|
@@ -0,0 +1,844 @@
|
|
|
+using UI.DressUp;
|
|
|
+using FairyGUI;
|
|
|
+using UnityEngine;
|
|
|
+using System.Collections.Generic;
|
|
|
+using System;
|
|
|
+using ET;
|
|
|
+using System.Collections;
|
|
|
+using System.Threading.Tasks;
|
|
|
+using UI.Arena;
|
|
|
+using UI.CommonGame;
|
|
|
+
|
|
|
+namespace GFGGame
|
|
|
+{
|
|
|
+ public class ArenaDressUpFightView : BaseView
|
|
|
+ {
|
|
|
+ private UI_ArenaDressUpFightUI _ui;
|
|
|
+ private ArenaDataManager _dataManager;
|
|
|
+ public FightRoleData _roleData;
|
|
|
+ // private int _fightID;
|
|
|
+ // private int _levelID;
|
|
|
+ private float listType1X = 0;
|
|
|
+ private float partsListX = 0;
|
|
|
+ private DressUpListType currentListType;
|
|
|
+ private int[] _currentList2;
|
|
|
+ private GameObject _scenePrefab;
|
|
|
+ private GameObject _sceneObject;
|
|
|
+ private List<int> _currentList3 = new List<int>();
|
|
|
+ private List<int> _currentList4 = new List<int>();
|
|
|
+ private int _currentMenuType;
|
|
|
+ private int _currentSuitId;
|
|
|
+ // private StoryLevelCfg _levelCfg;
|
|
|
+ // private StoryFightCfg _fightCfg;
|
|
|
+
|
|
|
+ private const int SORT_BY_HIGH_SCORE = 0;
|
|
|
+ private const int SORT_BY_LOW_SCORE = 1;
|
|
|
+ private int _scoreIndex = SORT_BY_HIGH_SCORE;
|
|
|
+ private List<LongPressGesture> _listLongPress = new List<LongPressGesture>();
|
|
|
+
|
|
|
+
|
|
|
+ public override void Dispose()
|
|
|
+ {
|
|
|
+ if (_sceneObject != null)
|
|
|
+ {
|
|
|
+ GameObject.Destroy(_sceneObject);
|
|
|
+ _sceneObject = null;
|
|
|
+ }
|
|
|
+ for (int i = 0; i < _listLongPress.Count; i++)
|
|
|
+ {
|
|
|
+ _listLongPress[i].Dispose();
|
|
|
+ }
|
|
|
+ if (_ui != null)
|
|
|
+ {
|
|
|
+ _ui.Dispose();
|
|
|
+ _ui = null;
|
|
|
+ }
|
|
|
+ base.Dispose();
|
|
|
+ }
|
|
|
+
|
|
|
+ protected override void Init()
|
|
|
+ {
|
|
|
+ base.Init();
|
|
|
+ packageName = UI_ArenaDressUpFightUI.PACKAGE_NAME;
|
|
|
+ _ui = UI_ArenaDressUpFightUI.Create();
|
|
|
+ viewCom = _ui.target;
|
|
|
+ isfullScreen = true;
|
|
|
+ _scenePrefab = GFGAsset.Load<GameObject>(ResPathUtil.GetPrefabPath("SceneDressUpFight"));
|
|
|
+ }
|
|
|
+
|
|
|
+ protected override void OnInit()
|
|
|
+ {
|
|
|
+ base.OnInit();
|
|
|
+
|
|
|
+ _ui.m_btnSearch.visible = true;
|
|
|
+ _ui.m_partsList.m_comboBoxRarity.items = new string[] { "高分优先", "低分优先" };
|
|
|
+ InitLists();
|
|
|
+ _ui.m_partsList.m_comboBoxRarity.onChanged.Add(OnComboBoxRarityChanged);
|
|
|
+ _ui.m_btnBack.onClick.Add(OnClickBtnBack);
|
|
|
+
|
|
|
+ _ui.m_comListType1.m_listType.onClickItem.Add(OnClickListType1Item);
|
|
|
+ _ui.m_comListType2.m_listType.onClickItem.Add(OnClickListType2Item);
|
|
|
+ _ui.m_partsList.m_list.onClickItem.Add(OnClickPartsListItem);
|
|
|
+ _ui.m_partsList2.m_list.onClickItem.Add(OnClickSuitPartsListItem);
|
|
|
+
|
|
|
+ _ui.m_touchPad.onClick.Add(OnTouchPad);
|
|
|
+ _ui.m_btnDelete.onClick.Add(OnClickBtnDelete);
|
|
|
+ _ui.m_btnNext.onClick.Add(OnClickBtnNext);
|
|
|
+ _ui.m_btnSearch.onClick.Add(OnClickBtnSearch);
|
|
|
+
|
|
|
+ _ui.m_partsList2.m_comboBoxRarity.visible = false;
|
|
|
+ _ui.m_partsList2.m_imgTop.visible = true;
|
|
|
+ _ui.m_partsList.m_imgTop.visible = false;
|
|
|
+
|
|
|
+ }
|
|
|
+ protected override void AddEventListener()
|
|
|
+ {
|
|
|
+ base.AddEventListener();
|
|
|
+ // EventAgent.AddEventListener(ConstMessage.CARD_CHOOSE, StartCalculateScore);
|
|
|
+ EventAgent.AddEventListener(ConstMessage.DRESS_FILTER, UpdatePartsListSort);
|
|
|
+ EventAgent.AddEventListener(ConstMessage.DRESS_SEARCH, UpdatePartsListSort);
|
|
|
+ // EventAgent.AddEventListener(ConstMessage.DRESS_UP_SCORE_CHANGED, UpdateValueInfo);
|
|
|
+
|
|
|
+ }
|
|
|
+ protected override void OnShown()
|
|
|
+ {
|
|
|
+ base.OnShown();
|
|
|
+ _dataManager = ArenaDataManager.Instance;
|
|
|
+ _roleData = _dataManager.DressupList[_dataManager.SelectDressIndex];
|
|
|
+ InstanceZonesDataManager.currentScoreType = _dataManager.ThemeList[_dataManager.SelectDressIndex];
|
|
|
+ InstanceZonesDataManager.currentFightTags = _dataManager.DressupList[_dataManager.SelectDressIndex].tags;
|
|
|
+
|
|
|
+
|
|
|
+ _scoreIndex = _ui.m_partsList.m_comboBoxRarity.selectedIndex;
|
|
|
+
|
|
|
+
|
|
|
+ //一级菜单
|
|
|
+ _ui.m_comListType1.m_listType.RemoveChildrenToPool();
|
|
|
+ _ui.m_comListType1.m_listType.numItems = DressUpMenuItemCfg1Array.Instance.dataArray.Length - 3;
|
|
|
+ float maxHeight = _ui.target.height - _ui.m_comListType1.m_listType.y - DressUpView.BOTTOM_BLANK;
|
|
|
+ if (_ui.m_comListType1.m_listType.height > maxHeight)
|
|
|
+ {
|
|
|
+ _ui.m_comListType1.m_listType.height = maxHeight;
|
|
|
+ }
|
|
|
+ _ui.m_comListType1.target.x = _ui.target.width;
|
|
|
+ _ui.m_comListType2.target.x = _ui.target.width;
|
|
|
+ _ui.m_partsList.target.x = _ui.target.width;
|
|
|
+ _ui.m_partsList2.target.x = _ui.target.width;
|
|
|
+ this.showListType1();
|
|
|
+ if (_sceneObject == null)
|
|
|
+ {
|
|
|
+ _sceneObject = GameObject.Instantiate(_scenePrefab);
|
|
|
+ MyDressUpHelper.dressUpObj.setSceneObj(_sceneObject, false, false);
|
|
|
+ MyDressUpHelper.dressUpObj.PutOnDefaultDressUpData();
|
|
|
+ }
|
|
|
+ _ui.m_txtDressLimit.text = string.Format("饰品穿戴限制:{0}/{1}", MyDressUpHelper.GetCurrentOrnamentCount(), GlobalCfgArray.globalCfg.dressLimitCount);
|
|
|
+
|
|
|
+ UpdateValueInfo();
|
|
|
+ SendLog();
|
|
|
+ Timers.inst.AddUpdate(CheckGuide);
|
|
|
+ }
|
|
|
+
|
|
|
+ protected override void OnHide()
|
|
|
+ {
|
|
|
+ base.OnHide();
|
|
|
+
|
|
|
+ if (_sceneObject != null)
|
|
|
+ {
|
|
|
+ GameObject.Destroy(_sceneObject);
|
|
|
+ _sceneObject = null;
|
|
|
+ }
|
|
|
+
|
|
|
+ DressUpMenuItemDataManager.Clear();
|
|
|
+
|
|
|
+ Timers.inst.Remove(CheckGuide);
|
|
|
+
|
|
|
+ }
|
|
|
+ protected override void RemoveEventListener()
|
|
|
+ {
|
|
|
+ base.RemoveEventListener();
|
|
|
+ // EventAgent.RemoveEventListener(ConstMessage.CARD_CHOOSE, StartCalculateScore);
|
|
|
+ EventAgent.RemoveEventListener(ConstMessage.DRESS_FILTER, UpdatePartsListSort);
|
|
|
+ EventAgent.RemoveEventListener(ConstMessage.DRESS_SEARCH, UpdatePartsListSort);
|
|
|
+ // EventAgent.RemoveEventListener(ConstMessage.DRESS_UP_SCORE_CHANGED, UpdateValueInfo);
|
|
|
+
|
|
|
+ }
|
|
|
+ private void OnClickBtnBack()
|
|
|
+ {
|
|
|
+ AlertUI.Show("是否确定退出?")
|
|
|
+ .SetLeftButton(true, "否").SetRightButton(true, "是", (object data) =>
|
|
|
+ {
|
|
|
+ ViewManager.GoBackFrom(typeof(ArenaDressUpFightView).FullName);
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ private void OnClickBtnHome()
|
|
|
+ {
|
|
|
+ AlertUI.Show("是否返回?")
|
|
|
+ .SetLeftButton(true, "否").SetRightButton(true, "是", (object data) =>
|
|
|
+ {
|
|
|
+ GameController.GoBackToMainView();
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ private void UpdateValueInfo()
|
|
|
+ {
|
|
|
+ UI_ComValueInfo comValueInfo = UI_ComValueInfo.Proxy(_ui.m_comValueInfo);
|
|
|
+ comValueInfo.m_scoreType.url = "ui://CommonGame/kp_sx_" + InstanceZonesDataManager.currentScoreType;
|
|
|
+ comValueInfo.m_txtScore.text = FightDataManager.Instance.score.ToString();
|
|
|
+ comValueInfo.m_txtFightScore.text = FightDataManager.Instance.GetArenaRoleFightScore(_roleData).ToString();
|
|
|
+ comValueInfo.m_txtTagScore.text = FightDataManager.Instance.GetTagsScore(_roleData.itemList, _roleData.tags).ToString();
|
|
|
+ int count = FightDataManager.Instance.GetTagsCount(_roleData.itemList, _roleData.tags);
|
|
|
+ comValueInfo.m_c1.selectedIndex = Math.Min(count, ArenaTagCfgArray.Instance.dataArray.Length);
|
|
|
+ if (_roleData.tags.Length > 0)
|
|
|
+ {
|
|
|
+ UI_ComTag item = UI_ComTag.Proxy(comValueInfo.m_comTag);
|
|
|
+ int tagType = TagCfgArray.Instance.GetCfg(_roleData.tags[0]).type;
|
|
|
+ item.m_txtTag.text = _roleData.tags[0];
|
|
|
+ item.m_loaTag.url = ResPathUtil.GetCommonGameResPath("fzd_bqbq_" + tagType);
|
|
|
+ UI_ComTag.ProxyEnd();
|
|
|
+ }
|
|
|
+ UI_ComValueInfo.ProxyEnd();
|
|
|
+ // GuideController.TryGuideDressUpFightViewBtnNext(_ui.m_btnNext);
|
|
|
+ }
|
|
|
+
|
|
|
+ private void OnClickListType1Item(EventContext context)
|
|
|
+ {
|
|
|
+
|
|
|
+ // GuideController.HideGuide();
|
|
|
+ GObject typeItem = context.data as GObject;
|
|
|
+ int order = (int)typeItem.data;
|
|
|
+ DressUpMenuItemCfg1 item1 = DressUpMenuItemCfg1Array.Instance.dataArray[order - 1];
|
|
|
+ if (item1.subMenusArr.Length > 0)
|
|
|
+ {
|
|
|
+ this.showListType2(item1.subMenusArr);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ if (this.showListParts(item1.type) == false)
|
|
|
+ {
|
|
|
+ PromptController.Instance.ShowFloatTextPrompt("未获得此类部件");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ this.showListParts(item1.type);
|
|
|
+
|
|
|
+ }
|
|
|
+ this.hideListType1();
|
|
|
+ UpdateListPartsSelected();
|
|
|
+ }
|
|
|
+
|
|
|
+ private void OnClickListType2Item(EventContext context)
|
|
|
+ {
|
|
|
+
|
|
|
+ GObject typeItem = context.data as GObject;
|
|
|
+ int order = (int)typeItem.data;
|
|
|
+ DressUpMenuItemCfg2 item2 = DressUpMenuItemCfg2Array.Instance.dataArray[order - 1];
|
|
|
+
|
|
|
+ if (this.showListParts(item2.type) == false)
|
|
|
+ {
|
|
|
+
|
|
|
+ PromptController.Instance.ShowFloatTextPrompt("未获得此类部件");
|
|
|
+ return;
|
|
|
+
|
|
|
+ }
|
|
|
+ this.hideListType2();
|
|
|
+ }
|
|
|
+
|
|
|
+ private void OnClickPartsListItem(EventContext context)
|
|
|
+ {
|
|
|
+ if (ViewManager.isViewOpen(typeof(DressUpItemTipsView).FullName))
|
|
|
+ {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ GObject listItem = context.data as GObject;
|
|
|
+ int id = (int)listItem.data;
|
|
|
+ if (_currentMenuType == (int)ConstDressUpItemType.TAO_ZHUANG)
|
|
|
+ {
|
|
|
+ this.showListParts2(id);
|
|
|
+ this.hideListParts();
|
|
|
+ MyDressUpHelper.dressUpObj.PutOnItemList(MyDressUpHelper.GetSuitFightItems(id));
|
|
|
+ // MyDressUpHelper.dressUpObj.PutOnSuitCfg(id, false);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ bool isOrnament = DressUpMenuItemCfg1Array.Instance.CheckIsOrnamentsType(id);
|
|
|
+ bool isDress = MyDressUpHelper.dressUpObj.CheckDressUpItemIsOn(id);
|
|
|
+ bool isHasSame = MyDressUpHelper.dressUpObj.CheckSameTypeIsOn(id);
|
|
|
+ bool isMaxCount = MyDressUpHelper.GetCurrentOrnamentCount() >= GlobalCfgArray.globalCfg.dressLimitCount;
|
|
|
+ if (isOrnament && !isDress && !isHasSame && isMaxCount)
|
|
|
+ {
|
|
|
+ PromptController.Instance.ShowFloatTextPrompt("饰品穿戴数量已达上限");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ MyDressUpHelper.dressUpObj.CheckCancelActionWhenPutOn(id);
|
|
|
+ MyDressUpHelper.dressUpObj.AddOrRemove(id, true);
|
|
|
+ }
|
|
|
+ _ui.m_txtDressLimit.text = string.Format("饰品穿戴限制:{0}/{1}", MyDressUpHelper.GetCurrentOrnamentCount(), GlobalCfgArray.globalCfg.dressLimitCount);
|
|
|
+ UpdateListPartsSelected();
|
|
|
+ UpdateListSuitPartsSelected();
|
|
|
+ UpdateValueInfo();
|
|
|
+
|
|
|
+ }
|
|
|
+ private void OnClickSuitPartsListItem(EventContext context)
|
|
|
+ {
|
|
|
+ if (ViewManager.isViewOpen(typeof(DressUpItemTipsView).FullName))
|
|
|
+ {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ GObject listItem = (GObject)context.data as GObject;
|
|
|
+ int id = (int)listItem.data;
|
|
|
+
|
|
|
+ bool isOrnament = DressUpMenuItemCfg1Array.Instance.CheckIsOrnamentsType(id);
|
|
|
+ bool isDress = MyDressUpHelper.dressUpObj.CheckDressUpItemIsOn(id);
|
|
|
+ bool isHasSame = MyDressUpHelper.dressUpObj.CheckSameTypeIsOn(id);
|
|
|
+ bool isMaxCount = MyDressUpHelper.GetCurrentOrnamentCount() >= GlobalCfgArray.globalCfg.dressLimitCount;
|
|
|
+ if (isOrnament && !isDress && !isHasSame && isMaxCount)
|
|
|
+ {
|
|
|
+ PromptController.Instance.ShowFloatTextPrompt("饰品穿戴数量已达上限");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ MyDressUpHelper.dressUpObj.CheckCancelActionWhenPutOn(id);
|
|
|
+ MyDressUpHelper.dressUpObj.AddOrRemove(id, true);
|
|
|
+ _ui.m_txtDressLimit.text = string.Format("饰品穿戴限制:{0}/{1}", MyDressUpHelper.GetCurrentOrnamentCount(), GlobalCfgArray.globalCfg.dressLimitCount);
|
|
|
+ UpdateListSuitPartsSelected();
|
|
|
+ UpdateValueInfo();
|
|
|
+ }
|
|
|
+ private void OnLongPress(EventContext context)
|
|
|
+ {
|
|
|
+ LongPressGesture gesture = (LongPressGesture)context.sender;
|
|
|
+ int itemId = (int)gesture.host.data;
|
|
|
+ GoodsItemTipsController.ShowItemTips(itemId);
|
|
|
+ }
|
|
|
+ private void OnTouchPad()
|
|
|
+ {
|
|
|
+ if (this.currentListType == DressUpListType.List4)
|
|
|
+ {
|
|
|
+ this.hideListParts2();
|
|
|
+ this.showListParts(ConstDressUpItemType.TAO_ZHUANG, true);
|
|
|
+ }
|
|
|
+ else if (this.currentListType == DressUpListType.List3)
|
|
|
+ {
|
|
|
+ if (_currentList2 != null)
|
|
|
+ {
|
|
|
+ this.showListType2(_currentList2);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ this.showListType1();
|
|
|
+ }
|
|
|
+ this.hideListParts();
|
|
|
+ }
|
|
|
+ else if (this.currentListType == DressUpListType.List2)
|
|
|
+ {
|
|
|
+ this.showListType1();
|
|
|
+ this.hideListType2();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ private void OnClickBtnDelete()
|
|
|
+ {
|
|
|
+ MyDressUpHelper.dressUpObj.TakeOffAll();
|
|
|
+ _ui.m_partsList.m_list.numItems = _currentList3.Count;
|
|
|
+ _ui.m_partsList2.m_list.numItems = _currentList4.Count;
|
|
|
+ _ui.m_txtDressLimit.text = string.Format("饰品穿戴限制:{0}/{1}", MyDressUpHelper.GetCurrentOrnamentCount(), GlobalCfgArray.globalCfg.dressLimitCount);
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ private async void OnClickBtnNext()
|
|
|
+ {
|
|
|
+ if (!MyDressUpHelper.CheckPutOnFinish())
|
|
|
+ {
|
|
|
+ AlertUI.Show("当前主题尚未穿戴完整")
|
|
|
+ .SetRightButton(true, "好的");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ await DressUpFinishAsync();
|
|
|
+ }
|
|
|
+
|
|
|
+ private async Task DressUpFinishAsync()
|
|
|
+ {
|
|
|
+ Timers.inst.StartCoroutine(ScreenShotTex());
|
|
|
+
|
|
|
+ if (CardDataManager.GetCardListByRarity(0).Count > 0)
|
|
|
+ {
|
|
|
+ ViewManager.Show<StoryCardChoose>(InstanceZonesDataManager.currentScoreType);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ bool result = await ArenaSproxy.ReqChangeArenaDressup(_dataManager.SelectDressIndex, 0, MyDressUpHelper.dressUpObj.itemList);
|
|
|
+ if (result)
|
|
|
+ {
|
|
|
+ if (_dataManager.SelectDressIndex == _dataManager.ThemeList.Count - 1)//最后一个主题搭配好要返回竞技场主界面
|
|
|
+ {
|
|
|
+ OnClickBtnBack();
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ _dataManager.SelectDressIndex++;
|
|
|
+ ViewManager.Show<ArenaDressUpFightView>();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ private IEnumerator ScreenShotTex()
|
|
|
+ {
|
|
|
+
|
|
|
+ GameObject Role = _sceneObject.transform.Find("Role").gameObject;
|
|
|
+ GameObject CopyRoleParent = _sceneObject.transform.Find("CopyRole").gameObject;
|
|
|
+ Transform CopyRole = CopyRoleParent.transform.Find("Role");
|
|
|
+ if (CopyRole != null)
|
|
|
+ {
|
|
|
+ GameObject.DestroyImmediate(CopyRole.gameObject);
|
|
|
+ }
|
|
|
+ Transform transform = GameObject.Instantiate(Role, CopyRoleParent.transform.position, Quaternion.identity).transform;//实例化物体
|
|
|
+ transform.parent = CopyRoleParent.transform;
|
|
|
+ transform.name = "Role";
|
|
|
+
|
|
|
+ GameObject gameObject = _sceneObject.transform.Find("FightCamera").gameObject;
|
|
|
+ Camera camera = gameObject.GetComponent<Camera>();
|
|
|
+ ArenaViewManager.Instance.textureDic[_dataManager.SelectDressIndex] = FightDataManager.Instance.GetPrintscreenNTexture(camera);
|
|
|
+
|
|
|
+ yield return new WaitForEndOfFrame();
|
|
|
+ }
|
|
|
+
|
|
|
+ private void OnClickBtnRecommend()
|
|
|
+ {
|
|
|
+ if (this.currentListType == DressUpListType.List4)
|
|
|
+ {
|
|
|
+ this.hideListParts2();
|
|
|
+ this.showListParts(ConstDressUpItemType.TAO_ZHUANG, true);
|
|
|
+ }
|
|
|
+ MyDressUpHelper.dressUpObj.CheckCancelActionWhenPutOn(_currentSuitId);
|
|
|
+ // InstanceZonesDataManager.usedRecommend = true;
|
|
|
+ // MyDressUpHelper.PutOnRecommendItems();
|
|
|
+ MyDressUpHelper.PutOnRecommendItems2();
|
|
|
+ _ui.m_txtDressLimit.text = string.Format("饰品穿戴限制:{0}/{1}", MyDressUpHelper.GetCurrentOrnamentCount(), GlobalCfgArray.globalCfg.dressLimitCount);
|
|
|
+
|
|
|
+ UpdateListPartsSelected();
|
|
|
+ UpdateListSuitPartsSelected();
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ private void InitLists()
|
|
|
+ {
|
|
|
+ _ui.m_comListType2.m_listType.itemRenderer = ListType2Item;
|
|
|
+ _ui.m_partsList.m_list.itemRenderer = ListPartsItem;
|
|
|
+ _ui.m_partsList2.m_list.itemRenderer = ListParts2Item;
|
|
|
+ listType1X = _ui.m_comListType1.target.x;
|
|
|
+ partsListX = _ui.m_partsList.target.x - _ui.m_partsList.target.width;
|
|
|
+ //一级菜单
|
|
|
+ _ui.m_comListType1.m_listType.itemRenderer = ListType1Item;
|
|
|
+ }
|
|
|
+
|
|
|
+ private void showListType1()
|
|
|
+ {
|
|
|
+ _currentList2 = null;
|
|
|
+ currentListType = DressUpListType.List1;
|
|
|
+ _ui.m_comListType1.m_listType.numItems = DressUpMenuItemCfg1Array.Instance.dataArray.Length - 3;
|
|
|
+ GTween.To(_ui.target.width, listType1X, 0.5f)
|
|
|
+ .SetTarget(_ui.m_comListType1.target)
|
|
|
+ .OnUpdate((GTweener t) =>
|
|
|
+ {
|
|
|
+ _ui.m_comListType1.target.x = t.value.x;
|
|
|
+ });
|
|
|
+ }
|
|
|
+ private void hideListType1()
|
|
|
+ {
|
|
|
+ GTween.To(listType1X, _ui.target.width, 0.5f)
|
|
|
+ .SetTarget(_ui.m_comListType1.target)
|
|
|
+ .OnUpdate((GTweener t) =>
|
|
|
+ {
|
|
|
+ _ui.m_comListType1.target.x = t.value.x;
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ private void showListType2(int[] menuStrArr = null)
|
|
|
+ {
|
|
|
+ currentListType = DressUpListType.List2;
|
|
|
+ if (menuStrArr != null && menuStrArr.Length > 0)
|
|
|
+ {
|
|
|
+ int len = menuStrArr.Length;
|
|
|
+ _currentList2 = menuStrArr.Clone() as int[];
|
|
|
+ _ui.m_comListType2.m_listType.RemoveChildrenToPool();
|
|
|
+ _ui.m_comListType2.m_listType.numItems = len;
|
|
|
+ //_ui.m_listType2.ResizeToFit(_ui.m_listType2.numItems);
|
|
|
+ float maxHeight = _ui.target.height - _ui.m_comListType2.m_listType.y - DressUpView.BOTTOM_BLANK;
|
|
|
+ if (_ui.m_comListType2.m_listType.height > maxHeight)
|
|
|
+ {
|
|
|
+ _ui.m_comListType2.m_listType.height = maxHeight;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ GTween.To(_ui.target.width, listType1X, 0.5f)
|
|
|
+ .SetTarget(_ui.m_comListType2.target)
|
|
|
+ .OnUpdate((GTweener t) =>
|
|
|
+ {
|
|
|
+ _ui.m_comListType2.target.x = t.value.x;
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ private void hideListType2()
|
|
|
+ {
|
|
|
+ GTween.To(listType1X, _ui.target.width, 0.5f)
|
|
|
+ .SetTarget(_ui.m_comListType2.target)
|
|
|
+ .OnUpdate((GTweener t) =>
|
|
|
+ {
|
|
|
+ _ui.m_comListType2.target.x = t.value.x;
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ private bool showListParts(int type, bool selectItem = false)
|
|
|
+ {
|
|
|
+ _currentMenuType = type;
|
|
|
+
|
|
|
+ UpdatePartsListSort();
|
|
|
+ if (_ui.m_partsList.m_list.numItems <= 0) return false;
|
|
|
+ _ui.m_partsList.m_list.ResizeToFit(_ui.m_partsList.m_list.numItems);
|
|
|
+ float maxHeight = _ui.m_partsList.target.height - _ui.m_partsList.m_list.y;
|
|
|
+ if (_ui.m_partsList.m_list.height > maxHeight)
|
|
|
+ {
|
|
|
+ _ui.m_partsList.m_list.height = maxHeight;
|
|
|
+ }
|
|
|
+ if (selectItem)
|
|
|
+ {
|
|
|
+ int itemId = MyDressUpHelper.dressUpObj.GetItemIdBuyType(_currentMenuType);
|
|
|
+ if (itemId > 0)
|
|
|
+ {
|
|
|
+ int index = _currentList3.IndexOf(itemId);
|
|
|
+ _ui.m_partsList.m_list.ScrollToView(index);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ currentListType = DressUpListType.List3;
|
|
|
+ GTween.To(_ui.target.width, partsListX, 0.5f)
|
|
|
+ .SetTarget(_ui.m_partsList)
|
|
|
+ .OnUpdate((GTweener t) =>
|
|
|
+ {
|
|
|
+ _ui.m_partsList.target.x = t.value.x;
|
|
|
+ });
|
|
|
+ UpdateListPartsSelected();
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ private void OnComboBoxRarityChanged()
|
|
|
+ {
|
|
|
+ _scoreIndex = _ui.m_partsList.m_comboBoxRarity.selectedIndex;
|
|
|
+ this.UpdatePartsListSort();
|
|
|
+ }
|
|
|
+ private void UpdatePartsListSort()
|
|
|
+ {
|
|
|
+
|
|
|
+ if (_currentMenuType == 0) return;
|
|
|
+
|
|
|
+ if (_currentMenuType == (int)ConstDressUpItemType.TAO_ZHUANG)
|
|
|
+ {
|
|
|
+ _currentList3 = DressUpMenuSuitDataManager.GetSuitIDList();
|
|
|
+ if (_scoreIndex == SORT_BY_HIGH_SCORE)
|
|
|
+ {
|
|
|
+ _currentList3 = SuitUtil.SortSuitListByHighScore(_currentList3);
|
|
|
+ }
|
|
|
+ else if (_scoreIndex == SORT_BY_LOW_SCORE)
|
|
|
+ {
|
|
|
+ _currentList3 = SuitUtil.SortSuitListByLowScore(_currentList3);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ _currentList3.Reverse();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ _currentList3 = DressUpMenuItemDataManager.getItemDatasByType(_currentMenuType);
|
|
|
+ if (_scoreIndex == SORT_BY_HIGH_SCORE)
|
|
|
+ {
|
|
|
+ _currentList3 = DressUpMenuItemDataManager.SortItemListByHighScore(_currentList3);
|
|
|
+ }
|
|
|
+ else if (_scoreIndex == SORT_BY_LOW_SCORE)
|
|
|
+ {
|
|
|
+ _currentList3 = DressUpMenuItemDataManager.SortItemListByLowScore(_currentList3);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ _currentList3.Reverse();
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ if (DressUpMenuItemDataManager.dressFilterType == DressFilterType.Search)
|
|
|
+ {
|
|
|
+ _currentList3 = DressUpMenuItemDataManager.DressSearch(_currentList3);
|
|
|
+ }
|
|
|
+ else if (DressUpMenuItemDataManager.dressFilterType == DressFilterType.Filter)
|
|
|
+ {
|
|
|
+ _currentList3 = DressUpMenuItemDataManager.DressFilter(_currentList3);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ _ui.m_partsList.m_list.RemoveChildrenToPool();
|
|
|
+ _ui.m_partsList.m_list.numItems = _currentList3.Count;
|
|
|
+
|
|
|
+ }
|
|
|
+ private void UpdateSuitPartsListSort()
|
|
|
+ {
|
|
|
+ if (_currentMenuType == 0) return;
|
|
|
+
|
|
|
+ _currentList4 = new List<int>(SuitCfgArray.Instance.GetSuitItems(_currentSuitId, true));
|
|
|
+
|
|
|
+ if (DressUpMenuItemDataManager.dressFilterType == DressFilterType.Search)
|
|
|
+ {
|
|
|
+ _currentList4 = DressUpMenuItemDataManager.DressSearch(_currentList4);
|
|
|
+ }
|
|
|
+ else if (DressUpMenuItemDataManager.dressFilterType == DressFilterType.Filter)
|
|
|
+ {
|
|
|
+ _currentList4 = DressUpMenuItemDataManager.DressFilter(_currentList4);
|
|
|
+ }
|
|
|
+
|
|
|
+ _ui.m_partsList2.m_list.RemoveChildrenToPool();
|
|
|
+ _ui.m_partsList2.m_list.numItems = _currentList4.Count;
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ private void hideListParts()
|
|
|
+ {
|
|
|
+ GTween.To(partsListX, _ui.target.width, 0.5f)
|
|
|
+ .SetTarget(_ui.m_partsList)
|
|
|
+ .OnUpdate((GTweener t) =>
|
|
|
+ {
|
|
|
+ _ui.m_partsList.target.x = t.value.x;
|
|
|
+ });
|
|
|
+ }
|
|
|
+ private void showListParts2(int suitId)
|
|
|
+ {
|
|
|
+ _currentSuitId = suitId;
|
|
|
+
|
|
|
+ _ui.m_partsList2.m_comboBoxRarity.items = new string[] { "高稀有度", "低稀有度", "最近获得" };
|
|
|
+
|
|
|
+ this.UpdateSuitPartsListSort();
|
|
|
+ _ui.m_partsList2.m_list.ResizeToFit(_ui.m_partsList2.m_list.numItems);
|
|
|
+ float maxHeight = _ui.m_partsList2.target.height - _ui.m_partsList2.m_list.y;// - DressUpView.BOTTOM_BLANK;
|
|
|
+ if (_ui.m_partsList2.m_list.height > maxHeight)
|
|
|
+ {
|
|
|
+ _ui.m_partsList2.m_list.height = maxHeight;
|
|
|
+ }
|
|
|
+ currentListType = DressUpListType.List4;
|
|
|
+ GTween.To(_ui.target.width, partsListX, 0.5f)
|
|
|
+ .SetTarget(_ui.m_partsList2)
|
|
|
+ .OnUpdate((GTweener t) =>
|
|
|
+ {
|
|
|
+ _ui.m_partsList2.target.x = t.value.x;
|
|
|
+ });
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ private void hideListParts2()
|
|
|
+ {
|
|
|
+ _currentMenuType = ConstDressUpItemType.TAO_ZHUANG;
|
|
|
+
|
|
|
+ GTween.To(partsListX, _ui.target.width, 0.5f)
|
|
|
+ .SetTarget(_ui.m_partsList2)
|
|
|
+ .OnUpdate((GTweener t) =>
|
|
|
+ {
|
|
|
+ _ui.m_partsList2.target.x = t.value.x;
|
|
|
+ });
|
|
|
+ }
|
|
|
+ private void ListType1Item(int index, GObject item)
|
|
|
+ {
|
|
|
+ UI.DressUp.UI_TypeItem typeItem = UI.DressUp.UI_TypeItem.Proxy(item);
|
|
|
+ DressUpMenuItemCfg1 item1 = DressUpMenuItemCfg1Array.Instance.dataArray[index];
|
|
|
+ typeItem.m_icon.url = "ui://DressUp/hz_fenleitu_" + item1.id;
|
|
|
+ typeItem.m_txtname.text = item1.name;
|
|
|
+ //typeItem.m_imgTitle.url = "ui://DressUp/hz_iconzi_" + item1.id;
|
|
|
+ typeItem.target.data = item1.id;
|
|
|
+ typeItem.m_imgNeed.visible = false;
|
|
|
+ typeItem.m_imgNew.visible = DressUpMenuItemDataManager.CheckIsFirstMenuNew(item1.id);
|
|
|
+ UI.DressUp.UI_TypeItem.ProxyEnd();
|
|
|
+ }
|
|
|
+
|
|
|
+ private void ListType2Item(int index, GObject item)
|
|
|
+ {
|
|
|
+ UI.DressUp.UI_TypeItem typeItem = UI.DressUp.UI_TypeItem.Proxy(item);
|
|
|
+ DressUpMenuItemCfg2 item2 = DressUpMenuItemCfg2Array.Instance.dataArray[_currentList2[index] - 1];
|
|
|
+ typeItem.m_icon.url = "ui://DressUp/hz_fenleituej_" + item2.id;
|
|
|
+ typeItem.m_txtname.text = item2.name;
|
|
|
+ //typeItem.m_imgTitle.url = "ui://DressUp/hz_iconziej_" + item2.id;
|
|
|
+ typeItem.target.data = item2.id;
|
|
|
+ // var subType = ItemUtilCS.GetItemSubType(_fightCfg.needItemId);
|
|
|
+ // typeItem.m_imgNeed.visible = subType == item2.type;
|
|
|
+ typeItem.m_imgNew.visible = DressUpMenuItemDataManager.CheckIsSecondMenuNew(item2.id);
|
|
|
+
|
|
|
+ UI.DressUp.UI_TypeItem.ProxyEnd();
|
|
|
+ }
|
|
|
+
|
|
|
+ private void ListPartsItem(int index, GObject item)
|
|
|
+ {
|
|
|
+ UI_PartsListItem listItem = UI_PartsListItem.Proxy(item);
|
|
|
+ int id = (int)_currentList3[index];
|
|
|
+ string iconRes = "";
|
|
|
+ string partName = "";
|
|
|
+ string ext = "png";
|
|
|
+ if (_currentMenuType == (int)ConstDressUpItemType.TAO_ZHUANG)
|
|
|
+ {
|
|
|
+ SuitCfg suitCfg = SuitCfgArray.Instance.GetCfg(id);
|
|
|
+ iconRes = suitCfg.res;
|
|
|
+ partName = suitCfg.name;
|
|
|
+ listItem.m_iconSelected.visible = false;
|
|
|
+ listItem.m_txtScore.text = "" + SuitUtil.GetSuitScore(id);
|
|
|
+ RarityIconController.UpdateRarityIcon(listItem.m_rarity, id, false, true);
|
|
|
+ listItem.m_loaBorder.url = "ui://DressUp/hz_kuangk_" + suitCfg.rarity;
|
|
|
+ listItem.m_imgNew.visible = false;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ ItemCfg itemCfg = ItemCfgArray.Instance.GetCfg(id);
|
|
|
+ iconRes = itemCfg.res;
|
|
|
+ partName = itemCfg.name;
|
|
|
+ listItem.m_iconSelected.visible = MyDressUpHelper.dressUpObj.CheckDressUpItemIsOn(id);
|
|
|
+ listItem.m_txtScore.text = "" + ItemDataManager.GetItemAdditionScore(id, InstanceZonesDataManager.currentScoreType, _roleData.tags);
|
|
|
+ listItem.m_loaBorder.url = "ui://DressUp/hz_kuangk_" + itemCfg.rarity;
|
|
|
+ bool isNew = DressUpMenuItemDataManager.CheckIsDressUpItemNew(id);
|
|
|
+ listItem.m_imgNew.visible = isNew;
|
|
|
+ if (isNew)
|
|
|
+ {
|
|
|
+ ItemProxy.ReqSetItemRead(id).Coroutine();
|
|
|
+ }
|
|
|
+ RarityIconController.UpdateRarityIcon(listItem.m_rarity, id, false);
|
|
|
+ ext = ItemUtil.GetItemResExt(itemCfg.itemType, itemCfg.subType, true);
|
|
|
+ }
|
|
|
+ if (listItem.target.data == null)
|
|
|
+ {
|
|
|
+ LongPressGesture longPressGesture = new LongPressGesture(listItem.target);
|
|
|
+ longPressGesture.once = true;
|
|
|
+ longPressGesture.onAction.Add(OnLongPress);
|
|
|
+ _listLongPress.Add(longPressGesture);
|
|
|
+ }
|
|
|
+ listItem.m_icon.url = ResPathUtil.GetIconPath(iconRes, ext);
|
|
|
+ listItem.m_ScoreType.url = "ui://CommonGame/kp_sx_" + InstanceZonesDataManager.currentScoreType;
|
|
|
+ listItem.m_txtTitle.text = partName;
|
|
|
+ listItem.target.data = id;
|
|
|
+ listItem.m_imgNeed.visible = false;
|
|
|
+ UI_PartsListItem.ProxyEnd();
|
|
|
+ }
|
|
|
+ private void ListParts2Item(int index, GObject item)
|
|
|
+ {
|
|
|
+ UI_PartsListItem listItem = UI_PartsListItem.Proxy(item);
|
|
|
+ int id = (int)_currentList4[index];
|
|
|
+ string iconRes = "";
|
|
|
+ string partName = "";
|
|
|
+ string ext = "png";
|
|
|
+
|
|
|
+
|
|
|
+ if (listItem.target.data == null)
|
|
|
+ {
|
|
|
+ LongPressGesture longPressGesture = new LongPressGesture(listItem.target);
|
|
|
+ longPressGesture.once = true;
|
|
|
+ longPressGesture.onAction.Add(OnLongPress);
|
|
|
+ _listLongPress.Add(longPressGesture);
|
|
|
+ }
|
|
|
+ ItemCfg itemCfg = ItemCfgArray.Instance.GetCfg(id);
|
|
|
+ iconRes = itemCfg.res;
|
|
|
+ partName = itemCfg.name;
|
|
|
+ listItem.m_iconSelected.visible = MyDressUpHelper.dressUpObj.CheckDressUpItemIsOn(id);
|
|
|
+ listItem.m_loaBorder.url = "ui://DressUp/hz_kuangk_" + itemCfg.rarity;
|
|
|
+ RarityIconController.UpdateRarityIcon(listItem.m_rarity, id, false);
|
|
|
+ ext = ItemUtil.GetItemResExt(itemCfg.itemType, itemCfg.subType, true);
|
|
|
+
|
|
|
+ listItem.m_ScoreType.visible = true;
|
|
|
+ // int mainScore;
|
|
|
+ // int mainValuel;
|
|
|
+ // ItemDataManager.GetMainScore(id, out mainScore, out mainValuel);
|
|
|
+ listItem.m_ScoreType.url = ResPathUtil.GetCommonGameResPath("kp_sx_" + InstanceZonesDataManager.currentScoreType);
|
|
|
+ listItem.m_txtScore.text = "" + ItemDataManager.GetItemAdditionScore(id, InstanceZonesDataManager.currentScoreType, _dataManager.DressupList[_dataManager.SelectDressIndex].tags);
|
|
|
+
|
|
|
+ listItem.m_icon.url = ResPathUtil.GetIconPath(iconRes, ext);
|
|
|
+ listItem.m_txtTitle.text = partName;
|
|
|
+ listItem.target.data = id;
|
|
|
+ // listItem.m_txtScore.visible = false;
|
|
|
+ //listItem.m_ScoreType.visible = true;
|
|
|
+ listItem.m_imgNeed.visible = false;
|
|
|
+ bool isNew = DressUpMenuItemDataManager.CheckIsDressUpItemNew(id);
|
|
|
+ listItem.m_imgNew.visible = isNew;
|
|
|
+ if (isNew)
|
|
|
+ {
|
|
|
+ ItemProxy.ReqSetItemRead(id).Coroutine();
|
|
|
+ }
|
|
|
+ UI_PartsListItem.ProxyEnd();
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+ private void UpdateListPartsSelected()
|
|
|
+ {
|
|
|
+ int count = _ui.m_partsList.m_list.numChildren;
|
|
|
+ int suitId = MyDressUpHelper.dressUpObj.suitId;
|
|
|
+
|
|
|
+ for (int i = 0; i < count; i++)
|
|
|
+ {
|
|
|
+ UI_PartsListItem listItem = UI_PartsListItem.Proxy(_ui.m_partsList.m_list.GetChildAt(i));
|
|
|
+ int id = (int)listItem.target.data;
|
|
|
+ if (_currentMenuType == (int)ConstDressUpItemType.TAO_ZHUANG)
|
|
|
+ {
|
|
|
+ listItem.m_iconSelected.visible = suitId > 0 && id == suitId;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ bool isPutOn = MyDressUpHelper.dressUpObj.CheckDressUpItemIsOn(id);//非套装金判断是否穿戴
|
|
|
+ var isSceneType = DressUpMenuItemCfg1Array.Instance.CheckIsSceneType(id);
|
|
|
+ bool isSuit = !isSceneType && suitId > 0 && SuitCfgArray.Instance.GetSuitIdOfItem(id) == suitId;//非场景类, 若当前穿戴套装要判断item是否属于套装(更换场景类不会改变套装穿戴状态)
|
|
|
+ bool isSceneSuit = isSceneType && suitId > 0 && isPutOn;//场景类, 若当前穿戴套装要判断item是否属已穿戴
|
|
|
+ listItem.m_iconSelected.visible = isPutOn || isSuit || isSceneSuit;
|
|
|
+ }
|
|
|
+ UI_PartsListItem.ProxyEnd();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ private void UpdateListSuitPartsSelected()
|
|
|
+ {
|
|
|
+ int count = _ui.m_partsList2.m_list.numChildren;
|
|
|
+ int suitId = MyDressUpHelper.dressUpObj.suitId;
|
|
|
+
|
|
|
+ for (int i = 0; i < count; i++)
|
|
|
+ {
|
|
|
+ UI_PartsListItem listItem = UI_PartsListItem.Proxy(_ui.m_partsList2.m_list.GetChildAt(i));
|
|
|
+ int id = (int)listItem.target.data;
|
|
|
+
|
|
|
+ bool isPutOn = MyDressUpHelper.dressUpObj.CheckDressUpItemIsOn(id);//非套装金判断是否穿戴
|
|
|
+ var isSceneType = DressUpMenuItemCfg1Array.Instance.CheckIsSceneType(id);
|
|
|
+ bool isSuit = !isSceneType && suitId > 0 && SuitCfgArray.Instance.GetSuitIdOfItem(id) == suitId;//非场景类, 若当前穿戴套装要判断item是否属于套装(更换场景类不会改变套装穿戴状态)
|
|
|
+ bool isSceneSuit = isSceneType && suitId > 0 && isPutOn;//场景类, 若当前穿戴套装要判断item是否属已穿戴
|
|
|
+ listItem.m_iconSelected.visible = isPutOn || isSuit || isSceneSuit;
|
|
|
+ UI_PartsListItem.ProxyEnd();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ private void OnClickBtnSearch()
|
|
|
+ {
|
|
|
+ ViewManager.Show<DressFilterView>(false, new object[] { ViewName.DRESS_UP_VIEW });
|
|
|
+ }
|
|
|
+
|
|
|
+ private void SendLog()
|
|
|
+ {
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ private void CheckGuide(object param)
|
|
|
+ {
|
|
|
+ if (GuideDataManager.IsGuideFinish(ConstGuideId.BUY_CLOTHING) <= 0
|
|
|
+ || GuideDataManager.IsGuideFinish(ConstGuideId.START_FIGHT) <= 0
|
|
|
+ || GuideDataManager.IsGuideFinish(ConstGuideId.AUTOPLAY_FIGHT) <= 0)
|
|
|
+ {
|
|
|
+ UpdateToCheckGuide(null);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ Timers.inst.Remove(CheckGuide);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ protected override void UpdateToCheckGuide(object param)
|
|
|
+ {
|
|
|
+ if (!ViewManager.CheckIsTopView(this.viewCom)) return;
|
|
|
+ }
|
|
|
+
|
|
|
+ protected override void TryCompleteGuide()
|
|
|
+ {
|
|
|
+ base.TryCompleteGuide();
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|