RefreshAll() public method

public RefreshAll ( ) : void
return void
Esempio n. 1
0
        private void OnSelectBattleCmd(CoreMessage msg)
        {
            int player = msg.Reader.ReadByte();
            int count  = msg.Reader.ReadByte();

            msg.Reader.ReadBytes(count * 11);
            count = msg.Reader.ReadByte();
            msg.Reader.ReadBytes(count * 8 + 2);
            Game.RefreshAll();
            Game.WaitForResponse(player);
            SendToPlayer(msg, player);
        }
Esempio n. 2
0
        private void OnNewTurn(CoreMessage msg)
        {
            Game.TimeReset();
            if (!Game.IsTag)
            {
                Game.RefreshAll();
            }
            Game.CurrentPlayer = msg.Reader.ReadByte();
            SendToAll(msg);

            if (Game.IsTag && Game.TurnCount > 0)
            {
                if (Game.TurnCount % 2 == 0)
                {
                    if (Game.CurPlayers[0].Equals(Game.Players[0]))
                    {
                        Game.CurPlayers[0] = Game.Players[1];
                    }
                    else
                    {
                        Game.CurPlayers[0] = Game.Players[0];
                    }
                }
                else
                {
                    if (Game.CurPlayers[1].Equals(Game.Players[2]))
                    {
                        Game.CurPlayers[1] = Game.Players[3];
                    }
                    else
                    {
                        Game.CurPlayers[1] = Game.Players[2];
                    }
                }
            }
            Game.TurnCount++;
        }
Esempio n. 3
0
 private void OnNewPhase(CoreMessage msg)
 {
     msg.Reader.ReadInt16();
     SendToAll(msg);
     Game.RefreshAll();
 }
