private void renameClick() { string testText = this.m_parent.getSelectedText(); if ((this.storedList.getSelectedItem() != null) && (testText != "")) { if (this.storedList.contains(testText)) { MyMessageBox.Show(SK.Text("Formations_Name_Exists", "That name is already in use"), SK.Text("Formations_Overwrite_Title", "Name Already in Use")); } else { string text = this.storedList.getSelectedItem().Text; GameEngine.Instance.CastleAttackerSetup.renameAttackSetup(text, testText); this.formationNames.Remove(this.storedList.getSelectedItem()); CustomSelfDrawPanel.CSDListItem item = new CustomSelfDrawPanel.CSDListItem { Text = testText }; this.formationNames.Add(item); this.storedList.populate(this.formationNames); this.selectedTitleLabel.Text = testText; this.loadNames(); } } }
private void fillBoxes() { List <CustomSelfDrawPanel.CSDListItem> items = new List <CustomSelfDrawPanel.CSDListItem>(); foreach (WorldMap.VillageNameItem item in villageFavourites) { if (GameEngine.Instance.World.isVillageVisible(item.villageID)) { CustomSelfDrawPanel.CSDListItem item2 = new CustomSelfDrawPanel.CSDListItem { Text = GameEngine.Instance.World.getVillageNameOrType(item.villageID), Data = item.villageID }; items.Add(item2); } } items.Sort((Comparison <CustomSelfDrawPanel.CSDListItem>)((first, next) => first.Text.CompareTo(next.Text))); this.favouritesList.populate(items); List <CustomSelfDrawPanel.CSDListItem> list2 = new List <CustomSelfDrawPanel.CSDListItem>(); foreach (WorldMap.VillageNameItem item3 in villageHistory) { if (GameEngine.Instance.World.isVillageVisible(item3.villageID)) { CustomSelfDrawPanel.CSDListItem item4 = new CustomSelfDrawPanel.CSDListItem { Text = GameEngine.Instance.World.getVillageNameOrType(item3.villageID), Data = item3.villageID }; list2.Add(item4); } } list2.Sort((Comparison <CustomSelfDrawPanel.CSDListItem>)((first, next) => first.Text.CompareTo(next.Text))); this.recentList.populate(list2); }
private void listDoubleClick(CustomSelfDrawPanel.CSDListItem item) { if (GameEngine.Instance.CastleAttackerSetup != null) { GameEngine.Instance.CastleAttackerSetup.restoreAttackSetup(item.Text); } }
private void listClick(CustomSelfDrawPanel.CSDListItem item) { this.updateTotals(item); this.m_parent.setSelectedText(item.Text); this.renameButton.Enabled = true; this.deleteButton.Enabled = true; this.loadButton.Enabled = true; }
private void favouriteClick(CustomSelfDrawPanel.CSDListItem item) { if (item != null) { this.recentList.clearSelectedItem(); if (item.Data >= 0) { this.m_selectedVillageID = item.Data; this.removeButton.Visible = true; this.updateButtons(); } } }
private void SharedCreateCode() { this.saveFormation(); if (!this.storedList.contains(this.saveName)) { CustomSelfDrawPanel.CSDListItem item = new CustomSelfDrawPanel.CSDListItem { Text = this.saveName }; this.formationNames.Add(item); this.storedList.populate(this.formationNames); } this.loadNames(); this.updateTotals(null); this.m_parent.setCreateText(""); }
private void recentDoubleClick(CustomSelfDrawPanel.CSDListItem item) { if (item != null) { this.favouritesList.clearSelectedItem(); if (item.Data >= 0) { this.m_selectedVillageID = item.Data; GameEngine.Instance.World.zoomToVillage(item.Data); InterfaceMgr.Instance.displaySelectedVillagePanel(item.Data, false, true, false, false); this.removeButton.Visible = false; this.updateButtons(); } } }
private void loadNames() { char[] separator = new char[] { '_' }; this.formationNames.Clear(); foreach (string str in Directory.GetFiles(GameEngine.getSettingsPath(true), "*.cas")) { string fileName = Path.GetFileName(str.Remove(str.LastIndexOf('.'))); string[] strArray2 = fileName.Split(separator); if ((strArray2.Length >= 2) && !(strArray2[0].ToLowerInvariant() != "attacksetup")) { fileName = fileName.Replace("AttackSetup_", ""); CustomSelfDrawPanel.CSDListItem item = new CustomSelfDrawPanel.CSDListItem { Text = fileName }; this.formationNames.Add(item); } } this.storedList.populate(this.formationNames); }
private void fillBoxes() { List<CustomSelfDrawPanel.CSDListItem> items = new List<CustomSelfDrawPanel.CSDListItem>(); foreach (WorldMap.VillageNameItem item in villageFavourites) { if (GameEngine.Instance.World.isVillageVisible(item.villageID)) { CustomSelfDrawPanel.CSDListItem item2 = new CustomSelfDrawPanel.CSDListItem { Text = GameEngine.Instance.World.getVillageNameOrType(item.villageID), Data = item.villageID }; items.Add(item2); } } items.Sort((Comparison<CustomSelfDrawPanel.CSDListItem>) ((first, next) => first.Text.CompareTo(next.Text))); this.favouritesList.populate(items); List<CustomSelfDrawPanel.CSDListItem> list2 = new List<CustomSelfDrawPanel.CSDListItem>(); foreach (WorldMap.VillageNameItem item3 in villageHistory) { if (GameEngine.Instance.World.isVillageVisible(item3.villageID)) { CustomSelfDrawPanel.CSDListItem item4 = new CustomSelfDrawPanel.CSDListItem { Text = GameEngine.Instance.World.getVillageNameOrType(item3.villageID), Data = item3.villageID }; list2.Add(item4); } } list2.Sort((Comparison<CustomSelfDrawPanel.CSDListItem>) ((first, next) => first.Text.CompareTo(next.Text))); this.recentList.populate(list2); }
private void listDoubleClick(CustomSelfDrawPanel.CSDListItem item) { }
private void closeClick(CustomSelfDrawPanel.CSDListItem item) { }
private void updateTotals(CustomSelfDrawPanel.CSDListItem current) { if (current == null) { this.castlePlacePeasantButton.Visible = false; this.castlePlaceArcherButton.Visible = false; this.castlePlacePikemanButton.Visible = false; this.castlePlaceSwordsmanButton.Visible = false; this.castlePlaceCatapultButton.Visible = false; this.castlePlaceCaptainButton.Visible = false; this.selectedTitleLabel.Text = ""; this.selectedTroopCountLabel.Text = ""; } else { int num = 0; int num2 = 0; int num3 = 0; int num4 = 0; int num5 = 0; int num6 = 0; List <CastleMap.RestoreCastleElement> list = GameEngine.Instance.CastleAttackerSetup.getAttackSetup(current.Text); int count = list.Count; foreach (CastleMap.RestoreCastleElement element in list) { switch (element.elementType) { case 90: num++; break; case 0x5b: num4++; break; case 0x5c: num2++; break; case 0x5d: num3++; break; case 0x5e: num5++; break; case 100: case 0x65: case 0x66: case 0x67: case 0x68: num6++; break; } } this.selectedTitleLabel.Text = current.Text; this.selectedTroopCountLabel.Text = SK.Text("Formations_Troop_Count", "Total Troops"); this.selectedTroopCountLabel.Text = this.selectedTroopCountLabel.Text + " - " + count.ToString(); this.castlePlacePeasantLabel.Text = num.ToString(); this.castlePlaceArcherLabel.Text = num2.ToString(); this.castlePlacePikemanLabel.Text = num3.ToString(); this.castlePlaceSwordsmanLabel.Text = num4.ToString(); this.castlePlaceCatapultLabel.Text = num5.ToString(); this.castlePlaceCaptainLabel.Text = num6.ToString(); this.castlePlacePeasantButton.Enabled = num != 0; this.castlePlaceArcherButton.Enabled = num2 != 0; this.castlePlacePikemanButton.Enabled = num3 != 0; this.castlePlaceSwordsmanButton.Enabled = num4 != 0; this.castlePlaceCatapultButton.Enabled = num5 != 0; this.castlePlaceCaptainButton.Enabled = num6 != 0; this.castlePlacePeasantButton.Visible = true; this.castlePlaceArcherButton.Visible = true; this.castlePlacePikemanButton.Visible = true; this.castlePlaceSwordsmanButton.Visible = true; this.castlePlaceCatapultButton.Visible = true; this.castlePlaceCaptainButton.Visible = true; } }
public void searchRegionUpdateCallback(string textInput) { if (this.regionNames == null) { this.regionNames = GameEngine.Instance.World.getParishNameList(); } List<CustomSelfDrawPanel.CSDListItem> items = new List<CustomSelfDrawPanel.CSDListItem>(); this.regionSearchList.highlightedItems.Clear(); foreach (string str in this.regionNames) { if (str.ToLower().Contains(textInput.ToLower())) { CustomSelfDrawPanel.CSDListItem item = new CustomSelfDrawPanel.CSDListItem { Text = str, Data = GameEngine.Instance.World.getParishIDFromName(str) }; items.Add(item); foreach (MailLink link in this.linkList) { if ((link.linkType == 3) && (link.objectName.ToLower() == str.ToLower())) { this.regionSearchList.highlightedItems.Add(item); } } } } this.regionSearchList.populate(items); this.regionAddButton.Enabled = this.playerSearchList.getSelectedItem() != null; }
private void getMailUserSearchCallback(GetMailUserSearch_ReturnType returnData) { if (returnData.Success) { List<CustomSelfDrawPanel.CSDListItem> items = new List<CustomSelfDrawPanel.CSDListItem>(); if (returnData.mailUsersSearch != null) { this.playerSearchList.highlightedItems.Clear(); foreach (string str in returnData.mailUsersSearch) { CustomSelfDrawPanel.CSDListItem item = new CustomSelfDrawPanel.CSDListItem { Text = str }; items.Add(item); foreach (MailLink link in this.linkList) { if ((link.linkType == 1) && (link.objectName.ToLower() == str.ToLower())) { this.playerSearchList.highlightedItems.Add(item); } } } } string userName = RemoteServices.Instance.UserName; if (userName.ToLower().Contains(this.searchText.ToLower())) { CustomSelfDrawPanel.CSDListItem item2 = new CustomSelfDrawPanel.CSDListItem { Text = userName }; items.Add(item2); foreach (MailLink link2 in this.linkList) { if ((link2.linkType == 1) && (link2.objectName.ToLower() == userName.ToLower())) { this.playerSearchList.highlightedItems.Add(item2); } } } this.playerSearchList.populate(items); this.playerAddButton.Enabled = this.playerSearchList.getSelectedItem() != null; this.villageTabButton.Active = this.playerAddButton.Enabled; this.villageTabButton.Alpha = this.playerAddButton.Enabled ? 1f : 0.5f; this.villageTabButton.CustomTooltipID = this.playerAddButton.Enabled ? 0x1ff : 0x206; } }