// Add a component to the board public void Add(string name) { // Check that the component is valid if (!game.quest.qd.components.ContainsKey(name)) { Debug.Log("Error: Unable to create missing quest component: " + name); Application.Quit(); } // Add to active list QuestData.QuestComponent qc = game.quest.qd.components[name]; if (boardItems.ContainsKey(name)) { return; } // Add to board if (qc is QuestData.Tile) { boardItems.Add(name, new Tile((QuestData.Tile)qc, game)); } if (qc is QuestData.Door) { boardItems.Add(name, new Door((QuestData.Door)qc, game)); } if (qc is QuestData.Token) { boardItems.Add(name, new Token((QuestData.Token)qc, game)); } }
public void AddItem(QuestData.QuestComponent qc) { Dictionary <string, IEnumerable <string> > traits = new Dictionary <string, IEnumerable <string> >(); traits.Add(val_type_translated, new string[] { new StringKey("val", qc.typeDynamic.ToUpper()).Translate() }); traits.Add(val_source_translated, new string[] { qc.source }); AddItem(new SelectionItemTraits(qc.sectionName, qc.sectionName, traits)); }
/// <summary> /// Get text related with selected component /// </summary> /// <param name="component">component to get text</param> /// <returns>extracted text</returns> public static string getComponentText(QuestData.QuestComponent component) { Game game = Game.Get(); switch (component.GetType().Name) { case "Event": if (!game.quest.heroSelection.ContainsKey(component.sectionName) || game.quest.heroSelection[component.sectionName].Count == 0) { return(component.sectionName); } return(game.quest.heroSelection[component.sectionName][0].heroData.name.Translate()); case "Tile": // Replaced with the name of the Tile return(game.cd.Get <TileSideData>(((QuestData.Tile)component).tileSideName).name.Translate()); case "CustomMonster": // Replaced with the custom nonster name return(((QuestData.CustomMonster)component).monsterName.Translate()); case "Spawn": if (!game.quest.monsterSelect.ContainsKey(component.sectionName)) { return(component.sectionName); } // Replaced with the text shown in the spawn string monsterName = game.quest.monsterSelect[component.sectionName]; if (monsterName.StartsWith("Custom")) { return(((QuestData.CustomMonster)game.quest.qd.components[monsterName]).monsterName.Translate()); } else { var monsterData = game.cd.Get <MonsterData>(game.quest.monsterSelect[component.sectionName]); return(monsterData.name.Translate()); } case "QItem": if (!game.quest.itemSelect.ContainsKey(component.sectionName)) { return(component.sectionName); } // Replaced with the first element in the list var itemData = game.cd.Get <ItemData>(game.quest.itemSelect[component.sectionName]); return(itemData.name.Translate()); default: return(component.sectionName); } }
public SelectionListEntry(QuestData.QuestComponent component, List <string> traits = null) { name = component.sectionName; key = name; filter = traits; if (filter == null) { filter = new List <string>(); } Game game = Game.Get(); filter.Add(component.source); filter.Add(new StringKey(VAL, component.typeDynamic.ToUpper()).Translate()); }
public static void EventTriggerType(string type) { Game game = Game.Get(); foreach (KeyValuePair <string, QuestData.QuestComponent> k in game.qd.components) { QuestData.QuestComponent c = k.Value; // Check if it is an event if (c is QuestData.Event) { QuestData.Event e = (QuestData.Event)c; if (e.trigger.Equals(type)) { QueueEvent(e.name); } } } }
public void Add(string name) { if (!game.quest.qd.components.ContainsKey(name)) { Debug.Log("Error: Unable to create missing quest component: " + name); Application.Quit(); } QuestData.QuestComponent qc = game.quest.qd.components[name]; if (qc is QuestData.Tile) { boardItems.Add(name, new Tile((QuestData.Tile)qc, game)); } if (qc is QuestData.Door) { boardItems.Add(name, new Door((QuestData.Door)qc, game)); } if (qc is QuestData.Token) { boardItems.Add(name, new Token((QuestData.Token)qc, game)); } }
protected virtual void RefreshReference() { component = Game.Get().quest.qd.components[name]; }