Example #1
0
        private void HandleConnectRequest(object sender, ShipMessage msg)
        {
            ShipPeer       peer    = sender as ShipPeer;
            ConnectRequest request = msg as ConnectRequest;

            ConnectResponce responce = new ConnectResponce();

            responce.Responce            = ConnectResponce.ResponceTypes.Accepted;
            responce.ScenarioName        = StartupInfo.SelectedScenario.Name;
            responce.ScenarioAuthor      = StartupInfo.SelectedScenario.Author;
            responce.ScenarioDescription = StartupInfo.SelectedScenario.Description;
            responce.ScenarioType        = StartupInfo.SelectedScenario.Type;
            responce.ScenarioVariation   = string.Empty;
            if (StartupInfo.SelectedVariation != null)
            {
                responce.ScenarioVariation = StartupInfo.SelectedVariation.DisplayName;
            }

            responce.ScenarioIconImage = StartupInfo.SelectedScenario.IconImage;

            responce.ServerKey           = ServiceInfo.IDKey;
            responce.ServerLANAddress    = StartupInfo.ServerLANAddress;
            responce.SerververWANAddress = StartupInfo.ServerWANHost;
            peer.Send(responce);

            if (request.ClientType == ConnectRequest.ClientTypes.Ship)
            {
                UpdateShipList shipList = new UpdateShipList();
                GetPlayableShipList(shipList);
                peer.Send(shipList);
            }
        }
Example #2
0
        private void GetPlayableShipList(UpdateShipList list)
        {
            foreach (var ship in PlayerShips)
            {
                list.Ships.Add(InfoFromShip(ship));
            }

            foreach (ShipTemplate avalabileShips in ActiveScenario.GetPlayableShips())
            {
                list.Ships.Add(InfoFromTempalte(avalabileShips));
            }
        }
Example #3
0
 public void HandleUpdateShipList(object sender, ShipMessage message)
 {
     LastShipList = message as UpdateShipList;
     ShipListUpdated?.Invoke(this, LastShipList);
 }