Пример #1
0
        public override void OnAllMembersData(ref AllMembersDataMsg msg)
        {
            // Setup members and clients
            if (msg.Clients != null)
            {
                foreach (var client in msg.Clients)
                {
                    if (!m_memberData.ContainsKey(client.SteamId))
                    {
                        m_memberData.Add(client.SteamId, new MyConnectedClientData()
                        {
                            Name = client.Name, IsAdmin = client.IsAdmin
                        });
                    }

                    if (!m_members.Contains(client.SteamId))
                    {
                        m_members.Add(client.SteamId);
                    }

                    if (!Sync.Clients.HasClient(client.SteamId))
                    {
                        Sync.Clients.AddClient(client.SteamId);
                    }
                }
            }

            // Setup identities, players, factions
            ProcessAllMembersData(ref msg);
        }
Пример #2
0
 protected override void OnAllMembersData(ref AllMembersDataMsg msg)
 {
     if (msg.Clients != null)
     {
         foreach (MyObjectBuilder_Client client in msg.Clients)
         {
             if (!this.m_memberData.ContainsKey(client.SteamId))
             {
                 MyMultiplayerBase.MyConnectedClientData data = new MyMultiplayerBase.MyConnectedClientData {
                     Name    = client.Name,
                     IsAdmin = client.IsAdmin
                 };
                 this.m_memberData.Add(client.SteamId, data);
             }
             if (!this.m_members.Contains(client.SteamId))
             {
                 this.m_members.Add(client.SteamId);
             }
             if (!Sync.Clients.HasClient(client.SteamId))
             {
                 Sync.Clients.AddClient(client.SteamId);
             }
         }
     }
     base.ProcessAllMembersData(ref msg);
 }
Пример #3
0
        public override void OnAllMembersData(ref AllMembersDataMsg msg)
        {
            if (Sync.IsServer)
            {
                Debug.Fail("Members data cannot be sent to server");
                return;
            }

            ProcessAllMembersData(ref msg);
        }
        public void OnAllMembersData(ref AllMembersDataMsg msg, MyNetworkClient sender)
        {
            if (Sync.IsServer)
            {
                Debug.Fail("Members data cannot be sent to server");
                return;
            }

            ProcessAllMembersData(ref msg);
        }
Пример #5
0
 protected void ProcessAllMembersData(ref AllMembersDataMsg msg)
 {
     Sync.Players.ClearIdentities();
     if (msg.Identities != null)
     {
         Sync.Players.LoadIdentities(msg.Identities);
     }
     Sync.Players.ClearPlayers();
     if (msg.Players != null)
     {
         Sync.Players.LoadPlayers(msg.Players);
     }
     MySession.Static.Factions.LoadFactions(msg.Factions, true);
 }
Пример #6
0
        protected void SendAllMembersDataToClient(ulong clientId)
        {
            AllMembersDataMsg msg = new AllMembersDataMsg();

            if (Sync.Players != null)
            {
                msg.Identities = Sync.Players.SaveIdentities();
                msg.Players    = Sync.Players.SavePlayers();
            }
            if (MySession.Static.Factions != null)
            {
                msg.Factions = MySession.Static.Factions.SaveFactions();
            }
            msg.Clients = MySession.Static.SaveMembers(true);
            Vector3D?position = null;

            Sandbox.Engine.Multiplayer.MyMultiplayer.RaiseStaticEvent <AllMembersDataMsg>(s => new Action <AllMembersDataMsg>(MyMultiplayerBase.OnAllMembersRecieved), msg, new EndpointId(clientId), position);
        }
Пример #7
0
        public void SendAllMembersDataToClient(ulong clientId)
        {
            Debug.Assert(Sync.IsServer);

            AllMembersDataMsg response = new AllMembersDataMsg();

            if (Sync.Players != null)
            {
                response.Identities = Sync.Players.SaveIdentities();
                response.Players    = Sync.Players.SavePlayers();
            }

            if (MySession.Static.Factions != null)
            {
                response.Factions = MySession.Static.Factions.SaveFactions();
            }

            response.Clients = MySession.Static.SaveMembers(true);

            MyMultiplayer.RaiseStaticEvent(s => MyMultiplayerBase.OnAllMembersRecieved, response, new EndpointId(clientId));
        }
Пример #8
0
        public void SendAllMembersDataToClient(ulong clientId)
        {
            Debug.Assert(Sync.IsServer);

            var response = new AllMembersDataMsg();

            if (Sync.Players != null)
            {
                response.Identities = Sync.Players.SaveIdentities();
                response.Players    = Sync.Players.SavePlayers();
            }

            if (MySession.Static.Factions != null)
            {
                response.Factions = MySession.Static.Factions.SaveFactions();
            }

            response.Clients = MySession.Static.SaveMembers(true);

            SyncLayer.SendMessage(ref response, clientId);
        }
 public void OnAllMembersData(ref AllMembersDataMsg msg, MyNetworkClient sender)
 {
     Debug.Fail("Members data cannot be sent to server");
 }
Пример #10
0
 static void OnAllMembersRecieved(AllMembersDataMsg msg)
 {
     MyMultiplayer.Static.OnAllMembersData(ref msg);
 }
Пример #11
0
 public virtual void OnAllMembersData(ref AllMembersDataMsg msg)
 {
 }
Пример #12
0
 private static void OnAllMembersRecieved(AllMembersDataMsg msg)
 {
     Sandbox.Engine.Multiplayer.MyMultiplayer.Static.OnAllMembersData(ref msg);
 }
Пример #13
0
 protected virtual void OnAllMembersData(ref AllMembersDataMsg msg)
 {
 }
Пример #14
0
        protected override void OnAllMembersData(ref AllMembersDataMsg msg)
        {
            bool isServer = Sync.IsServer;

            base.ProcessAllMembersData(ref msg);
        }