Ejemplo n.º 1
0
        private void ClientConnected(object sender, ClientConnectedEventArgs e)
        {
            if (playerManager == null)
            {
                playerManager = PluginManager.GetPluginByType <UMPlayerManager>();
            }
            if (entityManager == null)
            {
                entityManager = PluginManager.GetPluginByType <UMEntityManager>();
            }
            if (voipManager == null)
            {
                voipManager = PluginManager.GetPluginByType <UMVoipManager>();
            }

            UMClient NewClient = new UMClient(e.Client);

            clients.Add(e.Client, NewClient);


            Console.WriteLine("WorldManager registered player");
            e.Client.MessageReceived += Client_MessageReceived;

            voipManager.RegisterClient(e.Client);
        }
Ejemplo n.º 2
0
        public void RegisterClient(IClient client)
        {
            if (playerManager == null)
            {
                playerManager = PluginManager.GetPluginByType <UMPlayerManager>();
            }

            if (worldManager == null)
            {
                worldManager = PluginManager.GetPluginByType <UMWorldManager>();
            }


            Console.WriteLine("Weaponmanager registered player");
            client.MessageReceived += Client_MessageReceived;

            WorldData World = worldManager.clients[client].World;

            foreach (Player p in World.players.Values)
            {
                if (p.WeaponEntityID != ushort.MaxValue)
                {
                    using (DarkRiftWriter weaponSwitchWriter = DarkRiftWriter.Create())
                    {
                        WeaponSwitchServerDTO switchData = new WeaponSwitchServerDTO();
                        switchData.playerId       = client.ID;
                        switchData.weaponEntityId = p.WeaponEntityID;
                        switchData.weaponSlot     = 0;

                        weaponSwitchWriter.Write(switchData);
                        using (Message fireStartMessage = Message.Create(Tags.WeaponSwitchTag, weaponSwitchWriter)) //Repeat the incoming tagname as all message bodies are the same
                        {
                            client.SendMessage(fireStartMessage, SendMode.Reliable);
                        }
                    }
                }
            }
        }