コード例 #1
0
        public void Update(float dt)
        {
            if (Server.AlternativeSync)
            {
                HandleAlternativeConnection();
            }

            if (!closing && Character != null && Character.GameLocation == GameLocation.Space && Character.PlayerShip.ManeuverController != null)
            {
                Character.PlayerShip.Update(dt);
                if (lastSyncSendTime.Subtract(DateTime.UtcNow).TotalSeconds < -0.5)
                {
                    lastSyncSendTime = DateTime.UtcNow;
                    GameProtocol.GetProtocol().SyncMove(index, SpaceEntityType.Player, Server.GetObjectId(index));
                }
            }
            if (!closing && Chat != null)
            {
                Chat.Update(dt);
            }
        }
コード例 #2
0
        public void JoinSector(Client client)
        {
            clients.Add(client);
            client.Character.PlayerShip.currentShipStats   = ((ShipCard)Catalogue.FetchCard(client.Character.PlayerShip.WorldGuid, CardView.Ship)).Stats;
            client.Character.PlayerShip.ManeuverController = new ManeuverController(client.index, (MovementCard)Catalogue.FetchCard(client.Character.PlayerShip.WorldGuid, CardView.Movement));
            client.Character.PlayerShip.ManeuverController.AddManeuver(new RestManeuver(ManeuverType.Rest, Tick.Current.value, new Vector3(0, 0, 0), new Euler3(0, 0, 0)));

            int index = client.index;

            GameProtocol.GetProtocol().SetTimeOrigin(index);
            GameProtocol.GetProtocol().SendWhoIsPlayerToSector(index, SpaceEntityType.Player, Server.GetObjectId(index), (uint)index, Server.GetClientByIndex(index).Character.PlayerShip.WorldGuid);

            List <Client> _clients = clients;

            Parallel.ForEach(_clients, (c) =>
            {
                if (c.index != index)
                {
                    GameProtocol.GetProtocol().SendWhoIsPlayerToPlayer(index, c.index, SpaceEntityType.Player, Server.GetObjectId(c.index), (uint)c.index, Server.GetClientByIndex(c.index).Character.PlayerShip.WorldGuid);
                }
            });
        }
コード例 #3
0
        public void LeaveSector(Client client, RemovingCause removingCause)
        {
            clients.Remove(client);

            switch (removingCause)
            {
            case RemovingCause.JustRemoved:
            case RemovingCause.Dock:
            case RemovingCause.JumpOut:
                GameProtocol.GetProtocol().SendObjectLeft(client.index, 1, new SpaceEntityType[1] {
                    SpaceEntityType.Player
                }, new uint[1] {
                    Server.GetObjectId(client.index)
                }, new RemovingCause[1] {
                    removingCause
                });
                break;

            default:
                Log.Add(LogSeverity.ERROR, "Uknown removal cause on Leave Sector of the client " + client.Character.name);
                break;
            }
        }
コード例 #4
0
 public void SetOutpost(Faction faction, int Points)
 {
     GameProtocol.GetProtocol().SpawnOutpost(sectorId, faction);
 }