コード例 #1
0
        public WheelInfo GetInstruction(SideInfo sideInfo)
        {
            var wheels = client.GetInstruction(sideInfo.ToProto());

            return(new WheelInfo {
                Wheels = (from w in wheels select w.ToNative()).ToArray()
            });
        }
コード例 #2
0
    public void UpdatePlayerInfo(pb.GS2CUpdateRoomInfo msg)
    {
        Debug.Log("UpdatePlayerInfo=> status:" + msg.status.ToString() + ", player count:" + msg.player.Count);
        switch (msg.status)
        {
        case pb.GS2CUpdateRoomInfo.Status.ADD:
            for (int i = 0; i < msg.player.Count; i++)
            {
                if (getPlayerIndexInList(msg.player[i].player.oid) != -1)
                {
                    Debug.LogError("List has contained the player [" + msg.player[i].player.nickName + "], don't need add.");
                }
                else
                {
                    SideInfo info = new SideInfo();
                    info.UpdateBattlePlayerInfo(msg.player[i]);
                    _playerPaiInfoList.Add(info);
                    Debug.Log("add player to room, oid=" + info.PlayerInfo.OID + ", side=" + msg.player[i].side);
                    EventDispatcher.TriggerEvent(EventDefine.UpdateRoleInRoom);
                }
            }
            break;

        case pb.GS2CUpdateRoomInfo.Status.REMOVE:
            for (int i = 0; i < msg.player.Count; i++)
            {
                int index = getPlayerIndexInList(msg.player[i].player.oid);
                if (index != -1)
                {
                    _playerPaiInfoList.RemoveAt(index);
                }
                else
                {
                    Debug.LogError("Dict doesn't contain the player [" + msg.player[i].player.nickName + "], can't remove.");
                }
            }
            break;

        case pb.GS2CUpdateRoomInfo.Status.UPDATE:
            for (int i = 0; i < msg.player.Count; i++)
            {
                int index = getPlayerIndexInList(msg.player[i].player.oid);
                if (index != -1)
                {
                    _playerPaiInfoList[index].UpdateBattlePlayerInfo(msg.player[i]);
                }
                else
                {
                    Debug.LogError("Dict doesn't contain the player [" + msg.player[i].player.nickName + "], can't update.");
                }
            }
            break;

        default:
            break;
        }
    }
コード例 #3
0
        public void Init(Data data, float cellSize, SideInfo info)
        {
            this.data     = data;
            this.cellSize = cellSize;
            this.info     = info;

            CheckData(data, info);

            Inited();
        }
コード例 #4
0
    public int GetExchangeCardCountBySide(pb.BattleSide side)
    {
        SideInfo sideInfo = getSideInfoBySide(side);

        if (sideInfo != null)
        {
            return(sideInfo.GetExchangeCardCount());
        }
        return(0);
    }
コード例 #5
0
    public pb.CardType GetExchangeTypeBySide(pb.BattleSide side)
    {
        SideInfo sideInfo = getSideInfoBySide(side);

        if (sideInfo != null)
        {
            return(sideInfo.GetExchangeType());
        }
        return(pb.CardType.None);
    }
コード例 #6
0
    public pb.CardType GetLackCardTypeBySide(pb.BattleSide side)
    {
        SideInfo sideInfo = getSideInfoBySide(side);

        if (sideInfo != null)
        {
            return(sideInfo.LackPaiType);
        }
        return(pb.CardType.None);
    }
コード例 #7
0
        public PlacementInfo GetPlacement(SideInfo sideInfo)
        {
            var placement = client.GetPlacement(sideInfo.ToProto());

            return(new PlacementInfo
            {
                Robots = (from rb in placement.Robots select rb.ToNative()).ToArray(),
                Ball = placement.Ball.ToNative()
            });
        }
コード例 #8
0
        public static V5RPC.Proto.Field ToProto(this SideInfo native)
        {
            var field = new V5RPC.Proto.Field();

            for (int i = 0; i < 5; i++)
            {
                field.SelfRobots.Add(native.home[i].ToProto());
                field.OpponentRobots.Add(native.opp[i].ToProto());
            }
            field.Ball = native.currentBall.ToProto();
            field.Tick = native.TickMatch;
            return(field);
        }
コード例 #9
0
ファイル: RoadEntity.cs プロジェクト: GameThree/GameAnimals
 public bool CanPutDown(SideInfo side, SideInfo other)
 {
     if (side.AllAnimalMoveOut())
     {
         var first = other.GetFirst();
         if (first)
         {
             return(RoadLength - first.moveDistance > 0.0005f);
         }
         return(true);
     }
     return(false);
 }
コード例 #10
0
    public void SetSide(Side side, bool on, BlockStyle style)
    {
        var map  = side.side == CellSide.South ? southSideMap : westSideMap;
        var cell = side.GetCell();

        if (on)
        {
            SideInfo info = new SideInfo();
            info.SetStyle(style);
            map[cell] = info;
        }
        else
        {
            map.Remove(cell);
        }
    }
コード例 #11
0
 public void SendOver(SideInfo sideInfo)
 {
     Conn.SendThenRecv(new Message(MessageType.MSG_destroy, sideInfo));
 }
コード例 #12
0
        public WheelInfo SendNext(SideInfo sideInfo)
        {
            var resp = Conn.SendThenRecv(new Message(MessageType.MSG_strategy, sideInfo));

            return((WheelInfo)resp.GetData());
        }
コード例 #13
0
        public PlacementInfo SendPlacement(SideInfo sideInfo)
        {
            var resp = Conn.SendThenRecv(new Message(MessageType.MSG_placement, sideInfo));

            return((PlacementInfo)resp.GetData());
        }
コード例 #14
0
 public void SendBegin(SideInfo sideInfo)
 {
     Conn.SendThenRecv(new Message(MessageType.MSG_create, sideInfo));
 }