using UI.LuckyBox; using FairyGUI; using ET; using System.Collections.Generic; using System; namespace GFGGame { public class LuckyBoxController { private UI_ComModel _comModel; private LuckyBoxCfg _luckyBoxCfg; private int _time = 8; private int _bgIndex = 0; private int _modelIndex = 0; public LuckyBoxController(GComponent comModel, int luckyBoxId) { _luckyBoxCfg = LuckyBoxCfgArray.Instance.GetCfg(luckyBoxId); _comModel = UI_ComModel.Proxy(comModel); _comModel.m_loaBg.url = ResPathUtil.GetBgImgPath(_luckyBoxCfg.resArr[0]); if (_luckyBoxCfg.resArr.Length > 1) { Timers.inst.Add(1, 0, UpdateTime); } } public void Dispose() { } private void UpdateTime(object param) { _time = _time - 1 == 0 ? 8 : _time - 1; _bgIndex = _bgIndex + 1 == _luckyBoxCfg.resArr.Length ? 0 : _bgIndex + 1; _modelIndex = _modelIndex + 1 == _luckyBoxCfg.suitShowArr.Length ? 0 : _modelIndex + 1; } public void OnHide() { UI_ComModel.ProxyEnd(); } } }