Scriptum/Assets/Scripts/REFACTORING/Application/Shared/Manager/Panel/SceneDataListManager.cs

88 lines
3.3 KiB
C#
Raw Normal View History

2022-10-22 18:04:21 +02:00
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
2022-11-06 21:34:17 +01:00
// // Dictionary<int, EquippableItemPrefabAsset> itemsOfChestList = prefabAsset.content;
2022-10-22 18:04:21 +02:00
// //
// // string[] assetNames = AssetDatabase.FindAssets("t:EquippableItem", new[] { assetLocalization });
// //
2022-11-06 21:34:17 +01:00
// // foreach(KeyValuePair<int, EquippableItemPrefabAsset> itemsOfChestEntry in itemsOfChestList)
2022-10-22 18:04:21 +02:00
// // {
// // // 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);
}