public override void Initialize()
 {
     base.Initialize();
     _userInterface = Owner.GetComponent <ServerUserInterfaceComponent>().GetBoundUserInterface(ResearchConsoleUiKey.Key);
     _userInterface.OnReceiveMessage += UserInterfaceOnOnReceiveMessage;
     _client = Owner.GetComponent <ResearchClientComponent>();
 }
Exemple #2
0
        /// <summary>
        ///     Unregisters a remote client from this server.
        /// </summary>
        /// <param name="client"></param>
        public void UnregisterClient(ResearchClientComponent client)
        {
            if (client is ResearchPointSourceComponent source)
            {
                PointSources.Remove(source);
                return;
            }

            Clients.Remove(client);
        }
Exemple #3
0
        /// <summary>
        ///     Registers a remote client on this research server.
        /// </summary>
        /// <param name="client"></param>
        /// <returns></returns>
        public bool RegisterClient(ResearchClientComponent client)
        {
            if (client is ResearchPointSourceComponent source)
            {
                if (PointSources.Contains(source))
                {
                    return(false);
                }
                PointSources.Add(source);
                source.Server = this;
                return(true);
            }

            if (Clients.Contains(client))
            {
                return(false);
            }
            Clients.Add(client);
            client.Server = this;
            return(true);
        }