|
@@ -0,0 +1,146 @@
|
|
|
+using UI.RoleInfo;
|
|
|
+using System.Collections.Generic;
|
|
|
+using FairyGUI;
|
|
|
+using UI.CommonGame;
|
|
|
+using UnityEngine;
|
|
|
+using UI.Main;
|
|
|
+
|
|
|
+namespace GFGGame
|
|
|
+{
|
|
|
+ class ChangeThemeView : BaseWindow
|
|
|
+ {
|
|
|
+ private UI_ChangeThemeUI _ui;
|
|
|
+ private List<CardData> cardList = new List<CardData>();
|
|
|
+ private int selectIndex = 0;
|
|
|
+ private GComponent _comSelected;
|
|
|
+ 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 (_comSelected != null)
|
|
|
+ {
|
|
|
+ _comSelected.RemoveFromParent();
|
|
|
+ _comSelected.Dispose();
|
|
|
+ }
|
|
|
+ if (_ui != null)
|
|
|
+ {
|
|
|
+ _ui.Dispose();
|
|
|
+ _ui = null;
|
|
|
+ }
|
|
|
+ base.Dispose();
|
|
|
+ }
|
|
|
+
|
|
|
+ protected override void OnInit()
|
|
|
+ {
|
|
|
+ base.OnInit();
|
|
|
+ packageName = UI_ChangeThemeUI.PACKAGE_NAME;
|
|
|
+ _ui = UI_ChangeThemeUI.Create();
|
|
|
+ this.viewCom = _ui.target;
|
|
|
+ this.viewCom.Center();
|
|
|
+ this.modal = true;
|
|
|
+ viewAnimationType = EnumViewAnimationType.ZOOM_CENTER;
|
|
|
+
|
|
|
+ //_ui.m_list.SetVirtual();
|
|
|
+ _ui.m_list.itemRenderer = RenderListCardItem;
|
|
|
+ _ui.m_list.onClickItem.Add(OnListCardItemClick);
|
|
|
+ _ui.m_btnSure.onClick.Add(OnClickBtnSure);
|
|
|
+ _ui.m_btnClear.onClick.Add(OnClickBtnClear);
|
|
|
+ _ui.m_btnClose.onClick.Add(()=> { this.Hide(); });
|
|
|
+ AddEffect();
|
|
|
+ _comSelected = UIPackage.CreateObject(UI_MainUI.PACKAGE_NAME, "ComCardSelect").asCom;
|
|
|
+ }
|
|
|
+ protected override void OnShown()
|
|
|
+ {
|
|
|
+ base.OnShown();
|
|
|
+ cardList = CardDataManager.GetCardListByRoleType(0);
|
|
|
+ cardList = CardDataManager.SortItemList(cardList);
|
|
|
+ _ui.m_list.numItems = cardList.Count;
|
|
|
+ if(cardList.Count >0 )
|
|
|
+ {
|
|
|
+ _ui.m_list.GetChildAt(selectIndex).asCom.AddChild(_comSelected);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ protected override void OnHide()
|
|
|
+ {
|
|
|
+ base.OnHide();
|
|
|
+ }
|
|
|
+ private void RenderListCardItem(int index, GObject obj)
|
|
|
+ {
|
|
|
+ CardData cardData = cardList[index];
|
|
|
+ UI_ListCardFightItem item = UI_ListCardFightItem.Proxy(obj); // obj as GButton;
|
|
|
+ item.m_txtName.text = cardData.itemCfg.name;
|
|
|
+ item.m_comCardMask.m_loaCard.asLoader.url =
|
|
|
+ ResPathUtil.GetCardIconPath(cardData.resources[cardData.resIndex]);
|
|
|
+ item.m_txtLv.text = string.Format("{0}级", cardData.lv);
|
|
|
+ // item.m_loaRarity.url = ResPathUtil.GetCommonGameResPath("kp_sxing_x_" + cardData.itemCfg.rarity);
|
|
|
+ RarityIconController.UpdateRarityIcon(item.m_loaRarity, cardData.itemCfg.id,
|
|
|
+ false); // ResPathUtil.GetCommonGameResPath("kp_sxing_x_" + data.itemCfg.rarity);
|
|
|
+ item.m_loaMainScore.url = ResPathUtil.GetCommonGameResPath("kp_sx_" + (cardData.itemCfg.mainScore));
|
|
|
+ item.m_loaBorder.url = "ui://CommonGame/kp_kuang_" + cardData.itemCfg.rarity;
|
|
|
+ // UI_ComStar comStar = UI_ComStar.Proxy(item.m_comStar);
|
|
|
+
|
|
|
+ int starLevelDodge = cardData.star / 6;
|
|
|
+ item.m_starNumType.selectedIndex = cardData.itemCfg.starDescArr.Length - 1;
|
|
|
+ for (int i = 0; i < 4; i++)
|
|
|
+ {
|
|
|
+ UI_ComDodgeFightStar dodgeStar = UI_ComDodgeFightStar.Proxy(item.target.GetChild("dodgeStar" + i));
|
|
|
+ dodgeStar.m_lightType.selectedIndex = (starLevelDodge > i) ? 1 : 0;
|
|
|
+ UI_ComDodgeFightStar.ProxyEnd();
|
|
|
+ }
|
|
|
+ item.m_useIcon.visible = false;
|
|
|
+ if(cardData.id == MainDataManager.Instance.CardBgID)
|
|
|
+ {
|
|
|
+ selectIndex = index;
|
|
|
+ }
|
|
|
+ UI_ListCardFightItem.ProxyEnd();
|
|
|
+ // UI_ComStar.ProxyEnd();
|
|
|
+ }
|
|
|
+
|
|
|
+ private void OnListCardItemClick(EventContext context)
|
|
|
+ {
|
|
|
+ GObject obj = context.data as GObject;
|
|
|
+ UI_ListCardFightItem item = UI_ListCardFightItem.Proxy(obj);
|
|
|
+ item.m_t0.Play();
|
|
|
+
|
|
|
+ EffectUIPool.Recycle(_effectUI3);
|
|
|
+ _effectUI3 = null;
|
|
|
+ _effectUI3 = EffectUIPool.CreateEffectUI(item.m_effect, "ui_KP", "KP_Select");
|
|
|
+ _ui.m_list.GetChildAt(_ui.m_list.selectedIndex).asCom.AddChild(_comSelected);
|
|
|
+ OnCardSelected(cardList[_ui.m_list.selectedIndex].id);
|
|
|
+ }
|
|
|
+ private void OnCardSelected(int cardId)
|
|
|
+ {
|
|
|
+ MainDataManager.Instance.CardBgID = cardId;
|
|
|
+
|
|
|
+ }
|
|
|
+ private async void OnClickBtnSure()
|
|
|
+ {
|
|
|
+ await ActivitySProxy.SetOnceStatus(MainDataManager.Instance.CardBgKey, MainDataManager.Instance.CardBgID, 0);
|
|
|
+ PromptController.Instance.ShowFloatTextPrompt("更换成功!");
|
|
|
+ this.Hide();
|
|
|
+ }
|
|
|
+ private async void OnClickBtnClear()
|
|
|
+ {
|
|
|
+ await ActivitySProxy.SetOnceStatus(MainDataManager.Instance.CardBgKey, 0, 0);
|
|
|
+ MainDataManager.Instance.CardBgID = 0;
|
|
|
+ this.Hide();
|
|
|
+ }
|
|
|
+ private void AddEffect()
|
|
|
+ {
|
|
|
+ //邊框左上角特效
|
|
|
+ _effectUI1 = EffectUIPool.CreateEffectUI(_ui.m_holderLeftTop, "ui_Activity", "Com_window_L_up");
|
|
|
+
|
|
|
+ //邊框右下角特效
|
|
|
+ _effectUI2 = EffectUIPool.CreateEffectUI(_ui.m_holderRightDowm, "ui_Activity", "Com_window_R_Down");
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|