51 lines
1.1 KiB
C#
51 lines
1.1 KiB
C#
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 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);
|
|
}
|
|
}
|
|
} |