Beispiel #1
0
 public static bool BeginQuery(Contextual contextual)
 {
     if (self == null)
     {
         Debug.LogWarning("Theres no instance", self);
     }
     else if (ui._clientState != ContextClientState.Off)
     {
         Debug.LogWarning("Client is already in a context menu. Wait", contextual);
     }
     else if (contextual == null)
     {
         Debug.LogWarning("null", self);
     }
     else if (!contextual.exists)
     {
         Debug.LogWarning("requestable destroyed or did not implement monobehaviour", self);
     }
     else
     {
         NetEntityID             yid;
         Facepunch.MonoBehaviour implementor = contextual.implementor;
         if (((int)NetEntityID.Of((UnityEngine.MonoBehaviour)contextual, out yid)) == 0)
         {
             Debug.LogWarning("requestable has no network view", implementor);
         }
         else
         {
             ui.OnServerQuerySent(implementor, yid);
             return(true);
         }
     }
     return(false);
 }
Beispiel #2
0
    public static bool BeginQuery(Contextual contextual)
    {
        NetEntityID netEntityID;

        if (!Context.self)
        {
            Debug.LogWarning("Theres no instance", Context.self);
        }
        else if (Context.ui._clientState != ContextClientState.Off)
        {
            Debug.LogWarning("Client is already in a context menu. Wait", contextual);
        }
        else if (!contextual)
        {
            Debug.LogWarning("null", Context.self);
        }
        else if (contextual.exists)
        {
            Facepunch.MonoBehaviour monoBehaviour = contextual.implementor;
            if ((int)NetEntityID.Of(contextual, out netEntityID) != 0)
            {
                Context.ui.OnServerQuerySent(monoBehaviour, netEntityID);
                return(true);
            }
            Debug.LogWarning("requestable has no network view", monoBehaviour);
        }
        else
        {
            Debug.LogWarning("requestable destroyed or did not implement monobehaviour", Context.self);
        }
        return(false);
    }
Beispiel #3
0
 public void Release()
 {
     if (--this.refCount == 0)
     {
         UnityEngine.Object.Destroy(this.go);
         UnityEngine.Object.Destroy(this.script);
         this.go     = null;
         this.script = null;
     }
 }
Beispiel #4
0
 public void Retain()
 {
     if (this.refCount++ == 0)
     {
         System.Type[] components = new System.Type[] { typeof(Facepunch.MonoBehaviour) };
         this.go = new GameObject(this.gameObjectName, components);
         UnityEngine.Object.DontDestroyOnLoad(this.go);
         this.script = this.go.GetComponent <Facepunch.MonoBehaviour>();
     }
 }
Beispiel #5
0
                public void Retain()
                {
                    Facepunch.Load.Utility.ReferenceCountedCoroutine.Runner runner = this;
                    int num  = runner.refCount;
                    int num1 = num;

                    runner.refCount = num + 1;
                    if (num1 == 0)
                    {
                        this.go = new GameObject(this.gameObjectName, new Type[] { typeof(Facepunch.MonoBehaviour) });
                        UnityEngine.Object.DontDestroyOnLoad(this.go);
                        this.script = this.go.GetComponent <Facepunch.MonoBehaviour>();
                    }
                }
Beispiel #6
0
                public void Release()
                {
                    Facepunch.Load.Utility.ReferenceCountedCoroutine.Runner runner = this;
                    int num  = runner.refCount - 1;
                    int num1 = num;

                    runner.refCount = num;
                    if (num1 == 0)
                    {
                        UnityEngine.Object.Destroy(this.go);
                        UnityEngine.Object.Destroy(this.script);
                        this.go     = null;
                        this.script = null;
                    }
                }
Beispiel #7
0
    private bool SearchForContextRequestable(out UnityEngine.MonoBehaviour impl)
    {
        Contextual contextual;

        if (Contextual.FindUp(base.transform, out contextual))
        {
            Facepunch.MonoBehaviour   monoBehaviour  = contextual.implementor;
            UnityEngine.MonoBehaviour monoBehaviour1 = monoBehaviour;
            impl = monoBehaviour;
            if (monoBehaviour1)
            {
                return(true);
            }
        }
        impl = null;
        return(false);
    }
Beispiel #8
0
 public void Retain()
 {
     Facepunch.Load.Utility.ReferenceCountedCoroutine.Runner runner = this;
     int num = runner.refCount;
     int num1 = num;
     runner.refCount = num + 1;
     if (num1 == 0)
     {
         this.go = new GameObject(this.gameObjectName, new Type[] { typeof(Facepunch.MonoBehaviour) });
         UnityEngine.Object.DontDestroyOnLoad(this.go);
         this.script = this.go.GetComponent<Facepunch.MonoBehaviour>();
     }
 }
Beispiel #9
0
 public void Release()
 {
     Facepunch.Load.Utility.ReferenceCountedCoroutine.Runner runner = this;
     int num = runner.refCount - 1;
     int num1 = num;
     runner.refCount = num;
     if (num1 == 0)
     {
         UnityEngine.Object.Destroy(this.go);
         UnityEngine.Object.Destroy(this.script);
         this.go = null;
         this.script = null;
     }
 }