private void OnActionReceived(int connectionID, BoardActionMessage msg) { if (info.IsConnected(connectionID)) { NetworkTracker.ServerSendBoardAction(info.OtherConnectionID(connectionID), msg); } }
private void OnOpponentActionReceived(BoardActionMessage msg) { TurnAction action = new TurnAction(); action.searchPiece = msg.searchPiece; action.components = new List <TurnActionComponent>(); for (int i = 0; i < msg.components.Length; i++) { BoardActionMessageComponent c = msg.components[i]; action.components.Add(new TurnActionComponent() { type = c.type, actor = c.actor, target = c.target, promotionIndex = db.PieceNameToIndex(c.promotionPieceName), }); } opponentActionReceived.Send(action); }
private void SendTurnAction(TurnAction action) { BoardActionMessage msg = new BoardActionMessage(); msg.searchPiece = action.searchPiece; msg.components = new BoardActionMessageComponent[action.components.Count]; for (int i = 0; i < msg.components.Length; i++) { TurnActionComponent c = action.components[i]; msg.components[i] = new BoardActionMessageComponent() { type = c.type, actor = c.actor, target = c.target, promotionPieceName = db.PiecePrototypes[c.promotionIndex].LuaTag, }; } NetworkTracker.ClientSendBoardAction(msg); }
public static void ServerSendBoardAction(int connectionID, BoardActionMessage msg) { Instance.ServerSendMessage(connectionID, Msgs.BoardActionRelay, msg); }
public static void ClientSendBoardAction(BoardActionMessage msg) { Instance.ClientSendMessage(Msgs.BoardChooseAction, msg); }