Beispiel #1
0
        protected void Update()
        {
            if (player == null)
            {
                return;
            }

            if (canControl)
            {
                TurnEndButton.interactable = true;
                TurnEndButton.GetComponent <Image>().color = Color.white;
            }
            else
            {
                TurnEndButton.interactable = false;
                TurnEndButton.GetComponent <Image>().color = Color.gray;
            }

            THHPlayer opponent = game.getOpponent(player);

            if (opponent == null)
            {
                return;
            }
        }
Beispiel #2
0
        protected void Update()
        {
            if (_tipTimer.isExpired())
            {
                _tipTimer.reset();
                TipText.gameObject.SetActive(false);
            }
            else if (_tipTimer.isStarted)
            {
                TipText.color = new Color(TipText.color.r, TipText.color.g, TipText.color.b, 1 /*_tipTimer.getRemainedTime() / _tipTimer.duration*/);
            }

            if (game == null)
            {
                return;
            }

            if (player == null)
            {
                return;
            }
            SelfMaster.update(this, player, player.master, getSkin(player.master));
            if (player.skill != null)
            {
                SelfSkill.update(this, player, player, player.skill, getSkin(player.skill));
                SelfSkill.display();
            }
            else
            {
                SelfSkill.hide();
            }
            SelfGem.Text.text = player.gem.ToString();
            SelfHandList.updateItems(player.hand.ToArray(), (item, card) => item.Card.card == card, (item, card) =>
            {
                if (item.Card.isDisplaying)
                {
                    item.Card.update(card, getSkin(card));
                }
            });
            SelfHandList.sortItems((a, b) => player.hand.indexOf(a.Card.card) - player.hand.indexOf(b.Card.card));
            foreach (var servant in SelfFieldList)
            {
                servant.update(player, servant.card, getSkin(servant.card));
            }
            if (game.currentPlayer == player)
            {
                TurnEndButton.interactable = true;
                TurnEndButton.GetComponent <Image>().color = Color.white;
            }
            else
            {
                TurnEndButton.interactable = false;
                TurnEndButton.GetComponent <Image>().color = Color.gray;
            }

            THHPlayer opponent = game.getOpponent(player);

            if (opponent == null)
            {
                return;
            }
            EnemyMaster.update(this, opponent, opponent.master, getSkin(opponent.master));
            if (opponent.skill != null)
            {
                EnemySkill.update(this, player, opponent, opponent.skill, getSkin(opponent.skill));
                EnemySkill.display();
            }
            else
            {
                EnemySkill.hide();
            }
            EnemyGem.Text.text = opponent.gem.ToString();
            EnemyHandList.updateItems(opponent.hand.ToArray(), (item, card) => item.Card.card == card, (item, card) =>
            {
                item.Card.update(card, null);
            });
            EnemyHandList.sortItems((a, b) => opponent.hand.indexOf(a.Card.card) - opponent.hand.indexOf(b.Card.card));
            foreach (var servant in EnemyFieldList)
            {
                servant.update(opponent, servant.card, getSkin(servant.card));
            }

            IRequest request = game.answers.getLastRequest(player.id);

            if (request is InitReplaceRequest initReplace)
            {
                if (!InitReplaceDialog.isDisplaying)
                {
                    InitReplaceDialog.display();
                    InitReplaceDialog.InitReplaceCardList.clearItems();
                    InitReplaceDialog.InitReplaceCardList.updateItems(player.init, (i, c) => i.Card.card == c, (item, card) =>
                    {
                        item.Card.update(card, getSkin(card));
                        item.MarkImage.enabled = false;
                        item.asButton.onClick.RemoveAllListeners();
                        item.asButton.onClick.AddListener(() =>
                        {
                            item.MarkImage.enabled = !item.MarkImage.enabled;
                        });
                    });
                    InitReplaceDialog.InitReplaceCardList.sortItems((a, b) => player.init.indexOf(a.Card.card) - player.init.indexOf(b.Card.card));
                    InitReplaceDialog.ConfirmButton.interactable = true;
                    InitReplaceDialog.ConfirmButton.GetComponent <Image>().color = Color.white;
                    InitReplaceDialog.ConfirmButton.onClick.RemoveAllListeners();
                    InitReplaceDialog.ConfirmButton.onClick.AddListener(() =>
                    {
                        game.answers.answer(player.id, new InitReplaceResponse()
                        {
                            cardsId = InitReplaceDialog.InitReplaceCardList.Where(item => item.MarkImage.enabled).Select(item => item.Card.card.id).ToArray()
                        });
                        InitReplaceDialog.ConfirmButton.interactable = false;
                        InitReplaceDialog.ConfirmButton.GetComponent <Image>().color = Color.gray;
                    });
                }
            }
            else
            {
                InitReplaceDialog.hide();
            }

            if (_animationQueue.Count > 0)
            {
                Animation animation = _animationQueue[0];
                if (animation.update(this))
                {
                    _animationQueue.RemoveAt(0);
                }
            }
        }
