public ConfirmComponent(PPDDevice device, PPDFramework.Resource.ResourceManager resourceManager, PathManager pathManager, string message, string yes, string no, string ok, ConfirmButtonType buttonType) : base(device) { this.resourceManager = resourceManager; confirm = new TextureString(device, message, 15, 200, 400, true, true, PPDColors.White) { Position = new Vector2(300, 150) }; this.AddChild(confirm); if (buttonType == ConfirmButtonType.YesNo) { buttons = new Button[2]; for (int i = 0; i < buttons.Length; i++) { buttons[i] = new Button(device, resourceManager, pathManager, i == 0 ? yes : no) { Position = new Vector2(i == 0 ? 350 : 450, 280) }; buttons[i].Selected = false; this.AddChild(buttons[i]); } } else { buttons = new Button[1]; buttons[0] = new Button(device, resourceManager, pathManager, ok) { Position = new Vector2(400, 280) }; } buttons[0].Selected = true; this.AddChild(new PictureObject(device, resourceManager, pathManager.Combine("conftop.png")) { Position = new Vector2(266, 225 - 107) }); this.AddChild(new PictureObject(device, resourceManager, pathManager.Combine("confbottom.png")) { Position = new Vector2(266, 225 + 107 - 17) }); this.AddChild(new PictureObject(device, resourceManager, pathManager.Combine("confirmpause.png")) { Position = new Vector2(266, 118) }); this.AddChild(new RectangleComponent(device, resourceManager, PPDColors.Black) { RectangleWidth = 800, RectangleHeight = 450, Alpha = 0.75f }); Alpha = 1; Inputed += ConfirmComponent_Inputed; }
private void done() { EventSystem.current.SetSelectedGameObject(confirmButton); confirmButtonType = ConfirmButtonType.done; }