public StartPanel(PPDDevice device, MyGame myGame, PPDFramework.Resource.ResourceManager resourceManager) : base(device) { this.myGame = myGame; this.resourceManager = resourceManager; contentSprite = new SpriteObject(device); this.AddChild(contentSprite); var sprite = new SpriteObject(device); sprite.AddChild(new TextureString(device, Utility.Language["WelcomeToPPD"], 20, true, PPDColors.White) { Position = new SharpDX.Vector2(400, 200) }); sprite.AddChild(new TextureString(device, Utility.Language["StartInitialSetting"], 16, true, PPDColors.White) { Position = new SharpDX.Vector2(400, 240) }); Add(sprite); sprite = new SpriteObject(device); sprite.AddChild(new TextureString(device, Utility.Language["StartKeyButtonSetting"], 20, true, PPDColors.White) { Position = new SharpDX.Vector2(400, 200) }); sprite.AddChild(new TextureString(device, Utility.Language["InsertKeyboardAndController"], 16, true, PPDColors.White) { Position = new SharpDX.Vector2(400, 240) }); Add(sprite); sprite = new SpriteObject(device); sprite.AddChild((controllerNameText = new TextureString(device, "", 14, true, PPDColors.White) { Position = new SharpDX.Vector2(400, 10) })); reload = new FadableButton(device, resourceManager, Utility.Path.Combine("reload.png"), Utility.Path.Combine("reload_select.png"), ""); reload.MouseLeftClick += reload_MouseLeftClick; up = new FadableButton(device, resourceManager, Utility.Path.Combine("up.png"), Utility.Path.Combine("up_select.png"), ""); up.MouseLeftClick += up_MouseLeftClick; down = new FadableButton(device, resourceManager, Utility.Path.Combine("down.png"), Utility.Path.Combine("down_select.png"), ""); down.MouseLeftClick += down_MouseLeftClick; sprite.AddChild(up); sprite.AddChild(down); sprite.AddChild(reload); up.Position = down.Position = reload.Position = new SharpDX.Vector2(400, 225); sprite.AddChild(new PictureObject(device, resourceManager, Utility.Path.Combine("keysettinggrid.png")) { Position = new SharpDX.Vector2(290, 30) }); sprite.AddChild(new TextButton(device, resourceManager) { Position = new SharpDX.Vector2(320, 390), Text = Utility.Language["Start"] }); sprite.AddChild(new TextButton(device, resourceManager) { Position = new SharpDX.Vector2(320, 420), Text = Utility.Language["Home"] }); keys = new TextureString[ButtonUtility.Array.Length]; buttons = new TextureString[ButtonUtility.Array.Length]; if (myGame.KeyConfigManager.Configs.Length > 0) { keyConfig = myGame.KeyConfigManager[0]; } for (int i = 0; i < ButtonUtility.Array.Length; i++) { var textButton = new TextButton(device, resourceManager) { Position = new SharpDX.Vector2(530, 90 + i * 30), Text = Utility.Language["Change"], Index = i }; textButton.MouseLeftDown += textButton_MouseLeftDown; keys[i] = new TextureString(device, keyConfig.GetKeyMap((ButtonType)i).ToString(), 14, true, PPDColors.White) { Position = new SharpDX.Vector2(388, 82 + i * 30) }; buttons[i] = new TextureString(device, keyConfig.GetButtonMap((ButtonType)i).ToString(), 14, true, PPDColors.White) { Position = new SharpDX.Vector2(460, 82 + i * 30) }; sprite.AddChild(textButton); sprite.AddChild(keys[i]); sprite.AddChild(buttons[i]); } Add(sprite); sprite = new SpriteObject(device); sprite.AddChild(new TextureString(device, Utility.Language["SettingCompleted"], 20, true, PPDColors.White) { Position = new SharpDX.Vector2(400, 200) }); sprite.AddChild(new TextureString(device, Utility.Language["UserKeyboardOrController"], 16, true, PPDColors.White) { Position = new SharpDX.Vector2(400, 240) }); Add(sprite); right = new FadableButton(device, resourceManager, Utility.Path.Combine("right.png"), Utility.Path.Combine("right_select.png"), "Next") { Position = new SharpDX.Vector2(770, 225) }; this.AddChild(right); left = new FadableButton(device, resourceManager, Utility.Path.Combine("left.png"), Utility.Path.Combine("left_select.png"), "Back") { Position = new SharpDX.Vector2(30, 225) }; this.AddChild(left); left.MouseLeftClick += left_MouseLeftClick; right.MouseLeftClick += right_MouseLeftClick; focusManager = new FocusManager(); focusManager.Focus(this); left.Alpha = 0; this.Alpha = 0; }
public ChangeKeyConfigSprite(PPDDevice device, PPDFramework.Resource.ResourceManager resourceManager, MyGame myGame, KeyConfig keyConfig, ISound sound) : base(device) { this.resourceManager = resourceManager; this.myGame = myGame; this.keyConfig = keyConfig; this.sound = sound; var sprite = new SpriteObject(device); sprite.AddChild(new PictureObject(device, resourceManager, Utility.Path.Combine("keysettinggrid.png")) { Position = new SharpDX.Vector2(290, 30) }); sprite.AddChild(new TextButton(device, resourceManager) { Position = new SharpDX.Vector2(320, 390), Text = Utility.Language["Start"] }); sprite.AddChild(new TextButton(device, resourceManager) { Position = new SharpDX.Vector2(320, 420), Text = Utility.Language["Home"] }); keys = new TextureString[ButtonUtility.Array.Length]; buttons = new TextureString[ButtonUtility.Array.Length]; textButtons = new TextButton[ButtonUtility.Array.Length]; if (myGame.KeyConfigManager.CurrentConfigIndex < myGame.KeyConfigManager.Configs.Length) { keyConfig = myGame.KeyConfigManager.Configs[myGame.KeyConfigManager.CurrentConfigIndex]; } for (int i = 0; i < ButtonUtility.Array.Length; i++) { var textButton = new TextButton(device, resourceManager) { Position = new SharpDX.Vector2(530, 90 + i * 30), Text = Utility.Language["Change"], Index = i }; textButton.MouseLeftDown += textButton_MouseLeftDown; textButtons[i] = textButton; keys[i] = new TextureString(device, keyConfig.GetKeyMap((ButtonType)i).ToString(), 14, true, PPDColors.White) { Position = new SharpDX.Vector2(388, 82 + i * 30) }; buttons[i] = new TextureString(device, keyConfig.GetButtonMap((ButtonType)i).ToString(), 14, true, PPDColors.White) { Position = new SharpDX.Vector2(460, 82 + i * 30) }; sprite.AddChild(textButton); sprite.AddChild(keys[i]); sprite.AddChild(buttons[i]); } this.AddChild(sprite); this.AddChild((select = new PictureObject(device, resourceManager, Utility.Path.Combine("right.png"), true) { Position = new SharpDX.Vector2(280, 0), Scale = new SharpDX.Vector2(0.5f, 0.5f) })); Inputed += ChangeKeyConfigSprite_Inputed; LostFocused += ChangeKeyConfigSprite_LostFocused; GotFocused += ChangeKeyConfigSprite_GotFocused; }