Пример #1
0
        public void AnalysisFrameData()
        {
            FrameMessage = new Dictionary <int, PlaybackFrameData>();
            PlayerCards  = new Dictionary <int, PlaybackFrameData>();

            //解析回放数据
            for (int i = 0; i < ReplayData.Count; i++)
            {
                int index = FrameMessage.Count;
                FrameMessage.Add(index, new PlaybackFrameData(ReplayData[i].ToString()));
            }

            //添加自定义消息 GameOver
            var frameIndex = FrameMessage.Count;
            var frameData  = new PlaybackFrameData();

            frameData.SetFramePorocol(PlaybackProtocol.GameOver);
            FrameMessage.Add(frameIndex, frameData);

            foreach (var item in FrameMessage)
            {
                if (item.Value.Porocol == PlaybackProtocol.Allowcate)
                {
                    PlayerCards.Add(item.Value.OpChair, item.Value);
                }
            }
        }
Пример #2
0
 public void SetLastFrameData(PlaybackFrameData lastFrame)
 {
     if (lastFrame != null)
     {
         //避免循环引用
         lastFrame.LastFrameData = null;
         LastFrameData           = lastFrame;
     }
 }
Пример #3
0
        public void PlaybackZhuaGang(PlaybackFrameData data)
        {
            var card  = data.Cards[0];
            var group = Game.MahjongGroups;

            group.MahjongHandWall[data.OpChair].RemoveMahjong(card);
            // 设置吃碰杠
            group.MahjongCpgs[data.OpChair].SetZhuaGang(card);

            PlayEffect(data.OpChair, PoolObjectType.gang);
        }
Пример #4
0
        public void PlaybackZhaNiao(PlaybackFrameData data)
        {
            if (!mZhaniaoFlag)
            {
                mZhaniaoFlag = true;

                var zhongMaList = new List <int>();
                zhongMaList.AddRange(data.Cards);
                GameCenter.Hud.GetPanel <PanelExhibition>().Open(zhongMaList);
            }
        }
Пример #5
0
        public void OnReset()
        {
            mPauseFlag     = true;
            mLastFrameData = null;
            mCurrFrame     = mFrameMixLimit;

            foreach (var item in mGameResponseCommands)
            {
                item.Value.OnReset();
            }
        }
Пример #6
0
        private void SetCpgLayout(PlaybackFrameData data, List <int> removeCards, CpgModel cpg)
        {
            var lastFrameData = data.LastFrameData;
            var outCard       = lastFrameData.Cards[0];

            var group = Game.MahjongGroups;

            group.MahjongThrow[lastFrameData.OpChair].PopMahjong(outCard);
            Game.TableManager.GetParts <MahjongOutCardFlag>(TablePartsType.OutCardFlag).Hide();
            // 移除当前操作玩家手牌
            group.MahjongHandWall[data.OpChair].RemoveMahjong(removeCards);
            // 设置吃碰杠
            group.MahjongCpgs[data.OpChair].SetCpg(cpg);
        }
Пример #7
0
        public void PlaybackGameOver(PlaybackFrameData data)
        {
            if (!mHuFlag)
            {
                mHuFlag = true;
                var playerCount = GameCenter.DataCenter.MaxPlayerCount;
                var resultData  = new PlaybackResultDate();
                var group       = Game.MahjongGroups;

                List <int> cards;
                List <MahjongContainer> mahjongs;
                //收集手牌
                for (int i = 0; i < playerCount; i++)
                {
                    mahjongs = group.MahjongHandWall[i].MahjongList;
                    cards    = GameUtils.ConverToCards(mahjongs);
                    resultData.SetHandCard(cards, i);
                }
                //收集胡牌
                for (int i = 0; i < playerCount; i++)
                {
                    mahjongs = group.MahjongOther[i].MahjongList;
                    if (mahjongs.Count > 0)
                    {
                        cards = GameUtils.ConverToCards(mahjongs);
                        resultData.SetHucardList(cards, i);
                    }
                }
                //收集cpg
                for (int i = 0; i < playerCount; i++)
                {
                    var cpgItems = group.MahjongCpgs[i].CpgItemList;
                    if (cpgItems.Count > 0)
                    {
                        var cpgs = new List <CpgModel>();
                        for (int j = 0; j < cpgItems.Count; j++)
                        {
                            cpgs.Add(cpgItems[j].Model);
                        }
                        resultData.SetCpgModels(cpgs, i);
                    }
                }
                GameCenter.Hud.GetPanel <PanelPlaybackResult>().Open(resultData);
            }
            else
            {
                GameCenter.Hud.GetPanel <PanelPlaybackResult>().Open();
            }
        }
