public BaseNameTable(UObject uObj, string fileName, bool useInvisitek, bool useLayers)
 {
     UObj         = uObj;
     TextObject   = uObj.Decompile();
     FileName     = fileName;
     UseInvisitek = useInvisitek;
     UseLayers    = useLayers;
 }
示例#2
0
 private void dataGridView1_SelectionChanged(object sender, EventArgs e)
 {
     FindObject(sender as DataGridView);
     if (selectedObject != null)
     {
         selectedObject.Decompile();
         if (selectedObject.IsClassType("Texture"))
         {
             SharpGL.SceneGraph.Assets.Texture cube_texture = new SharpGL.SceneGraph.Assets.Texture();
             Bitmap texture = LibSquish.GetImage((UTexture)selectedObject);
             cube_texture.Create(gl, texture);
             SharpGL.SceneGraph.Assets.Material material = new SharpGL.SceneGraph.Assets.Material();
             material.Texture = cube_texture;
             cube             = new Cube();
             cube.Material    = material;
             BoundingVolume boundingVolume = cube.BoundingVolume;
             float[]        extent         = new float[3];
             cube.BoundingVolume.GetBoundDimensions(out extent[0], out extent[1], out extent[2]);
             float maxExtent   = extent.Max();
             float scaleFactor = maxExtent > 10 ? 10.0f / maxExtent : 1;
             cube.Transformation.ScaleX = scaleFactor;
             cube.Transformation.ScaleY = scaleFactor;
             cube.Transformation.ScaleZ = scaleFactor;
         }
         if (selectedObject.IsClassType("Sound"))
         {
             PlaySound();
         }
         if (selectedObject.IsClassType("StaticMesh"))
         {
             smi = new StaticMeshInstance();
             smi.Init((UStaticMesh)selectedObject, gl);
             BoundingVolume boundingVolume = smi.BoundingVolume;
             float[]        extent         = new float[3];
             smi.BoundingVolume.GetBoundDimensions(out extent[0], out extent[1], out extent[2]);
             float maxExtent = extent.Max();
             //  Scale so that we are at most 10 units in size.
             float scaleFactor = maxExtent > 10 ? 10.0f / maxExtent : 1;
             smi.Transformation.ScaleX  = scaleFactor;
             smi.Transformation.ScaleY  = scaleFactor;
             smi.Transformation.ScaleZ  = scaleFactor;
             smi.Transformation.RotateX = -90;
         }
     }
 }
示例#3
0
        protected override void Deserialize()
        {
            base.Deserialize();
            Console.WriteLine("==================================");
            Type type = this.GetType();

            foreach (UDefaultProperty p in Properties)
            {
                string       line         = p.Decompile();
                var          kv           = line.Split('=');
                PropertyInfo propertyInfo = type.GetProperty(kv[0]);
                object       propertyVal  = kv[1].Trim();
                Type         propertyType = propertyInfo.PropertyType;
                if (propertyType != typeof(UObject))
                {
                    var targetType = IsNullableType(propertyInfo.PropertyType) ? Nullable.GetUnderlyingType(propertyInfo.PropertyType) : propertyInfo.PropertyType;
                    propertyVal = Convert.ChangeType(propertyVal, targetType);
                    propertyInfo.SetValue(this, propertyVal, null);
                }
                else
                {
                    string temp_str;
                    temp_str = kv[1].Mid(kv[1].IndexOf("'"));
                    temp_str = temp_str.Substring(1, temp_str.Length - 2);
                    string u_type = kv[1].Left(kv[1].IndexOf("'"));
                    u_type = "UELib.Engine.U" + u_type;
                    UObject obj = this.Package.FindObject(temp_str, Extensions.FindType(u_type));
                    if (obj != null)
                    {
                        obj.Decompile();
                    }
                    propertyInfo.SetValue(this, obj, null);
                    Console.WriteLine();
                }
            }
            Console.WriteLine("==================================");
        }