Exemple #1
0
    // Token: 0x0600003F RID: 63 RVA: 0x0000301C File Offset: 0x0000121C
    public void ForceLast()
    {
        bool flag = global::SteamVR_Camera.values != null;

        if (flag)
        {
            foreach (object obj in global::SteamVR_Camera.values)
            {
                global::System.Collections.DictionaryEntry dictionaryEntry = (global::System.Collections.DictionaryEntry)obj;
                global::System.Reflection.FieldInfo        fieldInfo       = dictionaryEntry.Key as global::System.Reflection.FieldInfo;
                fieldInfo.SetValue(this, dictionaryEntry.Value);
            }
            global::SteamVR_Camera.values = null;
        }
        else
        {
            global::UnityEngine.Component[] components = base.GetComponents <global::UnityEngine.Component>();
            for (int i = 0; i < components.Length; i++)
            {
                global::SteamVR_Camera steamVR_Camera = components[i] as global::SteamVR_Camera;
                bool flag2 = steamVR_Camera != null && steamVR_Camera != this;
                if (flag2)
                {
                    bool flag3 = steamVR_Camera.flip != null;
                    if (flag3)
                    {
                        global::UnityEngine.Object.DestroyImmediate(steamVR_Camera.flip);
                    }
                    global::UnityEngine.Object.DestroyImmediate(steamVR_Camera);
                }
            }
            components = base.GetComponents <global::UnityEngine.Component>();
            bool flag4 = this != components[components.Length - 1] || this.flip == null;
            if (flag4)
            {
                bool flag5 = this.flip == null;
                if (flag5)
                {
                    this.flip = base.gameObject.AddComponent <global::SteamVR_CameraFlip>();
                }
                global::SteamVR_Camera.values = new global::System.Collections.Hashtable();
                global::System.Reflection.FieldInfo[] fields = base.GetType().GetFields(52);
                foreach (global::System.Reflection.FieldInfo fieldInfo2 in fields)
                {
                    bool flag6 = fieldInfo2.IsPublic || fieldInfo2.IsDefined(typeof(global::UnityEngine.SerializeField), true);
                    if (flag6)
                    {
                        global::SteamVR_Camera.values[fieldInfo2] = fieldInfo2.GetValue(this);
                    }
                }
                global::UnityEngine.GameObject gameObject = base.gameObject;
                global::UnityEngine.Object.DestroyImmediate(this);
                gameObject.AddComponent <global::SteamVR_Camera>().ForceLast();
            }
        }
    }
Exemple #2
0
        // Token: 0x060005D8 RID: 1496 RVA: 0x0001CA9C File Offset: 0x0001AC9C
        public static void SetPropertyOrField <T>(T obj, string name, object value)
        {
            global::System.Reflection.PropertyInfo property = typeof(T).GetProperty(name, 52);
            global::System.Reflection.FieldInfo    field    = typeof(T).GetField(name, 52);
            bool flag = property != null;

            if (flag)
            {
                property.SetValue(obj, value, null);
            }
            else
            {
                bool flag2 = field != null;
                if (flag2)
                {
                    field.SetValue(obj, value);
                }
                else
                {
                    global::VRGIN.Core.VRLog.Warn("Prop/Field not found!", global::System.Array.Empty <object>());
                }
            }
        }
Exemple #3
0
 // Token: 0x06000064 RID: 100 RVA: 0x00004460 File Offset: 0x00002660
 public void ReadConfig()
 {
     try
     {
         global::Valve.VR.HmdMatrix34_t pose = default(global::Valve.VR.HmdMatrix34_t);
         bool     flag  = false;
         object   obj   = this.config;
         string[] array = global::System.IO.File.ReadAllLines(this.configPath);
         foreach (string text in array)
         {
             string[] array3 = text.Split('=', 0);
             bool     flag2  = array3.Length == 2;
             if (flag2)
             {
                 string text2 = array3[0];
                 bool   flag3 = text2 == "m";
                 if (flag3)
                 {
                     string[] array4 = array3[1].Split(',', 0);
                     bool     flag4  = array4.Length == 12;
                     if (flag4)
                     {
                         pose.m0  = float.Parse(array4[0]);
                         pose.m1  = float.Parse(array4[1]);
                         pose.m2  = float.Parse(array4[2]);
                         pose.m3  = float.Parse(array4[3]);
                         pose.m4  = float.Parse(array4[4]);
                         pose.m5  = float.Parse(array4[5]);
                         pose.m6  = float.Parse(array4[6]);
                         pose.m7  = float.Parse(array4[7]);
                         pose.m8  = float.Parse(array4[8]);
                         pose.m9  = float.Parse(array4[9]);
                         pose.m10 = float.Parse(array4[10]);
                         pose.m11 = float.Parse(array4[11]);
                         flag     = true;
                     }
                 }
                 else
                 {
                     bool flag5 = text2 == "disableStandardAssets";
                     if (flag5)
                     {
                         global::System.Reflection.FieldInfo field = obj.GetType().GetField(text2);
                         bool flag6 = field != null;
                         if (flag6)
                         {
                             field.SetValue(obj, bool.Parse(array3[1]));
                         }
                     }
                     else
                     {
                         global::System.Reflection.FieldInfo field2 = obj.GetType().GetField(text2);
                         bool flag7 = field2 != null;
                         if (flag7)
                         {
                             field2.SetValue(obj, float.Parse(array3[1]));
                         }
                     }
                 }
             }
         }
         this.config = (global::SteamVR_ExternalCamera.Config)obj;
         bool flag8 = flag;
         if (flag8)
         {
             global::SteamVR_Utils.RigidTransform rigidTransform = new global::SteamVR_Utils.RigidTransform(pose);
             this.config.x = rigidTransform.pos.x;
             this.config.y = rigidTransform.pos.y;
             this.config.z = rigidTransform.pos.z;
             global::UnityEngine.Vector3 eulerAngles = rigidTransform.rot.eulerAngles;
             this.config.rx = eulerAngles.x;
             this.config.ry = eulerAngles.y;
             this.config.rz = eulerAngles.z;
         }
     }
     catch
     {
     }
 }
