Files
whale-town-front/_Core/ProjectPaths.gd
moyin 7a6e5be4f8 config:更新核心配置支持网格系统
- EventNames添加网格相关事件定义
- ProjectPaths添加网格系统和地形资源路径
2026-01-03 22:28:29 +08:00

118 lines
4.7 KiB
GDScript

# ============================================================================
# 项目路径配置 - ProjectPaths.gd
#
# 统一管理项目中所有路径常量,确保路径的一致性和可维护性
#
# 使用方式:
# var scene_path = ProjectPaths.SCENES_COMPONENTS + "ui/Button.tscn"
# var config_path = ProjectPaths.DATA_CONFIG + "game_config.json"
# ============================================================================
class_name ProjectPaths
# ============================================================================
# 核心系统路径
# ============================================================================
const CORE_ROOT = "res://_Core/"
const CORE_MANAGERS = CORE_ROOT + "managers/"
const CORE_SYSTEMS = CORE_ROOT + "systems/"
const CORE_COMPONENTS = CORE_ROOT + "components/"
const CORE_UTILS = CORE_ROOT + "utils/"
# 系统文件路径
const GRID_SYSTEM = CORE_SYSTEMS + "GridSystem.gd"
const EVENT_SYSTEM = CORE_SYSTEMS + "EventSystem.gd"
const TILE_SYSTEM = CORE_SYSTEMS + "TileSystem.gd"
# ============================================================================
# 场景路径
# ============================================================================
const SCENES_ROOT = "res://scenes/"
const SCENES_MAPS = SCENES_ROOT + "Maps/"
const SCENES_COMPONENTS = SCENES_ROOT + "Components/"
const SCENES_UI_COMPONENTS = SCENES_COMPONENTS + "ui/"
const SCENES_CHARACTER_COMPONENTS = SCENES_COMPONENTS + "characters/"
const SCENES_EFFECT_COMPONENTS = SCENES_COMPONENTS + "effects/"
const SCENES_ITEM_COMPONENTS = SCENES_COMPONENTS + "items/"
# ============================================================================
# UI路径
# ============================================================================
const UI_ROOT = "res://scenes/ui/"
const UI_WINDOWS = UI_ROOT
# ============================================================================
# 资源路径
# ============================================================================
const ASSETS_ROOT = "res://assets/"
const ASSETS_SPRITES = ASSETS_ROOT + "sprites/"
const ASSETS_AUDIO = ASSETS_ROOT + "audio/"
const ASSETS_FONTS = ASSETS_ROOT + "fonts/"
const ASSETS_MATERIALS = ASSETS_ROOT + "materials/"
const ASSETS_SHADERS = ASSETS_ROOT + "shaders/"
# 地形资源路径
const ASSETS_TERRAIN = ASSETS_SPRITES + "terrain/"
const ASSETS_GRASS = ASSETS_TERRAIN + "grass/"
# ============================================================================
# 数据路径
# ============================================================================
const DATA_ROOT = "res://data/"
const DATA_CONFIG = "res://Config/"
const DATA_SCENES = DATA_ROOT + "scenes/"
const DATA_LEVELS = DATA_ROOT + "levels/"
const DATA_DIALOGUES = DATA_ROOT + "dialogues/"
# ============================================================================
# Web资源路径
# ============================================================================
const WEB_ASSETS = "res://web_assets/"
# ============================================================================
# 测试路径
# ============================================================================
const TESTS_ROOT = "res://tests/"
const TESTS_UNIT = TESTS_ROOT + "unit/"
const TESTS_INTEGRATION = TESTS_ROOT + "integration/"
const TESTS_AUTH = TESTS_ROOT + "auth/"
# ============================================================================
# 工具路径
# ============================================================================
const UTILS_ROOT = "res://_Core/utils/"
# ============================================================================
# 模块路径
# ============================================================================
const MODULES_ROOT = "res://module/"
# ============================================================================
# 辅助方法
# ============================================================================
# 获取场景组件路径
static func get_component_path(category: String, component_name: String) -> String:
match category:
"ui":
return SCENES_UI_COMPONENTS + component_name + ".tscn"
"characters":
return SCENES_CHARACTER_COMPONENTS + component_name + ".tscn"
"effects":
return SCENES_EFFECT_COMPONENTS + component_name + ".tscn"
"items":
return SCENES_ITEM_COMPONENTS + component_name + ".tscn"
_:
return SCENES_COMPONENTS + component_name + ".tscn"
# 获取模块路径
static func get_module_path(module_name: String) -> String:
return MODULES_ROOT + module_name + "/"
# 获取模块配置路径
static func get_module_config_path(module_name: String) -> String:
return get_module_path(module_name) + "data/module_config.json"
# 获取场景数据路径
static func get_scene_data_path(scene_name: String) -> String:
return DATA_SCENES + scene_name.to_lower() + ".json"