Compare commits

..

2 Commits

Author SHA1 Message Date
SepComet 7106e0adbe feat: Introduce new services and refactor existing code for better structure
- Added ISpriteCacheService, IStaticDataService, and ITextService interfaces for improved service management.
- Implemented RunContracts for managing run states and node execution contexts.
- Created EnemyTagStatusRuntime to handle enemy status effects and their application.
- Refactored ShopPriceRuleService to utilize static data service for shop prices.
- Enhanced InventoryTowerEnduranceUtility to manage tower endurance reduction.
- Updated EventFormUseCase to work with new EventOptionExecutionContext.
- Removed unused dictionary loading code from ProcedurePreload.
- Cleaned up various utility classes and ensured consistent naming conventions.
- Updated tests to reflect changes in context and service usage.
2026-05-13 22:18:47 +08:00
SepComet 9fc0ef2216 拆分程序集,统一修改 Core 区域类的命名空间,暂不修复编译问题 2026-05-13 16:48:09 +08:00
247 changed files with 1057 additions and 695 deletions

View File

@ -0,0 +1,23 @@
{
"name": "GeometryTD.Runtime",
"rootNamespace": "GeometryTD.Runtime",
"references": [
"GUID:363c5eb08ff8e6a439b85e37b8c20d96",
"GUID:75469ad4d38634e559750d17036d5f7c",
"GUID:6055be8ebefd69e48b49212b09b47b2f",
"GUID:771b79705393da244ae720aa28ae8a69",
"GUID:c53de6f5028489b4689382a86bfbd807",
"GUID:0f19320f1ba33834b896afc5a5aaae67"
],
"includePlatforms": [
"Android"
],
"excludePlatforms": [],
"allowUnsafeCode": false,
"overrideReferences": false,
"precompiledReferences": [],
"autoReferenced": true,
"defineConstraints": [],
"versionDefines": [],
"noEngineReferences": false
}

View File

@ -0,0 +1,18 @@
{
"name": "GeometryTD.Gameplay",
"rootNamespace": "GeometryTD.Gameplay",
"references": [
"GUID:771b79705393da244ae720aa28ae8a69"
],
"includePlatforms": [
"Android"
],
"excludePlatforms": [],
"allowUnsafeCode": false,
"overrideReferences": false,
"precompiledReferences": [],
"autoReferenced": true,
"defineConstraints": [],
"versionDefines": [],
"noEngineReferences": false
}

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: c53de6f5028489b4689382a86bfbd807
AssemblyDefinitionImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,3 @@
{
"reference": "GUID:c53de6f5028489b4689382a86bfbd807"
}

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 5304296ea426f4d4b8067b7b64a3ad48
AssemblyDefinitionReferenceImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,5 +1,6 @@
using System.Collections.Generic; using System.Collections.Generic;
using GameFramework.DataTable; using GameFramework.DataTable;
using GeometryTD.Core;
using GeometryTD.CustomEvent; using GeometryTD.CustomEvent;
using GeometryTD.DataTable; using GeometryTD.DataTable;
using GeometryTD.Definition; using GeometryTD.Definition;
@ -79,7 +80,7 @@ namespace GeometryTD.CustomComponent
return; return;
} }
_eventFormUseCase.BindEvent(_activeEvent, _activeContext); _eventFormUseCase.BindEvent(_activeEvent, CreateEventOptionExecutionContext(_activeContext));
GameEntry.UIRouter.OpenUI(UIFormType.EventForm); GameEntry.UIRouter.OpenUI(UIFormType.EventForm);
GameEntry.Event.Fire( GameEntry.Event.Fire(
this, this,
@ -236,5 +237,12 @@ namespace GeometryTD.CustomComponent
return seed; return seed;
} }
} }
private static EventOptionExecutionContext CreateEventOptionExecutionContext(RunNodeExecutionContext context)
{
return new EventOptionExecutionContext(
context?.RunSeed ?? 0,
context?.SequenceIndex ?? -1);
}
} }
} }

View File

@ -0,0 +1,3 @@
{
"reference": "GUID:e67bd2d1b65d48ce8120141996e55b2b"
}

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: bd7362132664f0c499e39663c24ade2d
AssemblyDefinitionReferenceImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,3 @@
{
"reference": "GUID:0f19320f1ba33834b896afc5a5aaae67"
}

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 4c1cfd0d064e8b3418adeca47c20ae1d
AssemblyDefinitionReferenceImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,3 @@
{
"reference": "GUID:c53de6f5028489b4689382a86bfbd807"
}

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 6bc6ae941e9ae4c43a4f75e3405d0eaf
AssemblyDefinitionReferenceImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -123,7 +123,7 @@ namespace GeometryTD.CustomComponent
private int ResolveRandomPrice(RarityType rarity, Random random) private int ResolveRandomPrice(RarityType rarity, Random random)
{ {
return ShopPriceRuleService.ResolveRandomBuyPrice(_shopPriceRows, rarity, random); return ShopPriceRuleService.ResolveRandomBuyPrice(rarity, random);
} }
private static IconAreaContext BuildIconAreaContext(TowerCompItemData item) private static IconAreaContext BuildIconAreaContext(TowerCompItemData item)

