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()); } }
public void Begin() { if (palette == ScreenPalette.Set) { savedPalette = SpriteManager.GetPalette(); } else if (palette == ScreenPalette.Reset) { SpriteManager.SetPalette(savedPalette); } else { SpriteManager.SetPalette(palette); } }
internal static void LoadContent(PkMnGame game, ContentManager content, GraphicsDevice graphicsDevice) { currentPalette = ScreenPalette.Normal; wavyShader = false; SpriteManager.game = game; Font = content.Load <SpriteFont>("font"); Font.LineSpacing += 28; FontSmall = content.Load <SpriteFont>("font-small"); Black = new Texture2D(graphicsDevice, 1, 1); Black.SetData(new Color[] { Color.Black }); White = new Texture2D(graphicsDevice, 1, 1); White.SetData(new Color[] { Color.White }); HudSelf = content.Load <Texture2D>("hud-self"); HudFoe = content.Load <Texture2D>("hud-foe"); HudFrame = content.Load <Texture2D>("hud-frame"); Balls = content.Load <Texture2D>("balls"); HPBar = content.Load <Texture2D>("hp-bar"); Front = content.Load <Texture2D>("front"); Back = content.Load <Texture2D>("back"); PartyIcons = content.Load <Texture2D>("party-icons"); HudSmall = content.Load <Texture2D>("hud-small"); EffectSprites = new Dictionary <string, Texture2D>(); foreach (string file in Directory.GetFiles(Path.Combine(content.RootDirectory, "effect-sprites"))) { EffectSprites[Path.GetFileNameWithoutExtension(file)] = content.Load <Texture2D>(Path.Combine("effect-sprites", Path.GetFileNameWithoutExtension(file))); } ShaderColor = content.Load <Effect>("shader-color"); ShaderWavy = content.Load <Effect>("shader-wavy"); }
public SwapPalette(ScreenPalette palette) { this.palette = palette; }
internal static void SetPalette(ScreenPalette palette) { currentPalette = palette; }