private static string GetNetworkHandlePath(Transform obj, MonoBehaviour script) { if (script != null) { if (script.transform == obj) { return(null); } if (script is NetworkAttachment) { NetworkAttachment na = (NetworkAttachment)script; return(NetUtils.RelPath(obj.parent, na.transform)); } if (script is PhotonView) { PhotonView pv = (PhotonView)script; return(NetUtils.RelPath(obj.parent, pv.transform)); } if (script is PhotonViewLink) { PhotonViewLink pvl = (PhotonViewLink)script; return(null); // TODO see if we can return some path here } } return(NetUtils.GetPath(obj)); }
private static MonoBehaviour GetNetworkHandle(Transform obj) { NetworkAttachment na = obj.GetComponentInParent <NetworkAttachment>(); if (na != null) { return(na); } PhotonView pv = obj.GetComponentInParent <PhotonView>(); if (pv != null) { return(pv); } PhotonViewLink pvl = obj.GetComponentInParent <PhotonViewLink>(); if (pvl != null) { return(pvl); } PhotonViewLink pvl2 = obj.parent.GetComponentInParent <PhotonViewLink>(); if (pvl2 != null) { return(pvl2); } return(null); }
public NetworkAttachment GetNetworkAttachment() { if (parentHandleId < 0) { return(NetworkAttachment.Find(parentHandleId)); } else { return(null); } }
private static MonoBehaviour FindNetworkReferenceParent(int parentHandleId) { MonoBehaviour parent; if (parentHandleId > 0) { PhotonView pv = PhotonView.Find(parentHandleId); parent = pv; } else if (parentHandleId < 0) { NetworkAttachment na = NetworkAttachment.Find(parentHandleId); parent = na; } else { parent = null; } return(parent); }
private static int GetNetworkHandleId(MonoBehaviour script) { if (script != null) { if (script is NetworkAttachment) { NetworkAttachment na = (NetworkAttachment)script; return(-na.id); } if (script is PhotonView) { PhotonView pv = (PhotonView)script; return(pv.viewID); } if (script is PhotonViewLink) { PhotonViewLink pvl = (PhotonViewLink)script; return(pvl.linkedView.viewID); } } return(0); }