Exemplo n.º 1
0
 public NetEntityID(uLink.NetworkViewID viewID)
 {
     this = new NetEntityID()
     {
         _viewID = viewID
     };
 }
Exemplo n.º 2
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);
        }
    }
Exemplo n.º 3
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);
    }
Exemplo n.º 4
0
    public static NetEntityID.Kind Of(GameObject entity)
    {
        NetEntityID netEntityID;

        UnityEngine.MonoBehaviour monoBehaviour;
        return(NetEntityID.Of(entity, out netEntityID, out monoBehaviour));
    }
Exemplo n.º 5
0
    public static NetEntityID.Kind Of(GameObject entity, out NetEntityID entID, out UnityEngine.MonoBehaviour view)
    {
        if (!entity)
        {
            entID = NetEntityID.unassigned;
            view  = null;
            return(NetEntityID.Kind.Missing);
        }
        uLink.NetworkView component = entity.GetComponent <uLink.NetworkView>();
        if (component)
        {
            entID = new NetEntityID(component.viewID);
            view  = component;
            return(NetEntityID.Kind.Net);
        }
        NGCView nGCView = entity.GetComponent <NGCView>();

        if (nGCView)
        {
            entID = new NetEntityID(nGCView);
            view  = nGCView;
            return(NetEntityID.Kind.NGC | NetEntityID.Kind.Net);
        }
        entID = NetEntityID.unassigned;
        view  = null;
        return(NetEntityID.Kind.Missing);
    }
Exemplo n.º 6
0
    protected void WriteHitInfo(BitStream sendStream, ref Ray ray, bool didHit, ref RaycastHit2 hit)
    {
        bool        flag;
        NetEntityID unassigned;

        if (didHit)
        {
            IDBase id = hit.id;
            if ((id != null) && (id.idMain != null))
            {
                unassigned = NetEntityID.Get((MonoBehaviour)id.idMain);
                flag       = !unassigned.isUnassigned;
            }
            else
            {
                flag       = false;
                unassigned = NetEntityID.unassigned;
            }
        }
        else
        {
            unassigned = NetEntityID.unassigned;
            flag       = false;
        }
        this.WriteHitInfo(sendStream, ref ray, didHit, ref hit, flag, unassigned);
    }
Exemplo n.º 7
0
    public static NetEntityID.Kind Of(Component component)
    {
        NetEntityID netEntityID;

        UnityEngine.MonoBehaviour monoBehaviour;
        return(NetEntityID.Of(component, out netEntityID, out monoBehaviour));
    }
Exemplo n.º 8
0
    public static Kind Of(GameObject entity, out NetEntityID entID, out MonoBehaviour view)
    {
        if (entity == null)
        {
            entID = unassigned;
            view  = null;
            return(Kind.Missing);
        }
        NetworkView component = entity.GetComponent <NetworkView>();

        if (component != null)
        {
            entID = new NetEntityID(component.viewID);
            view  = component;
            return(Kind.Net);
        }
        NGCView view3 = entity.GetComponent <NGCView>();

        if (view3 != null)
        {
            entID = new NetEntityID(view3);
            view  = view3;
            return(Kind.NGC);
        }
        entID = unassigned;
        view  = null;
        return(Kind.Missing);
    }
Exemplo n.º 9
0
    public static NetEntityID.Kind Of(UnityEngine.MonoBehaviour script)
    {
        NetEntityID netEntityID;

        UnityEngine.MonoBehaviour monoBehaviour;
        return(NetEntityID.Of(script, out netEntityID, out monoBehaviour));
    }
Exemplo n.º 10
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);
 }
