示例#1
0
 static string smethod_6(VRCPunBehaviour vrcpunBehaviour_0)
 {
     return(vrcpunBehaviour_0.OwnerUserId);
 }
示例#2
0
 static void smethod_10(VRCPunBehaviour vrcpunBehaviour_0)
 {
     vrcpunBehaviour_0.RequestOwnership();
 }
示例#3
0
    // Token: 0x060052E5 RID: 21221 RVA: 0x001C6B64 File Offset: 0x001C4F64
    public IEnumerator Ready()
    {
        if (!NetworkMetadata.AllMetadata.Contains(this))
        {
            NetworkMetadata.AllMetadata.Add(this);
        }
        if (this.isReady)
        {
            yield break;
        }
        this.isReady    = false;
        this.combinedID = null;
        this.waitingFor = "photon view IDs";
        PhotonView[] views = base.gameObject.GetComponents <PhotonView>();
        while (this != null)
        {
            if (!views.Any((PhotonView v) => v != null && v.viewID <= 0))
            {
                break;
            }
            INetworkID      netID = base.gameObject.GetComponent <INetworkID>();
            VRCPunBehaviour vrc   = base.gameObject.GetComponent <VRCPunBehaviour>();
            foreach (PhotonView photonView in views)
            {
                if (netID != null && netID.NetworkID > 0)
                {
                    photonView.viewID = netID.NetworkID;
                }
                else if (vrc != null && vrc.ReservedID > 0)
                {
                    photonView.viewID = vrc.ReservedID;
                }
            }
            yield return(null);
        }
        if (this == null)
        {
            yield break;
        }
        this.waitingFor = "network to settle";
        while (this != null && (NetworkManager.Instance == null || !VRC.Network.IsNetworkSettled))
        {
            yield return(null);
        }
        if (this == null)
        {
            yield break;
        }
        this.waitingFor = "event handlers";
        VRC_EventHandler evtHandler = base.gameObject.GetComponent <VRC_EventHandler>();

        yield return(VRC.Network.ConfigureEventHandler(evtHandler));

        this.waitingFor = "children to ready";
        bool childrenNotReady = true;

        while (this != null && childrenNotReady)
        {
            childrenNotReady = false;
            for (int idx = 0; idx < base.transform.childCount; idx++)
            {
                Transform t = base.transform.GetChild(idx);
                if (!(t == null))
                {
                    GameObject child = base.transform.GetChild(idx).gameObject;
                    if (child != null && child.activeInHierarchy && !VRC.Network.IsObjectReady(child))
                    {
                        childrenNotReady = true;
                        this.waitingFor  = child.name + " to ready";
                        yield return(null);

                        break;
                    }
                }
            }
        }
        if (this == null)
        {
            yield break;
        }
        this.waitingFor = "blockReady to be lifted by " + string.Join(", ", (from b in this.blockReady
                                                                             select b.GetType().Name).ToArray <string>());
        while (this != null && this.blockReady.Count > 0)
        {
            yield return(null);
        }
        if (this == null)
        {
            yield break;
        }
        this.waitingFor = "local player to ready";
        while (this != null && VRC.Network.LocalPlayer == null)
        {
            yield return(null);
        }
        if (this == null)
        {
            yield break;
        }
        if (!base.gameObject.IsPlayer())
        {
            VRC.Player localPlayer = VRC.Network.LocalPlayer;
            while (this != null && !base.gameObject.IsPlayer() && !localPlayer.gameObject.IsReady())
            {
                yield return(null);
            }
            if (this == null)
            {
                yield break;
            }
        }
        this.waitingFor     = "configuration";
        this.combinedID     = VRC.Network.GetCombinedID(base.gameObject);
        this.isInstantiated = (base.GetComponent <ObjectInstantiatorHandle>() != null);
        this.sendCallbacks  = (base.GetComponent <NetworkManager>() == null);
        if (this.combinedID != null)
        {
            if (NetworkMetadata.ObjectCache.ContainsKey(this.combinedID.Value))
            {
                NetworkMetadata.ObjectCache.Remove(this.combinedID.Value);
            }
            NetworkMetadata.ObjectCache.Add(this.combinedID.Value, base.gameObject);
        }
        this.isReady    = true;
        this.waitingFor = "callbacks to finish";
        if (this.sendCallbacks)
        {
            try
            {
                base.SendMessage("OnNetworkReady", SendMessageOptions.DontRequireReceiver);
            }
            catch (MissingMethodException)
            {
            }
            catch (Exception exception)
            {
                Debug.LogException(exception, base.gameObject);
            }
        }
        this.waitingFor = "nothing";
        yield break;
    }