Beispiel #3
0
        protected void Update()
        {
            if (_tipTimer.isExpired())
            {
                _tipTimer.reset();
                TipText.gameObject.SetActive(false);
            }
            else if (_tipTimer.isStarted)
            {
                TipText.color = new Color(TipText.color.r, TipText.color.g, TipText.color.b, 1 /*_tipTimer.getRemainedTime() / _tipTimer.duration*/);
            }

            if (game == null)
            {
                return;
            }
            if (game.turnTimer != null && game.turnTimer.remainedTime <= 15)
            {
                TimeoutSlider.display();
                TimeoutSlider.value = game.turnTimer.remainedTime / 15;
            }
            else
            {
                TimeoutSlider.hide();
            }

            if (player == null)
            {
                return;
            }
            if (player.skill != null)
            {
                SelfSkill.update(this, player, player, player.skill, getSkin(player.skill));
                SelfSkill.display();
            }
            else
            {
                SelfSkill.hide();
            }
            SelfGem.Text.text = player.gem.ToString();
            if (canControl)
            {
                TurnEndButton.interactable = true;
                TurnEndButton.GetComponent <Image>().color = Color.white;
            }
            else
            {
                TurnEndButton.interactable = false;
                TurnEndButton.GetComponent <Image>().color = Color.gray;
            }

            THHPlayer opponent = game.getOpponent(player);

            if (opponent == null)
            {
                return;
            }
            if (opponent.skill != null)
            {
                EnemySkill.update(this, player, opponent, opponent.skill, getSkin(opponent.skill));
                EnemySkill.display();
            }
            else
            {
                EnemySkill.hide();
            }
            EnemyGem.Text.text = opponent.gem.ToString();

            IRequest request = game.answers.getLastRequest(player.id);

            if (request is InitReplaceRequest initReplace)
            {
                if (!InitReplaceDialog.isDisplaying)
                {
                    InitReplaceDialog.display();
                    InitReplaceDialog.InitReplaceCardList.clearItems();
                    InitReplaceDialog.InitReplaceCardList.updateItems(player.init, (i, c) => i.Card.card == c, (item, card) =>
                    {
                        item.Card.update(card, getSkin(card));
                        item.MarkImage.enabled = false;
                        item.asButton.onClick.RemoveAllListeners();
                        item.asButton.onClick.AddListener(() =>
                        {
                            item.MarkImage.enabled = !item.MarkImage.enabled;
                        });
                    });
                    InitReplaceDialog.InitReplaceCardList.sortItems((a, b) => player.init.indexOf(a.Card.card) - player.init.indexOf(b.Card.card));
                    InitReplaceDialog.ConfirmButton.interactable = true;
                    InitReplaceDialog.ConfirmButton.GetComponent <Image>().color = Color.white;
                    InitReplaceDialog.ConfirmButton.onClick.RemoveAllListeners();
                    InitReplaceDialog.ConfirmButton.onClick.AddListener(() =>
                    {
                        game.answers.answer(player.id, new InitReplaceResponse()
                        {
                            cardsId = InitReplaceDialog.InitReplaceCardList.Where(item => item.MarkImage.enabled).Select(item => item.Card.card.id).ToArray()
                        });
                        InitReplaceDialog.ConfirmButton.interactable = false;
                        InitReplaceDialog.ConfirmButton.GetComponent <Image>().color = Color.gray;
                    });
                }
            }
            else
            {
                InitReplaceDialog.hide();
            }

            if (_animationQueue.Count > 0)
            {
                for (int i = 0; i < _animationQueue.Count; i++)
                {
                    Animation anim      = _animationQueue[i];
                    bool      isBlocked = i != 0;//第一个永远不被阻挡
                    for (int j = 0; j < i; j++)
                    {
                        Animation prevAnim = _animationQueue[j];
                        if (prevAnim.blockAnim(anim))
                        {
                            isBlocked = true;
                            break;
                        }
                    }
                    if (isBlocked)
                    {
                        continue;
                    }
                    if (anim.update(this))
                    {
                        _animationQueue.RemoveAt(i);
                        i--;
                    }
                }
            }
        }