Exemplo n.º 11
0
    public virtual void Local_SecondaryFire(ViewModel vm, ItemRepresentation itemRep, IMeleeWeaponItem itemInstance, ref HumanController.InputSample sample)
    {
        RaycastHit raycastHit;
        Character  character = itemInstance.character;

        if (character == null)
        {
            return;
        }
        if (Physics.SphereCast(character.eyesRay, 0.3f, out raycastHit, this.GetRange(), 406721553))
        {
            IDBase component = raycastHit.collider.gameObject.GetComponent <IDBase>();
            if (component)
            {
                NetEntityID netEntityID = NetEntityID.Get(component);
                if (component.GetLocal <RepairReceiver>() != null && netEntityID != NetEntityID.unassigned)
                {
                    if (vm)
                    {
                        vm.PlayFireAnimation();
                    }
                    itemInstance.QueueSwingSound(Time.time + this.swingSoundDelay);
                    itemRep.Action <NetEntityID>(2, uLink.RPCMode.Server, netEntityID);
                }
            }
        }
    }
Exemplo n.º 12
0
    protected void WriteHitInfo(uLink.BitStream sendStream, ref Ray ray, bool didHit, ref RaycastHit2 hit)
    {
        bool        flag;
        NetEntityID netEntityID;

        if (!didHit)
        {
            netEntityID = NetEntityID.unassigned;
            flag        = false;
        }
        else
        {
            IDBase dBase = hit.id;
            if (!dBase || !dBase.idMain)
            {
                flag        = false;
                netEntityID = NetEntityID.unassigned;
            }
            else
            {
                netEntityID = NetEntityID.Get(dBase.idMain);
                flag        = !netEntityID.isUnassigned;
            }
        }
        this.WriteHitInfo(sendStream, ref ray, didHit, ref hit, flag, netEntityID);
    }
Exemplo n.º 13
0
    public virtual void FireSingleBullet(uLink.BitStream sendStream, Ray ray, ItemRepresentation itemRep, out Component hitComponent, out bool allowBlood)
    {
        RaycastHit2 raycastHit2;
        Vector3     point;
        IDMain      dMain;
        Component   component;
        IDMain      dMain1;
        NetEntityID netEntityID = NetEntityID.unassigned;
        bool        flag        = false;
        bool        flag1       = Physics2.Raycast2(ray, out raycastHit2, this.GetBulletRange(itemRep), 406721553);

        if (!flag1)
        {
            dMain        = null;
            point        = ray.GetPoint(this.GetBulletRange(itemRep));
            hitComponent = null;
        }
        else
        {
            point = raycastHit2.point;
            IDBase dBase = raycastHit2.id;
            if (!raycastHit2.remoteBodyPart)
            {
                component = raycastHit2.collider;
            }
            else
            {
                component = raycastHit2.remoteBodyPart;
            }
            hitComponent = component;
            if (!dBase)
            {
                dMain1 = null;
            }
            else
            {
                dMain1 = dBase.idMain;
            }
            dMain = dMain1;
            if (dMain)
            {
                netEntityID = NetEntityID.Get(dMain);
                if (!netEntityID.isUnassigned)
                {
                    TakeDamage takeDamage = dMain.GetComponent <TakeDamage>();
                    if (takeDamage)
                    {
                        flag = true;
                        if (takeDamage.ShouldPlayHitNotification())
                        {
                            this.PlayHitNotification(point, null);
                        }
                    }
                }
            }
        }
        this.WriteHitInfo(sendStream, ref ray, flag1, ref raycastHit2, flag, netEntityID);
        allowBlood = (!flag1 ? false : flag);
    }
Exemplo n.º 14
0
 public NetEntityID(NetworkView view)
 {
     this = new NetEntityID();
     if (view != null)
     {
         this._viewID = view.viewID;
     }
 }
Exemplo n.º 15
0
 public NetEntityID(uLink.NetworkView view)
 {
     this = new NetEntityID();
     if (view)
     {
         this._viewID = view.viewID;
     }
 }
Exemplo n.º 16
0
 public NetEntityID(NGCView view)
 {
     this = new NetEntityID();
     if (view != null)
     {
         this.v = view.id;
     }
 }
Exemplo n.º 17
0
    public override void DoAction2(BitStream stream, ItemRepresentation rep, ref NetworkMessageInfo info)
    {
        NetEntityID yid = stream.Read <NetEntityID>(new object[0]);

        if (!yid.isUnassigned && (yid.idBase == null))
        {
        }
    }
