private void initResourceArea(GetReport_ReturnType returnData)
 {
     this.areaResources.Size = new Size(this.attackerValuesPanel.Width * 2, this.attackerValuesPanel.Height);
     this.areaResources.Position = new Point((base.Width / 2) - (this.areaResources.Width / 2), this.attackerValuesPanel.Y);
     CustomSelfDrawPanel.CSDLine control = new CustomSelfDrawPanel.CSDLine {
         Position = new Point(1, 1),
         Size = new Size(this.areaResources.Width - 2, 0)
     };
     CustomSelfDrawPanel.CSDLine line2 = new CustomSelfDrawPanel.CSDLine {
         Position = new Point(1, this.areaResources.Height - 1),
         Size = new Size(this.areaResources.Width, 0)
     };
     this.areaResources.addControl(control);
     this.areaResources.addControl(line2);
     this.areaResources.Visible = false;
 }
        private int RefreshCards(CustomSelfDrawPanel.CSDImage content, List<CustomSelfDrawPanel.UICard> list, int width)
        {
            int[] numArray = null;
            if (GameEngine.Instance.World.lastUserCardSearchCriteria != null)
            {
                switch (GameEngine.Instance.World.lastUserCardSearchCriteria.newCardCategoryFilter)
                {
                    case 0x1001:
                        numArray = CardTypes.newCategories_ApplesOrder;
                        break;

                    case 0x1002:
                        numArray = CardTypes.newCategories_CheeseOrder;
                        break;

                    case 0x1003:
                        numArray = CardTypes.newCategories_MeatOrder;
                        break;

                    case 0x1004:
                        numArray = CardTypes.newCategories_BreadOrder;
                        break;

                    case 0x1005:
                        numArray = CardTypes.newCategories_VegOrder;
                        break;

                    case 0x1006:
                        numArray = CardTypes.newCategories_FishOrder;
                        break;

                    case 0x1007:
                        numArray = CardTypes.newCategories_AleOrder;
                        break;

                    case 0x2001:
                        numArray = CardTypes.newCategories_WoodOrder;
                        break;

                    case 0x2002:
                        numArray = CardTypes.newCategories_StoneOrder;
                        break;

                    case 0x2003:
                        numArray = CardTypes.newCategories_IronOrder;
                        break;

                    case 0x2004:
                        numArray = CardTypes.newCategories_PitchOrder;
                        break;

                    case 0x4001:
                        numArray = CardTypes.newCategories_VenisonOrder;
                        break;

                    case 0x4002:
                        numArray = CardTypes.newCategories_FurnitureOrder;
                        break;

                    case 0x4003:
                        numArray = CardTypes.newCategories_MetalwareOrder;
                        break;

                    case 0x4004:
                        numArray = CardTypes.newCategories_ClothesOrder;
                        break;

                    case 0x4005:
                        numArray = CardTypes.newCategories_WineOrder;
                        break;

                    case 0x4006:
                        numArray = CardTypes.newCategories_SaltOrder;
                        break;

                    case 0x4007:
                        numArray = CardTypes.newCategories_SpicesOrder;
                        break;

                    case 0x4008:
                        numArray = CardTypes.newCategories_SilkOrder;
                        break;

                    case 0x8001:
                        numArray = CardTypes.newCategories_BowsOrder;
                        break;

                    case 0x8002:
                        numArray = CardTypes.newCategories_PikesOrder;
                        break;

                    case 0x8003:
                        numArray = CardTypes.newCategories_ArmourOrder;
                        break;

                    case 0x8004:
                        numArray = CardTypes.newCategories_SwordsOrder;
                        break;

                    case 0x8005:
                        numArray = CardTypes.newCategories_CatapultsOrder;
                        break;

                    case 0x10001:
                        numArray = CardTypes.newCategories_CastleConOrder;
                        break;

                    case 0x10002:
                        numArray = CardTypes.newCategories_DefencesOrder;
                        break;

                    case 0x10003:
                        numArray = CardTypes.newCategories_WallsOrder;
                        break;

                    case 0x10004:
                        numArray = CardTypes.newCategories_KnightsOrder;
                        break;

                    case 0x20001:
                        numArray = CardTypes.newCategories_ScoutingOrder;
                        break;

                    case 0x20002:
                        numArray = CardTypes.newCategories_SpeedOrder;
                        break;

                    case 0x20003:
                        numArray = CardTypes.newCategories_RecruitmentOrder;
                        break;

                    case 0x20004:
                        numArray = CardTypes.newCategories_TroopsOrder;
                        break;

                    case 0x20005:
                        numArray = CardTypes.newCategories_DiplomacyOrder;
                        break;

                    case 0x40001:
                        numArray = CardTypes.newCategories_TradeOrder;
                        break;

                    case 0x40002:
                        numArray = CardTypes.newCategories_ReligionOrder;
                        break;

                    case 0x40003:
                        numArray = CardTypes.newCategories_HonourOrder;
                        break;

                    case 0x40004:
                        numArray = CardTypes.newCategories_GoldOrder;
                        break;

                    case 0x40005:
                        numArray = CardTypes.newCategories_PopOrder;
                        break;

                    case 0x40006:
                        numArray = CardTypes.newCategories_ResearchOrder;
                        break;

                    case 0x40007:
                        numArray = CardTypes.newCategories_CapacityOrder;
                        break;

                    case 0x40008:
                        numArray = CardTypes.newCategories_ConstructionOrder;
                        break;
                }
            }
            if (GameEngine.Instance.World.getTutorialStage() == 8)
            {
                list.Sort(CustomSelfDrawPanel.UICard.TUT2cardsNameComparer);
            }
            else if (GameEngine.Instance.World.getTutorialStage() == 12)
            {
                list.Sort(CustomSelfDrawPanel.UICard.TUTcardsNameComparer);
            }
            else if (this.sortByMode == 0)
            {
                list.Sort(CustomSelfDrawPanel.UICard.cardsNameComparer);
            }
            else if (this.sortByMode == 1)
            {
                list.Sort(CustomSelfDrawPanel.UICard.cardsIDComparer);
            }
            else if (this.sortByMode == 2)
            {
                list.Sort(CustomSelfDrawPanel.UICard.cardsNameComparerReverse);
            }
            else if (this.sortByMode == 3)
            {
                list.Sort(CustomSelfDrawPanel.UICard.cardsIDComparerReverse);
            }
            else if (this.sortByMode == 7)
            {
                list.Sort(CustomSelfDrawPanel.UICard.cardsQuantityComparer);
            }
            else if (this.sortByMode == 8)
            {
                list.Sort(CustomSelfDrawPanel.UICard.cardsQuantityComparerReverse);
            }
            int num = GameEngine.Instance.World.getRank() + 1;
            content.clearDirectControlsOnly();
            foreach (CustomSelfDrawPanel.UICard card in this.dummyCards)
            {
                card.clearControls();
            }
            this.dummyCards.Clear();
            int num2 = 0;
            int x = 0x10;
            int y = 0;
            if (this.currentCardSection == 0)
            {
                x = 0;
            }
            if (numArray != null)
            {
                this.sortBack.Visible = false;
                this.AvailablePanelContent.ClipRect = new Rectangle(this.AvailablePanelContent.ClipRect.X, this.AvailablePanelContent.ClipRect.Y, this.AvailablePanelContent.ClipRect.Width, this.AvailablePanel.Height - (BorderPadding * 2));
                int num5 = 0;
                int num6 = -1;
                for (int i = 0; i < numArray.Length; i += 3)
                {
                    if (numArray[i + 2] != num6)
                    {
                        int cardType = numArray[i];
                        int num9 = numArray[i + 1] * 0xb2;
                        int num10 = (numArray[i + 2] - num5) * 0xed;
                        bool flag = false;
                        CustomSelfDrawPanel.UICard control = null;
                        foreach (CustomSelfDrawPanel.UICard card3 in list)
                        {
                            if (CardTypes.getCardType(card3.Definition.id) == cardType)
                            {
                                flag = true;
                                control = card3;
                            }
                        }
                        CardTypes.CardDefinition def = CardTypes.getCardDefinition(cardType);
                        if ((!flag && (((def.cardRank <= 0) || (def.cardRarity <= 0)) || (def.available != 1))) && (num9 == 0))
                        {
                            bool flag2 = false;
                            int num11 = CardTypes.getCardType(cardType);
                            if ((num11 >= 0xbd7) && (num11 <= 0xbf5))
                            {
                                for (int j = 0; j < numArray.Length; j += 3)
                                {
                                    if (((numArray[j + 2] == numArray[i + 2]) && (cardType != numArray[j])) && (CardTypes.getCardDefinition(numArray[j]).available == 1))
                                    {
                                        numArray[j + 1]--;
                                        flag2 = true;
                                    }
                                }
                            }
                            if (!flag2)
                            {
                                num5++;
                                num6 = numArray[i + 2];
                                continue;
                            }
                        }
                        if ((num10 + 0xed) > num2)
                        {
                            num2 = num10 + 0xed;
                        }
                        if (flag)
                        {
                            control.Position = new Point(num9, num10);
                            content.addControl(control);
                            if ((num < control.Definition.cardRank) || (control.UserIDList.Count == 0))
                            {
                                control.rankLabel.Color = ARGBColors.Red;
                                control.Hilight(ARGBColors.Gray);
                            }
                            else
                            {
                                control.rankLabel.Color = ARGBColors.White;
                                control.Hilight(ARGBColors.White);
                            }
                            if (control.cardCount > 1)
                            {
                                control.countLabel.Text = control.cardCount.ToString();
                                if (control.cardCount >= 100)
                                {
                                    control.countLabel.Font = FontManager.GetFont("Arial", 16f, FontStyle.Bold);
                                }
                                else
                                {
                                    control.countLabel.Font = FontManager.GetFont("Arial", 18f, FontStyle.Bold);
                                }
                            }
                        }
                        else if (((def.cardRank > 0) && (def.cardRarity > 0)) && (def.available == 1))
                        {
                            CustomSelfDrawPanel.UICard card4 = BuyCardsPanel.makeUICard(def, RemoteServices.Instance.UserID, 0x2710);
                            card4.Position = new Point(num9, num10);
                            content.addControl(card4);
                            CustomSelfDrawPanel.CSDFill fill = new CustomSelfDrawPanel.CSDFill {
                                FillColor = Color.FromArgb(170, 0, 0, 0),
                                Alpha = 0.2f,
                                Position = new Point(2, 1),
                                Size = new Size((card4.Size.Width - 2) - 4, (card4.Size.Height - 1) - 5)
                            };
                            card4.addControl(fill);
                            this.dummyCards.Add(card4);
                            card4.CustomTooltipID = 0x2775;
                            card4.CustomTooltipData = cardType;
                            CustomSelfDrawPanel.CSDLabel label = new CustomSelfDrawPanel.CSDLabel();
                            if (def.cardPoints > 0)
                            {
                                label.Text = SK.Text("CARDS_GetCard", "Get Card");
                                label.Data = def.id;
                                label.setClickDelegate(new CustomSelfDrawPanel.CSDControl.CSD_ClickDelegate(this.linkToBuy));
                            }
                            else
                            {
                                label.Text = SK.Text("CARDS_No_Cards", "No Cards");
                            }
                            label.Position = new Point(num9 + 3, num10 + 5);
                            label.Size = new Size(0x9d, 0xd9);
                            label.Alignment = CustomSelfDrawPanel.CSD_Text_Alignment.CENTER_CENTER;
                            label.Font = FontManager.GetFont("Arial", 12f, FontStyle.Bold);
                            label.Color = ARGBColors.White;
                            label.CustomTooltipID = 0x2775;
                            label.CustomTooltipData = cardType;
                            content.addControl(label);
                        }
                    }
                }
            }
            else
            {
                if (!this.usingRecentFilter)
                {
                    this.sortBack.Visible = true;
                }
                this.AvailablePanelContent.ClipRect = new Rectangle(this.AvailablePanelContent.ClipRect.X, this.AvailablePanelContent.ClipRect.Y, this.AvailablePanelContent.ClipRect.Width, (this.AvailablePanel.Height - (BorderPadding * 2)) - 0x18);
                int num13 = 0;
                int num14 = 0;
                foreach (CustomSelfDrawPanel.UICard card5 in list)
                {
                    card5.Position = new Point(x, y);
                    content.addControl(card5);
                    num14 = y;
                    if (x > width)
                    {
                        x = 0x10;
                        if (this.currentCardSection == 0)
                        {
                            x = 0;
                        }
                        if (!this.compressedCards)
                        {
                            y += card5.Height + 8;
                        }
                        else
                        {
                            y += 0x3a;
                        }
                    }
                    else
                    {
                        x += card5.Width + 12;
                    }
                    if (this.compressedCards && (num13 < (list.Count - 4)))
                    {
                        card5.ClipRect = new Rectangle(0, 0, card5.Width, 60);
                        card5.bigEffect.Visible = false;
                        card5.rankLabel.Visible = false;
                    }
                    else
                    {
                        card5.ClipRect = Rectangle.Empty;
                        card5.bigEffect.Visible = true;
                        card5.rankLabel.Visible = true;
                    }
                    if (this.compressedCards)
                    {
                        CustomSelfDrawPanel.CSDLine line = new CustomSelfDrawPanel.CSDLine {
                            Position = new Point(card5.Position.X + 3, card5.Position.Y + 1),
                            Size = new Size(card5.Width - 7, 0),
                            LineColor = Color.FromArgb(0x80, ARGBColors.Black)
                        };
                        content.addControl(line);
                    }
                    num13++;
                    if ((num < card5.Definition.cardRank) || (card5.UserIDList.Count == 0))
                    {
                        card5.rankLabel.Color = ARGBColors.Red;
                        card5.Hilight(ARGBColors.Gray);
                    }
                    else
                    {
                        card5.rankLabel.Color = ARGBColors.White;
                        card5.Hilight(ARGBColors.White);
                    }
                    if (card5.cardCount > 1)
                    {
                        card5.countLabel.Text = card5.cardCount.ToString();
                        if (card5.cardCount >= 100)
                        {
                            card5.countLabel.Font = FontManager.GetFont("Arial", 16f, FontStyle.Bold);
                        }
                        else
                        {
                            card5.countLabel.Font = FontManager.GetFont("Arial", 18f, FontStyle.Bold);
                        }
                    }
                }
                if (list.Count > 0)
                {
                    num2 = (num14 + list[0].Height) + 8;
                }
            }
            disableCardsInPlay(this.UICardList);
            content.invalidate();
            return num2;
        }
        public void AddControls()
        {
            this.pnlWorlds.Controls.Clear();
            this.pnlLogin.Controls.Clear();
            this.pnlFeedback.Controls.Clear();
            this.pnlTabs.Controls.Clear();
            this.allButtons = new List<CustomSelfDrawPanel.CSDControl>();
            this.txtEmail = new TextBox();
            this.lblEmailSteam = new CustomSelfDrawPanel.CSDLabel();
            this.lblEmail = new CustomSelfDrawPanel.CSDLabel();
            if (Program.gamersFirstInstall || Program.arcInstall)
            {
                this.lblEmail.Text = "";
            }
            else if (!Program.bigpointInstall)
            {
                this.lblEmail.Text = this.strEmailAddress;
            }
            else
            {
                this.lblEmail.Text = SK.Text("Login_BigPoint_username", "Stronghold Kingdoms Username");
            }
            this.lblEmail.Width = 300;
            this.lblEmail.Height = 0x12;
            this.txtPassword = new TextBox();
            this.lblPassword = new CustomSelfDrawPanel.CSDLabel();
            if (Program.gamersFirstInstall || Program.arcInstall)
            {
                this.lblPassword.Text = "";
            }
            else if (!Program.bigpointInstall)
            {
                this.lblPassword.Text = this.strPassword;
            }
            else
            {
                this.lblPassword.Text = SK.Text("Login_BigPoint_Password", "Your Bigpoint Password");
            }
            this.lblPassword.Width = 300;
            this.lblPassword.Height = 0x12;
            this.LoginPanelControls_LoggedOut = new CustomSelfDrawPanel();
            this.LoginPanelControls_LoggedOut.AutoScaleMode = AutoScaleMode.None;
            this.LoginPanelControls_LoggedOut.forceStyle();
            this.btnLogin = new CustomSelfDrawPanel.CSDImage();
            this.allButtons.Add(this.btnLogin);
            this.btnLogin.Image = this.LoginImage;
            this.btnLogin.Width = this.btnLogin.Image.Width;
            this.btnLogin.Height = this.btnLogin.Image.Height;
            this.btnLogin.Enabled = false;
            this.lblLoginError = new CustomSelfDrawPanel.CSDLabel();
            this.lblLoginError.Color = ARGBColors.Red;
            this.lblLoginError.Visible = false;
            this.lblLoginError.Text = "ERROR:";
            this.lblLoginError.Width = this.pnlLogin.Width;
            this.lblEmail.Position = new Point(4, this.pnlTabs.Height - 0x1d);
            this.txtEmail.Location = new Point(4, this.lblEmail.Y + this.lblEmail.Height);
            this.lblEmailSteam.Position = new Point(4, this.lblEmail.Y + this.lblEmail.Height);
            this.lblPassword.Position = new Point(4, this.txtEmail.Bottom + 2);
            this.txtPassword.Location = new Point(4, this.lblPassword.Y + this.lblPassword.Height);
            this.txtPassword.Width = this.pnlLogin.Width - 8;
            this.txtEmail.Width = this.pnlLogin.Width - 8;
            this.lblEmailSteam.Width = this.pnlLogin.Width - 8;
            this.lblEmailSteam.Height = this.lblEmail.Height;
            this.txtPassword.PasswordChar = '*';
            this.btnLogin.Position = new Point(4, this.txtPassword.Bottom + 4);
            this.lblLoginError.Position = new Point(4, this.btnLogin.Y + this.btnLogin.Height);
            this.btnLogin.setClickDelegate(new CustomSelfDrawPanel.CSDControl.CSD_ClickDelegate(this.btnLogin_Click), "ProfileLoginWindow_login");
            this.btnLogin.setMouseOverDelegate(new CustomSelfDrawPanel.CSDControl.CSD_MouseOverDelegate(this.loginOver), new CustomSelfDrawPanel.CSDControl.CSD_MouseOverDelegate(this.loginOut));
            this.txtEmail.TextChanged += new EventHandler(this.txtLoginField_Validate_email);
            this.txtPassword.TextChanged += new EventHandler(this.txtLoginField_Validate);
            this.btnLoginFB = new CustomSelfDrawPanel.CSDButton();
            this.allButtons.Add(this.btnLoginFB);
            switch (Program.mySettings.LanguageIdent)
            {
                case "fr":
                    this.btnLoginFB.ImageNorm = (Image) GFXLibrary.facebookLogin_EN;
                    break;

                case "de":
                    this.btnLoginFB.ImageNorm = (Image) GFXLibrary.facebookLogin_DE;
                    break;

                case "ru":
                    this.btnLoginFB.ImageNorm = (Image) GFXLibrary.facebookLogin_RU;
                    break;

                case "es":
                    this.btnLoginFB.ImageNorm = (Image) GFXLibrary.facebookLogin_ES;
                    break;

                case "pl":
                    this.btnLoginFB.ImageNorm = (Image) GFXLibrary.facebookLogin_PL;
                    break;

                case "tr":
                    this.btnLoginFB.ImageNorm = (Image) GFXLibrary.facebookLogin_TR;
                    break;

                case "it":
                    this.btnLoginFB.ImageNorm = (Image) GFXLibrary.facebookLogin_IT;
                    break;

                case "pt":
                    this.btnLoginFB.ImageNorm = (Image) GFXLibrary.facebookLogin_PT;
                    break;

                default:
                    this.btnLoginFB.ImageNorm = (Image) GFXLibrary.facebookLogin_EN;
                    break;
            }
            this.btnLoginFB.OverBrighten = true;
            this.btnLoginFB.MoveOnClick = true;
            this.btnLoginFB.Enabled = false;
            this.btnLoginFB.Position = new Point((4 + this.btnLogin.Image.Width) + 4, this.txtPassword.Bottom + 4);
            this.lblLoginError.Position = new Point(4, this.btnLoginFB.Y + this.btnLoginFB.Height);
            this.btnLoginFB.setClickDelegate(new CustomSelfDrawPanel.CSDControl.CSD_ClickDelegate(this.btnLoginFB_Click), "ProfileLoginWindow_login");
            this.txtEmail.KeyPress += new KeyPressEventHandler(this.txtEmail_KeyPress);
            this.txtPassword.KeyPress += new KeyPressEventHandler(this.txtEmail_KeyPress);
            this.LoginPanelControls_LoggedOut.addControl(this.lblEmail);
            this.LoginPanelControls_LoggedOut.Controls.Add(this.txtEmail);
            this.LoginPanelControls_LoggedOut.addControl(this.lblEmailSteam);
            if ((Program.steamInstall && Program.steamActive) && Program.kingdomsAccountFound)
            {
                this.txtEmail.Visible = false;
                this.lblEmailSteam.Visible = true;
                this.lblEmailSteam.Text = Program.steamEmail;
                this.btnLoginFB.Visible = false;
            }
            else if ((Program.steamInstall && Program.steamActive) && !Program.kingdomsAccountFound)
            {
                this.txtEmail.Visible = false;
                this.lblEmailSteam.Visible = true;
                this.ShowCreateUserForm();
                this.btnLoginFB.Visible = false;
            }
            else if (Program.aeriaInstall || Program.bigpointInstall)
            {
                this.txtEmail.Visible = false;
                this.lblEmail.Visible = false;
                this.txtPassword.Visible = false;
                this.lblPassword.Visible = false;
                this.btnLogin.Visible = false;
                this.btnLoginFB.Visible = false;
            }
            if (Program.bigpointPartnerInstall)
            {
                this.txtEmail.Visible = false;
                this.lblEmail.Visible = false;
                this.txtPassword.Visible = false;
                this.lblPassword.Visible = false;
                this.btnLogin.Visible = true;
                this.btnLoginFB.Visible = false;
                this.btnLogin.Position = new Point(0x54, (this.txtPassword.Bottom + 4) - 30);
                this.bp2_loginMode = 0;
            }
            this.LoginPanelControls_LoggedOut.addControl(this.lblPassword);
            this.LoginPanelControls_LoggedOut.Controls.Add(this.txtPassword);
            this.LoginPanelControls_LoggedOut.addControl(this.btnLogin);
            this.LoginPanelControls_LoggedOut.addControl(this.btnLoginFB);
            this.LoginPanelControls_LoggedOut.addControl(this.lblLoginError);
            this.LoginPanelControls_LoggedOut.Size = this.pnlLogin.Size;
            this.LoginPanelControls_LoggedOut.Visible = true;
            this.pnlLogin.Controls.Add(this.LoginPanelControls_LoggedOut);
            this.LoginPanelControls_LoggedIn = new CustomSelfDrawPanel();
            this.LoginPanelControls_LoggedIn.AutoScaleMode = AutoScaleMode.None;
            this.LoginPanelControls_LoggedIn.forceStyle();
            this.LoginPanelControls_LoggedIn.Size = this.pnlLogin.Size;
            this.btnClientLogout = new CustomSelfDrawPanel.CSDImage();
            this.allButtons.Add(this.btnClientLogout);
            this.btnClientLogout.setClickDelegate(new CustomSelfDrawPanel.CSDControl.CSD_ClickDelegate(this.btnClientLogout_Click), "ProfileLoginWindow_logout");
            this.btnClientLogout.setMouseOverDelegate(new CustomSelfDrawPanel.CSDControl.CSD_MouseOverDelegate(this.logoutOver), new CustomSelfDrawPanel.CSDControl.CSD_MouseOverDelegate(this.logoutOut));
            this.btnClientLogout.Image = this.LogoutImage;
            this.btnClientLogout.Width = this.btnClientLogout.Image.Width;
            this.btnClientLogout.Height = this.btnClientLogout.Image.Height;
            if (((!Program.steamActive && !Program.aeriaInstall) && (!Program.gamersFirstInstall && !Program.arcInstall)) && !Program.bigpointInstall)
            {
                this.LoginPanelControls_LoggedIn.addControl(this.btnClientLogout);
            }
            this.pnlLogin.Controls.Add(this.LoginPanelControls_LoggedIn);
            this.btnShieldDesigner = new CustomSelfDrawPanel.CSDImage();
            this.allButtons.Add(this.btnShieldDesigner);
            this.lblUsername = new CustomSelfDrawPanel.CSDImage();
            this.LoginPanelControls_LoggedIn.addControl(this.btnShieldDesigner);
            this.LoginPanelControls_LoggedIn.addControl(this.lblUsername);
            this.btnShieldDesigner.setClickDelegate(new CustomSelfDrawPanel.CSDControl.CSD_ClickDelegate(this.LoadShieldDesigner), "ProfileLoginWindow_shield_designer");
            this.btnClientLogout.Y = this.pnlTabs.Height - 0x1d;
            this.btnClientLogout.X = (this.LoginPanelControls_LoggedIn.Width - this.btnClientLogout.Width) - 4;
            this.lblUsername.X = 4;
            this.lblUsername.Y = this.btnClientLogout.Y;
            this.WorldsPanelcontrols_LoggedOut = new CustomSelfDrawPanel();
            this.WorldsPanelcontrols_LoggedOut.AutoScaleMode = AutoScaleMode.None;
            this.WorldsPanelcontrols_LoggedOut.forceStyle();
            this.WorldsPanelcontrols_LoggedOut.Size = this.pnlWorlds.Size;
            this.lblWorldsOfflineError = new CustomSelfDrawPanel.CSDLabel();
            this.lblWorldsOfflineError.Color = ARGBColors.Red;
            this.WorldsPanelcontrols_LoggedOut.addControl(this.lblWorldsOfflineError);
            this.WorldsPanelcontrols_LoggedOut.Visible = false;
            this.pnlWorlds.Controls.Add(this.WorldsPanelcontrols_LoggedOut);
            this.WorldsPanelcontrols_LoggedIn = new CustomSelfDrawPanel();
            this.WorldsPanelcontrols_LoggedIn.forceStyle();
            this.WorldsPanelcontrols_LoggedIn.AutoScaleMode = AutoScaleMode.None;
            this.WorldsPanelcontrols_LoggedIn.Size = this.pnlWorlds.Size;
            this.lblWorldsOnlineError = new CustomSelfDrawPanel.CSDLabel();
            this.lblWorldsOnlineError.Color = ARGBColors.Red;
            this.WorldsPanelcontrols_LoggedIn.addControl(this.lblWorldsOnlineError);
            this.WorldsPanelcontrols_LoggedIn.Visible = false;
            this.pnlWorlds.Controls.Add(this.WorldsPanelcontrols_LoggedIn);
            this.BrowserTabsControls = new CustomSelfDrawPanel();
            this.BrowserTabsControls.forceStyle();
            this.BrowserTabsControls.AutoScaleMode = AutoScaleMode.None;
            this.BrowserTabsControls.Size = this.pnlTabs.Size;
            this.pnlTabs.Controls.Add(this.BrowserTabsControls);
            this.btnExit.GotFocus += new EventHandler(this.btnExit_GotFocus);
            if (Program.mySettings.Username.Trim().Length > 0)
            {
                this.ignoreEmailChange = true;
                this.txtEmail.Text = Program.mySettings.Username;
                this.ignoreEmailChange = false;
                if (Program.steamActive)
                {
                    this.lblEmailSteam.Text = Program.steamEmail;
                    this.txtPassword.Visible = false;
                    this.lblPassword.Visible = false;
                    this.btnLogin.Visible = false;
                    this.btnLoginFB.Visible = false;
                }
                this.txtPassword.Focus();
            }
            else
            {
                this.txtEmail.Focus();
            }
            this.LoginPanelControls_Feedback = new CustomSelfDrawPanel();
            this.LoginPanelControls_Feedback.forceStyle();
            this.LoginPanelControls_Feedback.Location = new Point(0, 0);
            this.LoginPanelControls_Feedback.AutoScaleMode = AutoScaleMode.None;
            this.LoginPanelControls_Feedback.Size = this.pnlFeedback.Size;
            this.feedbackProgressArea = new CustomSelfDrawPanel.CSDArea();
            this.feedbackProgressArea.Size = this.LoginPanelControls_Feedback.Size;
            this.LoginPanelControls_Feedback.addControl(this.feedbackProgressArea);
            this.feedbackProgress = new CustomSelfDrawPanel.CSDFill();
            this.feedbackProgress.FillColor = Color.FromArgb(0xff, 0xb6, 0);
            this.feedbackProgress.Size = new Size(0, this.pnlFeedback.Height);
            this.feedbackProgressArea.addControl(this.feedbackProgress);
            this.feedbackLine = new CustomSelfDrawPanel.CSDLine();
            this.feedbackLine.Position = new Point(0, 0);
            this.feedbackLine.Size = new Size(this.pnlFeedback.Width, 0);
            this.feedbackLine.LineColor = ARGBColors.Black;
            this.feedbackProgressArea.addControl(this.feedbackLine);
            this.exitButton = new CustomSelfDrawPanel.CSDImage();
            this.allButtons.Add(this.exitButton);
            this.exitButton.setClickDelegate(new CustomSelfDrawPanel.CSDControl.CSD_ClickDelegate(this.btnExit_Click), "ProfileLoginWindow_exit");
            this.exitButton.setMouseOverDelegate(new CustomSelfDrawPanel.CSDControl.CSD_MouseOverDelegate(this.exitOver), new CustomSelfDrawPanel.CSDControl.CSD_MouseOverDelegate(this.exitOut));
            this.exitButton.Image = this.ExitImage;
            this.exitButton.Width = this.exitButton.Image.Width;
            this.exitButton.Height = this.exitButton.Image.Height;
            this.exitButton.Position = new Point(0x337, 5);
            this.feedbackProgressArea.addControl(this.exitButton);
            this.cancelButton = new CustomSelfDrawPanel.CSDImage();
            this.cancelButton.setClickDelegate(new CustomSelfDrawPanel.CSDControl.CSD_ClickDelegate(this.cancelClick), "ProfileLoginWindow_cancel");
            this.cancelButton.setMouseOverDelegate(new CustomSelfDrawPanel.CSDControl.CSD_MouseOverDelegate(this.cancelOver), new CustomSelfDrawPanel.CSDControl.CSD_MouseOverDelegate(this.cancelOut));
            this.cancelButton.Image = this.CancelImage;
            this.cancelButton.Width = this.cancelButton.Image.Width;
            this.cancelButton.Height = this.cancelButton.Image.Height;
            this.cancelButton.Position = new Point(4, 5);
            this.cancelButton.Visible = false;
            this.feedbackProgressArea.addControl(this.cancelButton);
            this.lblRetrieving = new CustomSelfDrawPanel.CSDLabel();
            this.lblRetrieving.Text = "";
            this.lblRetrieving.Position = new Point(0x70, 10);
            this.lblRetrieving.Size = new Size(600, 20);
            this.lblRetrieving.Font = FontManager.GetFont("Microsoft Sans Serif", 8.25f);
            this.lblRetrieving.Color = ARGBColors.Black;
            this.lblRetrieving.Visible = false;
            this.Text = this.defaultWindowTitle;
            this.feedbackProgressArea.addControl(this.lblRetrieving);
            this.lblVersion = new CustomSelfDrawPanel.CSDLabel();
            this.lblVersion.Text = "";
            this.lblVersion.Position = new Point(640, 10);
            this.lblVersion.Size = new Size(0xa8, 20);
            this.lblVersion.Alignment = CustomSelfDrawPanel.CSD_Text_Alignment.TOP_RIGHT;
            this.lblVersion.Font = FontManager.GetFont("Microsoft Sans Serif", 8.25f);
            this.lblVersion.Color = ARGBColors.Black;
            this.lblVersion.Visible = false;
            this.feedbackProgressArea.addControl(this.lblVersion);
            this.tandcLabel = new CustomSelfDrawPanel.CSDLabel();
            this.tandcLabel.Text = SK.Text("MENU_TandC", "Terms & Conditions").Replace("&amp;", "&");
            this.tandcLabel.Size = new Size(270, 15);
            this.tandcLabel.Position = new Point(40, 10);
            this.tandcLabel.Font = FontManager.GetFont("Arial", 8f, FontStyle.Regular);
            this.tandcLabel.Color = ARGBColors.Black;
            this.tandcLabel.setClickDelegate(new CustomSelfDrawPanel.CSDControl.CSD_ClickDelegate(this.tcClicked));
            this.tandcLabel.setMouseOverDelegate(() => this.tandcLabel.Color = ARGBColors.Red, () => this.tandcLabel.Color = ARGBColors.Black);
            this.tandcLabel.Alignment = CustomSelfDrawPanel.CSD_Text_Alignment.TOP_LEFT;
            this.tandcLabel.Visible = true;
            this.feedbackProgressArea.addControl(this.tandcLabel);
            this.gameRulesLabel = new CustomSelfDrawPanel.CSDLabel();
            this.gameRulesLabel.Text = SK.Text("MENU_Game_Rules", "Game Rules");
            this.gameRulesLabel.Size = new Size(300, 15);
            if (Program.mySettings.languageIdent == "de")
            {
                this.gameRulesLabel.Position = new Point(0xfd, 10);
            }
            else
            {
                this.gameRulesLabel.Position = new Point(0xcd, 10);
            }
            this.gameRulesLabel.Font = FontManager.GetFont("Arial", 8f, FontStyle.Regular);
            this.gameRulesLabel.Color = ARGBColors.Black;
            this.gameRulesLabel.setClickDelegate(new CustomSelfDrawPanel.CSDControl.CSD_ClickDelegate(this.gameRulesClicked));
            this.gameRulesLabel.setMouseOverDelegate(() => this.gameRulesLabel.Color = ARGBColors.Red, () => this.gameRulesLabel.Color = ARGBColors.Black);
            this.gameRulesLabel.Alignment = CustomSelfDrawPanel.CSD_Text_Alignment.TOP_LEFT;
            this.gameRulesLabel.Visible = true;
            this.feedbackProgressArea.addControl(this.gameRulesLabel);
            this.forumLabel = new CustomSelfDrawPanel.CSDLabel();
            this.forumLabel.Text = SK.Text("MENU_Forum", "Forum");
            this.forumLabel.Size = new Size(300, 15);
            this.forumLabel.Position = new Point(370, 10);
            this.forumLabel.Font = FontManager.GetFont("Arial", 8f, FontStyle.Regular);
            this.forumLabel.Color = ARGBColors.Black;
            this.forumLabel.setClickDelegate(new CustomSelfDrawPanel.CSDControl.CSD_ClickDelegate(this.forumClicked));
            this.forumLabel.setMouseOverDelegate(() => this.forumLabel.Color = ARGBColors.Red, () => this.forumLabel.Color = ARGBColors.Black);
            this.forumLabel.Alignment = CustomSelfDrawPanel.CSD_Text_Alignment.TOP_LEFT;
            if (Program.bigpointInstall || Program.bigpointPartnerInstall)
            {
                this.forumLabel.Visible = false;
            }
            else
            {
                this.forumLabel.Visible = true;
            }
            this.feedbackProgressArea.addControl(this.forumLabel);
            this.supportLabel = new CustomSelfDrawPanel.CSDLabel();
            this.supportLabel.Text = SK.Text("MENU_Support", "Support");
            this.supportLabel.Size = new Size(100, 15);
            this.supportLabel.Position = new Point(0x217, 10);
            this.supportLabel.Font = FontManager.GetFont("Arial", 8f, FontStyle.Regular);
            this.supportLabel.Color = ARGBColors.Black;
            this.supportLabel.setClickDelegate(new CustomSelfDrawPanel.CSDControl.CSD_ClickDelegate(this.supportClicked));
            this.supportLabel.setMouseOverDelegate(() => this.supportLabel.Color = ARGBColors.Red, () => this.supportLabel.Color = ARGBColors.Black);
            this.supportLabel.Alignment = CustomSelfDrawPanel.CSD_Text_Alignment.TOP_LEFT;
            this.supportLabel.Visible = true;
            this.feedbackProgressArea.addControl(this.supportLabel);
            this.pnlFeedback.Controls.Add(this.LoginPanelControls_Feedback);
            this.GreyoutWorlds = this.MakeGreyoutImage(this.pnlWorlds);
            this.GreyoutLogin = this.MakeGreyoutImage(this.pnlLogin);
            this.GreyoutTabs = this.MakeGreyoutImage(this.pnlFeedback);
            if (Program.steamActive)
            {
                this.lblEmail.Visible = false;
                this.lblPassword.Visible = false;
                this.txtPassword.Visible = false;
            }
            if ((Program.steamInstall && Program.steamActive) && (Program.kingdomsAccountFound && !successfulAutoLogin))
            {
                this.btnLogin_Click();
            }
            if (Program.gamersFirstInstall || Program.arcInstall)
            {
                this.lblEmail.Visible = false;
                this.lblPassword.Visible = false;
                this.txtPassword.Visible = false;
                this.txtEmail.Visible = false;
                this.btnLogin.Visible = false;
                this.btnLoginFB.Visible = false;
                Program.mySettings.AutoLogin = false;
                if (!successfulAutoLogin)
                {
                    this.btnLogin_Click();
                }
            }
        }