【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, "columnCount": 5,
"rowCount": 7, "rowCount": 7,
"undoCount": 0, "undoCount": 0,
"addTimeCount": 2, "addTimeCount": 1,
"openHoleCount": 0, "openHoleCount": 0,
"resetCount": 1, "resetCount": 1,
"holesIndex": [ "holesIndex": [

View File

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

View File

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

View File

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

View File

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

View File

@ -44,18 +44,26 @@ public partial class SROptions
{ {
LevelManager.Instance.IsNewbieGuide = true; LevelManager.Instance.IsNewbieGuide = true;
} }
[Category("关卡相关"), DisplayName("通关到")]
public int PassLevelIndex
{
get => LevelSelectManager.Instance.CurPassLevelIndex;
set => LevelSelectManager.Instance.PassAllLevel(value);
}
[Category("界面相关"), DisplayName("开启评分弹窗")] [Category("界面相关"), DisplayName("开启评分弹窗")]
public void OpenScore() public void OpenScore()
{ {
UIManager.Instance.OpenWindow(UIConstants.UIScore); UIManager.Instance.OpenWindow(UIConstants.UIScore);
} }
[Category("界面相关"), DisplayName("开启用户隐私协议弹窗")] [Category("界面相关"), DisplayName("开启用户隐私协议弹窗")]
public void OpenUserAgreement() public void OpenUserAgreement()
{ {
UIManager.Instance.OpenWindow(UIConstants.UIUserAgreement); UIManager.Instance.OpenWindow(UIConstants.UIUserAgreement);
} }
[Category("界面相关"), DisplayName("开启同步弹窗")] [Category("界面相关"), DisplayName("开启同步弹窗")]
public void OpenSyncData() public void OpenSyncData()
{ {
@ -116,7 +124,7 @@ public partial class SROptions
{ {
AppInfoManager.Instance.ClearRemoteDataWithClientID(); AppInfoManager.Instance.ClearRemoteDataWithClientID();
} }
#if SDK_FIREBASE #if SDK_FIREBASE
[Category("崩溃相关"), DisplayName("发送Firebase崩溃测试")] [Category("崩溃相关"), DisplayName("发送Firebase崩溃测试")]
public void TestCrash() public void TestCrash()

View File

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

View File

@ -16,6 +16,7 @@ namespace Gameplay.LoadingExecutor
public class GameStartLoadingExecutor : LoadingExecutorWithUILoadingController public class GameStartLoadingExecutor : LoadingExecutorWithUILoadingController
{ {
private string _windowPos; private string _windowPos;
private bool _stayTuned;
protected override async UniTask _DoLoading() protected override async UniTask _DoLoading()
{ {
@ -39,9 +40,10 @@ namespace Gameplay.LoadingExecutor
_destProgress = 100f; _destProgress = 100f;
} }
public GameStartLoadingExecutor(string windowPos) public GameStartLoadingExecutor(string windowPos, bool stayTuned = false)
{ {
_windowPos = windowPos; _windowPos = windowPos;
_stayTuned = stayTuned;
} }
private async UniTask InitGfx() private async UniTask InitGfx()
@ -55,7 +57,7 @@ namespace Gameplay.LoadingExecutor
{ {
UIRoot.Instance.BgDestroy(); UIRoot.Instance.BgDestroy();
await UIManager.Instance.OpenWindow(_windowPos); await UIManager.Instance.OpenWindow(_windowPos);
//用户协议 -> 登录 -> 数据同步 //用户协议 -> 登录 -> 数据同步
if (AppInfoManager.Instance.UpdateConfirm) if (AppInfoManager.Instance.UpdateConfirm)
await UIManager.Instance.OpenWindow(UIConstants.UISyncTip); await UIManager.Instance.OpenWindow(UIConstants.UISyncTip);
@ -65,6 +67,9 @@ namespace Gameplay.LoadingExecutor
if (!PlayerPrefs.HasKey(LevelConstants.FirstLaunch)) if (!PlayerPrefs.HasKey(LevelConstants.FirstLaunch))
await UIManager.Instance.OpenWindow(UIConstants.UIUserAgreement); await UIManager.Instance.OpenWindow(UIConstants.UIUserAgreement);
if (_stayTuned)
await UIManager.Instance.OpenWindow(UIConstants.UIStayTuned);
} }
private async UniTask PreLoadSelectLevel() private async UniTask PreLoadSelectLevel()

View File

@ -80,9 +80,10 @@ namespace Gameplay.Manager
UpdateLevelInfo(); 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); SaveNewPassLevel(level);
UpdateLevelInfo(); UpdateLevelInfo();
} }

View File

@ -53,7 +53,7 @@ public class UIWinPanelController : UIWindow
_txtOldCoins = newNumber; _txtOldCoins = newNumber;
_txtCoins.text = _txtOldCoins.ToString(); _txtCoins.text = _txtOldCoins.ToString();
} }
protected override void OnOpenWindow(object data) protected override void OnOpenWindow(object data)
{ {
_rawImageGaussianBlurMask.texture = CommonUIUtils.RenderTexture; _rawImageGaussianBlurMask.texture = CommonUIUtils.RenderTexture;
@ -83,27 +83,26 @@ public class UIWinPanelController : UIWindow
_txtCoins.text = ShopManager.Instance.CurCoin.ToString(); _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(); CloseWindow();
BIManager.Instance.TrackEventLevel(cfg.BI.Event.level_next_level);
UIManager.Instance.CloseWindow(UIConstants.UIPausePanel); UIManager.Instance.CloseWindow(UIConstants.UIPausePanel);
var nextLevelID = LevelManager.Instance.CurrentLevel.GetLevelIndex() + 1; var nextLevelID = LevelManager.Instance.CurrentLevel.GetLevelIndex() + 1;
var levelID = $"level{nextLevelID}"; var levelID = $"level{nextLevelID}";
if (LevelManager.Instance.IsLevelExist(levelID)) if (LevelManager.Instance.IsLevelExist(levelID))
{ {
GameStateManager.Instance.ChangeState(new LevelState(levelID)); GameStateManager.Instance.ChangeState(new LevelState(levelID));
CloseWindow();
} }
else else
{ {
GameStateManager.Instance.ChangeState(new GameStateStart(UIConstants.UIMainPanel)); UIManager.Instance.CloseWindow(UIConstants.UILevelPanel, true);
UIManager.Instance.OpenWindow(UIConstants.UIStayTuned); GameStateManager.Instance.ChangeState(new GameStateStart(UIConstants.UIMainPanel, true));
} }
} }

View File

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

View File

@ -1,3 +1,4 @@
using TMPro;
using PhxhSDK; using PhxhSDK;
using Framework.BI; using Framework.BI;
using UnityEngine.UI; using UnityEngine.UI;
@ -7,7 +8,6 @@ using Framework.Manager;
using Framework.Constants; using Framework.Constants;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
using TMPro;
public class UILevelSelectItem : UIListItem<UILevelDataArray> public class UILevelSelectItem : UIListItem<UILevelDataArray>
{ {
@ -17,6 +17,8 @@ public class UILevelSelectItem : UIListItem<UILevelDataArray>
private Image _imgBottom; private Image _imgBottom;
private List<string> _levelID; private List<string> _levelID;
private bool show;
private const string BtnPath = "Btns/Btn_Level ({0})"; private const string BtnPath = "Btns/Btn_Level ({0})";
private const string LevelIDPath = "Btns/Btn_Level ({0})/txt_LevelID"; private const string LevelIDPath = "Btns/Btn_Level ({0})/txt_LevelID";
private const string LockPath = "Btns/Btn_Level ({0})/Img_Lock"; 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) protected override void OnBindData(UILevelDataArray data)
{ {
show = false;
var passLevelIndex = LevelSelectManager.Instance.CurPassLevelIndex; var passLevelIndex = LevelSelectManager.Instance.CurPassLevelIndex;
var groupIndex = passLevelIndex / LevelConstants.LevelSelectCount;
var levelIndex = passLevelIndex % LevelConstants.LevelSelectCount;
DebugUtil.LogError("通关是:{0}", passLevelIndex);
//根据数据绑定UI //根据数据绑定UI
for (int i = 0; i < LevelConstants.LevelSelectCount; i++) for (int i = 0; i < LevelConstants.LevelSelectCount; i++)
{ {
@ -40,29 +39,24 @@ public class UILevelSelectItem : UIListItem<UILevelDataArray>
_levelIDTexts[i] = _go.GetItem<TextMeshProUGUI>(string.Format(LevelIDPath, i)); _levelIDTexts[i] = _go.GetItem<TextMeshProUGUI>(string.Format(LevelIDPath, i));
_locks[i] = _go.GetItem<Image>(string.Format(LockPath, i)); _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>(); _levelID = new List<string>();
for (int i = 0; i < LevelConstants.LevelSelectCount; i++) for (int i = 0; i < LevelConstants.LevelSelectCount; i++)
{ {
if (data.LevelID[i] != null) 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.CurBtnObj = _go.FindObj(string.Format(BtnPath, i));
LevelSelectManager.Instance.GfxSelectLevel.transform.position = show = true;
LevelSelectManager.Instance.CurBtnObj.transform.position; }
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]); _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(); _btns[i].onClick.RemoveAllListeners();
} }
if (show)
LevelSelectManager.Instance.CurBtnObj = null;
} }

View File

@ -10,28 +10,26 @@ public class UIStayTunedController : UIWindow
protected override void OnAwake() protected override void OnAwake()
{ {
EventManager.Instance.Register(EventManager.EventName.RefreshLanguage, ChangeLanguage); EventManager.Instance.Register(EventManager.EventName.RefreshLanguage, ChangeLanguage);
_rawImageGaussianBlurMask = GetComponent<RawImage>("GaussianBlurMask"); _rawImageGaussianBlurMask = GetComponent<RawImage>("GaussianBlurMask");
BindButton("Btn_Panel", () => BindButton("Btn_Panel", () =>
{ {
EventManager.Instance.Send(EventManager.EventName.ShowGfx); EventManager.Instance.Send(EventManager.EventName.ShowGfx);
CloseWindow(); CloseWindow(true);
}); });
_imgName = StringManager.CurLanguage == StringManager.LanguageType.CN ChangeLanguage();
? "Img_StayTuned_CN"
: "Img_StayTuned_EN";
FindObj(_imgName).gameObject.SetActive(true);
} }
protected override void OnOpenWindow(object data) protected override void OnOpenWindow(object data)
{ {
EventManager.Instance.Send(EventManager.EventName.HideGfx); EventManager.Instance.Send(EventManager.EventName.HideGfx);
_rawImageGaussianBlurMask.texture = CommonUIUtils.RenderTexture; _rawImageGaussianBlurMask.texture = CommonUIUtils.RenderTexture;
} }
private void ChangeLanguage() private void ChangeLanguage()
{ {
FindObj(_imgName).gameObject.SetActive(false); if (_imgName != null)
FindObj(_imgName).gameObject.SetActive(false);
_imgName = StringManager.CurLanguage == StringManager.LanguageType.CN _imgName = StringManager.CurLanguage == StringManager.LanguageType.CN
? "Img_StayTuned_CN" ? "Img_StayTuned_CN"
: "Img_StayTuned_EN"; : "Img_StayTuned_EN";