public void PollNewMessages() { trace.TraceVerbose("PollNewMessages"); if (this.Player != null) { Message msg; while (m_connection.TryGetMessage(out msg)) { trace.TraceVerbose("OnReceiveMessage({0})", msg); bool handled = DispatchMessage(msg); if (!handled) { this.Player.DispatchMessage(msg); } } } if (!m_connection.IsConnected) { trace.TraceInformation("PollNewMessages, disconnected"); OnDisconnected(); } }
bool IsTimeToStartTick() { VerifyAccess(); bool r = _IsTimeToStartTick(); trace.TraceVerbose("IsTimeToStartTick = {0}", r); return(r); }
void UpdateTileLayout(Size renderSize) { var tileSize = this.TileSize; bool gridSizeChanged = UpdateGridSize(renderSize, tileSize); UpdateRenderOffset(renderSize, tileSize); trace.TraceVerbose("UpdateTileLayout(rs {0}, gs {1}, ts {2}) -> Off {3:F2}, Grid {4}", renderSize, this.GridSize, tileSize, m_renderOffset, this.GridSize); InvalidateTileRender(); if (TileLayoutChanged != null) { TileLayoutChanged(this.GridSize, tileSize); } if (gridSizeChanged) { if (this.GridSizeChanged != null) { this.GridSizeChanged(this, this.GridSize); } } }
void HandleMessage(MapDataTerrainsListMessage msg) { var env = m_world.GetObject <EnvironmentObject>(msg.Environment); trace.TraceVerbose("Received TerrainData for {0} tiles", msg.TileDataList.Count()); env.SetTerrains(msg.TileDataList); }
// Called from world void OnTurnStarted(ObjectID livingID) { turnTrace.TraceVerbose("TurnStart: {0}", livingID); if (m_world.IsOurTurn == false) { return; } if (this.IsAutoAdvanceTurnEnabled) { if (this.FocusedObject == null || this.FocusedObject.HasAction) { SendProceedTurn(); } } }
// Called from User public void DispatchMessage(Message m) { trace.TraceVerbose("DispatchMessage({0})", m); var msg = (ServerMessage)m; Action <Player, ServerMessage> method = s_handlerMap[msg.GetType()]; method(this, msg); }