123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161 |
- using UI.CommonGame;
- using FairyGUI;
- using UnityEngine;
- using UI.LuckyBox;
- namespace GFGGame
- {
- public class GetSuitItemVIew : BaseWindow
- {
- private UI_GetSuitItemUI _ui;
- private EffectUI _effectUI1;
- private DressUpObjUI _dressUpObjUI;
- public override void Dispose()
- {
- EffectUIPool.Recycle(_effectUI1);
- _effectUI1 = null;
- if (_dressUpObjUI != null)
- {
- _dressUpObjUI.Dispose();
- _dressUpObjUI = null;
- }
- if (_dressUpObjUI != null)
- {
- _dressUpObjUI.Dispose();
- _dressUpObjUI = null;
- }
- if (_ui != null)
- {
- _ui.Dispose();
- _ui = null;
- }
- base.Dispose();
- }
- protected override void OnInit()
- {
- base.OnInit();
- _ui = UI_GetSuitItemUI.Create();
- this.viewCom = _ui.target;
- isfullScreen = true;
- _dressUpObjUI = new DressUpObjUI("SceneDressUp",onShowAction);
- _ui.m_loaBg.onClick.Add(OnClickBg);
- _ui.m_btnShare.onClick.Add(OnClickShare);
- _effectUI1 = EffectUIPool.CreateEffectUI(_ui.m_holderEffect, "ui_ck", "ui_ck_tz");
- }
- void onShowAction()
- {
- EventAgent.DispatchEvent(ConstMessage.LUCKY_BOX_ANIMATION_WAIT);
- }
- protected override void OnShown()
- {
- base.OnShown();
- GRoot.inst.touchable = true;
- _ui.m_loaBg.touchable = false;
- int suitId = (int)viewData;
- if(suitId == 202025)
- {
- _ui.m_icon.x = -600;
- }
- else
- {
- _ui.m_icon.x = 0;
- }
- if (!GetSuitItemController.isAuto)
- {
- _ui.m_btnShare.visible = true;
- }
- else
- {
- _ui.m_btnShare.visible = false;
- }
- UpdateView(suitId);
- Timers.inst.Add(0.5f, 1, OnTimerClick);
- }
- protected override void OnHide()
- {
- base.OnHide();
- if (this.viewCom == null || this.viewCom.root == null)
- {
- Timers.inst.CallLater((object param) =>
- {
- GetSuitItemController.TryShow(0);
- });
- }
- TryCompleteGuide();
- Timers.inst.Remove(OnTimerClick);
- _ui.m_loaBg.touchable = true;
- }
- private void OnTimerClick(object param)
- {
- _ui.m_loaBg.touchable = true;
- }
- private void OnClickBg()
- {
- if (!GetSuitItemController.isAuto)
- {
- Hide();
- EventAgent.DispatchEvent(ConstMessage.LUCKY_BOX_SHOW_VIEW_CLOSE);
- EventAgent.DispatchEvent(ConstMessage.LUCKY_BOX_ANIMATION_WAIT);
- }
- }
- private void OnClickShare()
- {
- ShareDataManager.Instance.CaptureCameraToImage();
- }
- private void UpdateItem(int itemdId)
- {
- UI_LuckyBoxBonusItem itemUI = UI_LuckyBoxBonusItem.Proxy(_ui.m_item);
- ItemCfg itemCfg = ItemCfgArray.Instance.GetCfg(itemdId);
- itemUI.m_comIcon.m_icon.url = ResPathUtil.GetIconPath(itemCfg);
- string itemName = itemCfg.name;
- itemUI.m_comIcon.m_txtName.text = itemName;
- RarityIconController.UpdateRarityIcon(itemUI.m_comIcon.m_rarity, itemdId, false);
- itemUI.target.data = itemdId;
- itemUI.target.onClick.Clear();
- itemUI.target.onClick.Add(OnClickItemUI);
- UI_LuckyBoxBonusItem.ProxyEnd();
- }
- private void OnClickItemUI(EventContext context)
- {
- GComponent item = context.sender as GComponent;
- int itemID = (int)item.data;
- GoodsItemTipsController.ShowItemTips(itemID);
- }
- private void UpdateView(int suitId)
- {
- _ui.m_holderEffect.visible = true;
- int count = 0;//套装当前拥有的部件数量
- int totalCount = 1;
- // int suitId = 0;
- _ui.m_loaBg.url = ResPathUtil.GetBgImgPath("bg_zhuxian");
- DressUpMenuSuitDataManager.GetSuitProgressBySuitId(suitId, out count, out totalCount);
- if (suitId > 0)
- {
- SuitCfg suitCfg = SuitCfgArray.Instance.GetCfg(suitId);
- _ui.m_txtName.text = "套装·" + suitCfg.name;
- int targetY = (int)(_ui.m_item.y + _ui.m_item.height + 50);
- }
- // UpdateItem(itemId);
- bool showAction = SuitCfgArray.Instance.CheckSuitHasAction(suitId) && DressUpMenuSuitDataManager.CheckSuitHasActionRes(suitId);
- _dressUpObjUI.ResetSceneObj(115, false, true, null, false);
- _dressUpObjUI.dressUpObj.PutOnSuitCfg(suitId, showAction, null, false, false);
- _dressUpObjUI.UpdateWrapper(_ui.m_holder);
- }
- }
- }
|