Esempio n. 1
0
 protected override void OnEnter(GameFramework.Fsm.IFsm <Player> fsm)
 {
     base.OnEnter(fsm);
     Log.Debug("PlayerStateEnterRoom Enter name={0}", fsm.Owner.name);
     fsm.Owner.OnEnterRoom();
     fsm.Owner.state = EPlayerState.Watch;
 }
Esempio n. 2
0
        protected override void OnUpdate(GameFramework.Fsm.IFsm <Player> fsm, float elapseSeconds, float realElapseSeconds)
        {
            base.OnUpdate(fsm, elapseSeconds, realElapseSeconds);
            //如果手牌数据有3个有效的(不为0)则翻牌算牌型
            if (fsm.Owner.handCardsData.Count > 0)
            {
                int validNum = 0;
                for (int i = 0; i < fsm.Owner.handCardsData.Count; i++)
                {
                    if (fsm.Owner.handCardsData[i] > 0)
                    {
                        validNum++;
                    }
                }

                if (!makingcard && validNum == fsm.Owner.handCardsData.Count)
                {
                    fsm.Owner.OnMakeHandCard();
                    makingcard = true;
                }

                if (makingcard && fsm.Owner.handCards.Count == fsm.Owner.handCardsData.Count)
                {
                    makingcard = false;
                    ChangeState <PlayerStateCardStyle>(fsm);
                }
            }
        }
Esempio n. 3
0
 protected override void OnUpdate(GameFramework.Fsm.IFsm <Player> fsm, float elapseSeconds, float realElapseSeconds)
 {
     base.OnUpdate(fsm, elapseSeconds, realElapseSeconds);
     if (fsm.Owner.handCardsData.Count == 3)
     {
         ChangeState <PlayerStatePlaying>(fsm);
     }
 }
Esempio n. 4
0
 protected override void OnUpdate(GameFramework.Fsm.IFsm <Player> fsm, float elapseSeconds, float realElapseSeconds)
 {
     base.OnUpdate(fsm, elapseSeconds, realElapseSeconds);
     if (fsm.Owner.state == EPlayerState.Seat)
     {
         ChangeState <PlayerStateSeat>(fsm);
     }
 }
Esempio n. 5
0
        protected override void OnEnter(GameFramework.Fsm.IFsm <Player> fsm)
        {
            base.OnEnter(fsm);
            fsm.Owner.OnShowCard();
            fsm.Owner.OnBid();

            Log.Debug("进入抢庄");
        }
Esempio n. 6
0
        protected override void OnEnter(GameFramework.Fsm.IFsm <Player> fsm)
        {
            base.OnEnter(fsm);
            fsm.Owner.OnShowCard();
            if (fsm.Owner.id.Value != RoomManager.Instance.rData.bid.Value)
            {
                fsm.Owner.OnBet();
            }

            Log.Debug("进入下注");
        }
Esempio n. 7
0
 protected override void OnUpdate(GameFramework.Fsm.IFsm <Player> fsm, float elapseSeconds, float realElapseSeconds)
 {
     base.OnUpdate(fsm, elapseSeconds, realElapseSeconds);
     if (fsm.Owner.state == EPlayerState.Bet)
     {
         ChangeState <PlayerStateBet>(fsm);
     }
     else if (fsm.Owner.state == EPlayerState.Deal)
     {
         //先抢庄再发牌
         ChangeState <PlayerStateDeal>(fsm);
     }
 }
Esempio n. 8
0
 protected override void OnUpdate(GameFramework.Fsm.IFsm <Player> fsm, float elapseSeconds, float realElapseSeconds)
 {
     base.OnUpdate(fsm, elapseSeconds, realElapseSeconds);
     if (fsm.Owner.state == EPlayerState.GamePrepare)
     {
         ChangeState <PlayerStateGameReady>(fsm);
     }
     else if (fsm.Owner.state == EPlayerState.Watch)
     {
         ChangeState <PlayerStateEnterRoom>(fsm);
     }
     else if (fsm.Owner.state == EPlayerState.End)
     {
         ChangeState <PlayerStateEnd>(fsm);
     }
 }
Esempio n. 9
0
        protected override void OnUpdate(GameFramework.Fsm.IFsm <Player> fsm, float elapseSeconds, float realElapseSeconds)
        {
            base.OnUpdate(fsm, elapseSeconds, realElapseSeconds);
//            if (CardManager.Instance.cardManagerState == CardManagerStates.Playing)
//            {
//                //先发牌再抢庄
//                fsm.Owner.state = EPlayerState.Banker;
//                ChangeState<PlayerStateBanker>(fsm);
//            }
            if (fsm.Owner.state == EPlayerState.Banker)
            {
                ChangeState <PlayerStateBanker>(fsm);
            }
            else if (fsm.Owner.state == EPlayerState.Bet)
            {
                ChangeState <PlayerStateBet>(fsm);
            }
        }
Esempio n. 10
0
    protected override void OnInit(object userData)
    {
        base.OnInit(userData);

        Fsm = UnityGameFramework.Runtime.GameEntry.GetComponent <FsmComponent>();

        /* 英雄的所有状态类 */
        FsmState <Demo10_HeroLogic>[] heroStates = new FsmState <Demo10_HeroLogic>[] {
            new Demo10_HeroIdleState(),
            new Demo10_HeroWalkState(),
        };

        /* 创建状态机 */
        m_HeroFsm = Fsm.CreateFsm <Demo10_HeroLogic> (this, heroStates);

        /* 启动站立状态 */
        m_HeroFsm.Start <Demo10_HeroIdleState> ();
    }
