Esempio n. 1
0
        public static Node3D LoadNode(string path)
        {
            FileStream   fs = new FileStream(path, FileMode.Open, FileAccess.Read);
            BinaryReader r  = new BinaryReader(fs);

            Help.IOHelp.r = r;

            int et = IOHelp.ReadInt();

            switch (et)
            {
            case 1:
                var new_ent = new Entity3D();
                new_ent.Read();
                fs.Close();
                return(new_ent);

                break;

            case 2:
                var new_node = new Node3D();
                new_node.Read();
                fs.Close();
                return(new_node);

                break;
            }

            fs.Close();
            return(null);
        }
Esempio n. 2
0
        public void ReadClass(object cls)
        {
            var cn = IOHelp.ReadString();
            var np = IOHelp.ReadInt();

            foreach (var prop in cls.GetType().GetProperties())
            {
                var pn = IOHelp.ReadString();
                int pt = IOHelp.ReadInt();
                switch (pt)
                {
                case -1:
                    prop.SetValue(cls, null);
                    break;

                case 0:
                    prop.SetValue(cls, IOHelp.ReadString());
                    break;

                case 1:
                    prop.SetValue(cls, IOHelp.ReadInt());
                    break;

                case 2:
                    prop.SetValue(cls, IOHelp.ReadFloat());
                    break;

                case 3:
                    prop.SetValue(cls, IOHelp.ReadDouble());
                    break;

                case 4:
                    prop.SetValue(cls, IOHelp.ReadTexture2D());
                    break;

                case 5:
                    prop.SetValue(cls, IOHelp.ReadBool());
                    break;

                case 6:
                    prop.SetValue(cls, IOHelp.ReadVec3());
                    break;

                case 7:
                    prop.SetValue(cls, IOHelp.ReadVec4());
                    break;

                case 8:
                    prop.SetValue(cls, IOHelp.ReadMatrix());
                    break;

                case 9:

                    dynamic nl = prop.GetValue(cls);

                    nl.Clear();

                    int ec = IOHelp.ReadInt();

                    for (int i = 0; i < ec; i++)
                    {
                    }


                    break;
                }
            }
        }
Esempio n. 3
0
 public override void LoadNode()
 {
     _Body        = (BodyType)IOHelp.ReadInt();
     _InertiaDrag = IOHelp.ReadInt();
 }