Exemplo n.º 1
0
        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);
        }
Exemplo n.º 2
0
 private static void OnLandmarkRemoved()
 {
     while (m_disposableAnimals.Count > 0)
     {
         var index = m_disposableAnimals.Dequeue();
         NetworkIDManager.SendIDBehaviourDead(index, typeof(AI_NetworkBehaviour), true);
     }
 }
Exemplo n.º 3
0
 protected void SetNetworkIDManagerOrig(NetworkIDManager manager)
 {
     if (SwigDerivedClassHasMethod("SetNetworkIDManagerOrig", swigMethodTypes0))
     {
         RakNetPINVOKE.NetworkIDObject_SetNetworkIDManagerOrigSwigExplicitNetworkIDObject(swigCPtr, NetworkIDManager.getCPtr(manager));
     }
     else
     {
         RakNetPINVOKE.NetworkIDObject_SetNetworkIDManagerOrig(swigCPtr, NetworkIDManager.getCPtr(manager));
     }
 }
Exemplo n.º 4
0
 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);
 }
Exemplo n.º 5
0
        /// <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);
                }
            }
        }
Exemplo n.º 6
0
 protected override void OnDestroy()
 {
     base.OnDestroy();
     NetworkIDManager.RemoveNetworkID(this);
     mi_mod.UnregisterLightSource(mi_sceneLight);
 }
Exemplo n.º 7
0
 public void OnBlockPlaced()
 {
     NetworkIDManager.AddNetworkID(this);
 }
Exemplo n.º 8
0
 protected override void OnDestroy()
 {
     base.OnDestroy();
     NetworkIDManager.RemoveNetworkID(this);
 }
Exemplo n.º 9
0
 private global::System.IntPtr SwigDirectorGetNetworkIDManager()
 {
     return(NetworkIDManager.getCPtr(GetNetworkIDManager()).Handle);
 }