コード例 #1
0
 public override void Load(Utility utility)
 {
     // NOTE: This is not actually a shift to another object, this is just
     // for convenience since the type is dynamic and my system doesn't
     // really support that.
     Content = AnimGroupElementBase.Load(utility);
 }
コード例 #2
0
        public static AnimGroupElementBase Load(Utility utility)
        {
            AnimGroupElementBase result = null;

            // We need to load the TypeId because it tells us what kind of AnimGroupElement to expect...
            var typeId = utility.ReadU32();

            if (typeId == 0x00080000)
            {
                result = new AnimGroupMeshNodeVis();
            }
            else if (typeId == 0x01000000)
            {
                result = new AnimGroupMesh();
            }
            else if (typeId == 0x02000000)
            {
                result = new AnimGroupTexSampler();
            }
            else if (typeId == 0x04000000)
            {
                result = new AnimGroupBlendOp();
            }
            else if (typeId == 0x08000000)
            {
                result = new AnimGroupMaterialColor();
            }
            else if (typeId == 0x10000000)
            {
                result = new AnimGroupModel();
            }
            else if (typeId == 0x20000000)
            {
                result = new AnimGroupTexMapper();
            }
            else if (typeId == 0x40000000)
            {
                result = new AnimGroupBone();
            }
            else if (typeId == 0x80000000)
            {
                result = new AnimGroupTexCoord();
            }

            if (result == null)
            {
                throw new NotImplementedException($"Unknown AnimGroupElement type {typeId.ToString("X8")}!");
            }

            CGFXDebug.LoadStart(result, utility, hasDynamicType: true);

            // Otherwise, proceed...
            result.TypeId       = typeId;
            result.Name         = utility.ReadString();
            result.MemberOffset = utility.ReadI32();
            result.BlendOpIndex = utility.ReadI32();
            result.ObjType      = (AnimGroupObjType)utility.ReadU32();
            result.MemberType   = utility.ReadU32();
            result.MaterialPtr  = utility.ReadU32();

            result.LoadInternal(utility);

            return(result);
        }