public void addFactions()
        {
            int         yourRank    = GameEngine.Instance.World.getYourFactionRank();
            FactionData yourFaction = GameEngine.Instance.World.YourFaction;
            int         yourHouseID = 0;

            if (yourFaction != null)
            {
                yourHouseID = yourFaction.houseID;
            }
            int appliedToHouse = 0;

            if ((GameEngine.Instance.World.HouseVoteInfo != null) && (GameEngine.Instance.World.HouseVoteInfo.appliedToHouseID > 0))
            {
                appliedToHouse = GameEngine.Instance.World.HouseVoteInfo.appliedToHouseID;
            }
            this.wallScrollArea.clearControls();
            int y = 0;

            this.lineList.Clear();
            int position = 0;

            HouseData[]      houseInfo = GameEngine.Instance.World.HouseInfo;
            List <HouseData> list      = new List <HouseData>();

            foreach (HouseData data2 in houseInfo)
            {
                list.Add(data2);
            }
            switch (this.sortMethod)
            {
            case 0:
                list.Sort(this.namePosComparer);
                break;

            case 1:
                list.Sort(this.nameNegComparer);
                break;

            case 2:
                if (this.pageMode != 0)
                {
                    list.Sort(this.gloryPosComparer);
                    break;
                }
                list.Sort(this.playersPosComparer);
                break;

            case 3:
                if (this.pageMode != 0)
                {
                    list.Sort(this.gloryNegComparer);
                    break;
                }
                list.Sort(this.playersNegComparer);
                break;

            case 4:
                if (this.pageMode != 0)
                {
                    list.Sort(this.gloryPosComparer);
                    break;
                }
                list.Sort(this.pointsPosComparer);
                break;

            case 5:
                if (this.pageMode != 0)
                {
                    list.Sort(this.gloryNegComparer);
                    break;
                }
                list.Sort(this.pointsNegComparer);
                break;
            }
            foreach (HouseData data3 in list)
            {
                HouseLine control = new HouseLine();
                if (y != 0)
                {
                    y += 5;
                }
                control.Position = new Point(0, y);
                control.init(data3, yourHouseID, yourRank, appliedToHouse, position, this, this.pageMode == 1);
                this.wallScrollArea.addControl(control);
                y += control.Height;
                this.lineList.Add(control);
                position++;
            }
            this.wallScrollArea.Size = new Size(this.wallScrollArea.Width, y);
            if (y < this.wallScrollBar.Height)
            {
                this.wallScrollBar.Visible = false;
            }
            else
            {
                this.wallScrollBar.Visible         = true;
                this.wallScrollBar.NumVisibleLines = this.wallScrollBar.Height;
                this.wallScrollBar.Max             = y - this.wallScrollBar.Height;
            }
            this.wallScrollArea.invalidate();
            this.wallScrollBar.invalidate();
            this.update();
            base.Invalidate();
        }
 public void addFactions()
 {
     this.wallScrollArea.clearControls();
     int y = 0;
     this.lineList.Clear();
     FactionData yourFaction = GameEngine.Instance.World.YourFaction;
     int houseID = 0;
     int num3 = 0;
     int houseLeaderVote = -1;
     if (yourFaction != null)
     {
         houseID = yourFaction.houseID;
         houseLeaderVote = yourFaction.houseLeaderVote;
     }
     if ((houseID != 0) && (houseID == SelectedHouse))
     {
         if ((GameEngine.Instance.World.HouseVoteInfo != null) && (GameEngine.Instance.World.HouseVoteInfo.appliedToHouseID > 0))
         {
             int appliedToHouseID = GameEngine.Instance.World.HouseVoteInfo.appliedToHouseID;
         }
         num3 = GameEngine.Instance.World.getYourFactionRank();
     }
     int position = 0;
     FactionData[] dataArray = GameEngine.Instance.World.getHouseFactions(SelectedHouse);
     HouseVoteData houseVoteInfo = GameEngine.Instance.World.HouseVoteInfo;
     if (houseLeaderVote < 0)
     {
         houseLeaderVote = this.m_houseLeaderFactionID;
     }
     bool flag = false;
     foreach (FactionData data3 in dataArray)
     {
         if (houseLeaderVote == data3.factionID)
         {
             flag = true;
             break;
         }
     }
     if (!flag)
     {
         houseLeaderVote = this.m_houseLeaderFactionID;
     }
     foreach (FactionData data4 in dataArray)
     {
         if (!data4.active || (data4.numMembers == 0))
         {
             continue;
         }
         HouseLine control = new HouseLine();
         if (y != 0)
         {
             y += 5;
         }
         control.Position = new Point(0, y);
         control.init(data4, position, this);
         if (((houseVoteInfo != null) && ((num3 == 1) || (num3 == 2))) && (houseID == SelectedHouse))
         {
             bool vote = false;
             if (houseVoteInfo.contains(data4.factionID, ref vote))
             {
                 int numPos = 0;
                 int numNeg = 0;
                 if (houseVoteInfo.voteTotals != null)
                 {
                     for (int i = 0; i < (houseVoteInfo.voteTotals.Length / 3); i++)
                     {
                         if (houseVoteInfo.voteTotals[i, 0] == data4.factionID)
                         {
                             numPos = houseVoteInfo.voteTotals[i, 1];
                             numNeg = houseVoteInfo.voteTotals[i, 2];
                             break;
                         }
                     }
                 }
                 control.extendVote(vote, numPos, numNeg, num3 == 1);
             }
         }
         if (((num3 == 1) || (num3 == 2)) && (houseID == SelectedHouse))
         {
             bool flag3 = false;
             if (houseLeaderVote == data4.factionID)
             {
                 flag3 = true;
             }
             control.extendLeader(flag3, num3 == 1);
         }
         this.wallScrollArea.addControl(control);
         y += control.Height;
         this.lineList.Add(control);
         position++;
     }
     if ((((houseID == SelectedHouse) && (houseVoteInfo != null)) && ((houseVoteInfo.applications != null) && (houseVoteInfo.applications.Length > 0))) && ((num3 == 1) || (num3 == 2)))
     {
         HouseLine line2 = new HouseLine {
             Position = new Point(0, y)
         };
         line2.applicationLine();
         this.wallScrollArea.addControl(line2);
         y += line2.Height;
         this.lineList.Add(line2);
         position++;
         foreach (int num9 in houseVoteInfo.applications)
         {
             FactionData factionData = GameEngine.Instance.World.getFaction(num9);
             bool flag4 = false;
             if ((factionData != null) && houseVoteInfo.contains(factionData.factionID, ref flag4))
             {
                 int num10 = 0;
                 int num11 = 0;
                 if (houseVoteInfo.voteTotals != null)
                 {
                     for (int j = 0; j < (houseVoteInfo.voteTotals.Length / 3); j++)
                     {
                         if (houseVoteInfo.voteTotals[j, 0] == factionData.factionID)
                         {
                             num10 = houseVoteInfo.voteTotals[j, 1];
                             num11 = houseVoteInfo.voteTotals[j, 2];
                             break;
                         }
                     }
                 }
                 line2 = new HouseLine();
                 if (y != 0)
                 {
                     y += 5;
                 }
                 line2.Position = new Point(0, y);
                 line2.init(factionData, position, this);
                 line2.extendVote(flag4, num10, num11, num3 == 1);
                 line2.setAsApplication();
                 this.wallScrollArea.addControl(line2);
                 y += line2.Height;
                 this.lineList.Add(line2);
                 position++;
             }
         }
     }
     this.wallScrollArea.Size = new Size(this.wallScrollArea.Width, y);
     if (y < this.wallScrollBar.Height)
     {
         this.wallScrollBar.Visible = false;
     }
     else
     {
         this.wallScrollBar.Visible = true;
         this.wallScrollBar.NumVisibleLines = this.wallScrollBar.Height;
         this.wallScrollBar.Max = y - this.wallScrollBar.Height;
     }
     this.wallScrollArea.invalidate();
     this.wallScrollBar.invalidate();
     this.updateRelationshipText();
     this.update();
     base.Invalidate();
 }