From f9649281527d573184e84f27e4f8a94e2eb30368 Mon Sep 17 00:00:00 2001 From: Xuc Pan Date: Sat, 27 Apr 2024 18:04:28 +0800 Subject: [PATCH] fix: :bug: installModule return wrong money --- logic/GameClass/GameObj/Ship.cs | 36 ++++++++++++++++++++------------- 1 file changed, 22 insertions(+), 14 deletions(-) diff --git a/logic/GameClass/GameObj/Ship.cs b/logic/GameClass/GameObj/Ship.cs index a0bf7fd8..496ba8da 100755 --- a/logic/GameClass/GameObj/Ship.cs +++ b/logic/GameClass/GameObj/Ship.cs @@ -94,45 +94,48 @@ public bool InstallModule(ModuleType moduleType) case ModuleType.Producer1: if (ProducerModuleType != ProducerType.Producer1) { - SubMoney( - ProducerModule.SetROri( - ModuleFactory.FindIProducer(ShipType, ProducerType.Producer1) - ).Cost); + ProducerModule.SetROri(ModuleFactory.FindIProducer(ShipType, ProducerType.Producer1)); + SubMoney(ProducerModule.Get().Cost); return true; } break; case ModuleType.Producer2: if (ProducerModuleType != ProducerType.Producer2) { - SubMoney(ProducerModule.SetROri(ModuleFactory.FindIProducer(ShipType, ProducerType.Producer2)).Cost); + ProducerModule.SetROri(ModuleFactory.FindIProducer(ShipType, ProducerType.Producer2)); + SubMoney(ProducerModule.Get().Cost); return true; } break; case ModuleType.Producer3: if (ProducerModuleType != ProducerType.Producer3) { - SubMoney(ProducerModule.SetROri(ModuleFactory.FindIProducer(ShipType, ProducerType.Producer3)).Cost); + ProducerModule.SetROri(ModuleFactory.FindIProducer(ShipType, ProducerType.Producer3)); + SubMoney(ProducerModule.Get().Cost); return true; } break; case ModuleType.Constructor1: if (ConstructorModuleType != ConstructorType.Constructor1) { - SubMoney(ConstructorModule.SetROri(ModuleFactory.FindIConstructor(ShipType, ConstructorType.Constructor1)).Cost); + ConstructorModule.SetROri(ModuleFactory.FindIConstructor(ShipType, ConstructorType.Constructor1)); + SubMoney(ConstructorModule.Get().Cost); return true; } break; case ModuleType.Constructor2: if (ConstructorModuleType != ConstructorType.Constructor2) { - SubMoney(ConstructorModule.SetROri(ModuleFactory.FindIConstructor(ShipType, ConstructorType.Constructor2)).Cost); + ConstructorModule.SetROri(ModuleFactory.FindIConstructor(ShipType, ConstructorType.Constructor2)); + SubMoney(ConstructorModule.Get().Cost); return true; } break; case ModuleType.Constructor3: if (ConstructorModuleType != ConstructorType.Constructor3) { - SubMoney(ConstructorModule.SetROri(ModuleFactory.FindIConstructor(ShipType, ConstructorType.Constructor3)).Cost); + ConstructorModule.SetROri(ModuleFactory.FindIConstructor(ShipType, ConstructorType.Constructor3)); + SubMoney(ConstructorModule.Get().Cost); return true; } break; @@ -198,14 +201,16 @@ public bool InstallModule(ModuleType moduleType) case ModuleType.LaserGun: if (WeaponModuleType != WeaponType.LaserGun) { - SubMoney(WeaponModule.SetROri(ModuleFactory.FindIWeapon(ShipType, WeaponType.LaserGun)).Cost); + WeaponModule.SetROri(ModuleFactory.FindIWeapon(ShipType, WeaponType.LaserGun)); + SubMoney(WeaponModule.Get().Cost); return true; } break; case ModuleType.PlasmaGun: if (WeaponModuleType != WeaponType.PlasmaGun) { - SubMoney(WeaponModule.SetROri(ModuleFactory.FindIWeapon(ShipType, WeaponType.PlasmaGun)).Cost); + WeaponModule.SetROri(ModuleFactory.FindIWeapon(ShipType, WeaponType.PlasmaGun)); + SubMoney(WeaponModule.Get().Cost); return true; } break; @@ -213,7 +218,8 @@ public bool InstallModule(ModuleType moduleType) case ModuleType.ShellGun: if (WeaponModuleType != WeaponType.ShellGun) { - SubMoney(WeaponModule.SetROri(ModuleFactory.FindIWeapon(ShipType, WeaponType.ShellGun)).Cost); + WeaponModule.SetROri(ModuleFactory.FindIWeapon(ShipType, WeaponType.ShellGun)); + SubMoney(WeaponModule.Get().Cost); return true; } break; @@ -221,7 +227,8 @@ public bool InstallModule(ModuleType moduleType) case ModuleType.MissileGun: if (WeaponModuleType != WeaponType.MissileGun) { - SubMoney(WeaponModule.SetROri(ModuleFactory.FindIWeapon(ShipType, WeaponType.MissileGun)).Cost); + WeaponModule.SetROri(ModuleFactory.FindIWeapon(ShipType, WeaponType.MissileGun)); + SubMoney(WeaponModule.Get().Cost); return true; } break; @@ -229,7 +236,8 @@ public bool InstallModule(ModuleType moduleType) case ModuleType.ArcGun: if (WeaponModuleType != WeaponType.ArcGun) { - SubMoney(WeaponModule.SetROri(ModuleFactory.FindIWeapon(ShipType, WeaponType.ArcGun)).Cost); + WeaponModule.SetROri(ModuleFactory.FindIWeapon(ShipType, WeaponType.ArcGun)); + SubMoney(WeaponModule.Get().Cost); return true; } break;