public void Initialize() { _netManager.RegisterNetMessage <ShouldShowRulesPopupMessage>(); _netManager.RegisterNetMessage <ShowRulesPopupMessage>(); _netManager.RegisterNetMessage <RulesAcceptedMessage>(OnRulesAccepted); _netManager.Connected += OnConnected; }
public void Initialize() { _netManager.RegisterNetMessage <ShouldShowRulesPopupMessage>(OnShouldShowRules); _netManager.RegisterNetMessage <ShowRulesPopupMessage>(OnShowRulesPopupMessage); _netManager.RegisterNetMessage <RulesAcceptedMessage>(); _stateManager.OnStateChanged += OnStateChanged; }
/// <summary> /// Initializes the string table. /// </summary> public void Initialize(INetManager network) { _network = network; _network.RegisterNetMessage <MsgStringTableEntry>(MsgStringTableEntry.NAME, (int)MsgStringTableEntry.ID, message => { if (_network.IsServer) // Server does not receive entries from clients. { return; } var entry = (MsgStringTableEntry)message; var id = entry.EntryId; var str = string.IsNullOrEmpty(entry.EntryString) ? null : entry.EntryString; if (str == null) { _strings.Remove(id); } else { if (!_strings.ContainsKey(id)) { _strings.Add(id, str); } else { _strings[id] = str; } } }); }
/// <summary> /// Performs the setup so that the serializer can perform the string- /// exchange protocol. /// </summary> /// <remarks> /// The string-exchange protocol is started by the server when the /// client first connects. The server sends the client a hash of the /// string mapping; the client checks that hash against any local /// caches; and if necessary, the client requests a new copy of the /// mapping from the server. /// /// Uncached flow: <code> /// Client | Server /// | <-------------- Hash | /// | Need Strings ------> | /// | <----------- Strings | /// | Dont Need Strings -> | /// </code> /// /// Cached flow: <code> /// Client | Server /// | <-------------- Hash | /// | Dont Need Strings -> | /// </code> /// /// Verification failure flow: <code> /// Client | Server /// | <-------------- Hash | /// | Need Strings ------> | /// | <----------- Strings | /// + Hash Failed | /// | Need Strings ------> | /// | <----------- Strings | /// | Dont Need Strings -> | /// </code> /// /// NOTE: Verification failure flow is currently not implemented. /// </remarks> /// <param name="net"> /// The <see cref="INetManager"/> to perform the protocol steps over. /// </param> /// <seealso cref="MsgRobustMappedStringsSerializerServerHandshake"/> /// <seealso cref="MsgRobustMappedStringsSerializerClientHandshake"/> /// <seealso cref="MsgRobustMappedStringsSerializerStrings"/> /// <seealso cref="HandleServerHandshake"/> /// <seealso cref="HandleClientHandshake"/> /// <seealso cref="HandleStringsMessage"/> /// <seealso cref="OnClientCompleteHandshake"/> public void NetworkInitialize(INetManager net) { _net = net; net.RegisterNetMessage <MsgRobustMappedStringsSerializerServerHandshake>( nameof(MsgRobustMappedStringsSerializerServerHandshake), msg => HandleServerHandshake(net, msg)); net.RegisterNetMessage <MsgRobustMappedStringsSerializerClientHandshake>( nameof(MsgRobustMappedStringsSerializerClientHandshake), msg => HandleClientHandshake(net, msg)); net.RegisterNetMessage <MsgRobustMappedStringsSerializerStrings>( nameof(MsgRobustMappedStringsSerializerStrings), msg => HandleStringsMessage(net, msg)); }
/// <summary> /// Default constructor. /// </summary> public void NetSetup() { _netManager.RegisterNetMessage <MsgMap>(MsgMap.NAME, (int)MsgMap.ID, message => HandleNetworkMessage((MsgMap)message)); if (_netManager.IsServer) { _mapManager.OnTileChanged += MapMgrOnTileChanged; } }
/// <summary> /// Initializes the string table. /// </summary> public void Initialize(INetManager network, InitCallback callback = null) { Debug.Assert(!_initialized); _callback = callback; _network = network; _network.RegisterNetMessage <MsgStringTableEntries>(MsgStringTableEntries.NAME, message => { if (_network.IsServer) // Server does not receive entries from clients. { return; } var msg = (MsgStringTableEntries)message; foreach (var entry in msg.Entries) { var id = entry.Id; var str = string.IsNullOrEmpty(entry.String) ? null : entry.String; if (str == null) { _strings.Remove(id); } else { if (TryFindStringId(str, out int oldId)) { if (oldId == id) { continue; } _strings.Remove(oldId); _strings.Add(id, str); } else { _strings.Add(id, str); } } } if (callback == null) { return; } if (_network.IsClient && !_initialized) { _callback?.Invoke(); } }); Reset(); }
/// <summary> /// Initializes the string table. /// </summary> public void Initialize(InitCallback?callback = null, StringTableUpdateCallback?updateCallback = null) { DebugTools.Assert(!_initialized); _callback = callback; _updateCallback = updateCallback; _network.RegisterNetMessage <MsgStringTableEntries>(ReceiveEntries, NetMessageAccept.Client); Reset(); }
public void Initialize() { _netManager.RegisterNetMessage <MsgViewVariablesReqSession>(MsgViewVariablesReqSession.NAME, _msgReqSession); _netManager.RegisterNetMessage <MsgViewVariablesReqData>(MsgViewVariablesReqData.NAME, _msgReqData); _netManager.RegisterNetMessage <MsgViewVariablesModifyRemote>(MsgViewVariablesModifyRemote.NAME, _msgModifyRemote); _netManager.RegisterNetMessage <MsgViewVariablesCloseSession>(MsgViewVariablesCloseSession.NAME, _msgCloseSession); _netManager.RegisterNetMessage <MsgViewVariablesDenySession>(MsgViewVariablesDenySession.NAME); _netManager.RegisterNetMessage <MsgViewVariablesOpenSession>(MsgViewVariablesOpenSession.NAME); _netManager.RegisterNetMessage <MsgViewVariablesRemoteData>(MsgViewVariablesRemoteData.NAME); }
public void Initialize() { _netManager.RegisterNetMessage <AdminMenuPlayerListRequest>(AdminMenuPlayerListRequest.NAME); _netManager.RegisterNetMessage <AdminMenuPlayerListMessage>(AdminMenuPlayerListMessage.NAME, HandlePlayerListMessage); _commandWindows = new List <SS14Window>(); // Reset the AdminMenu Window on disconnect _netManager.Disconnect += (sender, channel) => ResetWindow(); _inputManager.SetInputCommand(ContentKeyFunctions.OpenAdminMenu, InputCmdHandler.FromDelegate(session => Toggle())); _clientAdminManager.AdminStatusUpdated += () => { // when status changes, show the top button if we can open admin menu. // if we can't or we lost admin status, close it and hide the button. _gameHud.AdminButtonVisible = CanOpen(); if (!_gameHud.AdminButtonVisible) { Close(); } }; _gameHud.AdminButtonToggled += (open) => { if (open) { TryOpen(); } else { Close(); } }; _gameHud.AdminButtonVisible = CanOpen(); _gameHud.AdminButtonDown = false; }
public void Initialize() { var logger = _logManager.GetSawmill("con.groups"); _netManager.RegisterNetMessage <MsgConGroupUpdate>(MsgConGroupUpdate.Name); _playerManager.PlayerStatusChanged += _onClientStatusChanged; // load the permission groups in the console _groups = new ConGroupContainer(_resourceManager, logger); _groups.LoadGroups(); // set up the session group container _sessions = new SessionGroupContainer(_configurationManager, logger); UpdateAllClientData(); }
/// <summary> /// Initializes the string table. /// </summary> public void Initialize(INetManager network) { _network = network; _network.RegisterNetMessage <MsgStringTableEntry>(MsgStringTableEntry.NAME, (int)MsgStringTableEntry.ID, message => { if (_network.IsServer) // Server does not receive entries from clients. { return; } var entry = (MsgStringTableEntry)message; var id = entry.EntryId; var str = string.IsNullOrEmpty(entry.EntryString) ? null : entry.EntryString; if (str == null) { _strings.Remove(id); } else { if (TryFindStringId(str, out int oldId)) { if (oldId == id) { return; } _strings.Remove(oldId); _strings.Add(id, str); } else { _strings.Add(id, str); } } }); // manually register the id on the client so it can bootstrap itself with incoming table entries if (_network.IsClient && !TryFindStringId(MsgStringTableEntry.NAME, out int msgId)) { _strings.Add((int)MsgStringTableEntry.ID, MsgStringTableEntry.NAME); } }
public virtual void Initialize() { _network.RegisterNetMessage <MsgEntity>(MsgEntity.NAME, HandleEntityNetworkMessage); }
/// <summary> /// Performs the setup so that the serializer can perform the string- /// exchange protocol. /// </summary> /// <remarks> /// The string-exchange protocol is started by the server when the /// client first connects. The server sends the client a hash of the /// string mapping; the client checks that hash against any local /// caches; and if necessary, the client requests a new copy of the /// mapping from the server. /// /// Uncached flow: <code> /// Client | Server /// | <-------------- Hash | /// | Need Strings ------> | /// | <----------- Strings | /// | Dont Need Strings -> | /// </code> /// /// Cached flow: <code> /// Client | Server /// | <-------------- Hash | /// | Dont Need Strings -> | /// </code> /// /// Verification failure flow: <code> /// Client | Server /// | <-------------- Hash | /// | Need Strings ------> | /// | <----------- Strings | /// + Hash Failed | /// | Need Strings ------> | /// | <----------- Strings | /// | Dont Need Strings -> | /// </code> /// /// NOTE: Verification failure flow is currently not implemented. /// </remarks> /// <param name="net"> /// The <see cref="INetManager"/> to perform the protocol steps over. /// </param> /// <seealso cref="MsgMapStrServerHandshake"/> /// <seealso cref="MsgMapStrClientHandshake"/> /// <seealso cref="MsgMapStrStrings"/> /// <seealso cref="HandleServerHandshake"/> /// <seealso cref="HandleClientHandshake"/> /// <seealso cref="HandleStringsMessage"/> /// <seealso cref="OnClientCompleteHandshake"/> private void NetworkInitialize() { _net.RegisterNetMessage <MsgMapStrServerHandshake>(nameof(MsgMapStrServerHandshake), HandleServerHandshake); _net.RegisterNetMessage <MsgMapStrClientHandshake>(nameof(MsgMapStrClientHandshake), HandleClientHandshake); _net.RegisterNetMessage <MsgMapStrStrings>(nameof(MsgMapStrStrings), HandleStringsMessage); }
public void Initialize() { _netManager.RegisterNetMessage <ShowRulesPopupMessage>(); }
public void Initialize() { _netManager.RegisterNetMessage <MsgSound>(RxSound); _netManager.Disconnect += DisconnectedFromServer; }
public override void Initialize() { base.Initialize(); _netManager.RegisterNetMessage <MsgReloadPrototypes>(HandleReloadPrototypes, NetMessageAccept.Server); }