示例#1
0
        public override void TurnUpdate()
        {
            if ((DateTime.Now - turnbeginTime).TotalMilliseconds < 5000)
            {
                return;
            }

            //ZConsole.LogLog(turnPhase);
            //ZConsole.LogLog(actionQueue.Count.ToString());
            switch (turnPhase)
            {
            case "begin":
                TurnAI();
                break;

            case "action":
                TurnAction();
                break;

            case "end":
                InputManager.Get().DoEndTurnButton();
                return;
            }
            if (EndTurnButton.Get().HasNoMorePlays())
            {
                turnPhase = "end";
            }
        }
 private void FindEndTurnButton()
 {
     this.m_EndTurnButton = EndTurnButton.Get();
     if (this.m_EndTurnButton != null)
     {
         this.m_EndTurnButtonTransform = this.m_EndTurnButton.transform;
     }
 }
 private void ChangeState_Timeout()
 {
     this.m_state = TurnTimerState.TIMEOUT;
     this.m_countdownEndTimestamp = 0f;
     if (EndTurnButton.Get() != null)
     {
         EndTurnButton.Get().OnTurnTimerEnded(this.m_currentTimerBelongsToFriendlySidePlayer);
     }
     this.StopCountdownAnims();
     this.UpdateCountdownAnims(0f);
 }
示例#4
0
        /// <summary>
        /// Get current Pegasus Game State.
        /// </summary>
        /// <returns>The RockPegasusGameState.</returns>
        public RockPegasusGameState GetPegasusGameState()
        {
            GameState state = GameState.Get();

            if (state.IsBusy())
            {
                return(RockPegasusGameState.Blocking);
            }
            else if (state.IsGameOver())
            {
                return(RockPegasusGameState.GameOver);
            }
            else if (state.IsResponsePacketBlocked())
            {
                return(RockPegasusGameState.Blocking);
            }
            else if (state.IsBlockingPowerProcessor())
            {
                return(RockPegasusGameState.Blocking);
            }
            else if (state.IsMulliganPhase())
            {
                if (state.IsMulliganManagerActive() == false || MulliganManager.Get() == null || MulliganManager.Get().GetMulliganButton() == null || MulliganManager.Get().GetMulliganButton().IsEnabled() == false)
                {
                    return(RockPegasusGameState.Blocking);
                }

                FieldInfo filedinfo = MulliganManager.Get().GetType().GetField("m_waitingForUserInput", BindingFlags.NonPublic | BindingFlags.Instance);
                bool      iswaiting = (bool)filedinfo.GetValue(MulliganManager.Get());
                if (!iswaiting)
                {
                    return(RockPegasusGameState.Blocking);
                }

                return(RockPegasusGameState.WaitForMulligan);
            }
            else if (state.IsMulliganPhasePending())
            {
                return(RockPegasusGameState.Blocking);
            }
            else if (state.IsFriendlySidePlayerTurn() == true)
            {
                if (EndTurnButton.Get().IsInWaitingState())
                {
                    return(RockPegasusGameState.Blocking);
                }

                return(RockPegasusGameState.WaitForPlay);
            }

            return(RockPegasusGameState.None);
        }
示例#5
0
        /// <summary>
        /// On WaitForAction state
        /// </summary>
        /// <returns>Seconds to be delayed before next call.</returns>
        private double OnRockAction()
        {
            if (EndTurnButton.Get().HasNoMorePlays())
            {
                this.ShowRockInfo("Job's Done");
                this.pegasus.DoEndTurn();
                this.currentAction = null;
                return(3);
            }

            if (this.currentAction == null || this.currentAction.IsDone() || !this.currentAction.IsValid())
            {
                var scene      = this.pegasus.SnapshotScene();
                var playAction = this.bot.GetPlayAction(scene);
                if (playAction.Objects != null && playAction.Objects.Count != 0)
                {
                    var rockActionContext = new RockEngineAction(this.pegasus, playAction.Objects, playAction.Slot);
                    if (rockActionContext.IsValid())
                    {
                        this.currentAction = rockActionContext;
                        this.ShowRockInfo(this.currentAction.Interpretation);
                    }
                    else
                    {
                        this.tracer.Warning("Invalid rockAction");
                    }
                }
                else
                {
                    this.ShowRockInfo("Job's Done");
                    this.pegasus.DoEndTurn();
                    return(3);
                }
            }

            if (this.currentAction != null && this.currentAction.IsValid())
            {
                this.currentAction.Apply();
            }

            return(1);
        }