View File

@ -0,0 +1,3 @@
{
"reference": "GUID:c53de6f5028489b4689382a86bfbd807"
}

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 93d673219f2a1a94599e67456ea33f7f
AssemblyDefinitionReferenceImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,4 +1,5 @@
using System.Collections.Generic; using System.Collections.Generic;
using GeometryTD.Core;
using GeometryTD.CustomUtility; using GeometryTD.CustomUtility;
using GeometryTD.Definition; using GeometryTD.Definition;
using UnityEngine; using UnityEngine;
@ -42,108 +43,4 @@ namespace GeometryTD.CustomComponent
enduranceLoss); enduranceLoss);
} }
} }
public static class InventoryTowerEnduranceUtility
{
public static int ReduceTowerEndurance(
BackpackInventoryData inventory,
IReadOnlyList<long> towerInstanceIds,
float enduranceLoss)
{
float resolvedLoss = Mathf.Max(0f, enduranceLoss);
if (inventory?.Towers == null ||
inventory.Towers.Count <= 0 ||
resolvedLoss <= 0f ||
towerInstanceIds == null ||
towerInstanceIds.Count <= 0)
{
return 0;
}
Dictionary<long, MuzzleCompItemData> muzzleMap = BuildComponentMap(inventory.MuzzleComponents);
Dictionary<long, BearingCompItemData> bearingMap = BuildComponentMap(inventory.BearingComponents);
Dictionary<long, BaseCompItemData> baseMap = BuildComponentMap(inventory.BaseComponents);
HashSet<long> processedTowerIds = new HashSet<long>();
int affectedCount = 0;
for (int i = 0; i < towerInstanceIds.Count; i++)
{
long towerInstanceId = towerInstanceIds[i];
if (towerInstanceId <= 0 || !processedTowerIds.Add(towerInstanceId))
{
continue;
}
if (!InventoryParticipantUtility.TryGetTowerById(inventory, towerInstanceId, out TowerItemData tower) ||
tower == null)
{
continue;
}
bool towerAffected = false;
if (muzzleMap.TryGetValue(tower.MuzzleComponentInstanceId, out MuzzleCompItemData muzzleComp))
{
towerAffected |= TryReduceComponentEndurance(muzzleComp, resolvedLoss);
}
if (bearingMap.TryGetValue(tower.BearingComponentInstanceId, out BearingCompItemData bearingComp))
{
towerAffected |= TryReduceComponentEndurance(bearingComp, resolvedLoss);
}
if (baseMap.TryGetValue(tower.BaseComponentInstanceId, out BaseCompItemData baseComp))
{
towerAffected |= TryReduceComponentEndurance(baseComp, resolvedLoss);
}
if (towerAffected)
{
affectedCount++;
}
}
return affectedCount;
}
private static bool TryReduceComponentEndurance(TowerCompItemData component, float enduranceLoss)
{
if (component == null)
{
return false;
}
float originalEndurance = component.Endurance;
float nextEndurance = Mathf.Clamp(originalEndurance - Mathf.Max(0f, enduranceLoss), 0f, 100f);
if (nextEndurance >= originalEndurance)
{
return false;
}
component.Endurance = nextEndurance;
return true;
}
private static Dictionary<long, TComp> BuildComponentMap<TComp>(List<TComp> components)
where TComp : TowerCompItemData
{
Dictionary<long, TComp> map = new Dictionary<long, TComp>();
if (components == null || components.Count <= 0)
{
return map;
}
for (int i = 0; i < components.Count; i++)
{
TComp component = components[i];
if (component == null || component.InstanceId <= 0)
{
continue;
}
map[component.InstanceId] = component;
}
return map;
}
}
} }

View File

