46 import org.hedgewars.hedgeroid.frontlib.Frontlib.RoomCallback; |
46 import org.hedgewars.hedgeroid.frontlib.Frontlib.RoomCallback; |
47 import org.hedgewars.hedgeroid.frontlib.Frontlib.RoomListCallback; |
47 import org.hedgewars.hedgeroid.frontlib.Frontlib.RoomListCallback; |
48 import org.hedgewars.hedgeroid.frontlib.Frontlib.RoomPtr; |
48 import org.hedgewars.hedgeroid.frontlib.Frontlib.RoomPtr; |
49 import org.hedgewars.hedgeroid.frontlib.Frontlib.SchemeCallback; |
49 import org.hedgewars.hedgeroid.frontlib.Frontlib.SchemeCallback; |
50 import org.hedgewars.hedgeroid.frontlib.Frontlib.SchemePtr; |
50 import org.hedgewars.hedgeroid.frontlib.Frontlib.SchemePtr; |
51 import org.hedgewars.hedgeroid.frontlib.Frontlib.StrBoolCallback; |
|
52 import org.hedgewars.hedgeroid.frontlib.Frontlib.StrCallback; |
51 import org.hedgewars.hedgeroid.frontlib.Frontlib.StrCallback; |
53 import org.hedgewars.hedgeroid.frontlib.Frontlib.StrIntCallback; |
52 import org.hedgewars.hedgeroid.frontlib.Frontlib.StrIntCallback; |
54 import org.hedgewars.hedgeroid.frontlib.Frontlib.StrRoomCallback; |
53 import org.hedgewars.hedgeroid.frontlib.Frontlib.StrRoomCallback; |
|
54 import org.hedgewars.hedgeroid.frontlib.Frontlib.StrStrBoolCallback; |
55 import org.hedgewars.hedgeroid.frontlib.Frontlib.StrStrCallback; |
55 import org.hedgewars.hedgeroid.frontlib.Frontlib.StrStrCallback; |
56 import org.hedgewars.hedgeroid.frontlib.Frontlib.TeamCallback; |
56 import org.hedgewars.hedgeroid.frontlib.Frontlib.TeamCallback; |
57 import org.hedgewars.hedgeroid.frontlib.Frontlib.TeamPtr; |
57 import org.hedgewars.hedgeroid.frontlib.Frontlib.TeamPtr; |
58 import org.hedgewars.hedgeroid.frontlib.Frontlib.VoidCallback; |
58 import org.hedgewars.hedgeroid.frontlib.Frontlib.VoidCallback; |
59 import org.hedgewars.hedgeroid.frontlib.Frontlib.WeaponsetCallback; |
59 import org.hedgewars.hedgeroid.frontlib.Frontlib.WeaponsetCallback; |
126 if(conn == null) { |
126 if(conn == null) { |
127 shutdown(true, appContext.getString(R.string.error_connection_failed)); |
127 shutdown(true, appContext.getString(R.string.error_connection_failed)); |
128 return; |
128 return; |
129 } |
129 } |
130 |
130 |
131 // FLIB.flib_netconn_onAdminAccess(conn, adminAccessCb, null) |
|
132 FLIB.flib_netconn_onSchemeChanged(conn, cfgSchemeCb, null); |
131 FLIB.flib_netconn_onSchemeChanged(conn, cfgSchemeCb, null); |
|
132 FLIB.flib_netconn_onClientFlags(conn, clientFlagsCb, null); |
133 FLIB.flib_netconn_onChat(conn, chatCb, null); |
133 FLIB.flib_netconn_onChat(conn, chatCb, null); |
134 FLIB.flib_netconn_onConnected(conn, connectedCb, null); |
134 FLIB.flib_netconn_onConnected(conn, connectedCb, null); |
135 FLIB.flib_netconn_onDisconnected(conn, disconnectCb, null); |
135 FLIB.flib_netconn_onDisconnected(conn, disconnectCb, null); |
136 FLIB.flib_netconn_onEngineMessage(conn, engineMessageCb, null); |
136 FLIB.flib_netconn_onEngineMessage(conn, engineMessageCb, null); |
137 FLIB.flib_netconn_onEnterRoom(conn, enterRoomCb, null); |
137 FLIB.flib_netconn_onEnterRoom(conn, enterRoomCb, null); |
140 FLIB.flib_netconn_onLobbyJoin(conn, lobbyJoinCb, null); |
140 FLIB.flib_netconn_onLobbyJoin(conn, lobbyJoinCb, null); |
141 FLIB.flib_netconn_onLobbyLeave(conn, lobbyLeaveCb, null); |
141 FLIB.flib_netconn_onLobbyLeave(conn, lobbyLeaveCb, null); |
142 FLIB.flib_netconn_onMapChanged(conn, mapChangedCb, null); |
142 FLIB.flib_netconn_onMapChanged(conn, mapChangedCb, null); |
143 FLIB.flib_netconn_onMessage(conn, messageCb, null); |
143 FLIB.flib_netconn_onMessage(conn, messageCb, null); |
144 FLIB.flib_netconn_onPasswordRequest(conn, passwordRequestCb, null); |
144 FLIB.flib_netconn_onPasswordRequest(conn, passwordRequestCb, null); |
145 FLIB.flib_netconn_onReadyState(conn, readyStateCb, null); |
|
146 FLIB.flib_netconn_onRoomAdd(conn, roomAddCb, null); |
145 FLIB.flib_netconn_onRoomAdd(conn, roomAddCb, null); |
147 FLIB.flib_netconn_onRoomChiefStatus(conn, roomChiefStatusCb, null); |
|
148 FLIB.flib_netconn_onRoomDelete(conn, roomDeleteCb, null); |
146 FLIB.flib_netconn_onRoomDelete(conn, roomDeleteCb, null); |
149 FLIB.flib_netconn_onRoomJoin(conn, roomJoinCb, null); |
147 FLIB.flib_netconn_onRoomJoin(conn, roomJoinCb, null); |
150 FLIB.flib_netconn_onRoomLeave(conn, roomLeaveCb, null); |
148 FLIB.flib_netconn_onRoomLeave(conn, roomLeaveCb, null); |
151 FLIB.flib_netconn_onRoomlist(conn, roomlistCb, null); |
149 FLIB.flib_netconn_onRoomlist(conn, roomlistCb, null); |
152 FLIB.flib_netconn_onRoomUpdate(conn, roomUpdateCb, null); |
150 FLIB.flib_netconn_onRoomUpdate(conn, roomUpdateCb, null); |
190 public void callback(Pointer context, MapRecipePtr mapPtr, int updateType) { |
188 public void callback(Pointer context, MapRecipePtr mapPtr, int updateType) { |
191 sendFromNet(MSG_MAP_CHANGED, updateType, mapPtr.deref()); |
189 sendFromNet(MSG_MAP_CHANGED, updateType, mapPtr.deref()); |
192 } |
190 } |
193 }; |
191 }; |
194 |
192 |
195 private final BoolCallback roomChiefStatusCb = new BoolCallback() { |
|
196 public void callback(Pointer context, boolean chief) { |
|
197 sendFromNet(MSG_ROOM_CHIEF_STATUS_CHANGED, chief); |
|
198 } |
|
199 }; |
|
200 |
|
201 private final StrCallback scriptChangedCb = new StrCallback() { |
193 private final StrCallback scriptChangedCb = new StrCallback() { |
202 public void callback(Pointer context, String script) { |
194 public void callback(Pointer context, String script) { |
203 sendFromNet(MSG_SCRIPT_CHANGED, script); |
195 sendFromNet(MSG_SCRIPT_CHANGED, script); |
204 } |
196 } |
205 }; |
197 }; |
225 private final StrCallback roomJoinCb = new StrCallback() { |
217 private final StrCallback roomJoinCb = new StrCallback() { |
226 public void callback(Pointer context, String name) { |
218 public void callback(Pointer context, String name) { |
227 sendFromNet(MSG_ROOM_JOIN, name); |
219 sendFromNet(MSG_ROOM_JOIN, name); |
228 } |
220 } |
229 }; |
221 }; |
|
222 |
230 private final StrStrCallback roomLeaveCb = new StrStrCallback() { |
223 private final StrStrCallback roomLeaveCb = new StrStrCallback() { |
231 public void callback(Pointer context, String name, String message) { |
224 public void callback(Pointer context, String name, String message) { |
232 sendFromNet(MSG_ROOM_LEAVE, Pair.create(name, message)); |
225 sendFromNet(MSG_ROOM_LEAVE, Pair.create(name, message)); |
233 } |
226 } |
234 }; |
227 }; |
|
228 |
|
229 private final StrStrBoolCallback clientFlagsCb = new StrStrBoolCallback() { |
|
230 public void callback(Pointer context, String nick, String flags, boolean newFlagsState) { |
|
231 sendFromNet(MSG_CLIENT_FLAGS, new ClientFlagsUpdate(nick, flags, newFlagsState)); |
|
232 } |
|
233 }; |
|
234 |
235 private final StrStrCallback chatCb = new StrStrCallback() { |
235 private final StrStrCallback chatCb = new StrStrCallback() { |
236 public void callback(Pointer context, String name, String msg) { |
236 public void callback(Pointer context, String name, String msg) { |
237 sendFromNet(MSG_CHAT, Pair.create(name, msg)); |
237 sendFromNet(MSG_CHAT, Pair.create(name, msg)); |
238 } |
238 } |
239 }; |
239 }; |
289 }; |
289 }; |
290 |
290 |
291 private final IntStrCallback leaveRoomCb = new IntStrCallback() { |
291 private final IntStrCallback leaveRoomCb = new IntStrCallback() { |
292 public void callback(Pointer context, int reason, String message) { |
292 public void callback(Pointer context, int reason, String message) { |
293 sendFromNet(MSG_LEAVE_ROOM, reason, message); |
293 sendFromNet(MSG_LEAVE_ROOM, reason, message); |
294 } |
|
295 }; |
|
296 |
|
297 private final StrBoolCallback readyStateCb = new StrBoolCallback() { |
|
298 public void callback(Pointer context, String player, boolean ready) { |
|
299 sendFromNet(MSG_READYSTATE, Pair.create(player, ready)); |
|
300 } |
294 } |
301 }; |
295 }; |
302 |
296 |
303 private final TeamCallback teamAddedCb = new TeamCallback() { |
297 private final TeamCallback teamAddedCb = new TeamCallback() { |
304 public void callback(Pointer context, TeamPtr team) { |
298 public void callback(Pointer context, TeamPtr team) { |