Browse Source

架构更新

wuzj 2 months ago
parent
commit
100a1e1177
1 changed files with 74 additions and 6 deletions
  1. 74 6
      README.md

+ 74 - 6
README.md

@@ -1,9 +1,16 @@
 Metaverse_Studio
 ├── Config                          # 配置文件目录:存放 JSON/CSV 配置文件
-│   ├── DefaultEventConfig.json     # 默认事件配置文件,用于配置 LevelSequence 的逻辑
-│   ├── DefaultRoomConfig.json      # 房间配置文件,定义物理房间与虚拟房间的映射关系
-│   ├── DefaultVersionConfig.json   # 版本管理配置,支持多场地差异化部署
-│   └── ...
+│   ├── LBERoom                     # 大空间房间配置文件目录
+│   │   ├── SIPSG.json              # 示例:SIPSG这个空间的房间配置文件
+│   │   └── Gusu.json               # 示例:Gusu这个空间的房间配置文件
+│   ├── EventTable                  # 策划事件
+│   │   ├── TigerHill.json          # 示例:虎丘秘境策划表
+│   │   └── Gusu.json               # 示例:姑苏繁华策划表
+│   ├── MovePath                    # 动线管理
+│   │   ├── SIPSG.json              # 示例:SIPSG这个空间的动线
+│   │   └── Gusu.json               # 示例:Gusu这个空间的动线
+│   └── Global
+│   │   └── Global.ini              # 示例:全局配置
 ├── Content                         # 插件内置资源目录:存放插件自带的素材或UI资源
 │   ├── UI                          # 工具界面的图标或样式资源
 │   │   └── Icon128.png             # 示例:图标资源
@@ -78,7 +85,32 @@ public:
     virtual void OnStart() override;
 };
 
-1. 模块管理系统
+2. 模块管理系统
+// ModuleBase.h
+#pragma once
+
+#include "CoreMinimal.h"
+
+// 模块接口
+class IMetaverseModule
+{
+public:
+    virtual ~IMetaverseModule() {}
+
+    virtual void Initialize() = 0; // 初始化
+    virtual void Shutdown() = 0;   // 销毁
+    virtual FString GetModuleName() const = 0; // 获取模块名称
+};
+
+// 模块基类
+class FMetaverseModuleBase : public IMetaverseModule
+{
+public:
+    virtual void Initialize() override {}
+    virtual void Shutdown() override {}
+    virtual FString GetModuleName() const override { return TEXT("BaseModule"); }
+};
+
 // 模块基类(抽象接口)
 UCLASS(Abstract)
 class IModuleBase : public UObject {
@@ -133,4 +165,40 @@ private:
     
     // Protobuf序列化工具
     TSharedPtr<FProtoSerializer> ProtoSerializer;
-};
+};
+
+4. 配置管理器,config作为模板,运行时拷贝
+#include "Misc/Paths.h"
+#include "HAL/FileManager.h"
+#include "Misc/FileHelper.h"
+
+void CopyDefaultConfigIfNeeded()
+{
+    // 插件默认配置路径
+    FString DefaultConfigPath = FPaths::Combine(FPaths::ProjectPluginsDir(), TEXT("Metaverse_Studio/Config/"));
+
+    // 游戏运行目录下的配置路径
+    FString RuntimeConfigPath = FPaths::Combine(FPaths::ProjectSavedDir(), TEXT("Config/Metaverse_Studio/"));
+
+    // 确保运行目录存在
+    IFileManager::Get().MakeDirectory(*RuntimeConfigPath, true);
+
+    // 遍历插件目录中的默认配置文件
+    TArray<FString> ConfigFiles;
+    IFileManager::Get().FindFiles(ConfigFiles, *DefaultConfigPath, TEXT("*.json"));
+
+    for (const FString& ConfigFile : ConfigFiles)
+    {
+        FString DefaultFilePath = FPaths::Combine(DefaultConfigPath, ConfigFile);
+        FString RuntimeFilePath = FPaths::Combine(RuntimeConfigPath, ConfigFile);
+
+        // 如果运行目录中不存在该配置文件,则复制
+        if (!FPaths::FileExists(RuntimeFilePath))
+        {
+            FFileHelper::CopyFile(*RuntimeFilePath, *DefaultFilePath);
+        }
+    }
+}
+
+全局配置 - ini
+逻辑配置 - json