@ -1,7 +1,5 @@
using System.Collections.Generic; using System.Collections.Generic;
using GameFramework.DataTable;
using GeometryTD.CustomUtility; using GeometryTD.CustomUtility;
using GeometryTD.DataTable;
using GeometryTD.Definition; using GeometryTD.Definition;
using UnityEngine; using UnityEngine;
@ -41,16 +39,13 @@ namespace GeometryTD.CustomComponent
{ {
private readonly PlayerInventoryQueryModel _queryModel; private readonly PlayerInventoryQueryModel _queryModel;
private readonly PlayerInventoryCommandModel _commandModel; private readonly PlayerInventoryCommandModel _commandModel;
private IDataTable<DRShopPrice> _shopPriceTable;
public PlayerInventoryTradeService( public PlayerInventoryTradeService(
PlayerInventoryQueryModel queryModel, PlayerInventoryQueryModel queryModel,
PlayerInventoryCommandModel commandModel, PlayerInventoryCommandModel commandModel)
IDataTable<DRShopPrice> shopPriceTable = null)
{ {
_queryModel = queryModel; _queryModel = queryModel;
_commandModel = commandModel; _commandModel = commandModel;
_shopPriceTable = shopPriceTable;
} }
public bool TryPurchaseComponent(TowerCompItemData item, int price) public bool TryPurchaseComponent(TowerCompItemData item, int price)
@ -179,7 +174,7 @@ namespace GeometryTD.CustomComponent
}; };
} }
if (!ShopPriceRuleService.TryResolveTowerSalePrice(tower, inventory, out int towerPrice, EnsureShopPriceTable())) if (!ShopPriceRuleService.TryResolveTowerSalePrice(tower, inventory, out int towerPrice))
{ {
return new PlayerInventorySaleCandidate return new PlayerInventorySaleCandidate
{ {
@ -249,7 +244,7 @@ namespace GeometryTD.CustomComponent
ItemId = component.InstanceId, ItemId = component.InstanceId,
IsSellable = true, IsSellable = true,
IsTower = false, IsTower = false,
Price = ShopPriceRuleService.ResolveComponentSalePrice(component, EnsureShopPriceTable()), Price = ShopPriceRuleService.ResolveComponentSalePrice(component),
FailureReason = PlayerInventorySaleFailureReason.None FailureReason = PlayerInventorySaleFailureReason.None
}; };
} }
@ -390,11 +385,5 @@ namespace GeometryTD.CustomComponent
return inventory; return inventory;
} }
private IDataTable<DRShopPrice> EnsureShopPriceTable()
{
_shopPriceTable ??= GameEntry.DataTable.GetDataTable<DRShopPrice>();
return _shopPriceTable;
}
} }
} }

View File

