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 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); }