123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051 |
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- using XRTool.Util;
- public class ItemSenceList : UnitySingleton<ItemSenceList>
- {
- public GameObject ItemSence;
- public GameObject CreateSenceBtn;
- public void Init(List<SceneConfig> 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<ItemSenceView>().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;
- }
- }
|