表格重构
This commit is contained in:
53
Assets/Scripts/Configs~/Mem/ConfigBase.cs
Normal file
53
Assets/Scripts/Configs~/Mem/ConfigBase.cs
Normal file
@@ -0,0 +1,53 @@
|
||||
using System;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using UnityEngine;
|
||||
using Object = UnityEngine.Object;
|
||||
|
||||
namespace NBF
|
||||
{
|
||||
public interface IConfigJsonParse
|
||||
{
|
||||
void Parse(JToken row);
|
||||
}
|
||||
|
||||
public interface ICustomParse
|
||||
{
|
||||
void Parse(JToken row);
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
public abstract class ConfigBase
|
||||
{
|
||||
public string name;
|
||||
|
||||
public int id;
|
||||
}
|
||||
|
||||
public abstract class ConfigGearBase : ConfigBase
|
||||
{
|
||||
public string modelPath = "Models/Rods/";
|
||||
|
||||
protected virtual string ModelRoot => "gfx/";
|
||||
|
||||
/// <summary>
|
||||
/// 所属的组
|
||||
/// </summary>
|
||||
public int group;
|
||||
|
||||
public GameObject GetModelPrefab()
|
||||
{
|
||||
return Resources.Load(ModelRoot + modelPath) as GameObject;
|
||||
}
|
||||
|
||||
public GameObject Instantiate(Transform parent)
|
||||
{
|
||||
return Object.Instantiate(GetModelPrefab(), Vector3.zero, Quaternion.identity, parent);
|
||||
}
|
||||
|
||||
public GameObject Instantiate(Transform parent, Vector3 position,
|
||||
Quaternion rotation)
|
||||
{
|
||||
return Object.Instantiate(GetModelPrefab(), position, rotation, parent);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user