Example #1
0
        internal static Tuple <Mask, Action> ParseFrom(string content, Layer layer)
        {
            Mask m = new Mask();

            m.ID     = ReadUInt(ref content);
            m.层ID    = ReadUInt(ref content);
            m.位置坐标.X = ReadDouble(ref content);
            m.位置坐标.Y = ReadDouble(ref content);

            m.生命.Begin    = ReadUInt(ref content);
            m.生命.LifeTime = ReadUInt(ref content);
            m.半宽          = ReadDouble(ref content);
            m.半高          = ReadDouble(ref content);
            m.启用圆形        = ReadBool(ref content);

            m.类型   = (ControlType)ReadUInt(ref content);
            m.控制ID = ReadUInt(ref content);
            m.运动.Motion.Speed.BaseValue                 = ReadDouble(ref content);
            m.运动.Motion.SpeedDirection.BaseValue        = ReadDouble(ref content);
            m.运动.SpeedDirectionPosition                 = ReadPosition(ref content);
            m.运动.Motion.Acceleration.BaseValue          = ReadDouble(ref content);
            m.运动.Motion.AccelerationDirection.BaseValue = ReadDouble(ref content);
            m.运动.AccelerationDirectionPosition          = ReadPosition(ref content);

            m.发射器事件组 = EventGroup.ParseEventGroups(ReadString(ref content));
            m.子弹事件组  = EventGroup.ParseEventGroups(ReadString(ref content));

            m.运动.Motion.Speed.RandValue                 = ReadDouble(ref content);
            m.运动.Motion.SpeedDirection.RandValue        = ReadDouble(ref content);
            m.运动.Motion.Acceleration.RandValue          = ReadDouble(ref content);
            m.运动.Motion.AccelerationDirection.RandValue = ReadDouble(ref content);

            var 绑定ID = ReadInt(ref content);
            var 深度绑定 = ReadBool(ref content);

            Action binder = () => { };

            if (绑定ID != -1)
            {
                binder                   = () =>
                                  m.绑定状态 = layer.FindBulletEmitterByID(绑定ID).Bind(m, 深度绑定, false);
            }

            if (content != string.Empty)
            {
                throw new ParserException("遮罩解析后剩余字符串:" + content);
            }

            return(Tuple.Create(m, binder));
        }
