public void SetQuotaVar() { if (GameObject.FindGameObjectWithTag(Game.DIALOG) != null) { return; } UIWindowSelectionListTraits select = new UIWindowSelectionListTraits(SelectQuotaVar, new StringKey("val", "SELECT", VAR)); Dictionary <string, IEnumerable <string> > traits = new Dictionary <string, IEnumerable <string> >(); traits.Add(CommonStringKeys.TYPE.Translate(), new string[] { "Quest" }); select.AddItem("{" + CommonStringKeys.NEW.Translate() + "}", "{NEW}", traits, true); EditorComponentVarTestsUtil.AddQuestVars(select); select.Draw(); }
public void AddAssignOp() { if (GameObject.FindGameObjectWithTag(Game.DIALOG) != null) { return; } UIWindowSelectionListTraits select = new UIWindowSelectionListTraits(delegate(string s) { EditorComponentVarTestsUtil.SelectAddOp(s, component, () => Update(), false); }, CommonStringKeys.SELECT_VAR); Dictionary <string, IEnumerable <string> > traits = new Dictionary <string, IEnumerable <string> >(); traits.Add(CommonStringKeys.TYPE.Translate(), new string[] { "Quest" }); select.AddItem("{" + CommonStringKeys.NEW.Translate() + "}", "{NEW}", traits, true); EditorComponentVarTestsUtil.AddQuestVars(select); select.Draw(); }
virtual public float AddEventVarOperationComponents(float offset) { UIElement ui = new UIElement(Game.EDITOR, scrollArea.GetScrollTransform()); ui.SetLocation(0.5f, offset, 18, 1); ui.SetText(new StringKey("val", "X_COLON", CommonStringKeys.ASSIGN)); ui = new UIElement(Game.EDITOR, scrollArea.GetScrollTransform()); ui.SetLocation(18.5f, offset++, 1, 1); ui.SetText(CommonStringKeys.PLUS, Color.green); ui.SetButton(delegate { AddAssignOp(); }); new UIElementBorder(ui, Color.green); foreach (VarOperation op in component.operations) { VarOperation tmp = op; ui = new UIElement(Game.EDITOR, scrollArea.GetScrollTransform()); ui.SetLocation(0.5f, offset, 8.5f, 1); ui.SetText(op.var); new UIElementBorder(ui); ui = new UIElement(Game.EDITOR, scrollArea.GetScrollTransform()); ui.SetLocation(9, offset, 2, 1); ui.SetText(op.operation); ui.SetButton(delegate { SetAssignOpp(tmp); }); new UIElementBorder(ui); ui = new UIElement(Game.EDITOR, scrollArea.GetScrollTransform()); ui.SetLocation(11, offset, 7.5f, 1); ui.SetText(op.value); ui.SetButton(delegate { EditorComponentVarTestsUtil.SetValue(tmp, Update); }); new UIElementBorder(ui); ui = new UIElement(Game.EDITOR, scrollArea.GetScrollTransform()); ui.SetLocation(18.5f, offset++, 1, 1); ui.SetText(CommonStringKeys.MINUS, Color.red); ui.SetButton(delegate { RemoveOp(tmp); }); new UIElementBorder(ui, Color.red); } return(offset + 1); }
public void SetAssignOpp(VarOperation op) { if (GameObject.FindGameObjectWithTag(Game.DIALOG) != null) { return; } UIWindowSelectionList select = new UIWindowSelectionList(delegate(string s) { EditorComponentVarTestsUtil.SelectSetOp(op, s, Update); }, new StringKey("val", "SELECT", CommonStringKeys.OP)); select.AddItem("="); select.AddItem("+"); select.AddItem("-"); select.AddItem("*"); select.AddItem("/"); select.AddItem("%"); select.Draw(); }
virtual public float AddEventVarConditionComponents(float yOffset) { return(EditorComponentVarTestsUtil.AddEventVarConditionComponents(scrollArea.GetScrollTransform(), 0.5f, yOffset, component, Update)); }
public void SetTrigger() { if (GameObject.FindGameObjectWithTag(Game.DIALOG) != null) { return; } Game game = Game.Get(); UIWindowSelectionListTraits select = new UIWindowSelectionListTraits(SelectEventTrigger, new StringKey("val", "SELECT", CommonStringKeys.TRIGGER)); Dictionary <string, IEnumerable <string> > traits = new Dictionary <string, IEnumerable <string> >(); traits.Add(CommonStringKeys.TYPE.Translate(), new string[] { new StringKey("val", "GENERAL").Translate() }); select.AddItem("{NONE}", "", traits, true); bool startPresent = false; bool noMorale = false; bool eliminated = false; foreach (KeyValuePair <string, QuestData.QuestComponent> kv in game.quest.qd.components) { QuestData.Event e = kv.Value as QuestData.Event; if (e != null) { if (e.trigger.Equals("EventStart")) { startPresent = true; } if (e.trigger.Equals("NoMorale")) { noMorale = true; } if (e.trigger.Equals("Eliminated")) { eliminated = true; } } } if (startPresent) { select.AddItem("EventStart", traits, Color.gray); } else { select.AddItem("EventStart", traits); } if (noMorale) { select.AddItem("NoMorale", traits, Color.gray); } else { select.AddItem("NoMorale", traits); } if (eliminated) { select.AddItem("Eliminated", traits, Color.gray); } else { select.AddItem("Eliminated", traits); } select.AddItem("EndRound", traits); select.AddItem("StartRound", traits); if (game.gameType is MoMGameType) { select.AddItem("Mythos", traits); select.AddItem("EndInvestigatorTurn", traits); select.AddItem("BeforeMonsterActivation", traits); } traits = new Dictionary <string, IEnumerable <string> >(); traits.Add(CommonStringKeys.TYPE.Translate(), new[] { CommonStringKeys.MONSTER.Translate() }); foreach (string monsterKey in game.cd.Keys <MonsterData>()) { select.AddItem("Defeated" + monsterKey, traits); select.AddItem("DefeatedUnique" + monsterKey, traits); } HashSet <string> vars = new HashSet <string>(); foreach (KeyValuePair <string, QuestData.QuestComponent> kv in game.quest.qd.components) { if (kv.Value is QuestData.Event) { QuestData.Event e = kv.Value as QuestData.Event; foreach (string s in EditorComponentVarTestsUtil.ExtractVarsFromEvent(e)) { if (s[0] == '@') { vars.Add(s); } } } } traits = new Dictionary <string, IEnumerable <string> >(); traits.Add(CommonStringKeys.TYPE.Translate(), new string[] { CommonStringKeys.CUSTOMMONSTER.Translate() }); foreach (KeyValuePair <string, QuestData.QuestComponent> kv in game.quest.qd.components) { if (kv.Value is QuestData.CustomMonster) { select.AddItem("Defeated" + kv.Key, traits); if (game.gameType is D2EGameType) { select.AddItem("DefeatedUnique" + kv.Key, traits); } } } traits = new Dictionary <string, IEnumerable <string> >(); traits.Add(CommonStringKeys.TYPE.Translate(), new string[] { CommonStringKeys.SPAWN.Translate() }); foreach (KeyValuePair <string, QuestData.QuestComponent> kv in game.quest.qd.components) { if (kv.Value is QuestData.Spawn) { select.AddItem("Defeated" + kv.Key, traits); if (game.gameType is D2EGameType) { select.AddItem("DefeatedUnique" + kv.Key, traits); } } } traits = new Dictionary <string, IEnumerable <string> >(); traits.Add(CommonStringKeys.TYPE.Translate(), new string[] { new StringKey("val", "VARS").Translate() }); foreach (string s in vars) { select.AddItem("Var" + s.Substring(1), traits); } select.Draw(); }
public void Update() { // Border UIElement ui = new UIElement(); var width = 22f; float leftBorder = UIScaler.GetHCenter(-11); ui.SetLocation(leftBorder, 2, width, 26); new UIElementBorder(ui); // Title ui = new UIElement(); ui.SetLocation(leftBorder + 1, 2, 20, 1); ui.SetText(title); var scrollArea = new UIElementScrollVertical(Game.EDITOR); scrollArea.SetLocation(leftBorder, 3, width, 20); scrollArea.SetScrollSize(newButton.Condition.VarTestsComponents.Count + 4); new UIElementBorder(scrollArea); EditorComponentVarTestsUtil.AddEventVarConditionComponents(scrollArea.GetScrollTransform(), 1.5f, 1.5f, newButton, Update); ui = new UIElement(); ui.SetLocation(leftBorder, 23, width, 5); new UIElementBorder(ui); var optionWidth = (width - 1f) / QUEST_BUTTON_ACTIONS.Count; for (int i = 0; i < QUEST_BUTTON_ACTIONS.Count; i++) { var action = QUEST_BUTTON_ACTIONS[i]; // None button ui = new UIElement(); ui.SetLocation(leftBorder + 0.5f + i * optionWidth, 24, optionWidth, 1); Color buttonColor = newButton.ConditionFailedAction == action ? Color.white : Color.gray; ui.SetBGColor(new Color(0.03f, 0.0f, 0f)); ui.SetText(new StringKey("val", action.ToString()).Translate(), buttonColor); ui.SetButton(delegate { this.newButton.RawConditionFailedAction = action; Update(); }); new UIElementBorder(ui, buttonColor); } // Cancel button ui = new UIElement(); ui.SetLocation(UIScaler.GetHCenter(-10f), 26, 9, 1); ui.SetBGColor(new Color(0.03f, 0.0f, 0f)); ui.SetText(CommonStringKeys.CANCEL); ui.SetButton(delegate { Destroyer.Dialog(); okAction.Invoke(originalButton); }); new UIElementBorder(ui); // OK button ui = new UIElement(); ui.SetLocation(UIScaler.GetHCenter(1), 26, 9, 1); ui.SetBGColor(new Color(0.03f, 0.0f, 0f)); ui.SetText(CommonStringKeys.OK); ui.SetButton(delegate { if (!newButton.HasCondition) { this.newButton.RawConditionFailedAction = null; } Destroyer.Dialog(); okAction.Invoke(newButton); }); new UIElementBorder(ui); }