1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489 |
- using UI.DressUp;
- using FairyGUI;
- using UnityEngine;
- using System.Collections.Generic;
- using System;
- using ET;
- using System.Collections;
- namespace GFGGame
- {
- public class DressUpFightType
- {
- public int levelID;
- public int teaPartID;
- }
- public class DressUpFightView : BaseView
- {
- private UI_DressUpFightUI _ui;
- private int _fightID;
- private int _levelID;
- private int _TeaPartyID;
- private float listType1X = 0;
- private float partsListX = 0;
- private float partsListScrollingPosY = 0;
- private DressUpListType currentListType;
- private int[] _currentList2;
- 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 int scoreType = 0; //目标分数类型保存
- private bool IsTeaPart = false;
- 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 OnInit()
- {
- base.OnInit();
- packageName = UI_DressUpFightUI.PACKAGE_NAME;
- _ui = UI_DressUpFightUI.Create();
- viewCom = _ui.target;
- isfullScreen = true;
- _ui.m_btnClose.width = GRoot.inst.width;
- _ui.m_btnClose.height = GRoot.inst.height;
- _ui.m_btnClose.AddRelation(GRoot.inst, RelationType.Size);
- _ui.m_btnLastStep.visible = true;
- _ui.m_btnNextStep.visible = true;
- _ui.m_btnClose.visible = false;
- _ui.m_grpTips.visible = false;
- _ui.m_btnRepeal.visible = false;
- _ui.m_btnRenewal.visible = false;
- _ui.m_btnSearch.visible = true;
- // _ui.m_comboBox.items = new string[] { "我的套装一", "我的套装二", "我的套装三", "我的套装四", "我的套装五", "我的套装六" };
- _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_btnHome.onClick.Add(OnClickBtnHome);
- // _ui.m_btnClothingShop.onClick.Add(OnClickBtnClothingShop);
- // _ui.m_comboBox.onChanged.Add(OnComboBoxChanged);
- _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_btnHint.onClick.Add(OnClickBtnHint);
- // _ui.m_btnGuide.onClick.Add(OnTouchPad);
- _ui.m_btnClose.onClick.Add(OnClickBtnClose);
- _ui.m_btnDelete.onClick.Add(OnClickBtnDelete);
- _ui.m_btnNext.onClick.Add(OnClickBtnNext);
- _ui.m_btnRecommend.onClick.Add(OnClickBtnRecommend);
- _ui.m_btnSearch.onClick.Add(OnClickBtnSearch);
- _ui.m_btnAutoPlay.onClick.Add(OnClickBtnAutoPlay);
- _ui.m_btnLastStep.onClick.Add(OnClickBtnLastStep);
- _ui.m_btnNextStep.onClick.Add(OnClickBtnNextStep);
- _ui.m_btnSubmission.onClick.Add(OnClickBtnSubmission);
-
- _ui.m_compNeed.target.onClick.Add(OnClickComNeed);
- _ui.m_compNeed.m_listTag.itemRenderer = RenderListTagItem;
- // _ui.m_btnShow.onClick.Add(OnClickBtnShow);
- // _ui.m_btnHide.onClick.Add(OnClickBtnHide);
- // _ui.m_loaShow.onClick.Add(OnClickLoaShow);
- // _ui.m_btnHide.visible = false;
- // EventAgent.AddEventListener(ConstMessage.ITEM_CHANGED, UpdatePartsListSort);
- _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_SEARCH, UpdateSerch);
- EventAgent.AddEventListener(ConstMessage.DRESS_FILTER, UpdateSerch);
- EventAgent.AddEventListener(ConstMessage.DRESS_FILTER_RESET, DressResetSerch);
- EventAgent.AddEventListener(ConstMessage.TEA_PARTY_STATU, TeaPartyStatuChange);
- // EventAgent.AddEventListener(ConstMessage.DRESS_UP_SCORE_CHANGED, UpdateScore);
- }
- protected override void RemoveEventListener()
- {
- base.RemoveEventListener();
- EventAgent.RemoveEventListener(ConstMessage.CARD_CHOOSE, StartCalculateScore);
- EventAgent.RemoveEventListener(ConstMessage.DRESS_SEARCH, UpdateSerch);
- EventAgent.RemoveEventListener(ConstMessage.DRESS_FILTER, UpdateSerch);
- EventAgent.RemoveEventListener(ConstMessage.DRESS_FILTER_RESET, DressResetSerch);
- EventAgent.RemoveEventListener(ConstMessage.TEA_PARTY_STATU, TeaPartyStatuChange);
- // EventAgent.RemoveEventListener(ConstMessage.DRESS_UP_SCORE_CHANGED, UpdateScore);
- }
- protected override void OnShown()
- {
- base.OnShown();
- var objData = (DressUpFightType)this.viewData;
- if (objData.teaPartID > 0) {
- IsTeaPart = true;
- _TeaPartyID = objData.teaPartID;
- }
- _levelID = objData.levelID;
- if (!IsTeaPart)
- _ui.m_c1.selectedIndex = 0;
- else
- _ui.m_c1.selectedIndex = 2;
- _ui.m_loaGuide.visible = true;
- InstanceZonesDataManager.usedRecommend = false;
- // _ui.m_comboBox.title = "我的套装";
- _ui.m_txtRecommendCount.SetVar("v1", "" + GameGlobal.myNumericComponent.GetAsInt(ET.NumericType.RecommendCount)).FlushVars();
- _ui.m_txtRecommendCount.SetVar("v2", GlobalCfgArray.globalCfg.recommendCount.ToString()).FlushVars();
- _scoreIndex = _ui.m_partsList.m_comboBoxRarity.selectedIndex;
- _ui.m_btnAutoPlay.selected = FightDataManager.Instance.autoPlay;
- _ui.m_btnAutoPlay.visible = FunctionOpenDataManager.Instance.CheckIsFunOpenById(ConstFunctionId.FUNCTION_AUTOPLAY_FIGHT, false);
- _ui.m_btnRecommend.visible = FunctionOpenDataManager.Instance.CheckIsFunOpenById(ConstFunctionId.FUNCTION_AUTOPLAY_FIGHT, false);
- if (!IsTeaPart) {
- InstanceZonesDataManager.currentLevelCfgId = _levelID;
- _levelCfg = StoryLevelCfgArray.Instance.GetCfg(_levelID);
- _fightCfg = StoryFightCfgArray.Instance.GetCfg(_levelCfg.fightID);
- if (_levelCfg.type == ConstInstanceZonesType.Field)
- {
- scoreType = FieldDataManager.Instance.fieldInfos.theme;
- _ui.m_btnAutoPlay.visible = false;
- }
- else {
- scoreType = _fightCfg.scoreType;
- }
- InstanceZonesDataManager.FightScene = _levelCfg.type;
- _ui.m_compNeed.target.visible = _fightCfg.needItemId > 0 || _fightCfg.needSuitId > 0 || _fightCfg.needTagsArr.Length > 0;
- if (_ui.m_compNeed.target.visible)
- {
- _ui.m_compNeed.m_c1.selectedIndex = 0;
- if (_fightCfg.needItemId > 0)
- {
- _ui.m_compNeed.m_txtNeedName.text = ItemUtil.GetItemName(_fightCfg.needItemId);
- _ui.m_compNeed.target.data = _fightCfg.needItemId;
- _ui.m_compNeed.m_imgGot.visible = ItemDataManager.GetItemNum(_fightCfg.needItemId) > 0;
- }
- else if (_fightCfg.needSuitId > 0)
- {
- _ui.m_compNeed.m_txtNeedName.text = ItemUtil.GetSuitName(_fightCfg.needSuitId);
- _ui.m_compNeed.target.data = _fightCfg.needSuitId;
- _ui.m_compNeed.m_imgGot.visible = DressUpMenuSuitDataManager.CheckHaveSuit(_fightCfg.needSuitId);
- }
- else
- {
- _ui.m_compNeed.m_c1.selectedIndex = 1;
- _ui.m_compNeed.m_listTag.numItems = _fightCfg.needTagsArr.Length;
- _ui.m_compNeed.m_imgGot.visible = false;
- }
- }
- }
- InstanceZonesDataManager.currentScoreType = scoreType;
- //一级菜单
- _ui.m_comListType1.m_listType.RemoveChildrenToPool();
- _ui.m_comListType1.m_listType.numItems = DressUpMenuItemCfg1Array.Instance.dataArray.Length - 3;
- //_ui.m_comListType1.m_listType1.ResizeToFit(_ui.m_listType1.numItems);
- 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;
- _ui.m_scoreType.url = "ui://CommonGame/kp_sx_" + scoreType;
- this.showListType1();
- if (_sceneObject == null)
- {
- _sceneObject = PrefabManager.Instance.InstantiateSync(ResPathUtil.GetPrefabPath("SceneDressUpFight"));
- MyDressUpHelper.dressUpObj.setSceneObj(_sceneObject, false, false);
- MyDressUpHelper.dressUpObj.PutOnDefaultDressUpData(IsTeaPart);
- }
- _ui.m_txtDressLimit.text = string.Format("饰品穿戴限制:{0}/{1}", MyDressUpHelper.GetCurrentOrnamentCount(), GlobalCfgArray.globalCfg.dressLimitCount);
- UpdateStepBtn(true);
- UpdateScore();
- if (!IsTeaPart)
- SendLog();
- else
- {
- var teapartyRoleCfg = TeapartyRoleCfgArray.Instance.GetCfgsByid(LeagueDataManager.Instance.TeaPartyId);
- _ui.m_txtTeaPartyName.text = teapartyRoleCfg[objData.teaPartID - 1].name;
- }
- Timers.inst.AddUpdate(CheckGuide);
- TeaPartyStatuChange();
- }
- protected override void OnHide()
- {
- base.OnHide();
- _ui.m_btnClose.visible = false;
- _ui.m_grpTips.visible = false;
- if (_sceneObject != null)
- {
- GameObject.Destroy(_sceneObject);
- _sceneObject = null;
- }
- _fightCfg = null;
- _levelCfg = null;
- DressUpMenuItemDataManager.Clear();
- MyDressUpHelper.ResetMemory();
- Timers.inst.Remove(CheckGuide);
- }
- private void OnClickBtnLastStep()
- {
- if (!MyDressUpHelper.OnClickBtnLastStep()) return;
- UpdateStepBtn(false);
- }
- private void OnClickBtnNextStep()
- {
- if (!MyDressUpHelper.OnClickBtnNextStep()) return;
- UpdateStepBtn(false);
- }
- //茶话会提交搭配
- private void OnClickBtnSubmission()
- {
- ChangeTeapartyDressup();
- }
- private async void ChangeTeapartyDressup()
- {
- DressUpData dressUpData = MyDressUpHelper.dressUpObj.DressUpDataClone();
- bool result = await LeagueSproxy.ChangeTeapartyDressup(RoleDataManager.roleId, _TeaPartyID, dressUpData.itemList);
- if (result)
- {
- backView();
- }
- }
- private void backView()
- {
- if (IsTeaPart)
- {
- ViewManager.Show<LeagueTeaPartyView>();
- }
- else if (_levelCfg.type == ConstInstanceZonesType.Studio && _levelCfg.subType != ConstInstanceZonesSubType.Hard3)
- {
- ViewManager.Show(StudioDataManager.Instance.VIEW_NAME, StudioDataManager.Instance.PROPERTY_SELECT_INDEX, ViewManager.GetGoBackDatas(StudioDataManager.Instance.VIEW_NAME));
- }
- else if (_levelCfg.type == ConstInstanceZonesType.Studio && _levelCfg.subType == ConstInstanceZonesSubType.Hard3)
- {
- ViewManager.Show<StudioFilingView>(null, ViewManager.GetGoBackDatas(typeof(StudioFilingView).FullName));
- }
- else if (_levelCfg.type == ConstInstanceZonesType.Field)
- {
- ViewManager.GoBackFrom(typeof(DressUpFightView).FullName);
- }
- else
- {
- //ViewManager.GoBackFrom(typeof(StoryChapterView).FullName);
- ViewManager.Show<StoryChapterView>(_levelCfg.chapterId);//, new object[] { typeof(StoryChapterListView).FullName}
- }
- //MyDressUpHelper.dressUpObj.TakeOffAll();
- this.Hide();
- }
- private void OnClickBtnBack()
- {
- if (!IsTeaPart) {
- AlertUI.Show("是否确定退出?")
- .SetLeftButton(true, "否").SetRightButton(true, "是", (object data) =>
- {
- backView();
- });
- }
- else {
- AlertUI.Show("当期搭配未保存,是否放弃提交搭配?")
- .SetLeftButton(true, "放弃搭配", (object data) =>
- {
- backView();
- }).SetRightButton(true, "提交搭配", (object data) =>
- {
- ChangeTeapartyDressup();
- });
- }
- //ViewManager.Show<StoryChapterView>(StoryDataManager.currentChapter);
- }
- private void OnClickBtnHome()
- {
- AlertUI.Show("是否返回?")
- .SetLeftButton(true, "否").SetRightButton(true, "是", (object data) =>
- {
- //MyDressUpHelper.dressUpObj.TakeOffAll();
- GameController.GoBackToMainView();
- });
- }
- private void OnClickBtnClothingShop()
- {
- ViewManager.Show<ClothingShopView>(new object[] { null, scoreType }, null, false, true);
- }
- 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();
- UpdateScore();
- }
- 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));
- UpdateStepBtn(true);
- // 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.AddOrRemove(id, true);
- UpdateStepBtn(true);
- }
- _ui.m_txtDressLimit.text = string.Format("饰品穿戴限制:{0}/{1}", MyDressUpHelper.GetCurrentOrnamentCount(), GlobalCfgArray.globalCfg.dressLimitCount);
- // UpdateListPartsSelected();
- // UpdateListSuitPartsSelected();
- UpdateScore();
- }
- 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();
- UpdateScore();
- }
- 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();
- }
- 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 OnClickBtnHint()
- {
- this.ShowTaskHint();
- }
- 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);
- UpdateStepBtn(true);
- // UpdateListPartsSelected();
- // UpdateListSuitPartsSelected();
- }
- private void OnClickBtnClose()
- {
- _ui.m_btnClose.visible = false;
- _ui.m_grpTips.visible = false;
- }
- private void OnClickBtnNext()
- {
- // if (!MyDressUpHelper.CheckPutOnFinish())
- // {
- // AlertUI.Show("只有换好衣服才能出门哦!")
- // .SetRightButton(true, "好的");
- // return;
- // }
- if (!CheckHasNeed())
- {
- AlertUI.Show("未穿戴必需品。").SetRightButton(true, "好的");
- return;
- }
- var levelCfg = StoryLevelCfgArray.Instance.GetCfg(_levelID);
- if (RoleDataManager.power < levelCfg.power)
- {
- ItemUtil.AddPower(OnClickBtnPhotograph);
- return;
- }
- OnClickBtnPhotograph();
- }
- private bool CheckHasNeed()
- {
- int _suitId = MyDressUpHelper.dressUpObj.suitId;
- bool isNoSuit = _fightCfg.needSuitId > 0 && _suitId != _fightCfg.needSuitId;//需要套装但未穿套装
- bool isDressUpItem = MyDressUpHelper.dressUpObj.CheckDressUpItemIsOn(_fightCfg.needItemId);
- bool isIncludeItem = _suitId > 0 && Array.IndexOf(SuitCfgArray.Instance.GetCfg(_suitId).partsArr, _fightCfg.needItemId) >= 0;
- bool isNoItem = _fightCfg.needItemId > 0 && !isDressUpItem && !isIncludeItem;
- if (isNoSuit || isNoItem)
- {
- return false;
- }
- return true;
- }
- private void OnClickBtnPhotograph()
- {
- Timers.inst.StartCoroutine(ScreenShotTex());
- }
- 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>();
- FightDataManager.Instance.RoleTextuex = FightDataManager.Instance.GetPrintscreenNTexture(camera);
- yield return new WaitForEndOfFrame();
- if (CardDataManager.GetCardListByRoleType(0).Count > 0)
- {
- ViewManager.Show<StoryCardChoose>(scoreType);
- }
- else
- {
- StartCalculateScore();
- }
- }
- private void StartCalculateScore()
- {
- //不可移动代码位置
- bool hasFightTarget = _fightCfg.targetName != null && _fightCfg.targetName.Length > 0;
- if (_levelCfg.type == ConstInstanceZonesType.Field)
- {
- FieldFightDataManager.Instance.CurrentCardId = InstanceZonesDataManager.currentCardId;
- FieldFightDataManager.Instance.CurrentScoreType = InstanceZonesDataManager.currentScoreType;
- FieldFightDataManager.Instance.currentLevelCfgId = InstanceZonesDataManager.currentLevelCfgId;
- }
- if (hasFightTarget)
- {
- ViewManager.Show<StoryFightTargetView>();
- }
- else
- {
- ViewManager.Show<StoryFightSingleView>();
- }
- this.Hide();
- }
- private void OnClickBtnRecommend()
- {
- if (this.currentListType == DressUpListType.List4)
- {
- this.hideListParts2();
- this.showListParts(ConstDressUpItemType.TAO_ZHUANG, true);
- }
- InstanceZonesDataManager.usedRecommend = true;
- // MyDressUpHelper.PutOnRecommendItems();
- MyDressUpHelper.PutOnRecommendItems2();
- _ui.m_txtDressLimit.text = string.Format("饰品穿戴限制:{0}/{1}", MyDressUpHelper.GetCurrentOrnamentCount(), GlobalCfgArray.globalCfg.dressLimitCount);
- UpdateStepBtn(true);
- // UpdateListPartsSelected();
- // UpdateListSuitPartsSelected();
- UpdateScore();
- if (!CheckHasNeed())
- {
- PromptController.Instance.ShowFloatTextPrompt("未拥有必需品");
- }
- }
- 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, true);
- }
- else if (_scoreIndex == SORT_BY_LOW_SCORE)
- {
- _currentList3 = DressUpMenuItemDataManager.SortItemListByLowScore(_currentList3, true);
- }
- else
- {
- _currentList3.Reverse();
- }
- }
- // if (DressUpMenuItemDataManager.dressFilterType == DressFilterType.Search)
- // {
- // _currentList3 = DressUpMenuItemDataManager.DressSearch(_currentList3);
- // }
- // else if (DressUpMenuItemDataManager.dressFilterType == DressFilterType.Filter)
- // {
- // _currentList3 = DressUpMenuItemDataManager.DressFilter(_currentList3);
- // }
- //必穿品放在列表最前面
- if (_fightCfg!= null && _fightCfg.needItemId > 0)
- {
- int index = _currentList3.IndexOf(_fightCfg.needItemId);
- if (index >= 0)
- {
- int item = _currentList3[index];
- _currentList3.Remove(_currentList3[index]);
- _currentList3.Insert(0, item);
- }
- }
- else if (_fightCfg != null && _fightCfg.needSuitId > 0)
- {
- int index = _currentList3.IndexOf(_fightCfg.needSuitId);
- if (index >= 0)
- {
- int item = _currentList3[index];
- _currentList3.Remove(_currentList3[index]);
- _currentList3.Insert(0, item);
- }
- }
- _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_TypeItem typeItem = 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;
- if (!IsTeaPart)
- {
- typeItem.m_imgNeed.visible = ItemUtil.CheckMenuType1(_fightCfg.needItemId, _fightCfg.needSuitId, item1.id);
- typeItem.m_itemType.selectedIndex = 0;
- }
- else
- typeItem.m_itemType.selectedIndex = 1;
- typeItem.m_imgNew.visible = DressUpMenuItemDataManager.CheckIsFirstMenuNew(item1.id);
- UI_TypeItem.ProxyEnd();
- }
- private void ListType2Item(int index, GObject item)
- {
- UI_TypeItem typeItem = 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;
- if (!IsTeaPart) {
- typeItem.m_itemType.selectedIndex = 0;
- var subType = ItemUtilCS.GetItemSubType(_fightCfg.needItemId);
- typeItem.m_imgNeed.visible = subType == item2.type;
- typeItem.m_imgNew.visible = DressUpMenuItemDataManager.CheckIsSecondMenuNew(item2.id);
- }
- else
- typeItem.m_itemType.selectedIndex = 1;
- UI_TypeItem.ProxyEnd();
- }
- private void ListTagItem(int index, GObject item)
- {
- Dictionary<int, Dictionary<string, int>> tagsArr = (Dictionary<int, Dictionary<string, int>>)item.parent.data;
- UI_ComTagItem listItem = UI_ComTagItem.Proxy(item);
- string name = "";
- string score = "";
- foreach (var info in tagsArr[index].Keys) {
- name = info;
- score = tagsArr[index][info].ToString();
- }
- int tagType = TagCfgArray.Instance.GetCfg(name).type;
- UI.CommonGame.UI_ComTag itemTag = UI.CommonGame.UI_ComTag.Proxy(listItem.m_loaTag);
- itemTag.m_txtTag.text = name;
- itemTag.m_loaTag.url = ResPathUtil.GetCommonGameResPath("fzd_bqbq_" + tagType);
- itemTag.m_loaTag.scale = new Vector2(0.8f, 0.8f);
- UI.CommonGame.UI_ComTag.ProxyEnd();
- listItem.m_txtScore.text = score;
- UI_ComTagItem.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;
- if (!IsTeaPart)
- {
- listItem.m_txtScore.text = "" + SuitUtil.GetSuitScore(id);
- listItem.m_itemType.selectedIndex = 0;
- }
- else
- {
- if (listItem.m_ListTag.data == null)
- listItem.m_ListTag.itemRenderer = ListTagItem;
- var tagCfg = DressUpMenuSuitDataManager.GetSuitTagCfgArray(id);
- listItem.m_ListTag.data = tagCfg;
- listItem.m_ListTag.numItems = tagCfg.Count;
- listItem.m_itemType.selectedIndex = 1;
- }
- 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);
- if (!IsTeaPart) {
- listItem.m_txtScore.text = "" + ItemDataManager.GetItemAdditionScore(id, InstanceZonesDataManager.currentScoreType, _fightCfg.needTagsArr);
- listItem.m_itemType.selectedIndex = 0;
- }
- else {
- if (listItem.m_ListTag.data == null)
- listItem.m_ListTag.itemRenderer = ListTagItem;
- var tagsArr = DressUpMenuItemDataManager.GetTidyTagCfgArray(itemCfg);
- listItem.m_ListTag.data = tagsArr;
- listItem.m_ListTag.numItems = tagsArr.Count;
- listItem.m_itemType.selectedIndex = 1;
- }
- 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_" + scoreType;
- listItem.m_txtTitle.text = partName;
- listItem.target.data = id;
- listItem.m_imgNeed.visible = _fightCfg != null && (_fightCfg.needItemId == id || _fightCfg.needSuitId == id);
- 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);
- if (!IsTeaPart) {
- listItem.m_txtScore.text = "" + ItemDataManager.GetItemAdditionScore(id, InstanceZonesDataManager.currentScoreType, _fightCfg.needTagsArr);
- listItem.m_itemType.selectedIndex = 0;
- }
- else
- {
- if (listItem.m_ListTag.data == null)
- listItem.m_ListTag.itemRenderer = ListTagItem;
- var tagsArr = DressUpMenuItemDataManager.GetTidyTagCfgArray(itemCfg);
- listItem.m_ListTag.data = tagsArr;
- listItem.m_ListTag.numItems = tagsArr.Count;
- listItem.m_itemType.selectedIndex = 1;
- }
- 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_" + scoreType);
- if (!IsTeaPart) {
- listItem.m_txtScore.text = "" + ItemDataManager.GetItemAdditionScore(id, InstanceZonesDataManager.currentScoreType, _fightCfg.needTagsArr);
- listItem.m_itemType.selectedIndex = 0;
- }
- else
- {
- if (listItem.m_ListTag.data == null)
- {
- listItem.m_ListTag.itemRenderer = ListTagItem;
- }
- var tagsArr = DressUpMenuItemDataManager.GetTidyTagCfgArray(itemCfg);
- listItem.m_ListTag.data = tagsArr;
- listItem.m_ListTag.numItems = tagsArr.Count;
- listItem.m_itemType.selectedIndex = 1;
- }
- 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 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 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 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 ShowTaskHint()
- {
- _ui.m_btnClose.visible = true;
- _ui.m_grpTips.visible = true;
- string str = "";
- if (!IsTeaPart)
- str = _levelCfg.hint;
- else {
- var teapartyRoleCfg = TeapartyRoleCfgArray.Instance.GetCfgsByid(LeagueDataManager.Instance.TeaPartyId);
- str = teapartyRoleCfg[_TeaPartyID - 1].hint;
- }
- _ui.m_txtHint.text = str;
- if (this._ui.m_txtHint.textHeight > this._ui.m_txtHint.textFormat.size * 2)
- {
- this._ui.m_txtHint.align = AlignType.Left;
- }
- else
- {
- this._ui.m_txtHint.align = AlignType.Center;
- }
- }
- private void UpdateScore()
- {
- if (!IsTeaPart)
- _ui.m_txtScore.text = "" + FightDataManager.Instance.GetScore(InstanceZonesDataManager.roleData).ToString();
- // GuideController.TryGuideDressUpFightViewBtnNext(_ui.m_btnNext);
- else
- _ui.m_txtMatch.text = "" + LeagueDataManager.Instance.GetTeaPartyMatchedValue(InstanceZonesDataManager.roleData);
- }
- private void OnClickBtnSearch()
- {
- ViewManager.Show<DressFilterView>(false, new object[] { typeof(DressUpView).FullName});
- }
- private void OnClickBtnAutoPlay()
- {
- FightDataManager.Instance.autoPlay = _ui.m_btnAutoPlay.selected;
- }
- private void OnClickComNeed()
- {
- if (_fightCfg.needItemId <= 0 && _fightCfg.needSuitId <= 0)
- {
- return;
- }
- if (_fightCfg.needSuitId > 0)
- {
- ViewManager.Show<SuitPartsDetailView>(_fightCfg.needSuitId, new object[] { typeof(DressUpFightView).FullName, this.viewData });
- }
- else
- {
- int itemId = (int)_ui.m_compNeed.target.data;
- object[] sourceDatas = new object[] { itemId, new object[] { typeof(DressUpFightView).FullName, this.viewData }, 1 };
- GoodsItemTipsController.ShowItemTips(itemId, sourceDatas);
- }
- }
- private void RenderListTagItem(int index, GObject obj)
- {
- UI.CommonGame.UI_ComTag item = UI.CommonGame.UI_ComTag.Proxy(obj);
- string tag = _fightCfg.needTagsArr[index];
- int tagType = TagCfgArray.Instance.GetCfg(tag).type;
- item.m_txtTag.text = tag;
- item.m_loaTag.url = ResPathUtil.GetCommonGameResPath("fzd_bqbq_" + tagType);
- UI.CommonGame.UI_ComTag.ProxyEnd();
- }
- private bool CheckListCount(int type)
- {
- if (type == (int)ConstDressUpItemType.TAO_ZHUANG)
- {
- return DressUpMenuSuitDataManager.GetSuitIDList().Count > 0;
- }
- else
- {
- return DressUpMenuItemDataManager.getItemDatasByType(type).Count > 0;
- }
- }
- private void SendLog()
- {
- var levelCfg = StoryLevelCfgArray.Instance.GetCfg(_levelID);
- switch (levelCfg.type)
- {
- case ConstInstanceZonesType.Story:
- LogServerHelper.SendPlayParticipationLog((int)PlayParticipationEnum.CHUN_ZHONG_LOU, 2);
- break;
- case ConstInstanceZonesType.Studio:
- StudioCfg studioCfg = StudioCfgArray.Instance.GetCfg(levelCfg.chapterId);
- if (studioCfg.funId == typeof(StudioMetalView).Name)
- {
- LogServerHelper.SendPlayParticipationLog((int)PlayParticipationEnum.JIN_SHU_XIU_FU, 2);
- }
- else if (studioCfg.funId == typeof(StudioFabricView).Name)
- {
- LogServerHelper.SendPlayParticipationLog((int)PlayParticipationEnum.ZHI_WU_XIU_FU, 2);
- }
- else if (studioCfg.funId == typeof(StudioPropertyView).Name)
- {
- LogServerHelper.SendPlayParticipationLog((int)PlayParticipationEnum.SHU_HUA_XIU_FU, 2);
- }
- break;
- }
- }
- 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);
- }
- _ui.m_loaGuide.visible = false;
- }
- protected override void UpdateToCheckGuide(object param)
- {
- if (!ViewManager.CheckIsTopView(this.viewCom) || IsTeaPart) return;
- int buyClothingIndex = 0;
- int buyClothingSubIndex = 0;
- int taozhuangIndex = 0;
- int len = _ui.m_comListType1.m_listType.numChildren;
- for (int i = 0; i < len; i++)
- {
- UI_TypeItem item = UI_TypeItem.Proxy(_ui.m_comListType1.m_listType.GetChildAt(i));
- if (item != null)
- {
- int menuID = (int)item.target.data;
- DressUpMenuItemCfg1 dressUpMenuItemCfg1 = DressUpMenuItemCfg1Array.Instance.GetCfg(menuID);
- if (GuideDataManager.IsGuideFinish(ConstGuideId.START_FIGHT) <= 0 && dressUpMenuItemCfg1.type == ConstDressUpItemType.TAO_ZHUANG)
- {
- taozhuangIndex = i;
- break;
- }
- if (GuideDataManager.IsGuideFinish(ConstGuideId.BUY_CLOTHING) <= 0 && _fightCfg.needItemId > 0 && ItemUtil.CheckMenuType1(_fightCfg.needItemId, _fightCfg.needSuitId, dressUpMenuItemCfg1.id))
- {
- buyClothingIndex = i;
- break;
- }
- }
- UI_TypeItem.ProxyEnd();
- }
- buyClothingSubIndex = _currentList3.IndexOf(_fightCfg.needItemId);
- GuideController.TryGuide(_ui.m_comListType1.m_listType, ConstGuideId.START_FIGHT, 3, "点击相应的分类,可以快速找到服饰。", taozhuangIndex);
- GuideController.TryGuide(_ui.m_partsList.m_list, ConstGuideId.START_FIGHT, 4, "", 0);
- GuideController.TryGuide(_ui.m_btnNext, ConstGuideId.START_FIGHT, 5, "穿着完毕,来验证一下,换上的服饰是否符合需求。");
- // GuideController.TryCompleteGuide(ConstGuideId.START_FIGHT, 5);
- GuideController.TryGuide(_ui.m_compNeed.target, ConstGuideId.BUY_CLOTHING, 3, "当提示有“必需品”时,需要穿上对应物品才能通关。");
- GuideController.TryGuide(_ui.m_btnRecommend, ConstGuideId.BUY_CLOTHING, 7, "点击推荐搭配,可以快速穿上必须品。");
- GuideController.TryGuide(_ui.m_btnAutoPlay, ConstGuideId.BUY_CLOTHING, 8, "勾选后,会自动进行比拼哦~~");
- GuideController.TryCompleteGuide(ConstGuideId.BUY_CLOTHING, 8);
- GuideController.TryGuide(_ui.m_btnHint, ConstGuideId.FIGHT_TIPS, 1, "这次换装需要获得别人的认可呢。");
- GuideController.TryCompleteGuide(ConstGuideId.FIGHT_TIPS, 1);
- GuideController.TryGuide(_ui.m_btnRecommend, ConstGuideId.AUTOPLAY_FIGHT, 1, "", -1, true, 0, true, true);//这个引导自动完成,测试中策划要求件推荐搭配引导提前,为避免意外,没有改引导表,而是直接吧推荐搭配加到买必须品的引导力,这个引导自动完成
- if (GuideDataManager.currentGuideId == GuideCfgArray.Instance.GetCfg(ConstGuideId.AUTOPLAY_FIGHT).id) GuideController.TryCompleteGuideIndex(ConstGuideId.AUTOPLAY_FIGHT, 1);
- GuideController.TryCompleteGuide(ConstGuideId.AUTOPLAY_FIGHT, 1);
- }
- protected override void TryCompleteGuide()
- {
- base.TryCompleteGuide();
- // GuideController.TryCompleteGuide(ConstGuideId.START_FIGHT, 5);
- }
- private void TeaPartyStatuChange()
- {
- if (IsTeaPart && LeagueDataManager.Instance.TeaPartyStatus == LeagueTeaPartyStatus.YesGo)
- {
- AlertUI.Show("管理员已开启茶会,请前往挑战!")
- .SetLeftButton(false).SetRightButton(true, "确定", (object data) =>
- {
- ViewManager.Show<LeagueTeaPartyView>();
- });
- }
- }
- }
- }
|