Пример #1
0
    // Token: 0x0600000D RID: 13 RVA: 0x00002220 File Offset: 0x00000620
    public void SetFrame(int frameId)
    {
        if (frameId < 0)
        {
            return;
        }
        this.DeactivateSprites();
        AnmFrame anmFrame = this.anmData.frames[frameId];

        for (int i = 0; i < anmFrame.spriteSize; i++)
        {
            int sprite = anmFrame.spriteIndex + i;
            this.SetSprite(sprite);
        }
    }
Пример #2
0
    // Token: 0x06000015 RID: 21 RVA: 0x00002550 File Offset: 0x00000950
    public void Load(byte[] bytes)
    {
        Stream input = new MemoryStream(bytes);

        using (BinaryReader binaryReader = new BigEndianBinaryReader(input))
        {
            int num = (int)binaryReader.ReadByte();
            this.modules = new AnmModule[num];
            for (int i = 0; i < num; i++)
            {
                AnmModule anmModule = default(AnmModule);
                anmModule.x     = (int)binaryReader.ReadByte();
                anmModule.y     = (int)binaryReader.ReadByte();
                anmModule.w     = (int)binaryReader.ReadByte();
                anmModule.h     = (int)binaryReader.ReadByte();
                this.modules[i] = anmModule;
            }
            int num2 = (int)binaryReader.ReadByte();
            for (int j = 0; j < num2; j++)
            {
                int num3 = (int)binaryReader.ReadByte();
                int num4 = (int)binaryReader.ReadByte();
                int num5 = (int)binaryReader.ReadByte();
                if (num4 == 0)
                {
                    AnmModule[] array = this.modules;
                    int         num6  = num3;
                    array[num6].x = (array[num6].x | num5 << 8);
                }
                else if (num4 == 1)
                {
                    AnmModule[] array2 = this.modules;
                    int         num7   = num3;
                    array2[num7].y = (array2[num7].y | num5 << 8);
                }
                else if (num4 == 2)
                {
                    AnmModule[] array3 = this.modules;
                    int         num8   = num3;
                    array3[num8].w = (array3[num8].w | num5 << 8);
                }
                else if (num4 == 3)
                {
                    AnmModule[] array4 = this.modules;
                    int         num9   = num3;
                    array4[num9].h = (array4[num9].h | num5 << 8);
                }
            }
            int num10 = (int)binaryReader.ReadByte();
            this.frames = new AnmFrame[num10];
            for (int k = 0; k < num10; k++)
            {
                AnmFrame anmFrame = default(AnmFrame);
                anmFrame.spriteIndex = (int)binaryReader.ReadUInt16();
                anmFrame.spriteSize  = (int)binaryReader.ReadByte();
                anmFrame.gx          = (int)binaryReader.ReadInt16();
                anmFrame.gy          = (int)binaryReader.ReadInt16();
                anmFrame.gr          = (int)binaryReader.ReadInt16();
                anmFrame.gb          = (int)binaryReader.ReadInt16();
                anmFrame.rx          = (int)binaryReader.ReadInt16();
                anmFrame.ry          = (int)binaryReader.ReadInt16();
                anmFrame.rr          = (int)binaryReader.ReadInt16();
                anmFrame.rb          = (int)binaryReader.ReadInt16();
                this.frames[k]       = anmFrame;
            }
            int num11 = (int)binaryReader.ReadInt16();
            this.sprites = new AnmSprite[num11];
            for (int l = 0; l < num11; l++)
            {
                AnmSprite anmSprite = default(AnmSprite);
                anmSprite.module = (int)binaryReader.ReadByte();
                anmSprite.x      = (int)binaryReader.ReadInt16();
                anmSprite.y      = (int)binaryReader.ReadInt16();
                anmSprite.flip   = (int)binaryReader.ReadByte();
                this.sprites[l]  = anmSprite;
            }
            int num12 = (int)binaryReader.ReadByte();
            this.actions = new AnmAction[num12];
            for (int m = 0; m < num12; m++)
            {
                AnmAction anmAction = default(AnmAction);
                anmAction.sequenceIndex = (int)binaryReader.ReadInt16();
                anmAction.sequenceSize  = (int)binaryReader.ReadChar();
                anmAction.ex1           = (int)binaryReader.ReadChar();
                anmAction.ex2           = (int)binaryReader.ReadChar();
                this.actions[m]         = anmAction;
            }
            int num13 = (int)binaryReader.ReadUInt16();
            this.sequences = new AnmSequence[num13];
            int n = 0;
            while (n < num13)
            {
                int frame = (int)binaryReader.ReadByte();
                int num14 = (int)binaryReader.ReadByte();
                for (int num15 = 0; num15 < num14; num15++)
                {
                    this.sequences[n].frame = frame;
                    n++;
                }
            }
        }
    }