Esempio n. 4
0
        public int Analyse(GameMessage msg, BinaryReader reader, byte[] raw)
        {
            LastMessage = msg;
            CoreMessage cmsg = new CoreMessage(msg, reader, raw);

            switch (msg)
            {
            case GameMessage.Retry:
                OnRetry();
                return(1);

            case GameMessage.Hint:
                OnHint(cmsg);
                break;

            case GameMessage.Win:
                OnWin(cmsg);
                return(2);

            case GameMessage.SelectBattleCmd:
                OnSelectBattleCmd(cmsg);
                return(1);

            case GameMessage.SelectIdleCmd:
                OnSelectIdleCmd(cmsg);
                return(1);

            case GameMessage.SelectEffectYn:
                OnSelectEffectYn(cmsg);
                return(1);

            case GameMessage.SelectYesNo:
                OnSelectYesNo(cmsg);
                return(1);

            case GameMessage.SelectOption:
                OnSelectOption(cmsg);
                return(1);

            case GameMessage.SelectCard:
            case GameMessage.SelectTribute:
                OnSelectCard(cmsg);
                return(1);

            case GameMessage.SelectChain:
                return(OnSelectChain(cmsg));

            case GameMessage.SelectPlace:
            case GameMessage.SelectDisfield:
            case GameMessage.SelectPosition:
                OnSelectPlace(cmsg);
                return(1);

            case GameMessage.SelectCounter:
                OnSelectCounter(cmsg);
                return(1);

            case GameMessage.SelectSum:
                OnSelectSum(cmsg);
                return(1);

            case GameMessage.SortCard:
            case GameMessage.SortChain:
                OnSortCard(cmsg);
                return(1);

            case GameMessage.ConfirmDecktop:
                OnConfirmDecktop(cmsg);
                break;

            case GameMessage.ConfirmCards:
                OnConfirmCards(cmsg);
                break;

            case GameMessage.ShuffleDeck:
            case GameMessage.RefreshDeck:
                SendToAll(cmsg, 1);
                break;

            case GameMessage.ShuffleHand:
                OnShuffleHand(cmsg);
                break;

            case GameMessage.SwapGraveDeck:
                OnSwapGraveDeck(cmsg);
                break;

            case GameMessage.ReverseDeck:
                SendToAll(cmsg, 0);
                break;

            case GameMessage.DeckTop:
                SendToAll(cmsg, 6);
                break;

            case GameMessage.ShuffleSetCard:
                OnShuffleSetCard(cmsg);
                break;

            case GameMessage.NewTurn:
                OnNewTurn(cmsg);
                break;

            case GameMessage.NewPhase:
                OnNewPhase(cmsg);
                break;

            case GameMessage.Move:
                OnMove(cmsg);
                break;

            case GameMessage.PosChange:
                OnPosChange(cmsg);
                break;

            case GameMessage.Set:
                OnSet(cmsg);
                break;

            case GameMessage.Swap:
                SendToAll(cmsg, 16);
                break;

            case GameMessage.FieldDisabled:
                SendToAll(cmsg, 4);
                break;

            case GameMessage.Summoned:
            case GameMessage.SpSummoned:
            case GameMessage.FlipSummoned:
                SendToAll(cmsg, 0);
                Game.RefreshMonsters(0);
                Game.RefreshMonsters(1);
                Game.RefreshSpells(0);
                Game.RefreshSpells(1);
                break;

            case GameMessage.Summoning:
            case GameMessage.SpSummoning:
                SendToAll(cmsg, 8);
                break;

            case GameMessage.FlipSummoning:
                OnFlipSummoning(cmsg);
                break;

            case GameMessage.Chaining:
                SendToAll(cmsg, 16);
                break;

            case GameMessage.Chained:
                SendToAll(cmsg, 1);
                Game.RefreshAll();
                break;

            case GameMessage.ChainSolving:
                SendToAll(cmsg, 1);
                break;

            case GameMessage.ChainSolved:
                SendToAll(cmsg, 1);
                Game.RefreshAll();
                break;

            case GameMessage.ChainEnd:
                SendToAll(cmsg, 0);
                Game.RefreshAll();
                break;

            case GameMessage.ChainNegated:
            case GameMessage.ChainDisabled:
                SendToAll(cmsg, 1);
                break;

            case GameMessage.CardSelected:
                OnCardSelected(cmsg);
                break;

            case GameMessage.RandomSelected:
                OnRandomSelected(cmsg);
                break;

            case GameMessage.BecomeTarget:
                OnBecomeTarget(cmsg);
                break;

            case GameMessage.Draw:
                OnDraw(cmsg);
                break;

            case GameMessage.Damage:
            case GameMessage.Recover:
            case GameMessage.LpUpdate:
            case GameMessage.PayLpCost:
                OnLpUpdate(cmsg);
                break;

            case GameMessage.Equip:
                SendToAll(cmsg, 8);
                break;

            case GameMessage.Unequip:
                SendToAll(cmsg, 4);
                break;

            case GameMessage.CardTarget:
            case GameMessage.CancelTarget:
                SendToAll(cmsg, 8);
                break;

            case GameMessage.AddCounter:
            case GameMessage.RemoveCounter:
                SendToAll(cmsg, 7);
                break;

            case GameMessage.Attack:
                SendToAll(cmsg, 8);
                break;

            case GameMessage.Battle:
                SendToAll(cmsg, 26);
                break;

            case GameMessage.AttackDiabled:
                SendToAll(cmsg, 0);
                break;

            case GameMessage.DamageStepStart:
            case GameMessage.DamageStepEnd:
                SendToAll(cmsg, 0);
                Game.RefreshMonsters(0);
                Game.RefreshMonsters(1);
                break;

            case GameMessage.MissedEffect:
                OnMissedEffect(cmsg);
                break;

            case GameMessage.TossCoin:
            case GameMessage.TossDice:
                OnTossCoin(cmsg);
                break;

            case GameMessage.AnnounceRace:
                OnAnnounceRace(cmsg);
                return(1);

            case GameMessage.AnnounceAttrib:
                OnAnnounceAttrib(cmsg);
                return(1);

            case GameMessage.AnnounceCard:
                OnAnnounceCard(cmsg);
                return(1);

            case GameMessage.AnnounceNumber:
                OnAnnounceNumber(cmsg);
                return(1);

            case GameMessage.CardHint:
                SendToAll(cmsg, 9);
                break;

            case GameMessage.MatchKill:
                OnMatchKill(cmsg);
                break;

            case GameMessage.TagSwap:
                OnTagSwap(cmsg);
                break;

            default:
                throw new Exception("[GameAnalyser] Unhandled packet id: " + msg);
            }
            return(0);
        }