public virtual NetworkIDManager GetNetworkIDManager() { global::System.IntPtr cPtr = (SwigDerivedClassHasMethod("GetNetworkIDManager", swigMethodTypes1) ? RakNetPINVOKE.NetworkIDObject_GetNetworkIDManagerSwigExplicitNetworkIDObject(swigCPtr) : RakNetPINVOKE.NetworkIDObject_GetNetworkIDManager(swigCPtr)); NetworkIDManager ret = (cPtr == global::System.IntPtr.Zero) ? null : new NetworkIDManager(cPtr, false); return(ret); }
private static void OnLandmarkRemoved() { while (m_disposableAnimals.Count > 0) { var index = m_disposableAnimals.Dequeue(); NetworkIDManager.SendIDBehaviourDead(index, typeof(AI_NetworkBehaviour), true); } }
protected void SetNetworkIDManagerOrig(NetworkIDManager manager) { if (SwigDerivedClassHasMethod("SetNetworkIDManagerOrig", swigMethodTypes0)) { RakNetPINVOKE.NetworkIDObject_SetNetworkIDManagerOrigSwigExplicitNetworkIDObject(swigCPtr, NetworkIDManager.getCPtr(manager)); } else { RakNetPINVOKE.NetworkIDObject_SetNetworkIDManagerOrig(swigCPtr, NetworkIDManager.getCPtr(manager)); } }
public virtual void SetNetworkIDManager(NetworkIDManager manager) { if (oldManager != null) { oldManager.pointerDictionary.Remove(GetIntPtr()); } if (manager != null) { manager.pointerDictionary.Add(GetIntPtr(), this); oldManager = manager; } SetNetworkIDManagerOrig(manager); }
/// <summary> /// Initializes the lantern switch behaviour providing a mod handle and a scene light wrapper. /// </summary> /// <param name="_mod">A handle to the mod object initializing this switch.</param> /// <param name="_light">Contains references to the block and other components.</param> public void Load(CLanternShadows _mod, SSceneLight _light) { mi_mod = _mod; mi_sceneLight = _light; mi_nlCntrl = mi_sceneLight.LightComponent.GetComponent <NightLightController>(); mi_setLightIntensityInfo = typeof(NightLightController).GetMethod("SetLightIntensity", BindingFlags.NonPublic | BindingFlags.Instance); mi_network = ComponentManager <Semih_Network> .Value; //use our block objects index so we receive RPC calls //need to use an existing blockindex as clients/host need to be aware of it ObjectIndex = mi_sceneLight.BlockObject.ObjectIndex; NetworkIDManager.AddNetworkID(this); CheckLightState(true); mi_loaded = true; if (!Semih_Network.IsHost) //request lantern states from host after load { mi_network.SendP2P( mi_network.HostID, new Message_Battery_OnOff( //just use the battery message as it should never Messages.Battery_OnOff, mi_network.NetworkIDManager, mi_network.LocalSteamID, this.ObjectIndex, (int)ELanternRequestType.REQUEST_STATE, //we use the battery uses int to pass our custom command type IsOn), EP2PSend.k_EP2PSendReliable, NetworkChannel.Channel_Game); } else if (mi_mod.SavedLightData.ContainsKey(SaveAndLoad.CurrentGameFileName)) { var data = mi_mod.SavedLightData[SaveAndLoad.CurrentGameFileName].FirstOrDefault(_o => _o.ObjectID == ObjectIndex); if (data != null) { UserControlsState = true; SetLightOn(data.IsOn); } } }
protected override void OnDestroy() { base.OnDestroy(); NetworkIDManager.RemoveNetworkID(this); mi_mod.UnregisterLightSource(mi_sceneLight); }
public void OnBlockPlaced() { NetworkIDManager.AddNetworkID(this); }
protected override void OnDestroy() { base.OnDestroy(); NetworkIDManager.RemoveNetworkID(this); }
private global::System.IntPtr SwigDirectorGetNetworkIDManager() { return(NetworkIDManager.getCPtr(GetNetworkIDManager()).Handle); }