123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100 |
- 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 countSuitId;//当前获得的物品还有多少个相同套装的部件需要展示
- 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();
- if (this.viewData != null) {
- suitID = (int)(this.viewData as object[])[0];
- countSuitId = (int)(this.viewData as object[])[1];
- }
- UpdateView();
- }
- private void UpdateView()
- {
- DressUpMenuSuitDataManager.GetSuitProgressBySuitId(suitID, out count, out totalCount);
- count = count - countSuitId;
- 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(LuckyBoxDataManager.ANIMATION_TIME, 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);
- }
- }
- }
|