private void addVillages(bool autoSelect) { List <int> list = GameEngine.Instance.World.getUserVillageIDList(); list.Sort(UserInfoScreen2.villageComparer); this.questsScrollArea.clearControls(); int y = 0; for (int i = 0; i < list.Count; i++) { int villageID = list[i]; NewQuestVillageLine control = new NewQuestVillageLine { Position = new Point(0, y) }; bool selected = villageID == this.m_villageID; control.init(villageID, this, i, selected); this.questsScrollArea.addControl(control); y += control.Height; } this.questsScrollArea.Size = new Size(this.questsScrollArea.Width, y); if (y < this.questsScrollBar.Height) { this.questsScrollBar.Visible = false; } else { this.questsScrollBar.Visible = true; this.questsScrollBar.NumVisibleLines = this.questsScrollBar.Height; this.questsScrollBar.Max = y - this.questsScrollBar.Height; } this.questsScrollArea.invalidate(); this.questsScrollBar.invalidate(); if (autoSelect && (list.Count == 1)) { this.villageSelected(list[0]); } }
private void addVillages(bool autoSelect) { List<int> list = GameEngine.Instance.World.getUserVillageIDList(); list.Sort(UserInfoScreen2.villageComparer); this.questsScrollArea.clearControls(); int y = 0; for (int i = 0; i < list.Count; i++) { int villageID = list[i]; NewQuestVillageLine control = new NewQuestVillageLine { Position = new Point(0, y) }; bool selected = villageID == this.m_villageID; control.init(villageID, this, i, selected); this.questsScrollArea.addControl(control); y += control.Height; } this.questsScrollArea.Size = new Size(this.questsScrollArea.Width, y); if (y < this.questsScrollBar.Height) { this.questsScrollBar.Visible = false; } else { this.questsScrollBar.Visible = true; this.questsScrollBar.NumVisibleLines = this.questsScrollBar.Height; this.questsScrollBar.Max = y - this.questsScrollBar.Height; } this.questsScrollArea.invalidate(); this.questsScrollBar.invalidate(); if (autoSelect && (list.Count == 1)) { this.villageSelected(list[0]); } }