更改了LevelManager内关卡解锁函数的判断方式

main
Yuntao Hu 2024-05-24 14:50:10 +08:00
parent 4bd790bfac
commit 5972eed92f
3 changed files with 15 additions and 24 deletions

View File

@ -64,7 +64,7 @@ namespace Gameplay
LevelInfo levelInfo = LevelManager.Instance.GetLevelInfoByID(levelId);//new LevelInfo(data);
await UI_LevelSelectController.Open(levelInfo);
await UI_LevelDetailController.Open(levelInfo);
UI_LevelDetailController.Open(levelInfo);
//EventManager.Instance.Send(EventManager.EventName.WindowJumpFinished);
}

View File

@ -337,15 +337,13 @@ namespace Gameplay.Level
/// <returns></returns>
public bool CheckLevelUnlock(int levelID)
{
LevelChapterType chapterType = GetLevelChapterType(levelID);
var lastInfo = GetLastFightLevelInfo(chapterType);
if (lastInfo == null)
var levelInfo = GetLevelInfoByID(levelID);
if(levelInfo == null)
{
DebugUtil.LogError($"cant find levelInfo,id:{levelID}");
return false;
}
return levelID <= lastInfo.ID;
return levelInfo.IsLock;
}
#endregion

View File

@ -138,7 +138,10 @@ public class UI_CategoryController : UIWindow
SetScrollView();
//info panel
infoPanel = new ItemInfoPopup(CommonUtils.GetGameObject(gameObject, "Image_BG/SecondPannel"), RegisterJumpEvent, isScale: false);
infoPanel = new ItemInfoPopup(CommonUtils.GetGameObject(gameObject, "Image_BG/SecondPannel"), () =>
{
CloseWindow();
}, isScale: false);
shownItemData = CategoryManager.Instance.ShowInCategory(PackageItemType.None);
foreach(var i in shownItemData)
{
@ -200,16 +203,6 @@ public class UI_CategoryController : UIWindow
shownItemData = CategoryManager.Instance.ShowInCategory(shownPackageType);
//sort
}
void RegisterJumpEvent()
{
EventManager.Instance.Register(EventManager.EventName.WindowJumpFinished, JumpActionEvent);
}
void JumpActionEvent()
{
EventManager.Instance.Unregister(EventManager.EventName.WindowJumpFinished, JumpActionEvent);
CloseWindow();
}
#endregion
#region ScrollviewFunc
@ -576,11 +569,11 @@ public class UI_CategoryController : UIWindow
ChoosePanel choosePanel;
public InfoPanel(GameObject Root,Action registerEvent, bool isScale = false) : base(Root, isScale)
public InfoPanel(GameObject Root,Action closeWindow, bool isScale = false) : base(Root, isScale)
{
Binder(Root);
BindPanelButtons(registerEvent);
BindPanelButtons(closeWindow);
}
void Binder(GameObject Root)
{
@ -639,7 +632,7 @@ public class UI_CategoryController : UIWindow
amountText.text = usageAmount.ToString();
}
void BindPanelButtons(Action registerEvent)
void BindPanelButtons(Action closeWindow)
{
BindButton(itemFrom, () =>
{
@ -666,7 +659,7 @@ public class UI_CategoryController : UIWindow
BindButton(CommonUtils.GetGameObject(itemFrom, "Image_Open/Button_0"), () =>
{
//TODO: LevelManager¼ì²é¹Ø¿¨ºÏ·¨ÐÔ
JumpToLevel(registerEvent);
JumpToLevel(closeWindow);
});
}
@ -842,14 +835,14 @@ public class UI_CategoryController : UIWindow
}
public ItemInfoPopup(GameObject go, Action registerEvent, bool isScale = true) : base(go, isScaleShow: isScale)
public ItemInfoPopup(GameObject go, Action closeWindow, bool isScale = true) : base(go, isScaleShow: isScale)
{
BG = CommonUtils.GetGameObject(go, "Image_BG");
//info panel
ItemInfopanel = CommonUtils.GetGameObject(go, "ItemInfo");
infoPanel = new InfoPanel(ItemInfopanel, registerEvent);
infoPanel = new InfoPanel(ItemInfopanel, closeWindow);
//choose panel
ItemChoosepanel = CommonUtils.GetGameObject(go, "ItemChoose");