【UI】通关、选关特效bug,调整关卡
parent
10f68072a3
commit
1943ec12cd
|
@ -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": [
|
||||||
|
|
|
@ -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,
|
||||||
|
|
|
@ -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,
|
||||||
|
|
|
@ -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,
|
||||||
|
|
|
@ -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,
|
||||||
|
|
|
@ -44,6 +44,14 @@ 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()
|
||||||
{
|
{
|
||||||
|
|
|
@ -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)
|
||||||
|
|
|
@ -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()
|
||||||
|
@ -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()
|
||||||
|
|
|
@ -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();
|
||||||
}
|
}
|
||||||
|
|
|
@ -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));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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);
|
||||||
}
|
}
|
||||||
|
|
|
@ -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++)
|
||||||
{
|
{
|
||||||
|
@ -41,28 +40,23 @@ public class UILevelSelectItem : UIListItem<UILevelDataArray>
|
||||||
_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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -15,12 +15,9 @@ public class UIStayTunedController : UIWindow
|
||||||
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)
|
||||||
|
@ -31,6 +28,7 @@ public class UIStayTunedController : UIWindow
|
||||||
|
|
||||||
private void ChangeLanguage()
|
private void ChangeLanguage()
|
||||||
{
|
{
|
||||||
|
if (_imgName != null)
|
||||||
FindObj(_imgName).gameObject.SetActive(false);
|
FindObj(_imgName).gameObject.SetActive(false);
|
||||||
_imgName = StringManager.CurLanguage == StringManager.LanguageType.CN
|
_imgName = StringManager.CurLanguage == StringManager.LanguageType.CN
|
||||||
? "Img_StayTuned_CN"
|
? "Img_StayTuned_CN"
|
||||||
|
|
Loading…
Reference in New Issue