1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495 |
- using UI.CommonGame;
- using FairyGUI;
- using UnityEngine;
- using UI.LuckyBox;
- namespace GFGGame
- {
- public class SuitItemView : BaseWindow
- {
- private UI_SuitItemUI _ui;
- private EffectUI _effectUI1;
- private int suitID;
- private int count = 0;//套装当前拥有的部件数量
- private int totalCount = 1;
- public override void Dispose()
- {
- EffectUIPool.Recycle(_effectUI1);
- _effectUI1 = null;
- if (_ui != null)
- {
- _ui.Dispose();
- _ui = null;
- }
- base.Dispose();
- }
- protected override void OnInit()
- {
- base.OnInit();
- packageName = UI_SuitItemUI.PACKAGE_NAME;
- _ui = UI_SuitItemUI.Create();
- this.viewCom = _ui.target;
- isfullScreen = true;
- _ui.m_loaBg.onTouchBegin.Add(OnClickBg);
- }
- protected override void OnShown()
- {
- base.OnShown();
- suitID = (int)this.viewData;
- UpdateView();
- }
- private void UpdateView()
- {
- DressUpMenuSuitDataManager.GetSuitProgressBySuitId(suitID, out count, out totalCount);
- if (suitID > 0)
- {
- SuitCfg suitCfg = SuitCfgArray.Instance.GetCfg(suitID);
- _ui.m_txtName.text = "套装·" + suitCfg.name;
- _ui.m_icon.url = ResPathUtil.GetFieldGuideIconPath(suitCfg.res);
- }
- _ui.m_probar.max = totalCount;
- _ui.m_probar.value = count;
- _ui.m_t_open.Play();
- if (GetSuitItemController.isAuto)
- {
- Timers.inst.Add(1.2f, 1, WaitAutoEnd);
- }
- }
- private void OnClickBg()
- {
- if(!GetSuitItemController.isAuto)
- {
- if (count == totalCount)
- {
- ViewManager.Show<GetSuitItemVIew>(suitID);
- }
- else
- {
- EventAgent.DispatchEvent(ConstMessage.LUCKY_BOX_ANIMATION_WAIT);
- }
- this.Hide();
- }
- }
- protected override void OnHide()
- {
-
- }
- private void WaitAutoEnd(object param = null)
- {
- this.Hide();
- if (count == totalCount)
- {
- ViewManager.Show<GetSuitItemVIew>(suitID);
- }
- else
- {
- EventAgent.DispatchEvent(ConstMessage.LUCKY_BOX_ANIMATION_WAIT);
- }
- Timers.inst.Remove(WaitAutoEnd);
- }
- }
- }
|