public void clearContents(bool includeLinks) { if (includeLinks) { this.linkList.Clear(); } this.playerSearchList.populate(new List<CustomSelfDrawPanel.CSDListItem>()); this.villageSearchList.populate(new List<CustomSelfDrawPanel.CSDListItem>()); this.regionSearchList.populate(new List<CustomSelfDrawPanel.CSDListItem>()); this.villageTabButton.Active = false; this.villageTabButton.Alpha = 0.5f; this.villageTabButton.CustomTooltipID = 0x206; this.playerAddButton.Enabled = false; this.villageAddButton.Enabled = false; this.regionAddButton.Enabled = false; this.selectedVillage = null; this.selectedLine = null; this.changeTabIcons(-1); }
public void villageUserInfoCallback(GetOtherUserVillageIDList_ReturnType returnData) { if (returnData.Success) { List<CustomSelfDrawPanel.CSDListItem> items = new List<CustomSelfDrawPanel.CSDListItem>(); this.villageSearchList.populate(items); List<WorldMap.VillageData> list2 = new List<WorldMap.VillageData>(); List<WorldMap.VillageData> list3 = new List<WorldMap.VillageData>(); List<WorldMap.VillageData> list4 = new List<WorldMap.VillageData>(); List<WorldMap.VillageData> list5 = new List<WorldMap.VillageData>(); List<WorldMap.VillageData> list6 = new List<WorldMap.VillageData>(); foreach (int num in returnData.userVillageList) { WorldMap.VillageData item = GameEngine.Instance.World.getVillageData(num); if (item != null) { if (item.regionCapital) { list3.Add(item); } else if (item.countyCapital) { list4.Add(item); } else if (item.provinceCapital) { list5.Add(item); } else if (item.countryCapital) { list6.Add(item); } else { list2.Add(item); } } } this.villageLines.Clear(); this.villageScrollArea.clearControls(); this.villageSearchArea.invalidate(); int y = 0; int position = 0; foreach (WorldMap.VillageData data2 in list2) { VillageLine control = new VillageLine(); if (y != 0) { y += 2; } control.Position = new Point(3, y); control.init(position, this.villageScrollArea.Width - 2, data2, 1, this); this.villageScrollArea.addControl(control); y += control.Height; this.villageLines.Add(control); position++; } foreach (WorldMap.VillageData data3 in list3) { VillageLine line2 = new VillageLine(); if (y != 0) { y += 2; } line2.Position = new Point(3, y); line2.init(position, this.villageScrollArea.Width, data3, 2, this); this.villageScrollArea.addControl(line2); y += line2.Height; this.villageLines.Add(line2); position++; } foreach (WorldMap.VillageData data4 in list4) { VillageLine line3 = new VillageLine(); if (y != 0) { y += 2; } line3.Position = new Point(3, y); line3.init(position, this.villageScrollArea.Width, data4, 3, this); this.villageScrollArea.addControl(line3); y += line3.Height; this.villageLines.Add(line3); position++; } foreach (WorldMap.VillageData data5 in list5) { VillageLine line4 = new VillageLine(); if (y != 0) { y += 2; } line4.Position = new Point(3, y); line4.init(position, this.villageScrollArea.Width, data5, 4, this); this.villageScrollArea.addControl(line4); y += line4.Height; this.villageLines.Add(line4); position++; } foreach (WorldMap.VillageData data6 in list6) { VillageLine line5 = new VillageLine(); if (y != 0) { y += 2; } line5.Position = new Point(3, y); line5.init(position, this.villageScrollArea.Width, data6, 5, this); this.villageScrollArea.addControl(line5); y += line5.Height; this.villageLines.Add(line5); position++; } this.villageAddButton.Enabled = false; this.villageScrollArea.Size = new Size(this.villageScrollArea.Width, y); if (y < this.villageBar.Height) { this.villageBar.Visible = false; } else { this.villageBar.Visible = true; this.villageBar.NumVisibleLines = this.villageBar.Height; this.villageBar.Max = y - this.villageBar.Height; } this.villageScrollArea.invalidate(); this.villageBar.invalidate(); this.changeTabIcons(1); } }
private void addVillage(VillageLine line) { bool flag = false; foreach (MailLink link in this.linkList) { if ((link.linkType == 2) && (link.objectID == line.villageID)) { flag = true; } } if (!flag) { MailLink item = new MailLink { linkType = 2, objectName = line.nameLabel.Text, objectID = line.villageID }; this.linkList.Add(item); line.isAdded = true; line.invalidate(); } }
public void setSelectedVillage(VillageLine inputLine) { this.selectedVillage = inputLine; foreach (VillageLine line in this.villageLines) { line.isSelected(line == inputLine); line.invalidate(); } this.villageAddButton.Enabled = this.selectedVillage != null; }