Example #1
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);
    }
Example #2
0
    public static NetEntityID.Kind Of(GameObject entity)
    {
        NetEntityID netEntityID;

        UnityEngine.MonoBehaviour monoBehaviour;
        return(NetEntityID.Of(entity, out netEntityID, out monoBehaviour));
    }
Example #3
0
    public static NetEntityID.Kind Of(Component component)
    {
        NetEntityID netEntityID;

        UnityEngine.MonoBehaviour monoBehaviour;
        return(NetEntityID.Of(component, out netEntityID, out monoBehaviour));
    }
Example #4
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;
         MonoBehaviour implementor = contextual.implementor;
         if (((int)NetEntityID.Of((MonoBehaviour)contextual, out yid)) == 0)
         {
             Debug.LogWarning("requestable has no network view", implementor);
         }
         else
         {
             ui.OnServerQuerySent(implementor, yid);
             return(true);
         }
     }
     return(false);
 }
Example #5
0
    public static NetEntityID.Kind Of(UnityEngine.MonoBehaviour script)
    {
        NetEntityID netEntityID;

        UnityEngine.MonoBehaviour monoBehaviour;
        return(NetEntityID.Of(script, out netEntityID, out monoBehaviour));
    }
Example #6
0
    public void WriteObjectSave(ref SavedObject.Builder saveobj)
    {
        NetEntityID netEntityID;

        using (Recycler <objectDeployable, objectDeployable.Builder> recycler = objectDeployable.Recycler())
        {
            objectDeployable.Builder builder = recycler.OpenBuilder();
            builder.SetCreatorID(this.creatorID);
            builder.SetOwnerID(this.ownerID);
            saveobj.SetDeployable(builder);
        }
        using (Recycler <objectICarriableTrans, objectICarriableTrans.Builder> recycler1 = objectICarriableTrans.Recycler())
        {
            objectICarriableTrans.Builder builder1 = recycler1.OpenBuilder();
            if (!this._carrier || (int)NetEntityID.Of(this._carrier, out netEntityID) == 0)
            {
                builder1.ClearTransCarrierID();
            }
            else
            {
                builder1.SetTransCarrierID(netEntityID.id);
            }
            saveobj.SetCarriableTrans(builder1);
        }
    }
Example #7
0
 public static bool ContextOf(Component component, out Contextual contextual)
 {
     UnityEngine.MonoBehaviour behaviour;
     if (((int)NetEntityID.Of(component, out behaviour)) == 0)
     {
         contextual = null;
         return(false);
     }
     return(GetMB(behaviour, out contextual));
 }
Example #8
0
 public static bool ContextOf(Component component, out Contextual contextual)
 {
     UnityEngine.MonoBehaviour monoBehaviour;
     if ((int)NetEntityID.Of(component, out monoBehaviour) != 0)
     {
         return(Contextual.GetMB(monoBehaviour, out contextual));
     }
     contextual = null;
     return(false);
 }
Example #9
0
    public static bool ContextOf(GameObject gameObject, out Contextual contextual)
    {
        MonoBehaviour behaviour;

        if (((int)NetEntityID.Of(gameObject, out behaviour)) == 0)
        {
            contextual = null;
            return(false);
        }
        return(GetMB(behaviour, out contextual));
    }
Example #10
0
 public static NetEntityID.Kind Of(Component component, out NetEntityID entID, out UnityEngine.MonoBehaviour view)
 {
     if (component is UnityEngine.MonoBehaviour)
     {
         return(NetEntityID.Of((UnityEngine.MonoBehaviour)component, out entID, out view));
     }
     if (component)
     {
         return(NetEntityID.Of(component.gameObject, out entID, out view));
     }
     entID = NetEntityID.unassigned;
     view  = null;
     return(NetEntityID.Kind.Missing);
 }
Example #11
0
    public static NetEntityID Get(UnityEngine.MonoBehaviour entityScript, bool throwIfNotFound)
    {
        NetEntityID netEntityID;

        if ((int)NetEntityID.Of(entityScript, out netEntityID) != 0)
        {
            return(netEntityID);
        }
        if (throwIfNotFound)
        {
            throw new InvalidOperationException("no recognizable net entity id");
        }
        return(NetEntityID.unassigned);
    }
Example #12
0
    public static NetEntityID Get(Component entityComponent, bool throwIfNotFound)
    {
        NetEntityID netEntityID;

        if ((int)NetEntityID.Of(entityComponent, out netEntityID) != 0)
        {
            return(netEntityID);
        }
        if (throwIfNotFound)
        {
            throw new InvalidOperationException("no recognizable net entity id");
        }
        return(NetEntityID.unassigned);
    }
Example #13
0
    private void OnClientPromptBegin(NetEntityID?useID)
    {
        NetEntityID yid;

        if (useID.HasValue)
        {
            yid = useID.Value;
        }
        else
        {
            NetEntityID.Of(this.clientQuery, out yid);
        }
        this.clientQueryTime = NetCull.localTimeInMillis;
        Context.UICommands.Issue_Request(yid);
        this.SetContextClientState(ContextClientState.Polling);
    }
Example #14
0
 public static NetEntityID.Kind Of(UnityEngine.MonoBehaviour script, out NetEntityID entID, out UnityEngine.MonoBehaviour view)
 {
     if (!script)
     {
         entID = NetEntityID.unassigned;
         view  = null;
         return(NetEntityID.Kind.Missing);
     }
     if (script is uLink.NetworkView)
     {
         view  = script;
         entID = ((uLink.NetworkView)script).viewID;
         return(NetEntityID.Kind.Net);
     }
     if (!(script is NGCView))
     {
         return(NetEntityID.Of(script.gameObject, out entID, out view));
     }
     view  = script;
     entID = new NetEntityID((NGCView)script);
     return(NetEntityID.Kind.NGC | NetEntityID.Kind.Net);
 }
