Exemplo n.º 1
0
 private void Awake()
 {
     ui_DiceField = GetComponentInParent <UI_DiceField>();
 }
Exemplo n.º 2
0
        public void ShowAIField(bool isShow)
        {
            if (isShow)
            {
                var enemyPlayerState = _client.GetEnemyPlayerState();
                var tableManager     = TableManager.Get();
                var diceArr          = enemyPlayerState.Field.Select(f =>
                {
                    tableManager.DiceInfo.GetData(f.diceId, out var diceInfo);
                    return(new Dice()
                    {
                        diceFieldNum = f.index,
                        diceData = diceInfo
                    });
                }).ToArray();

                UI_DiceField.Get().SetField(diceArr);
                UI_DiceField.Get().RefreshField(0.5f);

                var deckArr = enemyPlayerState.Deck.Select(d =>
                {
                    TableManager.Get().DiceInfo.GetData(d.diceId, out var diceInfo);
                    return(diceInfo, d.inGameLevel);
                }).ToArray();

                UI_InGame.Get().SetArrayDeck(deckArr);
                int count = UI_InGame.Get().arrUpgradeButtons.Length;
                for (int i = 0; i < count; i++)
                {
                    UI_InGame.Get().arrUpgradeButtons[i].SetIconAlpha(0.5f);
                }

                _client.BindDeckUI(enemyPlayerState.userId);
            }
            else
            {
                var localPlayerState = _client.GetLocalPlayerState();
                var tableManager     = TableManager.Get();
                var diceArr          = localPlayerState.Field.Select(f =>
                {
                    tableManager.DiceInfo.GetData(f.diceId, out var diceInfo);
                    return(new Dice()
                    {
                        diceFieldNum = f.index,
                        diceData = diceInfo
                    });
                }).ToArray();

                UI_DiceField.Get().SetField(diceArr);
                UI_DiceField.Get().RefreshField();

                var deckArr = localPlayerState.Deck.Select(d =>
                {
                    TableManager.Get().DiceInfo.GetData(d.diceId, out var diceInfo);
                    return(diceInfo, d.inGameLevel);
                }).ToArray();

                UI_InGame.Get().SetArrayDeck(deckArr);
                int count = UI_InGame.Get().arrUpgradeButtons.Length;
                for (int i = 0; i < count; i++)
                {
                    UI_InGame.Get().arrUpgradeButtons[i].SetIconAlpha(0.5f);
                }

                _client.BindDeckUI(localPlayerState.userId);
            }
        }