public void UpdateInfo() { if (!infoUIE.Empty() && infoUIE.Changed()) { LocalizationRead.updateScenarioText(monsterComponent.info_key, infoUIE.GetText()); } }
/// <summary> /// After selecting game, we load the localization file. /// Deppends on the gameType selected. /// There are two Localization files from ffg, one for D2E and one for MoM /// </summary> private void loadLocalization() { // After content import, we load the localization file if (LocalizationRead.selectDictionary("ffg") == null) { DictionaryI18n ffgDict = new DictionaryI18n(); var localizationFiles = Directory.GetFiles(ContentData.ImportPath() + "/text", "Localization_*.txt"); foreach (string file in localizationFiles) { ffgDict.AddDataFromFile(file); } LocalizationRead.AddDictionary("ffg", ffgDict); // CoSH used for Dunwich Horror data DictionaryI18n cshDict = new DictionaryI18n(); foreach (string file in Directory.GetFiles(ContentData.ImportPath() + "/text", "SCENARIO_CULT_OF_SENTINEL_HILL_MAD22_*.txt")) { cshDict.AddDataFromFile(file); } LocalizationRead.AddDictionary("csh", cshDict); var game = Game.Get(); foreach (var packInfo in game.config.GetPackLanguages(game.gameType.TypeName()) .Where(kv => !string.IsNullOrWhiteSpace(kv.Value))) { LocalizationRead.SetGroupTranslationLanguage(packInfo.Key, packInfo.Value); } } }
public void UpdateQuestName() { if (!nameUIE.Empty() && nameUIE.Changed()) { LocalizationRead.updateScenarioText(game.quest.qd.quest.name_key, nameUIE.GetText()); } }
public void UpdateInfo() { if (!infoDBE.Text.Equals("")) { LocalizationRead.updateScenarioText(monsterComponent.info_key, infoDBE.Text); } }
public void UpdateButtonLabel(int number) { if (!buttonUIE[number - 1].Empty() && buttonUIE[number - 1].Changed()) { LocalizationRead.updateScenarioText(eventComponent.genKey("button" + number), buttonUIE[number - 1].GetText()); } }
public void UpdateUniqueTitle() { if (!uniqueTitleUIE.Empty() && uniqueTitleUIE.Changed()) { LocalizationRead.updateScenarioText(spawnComponent.uniquetitle_key, uniqueTitleUIE.GetText()); } }
public void UpdateText() { if (eventTextUIE.Changed()) { if (eventTextUIE.Empty()) { LocalizationRead.dicts["qst"].Remove(eventComponent.text_key); eventComponent.display = false; } else { LocalizationRead.updateScenarioText(eventComponent.text_key, eventTextUIE.GetText()); if (eventComponent.buttons.Count == 0) { eventComponent.buttons.Add(eventComponent.genQuery("button1")); eventComponent.nextEvent.Add(new List <string>()); eventComponent.buttonColors.Add("white"); LocalizationRead.updateScenarioText(eventComponent.genKey("button1"), CONTINUE.Translate()); } if (!eventComponent.display) { eventComponent.display = true; Update(); return; } } if (!eventTextUIE.HeightAtTextPadding(1)) { Update(); } } }
public void UpdateName() { if (!nameDBE.Text.Equals("")) { LocalizationRead.updateScenarioText(monsterComponent.monstername_key, nameDBE.Text); } }
public void UpdateUniqueText() { if (!uniqueTextDBE.Text.Equals("")) { LocalizationRead.updateScenarioText(spawnComponent.uniquetext_key, uniqueTextDBE.Text); } }
public void UpdateButtonLabel(int number) { if (!buttonDBE[number - 1].Text.Equals("")) { LocalizationRead.updateScenarioText(eventComponent.genKey("button" + number), buttonDBE[number - 1].Text); } }
public void UpdateAttacks() { foreach (string type in monsterComponent.investigatorAttacks.Keys) { int index = 0; foreach (StringKey entry in monsterComponent.investigatorAttacks[type]) { if (attacksUIE[type][index].Empty()) { LocalizationRead.dicts["qst"].Remove(entry.key); if (monsterComponent.investigatorAttacks[type].Count == 1) { monsterComponent.investigatorAttacks.Remove(type); } else { monsterComponent.investigatorAttacks[type].RemoveAt(index); } Update(); return; } if (attacksUIE[type][index].Changed()) { LocalizationRead.updateScenarioText(entry.key, attacksUIE[type][index].GetText()); if (!attacksUIE[type][index].HeightAtTextPadding(1)) { Update(); } return; } index++; } } }
public void UpdateName() { if (!nameUIE.Empty() && nameUIE.Changed()) { LocalizationRead.updateScenarioText(monsterComponent.monstername_key, nameUIE.GetText()); } }
/// <summary> /// Create a .valkyrie package and associated meta data /// </summary> private static void CreatePackage() { Destroyer.Dialog(); Game game = Game.Get(); string packageName = Path.GetFileName(Path.GetDirectoryName(game.quest.qd.questPath)); try { string desktopDir = System.Environment.GetFolderPath(System.Environment.SpecialFolder.Desktop); string destination = Path.Combine(desktopDir, packageName); int postfix = 2; while (Directory.Exists(destination)) { destination = Path.Combine(desktopDir, packageName + postfix++); } Directory.CreateDirectory(destination); string packageFile = Path.Combine(destination, packageName + ".valkyrie"); using (var zip = new ZipFile()) { zip.AddDirectory(Path.GetDirectoryName(game.quest.qd.questPath)); zip.Save(packageFile); } string icon = game.quest.qd.quest.image.Replace('\\', '/'); if (icon.Length > 0) { string iconName = Path.GetFileName(icon); // Temp hack to get ToString to output local file game.quest.qd.quest.image = iconName; string src = Path.Combine(Path.GetDirectoryName(game.quest.qd.questPath), icon); string dest = Path.Combine(destination, iconName); File.Copy(src, dest); } string manifest = game.quest.qd.quest.ToString(); // Restore icon game.quest.qd.quest.image = icon; // Append sha version using (FileStream stream = File.OpenRead(packageFile)) { byte[] checksum = SHA256Managed.Create().ComputeHash(stream); manifest += "version=" + System.BitConverter.ToString(checksum) + "\n"; } foreach (KeyValuePair <string, string> kv in LocalizationRead.selectDictionary("qst").ExtractAllMatches("quest.name")) { manifest += "name." + kv.Key + "=" + kv.Value + "\n"; } File.WriteAllText(Path.Combine(destination, packageName + ".ini"), manifest); } catch (System.IO.IOException e) { ValkyrieDebug.Log("Warning: Unable to write to valkyrie package." + e.Message); } }
public void UpdateAbility() { if (!abilityUIE.Empty() && abilityUIE.Changed()) { //insert the text in the current language LocalizationRead.updateScenarioText(activationComponent.ability_key, abilityUIE.GetText()); } }
public void UpdateAbility() { if (!abilityDBE.Text.Equals("")) { //insert the text in the current language LocalizationRead.updateScenarioText(activationComponent.ability_key, abilityDBE.Text); } }
public void UpdateQuestName() { Game game = Game.Get(); if (!nameDBE.Text.Equals("")) { LocalizationRead.updateScenarioText(game.quest.qd.quest.name_key, nameDBE.Text); } }
public void AddButton() { int count = eventComponent.buttons.Count + 1; var butonLabelKey = eventComponent.genQuery("button" + count); eventComponent.buttons.Add(new QuestButtonData(butonLabelKey)); LocalizationRead.updateScenarioText(eventComponent.genKey("button" + count), BUTTON.Translate() + count); Update(); }
public void AddButton() { int count = eventComponent.nextEvent.Count + 1; eventComponent.nextEvent.Add(new List <string>()); eventComponent.buttons.Add(eventComponent.genQuery("button" + count)); eventComponent.buttonColors.Add("white"); LocalizationRead.updateScenarioText(eventComponent.genKey("button" + count), "Button " + count); Update(); }
public void UpdateMinionActions() { if (minionActionsUIE.Empty()) { LocalizationRead.scenarioDict.Remove(activationComponent.minion_key); } else if (minionActionsUIE.Changed()) { LocalizationRead.updateScenarioText(activationComponent.minion_key, minionActionsUIE.GetText()); } }
public void UpdateUniqueText() { if (!uniqueTextUIE.Empty() && uniqueTextUIE.Changed()) { LocalizationRead.updateScenarioText(spawnComponent.uniquetext_key, uniqueTextUIE.GetText()); if (!uniqueTextUIE.HeightAtTextPadding(1)) { Update(); } } }
public void UpdateMove() { if (moveUIE.Empty()) { LocalizationRead.dicts["qst"].Remove(activationComponent.move_key); } else if (moveUIE.Changed()) { LocalizationRead.updateScenarioText(activationComponent.move_key, moveUIE.GetText()); } }
public void UpdateMove() { if (!moveDBE.Text.Equals("")) { LocalizationRead.updateScenarioText(activationComponent.move_key, moveDBE.Text); } else { LocalizationRead.scenarioDict.Remove(activationComponent.move_key); } }
/// <summary> /// Search in current dictionary the text translated to the current language /// </summary> /// <returns>the text in the current language</returns> public string Translate() { if (this.isKey() && !preventLookup) { return(LocalizationRead.FFGLookup(this)); } else { return(key); } }
public void UpdateUIText() { Game game = Game.Get(); if (!textUIE.Empty() && textUIE.Changed()) { LocalizationRead.updateScenarioText(uiComponent.uitext_key, textUIE.GetText()); } game.quest.Remove(uiComponent.sectionName); game.quest.Add(uiComponent.sectionName); Update(); }
public void UpdateMoveButton() { if (moveButtonUIE.Empty()) { LocalizationRead.dicts["qst"].Remove(activationComponent.movebutton_key); } else if (moveButtonUIE.Changed()) { //insert the text in the current language LocalizationRead.updateScenarioText(activationComponent.movebutton_key, moveButtonUIE.GetText()); } }
public void UpdateMoveButton() { if (!moveButtonDBE.Text.Equals("")) { //insert the text in the current language LocalizationRead.updateScenarioText(activationComponent.movebutton_key, moveButtonDBE.Text); } else { LocalizationRead.scenarioDict.Remove(activationComponent.movebutton_key); } }
/// <summary> /// Search in current dictionary the text translated to the current language /// </summary> /// <returns>the text in the current language</returns> public string Translate() { if (this.isKey() && !preventLookup) { return(LocalizationRead.DictLookup(this)); } else { //non heys can have newline characters return(key.Replace("\\n", System.Environment.NewLine)); } }
public void UpdateQuestDesc() { Game game = Game.Get(); if (!descriptionDBE.Text.Equals("")) { LocalizationRead.updateScenarioText(game.quest.qd.quest.description_key, descriptionDBE.Text); } else { LocalizationRead.scenarioDict.Remove(game.quest.qd.quest.description_key); } }
public void NewInvestigatorAttack(string type) { if (!monsterComponent.investigatorAttacks.ContainsKey(type)) { monsterComponent.investigatorAttacks.Add(type, new List <StringKey>()); } int position = monsterComponent.investigatorAttacks[type].Count + 1; StringKey newAttack = new StringKey("qst", monsterComponent.sectionName + ".Attack_" + type + "_" + position); monsterComponent.investigatorAttacks[type].Add(newAttack); LocalizationRead.updateScenarioText(newAttack.key, "-"); Update(); }
// List of quests to copy public void Copy() { // Can copy all quests, not just user questList = QuestLoader.GetQuests(true); Game game = Game.Get(); foreach (GameObject go in GameObject.FindGameObjectsWithTag(Game.DIALOG)) { Object.Destroy(go); } // Header UIElement ui = new UIElement(); ui.SetLocation(2, 1, UIScaler.GetWidthUnits() - 4, 3); ui.SetText(new StringKey("val", "SELECT_TO_COPY", game.gameType.QuestName())); ui.SetFont(Game.Get().gameType.GetHeaderFont()); ui.SetFontSize(UIScaler.GetLargeFont()); UIElementScrollVertical scrollArea = new UIElementScrollVertical(); scrollArea.SetLocation(1, 5, UIScaler.GetWidthUnits() - 2f, 21); new UIElementBorder(scrollArea); // List of quests int offset = 0; foreach (KeyValuePair <string, QuestData.Quest> q in questList) { string key = q.Key; LocalizationRead.AddDictionary("qst", q.Value.localizationDict); ui = new UIElement(scrollArea.GetScrollTransform()); ui.SetLocation(1, offset, UIScaler.GetWidthUnits() - 5, 1.2f); ui.SetText(new StringKey("val", "INDENT", q.Value.name), Color.black); ui.SetTextAlignment(TextAnchor.MiddleLeft); ui.SetButton(delegate { Copy(key); }); ui.SetBGColor(Color.white); offset += 2; } scrollArea.SetScrollSize(offset); // Back to edit selection ui = new UIElement(); ui.SetLocation(1, UIScaler.GetBottom(-3), 8, 2); ui.SetText(CommonStringKeys.BACK, Color.red); ui.SetFont(Game.Get().gameType.GetHeaderFont()); ui.SetFontSize(UIScaler.GetMediumFont()); ui.SetButton(CancelCopy); new UIElementBorder(ui, Color.red); }