Compare commits
2 Commits
3df2a3ee2c
...
5220b634ec
Author | SHA1 | Date | |
---|---|---|---|
5220b634ec | |||
21c49ac96b |
@ -319,7 +319,7 @@ GameObject:
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
m_IsActive: 0
|
||||
--- !u!4 &912467178
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
@ -616,6 +616,7 @@ GameObject:
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 1371068282}
|
||||
- component: {fileID: 1371068283}
|
||||
m_Layer: 0
|
||||
m_Name: Loader
|
||||
m_TagString: Untagged
|
||||
@ -638,6 +639,18 @@ Transform:
|
||||
m_Children: []
|
||||
m_Father: {fileID: 0}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!114 &1371068283
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1371068281}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 147e91e6929d90a4fb877c0b0a6b608c, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
--- !u!1660057539 &9223372036854775807
|
||||
SceneRoots:
|
||||
m_ObjectHideFlags: 0
|
||||
|
@ -160,27 +160,25 @@ namespace Configs
|
||||
|
||||
foreach (var path in paths)
|
||||
{
|
||||
// 获取程序所在的目录路径
|
||||
var appDirectory = AppDomain.CurrentDomain.BaseDirectory;
|
||||
|
||||
// 构建目标目录的完整路径
|
||||
var dataDirectory = Path.Combine(appDirectory, path);
|
||||
|
||||
try
|
||||
{
|
||||
// 检查目录是否存在
|
||||
if (Directory.Exists(dataDirectory))
|
||||
if (!Directory.Exists(path))
|
||||
{
|
||||
// 获取目录下的所有子文件夹
|
||||
var subDirectories = Directory.GetDirectories(dataDirectory);
|
||||
|
||||
// 遍历并收集每个子文件夹中的 XML 文件
|
||||
foreach (var dir in subDirectories)
|
||||
{
|
||||
var xmlFiles = Directory.GetFiles(dir, "*.xml", SearchOption.AllDirectories);
|
||||
xmlFilePaths.AddRange(xmlFiles);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
// 获取目录下的所有子文件夹
|
||||
var subDirectories = Directory.GetDirectories(path);
|
||||
|
||||
// 遍历并收集每个子文件夹中的 XML 文件
|
||||
foreach (var dir in subDirectories)
|
||||
{
|
||||
var xmlFiles = Directory.GetFiles(dir, "*.xml", SearchOption.AllDirectories);
|
||||
xmlFilePaths.AddRange(xmlFiles);
|
||||
}
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
@ -11,15 +11,15 @@ namespace Data
|
||||
{
|
||||
public class PackAbout
|
||||
{
|
||||
public string[] after;
|
||||
public string author;
|
||||
public string[] before;
|
||||
public string description;
|
||||
public string name;
|
||||
public string description;
|
||||
public string author;
|
||||
public string version;
|
||||
public string packID;
|
||||
|
||||
public string[] necessary;
|
||||
public string packID;
|
||||
public string version;
|
||||
public string[] after;
|
||||
public string[] before;
|
||||
|
||||
/// <summary>
|
||||
/// 使用静态方法从 XML 文档创建 PackAbout 实例。
|
||||
@ -123,9 +123,9 @@ namespace Data
|
||||
packID = packAbout.packID;
|
||||
if (aboutXmls.Count > 1) Debug.LogWarning($"{packAbout.name}包拥有多个配置文件,系统选择了加载序的第一个,请避免这种情况");
|
||||
|
||||
var defineXmls = FindDocumentsWithRootName(aboutXmls, "Define");
|
||||
var defineXmls = FindDocumentsWithRootName(packDatas, "Define");
|
||||
// Debug.Log($"Define文件数量{defineXmls.Count}");
|
||||
foreach (var defineXml in defineXmls) LoadDefines(defineXml);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -140,12 +140,15 @@ namespace Data
|
||||
var className = element.Name.ToString();
|
||||
if (string.IsNullOrEmpty(className))
|
||||
continue;
|
||||
// Debug.Log("1");
|
||||
var def = LoadDefineClass(element);
|
||||
if (def == null)
|
||||
continue;
|
||||
// Debug.Log("2");
|
||||
if (!defines.ContainsKey(className))
|
||||
defines.Add(className, new List<Define>());
|
||||
defines[className].Add(def);
|
||||
// Debug.Log($"插入{className},{def.defName}");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -15,12 +15,29 @@ namespace Managers
|
||||
|
||||
public void Init()
|
||||
{
|
||||
var packFolder = Directory.GetDirectories(dataSetFilePath[0]);
|
||||
var packFolder = Configs.ConfigProcessor.GetSubFolders(new(dataSetFilePath));
|
||||
foreach (var folder in packFolder)
|
||||
{
|
||||
var pack = new DefinePack();
|
||||
if (pack.LoadPack(folder)) packs.Add(pack.packID, pack);
|
||||
}
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
if (packs == null || packs.Count == 0)
|
||||
{
|
||||
return "No packs available"; // 如果集合为空或为 null,返回默认信息
|
||||
}
|
||||
|
||||
var result = new System.Text.StringBuilder();
|
||||
|
||||
foreach (var definePack in packs)
|
||||
{
|
||||
result.AppendLine(definePack.ToString()); // 每个元素占一行
|
||||
}
|
||||
|
||||
return result.ToString();
|
||||
}
|
||||
}
|
||||
}
|
@ -5,7 +5,7 @@ namespace Test
|
||||
{
|
||||
public class ClockTest : MonoBehaviour
|
||||
{
|
||||
private static float timer = 0;
|
||||
//private static float timer = 0;
|
||||
|
||||
// Start is called once before the first execution of Update after the MonoBehaviour is created
|
||||
private void Start()
|
||||
|
23
Client/Assets/Scripts/Test/TestDefine.cs
Normal file
@ -0,0 +1,23 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace Test
|
||||
{
|
||||
|
||||
|
||||
public class TestDefine : MonoBehaviour
|
||||
{
|
||||
// Start is called once before the first execution of Update after the MonoBehaviour is created
|
||||
void Start()
|
||||
{
|
||||
Managers.DefineManager.Instance.Init();
|
||||
Debug.Log(Managers.DefineManager.Instance);
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
2
Client/Assets/Scripts/Test/TestDefine.cs.meta
Normal file
@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 147e91e6929d90a4fb877c0b0a6b608c
|
11
Client/Data/Core/About/About.xml
Normal file
@ -0,0 +1,11 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<About>
|
||||
<name>核心</name>
|
||||
<description>这是游戏的核心模块,除非有完整的代替,否则应该永远作为启动项</description>
|
||||
<version>0.1</version>
|
||||
<packID>core</packID>
|
||||
<sort>
|
||||
<before></before>
|
||||
<after></after>
|
||||
</sort>
|
||||
</About>
|
37
Client/Data/Core/Define/Player/CatGirl.xml
Normal file
@ -0,0 +1,37 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<Define><!--表示是游戏数据定义 -->
|
||||
<Attributes><!--定义一个Attributes类型 -->
|
||||
<defName>CatGirl</defName><!--此Attributes的引用名,应该保持唯一(在同一种类型中) -->
|
||||
<health>100</health><!--C#中定义的同名的Attributes类中含有的变量,并对其进行赋值 -->
|
||||
<speed>1.2</speed>
|
||||
<strength>5</strength>
|
||||
</Attributes>
|
||||
|
||||
<Character>
|
||||
<defName>CatGirl</defName>
|
||||
<label>CatGirl</label>
|
||||
<description>She is a cat girl with agile movements and sharp senses.</description>
|
||||
<attributes>CatGirl</attributes>
|
||||
|
||||
<drawingOrder_down>CatGirl_down</drawingOrder_down><!--根据defName引用其他的属性,识别过程是首先根据C#中定义的此变量的类型,再根据名称查找此类型定义的数据块 -->
|
||||
<drawingOrder_left>CatGirl_left</drawingOrder_left>
|
||||
<drawingOrder_right>CatGirl_right</drawingOrder_right>
|
||||
<drawingOrder_up>CatGirl_up</drawingOrder_up>
|
||||
</Character>
|
||||
|
||||
|
||||
<DrawingOrder>
|
||||
<defName>CatGirl_down</defName>
|
||||
<DrawNode name="body">
|
||||
<DrawNode name="head">
|
||||
<DrawNode name="backHair"/>
|
||||
<DrawNode name="ear"/>
|
||||
<DrawNode name="face"/>
|
||||
<DrawNode name="frontHair"/>
|
||||
<DrawNode name="hat"/>
|
||||
</DrawNode>
|
||||
<DrawNode name="clothes"/>
|
||||
</DrawNode>
|
||||
</DrawingOrder>
|
||||
</Define>
|
BIN
Client/Data/Core/Resource/Character/CatGirl/body/east.png
Normal file
After Width: | Height: | Size: 26 KiB |
BIN
Client/Data/Core/Resource/Character/CatGirl/body/north.png
Normal file
After Width: | Height: | Size: 33 KiB |
BIN
Client/Data/Core/Resource/Character/CatGirl/body/south.png
Normal file
After Width: | Height: | Size: 27 KiB |
BIN
Client/Data/Core/Resource/Character/CatGirl/clothing/east.png
Normal file
After Width: | Height: | Size: 32 KiB |
BIN
Client/Data/Core/Resource/Character/CatGirl/clothing/north.png
Normal file
After Width: | Height: | Size: 34 KiB |
BIN
Client/Data/Core/Resource/Character/CatGirl/clothing/south.png
Normal file
After Width: | Height: | Size: 38 KiB |
After Width: | Height: | Size: 36 KiB |
After Width: | Height: | Size: 44 KiB |
After Width: | Height: | Size: 37 KiB |
After Width: | Height: | Size: 16 KiB |
After Width: | Height: | Size: 2.1 KiB |
After Width: | Height: | Size: 40 KiB |
After Width: | Height: | Size: 22 KiB |
After Width: | Height: | Size: 26 KiB |
After Width: | Height: | Size: 21 KiB |
After Width: | Height: | Size: 6.9 KiB |
After Width: | Height: | Size: 8.0 KiB |
After Width: | Height: | Size: 8.4 KiB |
After Width: | Height: | Size: 8.4 KiB |
After Width: | Height: | Size: 6.6 KiB |
After Width: | Height: | Size: 8.3 KiB |
6
Client/Data/Core/Translation/Replace/Character.xml
Normal file
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<Translation>
|
||||
<Character.CatGirl.label>猫娘</Character.CatGirl.label>
|
||||
<Character.CatGirl.description>她是一个猫娘,拥有猫的特性和人类的智慧。她的耳朵和尾巴显示了她的猫族血统。</Character.CatGirl.description>
|
||||
</Translation>
|