public OptionControl(PPDDevice device, PPDFramework.Resource.ResourceManager resourceManager, ISound sound) : base(device) { this.resourceManager = resourceManager; this.sound = sound; back = new PictureObject(device, resourceManager, Utility.Path.Combine("option.png")); width = back.Width; Position = new Vector2(-width, 0); string[] langs = { "Auto", "ExceptSlide", "Random", "MuteSE", "Connect", "PerfectTrial", "RivalGhost", "RivalGhostCount", "Speed", "Profile" }; selectables = new SelectableComponent[langs.Length]; for (int i = 0; i < selectables.Length; i++) { if (i >= (int)State.RivalGhostCount) { switch ((State)i) { case State.RivalGhostCount: var counts = new int[SkinSetting.MaxRivalGhostCount]; for (var j = 0; j < counts.Length; j++) { counts[j] = j + 1; } this.AddChild(selectables[i] = new ListBoxComponent(device, resourceManager, Utility.Path, Utility.Language[langs[i]], counts) { Position = new Vector2(60, 80 + i * 30), SelectedIndex = SkinSetting.Setting.RivalGhostCount - 1 }); break; case State.Speed: this.AddChild(selectables[i] = new ListBoxComponent(device, resourceManager, Utility.Path, Utility.Language[langs[i]], speeds.Select(s => String.Format("x{0:F2}", s)).ToArray()) { Position = new Vector2(60, 80 + i * 30), SelectedIndex = 2 }); break; case State.Profile: this.AddChild(selectables[i] = new ListBoxComponent(device, resourceManager, Utility.Path, Utility.Language[langs[i]], ProfileManager.Instance.Profiles.Select(p => p.DisplayText).ToArray()) { Position = new Vector2(60, 80 + i * 30) }); break; } } else { float xOffset = i == 1 ? 30 : 0; this.AddChild(selectables[i] = new CheckBoxComponent(device, resourceManager, Utility.Path, Utility.Language[langs[i]]) { Position = new Vector2(30 + xOffset, 80 + i * 30) }); } } selectables[0].Selected = true; this.AddChild(new TextureString(device, Utility.Language["Option"], 32, PPDColors.White) { Position = new Vector2(40, 30) }); this.AddChild(back); Inputed += OptionControl_Inputed; }
public GameRuleComponent(PPDDevice device, PPDFramework.Resource.ResourceManager resourceManager, ISound sound) : base(device) { this.resourceManager = resourceManager; this.sound = sound; this.AddChild(back = new PictureObject(device, resourceManager, Utility.Path.Combine("dialog_back.png"))); this.AddChild(new RectangleComponent(device, resourceManager, PPDColors.Black) { RectangleHeight = 450, RectangleWidth = 800, Alpha = 0.75f }); back.AddChild(ruleSprite = new SpriteObject(device)); ruleSprite.AddChild(itemSupplyTypeSprite = new SpriteObject(device)); back.AddChild(new TextureString(device, Utility.Language["ChangeRule"], 30, PPDColors.White) { Position = new Vector2(35, 30) }); ruleSprite.AddChild(resultSort = new ListBoxComponent(device, resourceManager, Utility.Path, Utility.Language["RankOrder"], Utility.Language["Score"], Utility.Language["Accuracy"]) { Position = new SharpDX.Vector2(80, 80), Selected = true }); ruleSprite.AddChild(itemAvailable = new CheckBoxComponent(device, resourceManager, Utility.Path, Utility.Language["ItemAvailable"]) { Position = new SharpDX.Vector2(50, 120) }); ruleSprite.AddChild(okButton = new ButtonComponent(device, resourceManager, Utility.Path, Utility.Language["OK"]) { Position = new Vector2(270, 380) }); ruleSprite.AddChild(cancelButton = new ButtonComponent(device, resourceManager, Utility.Path, Utility.Language["Cancel"]) { Position = new Vector2(470, 380) }); ruleSprite.AddChild(maxItemCount = new ListBoxComponent(device, resourceManager, Utility.Path, Utility.Language["MaxItemCount"], 1, 2, 3, 4, 5, 6) { Position = new Vector2(110, 160) }); itemSupplyTypeSprite.AddChild(comboSupply = new RadioBoxComponent(device, resourceManager, Utility.Path, Utility.Language["DependentOnComboOrWorst"]) { Position = new Vector2(80, 200) }); ruleSprite.AddChild(comboSupplyCount = new ListBoxComponent(device, resourceManager, Utility.Path, Utility.Language["ItemPerCombo"], 50, 60, 70, 80, 90, 100) { Position = new Vector2(130, 240) }); ruleSprite.AddChild(worstSupplyCount = new ListBoxComponent(device, resourceManager, Utility.Path, Utility.Language["ItemPerWorst"], 50, 60, 70, 80, 90, 100) { Position = new Vector2(130, 280) }); itemSupplyTypeSprite.AddChild(rankSupply = new RadioBoxComponent(device, resourceManager, Utility.Path, Utility.Language["DependentOnRank"]) { Position = new Vector2(80, 320) }); selectList = new SelectableComponent[] { resultSort, itemAvailable, maxItemCount, comboSupply, comboSupplyCount, worstSupplyCount, rankSupply, okButton, cancelButton }; gridSelection = new GridSelection(); foreach (SelectableComponent comp in selectList) { gridSelection.Add(comp.Position); } resultSort.SelectedItem = Utility.Language[gameRule.ResultSortType.ToString()]; itemAvailable.Checked = gameRule.ItemAvailable; comboSupply.Checked = gameRule.ItemSupplyType == ItemSupplyType.ComboWorstCount; rankSupply.Checked = gameRule.ItemSupplyType == ItemSupplyType.Rank; comboSupplyCount.SelectedItem = gameRule.ItemSupplyComboCount; worstSupplyCount.SelectedItem = gameRule.ItemSupplyWorstCount; maxItemCount.SelectedItem = gameRule.MaxItemCount; Inputed += ItemSettingComponent_Inputed; GotFocused += ItemSettingComponent_GotFocused; }