Beispiel #1
0
        private void AssignRandomTool(SelectScreenPlayerData playerData)
        {
            int toolIndex = Random.Range(1, System.Enum.GetNames(typeof(CharToolType)).Length);

            playerData.charTool = (CharToolType)toolIndex;
            csPanels[playerData.playerSessionData.playerIndex].UpdatePanel(playerData);
        }
Beispiel #2
0
        private void AssignRandomSkin(SelectScreenPlayerData playerData)
        {
            int skinIndex = Random.Range(0, characterSkins.GetSkinsCount());

            playerData.skinIndex = skinIndex;
            csPanels[playerData.playerSessionData.playerIndex].UpdatePanel(playerData);
        }
Beispiel #3
0
        public void ChangeSpiritName(int playerIndex, int step)
        {
            SelectScreenPlayerData playerData = selectScreenPlayerDatas[playerIndex];
            int currentIndex = playerData.spiritNameIndex;

            currentIndex = MMath.SumAllowFlow(currentIndex, step, 0, characterNames.GetSpiritNamesCount() - 1);
            playerData.spiritNameIndex = currentIndex;
            csPanels[playerIndex].UpdatePanel(playerData);
        }
Beispiel #4
0
        public void ChangeCharacterSkin(int playerIndex, int step)
        {
            SelectScreenPlayerData playerData = selectScreenPlayerDatas[playerIndex];
            int currentIndex = playerData.skinIndex;

            currentIndex         = MMath.SumAllowFlow(currentIndex, step, 0, characterSkins.GetSkinsCount() - 1);
            playerData.skinIndex = currentIndex;
            csPanels[playerData.playerSessionData.playerIndex].UpdatePanel(playerData);
        }
Beispiel #5
0
        private void AssignRandomNames(SelectScreenPlayerData playerData)
        {
            int devotionIndex = Random.Range(0, characterNames.GetDevotionNamesCount());
            int spiritIndex   = Random.Range(0, characterNames.GetSpiritNamesCount());

            playerData.devotionNameIndex = devotionIndex;
            playerData.spiritNameIndex   = spiritIndex;
            //Debug.Log($"indices {devotionIndex},{spiritIndex}");
            csPanels[playerData.playerSessionData.playerIndex].UpdatePanel(playerData);
        }
Beispiel #6
0
 public void CopyData(SelectScreenPlayerData ssPlayerData)
 {
     this.playerSessionData = ssPlayerData.playerSessionData;
     this.skinIndex         = ssPlayerData.skinIndex;
     this.devotionNameIndex = ssPlayerData.devotionNameIndex;
     this.spiritNameIndex   = ssPlayerData.spiritNameIndex;
     this.charTool          = ssPlayerData.charTool;
     this.playerActive      = ssPlayerData.playerActive;
     this.playerReady       = ssPlayerData.playerReady;
 }
Beispiel #7
0
        public void PlayerClickedCancel(int playerIndex)
        {
            SelectScreenPlayerData playerData = selectScreenPlayerDatas[playerIndex];

            if (playerData.playerReady)
            {
                playerData.playerReady = false;
                csPanels[playerIndex].UpdatePanel(playerData);
            }
            else
            {
                inputManager.RemovePlayer(playerIndex);
            }
        }
Beispiel #8
0
        public void SetPlayerReady(int playerIndex, bool isReady)
        {
            SelectScreenPlayerData playerData = selectScreenPlayerDatas[playerIndex];

            if (playerData.playerReady != isReady)
            {
                playerData.playerReady = isReady;
                csPanels[playerIndex].UpdatePanel(playerData);
                if (isReady)
                {
                    CheckIfAllPlayersAreReady();
                }
            }
        }
Beispiel #9
0
        private void OnPlayerRegistered(PlayerSessionData playerSessionData)
        {
            SelectScreenPlayerData ssPlayerData = new SelectScreenPlayerData();

            selectScreenPlayerDatas[playerSessionData.playerIndex] = ssPlayerData;
            ssPlayerData.playerSessionData = playerSessionData;
            ssPlayerData.playerActive      = true;
            ssPlayerData.playerReady       = false;
            AssignRandomNames(ssPlayerData);
            AssignRandomSkin(ssPlayerData);
            AssignRandomTool(ssPlayerData);
            csPanels[playerSessionData.playerIndex].Activate(playerSessionData.playerIndex, playerSessionData.uiInputManager);
            audioController.PlayEnter();
        }
Beispiel #10
0
        public void ChangeTool(int playerIndex, int step)
        {
            SelectScreenPlayerData playerData = selectScreenPlayerDatas[playerIndex];
            int currentToolIndex = (int)playerData.charTool;
            int length           = System.Enum.GetNames(typeof(CharToolType)).Length;

            currentToolIndex = MMath.SumAllowFlow(currentToolIndex, step, 0, length - 1);
            //Skip none
            if ((CharToolType)currentToolIndex == CharToolType.None)
            {
                int singleStep = (step < 0) ? -1 : 1;
                currentToolIndex = MMath.SumAllowFlow(currentToolIndex, singleStep, 0, length - 1);
            }
            playerData.charTool = (CharToolType)currentToolIndex;
            csPanels[playerIndex].UpdatePanel(playerData);
        }
Beispiel #11
0
        public void UpdatePanel(SelectScreenPlayerData playerData)
        {
            string devotionName = characterSelectScreen.characterNames.GetDevotionName(playerData.devotionNameIndex);

            devotionNameOptionSelect.UpdateText(devotionName);
            string spiritName = characterSelectScreen.characterNames.GetSpiritName(playerData.spiritNameIndex);

            spiritNameOptionSelect.UpdateText(spiritName);
            string toolName = playerData.charTool.ToString();

            toolOptionSelect.UpdateText(toolName);
            CharacterSkinData skinData = characterSelectScreen.characterSkins.GetSkinData(playerData.skinIndex);

            skinOptionSelect.UpdateImage(skinData.defaultImage);
            playerReadyObject.SetActive(playerData.playerReady);
            //Debug.Log(devotionName + " " + spiritName);
        }