Exemple #1
0
 void SendToCaller(mvResponse resp)
 {
     foreach (mvResponseMsgItem item in resp.GetItems().OfType<mvResponseMsgItem>())
     {
         Clients.Caller.msg(item.Message);
     }
 }
Exemple #2
0
        void SendResponse(mvResponse resp, IParty party)
        {
            if (user == null) return;
            var groupName = user.PartyId.ToString();
            var items = resp.GetItems();

            foreach (mvResponseMsgItem item in items.OfType<mvResponseMsgItem>())
            {
                Clients.Group(groupName).msg(item.Message);
            }

            foreach (mvResponseActionItem item in items.OfType<mvResponseActionItem>())
            {
                var args = item.Items;
                switch (item.ActionKind)
                {
                    case ActionKind.FullStatus:
                        if (party != null)
                            Clients.Group(groupName).setStatus(party.Data);
                        break;
                    case ActionKind.SelectBabu:
                        Clients.Group(groupName).processBabu(args[0]);
                        break;
                    case ActionKind.DrawBabuk:
                        Clients.Group(groupName).drawBabuk(args[0], args[1], args[2]);
                        break;
                    case ActionKind.UpdateCurrentPlayer:
                        Clients.Group(groupName).updateCurrentPlayer(args[0], args[1], args[2]);
                        break;
                    case ActionKind.TileRemoved:
                        Clients.Group(groupName).tileRemoved(args[0], args[1]);
                        break;
                    case ActionKind.RemoveIsolated:
                        Clients.Group(groupName).removeIsolated(args[0], args[1]);
                        break;
                    case ActionKind.RemoveBabu:
                        Clients.Group(groupName).removeBabu(args[0]);
                        break;
                    case ActionKind.LadaDeployed:
                        Clients.Group(groupName).ladaDeployed(args[0], args[1]);
                        break;
                    case ActionKind.WinterStart:
                        Clients.Group(groupName).winterStart(args[0]);
                        break;
                    case ActionKind.GameEnd:
                        Clients.Group(groupName).endGame(args[0]);
                        break;
                }
            }
        }