public void init(FactionMemberData factionData, int position, FactionMyFactionPanel parent, bool ownFaction) { this.m_parent = parent; this.m_position = position; this.m_factionMemberData = factionData; this.clearControls(); if ((position & 1) == 0) { this.backgroundImage.Image = (Image) GFXLibrary.lineitem_strip_02_light; } else { this.backgroundImage.Image = (Image) GFXLibrary.lineitem_strip_02_dark; } this.backgroundImage.Position = new Point(0, 0); base.setClickDelegate(new CustomSelfDrawPanel.CSDControl.CSD_ClickDelegate(this.clickedLine)); base.addControl(this.backgroundImage); this.Size = this.backgroundImage.Size; NumberFormatInfo nFI = GameEngine.NFI; if ((factionData.status == 1) || (factionData.status == 2)) { if (factionData.status == 1) { this.officerImage.Image = (Image) GFXLibrary.faction_leaders[1]; this.officerImage.CustomTooltipID = 0x901; } else { this.officerImage.Image = (Image) GFXLibrary.faction_leaders[0]; this.officerImage.CustomTooltipID = 0x902; } this.officerImage.Position = new Point(9, 2); this.officerImage.setClickDelegate(new CustomSelfDrawPanel.CSDControl.CSD_ClickDelegate(this.clickedLine)); this.backgroundImage.addControl(this.officerImage); } this.playerName.Text = factionData.userName; if (factionData.status != -1) { this.playerName.Color = ARGBColors.Black; } else { this.playerName.Color = ARGBColors.DarkRed; } this.playerName.Position = new Point(0x45, 0); this.playerName.Size = new Size(250, this.backgroundImage.Height); this.playerName.Font = FontManager.GetFont("Arial", 9f, FontStyle.Regular); this.playerName.Alignment = CustomSelfDrawPanel.CSD_Text_Alignment.CENTER_LEFT; this.playerName.setClickDelegate(new CustomSelfDrawPanel.CSDControl.CSD_ClickDelegate(this.clickedLine)); this.backgroundImage.addControl(this.playerName); if (factionData.status != -1) { this.pointsLabel.Text = factionData.totalPoints.ToString("N", nFI); this.pointsLabel.Color = ARGBColors.Black; this.pointsLabel.Position = new Point(300, 0); this.pointsLabel.Size = new Size(0x55, this.backgroundImage.Height); this.pointsLabel.Font = FontManager.GetFont("Arial", 9f, FontStyle.Regular); this.pointsLabel.Alignment = CustomSelfDrawPanel.CSD_Text_Alignment.CENTER_RIGHT; this.pointsLabel.setClickDelegate(new CustomSelfDrawPanel.CSDControl.CSD_ClickDelegate(this.clickedLine)); this.backgroundImage.addControl(this.pointsLabel); this.rankName.Text = Rankings.getRankingName(factionData.rank, factionData.male); this.rankName.Color = ARGBColors.Black; this.rankName.Position = new Point(450, 0); this.rankName.Size = new Size(150, this.backgroundImage.Height); this.rankName.Font = FontManager.GetFont("Arial", 9f, FontStyle.Regular); this.rankName.Alignment = CustomSelfDrawPanel.CSD_Text_Alignment.CENTER_LEFT; this.rankName.setClickDelegate(new CustomSelfDrawPanel.CSDControl.CSD_ClickDelegate(this.clickedLine)); this.backgroundImage.addControl(this.rankName); this.villageLabel.Text = factionData.numVillages.ToString("N", nFI); this.villageLabel.Color = ARGBColors.Black; this.villageLabel.Position = new Point(620, 0); this.villageLabel.Size = new Size(0x37, this.backgroundImage.Height); this.villageLabel.Font = FontManager.GetFont("Arial", 9f, FontStyle.Regular); this.villageLabel.Alignment = CustomSelfDrawPanel.CSD_Text_Alignment.CENTER_RIGHT; this.villageLabel.setClickDelegate(new CustomSelfDrawPanel.CSDControl.CSD_ClickDelegate(this.clickedLine)); this.backgroundImage.addControl(this.villageLabel); if (factionData.online) { this.onlineImage.Image = (Image) GFXLibrary.radio_green[0]; this.onlineImage.Position = new Point(280, 5); this.backgroundImage.addControl(this.onlineImage); } } else { this.pointsLabel.Text = SK.Text("FactionsInvites_Invite_Pending", "Invitation Pending"); this.pointsLabel.Color = ARGBColors.DarkRed; this.pointsLabel.Position = new Point(300, 0); this.pointsLabel.Size = new Size(500, this.backgroundImage.Height); this.pointsLabel.Font = FontManager.GetFont("Arial", 9f, FontStyle.Regular); this.pointsLabel.Alignment = CustomSelfDrawPanel.CSD_Text_Alignment.CENTER_LEFT; this.pointsLabel.setClickDelegate(new CustomSelfDrawPanel.CSDControl.CSD_ClickDelegate(this.clickedLine)); this.backgroundImage.addControl(this.pointsLabel); switch (GameEngine.Instance.World.getYourFactionRank()) { case 1: case 2: this.declineButton.ImageNorm = (Image) GFXLibrary.mail2_button_blue_141wide_normal; this.declineButton.ImageOver = (Image) GFXLibrary.mail2_button_blue_141wide_over; this.declineButton.ImageClick = (Image) GFXLibrary.mail2_button_blue_141wide_pushed; this.declineButton.Position = new Point(560, 0); this.declineButton.Text.Text = SK.Text("FactionMemberLine_Cancel_Invite", "Cancel Invite"); this.declineButton.Text.Alignment = CustomSelfDrawPanel.CSD_Text_Alignment.CENTER_CENTER; this.declineButton.Text.Font = FontManager.GetFont("Arial", 9f, FontStyle.Bold); this.declineButton.TextYOffset = -3; this.declineButton.Text.Color = ARGBColors.Black; this.declineButton.setClickDelegate(new CustomSelfDrawPanel.CSDControl.CSD_ClickDelegate(this.declineClicked), "FactionMyFactionPanel_declined_clicked"); this.backgroundImage.addControl(this.declineButton); break; } } this.shieldImage.Image = GameEngine.Instance.World.getWorldShield(factionData.userID, 0x19, 0x1c); if (this.shieldImage.Image != null) { this.shieldImage.Position = new Point(0x27, 1); this.shieldImage.setClickDelegate(new CustomSelfDrawPanel.CSDControl.CSD_ClickDelegate(this.clickedLine)); this.shieldImage.setRightClickDelegate(new CustomSelfDrawPanel.CSDControl.CSD_ClickDelegate(this.clickedLine)); this.backgroundImage.addControl(this.shieldImage); } base.invalidate(); }
public void init(bool resized) { int height = base.Height; instance = this; base.clearControls(); NumberFormatInfo nFI = GameEngine.NFI; this.sidebar.addSideBar(1, this); FactionData data = GameEngine.Instance.World.getFaction(m_selectedFaction); if (data == null) { data = new FactionData(); } this.greyOverlay.Size = base.Size; this.mainBackgroundImage.FillColor = Color.FromArgb(0x86, 0x99, 0xa5); this.mainBackgroundImage.Position = new Point(0, 0); this.mainBackgroundImage.Size = new Size(base.Width - 200, height); base.addControl(this.mainBackgroundImage); this.backgroundFade.Image = (Image) GFXLibrary.background_top; this.backgroundFade.Position = new Point(0, 0); this.backgroundFade.Size = new Size(base.Width - 200, this.backgroundFade.Image.Height); this.mainBackgroundImage.addControl(this.backgroundFade); this.backImage1.Image = (Image) GFXLibrary.faction_tanback; this.backImage1.Position = new Point((this.mainBackgroundImage.Size.Width - this.backImage1.Size.Width) - 0x19, 12); this.mainBackgroundImage.addControl(this.backImage1); this.backImage2.Image = (Image) GFXLibrary.faction_title_band; this.backImage2.Position = new Point(20, 20); this.mainBackgroundImage.addControl(this.backImage2); this.barImage1.Image = (Image) GFXLibrary.faction_bar_tan_1_heavier; this.barImage1.Position = new Point(0x114, 70); this.mainBackgroundImage.addControl(this.barImage1); this.barImage2.Image = (Image) GFXLibrary.faction_bar_tan_1_lighter; this.barImage2.Position = new Point(0x114, 0x5e); this.mainBackgroundImage.addControl(this.barImage2); this.barImage3.Image = (Image) GFXLibrary.faction_bar_tan_1_heavier; this.barImage3.Position = new Point(0x114, 0x76); this.mainBackgroundImage.addControl(this.barImage3); this.factionNameLabel.Text = data.factionName; this.factionNameLabel.Color = ARGBColors.Black; this.factionNameLabel.Position = new Point(0xcd, 10); this.factionNameLabel.Size = new Size(600, 40); this.factionNameLabel.Font = FontManager.GetFont("Arial", 20f, FontStyle.Regular); this.factionNameLabel.Alignment = CustomSelfDrawPanel.CSD_Text_Alignment.TOP_LEFT; this.mainBackgroundImage.addControl(this.factionNameLabel); this.factionMottoLabel.Text = "\"" + data.factionMotto + "\""; this.factionMottoLabel.Color = ARGBColors.Black; this.factionMottoLabel.Position = new Point(0xcd, 0x29); this.factionMottoLabel.Size = new Size(600, 40); this.factionMottoLabel.Font = FontManager.GetFont("Arial", 12f, FontStyle.Regular); this.factionMottoLabel.Alignment = CustomSelfDrawPanel.CSD_Text_Alignment.TOP_LEFT; this.mainBackgroundImage.addControl(this.factionMottoLabel); if (data.houseID > 0) { this.houseLabel.Text = SK.Text("STATS_CATEGORY_TITLE_HOUSE", "House") + " " + data.houseID.ToString(); this.houseLabel.Color = ARGBColors.Black; this.houseLabel.Position = new Point(0x23f, 110); this.houseLabel.Size = new Size(200, 50); this.houseLabel.Font = FontManager.GetFont("Arial", 12f, FontStyle.Regular); this.houseLabel.Alignment = CustomSelfDrawPanel.CSD_Text_Alignment.CENTER_CENTER; this.houseLabel.setClickDelegate(new CustomSelfDrawPanel.CSDControl.CSD_ClickDelegate(this.houseClicked), "FactionMyFactionPanel_house"); this.mainBackgroundImage.addControl(this.houseLabel); this.houseImage.Image = (Image) GFXLibrary.house_circles_large[data.houseID - 1]; this.houseImage.Position = new Point(0x2a3 - (this.houseImage.Image.Width / 2), (0x41 - (this.houseImage.Image.Height / 2)) + 8); this.houseImage.setClickDelegate(new CustomSelfDrawPanel.CSDControl.CSD_ClickDelegate(this.houseClicked), "FactionMyFactionPanel_house"); this.mainBackgroundImage.addControl(this.houseImage); } this.membersLabel.Text = SK.Text("FactionInvites_Members", "Members"); this.membersLabel.Color = ARGBColors.Black; this.membersLabel.Position = new Point(0x11c, 0x49); this.membersLabel.Size = new Size(600, 40); this.membersLabel.Font = FontManager.GetFont("Arial", 10f, FontStyle.Regular); this.membersLabel.Alignment = CustomSelfDrawPanel.CSD_Text_Alignment.TOP_LEFT; this.mainBackgroundImage.addControl(this.membersLabel); this.membersLabelValue.Text = data.numMembers.ToString(); this.membersLabelValue.Color = ARGBColors.Black; this.membersLabelValue.Position = new Point(30, 0x49); this.membersLabelValue.Size = new Size(0x1e2, 40); this.membersLabelValue.Font = FontManager.GetFont("Arial", 10f, FontStyle.Regular); this.membersLabelValue.Alignment = CustomSelfDrawPanel.CSD_Text_Alignment.TOP_RIGHT; this.mainBackgroundImage.addControl(this.membersLabelValue); this.rankHeaderLabel.Text = SK.Text("STATS_CATEGORY_TITLE_RANK", "Rank"); this.rankHeaderLabel.Color = ARGBColors.Black; this.rankHeaderLabel.Position = new Point(0x11c, 0x79); this.rankHeaderLabel.Size = new Size(600, 40); this.rankHeaderLabel.Font = FontManager.GetFont("Arial", 10f, FontStyle.Regular); this.rankHeaderLabel.Alignment = CustomSelfDrawPanel.CSD_Text_Alignment.TOP_LEFT; this.mainBackgroundImage.addControl(this.rankHeaderLabel); this.rankHeaderLabelValue.Text = (GameEngine.Instance.World.getFactionRank(m_selectedFaction) + 1).ToString("N", nFI); this.rankHeaderLabelValue.Color = ARGBColors.Black; this.rankHeaderLabelValue.Position = new Point(30, 0x79); this.rankHeaderLabelValue.Size = new Size(0x1e2, 40); this.rankHeaderLabelValue.Font = FontManager.GetFont("Arial", 10f, FontStyle.Regular); this.rankHeaderLabelValue.Alignment = CustomSelfDrawPanel.CSD_Text_Alignment.TOP_RIGHT; this.mainBackgroundImage.addControl(this.rankHeaderLabelValue); this.pointsHeaderLabel.Text = SK.Text("FactionsPanel_Points", "Points"); this.pointsHeaderLabel.Color = ARGBColors.Black; this.pointsHeaderLabel.Position = new Point(0x11c, 0x61); this.pointsHeaderLabel.Size = new Size(600, 40); this.pointsHeaderLabel.Font = FontManager.GetFont("Arial", 10f, FontStyle.Regular); this.pointsHeaderLabel.Alignment = CustomSelfDrawPanel.CSD_Text_Alignment.TOP_LEFT; this.mainBackgroundImage.addControl(this.pointsHeaderLabel); this.pointsHeaderLabelValue.Text = data.points.ToString("N", nFI); this.pointsHeaderLabelValue.Color = ARGBColors.Black; this.pointsHeaderLabelValue.Position = new Point(30, 0x61); this.pointsHeaderLabelValue.Size = new Size(0x1e2, 40); this.pointsHeaderLabelValue.Font = FontManager.GetFont("Arial", 10f, FontStyle.Regular); this.pointsHeaderLabelValue.Alignment = CustomSelfDrawPanel.CSD_Text_Alignment.TOP_RIGHT; this.mainBackgroundImage.addControl(this.pointsHeaderLabelValue); this.headerLabelsImage.Size = new Size(((base.Width - 0x19) - 0x17) - 200, 0x1c); this.headerLabelsImage.Position = new Point(0x19, 0x9f); this.mainBackgroundImage.addControl(this.headerLabelsImage); this.headerLabelsImage.Create((Image) GFXLibrary.mail2_field_bar_mail_left, (Image) GFXLibrary.mail2_field_bar_mail_middle, (Image) GFXLibrary.mail2_field_bar_mail_right); this.divider1Image.Image = (Image) GFXLibrary.mail2_field_bar_mail_divider; this.divider1Image.Position = new Point(290, 0); this.headerLabelsImage.addControl(this.divider1Image); this.divider2Image.Image = (Image) GFXLibrary.mail2_field_bar_mail_divider; this.divider2Image.Position = new Point(440, 0); this.headerLabelsImage.addControl(this.divider2Image); this.divider3Image.Image = (Image) GFXLibrary.mail2_field_bar_mail_divider; this.divider3Image.Position = new Point(610, 0); this.headerLabelsImage.addControl(this.divider3Image); this.playerNameLabel.Text = SK.Text("UserInfoPanel_", "Player Name"); this.playerNameLabel.Color = ARGBColors.Black; this.playerNameLabel.Position = new Point(9, -2); this.playerNameLabel.Size = new Size(0x143, this.headerLabelsImage.Height); this.playerNameLabel.Font = FontManager.GetFont("Arial", 9f, FontStyle.Regular); this.playerNameLabel.Alignment = CustomSelfDrawPanel.CSD_Text_Alignment.CENTER_LEFT; this.headerLabelsImage.addControl(this.playerNameLabel); this.pointsLabel.Text = SK.Text("FactionsPanel_Points", "Points"); this.pointsLabel.Color = ARGBColors.Black; this.pointsLabel.Position = new Point(0x127, -2); this.pointsLabel.Size = new Size(140, this.headerLabelsImage.Height); this.pointsLabel.Font = FontManager.GetFont("Arial", 9f, FontStyle.Regular); this.pointsLabel.Alignment = CustomSelfDrawPanel.CSD_Text_Alignment.CENTER_CENTER; this.headerLabelsImage.addControl(this.pointsLabel); this.rankLabel.Text = SK.Text("STATS_CATEGORY_TITLE_RANK", "Rank"); this.rankLabel.Color = ARGBColors.Black; this.rankLabel.Position = new Point(0x1bd, -2); this.rankLabel.Size = new Size(0xdf, this.headerLabelsImage.Height); this.rankLabel.Font = FontManager.GetFont("Arial", 9f, FontStyle.Regular); this.rankLabel.Alignment = CustomSelfDrawPanel.CSD_Text_Alignment.CENTER_LEFT; this.headerLabelsImage.addControl(this.rankLabel); this.villagesLabel.Text = SK.Text("UserInfoPanel_Villages", "Villages"); this.villagesLabel.Color = ARGBColors.Black; this.villagesLabel.Position = new Point(0x267, -2); this.villagesLabel.Size = new Size(110, this.headerLabelsImage.Height); this.villagesLabel.Font = FontManager.GetFont("Arial", 9f, FontStyle.Regular); this.villagesLabel.Alignment = CustomSelfDrawPanel.CSD_Text_Alignment.CENTER_CENTER; this.headerLabelsImage.addControl(this.villagesLabel); this.flagimage.createFromFlagData(data.flagData); this.flagimage.Position = new Point(0x23, 6); this.flagimage.Scale = 0.5; this.mainBackgroundImage.addControl(this.flagimage); if (data.factionID == RemoteServices.Instance.UserFactionID) { InterfaceMgr.Instance.setVillageHeading(SK.Text("FactionInvites_My_Faction_Details", "My Faction Details")); } else { InterfaceMgr.Instance.setVillageHeading(SK.Text("FactionInvites_Faction_Details", "Faction Details")); } if ((RemoteServices.Instance.UserFactionID < 0) && GameEngine.Instance.World.alreadyGotFactionApplication(data.factionID)) { this.diplomacyLabel.Text = SK.Text("FactionInvites_Application Pending", "Application Pending"); this.diplomacyLabel.Color = ARGBColors.Black; this.diplomacyLabel.Position = new Point(0x18, 0x7e); this.diplomacyLabel.Size = new Size(240, 40); this.diplomacyLabel.Font = FontManager.GetFont("Arial", 12f, FontStyle.Regular); this.diplomacyLabel.Alignment = CustomSelfDrawPanel.CSD_Text_Alignment.TOP_LEFT; this.mainBackgroundImage.addControl(this.diplomacyLabel); } else if (((RemoteServices.Instance.UserFactionID < 0) && data.openForApplications) && !GameEngine.Instance.World.alreadyGotFactionApplication(data.factionID)) { if (GameEngine.Instance.World.getRank() >= 6) { this.diplomacyButton.ImageNorm = (Image) GFXLibrary.misc_button_blue_210wide_normal; this.diplomacyButton.ImageOver = (Image) GFXLibrary.misc_button_blue_210wide_over; this.diplomacyButton.ImageClick = (Image) GFXLibrary.misc_button_blue_210wide_pushed; this.diplomacyButton.Position = new Point(0x18, 0x7e); this.diplomacyButton.Text.Text = SK.Text("FactionInvites_Apply", "Apply To Join"); this.diplomacyButton.Text.Alignment = CustomSelfDrawPanel.CSD_Text_Alignment.CENTER_CENTER; this.diplomacyButton.Text.Font = FontManager.GetFont("Arial", 9f, FontStyle.Bold); this.diplomacyButton.TextYOffset = -3; this.diplomacyButton.Text.Color = ARGBColors.Black; this.diplomacyButton.setClickDelegate(new CustomSelfDrawPanel.CSDControl.CSD_ClickDelegate(this.applyClicked), "FactionMyFactionPanel_diplomacy"); this.mainBackgroundImage.addControl(this.diplomacyButton); } } else if (data.factionID != RemoteServices.Instance.UserFactionID) { if (GameEngine.Instance.World.getYourFactionRank() == 1) { this.diplomacyButton.ImageNorm = (Image) GFXLibrary.misc_button_blue_210wide_normal; this.diplomacyButton.ImageOver = (Image) GFXLibrary.misc_button_blue_210wide_over; this.diplomacyButton.ImageClick = (Image) GFXLibrary.misc_button_blue_210wide_pushed; this.diplomacyButton.Position = new Point(0x18, 0x7e); this.diplomacyButton.Text.Text = ""; this.diplomacyButton.Text.Alignment = CustomSelfDrawPanel.CSD_Text_Alignment.CENTER_CENTER; this.diplomacyButton.Text.Font = FontManager.GetFont("Arial", 9f, FontStyle.Bold); this.diplomacyButton.TextYOffset = -3; this.diplomacyButton.Text.Color = ARGBColors.Black; this.diplomacyButton.setClickDelegate(new CustomSelfDrawPanel.CSDControl.CSD_ClickDelegate(this.diplomacyClicked), "FactionMyFactionPanel_diplomacy"); this.mainBackgroundImage.addControl(this.diplomacyButton); } else { this.diplomacyLabel.Text = ""; this.diplomacyLabel.Color = ARGBColors.Black; this.diplomacyLabel.Position = new Point(0x18, 0x7e); this.diplomacyLabel.Size = new Size(240, 40); this.diplomacyLabel.Font = FontManager.GetFont("Arial", 12f, FontStyle.Regular); this.diplomacyLabel.Alignment = CustomSelfDrawPanel.CSD_Text_Alignment.TOP_RIGHT; this.mainBackgroundImage.addControl(this.diplomacyLabel); } } this.wallScrollArea.Position = new Point(0x19, 0xbc); this.wallScrollArea.Size = new Size(0x2c1, (height - 0x26) - 150); this.wallScrollArea.ClipRect = new Rectangle(new Point(0, 0), new Size(0x2c1, (height - 0x26) - 150)); this.mainBackgroundImage.addControl(this.wallScrollArea); this.mouseWheelOverlay.Position = this.wallScrollArea.Position; this.mouseWheelOverlay.Size = this.wallScrollArea.Size; this.mouseWheelOverlay.setMouseWheelDelegate(new CustomSelfDrawPanel.CSDControl.CSD_MouseWheelDelegate(this.mouseWheelMoved)); this.mainBackgroundImage.addControl(this.mouseWheelOverlay); int num1 = this.wallScrollBar.Value; this.wallScrollBar.Position = new Point(0x2dd, 0xbc); this.wallScrollBar.Size = new Size(0x18, (height - 0x26) - 150); this.mainBackgroundImage.addControl(this.wallScrollBar); this.wallScrollBar.Value = 0; this.wallScrollBar.Max = 100; this.wallScrollBar.NumVisibleLines = 0x19; this.wallScrollBar.Create(null, null, null, (Image) GFXLibrary._24wide_thumb_top, (Image) GFXLibrary._24wide_thumb_middle, (Image) GFXLibrary._24wide_thumb_bottom); this.wallScrollBar.setValueChangeDelegate(new CustomSelfDrawPanel.CSDControl.CSD_ValueChangedDelegate(this.wallScrollBarMoved)); bool uptodate = false; FactionMemberData[] fmd = GameEngine.Instance.World.getFactionMemberData(m_selectedFaction, ref uptodate); if (!resized) { if ((GameEngine.Instance.LocalWorldData.AIWorld && (data.factionID >= 1)) && (data.factionID <= 4)) { uptodate = true; fmd = new FactionMemberData[] { new FactionMemberData() }; switch (data.factionID) { case 1: fmd[0].userID = 1; fmd[0].userName = "******"; fmd[0].status = 1; fmd[0].numVillages = GameEngine.Instance.World.countRatsCastles(); break; case 2: fmd[0].userID = 2; fmd[0].userName = "******"; fmd[0].status = 1; fmd[0].numVillages = GameEngine.Instance.World.countSnakesCastles(); break; case 3: fmd[0].userID = 3; fmd[0].userName = "******"; fmd[0].status = 1; fmd[0].numVillages = GameEngine.Instance.World.countPigsCastles(); break; case 4: fmd[0].userID = 4; fmd[0].userName = "******"; fmd[0].status = 1; fmd[0].numVillages = GameEngine.Instance.World.countWolfsCastles(); break; } } if (!uptodate) { RemoteServices.Instance.set_GetViewFactionData_UserCallBack(new RemoteServices.GetViewFactionData_UserCallBack(this.getViewFactionDataCallback)); RemoteServices.Instance.GetViewFactionData(m_selectedFaction); } this.diplomacyOverlayVisible = false; } this.addPlayers(fmd); if (resized && this.diplomacyOverlayVisible) { this.addDiplomacyOverlay(); } }