Example #15
0
 public void WriteObjectSave(ref SavedObject.Builder saveobj)
 {
     using (Recycler <objectDeployable, objectDeployable.Builder> recycler = objectDeployable.Recycler())
     {
         objectDeployable.Builder builderForValue = recycler.OpenBuilder();
         builderForValue.SetCreatorID(this.creatorID);
         builderForValue.SetOwnerID(this.ownerID);
         saveobj.SetDeployable(builderForValue);
     }
     using (Recycler <objectICarriableTrans, objectICarriableTrans.Builder> recycler2 = objectICarriableTrans.Recycler())
     {
         NetEntityID yid;
         objectICarriableTrans.Builder builder2 = recycler2.OpenBuilder();
         if ((this._carrier != null) && (((int)NetEntityID.Of((MonoBehaviour)this._carrier, out yid)) != 0))
         {
             builder2.SetTransCarrierID(yid.id);
         }
         else
         {
             builder2.ClearTransCarrierID();
         }
         saveobj.SetCarriableTrans(builder2);
     }
 }
Example #16
0
    private bool ClientCheckUse(Ray ray, bool press)
    {
        RaycastHit raycastHit;

        Facepunch.MonoBehaviour   monoBehaviour;
        UnityEngine.MonoBehaviour monoBehaviour1;
        NetEntityID netEntityID;

        NetEntityID.Kind kind;
        Contextual       contextual;

        if (!Physics.Raycast(ray, out raycastHit, this.raycastLength, -201523205))
        {
            monoBehaviour = null;
        }
        else
        {
            Transform transforms  = raycastHit.transform;
            Transform transforms1 = transforms.parent;
            while (true)
            {
                NetEntityID.Kind kind1 = NetEntityID.Of(transforms, out netEntityID, out monoBehaviour1);
                kind = kind1;
                if ((int)kind1 != 0 || !transforms1)
                {
                    break;
                }
                transforms  = transforms1;
                transforms1 = transforms.parent;
            }
            if ((int)kind == 0)
            {
                monoBehaviour = null;
            }
            else if (!Contextual.ContextOf(monoBehaviour1, out contextual))
            {
                monoBehaviour = null;
            }
            else
            {
                monoBehaviour = contextual.implementor;
                if (press)
                {
                    Context.BeginQuery(contextual);
                }
            }
        }
        if (monoBehaviour != this.lastUseHighlight)
        {
            this.lastUseHighlight = monoBehaviour;
            if (!monoBehaviour)
            {
                RPOS.UseHoverTextClear();
            }
            else
            {
                IContextRequestableText contextRequestableText = monoBehaviour as IContextRequestableText;
                if (contextRequestableText == null)
                {
                    RPOS.UseHoverTextSet(monoBehaviour.name);
                }
                else
                {
                    RPOS.UseHoverTextSet(base.controllable, contextRequestableText);
                }
            }
        }
        return(monoBehaviour);
    }
Example #17
0
 public static NetEntityID.Kind Of(Component component, out NetEntityID entID)
 {
     UnityEngine.MonoBehaviour monoBehaviour;
     return(NetEntityID.Of(component, out entID, out monoBehaviour));
 }
Example #18
0
    public static NetEntityID.Kind Of(Component component, out UnityEngine.MonoBehaviour view)
    {
        NetEntityID netEntityID;

        return(NetEntityID.Of(component, out netEntityID, out view));
    }
Example #19
0
    private bool ClientCheckUse(Ray ray, bool press)
    {
        RaycastHit hit;

        Facepunch.MonoBehaviour implementor;
        if (Physics.Raycast(ray, out hit, this.raycastLength, -201523205))
        {
            UnityEngine.MonoBehaviour behaviour2;
            NetEntityID      yid;
            NetEntityID.Kind kind;
            Transform        component = hit.transform;
            for (Transform transform2 = component.parent; (((int)(kind = NetEntityID.Of(component, out yid, out behaviour2))) == 0) && (transform2 != null); transform2 = component.parent)
            {
                component = transform2;
            }
            if (((int)kind) == 0)
            {
                implementor = null;
            }
            else
            {
                Contextual contextual;
                if (Contextual.ContextOf(behaviour2, out contextual))
                {
                    implementor = contextual.implementor;
                    if (press)
                    {
                        Context.BeginQuery(contextual);
                    }
                }
                else
                {
                    implementor = null;
                }
            }
        }
        else
        {
            implementor = null;
        }
        if (implementor != this.lastUseHighlight)
        {
            this.lastUseHighlight = implementor;
            if (implementor != null)
            {
                IContextRequestableText text = implementor as IContextRequestableText;
                if (text != null)
                {
                    RPOS.UseHoverTextSet(base.controllable, text);
                }
                else
                {
                    RPOS.UseHoverTextSet(implementor.name);
                }
            }
            else
            {
                RPOS.UseHoverTextClear();
            }
        }
        return((bool)implementor);
    }
Example #20
0
    public static NetEntityID.Kind Of(GameObject entity, out UnityEngine.MonoBehaviour view)
    {
        NetEntityID netEntityID;

        return(NetEntityID.Of(entity, out netEntityID, out view));
    }
Example #21
0
 public static NetEntityID.Kind Of(UnityEngine.MonoBehaviour script, out NetEntityID entID)
 {
     UnityEngine.MonoBehaviour monoBehaviour;
     return(NetEntityID.Of(script, out entID, out monoBehaviour));
 }
Example #22
0
    public static NetEntityID.Kind Of(UnityEngine.MonoBehaviour script, out UnityEngine.MonoBehaviour view)
    {
        NetEntityID netEntityID;

        return(NetEntityID.Of(script, out netEntityID, out view));
    }