Esempio n. 1
0
 public TransformScreen(PkMnGame game, ScreenTransformation transformation, int offset, bool parallel)
 {
     this.game           = game;
     this.transformation = transformation;
     this.offset         = offset;
     this.Parallel       = parallel;
 }
Esempio n. 2
0
        public Effect(XmlNode node)
        {
            Type      = (SpecialEffectType)Enum.Parse(typeof(SpecialEffectType), node.Attributes["type"].Value.Replace("-", ""), true);
            StartAt   = node.Attributes.Contains("start-at") ? int.Parse(node.Attributes["start-at"].Value) : 0;
            StopEarly = node.Attributes.Contains("stop-early") ? int.Parse(node.Attributes["stop-early"].Value) : int.MaxValue;
            switch (Type)
            {
            case SpecialEffectType.PaletteSwap:
                Palette = (ScreenPalette)Enum.Parse(typeof(ScreenPalette), node.Attributes["palette"].Value.Replace("-", ""), true);
                break;

            case SpecialEffectType.Sequence:
                SequenceName = node.Attributes["sequence"].Value;
                break;

            case SpecialEffectType.Delay:
                DelayFrames = int.Parse(node.Attributes["delay"].Value);
                break;

            case SpecialEffectType.SpriteTransform:
                SpriteTransformation = (SpriteTransformation)Enum.Parse(typeof(SpriteTransformation), node.Attributes["transform"].Value.Replace("-", ""), true);
                Who = (Who)Enum.Parse(typeof(Who), node.Attributes["who"].Value, true);
                break;

            case SpecialEffectType.ScreenTransform:
                ScreenTransformation = (ScreenTransformation)Enum.Parse(typeof(ScreenTransformation), node.Attributes["transform"].Value.Replace("-", ""), true);
                Offset   = int.Parse(node.Attributes["offset"].Value);
                Parallel = node.Attributes.Contains("parallel") ? bool.Parse(node.Attributes["parallel"].Value) : false;
                break;

            case SpecialEffectType.Animation:
                string animationName = string.Join("", node.Attributes["animation"].Value.Split('-').Select(s => s.Substring(0, 1).ToUpper() + s.Substring(1).ToLower()));
                SpriteAnimation = System.Type.GetType("PkMn.Game.Animations." + animationName);
                if (SpriteAnimation == null)
                {
                    throw new Exception("Unable to get type: " + animationName);
                }
                Who         = (Who)Enum.Parse(typeof(Who), node.Attributes["who"].Value, true);
                DelayFrames = int.Parse(node.Attributes["delay"].Value);
                Param       = node.Attributes.Contains("param") ? int.Parse(node.Attributes["param"].Value) : 0;
                break;

            case SpecialEffectType.Temporary:
                break;

            default:
                throw new Exception("Unhandled SpecialEffectType: " + Type.ToString());
            }
        }