예제 #1
0
        private void initUserPanel()
        {
            AccountInfoPacket p = ClientUIOverlord.getCurrentAcountInfo();
            int iconNumber      = int.Parse(p.Properties [AlbotDictKeys.icon]);

            playerSlot.setUserPanel(iconNumber, p.Username, false);
        }
예제 #2
0
        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);
        }
예제 #3
0
        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;
                }
            }
        }
예제 #4
0
        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])
                }
            });
        }
예제 #5
0
        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
            };
        }
예제 #6
0
        private static void setupLocalPlayers(PreGameSlotInfo[] slots)
        {
            ClientPlayersHandler.resetLocalPLayers();
            string localUsername = ClientUIOverlord.getCurrentAcountInfo().Username;

            foreach (PreGameSlotInfo slot in slots)
            {
                if (slot.belongsToPlayer == localUsername)
                {
                    addLocalPlayer(slot.type);
                }
            }
        }
예제 #7
0
        void Awake()
        {
            if (singleton != null && singleton != this)
            {
                Destroy(this.gameObject);
            }

            if (hasLoaded == true)
            {
                return;
            }

            StartCoroutine(setLoadedState());
            singleton                        = this;
            ClientLogin.LoggedIn            += onLoggedIn;
            Msf.Client.Auth.LoggedOut       += onLoggedOut;
            Msf.Client.Rooms.AccessReceived += joinedGame;
            DontDestroyOnLoad(clientLobbySuperParent);
        }
예제 #8
0
        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);
        }
예제 #9
0
        public virtual void initPreGameLobby(Sprite gameSprite, PreGameRoomMsg roomInfo)
        {
            gameObject.SetActive(true);
            gameCreator.setCurrentPreLobby(this);

            this.type             = roomInfo.specs.type;
            this.roomId           = roomInfo.specs.roomID;
            this.currentPlayers   = roomInfo.players;
            this.gameImage.sprite = gameSprite;
            this.gameTitle.SetText(roomInfo.specs.type.ToString());
            this.quitButton.SetActive(roomInfo.specs.isInTournament == false);
            isAdmin = roomInfo.specs.hostName == ClientUIOverlord.getCurrentAcountInfo().Username;

            setPlayerSlots(roomInfo.players);
            setAdminValues(isAdmin);
            extractLocalPlayerSlotId(roomInfo.players);
            loginTCPUI.startServerClicked(true);
            handlers.Add(Msf.Connection.SetHandler((short)ServerCommProtocl.UpdatePreGame, updatePreGameLobby));

            CurrentGame.setNewCurrentPreGame(roomInfo.specs);
        }
예제 #10
0
        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();
            }
        }
예제 #11
0
        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 };
 }