void connector_GamesMessagePacketReceived(object sender, PackageEventArgs e) { //GameStart and GameOver are all that matter. if (e != null && e.ReceivedPacket != null) { GameMessagePacket p = e.ReceivedPacket.Package as GameMessagePacket; if (p != null) { if (p.SubPacketType == GameMessageSubPackets.GameMessageSubPacketTypes.GameEndSubPacket) { plyr.Stop(); GameInProgress = false; View.GameEnded(); } if (p.SubPacketType == GameMessageSubPackets.GameMessageSubPacketTypes.EndSimulationSubPacket) { plyr.Stop(); GameInProgress = false; View.SimulationEnded(); } if (p.SubPacketType == GameMessageSubPackets.GameMessageSubPacketTypes.AllShipSettingsSubPacket) { AllShipSettingsSubPacket allships = p.SubPacket as AllShipSettingsSubPacket; if (allships != null && allships.Ships != null && !shipSelected) { SelectedShip = View.GetShipSelection(allships.Ships); shipSelected = true; SelectStationAndReady(); } } } } }
public void sendGameMessage(Actor textIdOwner, ushort textId, byte log, uint displayId, params object[] msgParams) { if (msgParams.Length == 0) { queuePacket(GameMessagePacket.buildPacket(Server.GetWorldManager().GetActor().actorId, actorId, textIdOwner.actorId, textId, displayId, log)); } else { queuePacket(GameMessagePacket.buildPacket(Server.GetWorldManager().GetActor().actorId, actorId, textIdOwner.actorId, textId, displayId, log, LuaUtils.createLuaParamList(msgParams))); } }
public void SendGameMessage(int playerId, string message) { var gameMessagePacket = new GameMessagePacket { PacketId = 255, Message = message }; Console.WriteLine($"Sending game message packet(msg={message})"); UserIdToSockets[playerId].Send(JsonConvert.SerializeObject(gameMessagePacket)); }
public void SendGameMessage(ushort textId, byte log, uint displayId, params object[] msgParams) { if (msgParams == null || msgParams.Length == 0) { clientConnection.QueuePacket(GameMessagePacket.BuildPacket(0x5FF80001, 0x5FF80001, textId, displayId, log)); } else { clientConnection.QueuePacket(GameMessagePacket.BuildPacket(0x5FF80001, 0x5FF80001, textId, displayId, log, LuaUtils.CreateLuaParamList(msgParams))); } }