public bool update(double localTime) { if (this.btnCancel.Visible) { if (this.m_army.localEndTime == 0.0) { return(false); } if ((this.m_army.localStartTime + (GameEngine.Instance.LocalWorldData.AttackCancelDuration * 60)) < localTime) { return(false); } } else { WorldMap.LocalArmyData data = GameEngine.Instance.World.getArmy(this.m_armyID); if ((data == null) || (data.lootType != this.m_origLoot)) { return(false); } } DateTime time = VillageMap.getCurrentServerTime(); TimeSpan span = (TimeSpan)(this.m_arrivalTime - time); int secsLeft = (int)(span.TotalSeconds + 0.5); if (secsLeft < 1) { secsLeft = 0; } this.lblArrivalTime.Text = VillageMap.createBuildTimeString(secsLeft); return(true); }
public void update() { this.backGround.update(); if ((this.m_person != null) && !this.m_person.dying) { if (this.m_person.person.state != this.lastState) { this.backGround.updateTravelButton(this.homeVillageButton, this.m_person.person.homeVillageID); this.backGround.updateTravelButton(this.targetVillageButton, this.m_person.person.targetVillageID); this.lastState = this.m_person.person.state; if (this.lastState == 0) { InterfaceMgr.Instance.closePersonInfoPanel(); return; } if (((this.lastState == 1) || (this.lastState == 11)) || (((this.lastState == 0x15) || (this.lastState == 0x1f)) || (this.lastState == 0x4b))) { this.travelDirection.Image = (Image)GFXLibrary.mrhp_travelling_arrows[0]; } else if (this.lastState == 50) { this.travelDirection.Image = (Image)GFXLibrary.mrhp_travelling_arrows[1]; } } double num = DXTimer.GetCurrentMilliseconds() / 1000.0; double num2 = this.m_person.localEndTime - num; string subHeading = VillageMap.createBuildTimeString((int)num2); this.backGround.updateSubHeading(subHeading); } else { InterfaceMgr.Instance.closePersonInfoPanel(); } }
public void update() { this.backGround.update(); if (this.m_trader != null) { if (this.m_trader.trader.traderState != this.lastState) { this.lastState = this.m_trader.trader.traderState; this.backGround.updateTravelButton(this.homeVillageButton, this.m_trader.trader.homeVillageID); this.backGround.updateTravelButton(this.targetVillageButton, this.m_trader.trader.targetVillageID); this.resourceImage.Visible = false; this.resourceAmountLabel.Visible = false; if (this.lastState == 0) { InterfaceMgr.Instance.closeTraderInfoPanel(); return; } if (((this.lastState == 1) || (this.lastState == 3)) || (this.lastState == 6)) { this.backGround.updatePanelText(SK.Text("SelectArmyPanel_Trading", "Trading")); if (GameEngine.Instance.World.isUserVillage(this.m_trader.trader.homeVillageID)) { this.resourceImage.Image = (Image)GFXLibrary.getCommodity32DSImage(this.m_trader.trader.resource); this.resourceImage.Visible = true; NumberFormatInfo nFI = GameEngine.NFI; this.resourceAmountLabel.TextDiffOnly = GameEngine.Instance.World.getTradingAmount(this.m_trader.traderID).ToString("N", nFI); this.resourceAmountLabel.Visible = true; } if (this.lastState == 6) { this.travelDirection.Image = (Image)GFXLibrary.mrhp_travelling_arrows[1]; } else { this.travelDirection.Image = (Image)GFXLibrary.mrhp_travelling_arrows[0]; } } else if ((this.lastState == 2) || (this.lastState == 4)) { this.backGround.updatePanelText(SK.Text("SelectArmyPanel_Returning", "Returning")); this.travelDirection.Image = (Image)GFXLibrary.mrhp_travelling_arrows[1]; } else if (this.lastState == 5) { this.backGround.updatePanelText(SK.Text("SelectArmyPanel_Collecting", "Collecting")); this.travelDirection.Image = (Image)GFXLibrary.mrhp_travelling_arrows[0]; } } double num2 = DXTimer.GetCurrentMilliseconds() / 1000.0; double num3 = this.m_trader.localEndTime - num2; if (num3 < 0.0) { num3 = 0.0; } string subHeading = VillageMap.createBuildTimeString((int)num3); this.backGround.updateSubHeading(subHeading); } }
public void init(string ipAddr, DateTime lastTime, TimeSpan duration) { this.lblIP.Text = ipAddr; this.lblLoginTime.Text = lastTime.ToShortTimeString() + " - " + lastTime.ToLongDateString(); if (duration != TimeSpan.MinValue) { this.lblDuration.Text = VillageMap.createBuildTimeString((int)duration.TotalSeconds); } else { this.lblDuration.Text = ""; } }
public void update() { this.cardbar.update(); this.onVillageLoadUpdate(this.m_ownVillage, false); this.numLabel.Text = this.numLabel.Text; double num = this.storedPreCardDistance * CardTypes.getScoutSpeed(GameEngine.Instance.World.UserCardData); if (((int)num) != this.timeLabel.CustomTooltipData) { string str = VillageMap.createBuildTimeString((int)num); this.timeLabel.Text = str; this.timeLabel.CustomTooltipID = 0x4e20; this.timeLabel.CustomTooltipData = (int)num; } }
public bool updateConstructionGFX(double localBaseTime, DateTime serverBaseTime, bool initialUpdate, VillageMap vm) { if (this.baseSprite != null) { if (this.serverDeleting) { double num = (DXTimer.GetCurrentMilliseconds() - localBaseTime) / 1000.0; num -= 1.5; DateTime time = serverBaseTime.AddSeconds(num); if (!this.complete && (time.CompareTo(this.completionTime) >= 0)) { this.complete = true; } TimeSpan span = (TimeSpan)(this.deletionTime - time); int secsLeft = (int)(span.TotalSeconds - 0.5); if (span.TotalDays > 10.0) { secsLeft = 0x98967f; } if ((secsLeft > 0) && (secsLeft < 0x989680)) { if (!vm.ViewOnly) { string text = VillageMap.createBuildTimeString(secsLeft); this.baseSprite.attachText(text, new Point(0, -50), ARGBColors.White, true, true); } } else { this.baseSprite.clearText(); this.baseSprite.clearSecondText(); if (secsLeft <= 0) { return(true); } } this.baseSprite.ColorToUse = Color.FromArgb(0xff, 0xff, 0x80, 0x80); if (this.animSprite != null) { this.animSprite.ColorToUse = this.baseSprite.ColorToUse; } if (this.extraAnimSprite1 != null) { this.extraAnimSprite1.ColorToUse = this.baseSprite.ColorToUse; } if (this.extraAnimSprite2 != null) { this.extraAnimSprite2.ColorToUse = this.baseSprite.ColorToUse; } return(false); } if (this.complete) { return(false); } bool flag = false; double num3 = (DXTimer.GetCurrentMilliseconds() - localBaseTime) / 1000.0; if (initialUpdate) { num3 = 0.0; } num3 -= 3.0; DateTime time2 = serverBaseTime.AddSeconds(num3); if (time2.CompareTo(this.completionTime) < 0) { flag = true; } if (this.buildingType == 0) { flag = false; } if (flag) { if (!this.highlighted) { this.baseSprite.ColorToUse = Color.FromArgb(0x80, 0x80, 0x80, 0x80); if (this.animSprite != null) { this.animSprite.ColorToUse = Color.FromArgb(0x80, 0x80, 0x80, 0x80); } if (this.extraAnimSprite1 != null) { this.extraAnimSprite1.ColorToUse = Color.FromArgb(0x80, 0x80, 0x80, 0x80); } if (this.extraAnimSprite2 != null) { this.extraAnimSprite2.ColorToUse = Color.FromArgb(0x80, 0x80, 0x80, 0x80); } } TimeSpan span2 = (TimeSpan)(this.completionTime - time2); int num4 = (int)(span2.TotalSeconds - 0.5); if ((num4 > 0) && (num4 < 0x989680)) { int num6; int num5 = num4; num4 = vm.updateConstructionDisplayTime(num4, this.completionTime, out num6); Color col = (num6 == 1) ? ARGBColors.White : ARGBColors.WhiteSmoke; if (!vm.ViewOnly) { string str2 = VillageMap.createBuildTimeString(num4); if ((num4 != num5) && this.showFullConstructionText) { this.showFullConstructionText = false; string str3 = str2; str2 = str3 + Environment.NewLine + "(" + VillageMap.createBuildTimeString(num5) + ")"; } this.baseSprite.attachText(str2, new Point(0, -40), ARGBColors.White, true, true); if (num6 > 0) { this.baseSprite.attachSecondText(num6.ToString(), new Point(0, -55), col, true, true); } else { this.baseSprite.clearSecondText(); } } } else { this.baseSprite.clearText(); this.baseSprite.clearSecondText(); } } else { Color white = ARGBColors.White; this.baseSprite.ColorToUse = white; if (this.animSprite != null) { this.animSprite.ColorToUse = white; } if (this.extraAnimSprite1 != null) { this.extraAnimSprite1.ColorToUse = white; } if (this.extraAnimSprite2 != null) { this.extraAnimSprite2.ColorToUse = white; } this.complete = true; if (!initialUpdate) { this.localComplete = false; return(true); } this.baseSprite.clearText(); this.baseSprite.clearSecondText(); } } return(false); }
public void update() { if (this.proclamationLabel.Visible) { TimeSpan span = (TimeSpan)(VillageMap.getCurrentServerTime() - this.lastProclamationTime); if (span.TotalDays >= 7.0) { this.proclamationLabel.Visible = false; this.proclamationButton.Enabled = true; } else { this.proclamationLabel.Text = SK.Text("Proclamations_time_to_go", "Time before next Proclamation : ") + VillageMap.createBuildTimeString(0x93a80 - ((int)span.TotalSeconds)); } } }
public void init(int secondsLeft, int secondsLeftToCancel, bool canCancel) { secondsLeft += 30; secondsLeftToCancel += 30; this.m_secondsLeft = secondsLeft; this.m_secondsLeftToCancel = secondsLeftToCancel; base.clearControls(); base.Controls.Clear(); this.BackColor = ARGBColors.White; this.HeaderTitle = new CustomSelfDrawPanel.CSDImage(); this.HeaderTitle.Image = this.HeaderImage; this.HeaderTitle.Position = new Point((base.Width - this.HeaderTitle.Width) / 2, 0x20); this.AddControlToPanel(this.HeaderTitle); this.expiresInLabel.Text = SK.Text("VACATION_Expires_In", "Vacation Mode Expires in") + " - " + VillageMap.createBuildTimeString(secondsLeft); this.expiresInLabel.Position = new Point(0, 120); this.expiresInLabel.Size = new Size(base.Width, 30); this.expiresInLabel.Color = ARGBColors.Black; this.expiresInLabel.Font = FontManager.GetFont("Arial", 12f, FontStyle.Regular); this.expiresInLabel.Alignment = CustomSelfDrawPanel.CSD_Text_Alignment.TOP_CENTER; this.AddControlToPanel(this.expiresInLabel); this.cancelButton.ImageNorm = this.CancelImage; this.cancelButton.ImageOver = this.CancelImageOver; this.cancelButton.Position = new Point(0x6b, 200); this.cancelButton.setClickDelegate(new CustomSelfDrawPanel.CSDControl.CSD_ClickDelegate(this.cancelClick)); this.cancelButton.Visible = false; this.AddControlToPanel(this.cancelButton); if (canCancel) { this.cancelButton.Visible = false; } else { this.cancelInLabel.Text = SK.Text("VACATION_Cancel_In", "You can cancel in") + " - " + VillageMap.createBuildTimeString(secondsLeftToCancel); this.cancelInLabel.Position = new Point(0, 200); this.cancelInLabel.Size = new Size(base.Width, 30); this.cancelInLabel.Color = ARGBColors.Black; this.cancelInLabel.Font = FontManager.GetFont("Arial", 12f, FontStyle.Regular); this.cancelInLabel.Alignment = CustomSelfDrawPanel.CSD_Text_Alignment.TOP_CENTER; this.cancelInLabel.Visible = true; this.AddControlToPanel(this.cancelInLabel); } CustomSelfDrawPanel.CSDButton c = new CustomSelfDrawPanel.CSDButton { ImageNorm = this.CloseImage, ImageOver = this.CloseImageOver, Position = new Point(400, 300) }; c.setClickDelegate(new CustomSelfDrawPanel.CSDControl.CSD_ClickDelegate(this.closeClick)); this.AddControlToPanel(c); base.Invalidate(); }
public void update() { TimeSpan span = (TimeSpan)(DateTime.Now - this.m_startTime); int secsLeft = this.m_secondsLeft - ((int)span.TotalSeconds); if (secsLeft < 0) { InterfaceMgr.Instance.closeVacationCancelPopupWindow(); } else { this.expiresInLabel.TextDiffOnly = SK.Text("VACATION_Expires_In", "Vacation Mode Expires in") + " - " + VillageMap.createBuildTimeString(secsLeft); } int num2 = this.m_secondsLeftToCancel - ((int)span.TotalSeconds); if (num2 < 0) { if (!this.cancelButton.Visible) { this.cancelButton.Visible = true; this.cancelInLabel.Visible = false; } } else { this.cancelInLabel.Text = SK.Text("VACATION_Cancel_In", "You can cancel in") + " - " + VillageMap.createBuildTimeString(num2); } }
public void update() { this.backGround.update(); this.m_reinforcements = GameEngine.Instance.World.getReinforcement(this.selectedReinforcementID); if (this.m_reinforcements != null) { if (this.m_reinforcements.dead) { this.m_reinforcements = null; InterfaceMgr.Instance.closeReinforcementSelectedPanel(); } else { if (this.m_reinforcements.attackType != this.lastState) { this.backGround.updateTravelButton(this.homeVillageButton, this.m_reinforcements.homeVillageID); this.backGround.updateTravelButton(this.targetVillageButton, this.m_reinforcements.targetVillageID); this.fromVillageID = this.m_reinforcements.homeVillageID; this.toVillageID = this.m_reinforcements.targetVillageID; this.lastState = this.m_reinforcements.attackType; if (this.lastState == 20) { this.travelDirection.Image = (Image)GFXLibrary.mrhp_travelling_arrows[0]; if (GameEngine.Instance.World.isUserVillage(this.m_reinforcements.homeVillageID)) { this.returnButton.Visible = true; } else { this.returnButton.Visible = false; } if (GameEngine.Instance.World.isUserVillage(this.m_reinforcements.homeVillageID)) { this.returnButton.Text.TextDiffOnly = SK.Text("SelectArmyPanel_Retrieve", "Retrieve"); } else { this.returnButton.Text.TextDiffOnly = SK.Text("SelectArmyPanel_Return", "Return"); } } else { this.travelDirection.Image = (Image)GFXLibrary.mrhp_travelling_arrows[1]; this.returnButton.Visible = false; } } double num = DXTimer.GetCurrentMilliseconds() / 1000.0; double num2 = this.m_reinforcements.localEndTime - num; if (num2 < 0.0) { this.backGround.updateSubHeading(""); } else { string subHeading = VillageMap.createBuildTimeString((int)num2); this.backGround.updateSubHeading(subHeading); } } } else { InterfaceMgr.Instance.closeReinforcementSelectedPanel(); } }
public void update() { this.backGround.update(); this.m_army = GameEngine.Instance.World.getArmy(this.selectedArmyID); if (this.m_army == null) { InterfaceMgr.Instance.closeArmySelectedPanel(); } else if (this.m_army.dead) { this.m_army = null; InterfaceMgr.Instance.closeArmySelectedPanel(); } else { double num = DXTimer.GetCurrentMilliseconds() / 1000.0; double num2 = this.m_army.localEndTime - num; if (num2 < 0.0) { num2 = 0.0; } string subHeading = VillageMap.createBuildTimeString((int)num2); if ((!GameEngine.Instance.World.isUserVillage(this.m_army.homeVillageID) || ((((this.m_army.localStartTime + (GameEngine.Instance.LocalWorldData.AttackCancelDuration * 60)) < num) && !this.m_army.isScouts()) && !this.targetIsAI(this.m_army.targetVillageID))) || ((this.m_army.lootType >= 0) || this.forceReturnOff)) { this.returnButton.Visible = false; } else { this.returnButton.Visible = true; } if (this.m_army.lootType != this.lastState) { bool flag = false; if ((this.m_army.attackType == 30) || (this.m_army.attackType == 0x1f)) { this.backGround.updateHeading(SK.Text("SelectArmyPanel_Troops", "Troops")); this.backGround.updatePanelType(0x3e8); } else if (this.m_army.attackType == 0x11) { this.backGround.updateHeading(SK.Text("GENERIC_Invasion", "Invasion")); this.backGround.updatePanelType(0x3e8); } else if (!this.m_army.isScouts()) { this.backGround.updateHeading(SK.Text("SelectArmyPanel_Army", "Army")); this.backGround.updatePanelType(0x3e8); } else { flag = true; this.backGround.updatePanelType(0x3ea); this.backGround.updateHeading(SK.Text("SelectArmyPanel_Scouts", "Scouts")); } this.lastState = this.m_army.lootType; if (this.lastState >= 0) { this.travelDirection.Image = (Image)GFXLibrary.mrhp_travelling_arrows[1]; this.backGround.updatePanelText(SK.Text("SelectArmyPanel_Returning", "Returning")); if (this.m_army.attackType != 13) { this.backGround.updateTravelButton(this.homeVillageButton, this.m_army.travelFromVillageID); } else { this.backGround.updateTravelButton(this.homeVillageButton, SK.Text("SelectArmyPanel_Tutorial", "Tutorial")); } this.backGround.updateTravelButton(this.targetVillageButton, this.m_army.targetVillageID); if (flag && (this.homeVillageButton.Text.Text.Length == 0)) { this.backGround.updateTravelButton(this.targetVillageButton, SK.Text("GENERIC_Unknown", "Unknown")); } this.fromVillageID = this.m_army.travelFromVillageID; this.toVillageID = this.m_army.targetVillageID; this.returnButton.Visible = false; } else { this.travelDirection.Image = (Image)GFXLibrary.mrhp_travelling_arrows[0]; if ((this.m_army.attackType == 30) || (this.m_army.attackType == 0x1f)) { this.backGround.updatePanelText(SK.Text("SelectArmyPanel_Stationing", "Stationing")); } else if (flag) { this.backGround.updatePanelText(SK.Text("SelectArmyPanel_Scouting", "Scouting")); } else if (!GameEngine.Instance.LocalWorldData.AIWorld || (this.m_army.attackType != 0x11)) { this.backGround.updatePanelText(SK.Text("GENERIC_Attacking", "Attacking")); } else { bool flag2 = false; int special = GameEngine.Instance.World.getVillageData(this.m_army.travelFromVillageID).special; int num4 = GameEngine.Instance.World.getVillageData(this.m_army.targetVillageID).special; if (special == 30) { switch (num4) { case 7: case 8: case 9: case 10: case 11: case 12: case 13: case 14: this.backGround.updatePanelText(SK.Text("BARRACKS_Reinforcing", "Reinforcing")); flag2 = true; break; } } if (!flag2) { this.backGround.updatePanelText(SK.Text("GENERIC_Attacking", "Attacking")); } } if (this.m_army.attackType != 13) { this.backGround.updateTravelButton(this.homeVillageButton, this.m_army.travelFromVillageID); } else { this.backGround.updateTravelButton(this.homeVillageButton, SK.Text("SelectArmyPanel_Tutorial", "Tutorial")); } this.backGround.updateTravelButton(this.targetVillageButton, this.m_army.targetVillageID); if (flag && (this.homeVillageButton.Text.Text.Length == 0)) { this.backGround.updateTravelButton(this.targetVillageButton, SK.Text("GENERIC_Unknown", "Unknown")); } this.fromVillageID = this.m_army.travelFromVillageID; this.toVillageID = this.m_army.targetVillageID; } } this.backGround.updateSubHeading(subHeading); } }
public void update() { this.backGround.update(); if (this.attackMode && (InterfaceMgr.Instance.SelectedVassalVillage < 0)) { this.backImage.Size = this.backImage.Image.Size; this.drawArea.Visible = true; this.backGround.updateHeading(GameEngine.Instance.World.getVillageName(this.m_selectedVillage)); } int[] numArray = new int[3]; TimeSpan[] spanArray = new TimeSpan[3]; int numInfos = this.numInfos; this.numInfos = 0; bool visible = this.lblProtectionType.Visible; int num2 = 0; TimeSpan span = new TimeSpan(); if (GameEngine.Instance.World.isVillageInterdictProtected(this.m_selectedVillage)) { DateTime time = GameEngine.Instance.World.getInterdictTime(this.m_selectedVillage); DateTime time2 = VillageMap.getCurrentServerTime(); span = (TimeSpan)(time - time2); num2 = 1; spanArray[this.numInfos] = span; numArray[this.numInfos] = num2; this.numInfos++; } if (GameEngine.Instance.World.isVillagePeaceTimeProtected(this.m_selectedVillage)) { DateTime time3 = GameEngine.Instance.World.getPeaceTime(this.m_selectedVillage); DateTime time4 = VillageMap.getCurrentServerTime(); TimeSpan span2 = (TimeSpan)(time3 - time4); if (span2 > span) { span = span2; num2 = 2; } spanArray[this.numInfos] = span2; numArray[this.numInfos] = 2; this.numInfos++; } if (GameEngine.Instance.World.isVillageVacationProtected(this.m_selectedVillage)) { num2 = 3; numArray[this.numInfos] = 3; this.numInfos++; } if (this.numInfos > 0) { if (this.selectedProtection < this.numInfos) { num2 = numArray[(this.numInfos - 1) - this.selectedProtection]; span = spanArray[(this.numInfos - 1) - this.selectedProtection]; } else { this.selectedProtection = 0; } } switch (num2) { case 1: { int totalSeconds = (int)span.TotalSeconds; string str = VillageMap.createBuildTimeString(totalSeconds); this.lblProtected.TextDiffOnly = SK.Text("OtherVillagePanel_Cannot_Be_Attacked_For_X_Time", "Cannot be attacked for") + " : " + str; this.lblProtectionType.TextDiffOnly = SK.Text("OtherVillagePanel_Interdict", "Interdict"); this.lblProtectionType.Visible = true; break; } case 2: { int secsLeft = (int)span.TotalSeconds; string str2 = VillageMap.createBuildTimeString(secsLeft); this.lblProtected.TextDiffOnly = SK.Text("OtherVillagePanel_Cannot_Be_Attacked_For_X_Time", "Cannot be attacked for") + " : " + str2; this.lblProtectionType.TextDiffOnly = SK.Text("OtherVillagePanel_Peace", "Peace"); this.lblProtectionType.Visible = true; break; } case 3: this.lblProtected.TextDiffOnly = SK.Text("OtherVillagePanel_Cannot_Be_Attacked", "Cannot be attacked"); this.lblProtectionType.TextDiffOnly = SK.Text("OtherVillagePanel_Vacation", "Vacation Mode"); this.lblProtectionType.Visible = true; break; default: this.lblProtected.TextDiffOnly = ""; this.lblProtectionType.TextDiffOnly = ""; this.lblProtectionType.Visible = false; break; } if (visible != this.lblProtectionType.Visible) { this.updateSize(); if (!visible) { this.selectedProtection = 0; } } if (numInfos != this.numInfos) { if (this.numInfos >= 2) { this.leftButton.Visible = true; this.rightButton.Visible = true; } else { this.leftButton.Visible = false; this.rightButton.Visible = false; } } }
private void updateTreasureCastleTimeout() { if (GameEngine.Instance.World.isSpecial(this.m_selectedVillage) && GameEngine.Instance.World.isAttackableSpecial(this.m_selectedVillage)) { TimeSpan span = (TimeSpan)(VillageMap.getCurrentServerTime() - GameEngine.Instance.World.getLastTreasureCastleAttackTime()); int num = WorldMap.TreasureCastle_AttackGap; if (span.TotalSeconds < num) { this.treasureCastleTimeoutLabel.TextDiffOnly = SK.Text("EmptyVillage_NextAttackAvailable", "Next Attack Available in") + " " + VillageMap.createBuildTimeString(num - ((int)span.TotalSeconds)); } else { this.treasureCastleTimeoutLabel.TextDiffOnly = ""; if (this.treasureCastleTimeoutLabel.Visible && !GameEngine.Instance.World.isCapital(InterfaceMgr.Instance.OwnSelectedVillage)) { this.attackButton.Enabled = true; } } } }
public void updateEmptyVillageText(int selectedVillage) { bool flag = false; bool flag2 = false; if (GameEngine.Instance.World.isSpecial(selectedVillage) && GameEngine.Instance.World.isAttackableSpecial(selectedVillage)) { bool flag3 = this.isTallTreasureChestPanel(selectedVillage); if (flag3 != this.wasTall) { this.init(selectedVillage); flag = true; } flag2 = flag3; } if (!flag && GameEngine.Instance.LocalWorldData.AIWorld) { bool flag4 = false; switch (GameEngine.Instance.World.getSpecial(selectedVillage)) { case 7: case 9: case 11: case 13: flag4 = true; break; default: flag4 = false; break; } if (flag4 != this.wasAiShort) { this.init(selectedVillage); } } NumberFormatInfo nFI = GameEngine.NFI; this.m_selectedVillage = selectedVillage; this.buyVillageButton.Enabled = true; this.attackButton_AI.Enabled = true; this.scoutButton_AI.Enabled = true; this.scoutButton_Resources.Enabled = true; this.treasureCastleTimeoutLabel.Visible = false; this.backGround_AI.Visible = false; this.backGround_Enemy.Visible = false; this.backGround_Resources.Visible = false; this.backGround_Charter.Visible = false; this.special = false; this.invasionLabel.Visible = false; this.backGround_AI.removeWikiLink(this.wikiLink); this.wikiLink = null; int type = GameEngine.Instance.World.getSpecial(selectedVillage); if (SpecialVillageTypes.IS_TREASURE_CASTLE(type)) { this.wikiLink = this.backGround_AI.addWikiLink(0x31); } else if ((type == 15) || (type == 0x11)) { this.wikiLink = this.backGround_AI.addWikiLink(50); } if (!GameEngine.Instance.World.isSpecial(selectedVillage)) { this.backGround_Charter.Visible = true; this.backGround_Charter.updateHeading(SK.Text("EmptyVillagePanel_Available_Village", "New Village Charter")); this.backGround_Charter.updatePanelTypeFromVillageID(selectedVillage); this.backGround_Charter.stretchBackground(); base.Parent.Invalidate(); double villageGoldCost = GameEngine.Instance.LocalWorldData.villageGoldCost; double num4 = GameEngine.Instance.World.calcVillageDistance(InterfaceMgr.Instance.getSelectedMenuVillage(), selectedVillage) * GameEngine.Instance.LocalWorldData.villageCostDistanceMultiplier; villageGoldCost *= num4 + 1.0; int numOwnedVillages = GameEngine.Instance.World.numVillagesOwned(); int num6 = (int)villageGoldCost; num6 *= numOwnedVillages; villageGoldCost = num6; this.goldLabel.Text = ((int)villageGoldCost).ToString("N", nFI); WorldData localWorldData = GameEngine.Instance.LocalWorldData; Point point = GameEngine.Instance.World.getVillageLocation(InterfaceMgr.Instance.OwnSelectedVillage); Point point2 = GameEngine.Instance.World.getVillageLocation(selectedVillage); double d = ((point.X - point2.X) * (point.X - point2.X)) + ((point.Y - point2.Y) * (point.Y - point2.Y)); d = Math.Sqrt(d) * ((localWorldData.CaptainsMoveSpeed * localWorldData.gamePlaySpeed) * ResearchData.CaptainTimes[GameEngine.Instance.World.UserResearchData.Research_Courtiers]); d *= CardTypes.getArmySpeed(GameEngine.Instance.World.UserCardData); string str = VillageMap.createBuildTimeString((int)d); this.travelTimeLabel.Text = str; this.travelTimeLabel.CustomTooltipID = 0x4e20; this.travelTimeLabel.CustomTooltipData = (int)d; int num8 = 0; if (GameEngine.Instance.LocalWorldData.Alternate_Ruleset != 1) { num8 = ResearchData.getVillageBuyHonourCost(numOwnedVillages); if (((num8 > 0) && GameEngine.Instance.World.FourthAgeWorld) && (numOwnedVillages < GameEngine.Instance.World.MostAge4Villages)) { num8 = 0; } } if (num8 > 0) { this.honourImage.Visible = true; this.honourLabel.Visible = true; this.honourLabel.Text = num8.ToString("N", nFI); } else { this.honourImage.Visible = false; this.honourLabel.Visible = false; } } else { this.special = true; if (GameEngine.Instance.World.isAttackableSpecial(selectedVillage)) { this.backGround_AI.Visible = true; this.backGround_AI.updateHeading(GameEngine.Instance.World.getVillageNameOrType(selectedVillage)); this.backGround_AI.updatePanelTypeFromVillageID(selectedVillage); if (SpecialVillageTypes.IS_TREASURE_CASTLE(type)) { if (GameEngine.Instance.World.isCapital(InterfaceMgr.Instance.OwnSelectedVillage)) { this.attackButton_AI.Enabled = false; } if (flag2) { this.updateTreasureCastleTimeout(); this.treasureCastleTimeoutLabel.Visible = true; this.attackButton_AI.Enabled = false; } } } else if ((type >= 100) && (type <= 0xc7)) { this.backGround_Resources.Visible = true; this.backGround_Resources.updateHeading(GameEngine.Instance.World.getVillageNameOrType(selectedVillage)); this.backGround_Resources.updatePanelTypeFromVillageID(selectedVillage); this.scoutButton_Resources.Enabled = false; } else { this.backGround_Enemy.Visible = true; if (type == 30) { switch (GameEngine.Instance.World.getAIInvasionMarkerState(selectedVillage)) { case 0: this.backGround_Enemy.updateHeading(SK.Text("Invasion_None", "No Invasion Sighted")); break; case 1: { this.backGround_Enemy.updateHeading(SK.Text("Invasion_Planned", "Invasion Sighted")); DateTime time = GameEngine.Instance.World.getNextAIInvasionDate(selectedVillage); if (time != DateTime.MinValue) { TimeSpan span = (TimeSpan)(time - VillageMap.getCurrentServerTime()); this.invasionLabel.Visible = true; this.invasionLabel.Text = VillageMap.createBuildTimeString((int)span.TotalSeconds); } break; } case 2: this.backGround_Enemy.updateHeading(SK.Text("Invasion_Inprogress", "Invasion In Progress")); break; } } else { this.backGround_Enemy.updateHeading(GameEngine.Instance.World.getVillageNameOrType(selectedVillage)); } this.backGround_Enemy.updatePanelTypeFromVillageID(selectedVillage); } if (!GameEngine.Instance.World.isScoutableSpecial(selectedVillage) || GameEngine.Instance.World.isCapital(InterfaceMgr.Instance.OwnSelectedVillage)) { this.scoutButton_AI.Enabled = false; this.scoutButton_Resources.Enabled = false; } else { this.scoutButton_AI.Enabled = true; this.scoutButton_Resources.Enabled = true; } } }
public void init(int villageID, bool reset) { NumberFormatInfo nFI; int scoutResourceCarryLevel; Color white = ARGBColors.White; Color black = ARGBColors.Black; Color color1 = ARGBColors.White; this.m_selectedVillage = villageID; this.m_ownVillage = InterfaceMgr.Instance.OwnSelectedVillage; base.clearControls(); int y = 0x27; this.mainBackgroundImage.Image = (Image)GFXLibrary.body_background_canvas; this.mainBackgroundImage.ClipRect = new Rectangle(new Point(), base.Size); this.mainBackgroundImage.Position = new Point(0, y); this.mainBackgroundImage.Size = new Size(base.Size.Width, base.Size.Height - y); this.mainBackgroundImage.Tile = true; base.addControl(this.mainBackgroundImage); this.backgroundBottomEdge.Image = (Image)GFXLibrary.popup_border_bottom; this.backgroundBottomEdge.Position = new Point(0, base.Height - 2); base.addControl(this.backgroundBottomEdge); this.backgroundRightEdge.Image = (Image)GFXLibrary.popup_border_rhs; this.backgroundRightEdge.Position = new Point(base.Width - 2, y); base.addControl(this.backgroundRightEdge); this.cardbar.Position = new Point(0, 4); this.mainBackgroundImage.addControl(this.cardbar); this.cardbar.init(7); this.gfxImage.Image = (Image)GFXLibrary.scout_screen_illustration_01; this.gfxImage.Position = new Point(20, 0x47); this.mainBackgroundImage.addControl(this.gfxImage); this.sliderImage.Position = new Point(0x2c, 0x11c); this.sliderImage.Margin = new Rectangle(0x20, 0x3f, 0x20, 0x19); this.sliderImage.Value = 0; this.sliderImage.Max = 0; this.sliderImage.setValueChangeDelegate(new CustomSelfDrawPanel.CSDControl.CSD_ValueChangedDelegate(this.tracksMoved)); this.mainBackgroundImage.addControl(this.sliderImage); this.sliderImage.Create((Image)GFXLibrary.scout_screen_slider, (Image)GFXLibrary.scout_screen_slider_bar, (Image)GFXLibrary.scout_screen_slider_bar, (Image)GFXLibrary.scout_screen_slider_bar, (Image)GFXLibrary.scout_screen_slider_bar, (Image)GFXLibrary.scout_screen_slider_bar); this.arrowImage.Image = (Image)GFXLibrary.scout_screen_arrowbox; this.arrowImage.Position = new Point(0xee, 0x11c); this.mainBackgroundImage.addControl(this.arrowImage); this.scoutingLabel.Text = SK.Text("ScoutPopup_Scouting_Target", "Scouting") + " '" + GameEngine.Instance.World.getVillageNameOrType(villageID) + "'"; this.scoutingLabel.Color = white; this.scoutingLabel.DropShadowColor = black; this.scoutingLabel.Position = new Point(0, 0xf3); this.scoutingLabel.Size = new Size(700, 30); this.scoutingLabel.Font = FontManager.GetFont("Arial", 16f, FontStyle.Regular); this.scoutingLabel.Alignment = CustomSelfDrawPanel.CSD_Text_Alignment.TOP_CENTER; this.mainBackgroundImage.addControl(this.scoutingLabel); if (AttackTargetsPanel.isFavourite(this.m_selectedVillage)) { this.targetVillageFavourite.ImageNorm = (Image)GFXLibrary.star_market_1; this.targetVillageFavourite.CustomTooltipID = 0x83b; } else { this.targetVillageFavourite.ImageNorm = (Image)GFXLibrary.star_market_3; this.targetVillageFavourite.CustomTooltipID = 0x7e2; } this.targetVillageFavourite.OverBrighten = true; this.targetVillageFavourite.Position = new Point(650, 0xf4); this.targetVillageFavourite.setClickDelegate(new CustomSelfDrawPanel.CSDControl.CSD_ClickDelegate(this.villageFavouriteClicked)); this.targetVillageFavourite.Data = 0; this.mainBackgroundImage.addControl(this.targetVillageFavourite); this.numLabel.Text = ""; this.numLabel.Color = white; this.numLabel.DropShadowColor = black; this.numLabel.Position = new Point(0x3f, 0x17); this.numLabel.Size = new Size(0x3b, 0x18); this.numLabel.Font = FontManager.GetFont("Arial", 18f, FontStyle.Regular); this.numLabel.Alignment = CustomSelfDrawPanel.CSD_Text_Alignment.CENTER_CENTER; this.sliderImage.addControl(this.numLabel); this.timeLabel.Text = "00:00:00"; this.timeLabel.Color = white; this.timeLabel.DropShadowColor = black; this.timeLabel.Position = new Point(-28, 0x17); this.timeLabel.Size = new Size(0xbf, 0x18); this.timeLabel.Font = FontManager.GetFont("Arial", 12f, FontStyle.Regular); this.timeLabel.Alignment = CustomSelfDrawPanel.CSD_Text_Alignment.CENTER_CENTER; this.arrowImage.addControl(this.timeLabel); int index = 0; int type = GameEngine.Instance.World.getSpecial(villageID); switch (type) { case 3: case 4: index = 0x18; break; case 5: case 6: index = 0x19; break; case 7: case 8: case 9: case 10: case 11: case 12: case 13: case 14: index = 0x1c; break; case 15: case 0x10: case 0x11: case 0x12: index = 0x35; break; case 40: case 0x29: case 0x2a: case 0x2b: case 0x2c: case 0x2d: case 0x2e: case 0x2f: case 0x30: case 0x31: case 50: index = 0x36; break; case 0x33: case 0x34: case 0x35: case 0x36: case 0x37: case 0x38: case 0x39: case 0x3a: case 0x3b: case 60: index = 0x37; break; case 0x3d: case 0x3e: case 0x3f: case 0x40: case 0x41: case 0x42: case 0x43: case 0x44: case 0x45: case 70: index = 0x38; break; case 0x47: case 0x48: case 0x49: case 0x4a: case 0x4b: case 0x4c: case 0x4d: case 0x4e: case 0x4f: case 80: index = 0x39; break; case 0x51: case 0x52: case 0x53: case 0x54: case 0x55: case 0x56: case 0x57: case 0x58: case 0x59: case 90: index = 0x3a; break; case 100: if (HolidayPeriods.xmas(VillageMap.getCurrentServerTime())) { index = 0x3b; } else { index = 0x1d; } break; case 0x6a: index = 30; break; case 0x6b: index = 0x1f; break; case 0x6c: index = 0x21; break; case 0x6d: index = 0x20; break; case 0x70: index = 0x22; break; case 0x71: index = 0x23; break; case 0x72: index = 0x24; break; case 0x73: index = 0x29; break; case 0x74: index = 0x25; break; case 0x75: index = 40; break; case 0x76: index = 0x2a; break; case 0x77: index = 0x2d; break; case 0x79: index = 0x2c; break; case 0x7a: index = 0x26; break; case 0x7b: index = 0x2b; break; case 0x7c: index = 0x2e; break; case 0x7d: index = 0x2f; break; case 0x7e: index = 0x30; break; case 0x80: index = 0x3d; break; case 0x81: index = 60; break; case 130: index = 0x3e; break; case 0x83: index = 0x3f; break; case 0x84: index = 0x40; break; case 0x85: index = 0x27; break; default: if (GameEngine.Instance.World.isRegionCapital(villageID)) { index = 0x31; } else if (GameEngine.Instance.World.isCountyCapital(villageID)) { index = 50; } else if (GameEngine.Instance.World.isProvinceCapital(villageID)) { index = 0x33; } else if (GameEngine.Instance.World.isCountryCapital(villageID)) { index = 0x34; } else { index = GameEngine.Instance.World.getVillageSize(villageID); } break; } switch (type) { case 0x6a: case 0x6b: case 0x6c: case 0x6d: case 0x70: case 0x71: case 0x72: case 0x73: case 0x74: case 0x75: case 0x76: case 0x77: case 0x79: case 0x7a: case 0x7b: case 0x7c: case 0x7d: case 0x7e: case 0x80: case 0x81: case 130: case 0x83: case 0x84: case 0x85: { WorldMap.SpecialVillageCache cache = GameEngine.Instance.World.getSpecialVillageData(villageID, false); if (cache == null) { goto Label_0B37; } nFI = GameEngine.NFI; CustomSelfDrawPanel.CSDLabel control = new CustomSelfDrawPanel.CSDLabel { Text = cache.resourceLevel.ToString("N", nFI), Position = new Point(0x9e, 0x55), Size = new Size(150, 20), Alignment = CustomSelfDrawPanel.CSD_Text_Alignment.CENTER_CENTER, Color = white, DropShadowColor = black, Font = FontManager.GetFont("Arial", 12f, FontStyle.Regular) }; this.arrowImage.addControl(control); scoutResourceCarryLevel = GameEngine.Instance.LocalWorldData.ScoutResourceCarryLevel; int num5 = GameEngine.Instance.World.UserResearchData.Research_Foraging; scoutResourceCarryLevel = (CardTypes.adjustForagingLevel(GameEngine.Instance.World.UserCardData, scoutResourceCarryLevel) * ResearchData.foragingResearch[num5]) / 2; switch (type) { case 0x77: case 0x79: case 0x7a: case 0x7b: case 0x7c: case 0x7d: case 0x7e: case 0x80: case 0x81: case 130: case 0x83: case 0x84: case 0x85: scoutResourceCarryLevel /= 10; goto Label_0A92; } break; } default: goto Label_0B37; } Label_0A92: this.m_carryLevel = scoutResourceCarryLevel; this.scoutCarryingLabel.Text = this.m_carryLevel.ToString("N", nFI); this.scoutCarryingLabel.Position = new Point(0, 90); this.scoutCarryingLabel.Size = new Size(this.sliderImage.Width, 20); this.scoutCarryingLabel.Alignment = CustomSelfDrawPanel.CSD_Text_Alignment.CENTER_CENTER; this.scoutCarryingLabel.Color = white; this.scoutCarryingLabel.DropShadowColor = black; this.scoutCarryingLabel.Font = FontManager.GetFont("Arial", 12f, FontStyle.Regular); this.sliderImage.addControl(this.scoutCarryingLabel); Label_0B37: this.targetImage.Image = (Image)GFXLibrary.scout_screen_icons[index]; this.targetImage.Position = new Point(0xb5, 5); this.arrowImage.addControl(this.targetImage); WorldData localWorldData = GameEngine.Instance.LocalWorldData; Point point = GameEngine.Instance.World.getVillageLocation(InterfaceMgr.Instance.OwnSelectedVillage); Point point2 = GameEngine.Instance.World.getVillageLocation(villageID); int x = point.X; int num7 = point.Y; int num8 = point2.X; int num9 = point2.Y; double d = ((x - num8) * (x - num8)) + ((num7 - num9) * (num7 - num9)); d = Math.Sqrt(d) * ((localWorldData.ScoutsMoveSpeed * localWorldData.gamePlaySpeed) * ResearchData.ScoutTimes[GameEngine.Instance.World.UserResearchData.Research_Horsemanship]); this.storedPreCardDistance = d; d *= CardTypes.getScoutSpeed(GameEngine.Instance.World.UserCardData); string str = VillageMap.createBuildTimeString((int)d); this.timeLabel.Text = str; this.timeLabel.CustomTooltipID = 0x4e20; this.timeLabel.CustomTooltipData = (int)d; this.launchButton.ImageNorm = (Image)GFXLibrary.button_with_inset_normal; this.launchButton.ImageOver = (Image)GFXLibrary.button_with_inset_over; this.launchButton.ImageClick = (Image)GFXLibrary.button_with_inset_pushed; this.launchButton.Position = new Point(520, 0x144); this.launchButton.Text.Text = SK.Text("ScoutPopup_Go", "Go"); this.launchButton.Text.Font = FontManager.GetFont("Arial", 16f, FontStyle.Regular); this.launchButton.TextYOffset = 1; this.launchButton.Text.Color = ARGBColors.Black; this.launchButton.setClickDelegate(new CustomSelfDrawPanel.CSDControl.CSD_ClickDelegate(this.launch), "ScoutPopupPanel_launch"); this.launchButton.Enabled = false; this.mainBackgroundImage.addControl(this.launchButton); this.scoutHonourLabel.Text = ""; this.scoutHonourLabel.Color = white; this.scoutHonourLabel.DropShadowColor = black; this.scoutHonourLabel.Position = new Point(0, 410); this.scoutHonourLabel.Size = new Size(700, 30); this.scoutHonourLabel.Font = FontManager.GetFont("Arial", 11f, FontStyle.Regular); this.scoutHonourLabel.Alignment = CustomSelfDrawPanel.CSD_Text_Alignment.TOP_CENTER; this.scoutHonourLabel.Visible = false; this.mainBackgroundImage.addControl(this.scoutHonourLabel); if ((type >= 100) && (type <= 0xc7)) { this.scoutHonourLabel.Text = SK.Text("ScoutPopup_No_Honour_Stash_Out_Of_Range", "No Honour will be received, the stash is out of range."); } else if (type == 5) { this.scoutHonourLabel.Text = SK.Text("ScoutPopup_No_Honour_Wolf_Lair_Out_Of_Range", "No Honour will be received, the Wolf Lair is out of range."); } else if (type == 3) { this.scoutHonourLabel.Text = SK.Text("ScoutPopup_No_Honour_Bandit_Camp_Out_Of_Range", "No Honour will be received, the Bandit Camp is out of range."); } else if (((type == 7) || (type == 9)) || ((type == 11) || (type == 13))) { this.scoutHonourLabel.Text = SK.Text("ScoutPopup_No_Honour_AI_castle_Out_Of_Range", "No Honour will be received, the AI Castle is out of range."); } else if (((type == 15) || (type == 0x11)) || SpecialVillageTypes.IS_TREASURE_CASTLE(type)) { this.scoutHonourLabel.Text = SK.Text("LaunchAttackPopup_Paladin_No_Honour", "No honour will be received for destroying this type of AI castle"); } else { this.scoutHonourLabel.Text = SK.Text("ScoutPopup_No_Honour_Village_Out_Of_Range", "No Honour will be received, the village is out of range."); } this.scoutHonourLabel.Visible = GameEngine.Instance.World.isScoutHonourOutOfRange(InterfaceMgr.Instance.OwnSelectedVillage, villageID) && ((type <= 100) || (type > 0xc7)); this.titleImage.Image = (Image)GFXLibrary.popup_title_bar; this.titleImage.Position = new Point(0, 0); base.addControl(this.titleImage); this.titleLabel.Text = SK.Text("OwnVillagePanel_Send_Out_Scouts", "Send Out Scouts"); this.titleLabel.Color = Color.FromArgb(0xff, 0xff, 0xff); this.titleLabel.DropShadowColor = black; this.titleLabel.Position = new Point(20, 5); this.titleLabel.Size = new Size(base.Width, 0x20); this.titleLabel.Font = FontManager.GetFont("Arial", 18f, FontStyle.Bold); this.titleLabel.Alignment = CustomSelfDrawPanel.CSD_Text_Alignment.TOP_LEFT; this.titleImage.addControl(this.titleLabel); this.closeButton.ImageNorm = (Image)GFXLibrary.int_button_close_normal; this.closeButton.ImageOver = (Image)GFXLibrary.int_button_close_over; this.closeButton.ImageClick = (Image)GFXLibrary.int_button_close_in; this.closeButton.Position = new Point(0x293, 5); this.closeButton.setClickDelegate(new CustomSelfDrawPanel.CSDControl.CSD_ClickDelegate(this.closeClick), "ScoutPopupPanel_close"); this.titleImage.addControl(this.closeButton); CustomSelfDrawPanel.WikiLinkControl.init(this.titleImage, 0x22, new Point(0x261, 5)); if (GameEngine.Instance.getVillage(this.m_ownVillage) != null) { this.onVillageLoadUpdate(this.m_ownVillage, true); } else { GameEngine.Instance.downloadCurrentVillage(); } }