【设置】评分存盘放入设置中
parent
b4833ef177
commit
d5d2d5fc2c
|
@ -1,3 +1,4 @@
|
||||||
|
using Framework.Constants;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
public class CameraAdapter : MonoBehaviour
|
public class CameraAdapter : MonoBehaviour
|
||||||
|
@ -8,7 +9,7 @@ public class CameraAdapter : MonoBehaviour
|
||||||
{
|
{
|
||||||
_camera = transform.GetComponent<Camera>();
|
_camera = transform.GetComponent<Camera>();
|
||||||
var size = _camera.orthographicSize;
|
var size = _camera.orthographicSize;
|
||||||
_camera.orthographicSize = size * GlobalConstants.DesignResolutionWidth /
|
_camera.orthographicSize = size * NormalConstants.DesignResolutionWidth /
|
||||||
GlobalConstants.DesignResolutionHeight * Screen.height / Screen.width;
|
NormalConstants.DesignResolutionHeight * Screen.height / Screen.width;
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,3 +1,4 @@
|
||||||
|
using Framework.Constants;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.InputSystem;
|
using UnityEngine.InputSystem;
|
||||||
|
|
||||||
|
@ -35,7 +36,7 @@ public class CameraController : MonoBehaviour
|
||||||
{
|
{
|
||||||
_camera = transform.GetComponent<Camera>();
|
_camera = transform.GetComponent<Camera>();
|
||||||
var size = _camera.orthographicSize;
|
var size = _camera.orthographicSize;
|
||||||
_camera.orthographicSize = size * GlobalConstants.DesignResolutionWidth /
|
_camera.orthographicSize = size * NormalConstants.DesignResolutionWidth /
|
||||||
GlobalConstants.DesignResolutionHeight * Screen.height / Screen.width;
|
NormalConstants.DesignResolutionHeight * Screen.height / Screen.width;
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -9,23 +9,7 @@ namespace Framework.Constants
|
||||||
public const int PropPrice = 100;
|
public const int PropPrice = 100;
|
||||||
public const int TimePropPrice = 50;
|
public const int TimePropPrice = 50;
|
||||||
|
|
||||||
//多语言
|
// 关卡选择 一页的数量
|
||||||
public const string Chinese = "简体中文";
|
|
||||||
public const string English = "English";
|
|
||||||
|
|
||||||
//BI事件
|
|
||||||
public const string FteLevelSuccess = "fte_level_success_{0}";
|
|
||||||
public const string FteLevelEnter = "fte_level_enter_{0}";
|
|
||||||
|
|
||||||
//评分弹窗相关
|
|
||||||
public const string PopUpNumber = "PopUpNumber";
|
|
||||||
public const string PopUpToScore = "ToScore";
|
|
||||||
public const int PopUpLimitNumber = 8;
|
|
||||||
public const int LevelRateIndex = 4;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 关卡选择 一页数量
|
|
||||||
/// </summary>
|
|
||||||
public const int LevelSelectCount = 15;
|
public const int LevelSelectCount = 15;
|
||||||
|
|
||||||
//通关奖励
|
//通关奖励
|
||||||
|
|
|
@ -0,0 +1,23 @@
|
||||||
|
namespace Framework.Constants
|
||||||
|
{
|
||||||
|
public static class NormalConstants
|
||||||
|
{
|
||||||
|
public const float DesignResolutionWidth = 1080;
|
||||||
|
public const float DesignResolutionHeight = 1920;
|
||||||
|
|
||||||
|
public const string UserBuildSaveKey = "UserBuildInfo";
|
||||||
|
public const string DefaultBuildID = "Build_1";
|
||||||
|
|
||||||
|
//多语言
|
||||||
|
public const string Chinese = "简体中文";
|
||||||
|
public const string English = "English";
|
||||||
|
|
||||||
|
//BI事件
|
||||||
|
public const string FteLevelSuccess = "fte_level_success_{0}";
|
||||||
|
public const string FteLevelEnter = "fte_level_enter_{0}";
|
||||||
|
|
||||||
|
//评分弹窗相关
|
||||||
|
public const int PopUpLimitNumber = 8;
|
||||||
|
public const int LevelRateIndex = 4;
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,8 +0,0 @@
|
||||||
public static class GlobalConstants
|
|
||||||
{
|
|
||||||
public const float DesignResolutionWidth = 1080;
|
|
||||||
public const float DesignResolutionHeight = 1920;
|
|
||||||
|
|
||||||
public const string UserBuildSaveKey = "UserBuildInfo";
|
|
||||||
public const string DefaultBuildID = "Build_1";
|
|
||||||
}
|
|
|
@ -3,6 +3,7 @@ using PhxhSDK;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using LC.Newtonsoft.Json;
|
using LC.Newtonsoft.Json;
|
||||||
|
using Framework.Constants;
|
||||||
using Sirenix.OdinInspector;
|
using Sirenix.OdinInspector;
|
||||||
using Cysharp.Threading.Tasks;
|
using Cysharp.Threading.Tasks;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
@ -120,7 +121,7 @@ namespace Framework.Manager
|
||||||
public class UserBuildInfo
|
public class UserBuildInfo
|
||||||
{
|
{
|
||||||
public int GuideGroup;
|
public int GuideGroup;
|
||||||
public string BuildData = GlobalConstants.DefaultBuildID;
|
public string BuildData = NormalConstants.DefaultBuildID;
|
||||||
public Dictionary<string, string> ChooseNodeInfo;
|
public Dictionary<string, string> ChooseNodeInfo;
|
||||||
|
|
||||||
public UserBuildInfo()
|
public UserBuildInfo()
|
||||||
|
@ -138,6 +139,8 @@ namespace Framework.Manager
|
||||||
|
|
||||||
public class BuildManager
|
public class BuildManager
|
||||||
{
|
{
|
||||||
|
public const string UserBuildSaveKey = "UserBuildInfo";
|
||||||
|
public const string DefaultBuildID = "Build_1";
|
||||||
private const string NodeName = "Node{0}";
|
private const string NodeName = "Node{0}";
|
||||||
private const string OptionName = "Option{0}";
|
private const string OptionName = "Option{0}";
|
||||||
|
|
||||||
|
@ -263,7 +266,7 @@ namespace Framework.Manager
|
||||||
{
|
{
|
||||||
StorageManager.Instance.Init();
|
StorageManager.Instance.Init();
|
||||||
_userBuildInfo =
|
_userBuildInfo =
|
||||||
StorageManager.Instance.GetStorage<UserBuildInfo>(GlobalConstants.UserBuildSaveKey);
|
StorageManager.Instance.GetStorage<UserBuildInfo>(UserBuildSaveKey);
|
||||||
if (_userBuildInfo == null)
|
if (_userBuildInfo == null)
|
||||||
{
|
{
|
||||||
var buildId = _curBuildData.buildID;
|
var buildId = _curBuildData.buildID;
|
||||||
|
|
|
@ -11,8 +11,9 @@ namespace Framework.Setting
|
||||||
public float SoundVolume = 1f;
|
public float SoundVolume = 1f;
|
||||||
|
|
||||||
public string Language;
|
public string Language;
|
||||||
|
|
||||||
public bool FirstLaunch = true;
|
public bool FirstLaunch = true;
|
||||||
|
public int RateUsNumber = 0;
|
||||||
|
public bool RateUs = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public class SettingManager : Singlenton<SettingManager>
|
public class SettingManager : Singlenton<SettingManager>
|
||||||
|
@ -20,6 +21,12 @@ namespace Framework.Setting
|
||||||
private const string SettingKey = "SettingKey";
|
private const string SettingKey = "SettingKey";
|
||||||
private SettingData _settingData;
|
private SettingData _settingData;
|
||||||
|
|
||||||
|
public SettingData CurSettingData
|
||||||
|
{
|
||||||
|
get => _settingData;
|
||||||
|
private set => _settingData = value;
|
||||||
|
}
|
||||||
|
|
||||||
public void Init()
|
public void Init()
|
||||||
{
|
{
|
||||||
_settingData = StorageManager.Instance.GetStorage<SettingData>(SettingKey);
|
_settingData = StorageManager.Instance.GetStorage<SettingData>(SettingKey);
|
||||||
|
@ -62,9 +69,16 @@ namespace Framework.Setting
|
||||||
SaveSetting();
|
SaveSetting();
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool IsFirstLaunch()
|
public void SetRateUsPopNumber()
|
||||||
{
|
{
|
||||||
return _settingData.FirstLaunch;
|
_settingData.RateUsNumber++;
|
||||||
|
SaveSetting();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SetRateUs()
|
||||||
|
{
|
||||||
|
_settingData.RateUs = true;
|
||||||
|
SaveSetting();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SaveSetting()
|
private void SaveSetting()
|
||||||
|
|
|
@ -55,11 +55,11 @@ namespace Gameplay.LoadingExecutor
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private async UniTask InitBuildScene()
|
private async UniTask InitBuildScene()
|
||||||
{
|
{
|
||||||
var buildInfo = StorageManager.Instance.GetStorage<UserBuildInfo>(GlobalConstants.UserBuildSaveKey);
|
var buildInfo = StorageManager.Instance.GetStorage<UserBuildInfo>(NormalConstants.UserBuildSaveKey);
|
||||||
buildInfo ??= new UserBuildInfo();
|
buildInfo ??= new UserBuildInfo();
|
||||||
if (string.IsNullOrEmpty(buildInfo.BuildData))
|
if (string.IsNullOrEmpty(buildInfo.BuildData))
|
||||||
{
|
{
|
||||||
buildInfo.BuildData = GlobalConstants.DefaultBuildID;
|
buildInfo.BuildData = NormalConstants.DefaultBuildID;
|
||||||
}
|
}
|
||||||
|
|
||||||
//判断是否开启新手引导
|
//判断是否开启新手引导
|
||||||
|
@ -111,7 +111,7 @@ namespace Gameplay.LoadingExecutor
|
||||||
await UIManager.Instance.OpenWindow(UIConstants.UILogin);
|
await UIManager.Instance.OpenWindow(UIConstants.UILogin);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (SettingManager.Instance.IsFirstLaunch())
|
if (SettingManager.Instance.CurSettingData.FirstLaunch)
|
||||||
{
|
{
|
||||||
await UIManager.Instance.OpenWindow(UIConstants.UIUserAgreement);
|
await UIManager.Instance.OpenWindow(UIConstants.UIUserAgreement);
|
||||||
}
|
}
|
||||||
|
|
|
@ -145,7 +145,7 @@ namespace Gameplay.Manager
|
||||||
|
|
||||||
public void ReportEnterLevel()
|
public void ReportEnterLevel()
|
||||||
{
|
{
|
||||||
BIManager.Instance.TrackStringEventOnce(string.Format(LevelConstants.FteLevelEnter,
|
BIManager.Instance.TrackStringEventOnce(string.Format(NormalConstants.FteLevelEnter,
|
||||||
CurrentLevel.GetLevelIndex()));
|
CurrentLevel.GetLevelIndex()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -275,7 +275,7 @@ namespace Gameplay.Manager
|
||||||
|
|
||||||
private void ReportPassLevel()
|
private void ReportPassLevel()
|
||||||
{
|
{
|
||||||
BIManager.Instance.TrackStringEventOnce(string.Format(LevelConstants.FteLevelSuccess,
|
BIManager.Instance.TrackStringEventOnce(string.Format(NormalConstants.FteLevelSuccess,
|
||||||
CurrentLevel.GetLevelIndex()));
|
CurrentLevel.GetLevelIndex()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3,6 +3,7 @@ using UnityEngine.UIElements;
|
||||||
using Framework.Constants;
|
using Framework.Constants;
|
||||||
using Gameplay.Manager;
|
using Gameplay.Manager;
|
||||||
using Framework.Event;
|
using Framework.Event;
|
||||||
|
using Framework.Setting;
|
||||||
using UnityEngine.UI;
|
using UnityEngine.UI;
|
||||||
using Framework.UI;
|
using Framework.UI;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
@ -81,7 +82,7 @@ public class UILevelSelectController : UIWindow
|
||||||
_scrollRect.normalizedPosition = new Vector2(_scrollRect.normalizedPosition.x, 1f - targetPosition);
|
_scrollRect.normalizedPosition = new Vector2(_scrollRect.normalizedPosition.x, 1f - targetPosition);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void InitData()
|
private async void InitData()
|
||||||
{
|
{
|
||||||
LevelSelectManager.Instance.UpdateLevelInfo();
|
LevelSelectManager.Instance.UpdateLevelInfo();
|
||||||
_list = new UIList<UILevelSelectItem, UILevelDataArray>(_levelObj, "Viewport/Content/LevelPanel",
|
_list = new UIList<UILevelSelectItem, UILevelDataArray>(_levelObj, "Viewport/Content/LevelPanel",
|
||||||
|
@ -90,18 +91,16 @@ public class UILevelSelectController : UIWindow
|
||||||
_list.SetDatas(_levelDatas);
|
_list.SetDatas(_levelDatas);
|
||||||
|
|
||||||
//评分弹窗显示
|
//评分弹窗显示
|
||||||
if (!UnityEngine.PlayerPrefs.HasKey(LevelConstants.PopUpToScore) &&
|
if (!SettingManager.Instance.CurSettingData.RateUs &&
|
||||||
LevelSelectManager.Instance.CurPassLevelIndex >= LevelConstants.LevelRateIndex)
|
LevelSelectManager.Instance.CurPassLevelIndex >= NormalConstants.LevelRateIndex)
|
||||||
{
|
{
|
||||||
var popUpNumber = UnityEngine.PlayerPrefs.GetInt(LevelConstants.PopUpNumber, 0);
|
if (SettingManager.Instance.CurSettingData.RateUsNumber > NormalConstants.PopUpLimitNumber)
|
||||||
if (popUpNumber > LevelConstants.PopUpLimitNumber)
|
|
||||||
{
|
{
|
||||||
UIManager.Instance.OpenWindow(UIConstants.UIScore);
|
await UIManager.Instance.OpenWindow(UIConstants.UIScore);
|
||||||
UnityEngine.PlayerPrefs.SetInt(LevelConstants.PopUpNumber, 0);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
UnityEngine.PlayerPrefs.SetInt(LevelConstants.PopUpNumber, popUpNumber + 1);
|
SettingManager.Instance.SetRateUsPopNumber();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
using Framework.Constants;
|
using Framework.Constants;
|
||||||
|
using Framework.Setting;
|
||||||
using Framework.Event;
|
using Framework.Event;
|
||||||
using Framework.UI;
|
using Framework.UI;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
@ -20,7 +21,7 @@ public class UIScoreController : UIWindow
|
||||||
{
|
{
|
||||||
var url = Application.platform == RuntimePlatform.Android ? PathConstants.ScoreUrlAndroid : PathConstants.ScoreUrlIOS;
|
var url = Application.platform == RuntimePlatform.Android ? PathConstants.ScoreUrlAndroid : PathConstants.ScoreUrlIOS;
|
||||||
Application.OpenURL(url);
|
Application.OpenURL(url);
|
||||||
UnityEngine.PlayerPrefs.SetInt(LevelConstants.PopUpToScore, 1);
|
SettingManager.Instance.SetRateUs();
|
||||||
CloseWindow();
|
CloseWindow();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -50,8 +50,8 @@ public class UISettingPanelController : UIWindow
|
||||||
|
|
||||||
_lanDropdown = GameObject.Find("BG_SettingPanel/Language/Dropdown_Lan").GetComponent<TMP_Dropdown>();
|
_lanDropdown = GameObject.Find("BG_SettingPanel/Language/Dropdown_Lan").GetComponent<TMP_Dropdown>();
|
||||||
_lanDropdown.onValueChanged.AddListener(ChangLanguage);
|
_lanDropdown.onValueChanged.AddListener(ChangLanguage);
|
||||||
_lanDropdown.options.Add(new TMP_Dropdown.OptionData(LevelConstants.Chinese));
|
_lanDropdown.options.Add(new TMP_Dropdown.OptionData(NormalConstants.Chinese));
|
||||||
_lanDropdown.options.Add(new TMP_Dropdown.OptionData(LevelConstants.English));
|
_lanDropdown.options.Add(new TMP_Dropdown.OptionData(NormalConstants.English));
|
||||||
|
|
||||||
_lanDropdown.value = StringManager.CurLanguage == StringManager.LanguageType.CN ? 0 : 1;
|
_lanDropdown.value = StringManager.CurLanguage == StringManager.LanguageType.CN ? 0 : 1;
|
||||||
InitUI();
|
InitUI();
|
||||||
|
|
Loading…
Reference in New Issue