37 lines
998 B
C#
37 lines
998 B
C#
|
using System.Collections;
|
||
|
using System.Collections.Generic;
|
||
|
using UnityEngine;
|
||
|
using Sirenix.OdinInspector;
|
||
|
using System.IO;
|
||
|
using Cysharp.Threading.Tasks;
|
||
|
namespace BITKit
|
||
|
{
|
||
|
public abstract class Exec : SerializedMonoBehaviour, IAction
|
||
|
{
|
||
|
public void Excute()
|
||
|
{
|
||
|
try
|
||
|
{
|
||
|
foreach (var file in GetFiles())
|
||
|
{
|
||
|
if (file.Extension is ".json")
|
||
|
{
|
||
|
BIT4Log.Log<AutoExec>($"正在加载配置文件:{file.Name}");
|
||
|
var json = File.ReadAllText(file.FullName);
|
||
|
DataParser.Set(json);
|
||
|
Data.Set(file.Name, json);
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
catch (System.Exception e)
|
||
|
{
|
||
|
BIT4Log.LogException(e);
|
||
|
}
|
||
|
}
|
||
|
public abstract FileInfo[] GetFiles();
|
||
|
void Start()
|
||
|
{
|
||
|
Excute();
|
||
|
}
|
||
|
}
|
||
|
}
|