public NetEntityID(uLink.NetworkViewID viewID) { this = new NetEntityID() { _viewID = viewID }; }
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); } }
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); }
public static NetEntityID.Kind Of(GameObject entity) { NetEntityID netEntityID; UnityEngine.MonoBehaviour monoBehaviour; return(NetEntityID.Of(entity, out netEntityID, out monoBehaviour)); }
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); }
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); }
public static NetEntityID.Kind Of(Component component) { NetEntityID netEntityID; UnityEngine.MonoBehaviour monoBehaviour; return(NetEntityID.Of(component, out netEntityID, out monoBehaviour)); }
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); }
public static NetEntityID.Kind Of(UnityEngine.MonoBehaviour script) { NetEntityID netEntityID; UnityEngine.MonoBehaviour monoBehaviour; return(NetEntityID.Of(script, out netEntityID, out monoBehaviour)); }
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); }
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); } } } }
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); }
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); }
public NetEntityID(NetworkView view) { this = new NetEntityID(); if (view != null) { this._viewID = view.viewID; } }
public NetEntityID(uLink.NetworkView view) { this = new NetEntityID(); if (view) { this._viewID = view.viewID; } }
public NetEntityID(NGCView view) { this = new NetEntityID(); if (view != null) { this.v = view.id; } }
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)) { } }
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; } }
protected void SACH(NetEntityID makingForCharacterIDNow, uLink.NetworkMessageInfo info) { AudioSource audioSource = base.audio; if (audioSource) { audioSource.Play(); } }
protected void SACH(NetEntityID makingForCharacterIDNow, NetworkMessageInfo info) { AudioSource audio = base.audio; if (audio != null) { audio.Play(); } }
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); }
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)); }
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)); }
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); }
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); }
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); } }
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]); } }
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); }
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); }
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); }
internal void OnServerQuerySent(MonoBehaviour script, NetEntityID entID) { this.clientQuery = script; this.OnClientPromptBegin(new NetEntityID?(entID)); }
internal static void Issue_Request(NetEntityID clientQueryEntID) { Context.network.RPC<NetEntityID>("Context:A", uLink.RPCMode.Server, clientQueryEntID); }
private void A(NetEntityID hit, uLink.NetworkMessageInfo info) { }
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); }
private void NGC_OnInstantiate(NGCView view) { this.myID = NetEntityID.Get(this); this._resTarg = base.GetComponent<ResourceTarget>(); }