public WheelInfo GetInstruction(SideInfo sideInfo) { var wheels = client.GetInstruction(sideInfo.ToProto()); return(new WheelInfo { Wheels = (from w in wheels select w.ToNative()).ToArray() }); }
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; } }
public void Init(Data data, float cellSize, SideInfo info) { this.data = data; this.cellSize = cellSize; this.info = info; CheckData(data, info); Inited(); }
public int GetExchangeCardCountBySide(pb.BattleSide side) { SideInfo sideInfo = getSideInfoBySide(side); if (sideInfo != null) { return(sideInfo.GetExchangeCardCount()); } return(0); }
public pb.CardType GetExchangeTypeBySide(pb.BattleSide side) { SideInfo sideInfo = getSideInfoBySide(side); if (sideInfo != null) { return(sideInfo.GetExchangeType()); } return(pb.CardType.None); }
public pb.CardType GetLackCardTypeBySide(pb.BattleSide side) { SideInfo sideInfo = getSideInfoBySide(side); if (sideInfo != null) { return(sideInfo.LackPaiType); } return(pb.CardType.None); }
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() }); }
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); }
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); }
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); } }
public void SendOver(SideInfo sideInfo) { Conn.SendThenRecv(new Message(MessageType.MSG_destroy, sideInfo)); }
public WheelInfo SendNext(SideInfo sideInfo) { var resp = Conn.SendThenRecv(new Message(MessageType.MSG_strategy, sideInfo)); return((WheelInfo)resp.GetData()); }
public PlacementInfo SendPlacement(SideInfo sideInfo) { var resp = Conn.SendThenRecv(new Message(MessageType.MSG_placement, sideInfo)); return((PlacementInfo)resp.GetData()); }
public void SendBegin(SideInfo sideInfo) { Conn.SendThenRecv(new Message(MessageType.MSG_create, sideInfo)); }