You've already forked taptap2024_GJ_chidouren
init
This commit is contained in:
89
Assets/Scripts/System/GameConstConfig.cs
Normal file
89
Assets/Scripts/System/GameConstConfig.cs
Normal file
@@ -0,0 +1,89 @@
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.RandomPool;
|
||||
using Framework.Asset;
|
||||
using Game;
|
||||
using Game.Data;
|
||||
using Game.Data.BaseData;
|
||||
using Sirenix.OdinInspector;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Serialization;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace System
|
||||
{
|
||||
[CreateAssetMenu]
|
||||
public class GameConstConfig : ScriptableObject
|
||||
{
|
||||
#region Instance Logic
|
||||
|
||||
private static GameConstConfig _instance;
|
||||
|
||||
public static GameConstConfig Instance
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_instance == null)
|
||||
{
|
||||
#if UNITY_EDITOR
|
||||
_instance = UnityEditor.AssetDatabase.LoadAssetAtPath<GameConstConfig> ("Assets/GameRes/AlwaysRes/Config/GameConstConfig.asset");
|
||||
#else
|
||||
_instance = AssetManager.Instance.LoadAlwaysAsset<GameConstConfig> ("Config/GameConstConfig.asset");
|
||||
#endif
|
||||
|
||||
_instance.Init ();
|
||||
}
|
||||
#if UNITY_EDITOR
|
||||
if (_instance == null)
|
||||
{
|
||||
_instance = CreateInstance<GameConstConfig> ();
|
||||
_instance.Init ();
|
||||
// 自定义资源保存路径
|
||||
string path = "Assets/GameRes/AlwaysRes/Config";
|
||||
//如果项目总不包含该路径,创建一个
|
||||
if (!Directory.Exists (path))
|
||||
{
|
||||
Directory.CreateDirectory (path);
|
||||
}
|
||||
|
||||
UnityEditor.AssetDatabase.CreateAsset (_instance, path + "/GameSettings.asset");
|
||||
UnityEditor.AssetDatabase.Refresh ();
|
||||
}
|
||||
#endif
|
||||
return _instance;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
[SerializeField, Header ("主角每日体力上限")] private int playerPowerLimit = 5;
|
||||
[SerializeField, Header ("在线挂机等级上限")] public int MaxHangUpLevel = 100;
|
||||
|
||||
[SerializeField, Header ("在线挂机每日广告次数")]
|
||||
public int MaxHangUpLevelAdCount = 10;
|
||||
|
||||
public int PlayerPowerLimit => playerPowerLimit;
|
||||
|
||||
private void Init ()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
private static Color[] _qualityColors =
|
||||
{
|
||||
Color.white,
|
||||
new (0.6f, 0.76f, 1f),
|
||||
new (0.75f, 0.39f, 1f),
|
||||
new (1f, 0.38f, 0.16f),
|
||||
new (0.82f, 1f, 0.17f),
|
||||
new (1f, 0.05f, 0.37f),
|
||||
};
|
||||
|
||||
public static Color GetQualityColor (int quality)
|
||||
{
|
||||
return _qualityColors[quality];
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user