Example #2
0
        internal static Tuple <BulletEmitter, Action> ParseFrom(string content, Layer layer)
        {
            BulletEmitter e = new BulletEmitter();

            e.ID  = ReadUInt(ref content);
            e.层ID = ReadUInt(ref content);
            var 绑定状态 = ReadBool(ref content);   //CS里可能已经废弃
            var 绑定ID = ReadInt(ref content);
            var 相对方向 = ReadBool(ref content);

            ReadString(ref content);
            e.位置坐标.X           = ReadDouble(ref content);
            e.位置坐标.Y           = ReadDouble(ref content);
            e.生命.Begin         = ReadUInt(ref content);
            e.生命.LifeTime      = ReadUInt(ref content);
            e.发射坐标.X.BaseValue = ReadDouble(ref content);
            e.发射坐标.Y.BaseValue = ReadDouble(ref content);
            e.半径.BaseValue     = ReadDouble(ref content);
            e.半径方向.BaseValue   = ReadDouble(ref content);
            e.半径方向_坐标指定        = ReadPosition(ref content);
            e.条数.BaseValue     = ReadDouble(ref content);
            e.周期.BaseValue     = ReadUInt(ref content);
            e.发射角度.BaseValue   = ReadDouble(ref content);
            e.发射角度_坐标指定        = ReadPosition(ref content);
            e.范围.BaseValue     = ReadDouble(ref content);

            e.发射器运动.Motion.Speed.BaseValue                 = ReadDouble(ref content);
            e.发射器运动.Motion.SpeedDirection.BaseValue        = ReadDouble(ref content);
            e.发射器运动.SpeedDirectionPosition                 = ReadPosition(ref content);
            e.发射器运动.Motion.Acceleration.BaseValue          = ReadDouble(ref content);
            e.发射器运动.Motion.AccelerationDirection.BaseValue = ReadDouble(ref content);
            e.发射器运动.AccelerationDirectionPosition          = ReadPosition(ref content);

            e.子弹生命 = ReadUInt(ref content);
            e.子弹类型 = ReadUInt(ref content);

            e.宽比 = ReadDouble(ref content);
            e.高比 = ReadDouble(ref content);

            e.子弹颜色.R = ReadDouble(ref content);
            e.子弹颜色.G = ReadDouble(ref content);
            e.子弹颜色.B = ReadDouble(ref content);
            e.子弹颜色.A = ReadDouble(ref content);

            e.朝向.BaseValue = ReadDouble(ref content);
            e.朝向_坐标指定      = ReadPosition(ref content);
            e.朝向与速度方向相同    = ReadBool(ref content);

            e.子弹运动.Motion.Speed.BaseValue                 = ReadDouble(ref content);
            e.子弹运动.Motion.SpeedDirection.BaseValue        = ReadDouble(ref content);
            e.子弹运动.SpeedDirectionPosition                 = ReadPosition(ref content);
            e.子弹运动.Motion.Acceleration.BaseValue          = ReadDouble(ref content);
            e.子弹运动.Motion.AccelerationDirection.BaseValue = ReadDouble(ref content);
            e.子弹运动.AccelerationDirectionPosition          = ReadPosition(ref content);

            e.横比 = ReadDouble(ref content);
            e.纵比 = ReadDouble(ref content);

            e.雾化效果 = ReadBool(ref content);
            e.消除效果 = ReadBool(ref content);
            e.高光效果 = ReadBool(ref content);
            e.拖影效果 = ReadBool(ref content);
            e.出屏即消 = ReadBool(ref content);
            e.无敌状态 = ReadBool(ref content);

            e.发射器事件组 = EventGroup.ParseEventGroups(ReadString(ref content));
            e.子弹事件组  = EventGroup.ParseEventGroups(ReadString(ref content));

            e.发射坐标.X.RandValue = ReadDouble(ref content);
            e.发射坐标.Y.RandValue = ReadDouble(ref content);

            e.半径.RandValue   = ReadDouble(ref content);
            e.半径方向.RandValue = ReadDouble(ref content);

            e.条数.RandValue = ReadDouble(ref content);
            e.周期.RandValue = ReadDouble(ref content);

            e.发射角度.RandValue = ReadDouble(ref content);
            e.范围.RandValue   = ReadDouble(ref content);
            e.发射器运动.Motion.Speed.RandValue                 = ReadDouble(ref content);
            e.发射器运动.Motion.SpeedDirection.RandValue        = ReadDouble(ref content);
            e.发射器运动.Motion.Acceleration.RandValue          = ReadDouble(ref content);
            e.发射器运动.Motion.AccelerationDirection.RandValue = ReadDouble(ref content);
            e.朝向.RandValue = ReadDouble(ref content);

            e.子弹运动.Motion.Speed.RandValue                 = ReadDouble(ref content);
            e.子弹运动.Motion.SpeedDirection.RandValue        = ReadDouble(ref content);
            e.子弹运动.Motion.Acceleration.RandValue          = ReadDouble(ref content);
            e.子弹运动.Motion.AccelerationDirection.RandValue = ReadDouble(ref content);

            e.遮罩  = ReadBool(ref content);
            e.反弹板 = ReadBool(ref content);
            e.力场  = ReadBool(ref content);

            var 深度绑定 = ReadBool(ref content);

            Action binder = () => { };

            if (绑定ID != -1)
            {
                binder                   = () =>
                                  e.绑定状态 = layer.FindBulletEmitterByID(绑定ID).Bind(e, 深度绑定, 相对方向);
            }


            if (content != string.Empty)
            {
                throw new ParserException("发射器解析后剩余字符串:" + content);
            }

            return(Tuple.Create(e, binder));
        }
