using System.Collections; using System.Collections.Generic; using UnityEngine; public class GetItemUI : MonoBehaviourSingletonScrollViewMgr { public GameObject go_child, go_tabtoscreen; List lastlst = new List(); bool IsGamble; protected override void Awake() { base.Awake(); DontDestroy(); All_Off(); } void All_Off() { go_child.SetActive(false); go_tabtoscreen.SetActive(false); } public void Set(List lst, bool isGamble = false) { All_Off(); m_grid.animateSmoothly = true; IsGamble = isGamble; // 중복 합치기 lastlst = DSUtil.CombineSameItem(lst); for (int i = 0; i < lastlst.Count; i++) { if (lastlst[i].ItemType >= eItem.PC) ServerInfo.Ins.Add_Log(0, DSUtil.Format("add,{0},{1},{2}", lastlst[i].ItemType, lastlst[i].Get_ID(), lastlst[i].Amount)); } list_CardBase.ForEach(f => f.transform.localPosition = Vector3.zero); if (lastlst.Count <= 28) { m_grid.maxPerLine = 7; m_grid.transform.localScale = Vector3.one * 0.8f; } else { m_grid.maxPerLine = 11; m_grid.transform.localScale = Vector3.one * 0.65f; } } public void Show_Items() { base.Set(); DontBack = true; go_child.SetActive(true); Set_ScrollView(lastlst); Set_Coroutine(() => { m_grid.repositionNow = true; if (IsGamble) { SoundInfo.Ins.Play_OneShot(eSound.s023_CardMove); m_grid.onSmoothTweenFinished = () => { if (IsGamble) { IsGamble = false; list_CardBase.ForEach(f => f.Do_SomeThing()); Set_Coroutine(() => { SoundInfo.Ins.Play_OneShot(eSound.s024_Gamble, 0.25f); }, 0.5f); } }; } else m_grid.onSmoothTweenFinished = null; }, 0.1f); Set_Coroutine(() => { m_scrollview.ResetPosition(); }, 0.2f); Set_Coroutine(() => { go_tabtoscreen.SetActive(true); DontBack = false; }, 0.3f); } public override void OnClick_Back() { if (go_tabtoscreen.activeInHierarchy) { DontBack = false; base.OnClick_Back(); All_Off(); } } }