using System.Collections; using System.Collections.Generic; using UnityEngine; using XRTool.Util; public class ItemSenceList : UnitySingleton { public GameObject ItemSence; public GameObject CreateSenceBtn; public void Init(List scenes, SceneConfig currentScene) { for (int i = 0; i < scenes.Count; i++) { GameObject obj = Instantiate(ItemSence, transform) as GameObject; int Index = obj.transform.GetSiblingIndex(); obj.transform.GetComponent().Init(scenes[i].Id, scenes[i].SceneName, currentScene, false); } SetCreateSenceBtnBtn(); } public void SetCreateSenceBtnBtn(bool isRemove = false) { int num = 0; if (!isRemove) { num = transform.childCount; } else { num = transform.childCount - 1; } if (num > 0 && num < 10) { Vector3 temppos = CreateSenceBtn.transform.localPosition; temppos.y = 1500f - num * 150f; CreateSenceBtn.transform.localPosition = temppos; } else { Vector3 temppos = CreateSenceBtn.transform.localPosition; temppos.y = 150f; CreateSenceBtn.transform.localPosition = temppos; } } public int GetSceneCount() { return transform.childCount + 1; } }