@ -0,0 +1,3 @@
{
"reference": "GUID:c53de6f5028489b4689382a86bfbd807"
}

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: e09026219ecab5e44ab54879792e2b26
AssemblyDefinitionReferenceImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,15 +1,8 @@
//------------------------------------------------------------ using System;
// Game Framework
// Copyright © 2013-2021 Jiang Yin. All rights reserved.
// Homepage: https://gameframework.cn/
// Feedback: mailto:ellan@gameframework.cn
//------------------------------------------------------------
using System;
using System.IO; using System.IO;
using UnityEngine; using UnityEngine;
namespace GeometryTD.DataTable namespace GeometryTD.Core
{ {
public static class BinaryReaderExtension public static class BinaryReaderExtension
{ {

View File

@ -1,9 +1,8 @@
using System; using System;
using GeometryTD.Definition; using GeometryTD.Core;
using GeometryTD.CustomUtility;
using UnityGameFramework.Runtime; using UnityGameFramework.Runtime;
namespace GeometryTD.DataTable namespace GeometryTD.Core
{ {
/// <summary> /// <summary>
/// 底座组件表 /// 底座组件表

View File

@ -1,9 +1,8 @@
using System; using System;
using GeometryTD.Definition; using GeometryTD.Core;
using GeometryTD.CustomUtility;
using UnityGameFramework.Runtime; using UnityGameFramework.Runtime;
namespace GeometryTD.DataTable namespace GeometryTD.Core
{ {
/// <summary> /// <summary>
/// 轴承组件表 /// 轴承组件表

View File

@ -1,6 +1,6 @@
using UnityGameFramework.Runtime; using UnityGameFramework.Runtime;
namespace GeometryTD.DataTable namespace GeometryTD.Core
{ {
/// <summary> /// <summary>
/// 敌人配置表 /// 敌人配置表

View File

@ -16,7 +16,7 @@ using System.Text;
using UnityEngine; using UnityEngine;
using UnityGameFramework.Runtime; using UnityGameFramework.Runtime;
namespace GeometryTD.DataTable namespace GeometryTD.Core
{ {
/// <summary> /// <summary>
/// 实体表。 /// 实体表。

View File

@ -1,7 +1,7 @@
using UnityGameFramework.Runtime; using UnityGameFramework.Runtime;
using Newtonsoft.Json.Linq; using Newtonsoft.Json.Linq;
namespace GeometryTD.DataTable namespace GeometryTD.Core
{ {
/// <summary> /// <summary>
/// 事件配置表 /// 事件配置表

View File

@ -1,9 +1,8 @@
using System; using System;
using GeometryTD.Definition; using GeometryTD.Core;
using GeometryTD.CustomUtility;
using UnityGameFramework.Runtime; using UnityGameFramework.Runtime;
namespace GeometryTD.DataTable namespace GeometryTD.Core
{ {
/// <summary> /// <summary>
/// 关卡表 /// 关卡表

View File

@ -1,9 +1,8 @@
using System; using System;
using GeometryTD.CustomUtility; using GeometryTD.Core;
using GeometryTD.Definition;
using UnityGameFramework.Runtime; using UnityGameFramework.Runtime;
namespace GeometryTD.DataTable namespace GeometryTD.Core
{ {
/// <summary> /// <summary>
/// 关卡阶段表 /// 关卡阶段表

View File

@ -1,9 +1,8 @@
using System; using System;
using GeometryTD.CustomUtility; using GeometryTD.Core;
using GeometryTD.Definition;
using UnityGameFramework.Runtime; using UnityGameFramework.Runtime;
namespace GeometryTD.DataTable namespace GeometryTD.Core
{ {
/// <summary> /// <summary>
/// 关卡阶段出怪条目表 /// 关卡阶段出怪条目表

View File

@ -16,7 +16,7 @@ using System.Text;
using UnityEngine; using UnityEngine;
using UnityGameFramework.Runtime; using UnityGameFramework.Runtime;
namespace GeometryTD.DataTable namespace GeometryTD.Core
{ {
/// <summary> /// <summary>
/// 音乐配置表。 /// 音乐配置表。

View File

@ -1,9 +1,8 @@
using System; using System;
using GeometryTD.Definition; using GeometryTD.Core;
using GeometryTD.CustomUtility;
using UnityGameFramework.Runtime; using UnityGameFramework.Runtime;
namespace GeometryTD.DataTable namespace GeometryTD.Core
{ {
/// <summary> /// <summary>
/// 枪口组件表 /// 枪口组件表

View File

@ -1,10 +1,9 @@
using System; using System;
using GeometryTD.CustomUtility; using GeometryTD.Core;
using GeometryTD.Definition;
using UnityEngine; using UnityEngine;
using UnityGameFramework.Runtime; using UnityGameFramework.Runtime;
namespace GeometryTD.DataTable namespace GeometryTD.Core
{ {
/// <summary> /// <summary>
/// 局外道具掉落池配置表。 /// 局外道具掉落池配置表。

View File

@ -1,8 +1,7 @@
using GeometryTD.CustomUtility; using GeometryTD.Core;
using GeometryTD.Definition;
using UnityGameFramework.Runtime; using UnityGameFramework.Runtime;
namespace GeometryTD.DataTable namespace GeometryTD.Core
{ {
public sealed class DRRarityTagBudget : DataRowBase public sealed class DRRarityTagBudget : DataRowBase
{ {

View File

@ -6,7 +6,7 @@ using System.Text;
using UnityEngine; using UnityEngine;
using UnityGameFramework.Runtime; using UnityGameFramework.Runtime;
namespace GeometryTD.DataTable namespace GeometryTD.Core
{ {
/// <summary> /// <summary>
/// 场景配置表。 /// 场景配置表。

View File

@ -1,8 +1,7 @@
using GeometryTD.CustomUtility; using GeometryTD.Core;
using GeometryTD.Definition;
using UnityGameFramework.Runtime; using UnityGameFramework.Runtime;
namespace GeometryTD.DataTable namespace GeometryTD.Core
{ {
public class DRShopPrice : DataRowBase public class DRShopPrice : DataRowBase
{ {

View File

@ -2,7 +2,7 @@
using System.Text; using System.Text;
using UnityGameFramework.Runtime; using UnityGameFramework.Runtime;
namespace GeometryTD.DataTable namespace GeometryTD.Core
{ {
/// <summary> /// <summary>
/// 声音配置表。 /// 声音配置表。

View File

@ -1,9 +1,8 @@
using System; using System;
using GeometryTD.Definition; using GeometryTD.Core;
using GeometryTD.CustomUtility;
using UnityGameFramework.Runtime; using UnityGameFramework.Runtime;
namespace GeometryTD.DataTable namespace GeometryTD.Core
{ {
/// <summary> /// <summary>
/// Tag 表 /// Tag 表

View File

@ -1,8 +1,7 @@
using GeometryTD.CustomUtility; using GeometryTD.Core;
using GeometryTD.Definition;
using UnityGameFramework.Runtime; using UnityGameFramework.Runtime;
namespace GeometryTD.DataTable namespace GeometryTD.Core
{ {
public sealed class DRTagConfig : DataRowBase public sealed class DRTagConfig : DataRowBase
{ {

View File

@ -2,7 +2,7 @@
using System.Text; using System.Text;
using UnityGameFramework.Runtime; using UnityGameFramework.Runtime;
namespace GeometryTD.DataTable namespace GeometryTD.Core
{ {
/// <summary> /// <summary>
/// 界面配置表。 /// 界面配置表。

View File

@ -16,7 +16,7 @@ using System.Text;
using UnityEngine; using UnityEngine;
using UnityGameFramework.Runtime; using UnityGameFramework.Runtime;
namespace GeometryTD.DataTable namespace GeometryTD.Core
{ {
/// <summary> /// <summary>
/// 声音配置表。 /// 声音配置表。

View File

@ -10,7 +10,7 @@ using System;
using UnityEngine; using UnityEngine;
using UnityGameFramework.Runtime; using UnityGameFramework.Runtime;
namespace GeometryTD.DataTable namespace GeometryTD.Core
{ {
public static class DataTableExtension public static class DataTableExtension
{ {

View File

@ -1,11 +1,8 @@
{ {
"name": "GeometryTD.Runtime", "name": "GeometryTD.Core",
"rootNamespace": "GeometryTD", "rootNamespace": "GeometryTD.Core",
"references": [ "references": [
"UnityGameFramework.Editor", "GUID:363c5eb08ff8e6a439b85e37b8c20d96"
"UnityGameFramework.Runtime",
"Unity.InputSystem",
"Unity.TextMeshPro"
], ],
"includePlatforms": [], "includePlatforms": [],
"excludePlatforms": [], "excludePlatforms": [],

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 771b79705393da244ae720aa28ae8a69
AssemblyDefinitionImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,6 +1,6 @@
using System.Collections.Generic; using System.Collections.Generic;
namespace GeometryTD.Definition namespace GeometryTD.Core
{ {
public enum CombatParticipantTowerValidationFailureReason public enum CombatParticipantTowerValidationFailureReason
{ {

View File

@ -1,4 +1,4 @@
namespace GeometryTD.Definition namespace GeometryTD.Core
{ {
public static class CombatParticipantTowerValidationText public static class CombatParticipantTowerValidationText
{ {

View File

@ -1,8 +1,8 @@
using System; using System;
using GeometryTD.CustomUtility; using GeometryTD.Core;
using UnityEngine; using UnityEngine;
namespace GeometryTD.Definition namespace GeometryTD.Core
{ {
[Serializable] [Serializable]
public sealed class AttackPayload public sealed class AttackPayload

View File

@ -1,7 +1,7 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
namespace GeometryTD.Definition namespace GeometryTD.Core
{ {
/// <summary> /// <summary>
/// 玩家背包聚合数据。 /// 玩家背包聚合数据。

View File

@ -5,7 +5,7 @@
// Feedback: mailto:ellan@gameframework.cn // Feedback: mailto:ellan@gameframework.cn
//------------------------------------------------------------ //------------------------------------------------------------
namespace GeometryTD.Definition namespace GeometryTD.Core
{ {
public class BuildInfo public class BuildInfo
{ {

View File

@ -1,4 +1,4 @@
namespace GeometryTD.Definition namespace GeometryTD.Core
{ {
public class EventItem public class EventItem
{ {

View File

@ -1,4 +1,4 @@
namespace GeometryTD.Definition namespace GeometryTD.Core
{ {
public class EventOption public class EventOption
{ {

View File

@ -1,8 +1,7 @@
using System; using System;
using GeometryTD.Entity;
using UnityEngine; using UnityEngine;
namespace GeometryTD.Definition namespace GeometryTD.Core
{ {
[Serializable] [Serializable]
public sealed class HitStatusModifierContext public sealed class HitStatusModifierContext

View File

@ -1,6 +1,6 @@
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
namespace GeometryTD.Definition namespace GeometryTD.Core
{ {
[StructLayout(LayoutKind.Auto)] [StructLayout(LayoutKind.Auto)]
public struct ImpactData public struct ImpactData

View File

@ -1,6 +1,6 @@
using System; using System;
namespace GeometryTD.Definition namespace GeometryTD.Core
{ {
/// <summary> /// <summary>
/// 背包内组件实例基类(非 DataTable表示玩家持有物 /// 背包内组件实例基类(非 DataTable表示玩家持有物

View File

@ -2,7 +2,7 @@ using System;
using Newtonsoft.Json; using Newtonsoft.Json;
using UnityEngine; using UnityEngine;
namespace GeometryTD.Definition namespace GeometryTD.Core
{ {
/// <summary> /// <summary>
/// 背包内防御塔实例数据。 /// 背包内防御塔实例数据。

View File

@ -1,6 +1,6 @@
using System; using System;
namespace GeometryTD.Definition namespace GeometryTD.Core
{ {
/// <summary> /// <summary>
/// 防御塔独立属性快照。 /// 防御塔独立属性快照。

View File

@ -1,4 +1,4 @@
namespace GeometryTD.Definition namespace GeometryTD.Core
{ {
public class VersionInfo public class VersionInfo
{ {

View File

@ -1,4 +1,4 @@
namespace GeometryTD.Definition namespace GeometryTD.Core
{ {
public enum AttackMethodType : byte public enum AttackMethodType : byte
{ {

View File

@ -1,4 +1,4 @@
namespace GeometryTD.Definition namespace GeometryTD.Core
{ {
public enum AttackPropertyType : byte public enum AttackPropertyType : byte
{ {

View File

@ -1,4 +1,4 @@
namespace GeometryTD.Definition namespace GeometryTD.Core
{ {
/// <summary> /// <summary>
/// 阵营类型。 /// 阵营类型。

View File

@ -1,4 +1,4 @@
namespace GeometryTD.UI namespace GeometryTD.Core
{ {
public enum CombatSelectActionType : byte public enum CombatSelectActionType : byte
{ {

View File

@ -1,4 +1,4 @@
namespace GeometryTD.Definition namespace GeometryTD.Core
{ {
/// <summary> /// <summary>
/// 出怪条目类型 /// 出怪条目类型

View File

@ -1,4 +1,4 @@
namespace GeometryTD.Definition namespace GeometryTD.Core
{ {
public enum EventEffectType public enum EventEffectType
{ {

View File

@ -1,4 +1,4 @@
namespace GeometryTD.Definition namespace GeometryTD.Core
{ {
public enum EventRequirementType public enum EventRequirementType
{ {

View File

@ -1,4 +1,4 @@
namespace GeometryTD.Definition namespace GeometryTD.Core
{ {
public enum InventoryTagSourceType : byte public enum InventoryTagSourceType : byte
{ {

View File

@ -1,4 +1,4 @@
namespace GeometryTD.Definition namespace GeometryTD.Core
{ {
public enum LevelThemeType public enum LevelThemeType
{ {

View File

@ -1,4 +1,4 @@
namespace GeometryTD.Definition namespace GeometryTD.Core
{ {
public enum LevelVictoryType public enum LevelVictoryType
{ {

View File

@ -1,4 +1,4 @@
namespace GeometryTD.Definition namespace GeometryTD.Core
{ {
/// <summary> /// <summary>
/// 关卡阶段结束类型 /// 关卡阶段结束类型

View File

@ -1,4 +1,4 @@
namespace GeometryTD.Definition namespace GeometryTD.Core
{ {
public enum ProcedureMainCombatEntryBlockReason public enum ProcedureMainCombatEntryBlockReason
{ {

View File

@ -1,4 +1,4 @@
namespace GeometryTD.Definition namespace GeometryTD.Core
{ {
public enum ProcedureMainFlowPhase public enum ProcedureMainFlowPhase
{ {

View File

@ -1,4 +1,4 @@
namespace GeometryTD.Definition namespace GeometryTD.Core
{ {
public enum ProcedureMainRunAdvanceResult public enum ProcedureMainRunAdvanceResult
{ {

View File

@ -1,4 +1,4 @@
namespace GeometryTD.Definition namespace GeometryTD.Core
{ {
public enum ProcedureMainRunCompletionResult public enum ProcedureMainRunCompletionResult
{ {

View File

@ -1,4 +1,4 @@
namespace GeometryTD.Definition namespace GeometryTD.Core
{ {
public enum RarityType public enum RarityType
{ {

View File

@ -1,4 +1,4 @@
namespace GeometryTD.Definition namespace GeometryTD.Core
{ {
/// <summary> /// <summary>
/// 关系类型。 /// 关系类型。

View File

@ -1,4 +1,4 @@
namespace GeometryTD.Definition namespace GeometryTD.Core
{ {
public enum RepoItemClickActionType public enum RepoItemClickActionType
{ {

View File

@ -1,4 +1,4 @@
namespace GeometryTD.Definition namespace GeometryTD.Core
{ {
public enum SceneType : byte public enum SceneType : byte
{ {

View File

@ -1,4 +1,4 @@
namespace GeometryTD.Definition namespace GeometryTD.Core
{ {
public enum TagCategory : byte public enum TagCategory : byte
{ {

View File

@ -1,4 +1,4 @@
namespace GeometryTD.Definition namespace GeometryTD.Core
{ {
public enum TagTriggerPhase : byte public enum TagTriggerPhase : byte
{ {

View File

@ -1,4 +1,4 @@
namespace GeometryTD.Definition namespace GeometryTD.Core
{ {
public enum TagType : byte public enum TagType : byte
{ {

View File

@ -1,4 +1,4 @@
namespace GeometryTD.Definition namespace GeometryTD.Core
{ {
public enum TowerCompSlotType : byte public enum TowerCompSlotType : byte
{ {

View File

@ -1,4 +1,4 @@
namespace GeometryTD.Definition namespace GeometryTD.Core
{ {
/// <summary> /// <summary>
/// 界面编号。 /// 界面编号。

View File

@ -1,4 +1,4 @@
namespace GeometryTD.Definition namespace GeometryTD.Core
{ {
public class AddGoldEffect : EventEffectBase public class AddGoldEffect : EventEffectBase
{ {

View File

@ -1,4 +1,4 @@
namespace GeometryTD.Definition namespace GeometryTD.Core
{ {
public class AddRandomCompsEffect : EventEffectBase public class AddRandomCompsEffect : EventEffectBase
{ {

View File

@ -1,4 +1,4 @@
namespace GeometryTD.Definition namespace GeometryTD.Core
{ {
public class DamageRandomTowerEnduranceEffect : EventEffectBase public class DamageRandomTowerEnduranceEffect : EventEffectBase
{ {

View File

@ -1,4 +1,4 @@
namespace GeometryTD.Definition namespace GeometryTD.Core
{ {
public abstract class EventEffectBase public abstract class EventEffectBase
{ {

View File

@ -1,4 +1,4 @@
namespace GeometryTD.Definition namespace GeometryTD.Core
{ {
public class RemoveRandomCompsEffect : EventEffectBase public class RemoveRandomCompsEffect : EventEffectBase
{ {

View File

@ -1,12 +1,21 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using GeometryTD.CustomComponent;
using GeometryTD.CustomUtility;
using GeometryTD.Procedure;
using UnityEngine; using UnityEngine;
namespace GeometryTD.Definition namespace GeometryTD.Core
{ {
public sealed class EventOptionExecutionContext
{
public EventOptionExecutionContext(int runSeed, int sequenceIndex)
{
RunSeed = runSeed;
SequenceIndex = sequenceIndex;
}
public int RunSeed { get; }
public int SequenceIndex { get; }
}
public sealed class EventOptionExecutor public sealed class EventOptionExecutor
{ {
public EventOptionAvailability EvaluateOption(EventOption option, BackpackInventoryData inventory) public EventOptionAvailability EvaluateOption(EventOption option, BackpackInventoryData inventory)
@ -37,7 +46,7 @@ namespace GeometryTD.Definition
public EventOptionExecutionResult Execute( public EventOptionExecutionResult Execute(
EventItem eventItem, EventItem eventItem,
int optionIndex, int optionIndex,
RunNodeExecutionContext context, EventOptionExecutionContext context,
BackpackInventoryData workingInventory) BackpackInventoryData workingInventory)
{ {
if (eventItem == null || workingInventory == null) if (eventItem == null || workingInventory == null)
@ -72,7 +81,7 @@ namespace GeometryTD.Definition
EventEffectBase[] effects, EventEffectBase[] effects,
EventItem eventItem, EventItem eventItem,
int optionIndex, int optionIndex,
RunNodeExecutionContext context, EventOptionExecutionContext context,
BackpackInventoryData workingInventory, BackpackInventoryData workingInventory,
bool isRewardPhase) bool isRewardPhase)
{ {
@ -143,7 +152,7 @@ namespace GeometryTD.Definition
RemoveRandomCompsParam param, RemoveRandomCompsParam param,
int eventId, int eventId,
int optionIndex, int optionIndex,
RunNodeExecutionContext context, EventOptionExecutionContext context,
BackpackInventoryData workingInventory, BackpackInventoryData workingInventory,
int effectIndex) int effectIndex)
{ {
@ -171,7 +180,7 @@ namespace GeometryTD.Definition
AddRandomCompsParam param, AddRandomCompsParam param,
int eventId, int eventId,
int optionIndex, int optionIndex,
RunNodeExecutionContext context, EventOptionExecutionContext context,
BackpackInventoryData workingInventory, BackpackInventoryData workingInventory,
int effectIndex) int effectIndex)
{ {
@ -181,12 +190,12 @@ namespace GeometryTD.Definition
return; return;
} }
if (GameEntry.InventoryGeneration == null) if (CoreServiceHub.InventoryGeneration == null)
{ {
throw new InvalidOperationException("Event component generation requires InventoryGenerationComponent."); throw new InvalidOperationException("Event component generation requires InventoryGenerationComponent.");
} }
IReadOnlyList<TowerCompItemData> generatedComponents = GameEntry.InventoryGeneration.BuildEventRewardComponents( IReadOnlyList<TowerCompItemData> generatedComponents = CoreServiceHub.InventoryGeneration.BuildEventRewardComponents(
addCount, addCount,
param.MinRarity, param.MinRarity,
param.MaxRarity, param.MaxRarity,
@ -205,7 +214,7 @@ namespace GeometryTD.Definition
DamageRandomTowerEnduranceParam param, DamageRandomTowerEnduranceParam param,
int eventId, int eventId,
int optionIndex, int optionIndex,
RunNodeExecutionContext context, EventOptionExecutionContext context,
BackpackInventoryData workingInventory, BackpackInventoryData workingInventory,
int effectIndex) int effectIndex)
{ {
@ -272,7 +281,7 @@ namespace GeometryTD.Definition
} }
} }
private static bool RollProbability(int eventId, int optionIndex, RunNodeExecutionContext context, float probability) private static bool RollProbability(int eventId, int optionIndex, EventOptionExecutionContext context, float probability)
{ {
float clampedProbability = Mathf.Clamp01(probability); float clampedProbability = Mathf.Clamp01(probability);
if (clampedProbability >= 1f) if (clampedProbability >= 1f)
@ -290,7 +299,7 @@ namespace GeometryTD.Definition
} }
private static System.Random CreateRandom( private static System.Random CreateRandom(
RunNodeExecutionContext context, EventOptionExecutionContext context,
int eventId, int eventId,
int optionIndex, int optionIndex,
int effectIndex, int effectIndex,

View File

@ -1,4 +1,4 @@
namespace GeometryTD.Definition namespace GeometryTD.Core
{ {
public class CompCountAtLeastRequirement : EventRequirementBase public class CompCountAtLeastRequirement : EventRequirementBase
{ {

View File

@ -1,4 +1,4 @@
namespace GeometryTD.Definition namespace GeometryTD.Core
{ {
public abstract class EventRequirementBase public abstract class EventRequirementBase
{ {

View File

@ -1,4 +1,4 @@
namespace GeometryTD.Definition namespace GeometryTD.Core
{ {
public class GoldAtLeastRequirement : EventRequirementBase public class GoldAtLeastRequirement : EventRequirementBase
{ {

View File

@ -1,4 +1,4 @@
namespace GeometryTD.Definition namespace GeometryTD.Core
{ {
public class HasRelicRequirement : EventRequirementBase public class HasRelicRequirement : EventRequirementBase
{ {

View File

@ -1,4 +1,4 @@
namespace GeometryTD.Definition namespace GeometryTD.Core
{ {
public class TowerCountAtLeastRequirement : EventRequirementBase public class TowerCountAtLeastRequirement : EventRequirementBase
{ {

View File

@ -0,0 +1,3 @@
{
"reference": "GUID:771b79705393da244ae720aa28ae8a69"
}

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: f6496f38c28361745bf703b0dc338bc3
AssemblyDefinitionReferenceImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,6 +1,6 @@
using UnityEngine; using UnityEngine;
namespace GeometryTD.Definition namespace GeometryTD.Core
{ {
public static class InventoryRarityRuleService public static class InventoryRarityRuleService
{ {

View File

@ -1,4 +1,4 @@
namespace GeometryTD.Definition namespace GeometryTD.Core
{ {
public enum ParticipantTowerAssignFailureReason public enum ParticipantTowerAssignFailureReason
{ {

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 9aeb92ccac2068f489dcbd0200417463
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,31 @@
using System;
namespace GeometryTD.Core
{
public static class CoreServiceHub
{
public static IPlayerInventoryManager PlayerInventory { get; private set; }
public static IInventoryGenerationManager InventoryGeneration { get; private set; }
public static IEventFlowManager EventFlow { get; private set; }
public static ISpriteCacheService SpriteCache { get; private set; }
public static IStaticDataService StaticData { get; private set; }
public static ITextService TextService { get; private set; }
public static void Bind(
IPlayerInventoryManager playerInventory,
IInventoryGenerationManager inventoryGeneration,
IEventFlowManager eventFlow,
ISpriteCacheService spriteCache,
IStaticDataService staticData,
ITextService textService)
{
PlayerInventory = playerInventory ?? throw new ArgumentNullException(nameof(playerInventory));
InventoryGeneration = inventoryGeneration ?? throw new
ArgumentNullException(nameof(inventoryGeneration));
EventFlow = eventFlow ?? throw new ArgumentNullException(nameof(eventFlow));
SpriteCache = spriteCache ?? throw new ArgumentNullException(nameof(spriteCache));
StaticData = staticData ?? throw new ArgumentNullException(nameof(staticData));
TextService = textService ?? throw new ArgumentNullException(nameof(textService));
}
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 95f8a75dcf78e4545b36f1e24b92d82e
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,7 @@
namespace GeometryTD.Core
{
public interface IEventFlowManager
{
void EndEvent();
}
}

Some files were not shown because too many files have changed in this diff Show More