// 일정시간에 업데이트 횟수만큼 액션을 보여준다. // 일정시간 이후 새로운 패킷을 요청 새롭게 시작처리 // 이 함수는 현재 선택된 게임 리스트의 아이템만 활성화 운영된다. void UpdateJackpotPool() { if (!textJackpot.gameObject.activeSelf) { return; } // 일정시간에 서버 갱신 데이터 업데이트 ( 5분30초에 한번씩 갱신된 잭팟 정보 갱신 ) // 상위 클래스 리스트뷰에서 패킷을 5분에 한번씩 갱신한다. if (SYSTIMER.GetCurTime() - curUpdateTime > 630f) { curUpdateTime = SYSTIMER.GetCurTime(); ClacJackpotPool(); if (saveJackpot <= 0) { Invoke("UpdateJackpotPool", 30f); return; } } // 기본적으로 남은금액의 1/10 long temp = saveJackpot / 10; // 1/10 금액에서도 랜덤값으로 일정금액 정의 long random_pool = temp / Random.Range(2, 10); // 숫자 밸런스 액션에 필요한 값만큼 차감 if (random_pool < saveJackpot) { saveJackpot -= random_pool; } else { random_pool = saveJackpot; } // 랜덤 액션 타임 정의 (활성화된 게임 리스트가 동일한 행동을 피하기 위함) float delay = Random.Range(5, 10); long target = textJackpot.GetCurBalance() + random_pool; textJackpot.PlayTweenBalance(() => { UpdateJackpotPool(); }, textJackpot.GetCurBalance(), target, 1f, delay); }
// 이 케비넷 아이템은 재활용되므로 초기화시 기존 프리팹 생성들은 제거해야 한다. 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(); } }