关卡解锁状态和提示

main
yurui 2024-09-13 14:22:11 +08:00
parent 2316659e27
commit 69c4a52076
3 changed files with 38 additions and 12 deletions

View File

@ -23,6 +23,8 @@ public class ConditionLevelPass : ICondition
public string[] GetArgLocalizations(List<float> args)
{
return null;
int id = (int)args[0];
return new string[1] { id.ToString() };
}
}

View File

@ -305,6 +305,18 @@ public class LevelInfo : IRedPointTreeNode
}
#region API
/// <summary>
/// 获取解锁条件文本
/// </summary>
/// <returns></returns>
public string GetUnlockLocalizationText()
{
if (Cfg.Unlock.Length > 0)
return ConditionManager.Instance.GetConditionLocalization(Cfg.Unlock[0]);
else
return null;
}
/// <summary>
/// 获得星级目标的文本
/// </summary>

View File

@ -13,6 +13,7 @@ using PhxhSDK;
using TMPro;
using UnityEngine;
using UnityEngine.UI;
using Framework.Condition;
using Constants = Framework.Constants;
public class UI_LevelSelectController : UIWindow
@ -1541,6 +1542,10 @@ public class UI_LevelSelectController : UIWindow
/// 星级根节点
/// </summary>
private GameObject goStarRoot;
/// <summary>
/// 锁
/// </summary>
private GameObject goLock;
#endregion
/// <summary>
@ -1560,6 +1565,14 @@ public class UI_LevelSelectController : UIWindow
/// </summary>
private readonly Action<LevelInfo> levelAction;
/// <summary>
/// 是否上锁
/// </summary>
public bool IsLock
{
set { goLock.IsScaleShow(value); }
}
public LevelItem(GameObject root, Action<LevelInfo> level) : base(root)
{
levelAction = level;
@ -1571,6 +1584,7 @@ public class UI_LevelSelectController : UIWindow
goStraight = FindObj("Root/ImageStraight");
goDown = FindObj("Root/ImageDown");
goStarRoot = FindObj("Root/UI_Stars");
goLock = FindObj("Root/ImageLocked");
Transform tsStarRoot = goStarRoot.transform;
goStars = new GameObject[tsStarRoot.childCount];
for (int i = 0; i < tsStarRoot.childCount; ++i)
@ -1590,12 +1604,14 @@ public class UI_LevelSelectController : UIWindow
{
levelInfo = info;
if (null == levelInfo || levelInfo.IsLock)
if (null == levelInfo)
{
IsScaleShow = false;
return;
}
IsLock = levelInfo.IsLock;
textLevelName.text = info.IndexName;
if ((index & 1) == 1) // 奇数
{
@ -1661,6 +1677,11 @@ public class UI_LevelSelectController : UIWindow
private void OnClick()
{
if (levelInfo.IsLock)
{
UITipsManager.ShowTips(levelInfo.GetUnlockLocalizationText());
return;
}
levelAction?.Invoke(levelInfo);
}
}
@ -1718,16 +1739,7 @@ public class UI_LevelSelectController : UIWindow
return;
}
showCount = 0;
foreach (LevelInfo levelInfo in listLevelInfo)
{
if (levelInfo.IsLock)
break;
++showCount;
}
recycleView.ShowList(showCount);
recycleView.ShowList(listLevelInfo.Count);
IsScaleShow = true;
}