88 lines
3.3 KiB
C#
88 lines
3.3 KiB
C#
using UnityEditor;
|
|
using UnityEngine;
|
|
|
|
|
|
// Base class for Build method fo
|
|
// - SceneChestManager
|
|
// - SceneEquippableItemManager
|
|
public abstract class SceneDataListManager<T> : DataListManager<T>
|
|
{
|
|
private readonly string gameObjectLocalization;
|
|
private readonly string assetLocalization;
|
|
|
|
protected SceneDataListManager(string gameObjectLocalization, string assetLocalization)
|
|
{
|
|
this.gameObjectLocalization = gameObjectLocalization;
|
|
this.assetLocalization = assetLocalization;
|
|
}
|
|
|
|
// public override void Build()
|
|
// {
|
|
// foreach(var prefabAsset in Elements)
|
|
// {
|
|
//
|
|
// GameObject newObject = (GameObject)AssetDatabase.LoadAssetAtPath(gameObjectLocalization + prefabAsset.prefarbAssetName + ".prefab", typeof(GameObject));
|
|
//
|
|
// if(!newObject)
|
|
// {
|
|
// Debug.Log("Can't find prefarb by name " + prefabAsset.prefarbAssetName);
|
|
// break;
|
|
// }
|
|
//
|
|
//
|
|
// GameObject globalGUI = GameObject.FindGameObjectsWithTag("GUI")[0];
|
|
//
|
|
// if(globalGUI)
|
|
// {
|
|
// // 1. Create gameObject by handled prefab
|
|
// // 2. SetUp
|
|
// // 2.1 Set position
|
|
// GameObject _object = Instantiate(newObject, prefabAsset.position, Quaternion.identity, globalGUI.transform);
|
|
//
|
|
// // 2.2 Set name
|
|
// _object.name = prefabAsset.name;
|
|
//
|
|
// //chest.transform.SetParent(globalGUI.transform);
|
|
// // 2.3 Set pransform
|
|
// _object.transform.localScale = new Vector3(0.5f, 0.5f, 1);
|
|
//
|
|
//
|
|
// doBuild(_object);
|
|
// // // 3. SetUp EqippableItems list
|
|
// // Dictionary<int, EquippableItemPrefabAsset> itemsOfChestList = prefabAsset.content;
|
|
// //
|
|
// // string[] assetNames = AssetDatabase.FindAssets("t:EquippableItem", new[] { assetLocalization });
|
|
// //
|
|
// // foreach(KeyValuePair<int, EquippableItemPrefabAsset> itemsOfChestEntry in itemsOfChestList)
|
|
// // {
|
|
// // // 3.1 find object
|
|
// // foreach (string SOName in assetNames)
|
|
// // {
|
|
// // var SOpath = AssetDatabase.GUIDToAssetPath(SOName);
|
|
// //
|
|
// // if(SOpath.Contains(itemsOfChestEntry.Value.prefarbAssetName + ".asset"))
|
|
// // {
|
|
// // // 3.2 set EquippableItem object
|
|
// // chest.GetComponent<ChestController>().SetupItemInChest(
|
|
// // itemsOfChestEntry.Key,
|
|
// // AssetDatabase.LoadAssetAtPath<EquippableItem>(SOpath)
|
|
// // );
|
|
// //
|
|
// // break;
|
|
// // }
|
|
// // }
|
|
// // }
|
|
//
|
|
//
|
|
//
|
|
//
|
|
// } else {
|
|
// Debug.LogError("Can't find global GUI object!!!");
|
|
// break;
|
|
// }
|
|
// }
|
|
// }
|
|
|
|
protected abstract void doBuild(GameObject _object);
|
|
}
|