예제 #1
0
 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));
 }
예제 #2
0
        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);
        }
예제 #3
0
파일: NetUtils.cs 프로젝트: virror/PlayoVR
 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);
 }