コード例 #1
0
        public NetPlayerComponent(AOSClient client)
            : base(client)
        {
            netPlayers = new Dictionary <ushort, NetworkPlayer>();

            channel           = client.GetChannel(AOSChannelType.NetInterface);
            snapshotComponent = client.GetComponent <SnapshotNetComponent>();

            channel.AddRemoteEvent("Client_AddNetPlayer", R_AddNetPlayer);
            channel.AddRemoteEvent("Client_RemoveNetPlayer", R_RemoveNetPlayer);
            channel.AddRemoteEvent("Client_AddInitialNetPlayers", R_AddInitialNetPlayers);
        }
コード例 #2
0
        public NetPlayerComponent(AOSServer server)
            : base(server)
        {
            netPlayers        = new BiDictionary <NetConnection, NetworkPlayer>();
            stashedClientInfo = new Dictionary <NetConnection, ClientInfo>();
            channel           = server.GetChannel(AOSChannelType.NetInterface);
            snapshotComponent = server.GetComponent <SnapshotNetComponent>();

            channel.AddRemoteEvent("Server_ClientInfo", R_ClientInfo);
        }
コード例 #3
0
        public SnapshotSystem(NetMessenger messenger)
        {
            idAllocator = new IdAllocatorUInt16();
            interfaces  = new Dictionary <NetConnection, SnapshotConnectionInterface>();
            snapshotsAwaitingDeltaSupport = new HashSet <Snapshot>();

            channel = messenger.GetChannel((ushort)AOSChannelType.SnapshotSystem);
            channel.AddRemoteEvent("AllocateSnapshotId", R_AllocateSnapshotId);

            DashCMD.SetCVar("log_snapshots", false);
        }
コード例 #4
0
        public ServerWorld()
        {
            players      = new ConcurrentDictionary <NetConnection, ServerMPPlayer>();
            physEntities = new Dictionary <ushort, GameObject>();

            server            = AOSServer.Instance;
            snapshotComponent = server.GetComponent <SnapshotNetComponent>();
            objectComponent   = server.GetComponent <ObjectNetComponent>();
            channel           = server.GetChannel(AOSChannelType.World);

            channel.AddRemoteEvent("Server_SetBlock", R_SetBlock);
            channel.AddRemoteEvent("Server_ThrowGrenade", R_ThrowGrenade);
            channel.AddRemoteEvent("Server_ShootMelon", R_ShootMelon);

            objectComponent.OnCreatableInstantiated   += ObjectComponent_OnCreatableInstantiated;
            objectComponent.OnCreatableDestroyed      += ObjectComponent_OnCreatableDestroyed;
            snapshotComponent.OnWorldSnapshotOutbound += Server_OnWorldSnapshotOutbound;

            InitializeCMD();

            ConfigSection gameSection = Program.Config.GetSection("Game");

            if (gameSection == null)
            {
                DashCMD.WriteError("[server.cfg - ServerWorld] Section 'Game' is missing!");
            }
            else
            {
                string worldFile = gameSection.GetString("world-file");

                if (!string.IsNullOrWhiteSpace(worldFile))
                {
                    LoadFromFile(worldFile);
                }
                else
                {
                    DashCMD.WriteError("[server.cfg - ServerWorld] Game.world-file is missing!");
                }
            }
        }
コード例 #5
0
        public MPWorld(MasterRenderer renderer)
            : base(renderer)
        {
            players      = new Dictionary <ushort, ClientPlayer>();
            physEntities = new Dictionary <ushort, GameObject>();
            TimeOfDay    = 10;

            // Grab network components and the world channel
            client            = AOSClient.Instance;
            snapshotComponent = client.GetComponent <SnapshotNetComponent>();
            objectComponent   = client.GetComponent <ObjectNetComponent>();
            channel           = client.GetChannel(AOSChannelType.World);

            // Add remotes
            channel.AddRemoteEvent("Client_ThrowGrenade", R_ThrowGrenade);
            channel.AddRemoteEvent("Client_ShootMelon", R_ShootMelon);
            channel.AddRemoteEvent("Client_ServerImpact", R_ServerImpact);
            channel.AddRemoteEvent("Client_RolledBackServerPlayer", R_RolledBackServerPlayer);

            // Hook into component events
            objectComponent.OnCreatableInstantiated  += ObjectComponent_OnCreatableInstantiated;
            objectComponent.OnCreatableDestroyed     += ObjectComponent_OnCreatableDestroyed;
            snapshotComponent.OnWorldSnapshotInbound += SnapshotComponent_OnWorldSnapshotInbound;
        }