|
@@ -5,15 +5,29 @@ using FairyGUI;
|
|
|
using UI.CommonGame;
|
|
|
using UI.ClothingUpgrade;
|
|
|
using UnityEngine;
|
|
|
+using System.Text.RegularExpressions;
|
|
|
|
|
|
namespace GFGGame
|
|
|
{
|
|
|
public class ClothingSelectView : BaseWindow
|
|
|
{
|
|
|
private UI_ClothingSelectUI _ui;
|
|
|
+ private int partIndex1;
|
|
|
+ private int partIndex2;
|
|
|
+ private EffectUI _effectUI1;
|
|
|
+ private EffectUI _effectUI2;
|
|
|
|
|
|
public override void Dispose()
|
|
|
{
|
|
|
+ EffectUIPool.Recycle(_effectUI1);
|
|
|
+ _effectUI1 = null;
|
|
|
+ EffectUIPool.Recycle(_effectUI2);
|
|
|
+ _effectUI2 = null;
|
|
|
+ if (_ui != null)
|
|
|
+ {
|
|
|
+ _ui.Dispose();
|
|
|
+ _ui = null;
|
|
|
+ }
|
|
|
base.Dispose();
|
|
|
}
|
|
|
|
|
@@ -23,15 +37,20 @@ namespace GFGGame
|
|
|
packageName = UI_ClothingSelectUI.PACKAGE_NAME;
|
|
|
_ui = UI_ClothingSelectUI.Create();
|
|
|
this.viewCom = _ui.target;
|
|
|
+ isReturnView = true;
|
|
|
isfullScreen = true;
|
|
|
modal = true;
|
|
|
_ui.m_btnBack.onClick.Add(OnClickBtnBack);
|
|
|
_ui.m_selectList.itemRenderer = RenderListItem;
|
|
|
+
|
|
|
+ _effectUI1 = EffectUIPool.CreateEffectUI(_ui.m_bgEffect, "ui_gyp", "GYP_ALL");
|
|
|
+ _effectUI2 = EffectUIPool.CreateEffectUI(_ui.m_birdEffect, "ui_gyp", "GYP_Bird");
|
|
|
}
|
|
|
|
|
|
protected override void OnShown()
|
|
|
{
|
|
|
base.OnShown();
|
|
|
+ _ui.m_bg.url = ResPathUtil.GetBgImgPath("gyp_bg");
|
|
|
UpdateList();
|
|
|
}
|
|
|
|
|
@@ -39,33 +58,146 @@ namespace GFGGame
|
|
|
{
|
|
|
base.OnHide();
|
|
|
}
|
|
|
-
|
|
|
+ private void UpdateList()
|
|
|
+ {
|
|
|
+ _ui.m_selectList.numItems = CollectPartDataManager.Count;
|
|
|
+ }
|
|
|
private void RenderListItem(int index, GObject obj)
|
|
|
{
|
|
|
UI_clothingSelectItem listItem = UI_clothingSelectItem.Proxy(obj);
|
|
|
- if (listItem.target.data == null)
|
|
|
+ int level;
|
|
|
+ int levelNum;
|
|
|
+ int addNum;
|
|
|
+ if(index < CollectPartDataManager.Count - 1)
|
|
|
+ {
|
|
|
+ //0表示所有部位,1~7表示各个部位
|
|
|
+ partIndex1 = 0;
|
|
|
+ partIndex2 = index + 1;
|
|
|
+ }
|
|
|
+ else
|
|
|
{
|
|
|
- listItem.target.onClick.Add(OnBtnItem);
|
|
|
+ partIndex1 = 99;
|
|
|
+ partIndex2 = 99;
|
|
|
+ }
|
|
|
+ level = CollectPartDataManager.Instance.CollectPartDataDic[partIndex2][0];
|
|
|
+ levelNum = CollectPartDataManager.Instance.CollectPartDataDic[partIndex2][1];
|
|
|
+ if (IsOpenRank(partIndex2))
|
|
|
+ {
|
|
|
+ listItem.target.visible = true;
|
|
|
+ if (levelNum > 0)
|
|
|
+ {
|
|
|
+ addNum = CollegeBoostCfgArray.Instance.GetCfgBytypePartsAndtypePhaseAndlayer(partIndex1, level, levelNum).value;
|
|
|
+ float addNumPercentage = (float)addNum / CollectPartDataManager.Instance.AddtitionRatio;
|
|
|
+ listItem.m_c1.selectedIndex = 0;
|
|
|
+ listItem.m_partIcon.url = string.Format("ui://ClothingUpgrade/{0}", CollectPartDataManager.Instance.partImage[partIndex2]);
|
|
|
+ CollegeRankCfg rankItemList = CollegeRankCfgArray.Instance.GetCfgByRankPartsIdAndSecondLevelRank(partIndex1, level);
|
|
|
+ listItem.m_levelText.text = rankItemList.gradeName;
|
|
|
+ listItem.m_levelNumText.text = string.Format("{0}级", levelNum.ToString());
|
|
|
+ listItem.m_nameText.text = CollectPartDataManager.Instance.partNameDic[partIndex2];
|
|
|
+ listItem.m_levelDescText.text = string.Format("{0}%", addNumPercentage);
|
|
|
+
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+
|
|
|
+ listItem.m_c1.selectedIndex = 0;
|
|
|
+ listItem.m_partIcon.url = string.Format("ui://ClothingUpgrade/{0}", CollectPartDataManager.Instance.partImage[partIndex2]);
|
|
|
+ CollegeRankCfg rankItemList = CollegeRankCfgArray.Instance.GetCfgByRankPartsIdAndSecondLevelRank(partIndex1, level);
|
|
|
+ listItem.m_levelText.text = rankItemList.gradeName;
|
|
|
+ listItem.m_levelNumText.text = string.Format("{0}级", "0");
|
|
|
+ listItem.m_nameText.text = CollectPartDataManager.Instance.partNameDic[partIndex2];
|
|
|
+ listItem.m_levelDescText.text = string.Format("{0}%", "0");
|
|
|
+ }
|
|
|
+ if (listItem.target.data == null)
|
|
|
+ {
|
|
|
+ listItem.target.onClick.Add(OnBtnItem);
|
|
|
+ }
|
|
|
+ listItem.target.data = partIndex2;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ listItem.m_c1.selectedIndex = 1;
|
|
|
+ listItem.target.visible = false;
|
|
|
}
|
|
|
- listItem.target.data = index;
|
|
|
UI_clothingSelectItem.ProxyEnd();
|
|
|
}
|
|
|
+ private bool IsOpenRank(int partIndex,int levelNum = 9)
|
|
|
+ {
|
|
|
+ List<int> openList;
|
|
|
+ bool isRank = false;
|
|
|
+ bool isLevel = false;
|
|
|
+ bool isPassStory = false ;
|
|
|
+ CollegeRankOpenCfg openitem = CollegeRankOpenCfgArray.Instance.GetCfg(partIndex);
|
|
|
+ openList = GetOpenList(partIndex);
|
|
|
+ //判断段位
|
|
|
+ if (openitem.OpenPreconditionArr == null || openitem.OpenPreconditionArr.Length == 0)
|
|
|
+ {
|
|
|
+ isRank = true;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ if (CollectPartDataManager.Instance.CollectPartDataDic[openList[0]][0] >= openList[1])
|
|
|
+ {
|
|
|
+ if (CollectPartDataManager.Instance.CollectPartDataDic[openList[0]][1] >= openList[2])
|
|
|
+ {
|
|
|
+ isRank = true;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //判断等级
|
|
|
+ if(RoleDataManager.lvl >= openitem.needRoleLv)
|
|
|
+ {
|
|
|
+ isLevel = true;
|
|
|
+ }
|
|
|
+ //判断关卡
|
|
|
+ if(openitem.needStoryLevelId == 0 || InstanceZonesDataManager.CheckLevelPass(openitem.needStoryLevelId))
|
|
|
+ {
|
|
|
+ isPassStory = true;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ isPassStory = false;
|
|
|
+ }
|
|
|
+
|
|
|
+ return isRank&&isLevel&&isPassStory;
|
|
|
+ }
|
|
|
+ private List<int> GetOpenList(int partIndex)
|
|
|
+ {
|
|
|
+ List<int> openList = new List<int>();
|
|
|
+ string pattern = @"\d+";
|
|
|
+ CollegeRankOpenCfg openitem = CollegeRankOpenCfgArray.Instance.GetCfg(partIndex);
|
|
|
+ for (int i = 0; i < openitem.OpenPreconditionArr.Length; i++)
|
|
|
+ {
|
|
|
+ MatchCollection matches = Regex.Matches(openitem.OpenPreconditionArr[i], pattern);
|
|
|
+ foreach (Match match in matches)
|
|
|
+ {
|
|
|
+ openList.Add(int.Parse(match.Value));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return openList;
|
|
|
+ }
|
|
|
|
|
|
private void OnBtnItem(EventContext context)
|
|
|
{
|
|
|
GObject Item = context.sender as GObject;
|
|
|
int partIndex = (int)Item.data;
|
|
|
- ViewManager.Show<ClothingUpgradeView>(new object[] {partIndex });
|
|
|
+ if(IsOpenRank(partIndex))
|
|
|
+ {
|
|
|
+ ViewManager.Show<ClothingUpgradeView>(new object[] { partIndex });
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ //string openString = "";
|
|
|
+ //string partName = CollectPartDataManager.Instance.partNameDic[partIndex];
|
|
|
+ //List<int> openList = GetOpenList(partIndex);
|
|
|
+ //openString = CollegeRankCfgArray.Instance.GetCfgByRankPartsIdAndSecondLevelRank(partIndex2, openList[1]).gradeName;
|
|
|
+ //string descString = string.Format("该部位需要达到{0}{1}{2}开启", partName, openString, openList[2]);
|
|
|
+ PromptController.Instance.ShowFloatTextPrompt("需要达到特定条件开启");
|
|
|
+ }
|
|
|
}
|
|
|
-
|
|
|
private void OnClickBtnBack()
|
|
|
{
|
|
|
ViewManager.GoBackFrom(typeof(ClothingSelectView).FullName);
|
|
|
}
|
|
|
-
|
|
|
- private void UpdateList()
|
|
|
- {
|
|
|
-
|
|
|
- }
|
|
|
}
|
|
|
}
|