Пример #8
0
        public void PlaybackZimo(PlaybackFrameData data)
        {
            var huChair = data.OpChair;
            var huCard  = data.Cards[0];

            Game.MahjongGroups.MahjongHandWall[huChair].PopMahjong();

            var item = Game.MahjongCtrl.PopMahjong(huCard);

            Game.MahjongGroups.MahjongOther[huChair].GetInMahjong(item);
            Game.TableManager.ShowOutcardFlag(item);
            item.gameObject.SetActive(true);

            PlayEffect(data.OpChair, PoolObjectType.zimo);
        }
Пример #9
0
        public void PlaybackMingGang(PlaybackFrameData data)
        {
            var card     = data.Cards[0];
            var allCards = new List <int>()
            {
                card, card, card, card
            };
            var removeCards = new List <int>()
            {
                card, card, card
            };
            var cpg = new CpgModel()
            {
                Cards = allCards
            };

            SetCpgLayout(data, removeCards, cpg);
            PlayEffect(data.OpChair, PoolObjectType.gang);
        }
Пример #10
0
        /// <summary>
        /// 执行
        /// </summary>
        protected void Execute(PlaybackFrameData message)
        {
            if (message == null)
            {
                return;
            }

            Action <PlaybackFrameData> handler;

            if (mPlacbackHandlers.TryGetValue(message.Porocol, out handler))
            {
                // 显示dxnb
                GameCenter.Scene.TableManager.SwitchDirection(message.OpChair);

                message.SetLastFrameData(mLastFrameData);
                mLastFrameData = message;
                handler(message);
            }
        }
Пример #11
0
        public void PlaybackAnGang(PlaybackFrameData data)
        {
            var card     = data.Cards[0];
            var allCards = new List <int>()
            {
                card, card, card, card
            };

            var group = Game.MahjongGroups;

            group.MahjongHandWall[data.OpChair].RemoveMahjong(allCards);
            var cpg = new CpgModel()
            {
                Cards = allCards,
                Hide  = true
            };

            group.MahjongCpgs[data.OpChair].SetCpg(cpg);

            PlayEffect(data.OpChair, PoolObjectType.gang);
        }
Пример #12
0
        public void PlaybackHu(PlaybackFrameData data)
        {
            var paoChair = data.LastFrameData.OpChair;
            var huChair  = data.OpChair;
            var huCard   = data.Cards[0];

            var effect    = MahjongUtility.PlayMahjongEffect(PoolObjectType.shandian);
            var targetPos = Game.MahjongGroups.MahjongThrow[paoChair].GetLastMjPos();

            effect.transform.position = targetPos;
            effect.Execute();
            MahjongUtility.PlayEnvironmentSound("shandian");

            var item = Game.MahjongCtrl.PopMahjong(huCard);

            Game.MahjongGroups.MahjongOther[huChair].GetInMahjong(huCard);
            Game.TableManager.ShowOutcardFlag(item);
            item.gameObject.SetActive(true);

            PlayEffect(data.OpChair, PoolObjectType.hu);
        }
Пример #13
0
        public void PlaybackChi(PlaybackFrameData data)
        {
            var allCards    = data.Cards;
            var removeCards = new List <int>();

            for (int i = 0; i < allCards.Count; i++)
            {
                var card = allCards[i];
                //过滤
                if (card != data.LastFrameData.Cards[0])
                {
                    removeCards.Add(card);
                }
            }

            allCards.Sort();
            SetCpgLayout(data, removeCards, new CpgModel()
            {
                Cards = allCards
            });
            PlayEffect(data.OpChair, PoolObjectType.chi);
        }
Пример #14
0
 public void PlaybackSendCard(PlaybackFrameData data)
 {
     LogicAction.PlaybackSendCard(data);
 }
Пример #15
0
 public void OnReset()
 {
     LastFrameData = null;
 }
Пример #16
0
 public void PlaybackLiuju(PlaybackFrameData data)
 {
     Game.TableManager.HideOutcardFlag();
 }
Пример #17
0
 public void PlaybackTing(PlaybackFrameData data)
 {
     PlayEffect(data.OpChair, PoolObjectType.ting);
 }