Exemplo n.º 18
0
    public override void DoAction2(uLink.BitStream stream, ItemRepresentation rep, ref uLink.NetworkMessageInfo info)
    {
        NetEntityID netEntityID = stream.Read <NetEntityID>(new object[0]);

        if (!netEntityID.isUnassigned && !netEntityID.idBase)
        {
            return;
        }
    }
Exemplo n.º 19
0
    protected void SACH(NetEntityID makingForCharacterIDNow, uLink.NetworkMessageInfo info)
    {
        AudioSource audioSource = base.audio;

        if (audioSource)
        {
            audioSource.Play();
        }
    }
Exemplo n.º 20
0
    protected void SACH(NetEntityID makingForCharacterIDNow, NetworkMessageInfo info)
    {
        AudioSource audio = base.audio;

        if (audio != null)
        {
            audio.Play();
        }
    }
Exemplo n.º 21
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);
 }
Exemplo n.º 22
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));
 }
Exemplo n.º 23
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));
    }
Exemplo n.º 24
0
    private static object Deserializer(BitStream bs, params object[] codecOptions)
    {
        NetEntityID yid = new NetEntityID {
            p1 = bs.Read <ushort>(codecOptions)
        };

        if (yid.p1 == 0)
        {
            yid._viewID = bs.Read <NetworkViewID>(codecOptions);
            return(yid);
        }
        yid.p2 = bs.Read <ushort>(codecOptions);
        return(yid);
    }
Exemplo n.º 25
0
 public static Kind Of(Component component, out NetEntityID entID, out MonoBehaviour view)
 {
     if (component is MonoBehaviour)
     {
         return(Of((MonoBehaviour)component, out entID, out view));
     }
     if (component != null)
     {
         return(Of(component.gameObject, out entID, out view));
     }
     entID = unassigned;
     view  = null;
     return(Kind.Missing);
 }
Exemplo n.º 26
0
    private static void Serializer(uLink.BitStream bs, object value, params object[] codecOptions)
    {
        NetEntityID netEntityID = (NetEntityID)value;

        bs.Write <ushort>(netEntityID.p1, codecOptions);
        if (netEntityID.p1 != 0)
        {
            bs.Write <ushort>(netEntityID.p2, new object[0]);
        }
        else
        {
            bs.Write <uLink.NetworkViewID>(netEntityID._viewID, codecOptions);
        }
    }
Exemplo n.º 27
0
    private static void Serializer(BitStream bs, object value, params object[] codecOptions)
    {
        NetEntityID yid = (NetEntityID)value;

        bs.Write <ushort>(yid.p1, codecOptions);
        if (yid.p1 == 0)
        {
            bs.Write <NetworkViewID>(yid._viewID, codecOptions);
        }
        else
        {
            bs.Write <ushort>(yid.p2, new object[0]);
        }
    }
Exemplo n.º 28
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);
    }
Exemplo n.º 29
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);
    }
Exemplo n.º 30
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);
 }
Exemplo n.º 31
0
 internal void OnServerQuerySent(MonoBehaviour script, NetEntityID entID)
 {
     this.clientQuery = script;
     this.OnClientPromptBegin(new NetEntityID?(entID));
 }
Exemplo n.º 32
0
 internal static void Issue_Request(NetEntityID clientQueryEntID)
 {
     Context.network.RPC<NetEntityID>("Context:A", uLink.RPCMode.Server, clientQueryEntID);
 }
Exemplo n.º 33
0
 private void A(NetEntityID hit, uLink.NetworkMessageInfo info)
 {
 }
Exemplo n.º 34
0
 private void OnClientPromptBegin(NetEntityID? useID)
 {
     NetEntityID value;
     if (!useID.HasValue)
     {
         NetEntityID.Of(this.clientQuery, out value);
     }
     else
     {
         value = useID.Value;
     }
     this.clientQueryTime = NetCull.localTimeInMillis;
     Context.UICommands.Issue_Request(value);
     this.SetContextClientState(ContextClientState.Polling);
 }
Exemplo n.º 35
0
 private void NGC_OnInstantiate(NGCView view)
 {
     this.myID = NetEntityID.Get(this);
     this._resTarg = base.GetComponent<ResourceTarget>();
 }