123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997 |
- using UI.DressUp;
- using FairyGUI;
- using UnityEngine;
- using System.Collections.Generic;
- namespace GFGGame
- {
- public class ArenaDressUpFightView : BaseView
- {
- private UI_ArenaDressUpFightUI _ui;
- // private DressUpObj _dressUpData = new DressUpObj();
- private ArenaDataManager _dataManager;
- private FightData _roleData;
- public List<int> _itemList;//记录打开界面时的穿戴数据(保存后会更新)
- private float listType1X = 0;
- private float partsListX = 0;
- private float partsListScrollingPosY = 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();
- }
- // _dressUpData.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;
- isReturnView = true;
- _scenePrefab = GFGAsset.Load<GameObject>(ResPathUtil.GetPrefabPath("SceneArenaDressUpFight"));
- }
- protected override void OnInit()
- {
- base.OnInit();
- _ui.m_btnLastStep.visible = true;
- _ui.m_btnNextStep.visible = true;
- _ui.m_btnSearch.visible = true;
- _ui.m_partsList.m_comboBoxRarity.items = new string[] { "高分优先", "低分优先" };
- _ui.m_partsListSearch.m_comboBoxRarity.items = new string[] { "高分优先", "低分优先" };
- InitLists();
- _ui.m_partsList.m_comboBoxRarity.onChanged.Add(OnComboBoxRarityChanged);
- _ui.m_partsListSearch.m_comboBoxRarity.onChanged.Add(OnSearchComboBoxRarityChanged);
- _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_partsListSearch.m_list.onClickItem.Add(OnClickSearchPartsListItem);
- _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_btnLastStep.onClick.Add(OnClickBtnLastStep);
- _ui.m_btnNextStep.onClick.Add(OnClickBtnNextStep);
- // _ui.m_comValueInfo.m_btnFightScoreRule.onClick.Add(OnBtnFightScoreRule);
- _ui.m_comValueInfo.GetChild("btnFightScoreRule").onClick.Add(OnBtnFightScoreRule);
- _ui.m_grhCloseComFightScore.onClick.Add(OnCloseComFightScore);
- _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.DRESS_SEARCH, UpdateSerch);
- EventAgent.AddEventListener(ConstMessage.DRESS_FILTER, UpdateSerch);
- EventAgent.AddEventListener(ConstMessage.CARD_SELECTED, UpdateValueInfo);
- EventAgent.AddEventListener(ConstMessage.DRESS_FILTER_RESET, DressResetSerch);
- }
- protected override void RemoveEventListener()
- {
- base.RemoveEventListener();
- EventAgent.RemoveEventListener(ConstMessage.DRESS_SEARCH, UpdateSerch);
- EventAgent.RemoveEventListener(ConstMessage.DRESS_FILTER, UpdateSerch);
- EventAgent.RemoveEventListener(ConstMessage.CARD_SELECTED, UpdateValueInfo);
- EventAgent.RemoveEventListener(ConstMessage.DRESS_FILTER_RESET, DressResetSerch);
- }
- protected override void OnShown()
- {
- base.OnShown();
- _dataManager = ArenaDataManager.Instance;
- _roleData = _dataManager.DressupList[_dataManager.SelectThemeIndex];
- _itemList = new List<int>(_roleData.itemList);
- InstanceZonesDataManager.currentScoreType = _dataManager.ThemeList[_dataManager.SelectThemeIndex];
- InstanceZonesDataManager.currentFightTags = _dataManager.DressupList[_dataManager.SelectThemeIndex].tags;
- _scoreIndex = _ui.m_partsList.m_comboBoxRarity.selectedIndex;
- _ui.m_grhCloseComFightScore.visible = false;
- //一级菜单
- _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;
- _ui.m_partsListSearch.target.x = _ui.target.width;
- this.showListType1();
- if (_sceneObject == null)
- {
- _sceneObject = GameObject.Instantiate(_scenePrefab);
- MyDressUpHelper.dressUpObj.setSceneObj(_sceneObject, false, false);
- // GameObject copyObj = _sceneObject.transform.Find("CopyRole").gameObject;
- // _dressUpData.setSceneObj(copyObj);
- }
- MyDressUpHelper.dressUpObj.PutOnItemList(_roleData.itemList);
- _ui.m_txtDressLimit.text = string.Format("饰品穿戴限制:{0}/{1}", MyDressUpHelper.GetCurrentOrnamentCount(), GlobalCfgArray.globalCfg.dressLimitCount);
- UpdateStepBtn(true);
- UpdateValueInfo();
- SendLog();
- }
- protected override void OnHide()
- {
- base.OnHide();
- if (_sceneObject != null)
- {
- GameObject.Destroy(_sceneObject);
- _sceneObject = null;
- }
- DressUpMenuItemDataManager.Clear();
- MyDressUpHelper.ResetMemory();
- _ui.m_grhCloseComFightScore.visible = false;
- _ui.m_comValueInfo.GetController("c2").selectedIndex = 0;
- }
- private void OnClickBtnBack()
- {
- bool isSave = _itemList.Count == MyDressUpHelper.dressUpObj.itemList.Count;
- if (isSave)
- {
- for (int i = 0; i < _itemList.Count; i++)
- {
- int itemId = MyDressUpHelper.dressUpObj.itemList[i];
- if (_itemList.IndexOf(itemId) < 0)
- {
- isSave = false;
- break;
- }
- }
- }
- if (!isSave)
- {
- AlertUI.Show("当前穿搭尚未保存,是否确定退出?")
- .SetLeftButton(true, "否").SetRightButton(true, "是", (object data) =>
- {
- GoBackToView();
- });
- }
- else
- {
- GoBackToView();
- }
- }
- private void GoBackToView()
- {
- _roleData.itemList = _itemList;
- FightDataManager.Instance.SetItemScoreList(_roleData);
- ScoreSystemData.Instance.SetEquipScoresWithPartId(_roleData);
- ViewManager.GoBackFrom(typeof(ArenaDressUpFightView).FullName);
- }
- private void OnBtnFightScoreRule()
- {
- _ui.m_grhCloseComFightScore.visible = true;
- }
- private void OnCloseComFightScore()
- {
- _ui.m_comValueInfo.GetController("c2").selectedIndex = 0;
- _ui.m_grhCloseComFightScore.visible = false;
- }
- private void OnClickBtnHome()
- {
- AlertUI.Show("是否返回?")
- .SetLeftButton(true, "否").SetRightButton(true, "是", (object data) =>
- {
- GameController.GoBackToMainView();
- });
- }
- private void UpdateValueInfo()
- {
- _roleData.itemList = MyDressUpHelper.dressUpObj.itemList;
- FightDataManager.Instance.SetItemScoreList(_roleData);
- ScoreSystemData.Instance.SetEquipScoresWithPartId(_roleData);
- ArenaViewManager.Instance.UpdateValue(_ui.m_comValueInfo, _dataManager.SelectThemeIndex, _dataManager.DressupList);
- }
- 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 OnClickSearchPartsListItem(EventContext context)
- {
- if (ViewManager.isViewOpen(typeof(DressUpItemTipsView).FullName))
- {
- return;
- }
- GObject listItem = 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.AddOrRemove(id, true);
- _ui.m_txtDressLimit.text = string.Format("饰品穿戴限制:{0}/{1}", MyDressUpHelper.GetCurrentOrnamentCount(), GlobalCfgArray.globalCfg.dressLimitCount);
- UpdateStepBtn(true);
- // UpdateSearchListPartsSelected();
- UpdateValueInfo();
- }
- 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)
- {
- partsListScrollingPosY = _ui.m_partsList.m_list.scrollPane.scrollingPosY;
- this.showListParts2(id);
- this.hideListParts();
- MyDressUpHelper.dressUpObj.PutOnItemList(MyDressUpHelper.GetSuitFightItems(id));
- }
- 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.AddOrRemove(id, true);
- }
- _ui.m_txtDressLimit.text = string.Format("饰品穿戴限制:{0}/{1}", MyDressUpHelper.GetCurrentOrnamentCount(), GlobalCfgArray.globalCfg.dressLimitCount);
- UpdateStepBtn(true);
- // 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;
- }
- if (!DressUpMenuItemDataManager.CheckHasItem(id))
- {
- PromptController.Instance.ShowFloatTextPrompt("还未获得这件装扮");
- return;
- }
- MyDressUpHelper.dressUpObj.AddOrRemove(id, true);
- _ui.m_txtDressLimit.text = string.Format("饰品穿戴限制:{0}/{1}", MyDressUpHelper.GetCurrentOrnamentCount(), GlobalCfgArray.globalCfg.dressLimitCount);
- UpdateStepBtn(true);
- // UpdateListSuitPartsSelected();
- UpdateValueInfo();
- }
- private void UpdateStepBtn(bool isAdd, int suitId = 0)
- {
- if (isAdd)
- {
- MyDressUpHelper.AddMemoryDressup();
- }
- _ui.m_btnLastStep.enabled = MyDressUpHelper.stepIndex > 0;
- _ui.m_btnNextStep.enabled = MyDressUpHelper.stepIndex < MyDressUpHelper.dressMemory.Count - 1;
- UpdateListPartsSelected();
- UpdateListSuitPartsSelected();
- UpdateSearchListPartsSelected();
- }
- 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();
- }
- else if (this.currentListType == DressUpListType.List5)
- {
- this.showListType1();
- this.hideSearchListType();
- }
- }
- private void OnClickBtnDelete()
- {
- MyDressUpHelper.dressUpObj.TakeOffAll();
- _roleData.cardId = 0;
- _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);
- UpdateStepBtn(true);
- // UpdateListPartsSelected();
- // UpdateListSuitPartsSelected();
- UpdateValueInfo();
- }
- private void OnClickBtnNext()
- {
- // if (!MyDressUpHelper.CheckPutOnFinish())
- // {
- // AlertUI.Show("换好衣服才能进行下一步哦~").SetRightButton(true, "好的");
- // }
- // else
- // {
- DressUpFinish();
- // }
- }
- private async void DressUpFinish()
- {
- if (CardDataManager.GetCardListByRoleType(0).Count > 0)
- {
- ViewManager.Show<StoryCardChoose>(InstanceZonesDataManager.currentScoreType);
- }
- else
- {
- bool result = await ArenaSproxy.ReqChangeArenaDressup(_dataManager.SelectThemeIndex, 0, MyDressUpHelper.dressUpObj.itemList);
- if (result)
- {
- _itemList = new List<int>(MyDressUpHelper.dressUpObj.itemList);
- PromptController.Instance.ShowFloatTextPrompt("保存成功");
- OnClickBtnBack();
- }
- }
- }
- // private void OnClickBtnRecommend()
- // {
- // if (this.currentListType == DressUpListType.List4)
- // {
- // this.hideListParts2();
- // this.showListParts(ConstDressUpItemType.TAO_ZHUANG, true);
- // }
- // MyDressUpHelper.dressUpObj.CheckCancelActionWhenPutOn(_currentSuitId);
- // 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;
- _ui.m_partsListSearch.m_list.itemRenderer = ListPartsItem;
- 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 (type == (int)ConstDressUpItemType.TAO_ZHUANG)
- {
- _ui.m_partsList.m_list.scrollPane.SetPosY(partsListScrollingPosY, false);
- partsListScrollingPosY = 0;
- }
- 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 OnSearchComboBoxRarityChanged()
- {
- _scoreIndex = _ui.m_partsListSearch.m_comboBoxRarity.selectedIndex;
- this.UpdateSearchList();
- }
- 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 showSearchListType()
- {
- // _currentList2 = null;
- currentListType = DressUpListType.List5;
- GTween.To(_ui.target.width, partsListX, 0.5f)
- .SetTarget(_ui.m_partsListSearch.target)
- .OnUpdate((GTweener t) =>
- {
- _ui.m_partsListSearch.target.x = t.value.x;
- });
- }
- private void hideSearchListType()
- {
- GTween.To(partsListX, _ui.target.width, 0.5f)
- .SetTarget(_ui.m_partsListSearch.target)
- .OnUpdate((GTweener t) =>
- {
- _ui.m_partsListSearch.target.x = t.value.x;
- });
- }
- /*****************************************************************************************************/
- private void DressResetSerch()
- {
- if (currentListType == DressUpListType.List5)
- {
- OnTouchPad();
- }
- }
- private void UpdateSerch(EventContext context)
- {
- if (context.data.ToString() == ConstMessage.DRESS_SEARCH)
- {
- _currentList3 = DressUpMenuItemDataManager.DressSearch(false);
- }
- else if (context.data.ToString() == ConstMessage.DRESS_FILTER)
- {
- _currentList3 = DressUpMenuItemDataManager.DressFilter(false);
- }
- ViewManager.Hide<ModalStatusView>();
- UpdateSearchList();
- if (currentListType != DressUpListType.List5)
- {
- hideListParts();
- hideListParts2();
- hideListType1();
- hideListType2();
- showSearchListType();
- }
- _currentMenuType = 0;
- }
- private void UpdateSearchList()
- {
- if (_scoreIndex == SORT_BY_HIGH_SCORE)
- {
- _currentList3 = DressUpMenuItemDataManager.SortItemListByHighScore(_currentList3, true);
- }
- else if (_scoreIndex == SORT_BY_LOW_SCORE)
- {
- _currentList3 = DressUpMenuItemDataManager.SortItemListByLowScore(_currentList3, true);
- }
- _currentMenuType = 0;
- _ui.m_partsListSearch.m_list.numItems = _currentList3.Count; ;
- }
- 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 = false;
- 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_btnAni.visible = false;
- 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.SelectThemeIndex].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;
- listItem.m_btnAni.visible = false;
- bool isNew = DressUpMenuItemDataManager.CheckIsDressUpItemNew(id);
- listItem.m_imgNew.visible = isNew;
- if (isNew)
- {
- ItemProxy.ReqSetItemRead(id).Coroutine();
- }
- UI_PartsListItem.ProxyEnd();
- }
- private void UpdateSearchListPartsSelected()
- {
- int count = _ui.m_partsListSearch.m_list.numChildren;
- int suitId = MyDressUpHelper.dressUpObj.suitId;
- for (int i = 0; i < count; i++)
- {
- UI_PartsListItem listItem = UI_PartsListItem.Proxy(_ui.m_partsListSearch.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 UpdateListPartsSelected()
- {
- GList list;
- if (_ui.m_partsList.target.x == partsListX)
- {
- list = _ui.m_partsList.m_list;
- }
- else if (_ui.m_partsListSearch.target.x == partsListX)
- {
- list = _ui.m_partsListSearch.m_list;
- }
- else
- {
- return;
- }
- int count = list.numChildren;
- int suitId = MyDressUpHelper.dressUpObj.suitId;
- for (int i = 0; i < count; i++)
- {
- UI_PartsListItem listItem = UI_PartsListItem.Proxy(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[] { typeof(DressUpView).FullName});
- }
- private void OnClickBtnLastStep()
- {
- if (!MyDressUpHelper.OnClickBtnLastStep()) return;
- UpdateStepBtn(false);
- }
- private void OnClickBtnNextStep()
- {
- if (!MyDressUpHelper.OnClickBtnNextStep()) return;
- UpdateStepBtn(false);
- }
- private void SendLog()
- {
- }
- }
- }
|