private void initUserPanel() { AccountInfoPacket p = ClientUIOverlord.getCurrentAcountInfo(); int iconNumber = int.Parse(p.Properties [AlbotDictKeys.icon]); playerSlot.setUserPanel(iconNumber, p.Username, false); }
public void createNewGame(MapSelection selectedMap) { currentMap = selectedMap; AccountInfoPacket currentUser = ClientUIOverlord.getCurrentAcountInfo(); PreGameSpecs msg = ServerUtils.generateGameSpecs(selectedMap.type, currentUser.Username, true, true); Msf.Connection.SendMessage((short)ServerCommProtocl.CreatePreGame, msg, handleCreatedGameResponse); }
public static void addHuman() { AccountInfoPacket playerInfo = ClientUI.ClientUIOverlord.getCurrentAcountInfo(); ClientPlayersHandler.addPlayer(false, true, new AlbotServer.PlayerInfo { username = "******", iconNumber = int.Parse(playerInfo.Properties [AlbotDictKeys.icon]) }); }
/// <summary> /// Fired when msf user is successfully signed in in test mode /// </summary> /// <param name="accountInfo"></param> /// <param name="error"></param> protected virtual void OnSignInCallbackHandler(AccountInfoPacket accountInfo, string error) { if (accountInfo == null) { logger.Error(error); return; } StartClient(); }
private void extractLocalPlayerSlotId(PreGameSlotInfo[] players) { AccountInfoPacket p = ClientUIOverlord.getCurrentAcountInfo(); for (int i = 0; i < players.Length; i++) { if (players [i].playerInfo.username == p.Username) { playerId = i; } } }
private PreGameJoinRequest getJoinRequest(GameInfoType roomType, string roomID) { AccountInfoPacket ac = ClientUIOverlord.getCurrentAcountInfo(); return(new PreGameJoinRequest() { roomID = roomID, joiningPlayer = new PlayerInfo { username = ac.Username, iconNumber = int.Parse(ac.Properties[AlbotDictKeys.icon]) } }); }
private void initPlayerInfos() { AccountInfoPacket ac = ClientUIOverlord.getCurrentAcountInfo(); localInfo = new PlayerInfo() { username = ac.Username, iconNumber = int.Parse(ac.Properties[AlbotDictKeys.icon]) }; p2Slot = new PreGameSlotInfo() { slotID = 1, playerInfo = localInfo }; }
public static void setUIState(ClientUIStates state) { switch (state) { case ClientUIStates.LobbyBrowser: setMenuPanels(false, true, false); setLobbyPanels(false, true, false); break; case ClientUIStates.GameLobby: setMenuPanels(false, true, false); setLobbyPanels(true, false, false); currentAcountInfo = Msf.Client.Auth.AccountInfo; break; case ClientUIStates.PreGame: setMenuPanels(false, true, false); setLobbyPanels(false, false, false); break; case ClientUIStates.LoginMenu: setMenuPanels(true, false, false); setLobbyPanels(false, false, false); break; case ClientUIStates.PreTournament: setMenuPanels(false, false, false); setLobbyPanels(false, false, true); break; case ClientUIStates.PlayingTournament: case ClientUIStates.PlayingGame: setMenuPanels(false, false, false); setLobbyPanels(false, false, false); break; } if (state != ClientUIStates.PlayingGame) { dissconnectFromGameRoom(); } currentState = state; if (onUIStateChanged != null) { onUIStateChanged.Invoke(state); } }
/// <summary> /// Initiates a log out. In the process, disconnects and connects /// back to the server to ensure no state data is left on the server. /// </summary> public void LogOut() { if (!IsLoggedIn) { return; } IsLoggedIn = false; AccountInfo = null; if (Client != null && Client.IsConnected) { Client.Reconnect(); } }
private void OnSignedInAsGuest(AccountInfoPacket accountInfo, string error) { Msf.Events.Invoke(EventKeys.hideLoadingInfo); if (accountInfo == null) { Msf.Events.Invoke(EventKeys.showOkDialogBox, new OkDialogBoxViewEventMessage(error)); logger.Error(error); return; } mainView?.Show(); logger.Info("Successfully signed in!"); }
/// <summary> /// Initiates a log out. In the process, disconnects and connects /// back to the server to ensure no state data is left on the server. /// </summary> public void LogOut(IClientSocket connection) { if (!IsLoggedIn) { return; } IsLoggedIn = false; AccountInfo = null; if ((connection != null) && connection.IsConnected) { connection.Reconnect(); } LoggedOut?.Invoke(); }
/// <summary> /// Sends a generic login request /// </summary> public void LogIn(Dictionary <string, string> data, LoginCallback callback) { if (!Connection.IsConnected) { callback.Invoke(null, "Not connected to server"); return; } _isLoggingIn = true; // We first need to get an aes key // so that we can encrypt our login data _securityPlugin.GetAesKey(aesKey => { if (aesKey == null) { _isLoggingIn = false; callback.Invoke(null, "Failed to log in due to security issues"); return; } var encryptedData = Util.EncryptAES(data.ToBytes(), aesKey); Connection.SendMessage((short)OpCodes.LogIn, encryptedData, (status, response) => { _isLoggingIn = false; if (status != ResponseStatus.Success) { callback.Invoke(null, response.AsString("Unknown error")); return; } IsLoggedIn = true; AccountInfo = response.Deserialize(new AccountInfoPacket()); callback.Invoke(AccountInfo, null); LoggedIn?.Invoke(); }); }); }
private void handleJoinPreGameMsg(ResponseStatus status, IIncommingMessage rawMsg) { if (Msf.Helper.serverResponseSuccess(status, rawMsg) == false) { return; } PreGameRoomMsg msg = rawMsg.Deserialize <PreGameRoomMsg> (); currentMap = GameSelectionUI.getMatchingMapSelection(msg.specs.type); AccountInfoPacket playerInfo = ClientUIOverlord.getCurrentAcountInfo(); bool isAdmin = playerInfo.Username == msg.players [0].playerInfo.username; ClientUIStateManager.requestGotoState(ClientUIStates.PreGame); //Kill old TCP Connection TCPLocalConnection.stopServer(); preGameLobby.initPreGameLobby(currentMap.picture, msg); }
private void onUiStateChanged(ClientUIStates state) { bool exitedChat = false, enteredChat = false; if (state == ClientUIStates.GameLobby || state == ClientUIStates.PreGame) { if (isCurrentlyInChat == false) { enteredChat = true; isCurrentlyInChat = true; } } else if (isCurrentlyInChat) { exitedChat = true; isCurrentlyInChat = false; } AccountInfoPacket currentAcountInfo = ClientUIOverlord.getCurrentAcountInfo(); AlbotChatMsg msg = new AlbotChatMsg() { icon = int.Parse(currentAcountInfo.Properties [AlbotDictKeys.icon]), username = currentAcountInfo.Username }; if (enteredChat) { for (int i = MessagesList.transform.childCount; i > 1; i--) { Destroy(MessagesList.transform.GetChild(i - 1).gameObject); } Msf.Connection.SendMessage((short)ServerCommProtocl.LobbyPlayerEnter, msg); } else if (exitedChat) { Msf.Connection.SendMessage((short)ServerCommProtocl.LobbyPlayerLeft, msg); clearList(); } }
private void activateSinglePlayerLobby() { gameSelectionLobby.SetActive(false); singlePlayerLobby.SetActive(true); PreGameBaseLobby lobby = singlePlayerLobby.GetComponent <PreGameBaseLobby>(); AccountInfoPacket currentUser = ClientUI.ClientUIOverlord.getCurrentAcountInfo(); PlayerInfo playerInfo = new PlayerInfo() { iconNumber = int.Parse(currentUser.Properties[AlbotDictKeys.icon]), username = currentUser.Username }; PreGameSlotInfo[] players = new PreGameSlotInfo[] { new PreGameSlotInfo() { playerInfo = playerInfo, slotID = 0 }, new PreGameSlotInfo() { playerInfo = playerInfo, slotID = 1, isReady = true } }; PreGameSpecs specs = new PreGameSpecs() { type = gameMap.type, hostName = ClientUIOverlord.getCurrentAcountInfo().Username }; PreGameRoomMsg roomInfo = new PreGameRoomMsg() { players = players, specs = specs }; AnneHacks.startSinglePlayerLobby(lobby, gameMap); lobby.initPreGameLobby(gameMap.picture, roomInfo); }
private AlbotChatMsg getChatSpecsMsg() { AccountInfoPacket currentAcountInfo = ClientUIOverlord.getCurrentAcountInfo(); return new AlbotChatMsg() { icon = int.Parse(currentAcountInfo.Properties[AlbotDictKeys.icon]), username = currentAcountInfo.Username }; }