Exemple #4
0
        public static object slowSetField(object obj, string field, object @value)
        {
            if ((obj == null))
            {
                throw new global::System.NullReferenceException(global::haxe.lang.Runtime.concat(global::haxe.lang.Runtime.concat("Cannot access field \'", field), "\' of null."));
            }

            global::System.Type t = ((global::System.Type)((obj as global::System.Type)));
            global::System.Reflection.BindingFlags bf = default(global::System.Reflection.BindingFlags);
            if ((t == null))
            {
                t  = ((global::System.Type)(obj.GetType()));
                bf = ((global::System.Reflection.BindingFlags)((((global::System.Reflection.BindingFlags)((((global::System.Reflection.BindingFlags)(global::System.Reflection.BindingFlags.Instance)) | ((global::System.Reflection.BindingFlags)(global::System.Reflection.BindingFlags.Public))))) | ((global::System.Reflection.BindingFlags)(global::System.Reflection.BindingFlags.FlattenHierarchy)))));
            }
            else
            {
                obj = null;
                bf  = ((global::System.Reflection.BindingFlags)((((global::System.Reflection.BindingFlags)(global::System.Reflection.BindingFlags.Static)) | ((global::System.Reflection.BindingFlags)(global::System.Reflection.BindingFlags.Public)))));
            }

            global::System.Reflection.FieldInfo f = t.GetField(((string)(field)), ((global::System.Reflection.BindingFlags)(bf)));
            if ((f != null))
            {
                if ((f.FieldType as global::System.Reflection.MemberInfo).ToString().StartsWith("haxe.lang.Null"))
                {
                    @value = global::haxe.lang.Runtime.mkNullable(@value, f.FieldType);
                }

                if ((((@value != null) && global::System.Object.ReferenceEquals(((global::System.Type)(typeof(global::System.Double))), ((object)(@value.GetType())))) && !(global::System.Object.ReferenceEquals(((object)(t)), ((object)(f.FieldType))))))
                {
                    @value = ((global::System.IConvertible)((@value as global::System.IConvertible))).ToType(((global::System.Type)(f.FieldType)), default(global::System.IFormatProvider));
                }

                f.SetValue(((object)(obj)), ((object)(@value)));
                return(@value);
            }
            else
            {
                global::System.Reflection.PropertyInfo prop = t.GetProperty(((string)(field)), ((global::System.Reflection.BindingFlags)(bf)));
                if ((prop == null))
                {
                    if (t.IsCOMObject)
                    {
                        try {
                            return(t.InvokeMember(((string)(field)), ((global::System.Reflection.BindingFlags)(global::System.Reflection.BindingFlags.SetProperty)), default(global::System.Reflection.Binder), ((object)(obj)), ((object[])(new object[] { ((object)(@value)) }))));
                        }
                        catch (global::System.Exception e) {
                            global::haxe.lang.Exceptions.exception = e;
                        }
                    }

                    throw global::haxe.lang.HaxeException.wrap(global::haxe.lang.Runtime.concat(global::haxe.lang.Runtime.concat(global::haxe.lang.Runtime.concat("Field \'", field), "\' not found for writing from Class "), global::Std.@string(t)));
                }

                if ((prop.PropertyType as global::System.Reflection.MemberInfo).ToString().StartsWith("haxe.lang.Null"))
                {
                    @value = global::haxe.lang.Runtime.mkNullable(@value, prop.PropertyType);
                }

                if ((global::System.Object.ReferenceEquals(((global::System.Type)(typeof(global::System.Double))), ((object)(@value.GetType()))) && !(global::System.Object.ReferenceEquals(((object)(t)), ((object)(f.FieldType))))))
                {
                    @value = ((global::System.IConvertible)((@value as global::System.IConvertible))).ToType(((global::System.Type)(f.FieldType)), default(global::System.IFormatProvider));
                }

                prop.SetValue(((object)(obj)), ((object)(@value)), default(object[]));
                return(@value);
            }
        }