12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394 |
- using UI.CommonGame;
- using FairyGUI;
- using UnityEngine;
- using UI.LuckyBox;
- namespace GFGGame
- {
- public class SuitItemView : BaseWindow
- {
- private UI_SuitItemUI _ui;
- private int suitID;
- private int countSuitId;//当前获得的物品还有多少个相同套装的部件需要展示
- private int count = 0;//套装当前拥有的部件数量
- private int totalCount = 1;
- private EffectUI _effectUI1;
- private EffectUI _effectUI2;
- private EffectUI _effectUI3;
- public override void Dispose()
- {
- EffectUIPool.Recycle(_effectUI1);
- _effectUI1 = null;
- EffectUIPool.Recycle(_effectUI2);
- _effectUI2 = null;
- EffectUIPool.Recycle(_effectUI3);
- _effectUI3 = 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);
- _ui.m_probar.max = 0;
- _effectUI1 = EffectUIPool.CreateEffectUI(_ui.m_topEffect, "ui_LuckyBox", "SJJD_CradUp");
- _effectUI2 = EffectUIPool.CreateEffectUI(_ui.m_probarEffect, "ui_LuckyBox", "SJJD_CradUP_once");
- _effectUI3 = EffectUIPool.CreateEffectUI(_ui.m_downEffect, "ui_LuckyBox", "SJJD_CradDown");
- }
- 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 - 1;
- _ui.m_t_open.Play();
- _ui.m_probar.TweenValue(count, 0.7f);
- }
- private void OnClickBg()
- {
- if(!GetSuitItemController.isAuto)
- {
- if (count == totalCount)
- {
- ViewManager.Show<GetSuitItemVIew>(suitID);
- }
- this.Hide();
- //EventAgent.DispatchEvent(ConstMessage.LUCKY_BOX_SHOW_VIEW_CLOSE);
- }
- }
- protected override void OnHide()
- {
- _ui.m_probar.max = 0;
- _ui.m_probar.value = 0;
- }
- }
- }
|