【UI】通关、选关特效bug,调整关卡

iOS_release
zhangaotian 2024-06-27 15:40:40 +08:00
parent 10f68072a3
commit 1943ec12cd
13 changed files with 74 additions and 59 deletions

View File

@ -2,7 +2,7 @@
"columnCount": 5,
"rowCount": 7,
"undoCount": 0,
"addTimeCount": 2,
"addTimeCount": 1,
"openHoleCount": 0,
"resetCount": 1,
"holesIndex": [

View File

@ -1,7 +1,7 @@
{
"columnCount": 4,
"rowCount": 7,
"undoCount": 1,
"undoCount": 0,
"addTimeCount": 0,
"openHoleCount": 1,
"resetCount": 1,

View File

@ -1,9 +1,9 @@
{
"columnCount": 5,
"rowCount": 5,
"undoCount": 1,
"undoCount": 0,
"addTimeCount": 0,
"openHoleCount": 1,
"openHoleCount": 0,
"resetCount": 1,
"holesIndex": [
0,

View File

@ -2,8 +2,8 @@
"columnCount": 5,
"rowCount": 5,
"undoCount": 0,
"addTimeCount": 1,
"openHoleCount": 2,
"addTimeCount": 0,
"openHoleCount": 1,
"resetCount": 1,
"holesIndex": [
0,

View File

@ -1,7 +1,7 @@
{
"columnCount": 4,
"rowCount": 6,
"undoCount": 2,
"undoCount": 0,
"addTimeCount": 0,
"openHoleCount": 0,
"resetCount": 1,

View File

@ -44,6 +44,14 @@ public partial class SROptions
{
LevelManager.Instance.IsNewbieGuide = true;
}
[Category("关卡相关"), DisplayName("通关到")]
public int PassLevelIndex
{
get => LevelSelectManager.Instance.CurPassLevelIndex;
set => LevelSelectManager.Instance.PassAllLevel(value);
}
[Category("界面相关"), DisplayName("开启评分弹窗")]
public void OpenScore()
{

View File

@ -7,16 +7,18 @@ namespace Gameplay.Game
public class GameStateStart : IState
{
private string _windowPos;
private bool _stayTuned;
public GameStateStart(string windowPos)
public GameStateStart(string windowPos, bool stayTuned = false)
{
_windowPos = windowPos;
_stayTuned = stayTuned;
}
public void OnEnter()
{
LoadingExecutorManager.Instance.ExecuteLoading(
new GameStartLoadingExecutor(_windowPos));
new GameStartLoadingExecutor(_windowPos, _stayTuned));
}
public void OnUpdate(float deltaTime)

View File

@ -16,6 +16,7 @@ namespace Gameplay.LoadingExecutor
public class GameStartLoadingExecutor : LoadingExecutorWithUILoadingController
{
private string _windowPos;
private bool _stayTuned;
protected override async UniTask _DoLoading()
{
@ -39,9 +40,10 @@ namespace Gameplay.LoadingExecutor
_destProgress = 100f;
}
public GameStartLoadingExecutor(string windowPos)
public GameStartLoadingExecutor(string windowPos, bool stayTuned = false)
{
_windowPos = windowPos;
_stayTuned = stayTuned;
}
private async UniTask InitGfx()
@ -65,6 +67,9 @@ namespace Gameplay.LoadingExecutor
if (!PlayerPrefs.HasKey(LevelConstants.FirstLaunch))
await UIManager.Instance.OpenWindow(UIConstants.UIUserAgreement);
if (_stayTuned)
await UIManager.Instance.OpenWindow(UIConstants.UIStayTuned);
}
private async UniTask PreLoadSelectLevel()

View File

@ -80,9 +80,10 @@ namespace Gameplay.Manager
UpdateLevelInfo();
}
public void PassAllLevel()
public void PassAllLevel(int levelId = 0)
{
var level = $"level{_allLevels.Count}";
var id = levelId == 0 ? _allLevels.Count : levelId;
var level = $"level{id}";
SaveNewPassLevel(level);
UpdateLevelInfo();
}

View File

@ -83,27 +83,26 @@ public class UIWinPanelController : UIWindow
_txtCoins.text = ShopManager.Instance.CurCoin.ToString();
}
private void OpenShopInLevel()
private async void OpenShopInLevel()
{
UIManager.Instance.OpenWindow(UIConstants.UIShop);
await UIManager.Instance.OpenWindow(UIConstants.UIShop);
}
private void NextLevel()
private async void NextLevel()
{
BIManager.Instance.TrackEventLevel(cfg.BI.Event.level_next_level);
CloseWindow();
BIManager.Instance.TrackEventLevel(cfg.BI.Event.level_next_level);
UIManager.Instance.CloseWindow(UIConstants.UIPausePanel);
var nextLevelID = LevelManager.Instance.CurrentLevel.GetLevelIndex() + 1;
var levelID = $"level{nextLevelID}";
if (LevelManager.Instance.IsLevelExist(levelID))
{
GameStateManager.Instance.ChangeState(new LevelState(levelID));
CloseWindow();
}
else
{
GameStateManager.Instance.ChangeState(new GameStateStart(UIConstants.UIMainPanel));
UIManager.Instance.OpenWindow(UIConstants.UIStayTuned);
UIManager.Instance.CloseWindow(UIConstants.UILevelPanel, true);
GameStateManager.Instance.ChangeState(new GameStateStart(UIConstants.UIMainPanel, true));
}
}

View File

@ -21,8 +21,8 @@ public class UILevelSelectController : UIWindow
private ScrollRect _scrollRect;
private RectTransform _contentTrans;
private float _listHeight = 1960f;
private const float SingleHeight = 165f;
private float _listHeight;
private float _singleHeight;
protected override void OnAwake()
{
@ -31,6 +31,7 @@ public class UILevelSelectController : UIWindow
_scrollRect = _levelObj.GetComponent<ScrollRect>();
_contentTrans = FindObj("Scv_LevelList/Viewport/Content").GetComponent<RectTransform>();
_listHeight = _contentTrans.rect.height;
_singleHeight = _listHeight / LevelConstants.LevelSelectCount;
InitGfx();
InitData();
@ -75,7 +76,7 @@ public class UILevelSelectController : UIWindow
var index = levelIndex % LevelConstants.LevelSelectCount;
var listNumber = levelIndex / LevelConstants.LevelSelectCount;
float targetPosition = (index * SingleHeight + listNumber * _listHeight) / _contentTrans.rect.height;
float targetPosition = (index * _singleHeight + listNumber * _listHeight) / _contentTrans.rect.height;
_scrollRect.normalizedPosition = new Vector2(_scrollRect.normalizedPosition.x, 1f - targetPosition);
}

View File

@ -1,3 +1,4 @@
using TMPro;
using PhxhSDK;
using Framework.BI;
using UnityEngine.UI;
@ -7,7 +8,6 @@ using Framework.Manager;
using Framework.Constants;
using System.Collections.Generic;
using System.Text.RegularExpressions;
using TMPro;
public class UILevelSelectItem : UIListItem<UILevelDataArray>
{
@ -17,6 +17,8 @@ public class UILevelSelectItem : UIListItem<UILevelDataArray>
private Image _imgBottom;
private List<string> _levelID;
private bool show;
private const string BtnPath = "Btns/Btn_Level ({0})";
private const string LevelIDPath = "Btns/Btn_Level ({0})/txt_LevelID";
private const string LockPath = "Btns/Btn_Level ({0})/Img_Lock";
@ -27,12 +29,9 @@ public class UILevelSelectItem : UIListItem<UILevelDataArray>
protected override void OnBindData(UILevelDataArray data)
{
show = false;
var passLevelIndex = LevelSelectManager.Instance.CurPassLevelIndex;
var groupIndex = passLevelIndex / LevelConstants.LevelSelectCount;
var levelIndex = passLevelIndex % LevelConstants.LevelSelectCount;
DebugUtil.LogError("通关是:{0}", passLevelIndex);
//根据数据绑定UI
for (int i = 0; i < LevelConstants.LevelSelectCount; i++)
{
@ -41,28 +40,23 @@ public class UILevelSelectItem : UIListItem<UILevelDataArray>
_locks[i] = _go.GetItem<Image>(string.Format(LockPath, i));
}
//最后一关
var gfx = false;
if (passLevelIndex == LevelSelectManager.Instance.CurAllLevelDatas.Count &&
groupIndex * LevelConstants.LevelSelectCount == passLevelIndex)
{
gfx = true;
LevelSelectManager.Instance.CurBtnObj = _go.FindObj(string.Format(BtnPath, _btns.Length - 1));
LevelSelectManager.Instance.GfxSelectLevel.transform.position =
LevelSelectManager.Instance.CurBtnObj.transform.position;
}
_levelID = new List<string>();
for (int i = 0; i < LevelConstants.LevelSelectCount; i++)
{
if (data.LevelID[i] != null)
{
//特效表现
if (groupIndex == data.LevelIndex && levelIndex == i && !gfx)
//特效
if (data.LevelIndex * LevelConstants.LevelSelectCount + i == passLevelIndex &&
passLevelIndex != LevelSelectManager.Instance.CurAllLevelDatas.Count)
{
LevelSelectManager.Instance.CurBtnObj = _go.FindObj(string.Format(BtnPath, i));
LevelSelectManager.Instance.GfxSelectLevel.transform.position =
LevelSelectManager.Instance.CurBtnObj.transform.position;
show = true;
}
else if (data.LevelIndex * LevelConstants.LevelSelectCount + 1 + i == passLevelIndex &&
passLevelIndex == LevelSelectManager.Instance.CurAllLevelDatas.Count)
{
LevelSelectManager.Instance.CurBtnObj = _go.FindObj(string.Format(BtnPath, _btns.Length - 1));
show = true;
}
//上锁表现
@ -87,8 +81,12 @@ public class UILevelSelectItem : UIListItem<UILevelDataArray>
_levelID.Add(data.LevelID[i]);
}
/*else
_btns[i].gameObject.SetActive(false);*/
}
if (show)
{
LevelSelectManager.Instance.GfxSelectLevel.transform.position =
LevelSelectManager.Instance.CurBtnObj.transform.position;
}
}
@ -98,6 +96,9 @@ public class UILevelSelectItem : UIListItem<UILevelDataArray>
{
_btns[i].onClick.RemoveAllListeners();
}
if (show)
LevelSelectManager.Instance.CurBtnObj = null;
}

View File

@ -15,12 +15,9 @@ public class UIStayTunedController : UIWindow
BindButton("Btn_Panel", () =>
{
EventManager.Instance.Send(EventManager.EventName.ShowGfx);
CloseWindow();
CloseWindow(true);
});
_imgName = StringManager.CurLanguage == StringManager.LanguageType.CN
? "Img_StayTuned_CN"
: "Img_StayTuned_EN";
FindObj(_imgName).gameObject.SetActive(true);
ChangeLanguage();
}
protected override void OnOpenWindow(object data)
@ -31,7 +28,8 @@ public class UIStayTunedController : UIWindow
private void ChangeLanguage()
{
FindObj(_imgName).gameObject.SetActive(false);
if (_imgName != null)
FindObj(_imgName).gameObject.SetActive(false);
_imgName = StringManager.CurLanguage == StringManager.LanguageType.CN
? "Img_StayTuned_CN"
: "Img_StayTuned_EN";