示例#6
0
        public bool MoveNext()
        {
            uint num = (uint)this.$PC;

            this.$PC = -1;
            switch (num)
            {
            case 0:
                this.$current = new WaitForSeconds(0.25f);
                this.$PC      = 1;
                goto Label_00D6;

            case 1:
                if (TurnTimer.Get() != null)
                {
                    TurnTimer.Get().OnEndTurnRequested();
                }
                EndTurnButton.Get().m_EndTurnButtonMesh.GetComponent <Animation>()["ENDTURN_YOUR_TIMER_DONE"].speed = 0.7f;
                EndTurnButton.Get().OnTurnTimerEnded(true);
                this.$current = new WaitForSeconds(1f);
                this.$PC      = 2;
                goto Label_00D6;

            case 2:
                EndTurnButton.Get().m_EndTurnButtonMesh.GetComponent <Animation>()["ENDTURN_YOUR_TIMER_DONE"].speed = 1f;
                break;

            default:
                break;
                this.$PC = -1;
                break;
            }
            return(false);

Label_00D6:
            return(true);
        }
示例#7
0
        private void OnRockAI()
        {
            if (OnRocking)
            {
                return;
            }
            OnRocking = true;


            try
            {
                if (ActionRocking != null && ActionRocking.step == -1)
                {
                    ActionRocking = null;
                }
                if (ActionRocking != null)
                {
                    try
                    {
                        OnAction(ActionRocking);
                    }
                    catch
                    {
                        ActionRocking = null;
                    }
                    return;
                }

                // ActionRocking = should be null;

                HoldBack(250);
                if (EndTurnButton.Get().HasNoMorePlays())
                {
                    OnRockTurnEnd();
                    return;
                }

                RockAction action = HearthrockRobot.RockIt();

                if (action.type == HEARTHROCK_ACTIONTYPE.PLAY)
                {
                    SingletonEndTurn = false;
                    Notify("Play: " + action.card1.GetEntity().GetName() + "=>" + action.card1.GetEntity().GetCardId());
                    ActionRocking = action;
                }
                else if (action.type == HEARTHROCK_ACTIONTYPE.ATTACK)
                {
                    SingletonEndTurn = false;
                    Notify("Attack: " + action.card1.GetEntity().GetName() + " > " + action.card2.GetEntity().GetName());
                    ActionRocking = action;
                }
                else
                {
                    OnRockTurnEnd();
                }
            }
            catch (Exception e)
            {
                Log("OnRockAI ex " + e.ToString());
            }
            finally
            {
                OnRocking = false;
            }
        }
 private bool CheckCriticalAssetLoads()
 {
     if (!this.m_criticalAssetsLoaded)
     {
         if (Board.Get() == null)
         {
             return(false);
         }
         if (BoardCameras.Get() == null)
         {
             return(false);
         }
         if (BoardStandardGame.Get() == null)
         {
             return(false);
         }
         if (GameMgr.Get().IsTutorial() && (BoardTutorial.Get() == null))
         {
             return(false);
         }
         if (MulliganManager.Get() == null)
         {
             return(false);
         }
         if (TurnStartManager.Get() == null)
         {
             return(false);
         }
         if (TargetReticleManager.Get() == null)
         {
             return(false);
         }
         if (GameplayErrorManager.Get() == null)
         {
             return(false);
         }
         if (EndTurnButton.Get() == null)
         {
             return(false);
         }
         if (BigCard.Get() == null)
         {
             return(false);
         }
         if (CardTypeBanner.Get() == null)
         {
             return(false);
         }
         if (TurnTimer.Get() == null)
         {
             return(false);
         }
         if (CardColorSwitcher.Get() == null)
         {
             return(false);
         }
         if (RemoteActionHandler.Get() == null)
         {
             return(false);
         }
         if (ChoiceCardMgr.Get() == null)
         {
             return(false);
         }
         if (InputManager.Get() == null)
         {
             return(false);
         }
         this.m_criticalAssetsLoaded = true;
         this.ProcessQueuedPowerHistory();
     }
     return(true);
 }