|
@@ -0,0 +1,279 @@
|
|
|
+using System.Collections.Generic;
|
|
|
+using FairyGUI;
|
|
|
+using UI.CommonGame;
|
|
|
+namespace GFGGame
|
|
|
+{
|
|
|
+ public class ApproachView
|
|
|
+ {
|
|
|
+ private UI_ComTipsApproach _ui;
|
|
|
+ private object[] _viewData;
|
|
|
+
|
|
|
+ private int _itemId;
|
|
|
+ private object[] _fromeViewDatas;
|
|
|
+ private int _needCount;
|
|
|
+ private List<string[]> _approachDatas = new List<string[]>();
|
|
|
+
|
|
|
+ public void Dispose()
|
|
|
+ {
|
|
|
+ if (_ui != null)
|
|
|
+ {
|
|
|
+ _ui.Dispose();
|
|
|
+ _ui = null;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ public void OnHide()
|
|
|
+ {
|
|
|
+ _ui.m_list.onClickItem.Remove(OnClickListApproachItem);
|
|
|
+ if (_ui.m_list.numItems > 0)
|
|
|
+ {
|
|
|
+ _ui.m_list.ScrollToView(0);
|
|
|
+ _ui.m_list.numItems = 0;
|
|
|
+ }
|
|
|
+ _approachDatas.Clear();
|
|
|
+ _fromeViewDatas = null;
|
|
|
+ UI_ComTipsApproach.ProxyEnd();
|
|
|
+ }
|
|
|
+ public void OnShow(GComponent component, object[] viewData)
|
|
|
+ {
|
|
|
+ _ui = UI_ComTipsApproach.Proxy(component);
|
|
|
+ _viewData = viewData;
|
|
|
+ _itemId = (int)viewData[0];
|
|
|
+ _fromeViewDatas = viewData[1] as object[];
|
|
|
+ _needCount = viewData.Length > 2 ? (int)viewData[2] : 0;
|
|
|
+ _ui.m_list.itemRenderer = ListApproachItemRenderer;
|
|
|
+ _ui.m_list.onClickItem.Add(OnClickListApproachItem);
|
|
|
+
|
|
|
+ SetData();
|
|
|
+ UpdateView();
|
|
|
+ }
|
|
|
+
|
|
|
+ private void SetData()
|
|
|
+ {
|
|
|
+ ItemCfg itemCfg = ItemCfgArray.Instance.GetCfg(_itemId);
|
|
|
+ if (string.IsNullOrEmpty(itemCfg.approach)) return;
|
|
|
+
|
|
|
+ string[] approachStrs = itemCfg.approach.Split(';');
|
|
|
+ foreach (string approachStr in approachStrs)
|
|
|
+ {
|
|
|
+ if (string.IsNullOrEmpty(approachStr)) continue;
|
|
|
+ string[] infos = approachStr.Split('=');
|
|
|
+ _approachDatas.Add(infos);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ private void UpdateView()
|
|
|
+ {
|
|
|
+ _ui.m_txtNone.visible = _approachDatas.Count == 0;
|
|
|
+ _ui.m_list.numItems = _approachDatas.Count;
|
|
|
+ }
|
|
|
+
|
|
|
+ private void ListApproachItemRenderer(int index, GObject item)
|
|
|
+ {
|
|
|
+ UI_ListSourceItem listItem = UI_ListSourceItem.Proxy(item);
|
|
|
+ string[] infos = _approachDatas[index];
|
|
|
+ string functionId = infos[0];
|
|
|
+ GameFunctionCfg gameFunctionCfg = GameFunctionCfgArray.Instance.GetCfg(functionId);
|
|
|
+
|
|
|
+ if (functionId == ConstFunctionId.JU_QING_GUAN_QIA)
|
|
|
+ {
|
|
|
+ var levelCfgId = int.Parse(infos[1]);
|
|
|
+ var levelCfg = StoryLevelCfgArray.Instance.GetCfg(levelCfgId);
|
|
|
+ if (levelCfg.type == ConstInstanceZonesType.Story)
|
|
|
+ {
|
|
|
+ var chapterCfg = StoryChapterCfgArray.Instance.GetCfg(levelCfg.chapterId);
|
|
|
+ string chapter = NumberUtil.GetChiniseNumberText(chapterCfg.order);
|
|
|
+ string level = NumberUtil.GetChiniseNumberText(levelCfg.order);
|
|
|
+ if (levelCfg.subType == ConstInstanceZonesSubType.Normal)
|
|
|
+ {
|
|
|
+ listItem.m_txtSourceName.text = string.Format(gameFunctionCfg.name, chapter, level);
|
|
|
+ }
|
|
|
+ else if (levelCfg.subType == ConstInstanceZonesSubType.Hard)
|
|
|
+ {
|
|
|
+ listItem.m_txtSourceName.text = string.Format("精英" + gameFunctionCfg.name, chapter, level);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else if (levelCfg.type == ConstInstanceZonesType.Studio)
|
|
|
+ {
|
|
|
+ var studioCfg = StudioCfgArray.Instance.GetCfg(levelCfg.chapterId);
|
|
|
+ listItem.m_txtSourceName.text = levelCfg.name;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else if (functionId == ConstFunctionId.FU_ZHUANG_DIAN)
|
|
|
+ {
|
|
|
+ int shopId = int.Parse(infos[1]);
|
|
|
+ if (shopId == ConstStoreId.LUCKY_BOX_ACTIVITY_STORE_ID)
|
|
|
+ {
|
|
|
+ listItem.m_txtSourceName.text = "活动商店";
|
|
|
+ }
|
|
|
+ else if (shopId == ConstStoreId.LUCKY_BOX_STORE_ID)
|
|
|
+ {
|
|
|
+ listItem.m_txtSourceName.text = "落星商店";
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ listItem.m_txtSourceName.text = "服装店";
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ listItem.m_txtSourceName.text = gameFunctionCfg.name;
|
|
|
+ }
|
|
|
+
|
|
|
+ listItem.target.data = infos;
|
|
|
+ UI_ListSourceItem.ProxyEnd();
|
|
|
+ }
|
|
|
+ private void OnClickListApproachItem(EventContext context)
|
|
|
+ {
|
|
|
+ GObject listItem = context.data as GObject;
|
|
|
+ string[] infos = listItem.data as string[];
|
|
|
+ string functionId = infos[0];
|
|
|
+
|
|
|
+ int hasNum = ItemDataManager.GetItemNum(_itemId);
|
|
|
+ int needCount = 0;
|
|
|
+ bool isJump = true;
|
|
|
+ switch (functionId)
|
|
|
+ {
|
|
|
+ case ConstFunctionId.FU_ZHUANG_DIAN:
|
|
|
+ // this.Hide();
|
|
|
+
|
|
|
+ needCount = _needCount == 0 ? 1 : _needCount;
|
|
|
+ int shopId = int.Parse(infos[1]);
|
|
|
+ if (shopId == ConstStoreId.LUCKY_BOX_ACTIVITY_STORE_ID)
|
|
|
+ {
|
|
|
+ PromptController.Instance.ShowFloatTextPrompt("活动暂未开启");
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ isJump = ViewManager.Show(ViewName.CLOTHING_SHOP_VIEW, new object[] { shopId, null, _itemId, needCount }, _fromeViewDatas, true, true);
|
|
|
+ break;
|
|
|
+ case ConstFunctionId.FU_ZHUANG_DECOMPOSE:
|
|
|
+ // this.Hide();
|
|
|
+ isJump = ViewManager.Show<ClothingDecomposeView>(null, _fromeViewDatas);
|
|
|
+ break;
|
|
|
+ case ConstFunctionId.SHOP_GIFT_BAG:
|
|
|
+ // this.Hide();
|
|
|
+ int giftBagValue = int.Parse(infos[1]);
|
|
|
+ isJump = ViewManager.Show<RechargeStoreView>(giftBagValue, _fromeViewDatas);
|
|
|
+ break;
|
|
|
+ case ConstFunctionId.SHOP_EXCHANGE:
|
|
|
+ // this.Hide();
|
|
|
+ int exchangeValue = int.Parse(infos[1]);
|
|
|
+ isJump = ViewManager.Show<RechargeStoreView>(exchangeValue, _fromeViewDatas);
|
|
|
+ break;
|
|
|
+ case ConstFunctionId.JU_QING_GUAN_QIA:
|
|
|
+
|
|
|
+ string value = infos[1];
|
|
|
+ var levelCfgId = int.Parse(value);
|
|
|
+ var levelCfg = StoryLevelCfgArray.Instance.GetCfg(levelCfgId);
|
|
|
+ isJump = false;
|
|
|
+ if (levelCfg.type == ConstInstanceZonesType.Story)
|
|
|
+ {
|
|
|
+ if (!FunctionOpenDataManager.Instance.CheckIsFunOpenById(ViewName.STORY_CHAPTER_VIEW))
|
|
|
+ {
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ if (!MainStoryDataManager.CheckLevelUnlock(levelCfgId))
|
|
|
+ {
|
|
|
+ PromptController.Instance.ShowFloatTextPrompt("关卡未开启");
|
|
|
+ break;
|
|
|
+ }
|
|
|
+
|
|
|
+ if ((string)_fromeViewDatas[0] == ViewName.DRESS_UP_FIGHT_VIEW)
|
|
|
+ {
|
|
|
+ //从战斗换装必需品来源跳转到剧情界面,在剧情界面点返回后直接返回章节界面,无需返回换装界面
|
|
|
+ _fromeViewDatas = null;
|
|
|
+ }
|
|
|
+ isJump = ViewManager.Show(ViewName.STORY_CHAPTER_VIEW, levelCfg.chapterId, _fromeViewDatas, true);
|
|
|
+ InstanceZonesController.ShowLevelView(levelCfgId, StudioDataManager.Instance.OnFinishStoryLevel, _itemId, _needCount);
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ else if (levelCfg.type == ConstInstanceZonesType.Studio)
|
|
|
+ {
|
|
|
+ StudioCfg studioCfg = StudioCfgArray.Instance.GetCfg(levelCfg.chapterId);
|
|
|
+
|
|
|
+ if (!FunctionOpenDataManager.Instance.CheckIsFunOpenById(studioCfg.funId))
|
|
|
+ {
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ //TO DO
|
|
|
+ List<StoryLevelCfg> storyLevelCfgs = StoryLevelCfgArray.Instance.GetCfgsBytypeAndsubTypeAndchapterId(studioCfg.type, studioCfg.subType, studioCfg.id);
|
|
|
+ StudioDataManager.Instance.IsCanFight(levelCfg.id, out bool canFight, out string content);
|
|
|
+ if (!canFight)
|
|
|
+ {
|
|
|
+ PromptController.Instance.ShowFloatTextPrompt("关卡未开启");
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ // this.Hide();
|
|
|
+ if (!TimeUtil.CheckDayOfWeek(studioCfg.timeArr))
|
|
|
+ {
|
|
|
+ PromptController.Instance.ShowFloatTextPrompt("不在活动周期内");
|
|
|
+ break;
|
|
|
+ }
|
|
|
+
|
|
|
+ int type = studioCfg.funId == typeof(StudioPropertyView).Name ? 1 : 0;
|
|
|
+ StudioDataManager.Instance.TYPE_SELECT_INDEX = type;
|
|
|
+ StudioDataManager.Instance.PROPERTY_SELECT_INDEX = 0;
|
|
|
+ if (studioCfg.funId == typeof(StudioPropertyView).Name)
|
|
|
+ {
|
|
|
+ List<StudioCfg> studioCfgs = StudioCfgArray.Instance.GetCfgsByfunId(typeof(StudioPropertyView).Name);
|
|
|
+ for (int i = 0; i < studioCfgs.Count; i++)
|
|
|
+ {
|
|
|
+ if (studioCfgs[i].id == studioCfg.id)
|
|
|
+ {
|
|
|
+ StudioDataManager.Instance.PROPERTY_SELECT_INDEX = i;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ string viewName = "GFGGame." + studioCfg.funId;
|
|
|
+
|
|
|
+ ViewManager.Show(viewName, new object[] { type, 0 }, _fromeViewDatas);
|
|
|
+ StudioDataManager.Instance.VIEW_NAME = viewName;
|
|
|
+ InstanceZonesController.ShowLevelView(levelCfgId, StudioDataManager.Instance.OnFinishStoryLevel, _itemId, _needCount);
|
|
|
+ isJump = true;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+
|
|
|
+ break;
|
|
|
+ case ConstFunctionId.FU_ZHUANG_HE_CHENG:
|
|
|
+
|
|
|
+ isJump = false;
|
|
|
+ int suitId = SuitCfgManager.Instance.GetItemSuitId(_itemId);
|
|
|
+ if (suitId > 0)
|
|
|
+ {
|
|
|
+ // this.Hide();
|
|
|
+ isJump = ViewManager.Show(ViewName.CLOTHING_SYNTHETIC_VIEW, new object[] { suitId, _itemId }, _fromeViewDatas);
|
|
|
+
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ case ConstFunctionId.ZHAI_XING:
|
|
|
+ // this.Hide();
|
|
|
+ isJump = ViewManager.Show(ViewName.LUCKY_BOX_VIEW, null, _fromeViewDatas, true);
|
|
|
+ break;
|
|
|
+ case ConstFunctionId.TAO_ZHUANG_TU_JIAN:
|
|
|
+ isJump = false;
|
|
|
+ if (ViewManager.isViewOpen(ViewName.SUIT_GUIDE_VIEW))
|
|
|
+ {
|
|
|
+
|
|
|
+ // this.Hide();
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ // this.Hide();
|
|
|
+ isJump = ViewManager.Show(ViewName.SUIT_GUIDE_VIEW, null, _fromeViewDatas);
|
|
|
+
|
|
|
+ break;
|
|
|
+ case ConstFunctionId.TAO_ZHUANG_HE_CHENG:
|
|
|
+ // this.Hide();
|
|
|
+ isJump = ViewManager.Show(ViewName.SUIT_SYNTHETIC_LIST_VIEW);
|
|
|
+ break;
|
|
|
+ case ConstFunctionId.SUIT_FOSTER:
|
|
|
+ // this.Hide();
|
|
|
+ isJump = ViewManager.Show<ClothingListView>(null, _fromeViewDatas);
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ if (isJump)
|
|
|
+ {
|
|
|
+ EventAgent.DispatchEvent(ConstMessage.JUMP_TO_SOURCE);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+}
|