// Token: 0x06000055 RID: 85 RVA: 0x00003D14 File Offset: 0x00001F14
 private void OnEnable()
 {
     for (int i = 0; i < this.objects.Length; i++)
     {
         global::UnityEngine.GameObject gameObject = this.objects[i];
         bool flag = gameObject != null;
         if (flag)
         {
             gameObject.SetActive(false);
         }
     }
     this.OnTrackedDeviceRoleChanged(global::System.Array.Empty <object>());
     for (int j = 0; j < global::SteamVR.connected.Length; j++)
     {
         bool flag2 = global::SteamVR.connected[j];
         if (flag2)
         {
             this.OnDeviceConnected(new object[]
             {
                 j,
                 true
             });
         }
     }
     global::SteamVR_Utils.Event.Listen("input_focus", new global::SteamVR_Utils.Event.Handler(this.OnInputFocus));
     global::SteamVR_Utils.Event.Listen("device_connected", new global::SteamVR_Utils.Event.Handler(this.OnDeviceConnected));
     global::SteamVR_Utils.Event.Listen("TrackedDeviceRoleChanged", new global::SteamVR_Utils.Event.Handler(this.OnTrackedDeviceRoleChanged));
 }
    // Token: 0x0600005A RID: 90 RVA: 0x00003FD4 File Offset: 0x000021D4
    private void SetTrackedDeviceIndex(int objectIndex, uint trackedDeviceIndex)
    {
        bool flag = trackedDeviceIndex != uint.MaxValue;

        if (flag)
        {
            for (int i = 0; i < this.objects.Length; i++)
            {
                bool flag2 = i != objectIndex && this.indices[i] == trackedDeviceIndex;
                if (flag2)
                {
                    global::UnityEngine.GameObject gameObject = this.objects[i];
                    bool flag3 = gameObject != null;
                    if (flag3)
                    {
                        gameObject.SetActive(false);
                    }
                    this.indices[i] = uint.MaxValue;
                }
            }
        }
        bool flag4 = trackedDeviceIndex != this.indices[objectIndex];

        if (flag4)
        {
            this.indices[objectIndex] = trackedDeviceIndex;
            global::UnityEngine.GameObject gameObject2 = this.objects[objectIndex];
            bool flag5 = gameObject2 != null;
            if (flag5)
            {
                bool flag6 = trackedDeviceIndex == uint.MaxValue;
                if (flag6)
                {
                    gameObject2.SetActive(false);
                }
                else
                {
                    gameObject2.SetActive(true);
                    gameObject2.BroadcastMessage("SetDeviceIndex", (int)trackedDeviceIndex, 1);
                }
            }
        }
    }
Exemple #3
0
        // Token: 0x06000589 RID: 1417 RVA: 0x0001B8F8 File Offset: 0x00019AF8
        private global::System.Collections.IEnumerator Measure()
        {
            global::System.Collections.Generic.List <global::UnityEngine.GameObject> queue = global::System.Linq.Enumerable.ToList <global::UnityEngine.GameObject>(global::System.Linq.Enumerable.Where <global::UnityEngine.GameObject>(global::System.Linq.Enumerable.Except <global::UnityEngine.GameObject>(global::VRGIN.Helpers.UnityHelper.GetRootNodes(), new global::UnityEngine.GameObject[]
            {
                base.gameObject
            }), (global::UnityEngine.GameObject n) => !n.name.StartsWith("VRGIN") && !n.name.StartsWith("[")));
            yield return(base.StartCoroutine(this.MeasureFramerate(30)));

            double startInterval = this._CurrentInterval;

            global::VRGIN.Core.VRLog.Info("Starting to profile! This might take a while...", global::System.Array.Empty <object>());
            while (queue.Count > 0)
            {
                global::UnityEngine.GameObject obj = global::System.Linq.Enumerable.First <global::UnityEngine.GameObject>(queue);
                queue.RemoveAt(0);
                bool flag = !obj.activeInHierarchy;
                if (!flag)
                {
                    obj.SetActive(false);
                    yield return(base.StartCoroutine(this.MeasureFramerate(30)));

                    obj.SetActive(true);
                    double impact = startInterval / this._CurrentInterval;
                    global::VRGIN.Core.VRLog.Info("{0}{1}: {2:0.00}", new object[]
                    {
                        string.Join("", global::System.Linq.Enumerable.ToArray <string>(global::System.Linq.Enumerable.Repeat <string>(" ", obj.transform.Depth()))),
                        obj.name,
                        impact
                    });
                    bool flag2 = impact > 1.1499999761581421;
                    if (flag2)
                    {
                        queue.InsertRange(0, obj.Children());
                        foreach (global::UnityEngine.Behaviour component in global::System.Linq.Enumerable.Where <global::UnityEngine.Behaviour>(obj.GetComponents <global::UnityEngine.Behaviour>(), (global::UnityEngine.Behaviour c) => c.enabled))
                        {
                            component.enabled = false;
                            yield return(base.StartCoroutine(this.MeasureFramerate(30)));

                            component.enabled = true;
                            impact            = startInterval / this._CurrentInterval;
                            global::VRGIN.Core.VRLog.Info("{0}{1} [{2}]: {3:0.000}", new object[]
                            {
                                string.Join("", global::System.Linq.Enumerable.ToArray <string>(global::System.Linq.Enumerable.Repeat <string>(" ", obj.transform.Depth()))),
                                obj.name,
                                component.GetType().Name,
                                impact
                            });
                            component = null;
                        }
                        global::System.Collections.Generic.IEnumerator <global::UnityEngine.Behaviour> enumerator = null;
                    }
                    yield return(null);

                    obj = null;
                }
            }
            global::VRGIN.Core.VRLog.Info("Done!", global::System.Array.Empty <object>());
            this._Callback();
            global::UnityEngine.Object.Destroy(base.gameObject);
            yield break;
            yield break;
        }