Example #3
0
        internal static Tuple <LazerEmitter, Action> ParseFrom(string c, Layer layer)
        {
            LazerEmitter l = new LazerEmitter();

            l.ID  = ReadUInt(ref c);
            l.层ID = ReadUInt(ref c);
            var 绑定状态 = ReadBool(ref c); //CS里可能已废弃
            var 绑定ID = ReadInt(ref c);
            var 相对方向 = ReadBool(ref c);

            ReadString(ref c);  //TODO:CrazyStorm未描述此格数据内容
            l.位置坐标.X         = ReadDouble(ref c);
            l.位置坐标.Y         = ReadDouble(ref c);
            l.生命.Begin       = ReadUInt(ref c);
            l.生命.LifeTime    = ReadUInt(ref c);
            l.半径.BaseValue   = ReadDouble(ref c);
            l.半径方向.BaseValue = ReadDouble(ref c);
            l.半径方向_坐标指定      = ReadPosition(ref c);
            l.条数.BaseValue   = ReadDouble(ref c);
            l.周期.BaseValue   = ReadDouble(ref c);
            l.发射角度.BaseValue = ReadDouble(ref c);
            l.发射角度_坐标指定      = ReadPosition(ref c);
            l.范围.BaseValue   = ReadDouble(ref c);
            l.发射器运动.Motion.Speed.BaseValue                 = ReadDouble(ref c);
            l.发射器运动.Motion.SpeedDirection.BaseValue        = ReadDouble(ref c);
            l.发射器运动.SpeedDirectionPosition                 = ReadPosition(ref c);
            l.发射器运动.Motion.Acceleration.BaseValue          = ReadDouble(ref c);
            l.发射器运动.Motion.AccelerationDirection.BaseValue = ReadDouble(ref c);
            l.发射器运动.AccelerationDirectionPosition          = ReadPosition(ref c);
            l.子弹生命   = ReadUInt(ref c);
            l.类型     = ReadUInt(ref c);
            l.宽比     = ReadDouble(ref c);
            l.长度     = ReadDouble(ref c);
            l.透明度    = ReadDouble(ref c);
            l.启用射线激光 = ReadBool(ref c);
            l.子弹运动.Motion.Speed.BaseValue                 = ReadDouble(ref c);
            l.子弹运动.Motion.SpeedDirection.BaseValue        = ReadDouble(ref c);
            l.子弹运动.SpeedDirectionPosition                 = ReadPosition(ref c);
            l.子弹运动.Motion.Acceleration.BaseValue          = ReadDouble(ref c);
            l.子弹运动.Motion.AccelerationDirection.BaseValue = ReadDouble(ref c);
            l.子弹运动.AccelerationDirectionPosition          = ReadPosition(ref c);
            l.横比   = ReadDouble(ref c);
            l.纵比   = ReadDouble(ref c);
            l.高光效果 = ReadBool(ref c);
            l.出屏即消 = ReadBool(ref c);
            l.无敌状态 = ReadBool(ref c);
            ReadString(ref c);
            l.发射器事件组         = EventGroup.ParseEventGroups(ReadString(ref c));
            l.子弹事件组          = EventGroup.ParseEventGroups(ReadString(ref c));
            l.半径.RandValue   = ReadDouble(ref c);
            l.半径方向.RandValue = ReadDouble(ref c);
            l.条数.RandValue   = ReadDouble(ref c);
            l.周期.RandValue   = ReadDouble(ref c);
            l.发射角度.RandValue = ReadDouble(ref c);
            l.范围.RandValue   = ReadDouble(ref c);
            l.发射器运动.Motion.Speed.RandValue                 = ReadDouble(ref c);
            l.发射器运动.Motion.SpeedDirection.RandValue        = ReadDouble(ref c);
            l.发射器运动.Motion.Acceleration.RandValue          = ReadDouble(ref c);
            l.发射器运动.Motion.AccelerationDirection.RandValue = ReadDouble(ref c);
            l.子弹运动.Motion.Speed.RandValue                 = ReadDouble(ref c);
            l.子弹运动.Motion.SpeedDirection.RandValue        = ReadDouble(ref c);
            l.子弹运动.Motion.Acceleration.RandValue          = ReadDouble(ref c);
            l.子弹运动.Motion.AccelerationDirection.RandValue = ReadDouble(ref c);
            var 深度绑定 = ReadBool(ref c);

            Action binder = () => { };

            if (绑定ID != -1)
            {
                binder                   = () =>
                                  l.绑定状态 = layer.FindBulletEmitterByID(绑定ID).Bind(l, 深度绑定, 相对方向);
            }

            if (c != string.Empty)
            {
                throw new ParserException("激光发射器解析后剩余字符串:" + c);
            }

            return(Tuple.Create(l, binder));
        }