// 리스트 공백용 or 게임 리소스 준비안될때 public void InitDefault() { _Info = null; _id = 0; _url = ""; _bundleName = ""; this.gameObject.name = "none"; callbackSelected = null; if (imgBody != null) { Destroy(imgBody.gameObject); imgBody = null; } if (effect != null) { Destroy(effect.gameObject); effect = null; } this.gameObject.SetActive(true); saveJackpot = 0; textJackpot.gameObject.SetActive(false); imgComingSoon.gameObject.SetActive(false); imgBody = CreateUIPrefab <Image>(this.GetComponent <RectTransform>(), "CabinetBody"); imgBody.transform.SetSiblingIndex(0); SetState(eState.None); }
// 이 케비넷 아이템은 재활용되므로 초기화시 기존 프리팹 생성들은 제거해야 한다. public void Init(PK.GamesInfo.REData info, System.Action <int> callback) { if (imgBody != null) { Destroy(imgBody.gameObject); imgBody = null; } if (effect != null) { Destroy(effect.gameObject); effect = null; } this.gameObject.name = info.game_id.ToString(); this.gameObject.SetActive(true); imgBody = CreateUIPrefab <Image>(this.GetComponent <RectTransform>(), "CabinetBody_" + info.game_id.ToString()); if (imgBody != null) { _Info = info; callbackSelected = callback; _id = info.game_id; _url = info.icon; curUpdateTime = SYSTIMER.GetCurTime(); ClacJackpotPool(); imgBody.transform.SetSiblingIndex(0); effect = CreateUIPrefab <CabinetEffect>(this.GetComponent <RectTransform>(), "CabinetEffect_" + _id.ToString()); if (effect != null) { effect.transform.SetSiblingIndex(1); effect.GetComponent <RectTransform>().anchoredPosition = new Vector2(-117.8f, -40.9f); effect.enabled = false; } OnEnable(); SetTag(_Info.tag); } else { InitDefault(); } }