- 添加对话表结构
- 调整部分类的命名空间 - 引入 EnumUtility 用于string与enum的转换
This commit is contained in:
@@ -7,7 +7,7 @@
|
||||
|
||||
using GameFramework;
|
||||
|
||||
namespace StarForce
|
||||
namespace CustomUtility
|
||||
{
|
||||
public static class AssetUtility
|
||||
{
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
using System.Collections.Generic;
|
||||
using UnityGameFramework.Runtime;
|
||||
|
||||
namespace CustomUtility
|
||||
{
|
||||
public static class EnumUtility<T> where T : struct, System.Enum
|
||||
{
|
||||
private static readonly Dictionary<string, T> _enumCache = new();
|
||||
|
||||
public static T Get(string value)
|
||||
{
|
||||
if (!_enumCache.TryGetValue(value, out T result))
|
||||
{
|
||||
if (System.Enum.TryParse(value, true, out result))
|
||||
{
|
||||
_enumCache[value] = result;
|
||||
}
|
||||
else
|
||||
{
|
||||
Log.Error($"Enum 解析失败:类型:{typeof(T).Name} 不包含值 {value}");
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d0591e8f95955014f8c2f8d9ba3c9247
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -9,7 +9,7 @@ using GameFramework;
|
||||
using LitJson;
|
||||
using System;
|
||||
|
||||
namespace StarForce
|
||||
namespace CustomUtility
|
||||
{
|
||||
/// <summary>
|
||||
/// LitJSON 函数集辅助器。
|
||||
|
||||
@@ -1,13 +1,6 @@
|
||||
//------------------------------------------------------------
|
||||
// Game Framework
|
||||
// Copyright © 2013-2021 Jiang Yin. All rights reserved.
|
||||
// Homepage: https://gameframework.cn/
|
||||
// Feedback: mailto:ellan@gameframework.cn
|
||||
//------------------------------------------------------------
|
||||
using System;
|
||||
|
||||
using System;
|
||||
|
||||
namespace StarForce
|
||||
namespace CustomUtility
|
||||
{
|
||||
public static class WebUtility
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user