Beispiel #4
0
    // Update is called once per frame
    void Update()
    {
        if (Input.GetKey(KeyCode.Keypad9))
        {
            cardFrameUV.GetComponent <UVScroll>().Action();
        }
        int a = 0; a++;


        if (Input.GetKey(KeyCode.Keypad0))
        {
            //remainingpoints.GetComponent<RemainingPoints>().Reset();
            UVMgr.GetComponent <UVEffectManager>().
            Action(UV_EFFECT_TYPE.BIG_DAMAGE, new Vector3(1, 0, 0), new Vector3(90, 0, 0));
        }

        if (Input.GetKey(KeyCode.Keypad1))
        {
            //remainingpoints.GetComponent<RemainingPoints>().NotRemaining(1);
            UVMgr.GetComponent <UVEffectManager>().
            Action(UV_EFFECT_TYPE.SKILL_LOSE, new Vector3(1, 0, 0), new Vector3(0, 0, 90));
        }

        if (Input.GetKey(KeyCode.Keypad2))
        {
            //remainingpoints.GetComponent<RemainingPoints>().NotRemaining(5);
        }

        if (Input.GetKey(KeyCode.Keypad3))
        {
            //remainingpoints.GetComponent<RemainingPoints>().NotRemaining(7);
        }

        if (Input.GetKey(KeyCode.Keypad4))
        {
            remainingpoints.GetComponent <RemainingPoints>().Remaining(1);
        }
        if (Input.GetKey(KeyCode.Keypad5))
        {
            remainingpoints.GetComponent <RemainingPoints>().Remaining(5);
        }
        if (Input.GetKey(KeyCode.Keypad6))
        {
            remainingpoints.GetComponent <RemainingPoints>().Remaining(7);
        }
        if (Input.GetKey(KeyCode.Keypad7))
        {
            remainingpoints.GetComponent <RemainingPoints>().TouchBegan();
        }
        if (Input.GetKey(KeyCode.Keypad8))
        {
            remainingpoints.GetComponent <RemainingPoints>().TouchEnded();
        }


        if (Input.GetKey(KeyCode.Q))
        {
            m_TurnEndButton.GetComponent <TurnEndButton>().Action(TurnEndButton.TURN_END_TYPE.NEXT);
        }
        if (Input.GetKey(KeyCode.W))
        {
            m_TurnEndButton.GetComponent <TurnEndButton>().Action(TurnEndButton.TURN_END_TYPE.SET_OK);
        }
        if (Input.GetKey(KeyCode.E))
        {
            m_TurnEndButton.GetComponent <TurnEndButton>().BackButton();
        }

        if (Input.GetKey(KeyCode.R))
        {
            LifePoints.GetComponent <LifePoint>().AddLP(-1);
        }
        if (Input.GetKey(KeyCode.T))
        {
            LifePoints.GetComponent <LifePoint>().AddLP(1);
        }
        if (Input.GetKey(KeyCode.Y))
        {
            LifePoints.GetComponent <LifePoint>().SetLP(250);
        }
        if (Input.GetKey(KeyCode.U))
        {
            LifePoints.GetComponent <LifePoint>().SetLP(40);
        }
        if (Input.GetKey(KeyCode.G))
        {
            LifePoints.GetComponent <LifePoint>().ActionDangerFlag();
        }
        if (Input.GetKey(KeyCode.H))
        {
            LifePoints.GetComponent <LifePoint>().StopDangerFlag();
        }
        // throw処理
        if (Input.GetKey(KeyCode.Z))
        {
            Card.GetComponent <ScreenOutAppeared>().Action();
            Card.GetComponent <ScreenOutAppeared>().SetPos(new Vector3(-10, 0, 0));
        }
        // throw処理
        if (Input.GetKey(KeyCode.X))
        {
            Card.GetComponent <ScreenOutAppeared>().Stop();
        }

        // throw処理
        if (Input.GetKey(KeyCode.C))
        {
            Card.GetComponent <Rotation>().Action();
            Card.GetComponent <Rotation>().SetAngle(new Vector3(0, 0, 0));
        }

        // throw処理
        if (Input.GetKey(KeyCode.V))
        {
            //UVEffect.GetComponent<UVScroll>().Action();
            UVMgr.GetComponent <UVEffectManager>().
            Action(UV_EFFECT_TYPE.UP_STATUS, new Vector3(1, 0, 0), new Vector3(0, 0, 90));
        }

        if (Input.GetKey(KeyCode.B))
        {
            //UVEffect.GetComponent<UVScroll>().Action();
            UVMgr.GetComponent <UVEffectManager>().
            Action(UV_EFFECT_TYPE.DOWN_STATUS, new Vector3(0, 0, 0), new Vector3(0, 0, 0));
        }

        if (Input.GetKey(KeyCode.N))
        {
            //UVEffect.GetComponent<UVScroll>().Action();
            UVMgr.GetComponent <UVEffectManager>().
            Action(UV_EFFECT_TYPE.SUMMON, new Vector3(0, 3, 0), new Vector3(0, 0, 0));
        }

        if (Input.GetKey(KeyCode.P))
        {
            //Panel.GetComponent<Animator>().enabled = true;

            //int iNameHashTag = 0;// 決め打ち
            //Panel.GetComponent<Animator>().Play(iNameHashTag/*"anim"*/, 0,0);

            PanelMgr.GetComponent <PanelEffectManager>().
            Action(PANEL_EFFECT_TYPE.ABILITY, new Vector3(0, 0, 0), new Vector3(0, 0, 0));
        }

        if (Input.GetKey(KeyCode.O))
        {
            //Panel.GetComponent<Animator>().enabled = true;

            //int iNameHashTag = 0;// 決め打ち
            //Panel.GetComponent<Animator>().Play(iNameHashTag/*"anim"*/, 0,0);

            PanelMgr.GetComponent <PanelEffectManager>().
            Action(PANEL_EFFECT_TYPE.DAMAGE, new Vector3(0, 0, 0), new Vector3(0, 0, 0));
        }
        if (Input.GetKey(KeyCode.I))
        {
            //Panel.GetComponent<Animator>().enabled = true;

            //int iNameHashTag = 0;// 決め打ち
            //Panel.GetComponent<Animator>().Play(iNameHashTag/*"anim"*/, 0,0);

            PanelMgr.GetComponent <PanelEffectManager>().
            Action(PANEL_EFFECT_TYPE.STAR, new Vector3(0, 0, 0), new Vector3(0, 0, 0));
        }
        if (Input.GetKey(KeyCode.U))
        {
            //Panel.GetComponent<Animator>().enabled = true;

            //int iNameHashTag = 0;// 決め打ち
            //Panel.GetComponent<Animator>().Play(iNameHashTag/*"anim"*/, 0,0);

            PanelMgr.GetComponent <PanelEffectManager>().
            Action(PANEL_EFFECT_TYPE.ORANGE_LIGHT, new Vector3(0, 0, 0), new Vector3(0, 0, 0));
        }


        if (Input.GetKey(KeyCode.Y))
        {
            ClickEf.SetActive(true);
            ClickEf.GetComponent <Animator>().Play(0, 0, 0.0f);
        }

        if (Input.GetKey(KeyCode.F))
        {
            TurnEndEffects.GetComponent <TurnEndEffects>().Action(PHASE_TYPE.BATTLE_START);
        }

        if (Input.GetKey(KeyCode.G))
        {
            TurnEndEffects.GetComponent <TurnEndEffects>().Action(PHASE_TYPE.BATTLE);
        }
        if (Input.GetKey(KeyCode.H))
        {
            TurnEndEffects.GetComponent <TurnEndEffects>().Action(PHASE_TYPE.WINNER);
        }
        if (Input.GetKey(KeyCode.J))
        {
            TurnEndEffects.GetComponent <TurnEndEffects>().Action(PHASE_TYPE.LOSER);
        }
        if (Input.GetKey(KeyCode.K))
        {
            TurnEndEffects.GetComponent <TurnEndEffects>().Stop();
        }
        Card.GetComponent <ScreenOutAppeared>().SelfUpdate();
        Card.GetComponent <Rotation>().SelfUpdate();
    }
Beispiel #5
0
 public void ToggleTurnEndButton(bool enabled)
 {
     _turnEndButton.GetComponent <Button>().interactable = enabled;
 }