示例#1
0
 public void ReadFrom(IDataInputStream stream)
 {
     X = stream.ReadSingle();
     Y = stream.ReadSingle();
     Z = stream.ReadSingle();
     W = stream.ReadSingle();
 }
示例#2
0
 public void ReadFrom(IDataInputStream stream)
 {
     lowOpen  = stream.ReadBoolean();
     low      = stream.ReadSingle();
     highOpen = stream.ReadBoolean();
     high     = stream.ReadSingle();
 }
示例#3
0
            public void ReadFrom(IDataInputStream stream)
            {
                repeatStartTime = stream.ReadSingle();
                int length = stream.ReadInt32();

                commands = new AnimCommand[length];
                for (int j = 0; j < length; ++j)
                {
                    commands[j] = InputStreamHelper.ReadStorySceneObjectCommand(stream);
                }
            }
示例#4
0
        public static AnimCommand ReadStorySceneObjectCommand(IDataInputStream stream)
        {
            AnimCommand ret;
            bool        isCameraCmd = stream.ReadBoolean();
            bool        isEasedCmd  = stream.ReadBoolean();
            float       startTime   = stream.ReadSingle();

            if (isCameraCmd)
            {
                if (isEasedCmd)
                {
                    CameraAttrType attrType = (CameraAttrType)stream.ReadByte();
                    EaseType       esType   = (EaseType)stream.ReadByte();
                    float          duration = stream.ReadSingle();
                    switch (attrType)
                    {
                    case CameraAttrType.Position: {
                        var posCmd = new EaseCameraPosition();
                        posCmd.val.ReadFrom(stream);
                        ret = posCmd;
                    }
                    break;

                    case CameraAttrType.Zoom: {
                        var zoomCmd = new EaseCameraZoom();
                        zoomCmd.val = stream.ReadSingle();
                        ret         = zoomCmd;
                    }
                    break;

                    default:
                        throw new NotImplementedException();
                    }
                    var easeAttrCmd = (EaseCameraAttribute)ret;
                    easeAttrCmd.esType   = esType;
                    easeAttrCmd.duration = duration;
                }
                else
                {
                    CameraAttrType attrType = (CameraAttrType)stream.ReadByte();
                    switch (attrType)
                    {
                    case CameraAttrType.Position: {
                        var posCmd = new SetCameraPosition();
                        posCmd.val.ReadFrom(stream);
                        ret = posCmd;
                    }
                    break;

                    case CameraAttrType.Zoom: {
                        var zoomCmd = new SetCameraZoom();
                        zoomCmd.val = stream.ReadSingle();
                        ret         = zoomCmd;
                    }
                    break;

                    default:
                        throw new NotImplementedException();
                    }
                }
            }
            else
            {
                if (isEasedCmd)
                {
                    ObjectAttrType attrType = (ObjectAttrType)stream.ReadByte();
                    EaseType       esType   = (EaseType)stream.ReadByte();
                    float          duration = stream.ReadSingle();
                    switch (attrType)
                    {
                    case ObjectAttrType.Position: {
                        var posCmd = new EaseObjectPosition();
                        posCmd.val.ReadFrom(stream);
                        ret = posCmd;
                    }
                    break;

                    case ObjectAttrType.Rotation: {
                        var rotCmd = new EaseObjectRotation();
                        rotCmd.angle = stream.ReadSingle();
                        ret          = rotCmd;
                    }
                    break;

                    case ObjectAttrType.Scale: {
                        var scaleCmd = new EaseObjectScale();
                        scaleCmd.val.ReadFrom(stream);
                        ret = scaleCmd;
                    }
                    break;

                    case ObjectAttrType.Alpha: {
                        var alphaCmd = new EaseObjectAlpha();
                        alphaCmd.val = stream.ReadSingle();
                        ret          = alphaCmd;
                    }
                    break;

                    case ObjectAttrType.Tint: {
                        var tintCmd = new EaseObjectTint();
                        tintCmd.color.ReadFrom(stream);
                        ret = tintCmd;
                    }
                    break;

                    case ObjectAttrType.Sprite: {
                        var spriteCmd = new EaseObjectSprite();
                        spriteCmd.spriteIndex = stream.ReadInt32();
                        ret = spriteCmd;
                    }
                    break;

                    default:
                        throw new NotImplementedException();
                    }
                    var easeAttrCmd = (EaseObjectAttribute)ret;
                    easeAttrCmd.esType   = esType;
                    easeAttrCmd.duration = duration;
                }
                else
                {
                    ObjectAttrType attrType = (ObjectAttrType)stream.ReadByte();
                    switch (attrType)
                    {
                    case ObjectAttrType.Position: {
                        var posCmd = new SetObjectPosition();
                        posCmd.val.ReadFrom(stream);
                        ret = posCmd;
                    }
                    break;

                    case ObjectAttrType.ZIndex: {
                        var zCmd = new SetObjectZIndex();
                        zCmd.val = stream.ReadInt32();
                        ret      = zCmd;
                    }
                    break;

                    case ObjectAttrType.Rotation: {
                        var rotCmd = new SetObjectRotation();
                        rotCmd.angle = stream.ReadSingle();
                        ret          = rotCmd;
                    }
                    break;

                    case ObjectAttrType.Scale: {
                        var scaleCmd = new SetObjectScale();
                        scaleCmd.val.ReadFrom(stream);
                        ret = scaleCmd;
                    }
                    break;

                    case ObjectAttrType.Alpha: {
                        var alphaCmd = new SetObjectAlpha();
                        alphaCmd.val = stream.ReadSingle();
                        ret          = alphaCmd;
                    }
                    break;

                    case ObjectAttrType.Tint: {
                        var tintCmd = new SetObjectTint();
                        tintCmd.color.ReadFrom(stream);
                        ret = tintCmd;
                    }
                    break;

                    case ObjectAttrType.Sprite: {
                        var spriteCmd = new SetObjectSprite();
                        spriteCmd.spriteIndex = stream.ReadInt32();
                        ret = spriteCmd;
                    }
                    break;

                    default:
                        throw new NotImplementedException();
                    }
                }
            }
            ret.startTime = startTime;
            return(ret);
        }
示例#5
0
 public void ReadFrom(IDataInputStream stream)
 {
     pos.ReadFrom(stream);
     rot = stream.ReadSingle();
     sca.ReadFrom(stream);
 }