diff --git a/1.6/1.6/Assemblies/WulaFallenEmpire.dll b/1.6/1.6/Assemblies/WulaFallenEmpire.dll index d4ea2d28..3e60e2b2 100644 Binary files a/1.6/1.6/Assemblies/WulaFallenEmpire.dll and b/1.6/1.6/Assemblies/WulaFallenEmpire.dll differ diff --git a/1.6/1.6/Defs/BodyAndPartDefs/Bodyparts_WULA.xml b/1.6/1.6/Defs/BodyAndPartDefs/Bodyparts_WULA.xml index b093cf03..c89a4dd3 100644 --- a/1.6/1.6/Defs/BodyAndPartDefs/Bodyparts_WULA.xml +++ b/1.6/1.6/Defs/BodyAndPartDefs/Bodyparts_WULA.xml @@ -98,16 +98,6 @@
  • ManipulationLimbCore
  • - - WULA_Mobile_Bunker_Bodypart - - 250 - 0 - false - - 1 - 0 - WULA_Shield_Field_Maintainer_Bodypart diff --git a/1.6/1.6/Defs/FleshTypeDefs/FleshType_WULA.xml b/1.6/1.6/Defs/FleshTypeDefs/FleshType_WULA.xml index 80a0d4a3..d72ed9c6 100644 --- a/1.6/1.6/Defs/FleshTypeDefs/FleshType_WULA.xml +++ b/1.6/1.6/Defs/FleshTypeDefs/FleshType_WULA.xml @@ -94,4 +94,97 @@ --> + + Wula_Mechunit_Fleshtype + CorpsesMechanoid + Damage_HitMechanoid + false + +
  • + Things/Pawn/Wounds/WoundMechA +
  • +
  • + Things/Pawn/Wounds/WoundMechB +
  • +
  • + Things/Pawn/Wounds/WoundMechC +
  • +
    + +
  • + Wula/Things/WulaSpecies/Wounds/WULA_Species_Wound_None +
  • + +
    + +
    diff --git a/1.6/1.6/Defs/WulaMiscSettingDefs/LifeStageDefs/LifeStages_WULA.xml b/1.6/1.6/Defs/LifeStageDefs/LifeStages_WULA.xml similarity index 77% rename from 1.6/1.6/Defs/WulaMiscSettingDefs/LifeStageDefs/LifeStages_WULA.xml rename to 1.6/1.6/Defs/LifeStageDefs/LifeStages_WULA.xml index dee38215..11d7e2b8 100644 --- a/1.6/1.6/Defs/WulaMiscSettingDefs/LifeStageDefs/LifeStages_WULA.xml +++ b/1.6/1.6/Defs/LifeStageDefs/LifeStages_WULA.xml @@ -13,4 +13,10 @@ 1 + + Wula_Mechunit_LifeStage + + true + false + diff --git a/1.6/1.6/Defs/PawnKinds/PawnKinds_Wula.xml b/1.6/1.6/Defs/PawnKinds/PawnKinds_Wula.xml index 284d962c..d85a59d1 100644 --- a/1.6/1.6/Defs/PawnKinds/PawnKinds_Wula.xml +++ b/1.6/1.6/Defs/PawnKinds/PawnKinds_Wula.xml @@ -270,32 +270,6 @@ 0.7 - - WULA_Mobile_Bunker - - WULA_Mobile_Bunker - false - PlayerColony - false - 200 - - -
  • - - Wula/Things/WULA_Mobile_Bunker/Bodies/Naked_Thin - Wula/Things/WULA_Cat/AllegianceOverlays/None - CutoutWithOverlay - Graphic_Multi - 3.4 - - (1.4, 1.8, 1.4) - - -
  • -
    - - 0.7 -
    Wula_Mech_Mobile_Factory diff --git a/1.6/1.6/Defs/ThingDefs_Races/Races_Wulaspecies.xml b/1.6/1.6/Defs/ThingDefs_Races/Races_Wulaspecies.xml index 1e39552e..85cb6430 100644 --- a/1.6/1.6/Defs/ThingDefs_Races/Races_Wulaspecies.xml +++ b/1.6/1.6/Defs/ThingDefs_Races/Races_Wulaspecies.xml @@ -1099,133 +1099,6 @@ - - - WULA_Mobile_Bunker - - 四只猫猫在抬着地堡移动,虽然很难相信但是事实就是这样的。在地堡的射击窗里还有另外的两只乌拉猫猫,它们会操纵地堡的机枪向外射击。\n\n猫猫可以放下地堡,然后一股脑地钻进去,这会让地堡重新变为建筑。 - - - true - true - - - false - - - - 1 - 3 - 0.75 - 0.75 - 0.75 - - - - 5 - -
  • - MechanoidFullyFormed - 0 - Pawn_Wula_Mech_Mobile_Factory_Call -
  • -
    - 2 - Heavy -
    - -
  • - - -
  • Blunt
  • - - 360 - 8 - Torso - true - -
    - -
  • - 0 - WULA_Cat_Bunker_TurretGun - - -
  • - PawnRenderNode_TurretGun - PawnRenderNodeWorker_TurretGun - Body - (2, 2) - 20 - Any - - - -90 - (-1, 0, -1.45) - true - -5 - - - 90 - -5 - (3.25, 0, -1) - - - -90 - (1.5, 0, -1.45) - - - 90 - (-3.25, 0, -1) - - -
  • - - -
  • - 1 - WULA_Cat_Bunker_TurretGun - - -
  • - PawnRenderNode_TurretGun - PawnRenderNodeWorker_TurretGun - Body - (2, 2) - 20 - Any - - - -90 - (1, 0, -1.45) - -5 - - - -90 - (3.25, 0, -1) - - - -90 - (-1.6, 0, -1.45) - - - 90 - (-3.25, 0, -1) - -5 - - -
  • - - - -
  • - WULA_Cat_Bunker - 部署为乌拉猫猫地堡 - 乌拉猫猫们把地堡扔在地上然后钻进去,重新转变为建筑。每一次转变为建筑后,都会有24小时的冷却时间,在此期间不允许重新变为BUk-1"地堡猫猫"。 - Wula/UI/Commands/WULA_BunkerCat -
  • -
    -
    Wula_AI_Heavy_Panzer diff --git a/1.6/1.6/Defs/ThingDefs_Races/WULA_Mechunit_Race.xml b/1.6/1.6/Defs/ThingDefs_Races/WULA_Mechunit_Race.xml new file mode 100644 index 00000000..a935b9a5 --- /dev/null +++ b/1.6/1.6/Defs/ThingDefs_Races/WULA_Mechunit_Race.xml @@ -0,0 +1,454 @@ + + + + + WulaFallenEmpire.Wulamechunit + North + BulletImpact_Metal + Pawn + None + + 0 + -99999 + 99999 + 0 + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 1 + 1 + + + None + Wula_Mechunit_Fleshtype + ToolUser + true + false + false + NamerMech + true + +
  • + Wula_Mechunit_LifeStage + 0 + + + + +
  • +
    +
    + +
  • + + +
  • Blunt
  • +
  • Poke
  • + + 8 + 2 + Legs + 0.1 + +
    + + +
  • WulaFallenEmpire.ITab_MechSkills
  • +
  • ITab_Pawn_Health
  • +
  • ITab_Pawn_Needs
  • +
  • ITab_Pawn_Gear
  • +
  • ITab_Pawn_Log
  • +
    +
    + + + Wula_AI_Heavy_Panzer + + + Wula/Things/Wula_AI_Heavy_Panzer/Wula_AI_Heavy_Panzer_Icon + + + +
  • Wula_AI_Heavy_Panzer_Main_Weapon
  • +
    + true + true +
    + + false + +
    + + 1 + 2 + 2 + 0 + + 9999 + 0 + + 1 + 1 + 2 + + + 300 + 18 + 2 + + + WULA_AI_Heavy_Panzer_Body + 20 + +
  • + MechanoidFullyFormed + 0 + Pawn_Wula_AI_Heavy_Panzer_Call +
  • +
    + 10 + + 1 + Heavy + +
    + +
  • + + +
  • Blunt
  • + + 360 + 8 + Torso + true + +
    + +
  • + 0 + Wula_AI_Heavy_Panzer_Turret_Weapon + + +
  • + PawnRenderNode_TurretGun + PawnRenderNodeWorker_TurretGun + Body + (7, 7) + 20 + Any + + + -90 + + + -90 + + + -90 + + + 90 + + +
  • + + +
  • + 36000 + 5.2 + 5.4 + 0.02 + 4.0 + false +
  • + +
  • + + + Drafted + + + WULA_Hover_FlyNorth + WULA_Hover_FlyEast + WULA_Hover_FlySouth +
  • +
  • + 1.5 + 30 + Crush + 3 + false + false + false + true + false + false + false + 碾压伤害 + HAp-6"战车"可以将舰身稍微下沉一些并创造低压区,以碾压靠近的敌军——这同时会使得它伤害附近所有的散落物品。 + Wula/UI/Commands/Wula_Mech_Mobile_Factory_AreaDamage +
  • +
    +
    + + Wula_Basic_Panzer + + 乌拉帝国的中型战争机械,以悬浮的方式穿梭于战场之上,使用破坏力巨大的自动炮和车体臼炮打击敌方,是乌拉帝国前锋部队的中流砥柱。 + + 3.25 + 17500 + 0.35 + 1.25 + 1.25 + 1.5 + + + + 2 + + + DD_Race_DHM69_Scythe_Body + DD_Battle_Mech_With_3_Pilot + 10 + 5 + + + 500 + 300 + 12 + + +
  • + 3 + MechPilot + + 0.1 + + DivineDiurganate/UI/Commands/DD_Enter_Mech + DivineDiurganate/UI/Commands/DD_Exit_Mech +
  • +
  • + Chemfuel + 70 + 35 + + 1 + 240 + + (0.6, 0.5, 0.4) + + true + 1 + + true +
  • +
  • + true + 1 + + 10 + + + ConstructMetal +
  • +
  • + DD_DHM70_Rampart_Mech_Weapon +
  • +
  • + true + false + + 1.0 + true + false + 3 + + +
  • + DD_Ratkin_Pilot + 1 + false +
  • + + +
  • + 0 + 1 +
  • + +
  • + DD_Mote_MechBlackSmoke + 30 + 20 + 1.5 + 10 + 0.25 + (0.85,0,2.25) +
  • +
  • + DD_Mote_MechBlackSmoke + 30 + 20 + 1.5 + 10 + 0.25 + (-0.85,0,2.25) +
  • + +
  • + DD_DHM70_Rampart_Mech_Moving_Sound +
  • + +
  • + 0.1 + 120~180 + true + + + 11.5 + Flame + 5 + 2 + 0.25 + true + true + true + 1 + + + + Explosion_Bomb + + + true + true + 0 +
  • + +
  • + 0 + DD_DHM69_Scythe_MG_Turret + +
  • + PawnRenderNode_TurretGun + PawnRenderNodeWorker_TurretGun + Body + (2, 2) + 20 + Any +
  • + + +
  • + 1 + DD_DHM69_Scythe_MG_Turret + +
  • + PawnRenderNode_TurretGun + PawnRenderNodeWorker_TurretGun + Body + (2, 2) + 20 + Any +
  • + + +
  • + 2 + DD_DHM69_Scythe_MG_Turret + +
  • + PawnRenderNode_TurretGun + PawnRenderNodeWorker_TurretGun + Body + (2, 2) + 20 + Any +
  • + + + +
  • + + false + + + + + 1 + false + + + + +
  • + DD_DHM70_Rampart_Mech_Prototype + +
  • DD_MechPrototype
  • + + 1.0 + false + + + +
    +
    + + DD_DHM70_Rampart_Mech + + DD_DHM70_Rampart_Mech + PlayerColony + false + false + false + 800 + +
  • DD_DHM70_Rampart_Mech_Weapon
  • +
    + 99999~99999 + +
  • + + DivineDiurganate/Things/DD_DHM70_Rampart/Naked_Thin + 6.5 + + (2 ,2, 0.8) + (0,0,-0.15) + + +
  • +
    +
    + + DD_DHM70_Rampart_Mech_Prototype + + DD_DHM70_Rampart_Mech + PlayerColony + false + false + false + 900 + +
  • DD_DHM70_Rampart_Mech_Weapon
  • +
    + 99999~99999 + +
  • + + DivineDiurganate/Things/DD_DHM70_Rampart/Prototype + 6.5 + + (2 ,2, 0.8) + (0,0,-0.15) + + +
  • +
    +
    +
    \ No newline at end of file diff --git a/Source/WulaFallenEmpire/HediffComp/HediffCompProperties_DisappearWithEffect.cs b/Source/WulaFallenEmpire/HediffComp/WULA_DisappearWithEffect/HediffCompProperties_DisappearWithEffect.cs similarity index 100% rename from Source/WulaFallenEmpire/HediffComp/HediffCompProperties_DisappearWithEffect.cs rename to Source/WulaFallenEmpire/HediffComp/WULA_DisappearWithEffect/HediffCompProperties_DisappearWithEffect.cs diff --git a/Source/WulaFallenEmpire/HediffComp/HediffCompProperties_GiveHediffsInRangeToRace.cs b/Source/WulaFallenEmpire/HediffComp/WULA_GiveHediffsInRangeToRace/HediffCompProperties_GiveHediffsInRangeToRace.cs similarity index 100% rename from Source/WulaFallenEmpire/HediffComp/HediffCompProperties_GiveHediffsInRangeToRace.cs rename to Source/WulaFallenEmpire/HediffComp/WULA_GiveHediffsInRangeToRace/HediffCompProperties_GiveHediffsInRangeToRace.cs diff --git a/Source/WulaFallenEmpire/HediffComp/HediffComp_GiveHediffsInRangeToRace.cs b/Source/WulaFallenEmpire/HediffComp/WULA_GiveHediffsInRangeToRace/HediffComp_GiveHediffsInRangeToRace.cs similarity index 100% rename from Source/WulaFallenEmpire/HediffComp/HediffComp_GiveHediffsInRangeToRace.cs rename to Source/WulaFallenEmpire/HediffComp/WULA_GiveHediffsInRangeToRace/HediffComp_GiveHediffsInRangeToRace.cs diff --git a/Source/WulaFallenEmpire/HediffComp/HediffCompProperties_NanoRepair.cs b/Source/WulaFallenEmpire/HediffComp/WULA_NanoRepair/HediffCompProperties_NanoRepair.cs similarity index 100% rename from Source/WulaFallenEmpire/HediffComp/HediffCompProperties_NanoRepair.cs rename to Source/WulaFallenEmpire/HediffComp/WULA_NanoRepair/HediffCompProperties_NanoRepair.cs diff --git a/Source/WulaFallenEmpire/HediffComp/HediffComp_RegenerateBackstory.cs b/Source/WulaFallenEmpire/HediffComp/WULA_RegenerateBackstory/HediffComp_RegenerateBackstory.cs similarity index 100% rename from Source/WulaFallenEmpire/HediffComp/HediffComp_RegenerateBackstory.cs rename to Source/WulaFallenEmpire/HediffComp/WULA_RegenerateBackstory/HediffComp_RegenerateBackstory.cs diff --git a/Source/WulaFallenEmpire/HediffComp/HediffCompProperties_SwitchableHediff.cs b/Source/WulaFallenEmpire/HediffComp/WULA_SwitchableHediff/HediffCompProperties_SwitchableHediff.cs similarity index 100% rename from Source/WulaFallenEmpire/HediffComp/HediffCompProperties_SwitchableHediff.cs rename to Source/WulaFallenEmpire/HediffComp/WULA_SwitchableHediff/HediffCompProperties_SwitchableHediff.cs diff --git a/Source/WulaFallenEmpire/HediffComp/HediffComp_TimedExplosion.cs b/Source/WulaFallenEmpire/HediffComp/WULA_TimedExplosion/HediffComp_TimedExplosion.cs similarity index 100% rename from Source/WulaFallenEmpire/HediffComp/HediffComp_TimedExplosion.cs rename to Source/WulaFallenEmpire/HediffComp/WULA_TimedExplosion/HediffComp_TimedExplosion.cs diff --git a/Source/WulaFallenEmpire/ITab/ITab_MechSkills.cs b/Source/WulaFallenEmpire/ITab/ITab_MechSkills.cs new file mode 100644 index 00000000..e495e336 --- /dev/null +++ b/Source/WulaFallenEmpire/ITab/ITab_MechSkills.cs @@ -0,0 +1,443 @@ +// File: ITab_MechSkills.cs +using RimWorld; +using System.Collections.Generic; +using UnityEngine; +using Verse; + +namespace WulaFallenEmpire +{ + /// + /// 专业版:使用网格系统布局 + /// + public class ITab_MechSkills : ITab + { + private Vector2 scrollPosition = Vector2.zero; + private string nameBuffer = ""; + private bool isRenaming = false; + + // 网格系统参数 + private const float GridSize = 8f; + private const float HeaderRows = 4; // 头部占4行 + private const float PilotRows = 4; // 驾驶员信息占3行 + private const float TitleRows = 2; // 技能标题占1行 + private const float SkillRows = 18; // 技能区域占20行 + + public ITab_MechSkills() + { + this.size = new Vector2(520f, 600f); + this.labelKey = "DD_MechSkills".Translate(); + } + + protected override void FillTab() + { + var pawn = SelPawn; + if (pawn == null) + return; + + if (pawn.TryGetComp() == null) + { + DrawError("DD_NoMechSkillComps".Translate()); + return; + } + + DrawGridLayout(pawn); + } + + private void DrawGridLayout(Pawn pawn) + { + // 创建网格 + float rowHeight = size.y / (HeaderRows + PilotRows + TitleRows + SkillRows); + + // 1. 头部区域 + Rect headerRect = new Rect(0, 0, size.x, rowHeight * HeaderRows); + DrawGridHeader(headerRect, pawn, rowHeight); + + // 2. 驾驶员区域 + float curY = headerRect.yMax; + var pilotComp = pawn.TryGetComp(); + + if (pilotComp != null) + { + Rect pilotRect = new Rect(0, curY, size.x, rowHeight * PilotRows); + DrawGridPilot(pilotRect, pilotComp, rowHeight); + curY = pilotRect.yMax; + } + else + { + curY += rowHeight; // 空一行 + } + + // 3. 技能区域 + Rect skillsRect = new Rect(0, curY, size.x, size.y - curY); + DrawGridSkills(skillsRect, pawn, rowHeight); + } + private void DrawGridHeader(Rect rect, Pawn pawn, float rowHeight) + { + Widgets.DrawMenuSection(rect); + + // 使用网格定位 + float padding = rowHeight * 0.5f; + + if (isRenaming) + { + DrawRenameMode(rect, pawn, rowHeight, padding); + } + else + { + DrawNormalMode(rect, pawn, rowHeight, padding); + } + + // 状态行(第3-4行)- 始终显示 + DrawStatusLine(rect, pawn, rowHeight, padding); + + Text.Anchor = TextAnchor.UpperLeft; + } + private void DrawRenameMode(Rect rect, Pawn pawn, float rowHeight, float padding) + { + Text.Font = GameFont.Medium; + Text.Anchor = TextAnchor.MiddleLeft; + + // 计算输入框和按钮的总宽度 + float totalWidth = rect.width - padding * 2; + float buttonWidth = 85f; // 每个按钮85像素 + float spacing = 10f; // 按钮间距 + + // 计算可用宽度(减去按钮宽度) + float availableWidth = totalWidth - (buttonWidth * 2 + spacing); + + // 输入框 + Rect inputRect = new Rect( + padding, + padding, + availableWidth, + rowHeight * 1.5f + ); + + nameBuffer = nameBuffer ?? pawn.Name?.ToStringShort ?? pawn.LabelShort; + nameBuffer = Widgets.TextField(inputRect, nameBuffer); + + // 确认按钮 + Rect confirmRect = new Rect( + inputRect.xMax + spacing, + inputRect.y, + buttonWidth, + inputRect.height + ); + + // 取消按钮 + Rect cancelRect = new Rect( + confirmRect.xMax + spacing, + inputRect.y, + buttonWidth, + inputRect.height + ); + + // 绘制按钮 + if (Widgets.ButtonText(confirmRect, "OK".Translate())) + { + if (pawn != null && !string.IsNullOrEmpty(nameBuffer)) + { + pawn.Name = new NameSingle(nameBuffer, false); + isRenaming = false; + } + } + + if (Widgets.ButtonText(cancelRect, "Cancel".Translate())) + { + isRenaming = false; + } + + // 添加回车键支持 + if (Event.current.type == EventType.KeyDown && Event.current.keyCode == KeyCode.Return) + { + if (pawn != null && !string.IsNullOrEmpty(nameBuffer)) + { + pawn.Name = new NameSingle(nameBuffer, false); + isRenaming = false; + Event.current.Use(); + } + } + + if (Event.current.type == EventType.KeyDown && Event.current.keyCode == KeyCode.Escape) + { + isRenaming = false; + Event.current.Use(); + } + } + private void DrawNormalMode(Rect rect, Pawn pawn, float rowHeight, float padding) + { + Text.Font = GameFont.Medium; + Text.Anchor = TextAnchor.MiddleLeft; + + // 名称行(第1-2行) + Rect nameRect = new Rect( + padding, + padding, + rect.width * 0.5f - padding * 2, + rowHeight * 1.5f + ); + + Widgets.Label(nameRect, pawn.Name?.ToStringShort ?? pawn.LabelShort); + + // 重命名按钮(右对齐) + if (pawn.Faction?.IsPlayer == true) + { + // 计算按钮宽度 + float renameButtonWidth = 100f; + + Rect renameRect = new Rect( + rect.width - padding - renameButtonWidth, + padding, + renameButtonWidth, + rowHeight * 1.5f + ); + + if (Widgets.ButtonText(renameRect, "Rename".Translate())) + { + isRenaming = true; + nameBuffer = pawn.Name?.ToStringShort ?? pawn.LabelShort; + } + } + } + private void DrawStatusLine(Rect rect, Pawn pawn, float rowHeight, float padding) + { + Text.Font = GameFont.Small; + GUI.color = new Color(0.8f, 0.8f, 0.8f); + + // 状态行的y坐标取决于是否在重命名模式 + float statusY; + if (isRenaming) + { + // 重命名模式下,状态行在输入框下方 + statusY = padding + rowHeight * 1.5f + padding * 0.5f; + } + else + { + // 正常模式下,状态行在名称标签下方 + statusY = padding + rowHeight * 1.5f + padding * 0.5f; + } + + // 确保状态行不会超出头部区域 + Rect statusRect = new Rect( + padding, + statusY, + rect.width - padding * 2, + rowHeight * 1.5f + ); + + string status = GetStatus(pawn); + string type = "DD_Mech".Translate(); + Widgets.Label(statusRect, $"{type} | {status}"); + + GUI.color = Color.white; + } + + private void DrawGridPilot(Rect rect, CompMechPilotHolder pilotComp, float rowHeight) + { + float padding = rowHeight * 0.5f; + + Widgets.DrawBox(rect); + Widgets.DrawBoxSolid(rect, new Color(0.15f, 0.15f, 0.15f, 0.3f)); + + // 标题 + Rect titleRect = new Rect( + padding, + rect.y + padding, + rect.width - padding * 2, + rowHeight + 5f + ); + + Text.Font = GameFont.Medium; + Widgets.Label(titleRect, "DD_PilotTitle".Translate()); + Text.Font = GameFont.Small; + + // 内容 + Rect contentRect = new Rect( + padding, + titleRect.yMax + padding * 0.5f, + rect.width - padding * 2, + rowHeight * 1.5f + ); + + if (pilotComp.HasPilots) + { + var pilots = pilotComp.GetPilots(); + List pilotNames = new List(); + foreach (var pilot in pilots) + { + if (pilot != null) pilotNames.Add(pilot.LabelShort); + } + var pilotNamelist = string.Join(", ", pilotNames); + Widgets.Label(contentRect, $"DD_PilotInfo".Translate(pilotNamelist)); + } + else + { + GUI.color = Color.gray; + Widgets.Label(contentRect, "DD_NoPilotShort".Translate()); + GUI.color = Color.white; + } + } + + private void DrawGridSkills(Rect rect, Pawn pawn, float rowHeight) + { + Widgets.DrawMenuSection(rect); + + float padding = rowHeight * 0.5f; + + // 标题 + Rect titleRect = new Rect( + padding, + rect.y + padding, + rect.width - padding * 2, + rowHeight + 5f + ); + + Text.Font = GameFont.Medium; + Widgets.Label(titleRect, "Skills".Translate()); + Text.Font = GameFont.Small; + + // 技能列表区域 + Rect skillsArea = new Rect( + 0, + titleRect.yMax + padding, + rect.width, + rect.height - (titleRect.yMax - rect.y) - padding + ); + + if (pawn.skills == null || pawn.skills.skills.Count == 0) + { + GUI.color = Color.gray; + Widgets.Label(skillsArea.ContractedBy(padding * 2), "DD_MechNoSkill".Translate()); + GUI.color = Color.white; + return; + } + + // 滚动区域 + float skillHeight = rowHeight * 1.2f; + float viewHeight = pawn.skills.skills.Count * skillHeight + padding * 2; + + Rect viewRect = new Rect(0, 0, skillsArea.width - 16f, viewHeight); + Widgets.BeginScrollView(skillsArea, ref scrollPosition, viewRect); + + float curY = 0; + foreach (var skill in pawn.skills.skills) + { + if (skill == null || skill.TotallyDisabled) + continue; + + Rect skillRect = new Rect( + padding, + curY, + viewRect.width - padding * 2, + skillHeight + ); + + DrawGridSkill(skillRect, skill, rowHeight); + curY += skillHeight + padding * 0.3f; + } + + Widgets.EndScrollView(); + } + + private void DrawGridSkill(Rect rect, SkillRecord skill, float rowHeight) + { + // 背景 + if (Mouse.IsOver(rect)) + { + Widgets.DrawHighlight(rect); + } + + // 布局:名称 | 进度条 | 等级 + float nameWidth = rect.width * 0.35f; + float barWidth = rect.width * 0.45f; + float levelWidth = rect.width * 0.2f; + + // 名称 + Rect nameRect = new Rect(rect.x, rect.y, nameWidth, rect.height); + Text.Anchor = TextAnchor.MiddleLeft; + Widgets.Label(nameRect, skill.def.LabelCap); + + // 进度条 + Rect barRect = new Rect( + nameRect.xMax + rowHeight * 0.5f, + rect.y + (rect.height - 12f) / 2f, + barWidth - rowHeight, + 12f + ); + Widgets.FillableBar(barRect, skill.Level / 20f); + + // 等级 + Rect levelRect = new Rect(barRect.xMax + rowHeight * 0.5f, rect.y, levelWidth, rect.height); + Text.Anchor = TextAnchor.MiddleRight; + Widgets.Label(levelRect, $"Lv.{skill.Level}"); + + Text.Anchor = TextAnchor.UpperLeft; + + // 工具提示 + if (Mouse.IsOver(rect)) + { + TooltipHandler.TipRegion(rect, + $"{skill.def.LabelCap}\n" + + $"{skill.def.description}"); + } + } + + private void DrawRenameButtons(Rect rect) + { + float buttonWidth = rect.width / 2 - 2.5f; + + Rect confirmRect = new Rect(rect.x, rect.y, buttonWidth, rect.height); + if (Widgets.ButtonText(confirmRect, "OK".Translate())) + { + var pawn = SelPawn; + if (pawn != null && !string.IsNullOrEmpty(nameBuffer)) + { + pawn.Name = new NameSingle(nameBuffer, false); + isRenaming = false; + } + } + + Rect cancelRect = new Rect(confirmRect.xMax + 5f, rect.y, buttonWidth, rect.height); + if (Widgets.ButtonText(cancelRect, "Cancel".Translate())) + { + isRenaming = false; + } + } + + private string GetStatus(Pawn pawn) + { + if (pawn.Downed) return "Downed".Translate(); + if (pawn.Dead) return "Dead".Translate(); + if (pawn.Drafted) return "CommandDraftLabel".Translate(); + + var pilotComp = pawn.TryGetComp(); + if (pilotComp == null || !pilotComp.HasPilots) + return "DD_NoPilot".Translate(); + + return "DD_Operational".Translate(); + } + + private void DrawError(string message) + { + Rect rect = new Rect(0, 0, size.x, size.y); + Widgets.DrawMenuSection(rect); + + Text.Anchor = TextAnchor.MiddleCenter; + Text.Font = GameFont.Medium; + GUI.color = Color.yellow; + Widgets.Label(rect.ContractedBy(30f), message); + GUI.color = Color.white; + Text.Font = GameFont.Small; + Text.Anchor = TextAnchor.UpperLeft; + } + + public override bool IsVisible + { + get + { + var pawn = SelPawn; + return pawn != null && pawn.TryGetComp() != null; + } + } + } +} diff --git a/Source/WulaFallenEmpire/Pawn/Comp_PawnRenderExtra.cs b/Source/WulaFallenEmpire/Pawn/WULA_PawnRenderExtra/Comp_PawnRenderExtra.cs similarity index 100% rename from Source/WulaFallenEmpire/Pawn/Comp_PawnRenderExtra.cs rename to Source/WulaFallenEmpire/Pawn/WULA_PawnRenderExtra/Comp_PawnRenderExtra.cs diff --git a/Source/WulaFallenEmpire/WulaFallenEmpire.csproj b/Source/WulaFallenEmpire/WulaFallenEmpire.csproj index d6d67dfc..54bfbef4 100644 --- a/Source/WulaFallenEmpire/WulaFallenEmpire.csproj +++ b/Source/WulaFallenEmpire/WulaFallenEmpire.csproj @@ -86,7 +86,16 @@ + + + + + + + + + @@ -317,13 +326,6 @@ - - - - - - - @@ -334,7 +336,6 @@ -