internal void DrawTroop(Troop troop, bool playerControlling) { if (Session.Current.Scenario.ScenarioMap.TileWidth >= 50) { Color white = Color.White; this.DisplayOffset = Session.MainGame.mainGameScreen.GetPointByPosition(troop.Position); this.DisplayOffset = new Point(this.DisplayOffset.X, this.DisplayOffset.Y - 13); if (troop.BelongedFaction != null) { white = troop.BelongedFaction.FactionColor; } TheTroopKind = troop.TheMilitaryType; PersonID = troop.Leader.PictureIndex; //FactionID = troop.BelongedFaction.ID; UIKind = "Old"; if (Switch1 == "1") { UIKind = "New1"; } else if (Switch1 == "2") { UIKind = "New2"; } else if (Switch1 == "3") { //UIKind = "New1"; string path1 = @"Content\Textures\GameComponents\PersonPortrait\Images\Default\" + this.PersonID.ToString() + "t.jpg"; //string path2 = @"Content\Textures\GameComponents\PersonPortrait\Images\Player\" + this.PersonID.ToString() + "t.jpg"; //if (Platform.Current.FileExists(path1)) //{ UIKind = "New2"; //} //else if (Platform.Current.FileExists(path2)) //{ // UIKind = "New2"; //} } if (UIKind == "Old") { Rectangle?sourceRectangle = null; CacheManager.Draw(this.BackgroundTexture, new Rectangle(this.displayOffset.X, this.displayOffset.Y, this.BackgroundSize.X, this.BackgroundSize.Y), sourceRectangle, Color.White, 0f, Vector2.Zero, SpriteEffects.None, 0.47f); CacheManager.Draw(this.shiqicaotupian, new Rectangle(this.displayOffset.X + this.shiqicaoweizhi.X, this.displayOffset.Y + this.shiqicaoweizhi.Y, this.shiqicaoweizhi.Width, this.shiqicaoweizhi.Height), sourceRectangle, Color.White, 0f, Vector2.Zero, SpriteEffects.None, 0.469f); CacheManager.Draw(this.shiqitiaotupian, new Rectangle(this.displayOffset.X + this.shiqitiaoweizhi.X, this.displayOffset.Y + this.shiqitiaoweizhi.Y, shiqitiaokuandu(troop), this.shiqitiaoweizhi.Height), sourceRectangle, Color.White, 0f, Vector2.Zero, SpriteEffects.None, 0.469f); sourceRectangle = null; CacheManager.Draw(this.FactionTexture, new Rectangle(this.displayOffset.X + this.FactionPosition.X, this.displayOffset.Y + this.FactionPosition.Y, this.FactionPosition.Width, this.FactionPosition.Height), sourceRectangle, white, 0f, Vector2.Zero, SpriteEffects.None, 0.469f); this.NameText.Text = troop.Leader.Name; this.binglitext.Text = troop.Army.Quantity.ToString(); this.NameText.Draw(0.47f); this.binglitext.Draw(0.47f); sourceRectangle = null; //try //{ //CacheManager.Draw(troop.Leader.TroopPortrait, new Rectangle(this.displayOffset.X + this.PortraitPosition.X, this.displayOffset.Y + this.PortraitPosition.Y, this.PortraitPosition.Width, this.PortraitPosition.Height), null, Color.White, 0f, Vector2.Zero, SpriteEffects.None, 0.4687f); CacheManager.DrawZhsanAvatar(troop.Leader, "s", new Rectangle(this.displayOffset.X + this.PortraitPosition.X, this.displayOffset.Y + this.PortraitPosition.Y, this.PortraitPosition.Width, this.PortraitPosition.Height), Color.White, 0.4687f); //} //catch { } if (playerControlling && (Session.GlobalVariables.SkyEye || Session.Current.Scenario.IsCurrentPlayer(troop.BelongedFaction))) { if (!troop.ControlAvail()) { sourceRectangle = null; CacheManager.Draw(this.NoControlTexture, this.NoControlIconDisplayPosition, sourceRectangle, Color.White, 0f, Vector2.Zero, SpriteEffects.None, 0.4688f); } else { switch (troop.ControlState) { case TroopControlState.Undone: sourceRectangle = null; CacheManager.Draw(this.ActionUndoneTexture, this.ActionIconDisplayPosition, sourceRectangle, Color.White, 0f, Vector2.Zero, SpriteEffects.None, 0.4688f); break; case TroopControlState.Done: sourceRectangle = null; CacheManager.Draw(this.ActionDoneTexture, this.ActionIconDisplayPosition, sourceRectangle, Color.White, 0f, Vector2.Zero, SpriteEffects.None, 0.4688f); break; case TroopControlState.Auto: sourceRectangle = null; CacheManager.Draw(this.ActionAutoTexture, this.ActionIconDisplayPosition, sourceRectangle, Color.White, 0f, Vector2.Zero, SpriteEffects.None, 0.4688f); break; case TroopControlState.AutoDone: sourceRectangle = null; CacheManager.Draw(this.ActionAutoDoneTexture, this.ActionIconDisplayPosition, sourceRectangle, Color.White, 0f, Vector2.Zero, SpriteEffects.None, 0.4688f); break; } } if (troop.Food < troop.FoodCostPerDay) { sourceRectangle = null; CacheManager.Draw(this.FoodShortageTexture, this.FoodIconDisplayPosition, sourceRectangle, Color.White, 0f, Vector2.Zero, SpriteEffects.None, 0.4688f); } /* * else * { * sourceRectangle = null; * CacheManager.Draw(this.FoodNormalTexture, this.FoodIconDisplayPosition, sourceRectangle, Color.White, 0f, Vector2.Zero, SpriteEffects.None, 0.4688f); * } */ } if (troop.CurrentStunt != null) { CacheManager.Draw(this.StuntTexture, this.StuntIconDisplayPosition, null, Color.White, 0f, Vector2.Zero, SpriteEffects.None, 0.4688f); } } if (UIKind == "New1") { TheTroopKindPicture = PictureNull; if (TheTroopKind == 0) { TheTroopKindPicture = TheTroopKind11Picture; } else if (TheTroopKind == 1) { TheTroopKindPicture = TheTroopKind12Picture; } else if (TheTroopKind == 2) { TheTroopKindPicture = TheTroopKind13Picture; } else if (TheTroopKind == 3) { TheTroopKindPicture = TheTroopKind14Picture; } else if (TheTroopKind == 4) { TheTroopKindPicture = TheTroopKind15Picture; } try { CacheManager.Draw(this.TheMask11, this.TheBackgroundDisplayPosition, null, Color.White, 0f, Vector2.Zero, SpriteEffects.None, 0.461f); CacheManager.Draw(this.TheMask12, this.TheBackgroundDisplayPosition, null, Color.White, 0f, Vector2.Zero, SpriteEffects.None, 0.464f); CacheManager.Draw(this.TheMask13, this.TheBackgroundDisplayPosition, null, Color.White, 0f, Vector2.Zero, SpriteEffects.None, 0.466f); CacheManager.Draw(this.TheMask14, this.TheBackgroundDisplayPosition, null, Color.White, 0f, Vector2.Zero, SpriteEffects.None, 0.468f); CacheManager.Draw(this.TheBackground1, this.TheBackgroundDisplayPosition, null, Color.White, 0f, Vector2.Zero, SpriteEffects.None, 0.47f); } catch { } //try //{ //CacheManager.Draw(troop.Leader.TroopPortrait, this.ThePortraitDisplayPosition, null, Color.White, 0f, Vector2.Zero, SpriteEffects.None, 0.469f); CacheManager.DrawZhsanAvatar(troop.Leader, "s", this.ThePortraitDisplayPosition, Color.White, 0.469f); if (ShowFactionName1Background == "on") { CacheManager.Draw(this.FactionName1Background, this.FactionNameDisplayPosition, null, Color.White, 0f, Vector2.Zero, SpriteEffects.None, 0.462f); } CacheManager.Draw(this.FactionColor1Picture, this.FactionColorDisplayPosition, null, white, 0f, Vector2.Zero, SpriteEffects.None, 0.463f); CacheManager.Draw(this.FactionColor1Background, this.FactionColorDisplayPosition, null, Color.White, 0f, Vector2.Zero, SpriteEffects.None, 0.465f); //} //catch { } try { CacheManager.Draw(this.TheTroopKindPicture, this.TheTroopKindDisplayPosition, null, Color.White, 0f, Vector2.Zero, SpriteEffects.None, 0.465f); } catch { } try { CacheManager.Draw(this.Theshiqi1Texture, this.TheshiqiDisplayPosition(troop), this.TheshiqiPosition(troop), Color.White, 0f, Vector2.Zero, SpriteEffects.None, 0.467f); CacheManager.Draw(this.Thezhanyi1Texture, this.ThezhanyiDisplayPosition(troop), this.ThezhanyiPosition(troop), Color.White, 0f, Vector2.Zero, SpriteEffects.None, 0.467f); } catch { } if (playerControlling && (Session.GlobalVariables.SkyEye || Session.Current.Scenario.IsCurrentPlayer(troop.BelongedFaction))) { if (!troop.ControlAvail()) { CacheManager.Draw(this.TheNoControl1Texture, this.TheNoControlIconDisplayPosition, null, Color.White, 0f, Vector2.Zero, SpriteEffects.None, 0.465f); } else { switch (troop.ControlState) { case TroopControlState.Undone: CacheManager.Draw(this.TheActionUndone1Texture, this.TheActionIconDisplayPosition, null, Color.White, 0f, Vector2.Zero, SpriteEffects.None, 0.465f); break; case TroopControlState.Done: CacheManager.Draw(this.TheActionDone1Texture, this.TheActionIconDisplayPosition, null, Color.White, 0f, Vector2.Zero, SpriteEffects.None, 0.465f); break; case TroopControlState.Auto: CacheManager.Draw(this.TheActionAuto1Texture, this.TheActionIconDisplayPosition, null, Color.White, 0f, Vector2.Zero, SpriteEffects.None, 0.465f); break; case TroopControlState.AutoDone: CacheManager.Draw(this.TheActionAutoDone1Texture, this.TheActionIconDisplayPosition, null, Color.White, 0f, Vector2.Zero, SpriteEffects.None, 0.465f); break; } } if (troop.Food < troop.FoodCostPerDay) { CacheManager.Draw(this.TheFoodShortage1Texture, this.TheFoodIconDisplayPosition, null, Color.White, 0f, Vector2.Zero, SpriteEffects.None, 0.463f); } } if (troop.CurrentStunt != null) { CacheManager.Draw(this.TheStunt1Texture, this.TheStuntIconDisplayPosition, null, Color.White, 0f, Vector2.Zero, SpriteEffects.None, 0.463f); } if (FactionName1Kind == "1") { this.FactionName1Text.Text = troop.Leader.SurName; } else if (FactionName1Kind == "2") { this.FactionName1Text.Text = troop.Leader.BelongedFaction.Leader.SurName; } else if (FactionName1Kind == "3") { if (troop.Leader.BelongedFaction.Leader.Name == troop.Leader.BelongedFaction.Name) { this.FactionName1Text.Text = troop.Leader.BelongedFaction.Leader.SurName; } this.FactionName1Text.Text = troop.Leader.BelongedFaction.Name; } this.TroopName1Text.Text = troop.Leader.Name; this.Thebingli1Text.Text = troop.Army.Quantity.ToString(); this.FactionName1Text.Draw(0.462f); this.TroopName1Text.Draw(0.462f); this.Thebingli1Text.Draw(0.462f); } if (UIKind == "New2") { TheTroopKindPicture = PictureNull; if (TheTroopKind == 0) { TheTroopKindPicture = TheTroopKind21Picture; } else if (TheTroopKind == 1) { TheTroopKindPicture = TheTroopKind22Picture; } else if (TheTroopKind == 2) { TheTroopKindPicture = TheTroopKind23Picture; } else if (TheTroopKind == 3) { TheTroopKindPicture = TheTroopKind24Picture; } else if (TheTroopKind == 4) { TheTroopKindPicture = TheTroopKind25Picture; } //try //{ if (this.TheMask21 != null) { CacheManager.Draw(this.TheMask21, this.TheBackgroundDisplayPosition, null, Color.White, 0f, Vector2.Zero, SpriteEffects.None, 0.461f); } if (this.TheMask22 != null) { CacheManager.Draw(this.TheMask22, this.TheBackgroundDisplayPosition, null, Color.White, 0f, Vector2.Zero, SpriteEffects.None, 0.464f); } if (this.TheMask23 != null) { CacheManager.Draw(this.TheMask23, this.TheBackgroundDisplayPosition, null, Color.White, 0f, Vector2.Zero, SpriteEffects.None, 0.466f); } if (this.TheMask24 != null) { CacheManager.Draw(this.TheMask24, this.TheBackgroundDisplayPosition, null, Color.White, 0f, Vector2.Zero, SpriteEffects.None, 0.468f); } if (this.TheBackground2 != null) { CacheManager.Draw(this.TheBackground2, this.TheBackgroundDisplayPosition, null, Color.White, 0f, Vector2.Zero, SpriteEffects.None, 0.47f); } //} //catch { } //try //{ CacheManager.DrawZhsanAvatar(troop.Leader, "s", this.ThePortraitDisplayPosition, Color.White, 0.469f); //CacheManager.Draw(troop.Leader.TroopPortrait, this.ThePortraitDisplayPosition, null, Color.White, 0f, Vector2.Zero, SpriteEffects.None, 0.469f); if (ShowFactionName2Background == "on" && this.FactionName2Background != null) { CacheManager.Draw(this.FactionName2Background, this.FactionNameDisplayPosition, null, Color.White, 0f, Vector2.Zero, SpriteEffects.None, 0.462f); } if (this.FactionColor2Picture != null) { CacheManager.Draw(this.FactionColor2Picture, this.FactionColorDisplayPosition, null, white, 0f, Vector2.Zero, SpriteEffects.None, 0.463f); } if (this.FactionColor2Background != null) { CacheManager.Draw(this.FactionColor2Background, this.FactionColorDisplayPosition, null, Color.White, 0f, Vector2.Zero, SpriteEffects.None, 0.465f); } //} //catch { } //try //{ if (this.TheTroopKindPicture != null) { CacheManager.Draw(this.TheTroopKindPicture, this.TheTroopKindDisplayPosition, null, Color.White, 0f, Vector2.Zero, SpriteEffects.None, 0.465f); } //} //catch { } //try //{ if (this.Theshiqi2Texture != null) { CacheManager.Draw(this.Theshiqi2Texture, this.TheshiqiDisplayPosition(troop), this.TheshiqiPosition(troop), Color.White, 0f, Vector2.Zero, SpriteEffects.None, 0.467f); } if (this.Thezhanyi2Texture != null) { CacheManager.Draw(this.Thezhanyi2Texture, this.ThezhanyiDisplayPosition(troop), this.ThezhanyiPosition(troop), Color.White, 0f, Vector2.Zero, SpriteEffects.None, 0.467f); } //} //catch { } if (playerControlling && (Session.GlobalVariables.SkyEye || Session.Current.Scenario.IsCurrentPlayer(troop.BelongedFaction))) { if (!troop.ControlAvail()) { CacheManager.Draw(this.TheNoControl2Texture, this.TheNoControlIconDisplayPosition, null, Color.White, 0f, Vector2.Zero, SpriteEffects.None, 0.465f); } else { switch (troop.ControlState) { case TroopControlState.Undone: CacheManager.Draw(this.TheActionUndone2Texture, this.TheActionIconDisplayPosition, null, Color.White, 0f, Vector2.Zero, SpriteEffects.None, 0.465f); break; case TroopControlState.Done: CacheManager.Draw(this.TheActionDone2Texture, this.TheActionIconDisplayPosition, null, Color.White, 0f, Vector2.Zero, SpriteEffects.None, 0.465f); break; case TroopControlState.Auto: CacheManager.Draw(this.TheActionAuto2Texture, this.TheActionIconDisplayPosition, null, Color.White, 0f, Vector2.Zero, SpriteEffects.None, 0.465f); break; case TroopControlState.AutoDone: CacheManager.Draw(this.TheActionAutoDone2Texture, this.TheActionIconDisplayPosition, null, Color.White, 0f, Vector2.Zero, SpriteEffects.None, 0.465f); break; } } if (troop.Food < troop.FoodCostPerDay) { CacheManager.Draw(this.TheFoodShortage2Texture, this.TheFoodIconDisplayPosition, null, Color.White, 0f, Vector2.Zero, SpriteEffects.None, 0.463f); } } if (troop.CurrentStunt != null) { CacheManager.Draw(this.TheStunt2Texture, this.TheStuntIconDisplayPosition, null, Color.White, 0f, Vector2.Zero, SpriteEffects.None, 0.463f); } if (FactionName2Kind == "1") { this.FactionName2Text.Text = troop.Leader.SurName; } else if (FactionName2Kind == "2") { this.FactionName2Text.Text = troop.Leader.BelongedFaction.Leader.SurName; } else if (FactionName2Kind == "3") { if (troop.Leader.BelongedFaction.Leader.Name == troop.Leader.BelongedFaction.Name) { this.FactionName2Text.Text = troop.Leader.BelongedFaction.Leader.SurName; } this.FactionName2Text.Text = troop.Leader.BelongedFaction.Name; } this.TroopName2Text.Text = troop.Leader.Name; this.Thebingli2Text.Text = troop.Army.Quantity.ToString(); this.FactionName2Text.Draw(0.462f); this.TroopName2Text.Draw(0.462f); this.Thebingli2Text.Draw(0.462f); } } }
internal void DrawTroop(SpriteBatch spriteBatch, Troop troop, bool playerControlling) { if (troop.Scenario.ScenarioMap.TileWidth >= 50) { Color white = Color.White; this.DisplayOffset = troop.Scenario.GameScreen.GetPointByPosition(troop.Position); this.DisplayOffset = new Point(this.DisplayOffset.X, this.DisplayOffset.Y - 13); if (troop.BelongedFaction != null) { white = troop.BelongedFaction.FactionColor; } Rectangle?sourceRectangle = null; spriteBatch.Draw(this.BackgroundTexture, new Rectangle(this.displayOffset.X, this.displayOffset.Y, this.BackgroundSize.X, this.BackgroundSize.Y), sourceRectangle, Color.White, 0f, Vector2.Zero, SpriteEffects.None, 0.47f); spriteBatch.Draw(this.shiqicaotupian, new Rectangle(this.displayOffset.X + this.shiqicaoweizhi.X, this.displayOffset.Y + this.shiqicaoweizhi.Y, this.shiqicaoweizhi.Width, this.shiqicaoweizhi.Height), sourceRectangle, Color.White, 0f, Vector2.Zero, SpriteEffects.None, 0.469f); spriteBatch.Draw(this.shiqitiaotupian, new Rectangle(this.displayOffset.X + this.shiqitiaoweizhi.X, this.displayOffset.Y + this.shiqitiaoweizhi.Y, shiqitiaokuandu(troop), this.shiqitiaoweizhi.Height), sourceRectangle, Color.White, 0f, Vector2.Zero, SpriteEffects.None, 0.469f); sourceRectangle = null; spriteBatch.Draw(this.FactionTexture, new Rectangle(this.displayOffset.X + this.FactionPosition.X, this.displayOffset.Y + this.FactionPosition.Y, this.FactionPosition.Width, this.FactionPosition.Height), sourceRectangle, white, 0f, Vector2.Zero, SpriteEffects.None, 0.469f); this.NameText.Text = troop.Leader.Name; this.binglitext.Text = troop.Army.Quantity.ToString(); this.NameText.Draw(spriteBatch, 0.47f); this.binglitext.Draw(spriteBatch, 0.47f); sourceRectangle = null; try { spriteBatch.Draw(troop.Leader.SmallPortrait, new Rectangle(this.displayOffset.X + this.PortraitPosition.X, this.displayOffset.Y + this.PortraitPosition.Y, this.PortraitPosition.Width, this.PortraitPosition.Height), null, Color.White, 0f, Vector2.Zero, SpriteEffects.None, 0.4687f); } catch { } if (playerControlling && (GlobalVariables.SkyEye || troop.Scenario.IsCurrentPlayer(troop.BelongedFaction))) { if (!troop.ControlAvail()) { sourceRectangle = null; spriteBatch.Draw(this.NoControlTexture, this.NoControlIconDisplayPosition, sourceRectangle, Color.White, 0f, Vector2.Zero, SpriteEffects.None, 0.4688f); } else { switch (troop.ControlState) { case TroopControlState.Undone: sourceRectangle = null; spriteBatch.Draw(this.ActionUndoneTexture, this.ActionIconDisplayPosition, sourceRectangle, Color.White, 0f, Vector2.Zero, SpriteEffects.None, 0.4688f); break; case TroopControlState.Done: sourceRectangle = null; spriteBatch.Draw(this.ActionDoneTexture, this.ActionIconDisplayPosition, sourceRectangle, Color.White, 0f, Vector2.Zero, SpriteEffects.None, 0.4688f); break; case TroopControlState.Auto: sourceRectangle = null; spriteBatch.Draw(this.ActionAutoTexture, this.ActionIconDisplayPosition, sourceRectangle, Color.White, 0f, Vector2.Zero, SpriteEffects.None, 0.4688f); break; case TroopControlState.AutoDone: sourceRectangle = null; spriteBatch.Draw(this.ActionAutoDoneTexture, this.ActionIconDisplayPosition, sourceRectangle, Color.White, 0f, Vector2.Zero, SpriteEffects.None, 0.4688f); break; } } if (troop.Food < troop.FoodCostPerDay) { sourceRectangle = null; spriteBatch.Draw(this.FoodShortageTexture, this.FoodIconDisplayPosition, sourceRectangle, Color.White, 0f, Vector2.Zero, SpriteEffects.None, 0.4688f); } /* * else * { * sourceRectangle = null; * spriteBatch.Draw(this.FoodNormalTexture, this.FoodIconDisplayPosition, sourceRectangle, Color.White, 0f, Vector2.Zero, SpriteEffects.None, 0.4688f); * } */ } if (troop.CurrentStunt != null) { spriteBatch.Draw(this.StuntTexture, this.StuntIconDisplayPosition, null, Color.White, 0f, Vector2.Zero, SpriteEffects.None, 0.4688f); } } }