Esempio n. 11
0
    /// <summary>
    /// 初始化状态机
    /// </summary>
    private void InitFSM()
    {
        monsterStateFsm = GameEntry.Fsm.CreateFsm <Monster> ("monsterStateFsm" + this.Id, this, new FsmState <Monster>[] {
            new MonsterCDIdleState(),
            new MonsterAtkCDState(),
        });

        monsterActionFsm = GameEntry.Fsm.CreateFsm <Monster> ("monsterActionFsm" + this.Id, this, new FsmState <Monster>[] {
            new MonsterIdleState(),
            new MonsterWalkState(),
            new MonsterAtkState(),
            new MonsterHurtState(),
            new MonsterDeadState(),
        });

        /* 启动状态机 */
        monsterStateFsm.Start <MonsterCDIdleState> ();
        monsterActionFsm.Start <MonsterIdleState> ();
    }
Esempio n. 12
0
    /// <summary>
    /// 初始化状态机
    /// </summary>
    private void InitFSM()
    {
        /* 创建状态机 */
        heroStateFsm = GameEntry.Fsm.CreateFsm <Hero> ("heroStateFsm", this, new FsmState <Hero>[] {
            new HeroCDIdleState(),
            new HeroAtkCDState(),
        });

        heroActionFsm = GameEntry.Fsm.CreateFsm <Hero> ("heroActionFsm", this, new FsmState <Hero>[] {
            new HeroIdleState(),
            new HeroWalkState(),
            new HeroAtkState(),
            new HeroHurtState(),
            new HeroDeadState(),
        });

        /* 启动状态机 */
        heroStateFsm.Start <HeroCDIdleState> ();
        heroActionFsm.Start <HeroIdleState> ();
    }
        protected override void OnShow(object userData)
        {
            base.OnShow(userData);

            Debug.Log("Player已加载");



            // Player状态类
            FsmState <PlayerLogic>[] playerStates = new FsmState <PlayerLogic>[]
            {
                new PlayerIdleState(),
                new PlayerWalkState()
            };

            // 创建状态机
            m_PlayerFsm = GameEntry.Fsm.CreateFsm <PlayerLogic>(this, playerStates);

            // 启动站立状态
            m_PlayerFsm.Start <PlayerIdleState>();
        }
Esempio n. 14
0
 protected override void OnEnter(GameFramework.Fsm.IFsm <Player> fsm)
 {
     base.OnEnter(fsm);
     Log.Debug("PlayerStateInit Enter");
     ChangeState <PlayerStateEnterRoom>(fsm);
 }
Esempio n. 15
0
 protected override void OnLeave(GameFramework.Fsm.IFsm <Player> fsm, bool isShutdown)
 {
     base.OnLeave(fsm, isShutdown);
     fsm.Owner.bBiding.Value = false;
 }
Esempio n. 16
0
 protected override void OnEnter(GameFramework.Fsm.IFsm <Player> fsm)
 {
     base.OnEnter(fsm);
     Log.Debug("进入发牌表现");
     CardManager.Instance.DoDealCards();
 }
Esempio n. 17
0
 protected override void OnEnter(GameFramework.Fsm.IFsm <Player> fsm)
 {
     base.OnEnter(fsm);
     fsm.Owner.OnSeatPre();
     Log.Debug("进入准备入座");
 }
Esempio n. 18
0
 protected override void OnEnter(GameFramework.Fsm.IFsm <Player> fsm)
 {
     base.OnEnter(fsm);
     Log.Debug("PlayerStateSeat Enter name={0}", fsm.Owner.name);
     fsm.Owner.OnSeat();
 }
Esempio n. 19
0
 protected override void OnInit(GameFramework.Fsm.IFsm <Player> fsm)
 {
     base.OnInit(fsm);
     Log.Debug("PlayerStatePlaying OnInit name={0}", fsm.Owner.name);
 }
Esempio n. 20
0
 protected override void OnEnter(GameFramework.Fsm.IFsm <Player> fsm)
 {
     base.OnEnter(fsm);
     fsm.Owner.OnDeal();
     Log.Debug("开始接受服务器的牌数据");
 }
Esempio n. 21
0
 protected override void OnEnter(GameFramework.Fsm.IFsm <IProcedureManager> procedureOwner)
 {
     base.OnEnter(procedureOwner);
 }
Esempio n. 22
0
 protected override void OnEnter(GameFramework.Fsm.IFsm <Player> fsm)
 {
     base.OnEnter(fsm);
     fsm.Owner.OnStart();
     Log.Debug("游戏开始");
 }
Esempio n. 23
0
 protected override void OnLeave(GameFramework.Fsm.IFsm <Player> fsm, bool isShutdown)
 {
     base.OnLeave(fsm, isShutdown);
 }
Esempio n. 24
0
 protected override void OnInit(GameFramework.Fsm.IFsm <Player> fsm)
 {
     base.OnInit(fsm);
 }
Esempio n. 25
0
 protected override void OnEnter(GameFramework.Fsm.IFsm <Player> fsm)
 {
     base.OnEnter(fsm);
     fsm.Owner.OnCardStyle();
     Log.Debug("进入算分");
 }
Esempio n. 26
0
 protected override void OnUpdate(GameFramework.Fsm.IFsm <Player> fsm, float elapseSeconds, float realElapseSeconds)
 {
     base.OnUpdate(fsm, elapseSeconds, realElapseSeconds);
 }
Esempio n. 27
0
 protected override void OnDestroy(GameFramework.Fsm.IFsm <Player> fsm)
 {
     base.OnDestroy(fsm);
 }
Esempio n. 28
0
 protected override void OnEnter(GameFramework.Fsm.IFsm <Player> fsm)
 {
     base.OnEnter(fsm);
     fsm.Owner.OnGameReady();
     Log.Debug("{0}进入准备", fsm.Owner.name);
 }