diff --git a/1.6/1.6/Assemblies/WulaFallenEmpire.dll b/1.6/1.6/Assemblies/WulaFallenEmpire.dll index 43d434e8..120cff30 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/EventDefs/EventDef_Wula/Wula_MainEvent.xml b/1.6/1.6/Defs/EventDefs/EventDef_Wula/Wula_MainEvent.xml index 8599faa3..c468ed81 100644 --- a/1.6/1.6/Defs/EventDefs/EventDef_Wula/Wula_MainEvent.xml +++ b/1.6/1.6/Defs/EventDefs/EventDef_Wula/Wula_MainEvent.xml @@ -614,7 +614,7 @@ Combat 100 - 1 + 1 diff --git a/1.6/1.6/Defs/JobDefs/WULA_JobDefs.xml b/1.6/1.6/Defs/JobDefs/WULA_JobDefs.xml index 0621f514..341755d8 100644 --- a/1.6/1.6/Defs/JobDefs/WULA_JobDefs.xml +++ b/1.6/1.6/Defs/JobDefs/WULA_JobDefs.xml @@ -45,4 +45,14 @@ false false + + + WULA_CastAbilityOnThingMelee_WithWeapon + JobDriver_CastAbilityMelee + false + true + true + true + 1 + \ No newline at end of file diff --git a/1.6/1.6/Defs/PawnKinds/PawnKinds_Wula.xml b/1.6/1.6/Defs/PawnKinds/PawnKinds_Wula.xml index b6d6ddf9..6ca4f9e0 100644 --- a/1.6/1.6/Defs/PawnKinds/PawnKinds_Wula.xml +++ b/1.6/1.6/Defs/PawnKinds/PawnKinds_Wula.xml @@ -373,7 +373,7 @@ Wula_PIA_Heavy_Unit - + WulaSpecies
  • @@ -429,6 +429,119 @@
  • + + Wula_PIA_Heavy_Unit_Melee + + WulaSpecies + +
  • + + Wula/Item/WULA_Species_Icon + SRA/Pawn/Mechanoid/AllegianceOverlays/None + CutoutWithOverlay + Graphic_Multi + 1 + + (0.2, 0.3, 0.2) + + +
  • +
    + 18 + 20 + 500 + 10~20 + 10~20 + Poor + Poor + Poor + true + +
  • Wula_Armor_Super_Heavy
  • +
  • Wula_Armor_Shield
  • +
    + +
  • Wula_Melee_Weapon_T3
  • +
    + +
  • WULA_Heavy_Infantry_PowerArmor
  • +
  • WULA_Heavy_Infantry_Helmet
  • +
    + 90000~350000 + 1 + 1 + 1 + 999999~999999 + 999999~999999 + +
  • WULA_AutoJumpdrive
  • +
  • DeathAcidifier
  • +
    + + +
  • + +
  • Wula_Backstory_Categories
  • + + +
    +
    + + Wula_PIA_Heavy_Unit_Range + + WulaSpecies + +
  • + + Wula/Item/WULA_Species_Icon + SRA/Pawn/Mechanoid/AllegianceOverlays/None + CutoutWithOverlay + Graphic_Multi + 1 + + (0.2, 0.3, 0.2) + + +
  • +
    + 18 + 20 + 500 + 10~20 + 10~20 + Poor + Poor + Poor + true + +
  • Wula_Armor_Super_Heavy
  • +
    + +
  • Wula_Ranged_Weapon_T3
  • +
    + +
  • WULA_Heavy_Infantry_PowerArmor
  • +
  • WULA_Heavy_Infantry_Helmet
  • +
    + 90000~350000 + 1 + 1 + 1 + 999999~999999 + 999999~999999 + +
  • WULA_AutoJumpdrive
  • +
  • DeathAcidifier
  • +
    + + +
  • + +
  • Wula_Backstory_Categories
  • + + +
    +
    diff --git a/1.6/1.6/Defs/ResearchProjectDefs/WULA_ResearchProjects_Remake.xml b/1.6/1.6/Defs/ResearchProjectDefs/WULA_ResearchProjects_Remake.xml index b485472f..089d6e33 100644 --- a/1.6/1.6/Defs/ResearchProjectDefs/WULA_ResearchProjects_Remake.xml +++ b/1.6/1.6/Defs/ResearchProjectDefs/WULA_ResearchProjects_Remake.xml @@ -198,10 +198,21 @@ WULA_Aircraft_Carrier_Technology - - 允许殖民地建立信标增加航空舰配额,并使得机械乌拉可以调频天线以申请舰队空中支援,包含2艘可以发起轨道炮击的巡洋舰和1艘可以提供航空器支援的航空舰。 + + 允许殖民地建立信标增加攻击舰队配额,并使得机械乌拉可以调频天线以申请舰队空中支援,包含2艘可以发起轨道炮击的巡洋舰和1艘可以提供航空器支援的航空舰。 600 - 5.00 + 6.00 + 4.40 + +
  • WULA_Colony_License_LV2_Technology
  • +
    +
    + + WULA_ConstructionShip_Technology + + 允许殖民地建立信标增加拒止舰队配额,并使得机械乌拉可以调频天线以申请舰队空中支援,包含1艘可以提供轨道支援的拒止舰。 + 600 + 6.00 3.80
  • WULA_Colony_License_LV2_Technology
  • @@ -336,8 +347,8 @@
    WULA_DarkEnergy_Generators_Technology - 9.00 - 3.80 + 10.00 + 2.70 允许殖民地申请空投暗物质发电机,一种输出功率极为恐怖却非常消耗资源的发电机。 600 diff --git a/1.6/1.6/Defs/ThingDefs_Misc/WULA_Flyover_Item.xml b/1.6/1.6/Defs/ThingDefs_Misc/WULA_Flyover_Item.xml index 32311f8f..b00e477f 100644 --- a/1.6/1.6/Defs/ThingDefs_Misc/WULA_Flyover_Item.xml +++ b/1.6/1.6/Defs/ThingDefs_Misc/WULA_Flyover_Item.xml @@ -2184,7 +2184,7 @@ Wula/Building/Flag/WULA_Flag_Building_Mount_Incoming Graphic_Single - TransparentPostLight + MoteGlow (1,1) false @@ -2220,7 +2220,7 @@ 乌拉帝国行星封锁机关的全息旗帜,除了宣誓主权外,也能激励附近的乌拉星人更加凶狠地战斗。 WulaFallenEmpire.Building_ExtraGraphics true - BuildingOnTop + Building 50 true PassThroughOnly @@ -2271,15 +2271,17 @@
  • Wula/Building/Flag/WULA_Flag_Building_A + MoteGlow (3,3) 0 - (0,1,3) + (0,1,2) 1.5 0.2 0
  • Wula/Building/Flag/WULA_Flag_Building_Mount + Transparent (1,1) 1 (0,1,0) @@ -2327,6 +2329,37 @@ WULA_Support_Shield 乌拉帝国行星封锁机关的全息旗帜,除了宣誓主权外,也能激励附近的乌拉星人更加凶狠地战斗。这面旗帜的底座附带了一个大型拒止护盾,可以反射所有的敌方射弹,己方的开火不受影响。\n\n在工作一段时间后,该系统将自行烧毁。 + + +
  • + 0 + 0 + + +
  • + Wula/Building/Flag/WULA_Flag_Building_B + MoteGlow + (3,3) + 0 + (0,1,2) + 1.5 + 0.2 + 0 +
  • +
  • + Wula/Building/Flag/WULA_Flag_Building_Mount + Transparent + (1,1) + 1 + (0,1,0) + 0 + 0 + 0 +
  • +
    + + +
  • 3600 @@ -2371,6 +2404,37 @@ WULA_Support_AreaTeleporter 乌拉帝国行星封锁机关的全息旗帜,除了宣誓主权外,也能激励附近的乌拉星人更加凶狠地战斗。这面旗帜的底座附带了一个区域传送器,可以使得机械乌拉在旗帜区域内传送。\n\n在工作一段时间后,该系统将自行烧毁。 + + +
  • + 0 + 0 + + +
  • + Wula/Building/Flag/WULA_Flag_Building_C + MoteGlow + (3,3) + 0 + (0,1,2) + 1.5 + 0.2 + 0 +
  • +
  • + Wula/Building/Flag/WULA_Flag_Building_Mount + Transparent + (1,1) + 1 + (0,1,0) + 0 + 0 + 0 +
  • + + + +
  • 20 diff --git a/1.6/1.6/Defs/ThingDefs_Misc/Weapons/WULA_FE_Manpack_Weapon.xml b/1.6/1.6/Defs/ThingDefs_Misc/Weapons/WULA_FE_Manpack_Weapon.xml index 2cfe3ff6..e21905fe 100644 --- a/1.6/1.6/Defs/ThingDefs_Misc/Weapons/WULA_FE_Manpack_Weapon.xml +++ b/1.6/1.6/Defs/ThingDefs_Misc/Weapons/WULA_FE_Manpack_Weapon.xml @@ -286,6 +286,118 @@ Maneuver_Slash_MeleeMiss Maneuver_Slash_MeleeDodge + + WULA_MW_Twohanded_ChainBroadsword + + 一把需要双手才能拿起的巨型链锯刀,这种恐怖的近战武器一击就可以造成大量伤口,甚至将对手劈成两段。它的刀头装备了一台微型相位引擎,可以挥出斩裂空间的一刀,然后瞬间移动到目标面前。 + + Wula/Weapon/WULA_MW_Twohanded_ChainBroadsword/WULA_MW_Twohanded_ChainBroadsword + CutoutComplex + Graphic_Single + 1.5 + + 25 + +
  • Wula_Melee_Weapon_T3
  • + + 0.8 + Spacer + 0 + +
  • Metallic
  • +
    + + + 4000 + 20 + + + 12 + 12 + 80 + + +
  • + + +
  • WULA_MW_ChainSword_MultiStrike
  • + + 1.75 + 35 + 2 + WULA_MW_ChainSword_Hit + WULA_MW_ChainSword_Hit + +
    + + +
  • WULA_WeaponArmor_Productor
  • +
    + WULA_Synth_Weapon_3_Melee_Technology + + 7 + + 450 + UnfinishedWeapon +
    + +
  • + Wula/Weapon/WULA_MW_Twohanded_ChainBroadsword/WULA_MW_Twohanded_ChainBroadsword_Anim + 8 + 8 +
  • +
  • + 8~12 + 0.2 +
  • +
  • + WULA_MW_Twohanded_ChainBroadsword_Ability + 传送核心 +
  • +
    + + + WULA_MW_Twohanded_ChainBroadsword_Ability + + 使用CBs-25"地狱牙"刀头的相位引擎立刻折跃至一个新的位置——这种折跃引擎只能折跃小型目标,如果持刀者体型大于1则无法发起传送。 + UI/Abilities/Skip + True + False + false + 200 + HoraxianSpellLight_Warmup + true + + Verb_CastAbility + 1 + 30 + WULA_Psi_Skip_Sound + false + + true + + + +
  • + 30 + + 0 + 0 + + 1 + Impact + 3 + false + false + true + + Skip_Entry + Skip_Exit + +
  • +
    +
    WULA_MW_Breaker_Bar @@ -368,6 +480,10 @@ 1 +
  • + WULA_MW_Breaker_Bar_Ability + 助推器 +
  • @@ -387,6 +503,45 @@ Maneuver_Slash_MeleeMiss Maneuver_Slash_MeleeDodge + + WULA_MW_Breaker_Bar_Ability + + 将PMb-97"破墙槌"的锤头加到最大压强,随后挥出向上的一击,以突破严密的人墙。即使敌人侥幸存活,也会眩晕并被砸飞出一段距离。 + UI/Abilities/UnnaturalHealing + 300 + false + true + true + + Verb_CastAbilityTouch + false + -1 + 0.5 + WULA_MW_Breaker_Bar_Hit + + false + true + false + + + +
  • + Demolish + 80 + 2 + 300 + 8 + true + false + PawnFlyer + + PawnFlyer_Land + + +
  • +
    + WULA_CastAbilityOnThingMelee_WithWeapon +
    WULA_MW_Constructor_Hammer @@ -1154,6 +1309,10 @@ Bullet_WULA_RW_Penetrating_Beam WulaFallenEmpire.Projectile_WulaPenetratingBeam + + Wula/Weapon/WULA_Weapon_Empty + Graphic_Single +
  • 2 @@ -1247,6 +1406,10 @@ Bullet_WULA_RW_Penetrating_Beam_Ranged WulaFallenEmpire.Projectile_WulaPenetratingBeam + + Wula/Weapon/WULA_Weapon_Empty + Graphic_Single +
  • 2 diff --git a/Content/Textures/Wula/Building/Flag/WULA_Flag_Building_A.png b/Content/Textures/Wula/Building/Flag/WULA_Flag_Building_A.png index 55580033..6d254205 100644 Binary files a/Content/Textures/Wula/Building/Flag/WULA_Flag_Building_A.png and b/Content/Textures/Wula/Building/Flag/WULA_Flag_Building_A.png differ diff --git a/Content/Textures/Wula/Building/Flag/WULA_Flag_Building_B.png b/Content/Textures/Wula/Building/Flag/WULA_Flag_Building_B.png new file mode 100644 index 00000000..b4cb0eff Binary files /dev/null and b/Content/Textures/Wula/Building/Flag/WULA_Flag_Building_B.png differ diff --git a/Content/Textures/Wula/Building/Flag/WULA_Flag_Building_C.png b/Content/Textures/Wula/Building/Flag/WULA_Flag_Building_C.png new file mode 100644 index 00000000..128639d9 Binary files /dev/null and b/Content/Textures/Wula/Building/Flag/WULA_Flag_Building_C.png differ diff --git a/Content/Textures/Wula/Building/Flag/WULA_Flag_Building_D.png b/Content/Textures/Wula/Building/Flag/WULA_Flag_Building_D.png new file mode 100644 index 00000000..e0707c94 Binary files /dev/null and b/Content/Textures/Wula/Building/Flag/WULA_Flag_Building_D.png differ diff --git a/Content/Textures/Wula/Weapon/WULA_MW_Twohanded_ChainBroadsword/WULA_MW_Twohanded_ChainBroadsword.png b/Content/Textures/Wula/Weapon/WULA_MW_Twohanded_ChainBroadsword/WULA_MW_Twohanded_ChainBroadsword.png new file mode 100644 index 00000000..30ccb188 Binary files /dev/null and b/Content/Textures/Wula/Weapon/WULA_MW_Twohanded_ChainBroadsword/WULA_MW_Twohanded_ChainBroadsword.png differ diff --git a/Content/Textures/Wula/Weapon/WULA_MW_Twohanded_ChainBroadsword/WULA_MW_Twohanded_ChainBroadsword_Anim.png b/Content/Textures/Wula/Weapon/WULA_MW_Twohanded_ChainBroadsword/WULA_MW_Twohanded_ChainBroadsword_Anim.png new file mode 100644 index 00000000..d4cfb806 Binary files /dev/null and b/Content/Textures/Wula/Weapon/WULA_MW_Twohanded_ChainBroadsword/WULA_MW_Twohanded_ChainBroadsword_Anim.png differ diff --git a/Source/WulaFallenEmpire/Ability/WULA_StunKnockback/CompAbilityEffect_StunKnockback.cs b/Source/WulaFallenEmpire/Ability/WULA_StunKnockback/CompAbilityEffect_StunKnockback.cs new file mode 100644 index 00000000..dc2c5d73 --- /dev/null +++ b/Source/WulaFallenEmpire/Ability/WULA_StunKnockback/CompAbilityEffect_StunKnockback.cs @@ -0,0 +1,257 @@ +using RimWorld; +using Verse; +using Verse.AI; +using System.Collections.Generic; +using UnityEngine; +using Verse.Sound; + +namespace WulaFallenEmpire +{ + public class CompAbilityEffect_StunKnockback : CompAbilityEffect + { + public new CompProperties_StunKnockback Props => (CompProperties_StunKnockback)props; + + public override void Apply(LocalTargetInfo target, LocalTargetInfo dest) + { + base.Apply(target, dest); + + if (target.HasThing && target.Thing is Pawn targetPawn) + { + // 第一步:造成伤害和眩晕 + bool targetDied = ApplyDamageAndStun(targetPawn); + + // 第二步:如果目标仍然存活,执行击退 + if (!targetDied && targetPawn != null && !targetPawn.Dead && !targetPawn.Downed) + { + PerformKnockback(targetPawn); + } + } + } + + /// + /// 应用伤害和眩晕效果,返回目标是否死亡 + /// + private bool ApplyDamageAndStun(Pawn targetPawn) + { + // 记录目标的初始状态(是否存活) + bool wasAliveBeforeDamage = !targetPawn.Dead; + + // 创建伤害信息 + DamageInfo damageInfo = new DamageInfo( + Props.damageDef, + Props.damageAmount, + Props.armorPenetration, + -1f, + parent.pawn, + null + ); + + // 应用伤害 + targetPawn.TakeDamage(damageInfo); + + // 检查目标是否死亡 + bool targetDied = targetPawn.Dead || targetPawn.Destroyed || targetPawn == null; + + if (targetDied) + { + return true; + } + + // 使用施法者的地图而不是目标的地图 + Map map = parent.pawn.Map; + + // 播放冲击效果 + if (Props.impactEffecter != null && map != null) + { + Effecter effect = Props.impactEffecter.Spawn(); + effect.Trigger(new TargetInfo(targetPawn.Position, map), new TargetInfo(targetPawn.Position, map)); + effect.Cleanup(); + } + + // 播放冲击音效 + if (Props.impactSound != null && map != null) + { + Props.impactSound.PlayOneShot(new TargetInfo(targetPawn.Position, map)); + } + + // 应用眩晕 - 只在目标存活时应用 + if (Props.stunTicks > 0 && !targetPawn.Dead) + { + targetPawn.stances.stunner.StunFor(Props.stunTicks, parent.pawn); + } + + return false; + } + + /// + /// 执行击退 + /// + private void PerformKnockback(Pawn targetPawn) + { + // 再次检查目标是否有效 + if (targetPawn == null || targetPawn.Destroyed || targetPawn.Dead) + { + return; + } + + // 计算击退方向 + IntVec3 knockbackDirection = CalculateKnockbackDirection(targetPawn.Position); + + // 寻找最远的可站立击退位置 + IntVec3 knockbackDestination = FindFarthestStandablePosition(targetPawn, knockbackDirection); + + // 如果找到了有效位置,执行击退飞行 + if (knockbackDestination.IsValid && knockbackDestination != targetPawn.Position) + { + CreateKnockbackFlyer(targetPawn, knockbackDestination); + } + } + + /// + /// 计算击退方向(施法者到目标的连线延长线) + /// + private IntVec3 CalculateKnockbackDirection(IntVec3 targetPosition) + { + // 从施法者指向目标的方向 + IntVec3 direction = targetPosition - parent.pawn.Position; + + // 标准化方向(保持整数坐标) + if (direction.x != 0 || direction.z != 0) + { + // 找到主要方向分量 + if (Mathf.Abs(direction.x) > Mathf.Abs(direction.z)) + { + return new IntVec3(Mathf.Sign(direction.x) > 0 ? 1 : -1, 0, 0); + } + else + { + return new IntVec3(0, 0, Mathf.Sign(direction.z) > 0 ? 1 : -1); + } + } + + // 如果施法者和目标在同一位置,使用随机方向 + return new IntVec3(Rand.Value > 0.5f ? 1 : -1, 0, 0); + } + + /// + /// 寻找最远的可站立击退位置(不检查路径通行性,只检查目标格子是否可站立) + /// + private IntVec3 FindFarthestStandablePosition(Pawn targetPawn, IntVec3 direction) + { + Map map = targetPawn.Map; + IntVec3 currentPos = targetPawn.Position; + IntVec3 farthestValidPos = currentPos; + + // 从最大距离开始向回找,找到第一个可站立的格子 + for (int distance = Props.maxKnockbackDistance; distance >= 1; distance--) + { + IntVec3 testPos = currentPos + (direction * distance); + + if (!testPos.InBounds(map)) + continue; + + // 检查格子是否可站立且没有其他Pawn + if (IsCellStandableAndEmpty(testPos, map, targetPawn)) + { + farthestValidPos = testPos; + break; + } + } + + return farthestValidPos; + } + + /// + /// 检查格子是否可站立且没有其他Pawn + /// + private bool IsCellStandableAndEmpty(IntVec3 cell, Map map, Pawn targetPawn) + { + if (!cell.InBounds(map)) + return false; + + // 检查是否可站立 + if (!cell.Standable(map)) + return false; + + // 检查是否有建筑阻挡(如果配置不允许击退到墙上) + if (!Props.canKnockbackIntoWalls) + { + Building edifice = cell.GetEdifice(map); + if (edifice != null && !(edifice is Building_Door)) + return false; + } + + // 检查视线(如果需要) + if (Props.requireLineOfSight && !GenSight.LineOfSight(targetPawn.Position, cell, map)) + return false; + + // 检查是否有其他pawn + List thingList = cell.GetThingList(map); + foreach (Thing thing in thingList) + { + if (thing is Pawn otherPawn && otherPawn != targetPawn) + return false; + } + + return true; + } + + /// + /// 创建击退飞行器 + /// + private void CreateKnockbackFlyer(Pawn targetPawn, IntVec3 destination) + { + Map map = targetPawn.Map; + + // 使用自定义飞行器或默认飞行器 + ThingDef flyerDef = Props.knockbackFlyerDef ?? ThingDefOf.PawnFlyer; + + // 创建飞行器(参考JumpUtility.DoJump) + PawnFlyer flyer = PawnFlyer.MakeFlyer( + flyerDef, + targetPawn, + destination, + Props.flightEffecterDef, + Props.landingSound, + false, // 不携带物品 + null, // 不覆盖起始位置 + null, // 传递Ability对象而不是CompAbilityEffect + new LocalTargetInfo(destination) + ); + + if (flyer != null) + { + // 生成飞行器 + GenSpawn.Spawn(flyer, destination, map); + } + } + + public override bool Valid(LocalTargetInfo target, bool throwMessages = false) + { + // 首先调用基类验证 + if (!base.Valid(target, throwMessages)) + return false; + + // 检查目标是否为Pawn + if (!target.HasThing || !(target.Thing is Pawn)) + { + return false; + } + + // 检查目标是否存活 + Pawn targetPawn = target.Thing as Pawn; + if (targetPawn.Dead || targetPawn.Downed) + { + return false; + } + + // 检查是否在同一地图 + if (targetPawn.Map != parent.pawn.Map) + { + return false; + } + + return true; + } + } +} diff --git a/Source/WulaFallenEmpire/Ability/WULA_StunKnockback/CompProperties_StunKnockback.cs b/Source/WulaFallenEmpire/Ability/WULA_StunKnockback/CompProperties_StunKnockback.cs new file mode 100644 index 00000000..54d192be --- /dev/null +++ b/Source/WulaFallenEmpire/Ability/WULA_StunKnockback/CompProperties_StunKnockback.cs @@ -0,0 +1,36 @@ +using RimWorld; +using Verse; +using System.Collections.Generic; + +namespace WulaFallenEmpire +{ + public class CompProperties_StunKnockback : CompProperties_AbilityEffect + { + // 伤害设置 + public DamageDef damageDef = DamageDefOf.Blunt; + public float damageAmount = 15f; + public float armorPenetration = 0f; + + // 眩晕设置 + public int stunTicks = 180; // 3秒眩晕 + + // 击退设置 + public int maxKnockbackDistance = 5; // 最大击退距离 + public bool requireLineOfSight = true; // 击退路径是否需要视线 + public bool canKnockbackIntoWalls = false; // 是否可以击退到墙上 + + // 飞行效果设置 + public ThingDef knockbackFlyerDef; + public EffecterDef flightEffecterDef; + public SoundDef landingSound; + + // 伤害和击退的视觉效果 + public EffecterDef impactEffecter; + public SoundDef impactSound; + + public CompProperties_StunKnockback() + { + compClass = typeof(CompAbilityEffect_StunKnockback); + } + } +} diff --git a/Source/WulaFallenEmpire/BuildingComp/Building_ExtraGraphics.cs b/Source/WulaFallenEmpire/BuildingComp/Building_ExtraGraphics.cs index 84fe40c6..19c54fda 100644 --- a/Source/WulaFallenEmpire/BuildingComp/Building_ExtraGraphics.cs +++ b/Source/WulaFallenEmpire/BuildingComp/Building_ExtraGraphics.cs @@ -12,7 +12,7 @@ namespace WulaFallenEmpire // 通过 ModExtension 配置的图形数据 private ExtraGraphicsExtension modExtension; - // 图形缓存 + // 图形缓存 - 现在包含Shader信息 private Dictionary graphicsCache = new Dictionary(); // 动画状态 - 每个图层的独立浮动 @@ -41,16 +41,16 @@ namespace WulaFallenEmpire // 重写 Graphic 属性返回 null,完全自定义渲染 public override Graphic Graphic => null; - // 获取缓存的图形 - private Graphic GetCachedGraphic(string texturePath, Vector2 scale, Color color) + // 获取缓存的图形 - 修改后支持自定义Shader + private Graphic GetCachedGraphic(string texturePath, Vector2 scale, Color color, Shader shader) { - string cacheKey = $"{texturePath}_{scale.x}_{scale.y}_{color}"; + string cacheKey = $"{texturePath}_{scale.x}_{scale.y}_{color}_{shader?.name ?? "null"}"; if (!graphicsCache.TryGetValue(cacheKey, out Graphic graphic)) { graphic = GraphicDatabase.Get( texturePath, - ShaderDatabase.TransparentPostLight, + shader ?? ShaderDatabase.TransparentPostLight, // 使用传入的Shader,如果为null则使用默认 scale, color); graphicsCache[cacheKey] = graphic; @@ -58,6 +58,66 @@ namespace WulaFallenEmpire return graphic; } + + // 根据Shader名称获取Shader - 修正版本 + private Shader GetShaderByName(string shaderName) + { + if (string.IsNullOrEmpty(shaderName)) + return ShaderDatabase.TransparentPostLight; + + // 使用switch语句匹配实际可用的Shader + switch (shaderName.ToLower()) + { + case "transparent": + return ShaderDatabase.Transparent; + case "transparentpostlight": + return ShaderDatabase.TransparentPostLight; + case "transparentplant": + return ShaderDatabase.TransparentPlant; + case "cutout": + return ShaderDatabase.Cutout; + case "cutoutcomplex": + return ShaderDatabase.CutoutComplex; + case "cutoutflying": + return ShaderDatabase.CutoutFlying; + case "cutoutflying01": + return ShaderDatabase.CutoutFlying01; + case "terrainfade": + return ShaderDatabase.TerrainFade; + case "terrainfaderough": + return ShaderDatabase.TerrainFadeRough; + case "mote": + return ShaderDatabase.Mote; + case "moteglow": + return ShaderDatabase.MoteGlow; + case "motepulse": + return ShaderDatabase.MotePulse; + case "moteglowpulse": + return ShaderDatabase.MoteGlowPulse; + case "motewater": + return ShaderDatabase.MoteWater; + case "moteglowdistorted": + return ShaderDatabase.MoteGlowDistorted; + case "solidcolor": + return ShaderDatabase.SolidColor; + case "vertexcolor": + return ShaderDatabase.VertexColor; + case "invisible": + return ShaderDatabase.Invisible; + case "silhouette": + return ShaderDatabase.Silhouette; + case "worldterrain": + return ShaderDatabase.WorldTerrain; + case "worldocean": + return ShaderDatabase.WorldOcean; + case "metaoverlay": + return ShaderDatabase.MetaOverlay; + default: + Log.Warning($"Building_ExtraGraphics: Shader '{shaderName}' not found, using TransparentPostLight as fallback"); + return ShaderDatabase.TransparentPostLight; + } + } + protected override void DrawAt(Vector3 drawLoc, bool flip = false) { // 不调用基类的 DrawAt,完全自定义渲染 @@ -101,8 +161,11 @@ namespace WulaFallenEmpire return; } - // 获取图形 - Graphic graphic = GetCachedGraphic(layer.texturePath, layer.scale, layer.color); + // 获取Shader + Shader shader = GetShaderByName(layer.shaderName); + + // 获取图形(现在传入Shader) + Graphic graphic = GetCachedGraphic(layer.texturePath, layer.scale, layer.color, shader); // 计算图层浮动偏移 float hoverOffset = 0f; @@ -187,7 +250,7 @@ namespace WulaFallenEmpire } } - // 单个图形层的配置数据 + // 单个图形层的配置数据 - 添加shaderName字段 public class GraphicLayerData { // 基础配置 @@ -195,6 +258,7 @@ namespace WulaFallenEmpire public Vector2 scale = Vector2.one; // 缩放比例 public Color color = Color.white; // 颜色 public int drawOrder = 0; // 绘制顺序(数字小的先绘制) + public string shaderName = "TransparentPostLight"; // Shader名称(新增) // 位置配置 - 使用环世界坐标系 // X: 左右偏移, Y: 图层深度, Z: 上下偏移 diff --git a/Source/WulaFallenEmpire/WulaFallenEmpire.csproj b/Source/WulaFallenEmpire/WulaFallenEmpire.csproj index 8215eff1..e4f9b812 100644 --- a/Source/WulaFallenEmpire/WulaFallenEmpire.csproj +++ b/Source/WulaFallenEmpire/WulaFallenEmpire.csproj @@ -92,6 +92,8 @@ + + diff --git a/WeaponTweakData/WULA_MW_Breaker_Bar_tourswen.wulafallenempirev2test.json b/WeaponTweakData/WULA_MW_Breaker_Bar_tourswen.wulafallenempirev2test.json new file mode 100644 index 00000000..88b31f7f --- /dev/null +++ b/WeaponTweakData/WULA_MW_Breaker_Bar_tourswen.wulafallenempirev2test.json @@ -0,0 +1,11 @@ +{ + "TextureModID": "tourswen.wulafallenempirev2test", + "ItemDefName": "WULA_MW_Breaker_Bar", + "ItemType": "ThingDef", + "ItemTypeNamespace": "Verse", + "OffY": 0.0545980521, + "ScaleX": 1.5, + "ScaleY": 1.5, + "BladeStart": -0.428160578, + "MeleeWeaponType": 1 +} \ No newline at end of file diff --git a/WeaponTweakData/WULA_MW_ChainSword_tourswen.wulafallenempirev2test.json b/WeaponTweakData/WULA_MW_ChainSword_tourswen.wulafallenempirev2test.json new file mode 100644 index 00000000..f3787cc5 --- /dev/null +++ b/WeaponTweakData/WULA_MW_ChainSword_tourswen.wulafallenempirev2test.json @@ -0,0 +1,12 @@ +{ + "TextureModID": "tourswen.wulafallenempirev2test", + "ItemDefName": "WULA_MW_ChainSword", + "ItemType": "ThingDef", + "ItemTypeNamespace": "Verse", + "OffX": 0.2614946, + "OffY": 0.204023167, + "HandsMode": 1, + "BladeStart": -0.100574359, + "BladeEnd": 0.543103456, + "MeleeWeaponType": 48 +} \ No newline at end of file diff --git a/WeaponTweakData/WULA_MW_Charge_Mace_tourswen.wulafallenempirev2test.json b/WeaponTweakData/WULA_MW_Charge_Mace_tourswen.wulafallenempirev2test.json new file mode 100644 index 00000000..4f8ea51f --- /dev/null +++ b/WeaponTweakData/WULA_MW_Charge_Mace_tourswen.wulafallenempirev2test.json @@ -0,0 +1,11 @@ +{ + "TextureModID": "tourswen.wulafallenempirev2test", + "ItemDefName": "WULA_MW_Charge_Mace", + "ItemType": "ThingDef", + "ItemTypeNamespace": "Verse", + "OffY": 0.0201152936, + "HandsMode": 1, + "BladeStart": -0.318965524, + "BladeEnd": 0.336206883, + "MeleeWeaponType": 40 +} \ No newline at end of file diff --git a/WeaponTweakData/WULA_MW_Constructor_Hammer_tourswen.wulafallenempirev2test.json b/WeaponTweakData/WULA_MW_Constructor_Hammer_tourswen.wulafallenempirev2test.json new file mode 100644 index 00000000..92edac0b --- /dev/null +++ b/WeaponTweakData/WULA_MW_Constructor_Hammer_tourswen.wulafallenempirev2test.json @@ -0,0 +1,10 @@ +{ + "TextureModID": "tourswen.wulafallenempirev2test", + "ItemDefName": "WULA_MW_Constructor_Hammer", + "ItemType": "ThingDef", + "ItemTypeNamespace": "Verse", + "OffY": 0.04885075, + "BladeStart": -0.336206883, + "BladeEnd": 0.330460131, + "MeleeWeaponType": 1 +} \ No newline at end of file diff --git a/WeaponTweakData/WULA_MW_Twohanded_ChainBroadsword_tourswen.wulafallenempirev2test.json b/WeaponTweakData/WULA_MW_Twohanded_ChainBroadsword_tourswen.wulafallenempirev2test.json new file mode 100644 index 00000000..5d62c2ee --- /dev/null +++ b/WeaponTweakData/WULA_MW_Twohanded_ChainBroadsword_tourswen.wulafallenempirev2test.json @@ -0,0 +1,13 @@ +{ + "TextureModID": "tourswen.wulafallenempirev2test", + "ItemDefName": "WULA_MW_Twohanded_ChainBroadsword", + "ItemType": "ThingDef", + "ItemTypeNamespace": "Verse", + "OffX": 0.08908081, + "OffY": 0.244253218, + "ScaleX": 1.5, + "ScaleY": 1.5, + "BladeStart": -0.502873361, + "BladeEnd": 0.807471454, + "MeleeWeaponType": 6 +} \ No newline at end of file diff --git a/WeaponTweakData/tourswen.wulafallenempirev2test.txt b/WeaponTweakData/tourswen.wulafallenempirev2test.txt new file mode 100644 index 00000000..6f659fb6 --- /dev/null +++ b/WeaponTweakData/tourswen.wulafallenempirev2test.txt @@ -0,0 +1 @@ +Wula Fallen Empire V2 \ No newline at end of file diff --git a/美术与文本源文件/Wula/Building/WULA_Flag_Building_1.sai2 b/美术与文本源文件/Wula/Building/WULA_Flag_Building_1.sai2 index 608b93a1..acd20fb5 100644 Binary files a/美术与文本源文件/Wula/Building/WULA_Flag_Building_1.sai2 and b/美术与文本源文件/Wula/Building/WULA_Flag_Building_1.sai2 differ diff --git a/美术与文本源文件/Wula/Weapon/WULA_MW_Twohanded_ChainBroadsword.sai2 b/美术与文本源文件/Wula/Weapon/WULA_MW_Twohanded_ChainBroadsword.sai2 new file mode 100644 index 00000000..3b7f82c1 Binary files /dev/null and b/美术与文本源文件/Wula/Weapon/WULA_MW_Twohanded_ChainBroadsword.sai2 differ