public override void HandleComponentState(ComponentState?curState, ComponentState?nextState)
        {
            if (curState is not HandsComponentState state)
            {
                return;
            }

            Hands.Clear();

            foreach (var handState in state.Hands)
            {
                var newHand = new Hand(handState.Name, handState.Location);
                Hands.Add(newHand);
            }

            ActiveHand = state.ActiveHand;

            HandsModified();
        }
Example #2
0
 //每小局要清空的数据
 public void LittleRoundClearData()
 {
     Hands.Clear();
     MoCardCount       = 0;     //摸牌的次数 只有AI才会记录
     IsAlreadyDaPiao   = false; //是否已经打过漂
     MoEndHand         = -1;    //摸的最后一张手牌
     SmallGangScore    = 0;     //小局杠牌得分
     ReadyState        = false; //玩家准备状态
     IsCanPlayCard     = false; //是否可以出牌
     LiangDaoNoneCards = null;  //亮倒无关的牌
     PlayCards.Clear();         //出牌信息
     foreach (var operateInfo in OperateInfos)
     {
         operateInfo.Dispose();
     }
     OperateInfos.Clear(); //碰杠信息
     PiaoNum    = 0;       //漂的分数
     IsLiangDao = false;   //是否亮倒
     IsRestIn   = false;   //是否休息中
 }
        public override void HandleComponentState(ComponentState?curState, ComponentState?nextState)
        {
            if (curState is not HandsComponentState state)
            {
                return;
            }

            Hands.Clear();

            foreach (var handState in state.Hands)
            {
                var newHand = new Hand(handState.Name, handState.Enabled, handState.Location);
                Hands.Add(newHand);
            }
            ActiveHand = state.ActiveHand;

            UpdateHandContainers();
            UpdateHandVisualizer();
            UpdateHandsGuiState();
        }
Example #4
0
        public override void HandleComponentState(ComponentState?curState, ComponentState?nextState)
        {
            if (curState is not HandsComponentState state)
            {
                return;
            }

            Hands.Clear();

            foreach (var handState in state.Hands)
            {
                var newHand = new Hand(handState.Name, handState.Location);
                Hands.Add(newHand);
            }

            ActiveHand = state.ActiveHand;

            UpdateHandContainers();
            UpdateHandVisualizer();
            Owner.EntityManager.EventBus.RaiseEvent(EventSource.Local, new HandsModifiedMessage {
                Hands = this
            });
        }