public void BuildOnlineWorldList(List<WorldInfo> list)
        {
            if ((this.loggedInWorldControls != null) && (this.loggedInWorldControls.Count > 0))
            {
                foreach (CustomSelfDrawPanel.CSDControl control in this.loggedInWorldControls)
                {
                    this.WorldsPanelcontrols_LoggedIn.removeControl(control);
                }
                this.loggedInWorldControls.Clear();
            }
            else if (this.loggedInWorldControls == null)
            {
                this.loggedInWorldControls = new List<CustomSelfDrawPanel.CSDControl>();
            }
            int lastWorldID = Program.mySettings.LastWorldID;
            string str = SK.Text("LOGIN_LastWorld", "Last World Played");
            int num2 = 0;
            for (int i = 0; i < list.Count; i++)
            {
                if (list[i].Playing)
                {
                    num2++;
                }
            }
            int num4 = -1;
            if (num2 == 0)
            {
                if (this.chkAutoLogin != null)
                {
                    this.chkAutoLogin.Checked = false;
                }
                Program.mySettings.AutoLogin = false;
                str = SK.Text("LOGIN_Recommended_Server", "Recommended World");
                bool flag = false;
                int num5 = 0;
                int kingdomsWorldID = lastWorldID;
                for (int k = 0; k < list.Count; k++)
                {
                    if (list[k].Supportculture == Program.mySettings.LanguageIdent)
                    {
                        flag = true;
                    }
                    if (list[k].NewWorld)
                    {
                        num5++;
                        kingdomsWorldID = list[k].KingdomsWorldID;
                        if (((list[k].KingdomsWorldID >= 700) && (list[k].KingdomsWorldID < 0x31f)) || ((list[k].KingdomsWorldID >= 0x4b0) && (list[k].KingdomsWorldID < 0x513)))
                        {
                            num4 = list[k].KingdomsWorldID;
                        }
                    }
                }
                if (num5 == 1)
                {
                    lastWorldID = kingdomsWorldID;
                }
                else
                {
                    bool flag2 = false;
                    string languageIdent = Program.mySettings.LanguageIdent;
                    if (!flag)
                    {
                        languageIdent = "en";
                    }
                    bool flag3 = false;
                    int num8 = -1;
                    if (languageIdent == "en")
                    {
                        uint systemDefaultLangID = 0;
                        try
                        {
                            systemDefaultLangID = GetSystemDefaultLangID();
                        }
                        catch (Exception)
                        {
                        }
                        if (systemDefaultLangID == 0x409)
                        {
                            for (int m = 0; m < list.Count; m++)
                            {
                                if ((((list[m].Supportculture == languageIdent) && (list[m].KingdomsWorldID >= 900)) && ((list[m].KingdomsWorldID < 0x3e8) && list[m].NewWorld)) && (list[m].Online && list[m].AvailableToJoin))
                                {
                                    flag3 = true;
                                    lastWorldID = list[m].KingdomsWorldID;
                                    flag2 = true;
                                    break;
                                }
                            }
                        }
                    }
                    else if (!(languageIdent == "es"))
                    {
                        if (languageIdent == "pt")
                        {
                            uint num13 = 0;
                            try
                            {
                                num13 = GetSystemDefaultLangID();
                            }
                            catch (Exception)
                            {
                            }
                            if (num13 == 0x816)
                            {
                                languageIdent = "es";
                            }
                            else
                            {
                                bool flag4 = false;
                                for (int n = 0; n < list.Count; n++)
                                {
                                    if (list[n].Supportculture == "pt")
                                    {
                                        flag4 = true;
                                        break;
                                    }
                                }
                                if (!flag4)
                                {
                                    languageIdent = "es";
                                }
                            }
                        }
                    }
                    else
                    {
                        uint num11 = 0;
                        try
                        {
                            num11 = GetSystemDefaultLangID();
                        }
                        catch (Exception)
                        {
                        }
                        switch (num11)
                        {
                            case 0x140a:
                            case 0x180a:
                            case 0x80a:
                            case 0x100a:
                            case 0x1c0a:
                            case 0x200a:
                            case 0x240a:
                            case 0x280a:
                            case 0x2c0a:
                            case 0x380a:
                            case 0x3c0a:
                            case 0x400a:
                            case 0x300a:
                            case 0x340a:
                            case 0x4c0a:
                            case 0x500a:
                            case 0x540a:
                            case 0x440a:
                            case 0x480a:
                                for (int num12 = 0; num12 < list.Count; num12++)
                                {
                                    if (list[num12].Supportculture == "pt")
                                    {
                                        languageIdent = "pt";
                                        break;
                                    }
                                }
                                break;
                        }
                    }
                    if (!flag3)
                    {
                        bool flag5 = false;
                        for (int num15 = 0; num15 < list.Count; num15++)
                        {
                            if ((list[num15].Supportculture == languageIdent) && ((languageIdent != "en") || (list[num15].KingdomsWorldID < 200)))
                            {
                                if (((list[num15].KingdomsWorldID > num8) && (list[num15].Online || !flag2)) && list[num15].AvailableToJoin)
                                {
                                    lastWorldID = list[num15].KingdomsWorldID;
                                    num8 = list[num15].KingdomsWorldID;
                                    if (list[num15].Online)
                                    {
                                        flag2 = true;
                                    }
                                }
                                if ((list[num15].NewWorld && list[num15].Online) && list[num15].AvailableToJoin)
                                {
                                    lastWorldID = list[num15].KingdomsWorldID;
                                    flag2 = true;
                                    flag5 = true;
                                    break;
                                }
                            }
                        }
                        if (!flag5 && (num4 >= 0))
                        {
                            lastWorldID = num4;
                        }
                    }
                }
            }
            LastNumberOfWorldsPlaying = num2;
            DateTime time = new DateTime(0x7de, 2, 20, 0, 0, 0);
            CustomSelfDrawPanel.CSDLabel statusLinkLabel = new CustomSelfDrawPanel.CSDLabel {
                Text = SK.Text("LOGIN_WORLDS_STATUS_PAGE", "Live Status Webpage"),
                Color = ARGBColors.Black,
                Font = FontManager.GetFont("Arial", 9f, FontStyle.Regular),
                Position = new Point(0, 0xaf),
                Size = new Size(this.WorldsPanelcontrols_LoggedOut.Width, 0x19),
                Alignment = CustomSelfDrawPanel.CSD_Text_Alignment.CENTER_CENTER
            };
            statusLinkLabel.setClickDelegate(new CustomSelfDrawPanel.CSDControl.CSD_ClickDelegate(this.statusPageClicked));
            statusLinkLabel.setMouseOverDelegate(() => statusLinkLabel.Color = ARGBColors.Red, () => statusLinkLabel.Color = ARGBColors.Black);
            this.loggedInWorldControls.Add(statusLinkLabel);
            for (int j = 0; j < list.Count; j++)
            {
                if ((list[j].KingdomsWorldID != lastWorldID) || ((num2 != 0) && !list[j].Playing))
                {
                    continue;
                }
                CustomSelfDrawPanel.CSDLabel label = new CustomSelfDrawPanel.CSDLabel();
                CustomSelfDrawPanel.CSDImage image = new CustomSelfDrawPanel.CSDImage();
                CustomSelfDrawPanel.CSDImage image2 = new CustomSelfDrawPanel.CSDImage();
                CustomSelfDrawPanel.CSDLabel label2 = new CustomSelfDrawPanel.CSDLabel();
                CustomSelfDrawPanel.CSDLabel label3 = new CustomSelfDrawPanel.CSDLabel {
                    Text = str,
                    Position = new Point(0, 10),
                    Size = new Size(this.WorldsPanelcontrols_LoggedIn.Width, 60),
                    Font = FontManager.GetFont("Arial", 9f, FontStyle.Regular),
                    Color = ARGBColors.Black,
                    Alignment = CustomSelfDrawPanel.CSD_Text_Alignment.CENTER_CENTER
                };
                this.loggedInWorldControls.Add(label3);
                int num17 = 70;
                image.Y = num17;
                image2.Y = num17;
                label.Y = num17;
                label2.Y = num17;
                label.Width = (this.worldControlWidth + 8) + 8;
                label.Height = this.worldControlHeight;
                label2.Width = this.worldControlWidth - 8;
                label2.Height = this.worldControlHeight;
                switch (list[j].Supportculture)
                {
                    case "en":
                        image.CustomTooltipID = 0xfa1;
                        break;

                    case "de":
                        image.CustomTooltipID = 0xfa2;
                        break;

                    case "fr":
                        image.CustomTooltipID = 0xfa3;
                        break;

                    case "ru":
                        image.CustomTooltipID = 0xfa4;
                        break;

                    case "es":
                        image.CustomTooltipID = 0xfb0;
                        break;

                    case "pl":
                        image.CustomTooltipID = 0xfb4;
                        break;

                    case "tr":
                        image.CustomTooltipID = 0xfb7;
                        break;

                    case "it":
                        image.CustomTooltipID = 0xfbb;
                        break;

                    case "pt":
                        image.CustomTooltipID = 0xfc3;
                        break;

                    case "eu":
                        image.CustomTooltipID = 0xfbf;
                        break;
                }
                switch (list[j].MapCulture)
                {
                    case "en":
                        image2.CustomTooltipID = 0xfa5;
                        break;

                    case "de":
                        image2.CustomTooltipID = 0xfa6;
                        break;

                    case "fr":
                        image2.CustomTooltipID = 0xfa7;
                        break;

                    case "ru":
                        image2.CustomTooltipID = 0xfa8;
                        break;

                    case "es":
                        image2.CustomTooltipID = 0xfb1;
                        break;

                    case "pl":
                        image2.CustomTooltipID = 0xfb5;
                        break;

                    case "tr":
                        image2.CustomTooltipID = 0xfb8;
                        break;

                    case "it":
                        image2.CustomTooltipID = 0xfbc;
                        break;

                    case "us":
                        image2.CustomTooltipID = 0xfbe;
                        break;

                    case "eu":
                        image2.CustomTooltipID = 0xfc0;
                        break;

                    case "pt":
                        image2.CustomTooltipID = 0xfc4;
                        break;
                }
                label.Text = getWorldShortDesc(list[j]);
                image.Image = (Image) GFXLibrary.getLoginWorldFlag(list[j].Supportculture);
                image.Width = image.Image.Width;
                image.Height = image.Image.Height;
                image2.Image = (Image) GFXLibrary.getLoginWorldMap(list[j].MapCulture);
                image2.Width = image2.Image.Width;
                image2.Height = image2.Image.Height;
                label.X = 3;
                image.X = (label.X + label.Width) + 8;
                image2.X = (image.X + image.Width) + 8;
                label2.X = (image2.X + image2.Width) + 8;
                if (list[j].Online)
                {
                    label2.Text = this.strOnline;
                    label2.Color = ARGBColors.Green;
                    CustomSelfDrawPanel.CSDImage image3 = new CustomSelfDrawPanel.CSDImage();
                    this.allButtons.Add(image3);
                    image3.Width = this.worldControlWidth;
                    image3.Height = this.worldControlHeight;
                    image3.Y = num17;
                    image3.Tag = list[j];
                    image3.setClickDelegate(new CustomSelfDrawPanel.CSDControl.CSD_ClickDelegate(this.btnWorldAction_Click), "ProfileLoginWindow_enter_world");
                    image3.setMouseOverDelegate(new CustomSelfDrawPanel.CSDControl.CSD_MouseOverDelegate(this.btnWorldAction_mouseOver), new CustomSelfDrawPanel.CSDControl.CSD_MouseOverDelegate(this.btnWorldAction_mouseOut));
                    if (list[j].Playing)
                    {
                        image3.Image = this.PlayImage;
                    }
                    else if (list[j].AvailableToJoin)
                    {
                        image3.Image = this.JoinImage;
                    }
                    else
                    {
                        image3.Image = this.ClosedImage;
                        image3.setClickDelegate(null);
                        image3.setMouseOverDelegate(null, null);
                    }
                    image3.Width = image3.Image.Width;
                    image3.Height = image3.Image.Height;
                    image3.X = (this.pnlWorlds.Width - 4) - image3.Width;
                    this.loggedInWorldControls.Add(image3);
                    label2.CustomTooltipID = 0xfaa;
                }
                else
                {
                    if ((list[j].KingdomsWorldID == 0x9c4) && (DateTime.UtcNow > time))
                    {
                        label2.Text = this.strWorldEnded;
                        label2.Width = 0x80;
                    }
                    else
                    {
                        label2.Text = this.strOffline;
                        label2.Color = ARGBColors.Red;
                    }
                    label2.CustomTooltipID = 0xfa9;
                }
                this.loggedInWorldControls.Add(image);
                this.loggedInWorldControls.Add(image2);
                this.loggedInWorldControls.Add(label);
                this.loggedInWorldControls.Add(label2);
                break;
            }
            CustomSelfDrawPanel.CSDButton item = new CustomSelfDrawPanel.CSDButton {
                ImageNorm = this.SelectImage,
                ImageOver = this.SelectImageOver,
                Position = new Point(0x17, 120)
            };
            item.setClickDelegate(new CustomSelfDrawPanel.CSDControl.CSD_ClickDelegate(this.ShowWorldSelect), "ProfileLoginWindow_show_worlds");
            this.loggedInWorldControls.Add(item);
            if (NewWorldsAvailable)
            {
                CustomSelfDrawPanel.CSDLabel label4 = new CustomSelfDrawPanel.CSDLabel {
                    Text = SK.Text("LOGIN_New_Worlds", "A New World is available!"),
                    Color = ARGBColors.Green,
                    Position = new Point(0, 0x9b),
                    Size = new Size(this.WorldsPanelcontrols_LoggedIn.Width, 60),
                    Font = FontManager.GetFont("Arial", 9f, FontStyle.Regular),
                    Alignment = CustomSelfDrawPanel.CSD_Text_Alignment.TOP_CENTER
                };
                this.loggedInWorldControls.Add(label4);
            }
            foreach (CustomSelfDrawPanel.CSDControl control2 in this.loggedInWorldControls)
            {
                this.WorldsPanelcontrols_LoggedIn.addControl(control2);
            }
            this.WorldsPanelcontrols_LoggedIn.Invalidate(true);
        }
 public void BuildOfflineWorldList(List<WorldInfo> list)
 {
     if ((this.loggedOutWorldControls != null) && (this.loggedOutWorldControls.Count > 0))
     {
         foreach (CustomSelfDrawPanel.CSDControl control in this.loggedOutWorldControls)
         {
             this.WorldsPanelcontrols_LoggedOut.removeControl(control);
         }
         this.loggedOutWorldControls.Clear();
     }
     else if (this.loggedOutWorldControls == null)
     {
         this.loggedOutWorldControls = new List<CustomSelfDrawPanel.CSDControl>();
     }
     int num = 0;
     for (int i = 0; i < list.Count; i++)
     {
         if (list[i].Online)
         {
             num++;
         }
     }
     string str = "";
     Color green = ARGBColors.Green;
     if (num == 0)
     {
         str = SK.Text("LOGIN_ALL_OFFLINE", "All Worlds Offline");
         green = ARGBColors.Red;
     }
     else if (num == list.Count)
     {
         str = SK.Text("LOGIN_ALL_ONLINE", "All Worlds Online");
     }
     else
     {
         str = SK.Text("LOGIN_WORLDS_ONLINE", "Worlds Online : ") + num.ToString() + " / " + list.Count.ToString();
         green = ARGBColors.Black;
     }
     CustomSelfDrawPanel.CSDLabel item = new CustomSelfDrawPanel.CSDLabel {
         Text = str,
         Color = green,
         Font = FontManager.GetFont("Arial", 9f, FontStyle.Bold),
         Position = new Point(0, 0),
         Size = new Size(this.WorldsPanelcontrols_LoggedOut.Width, 80),
         Alignment = CustomSelfDrawPanel.CSD_Text_Alignment.TOP_CENTER
     };
     this.loggedOutWorldControls.Add(item);
     CustomSelfDrawPanel.CSDLabel statusLinkLabel = new CustomSelfDrawPanel.CSDLabel {
         Text = SK.Text("LOGIN_WORLDS_STATUS_PAGE", "Live Status Webpage"),
         Color = ARGBColors.Black,
         Font = FontManager.GetFont("Arial", 9f, FontStyle.Regular),
         Position = new Point(0, 20),
         Size = new Size(this.WorldsPanelcontrols_LoggedOut.Width, 0x19),
         Alignment = CustomSelfDrawPanel.CSD_Text_Alignment.CENTER_CENTER
     };
     statusLinkLabel.setClickDelegate(new CustomSelfDrawPanel.CSDControl.CSD_ClickDelegate(this.statusPageClicked));
     statusLinkLabel.setMouseOverDelegate(() => statusLinkLabel.Color = ARGBColors.Red, () => statusLinkLabel.Color = ARGBColors.Black);
     this.loggedOutWorldControls.Add(statusLinkLabel);
     foreach (CustomSelfDrawPanel.CSDControl control2 in this.loggedOutWorldControls)
     {
         this.WorldsPanelcontrols_LoggedOut.addControl(control2);
     }
     this.WorldsPanelcontrols_LoggedOut.Invalidate(true);
 }