Merge pull request 'Add setting game' (#431) from feature/dlg_setting into develop
Reviewed-on: https://git.pthub.vn/Unity/perfect-world-unity/pulls/431
This commit is contained in:
@@ -12,7 +12,60 @@ MonoBehaviour:
|
||||
m_Script: {fileID: 11500000, guid: 913f99a0553e9ec438c859c044d5c04b, type: 3}
|
||||
m_Name: GameRunConfig
|
||||
m_EditorClassIdentifier:
|
||||
playerPrefab: {fileID: 6513559496054861882, guid: 1f80fef119a826b4a826baf52a8f92d7, type: 3}
|
||||
monsterPrefab: {fileID: 6975799234359536760, guid: 244942d3fb9382846b82581ce24fbf4e, type: 3}
|
||||
npcServerPrefab: {fileID: 2426933851766496167, guid: 9bd42cdc18b3d624db35707155fc50de, type: 3}
|
||||
testVfxPrefab: {fileID: 2282869967233380084, guid: 88e840e5dac12ed4383d994c7fadfef1, type: 3}
|
||||
viewDistanceCfg:
|
||||
- title: Config 1
|
||||
fShow: 200
|
||||
fHide: 400
|
||||
- title: Config 2
|
||||
fShow: 400
|
||||
fHide: 600
|
||||
- title: Config 3
|
||||
fShow: 600
|
||||
fHide: 800
|
||||
- title: Config 4
|
||||
fShow: 800
|
||||
fHide: 1000
|
||||
- title: Config 5
|
||||
fShow: 1000
|
||||
fHide: 1200
|
||||
- title: Config 6
|
||||
fShow: 1200
|
||||
fHide: 1400
|
||||
viewDistanceNPCCfg:
|
||||
- title: Config 1
|
||||
fShow: 25
|
||||
fHide: 40
|
||||
- title: Config 2
|
||||
fShow: 40
|
||||
fHide: 55
|
||||
- title: Config 3
|
||||
fShow: 55
|
||||
fHide: 70
|
||||
- title: Config 4
|
||||
fShow: 70
|
||||
fHide: 85
|
||||
- title: Config 5
|
||||
fShow: 85
|
||||
fHide: 100
|
||||
- title: Config 6
|
||||
fShow: 100
|
||||
fHide: 115
|
||||
viewDistanceEPCfg:
|
||||
- title: Config 1
|
||||
fShow: 25
|
||||
fHide: 40
|
||||
- title: Config 2
|
||||
fShow: 40
|
||||
fHide: 55
|
||||
- title: Config 3
|
||||
fShow: 55
|
||||
fHide: 70
|
||||
- title: Config 4
|
||||
fShow: 70
|
||||
fHide: 85
|
||||
- title: Config 5
|
||||
fShow: 85
|
||||
fHide: 100
|
||||
- title: Config 6
|
||||
fShow: 100
|
||||
fHide: 115
|
||||
|
||||
@@ -1,4 +1,8 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.InteropServices;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Rendering;
|
||||
using UnityEngine.Serialization;
|
||||
|
||||
namespace BrewMonster
|
||||
@@ -6,16 +10,20 @@ namespace BrewMonster
|
||||
[CreateAssetMenu(fileName = "GameRunConfig", menuName = "BrewMonster/Game Run Config")]
|
||||
public class GameRunConfig : ScriptableObject
|
||||
{
|
||||
[FormerlySerializedAs("characterPrefab")]
|
||||
[Header("Prefabs")]
|
||||
[SerializeField] private GameObject playerPrefab;
|
||||
[SerializeField] private GameObject monsterPrefab;
|
||||
[SerializeField] private GameObject npcServerPrefab;
|
||||
[SerializeField] private GameObject testVfxPrefab;
|
||||
[SerializeField] private List<ViewDistance> viewDistanceCfg;
|
||||
[SerializeField] private List<ViewDistance> viewDistanceNPCCfg;
|
||||
[SerializeField] private List<ViewDistance> viewDistanceEPCfg;
|
||||
|
||||
public GameObject PlayerPrefab => playerPrefab;
|
||||
public GameObject MonsterPrefab => monsterPrefab;
|
||||
public GameObject NpcServerPrefab => npcServerPrefab.gameObject;
|
||||
public GameObject TestVfxPrefab => testVfxPrefab;
|
||||
public List<ViewDistance> GetViewDistanceCfg { get => viewDistanceCfg;}
|
||||
public List<ViewDistance> GetViewDistanceNPCCfg { get => viewDistanceNPCCfg;}
|
||||
public List<ViewDistance> GetViewDistanceEPCfg { get => viewDistanceEPCfg;}
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
public struct ViewDistance
|
||||
{
|
||||
public string title;
|
||||
public float fShow;
|
||||
public float fHide;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using BrewMonster;
|
||||
using BrewMonster.Scripts.Task;
|
||||
using CSNetwork;
|
||||
using CSNetwork.GPDataType;
|
||||
using Cysharp.Threading.Tasks;
|
||||
using ModelRenderer.Scripts.GameData;
|
||||
using System;
|
||||
@@ -10,8 +11,9 @@ using System.IO;
|
||||
using System.Threading.Tasks;
|
||||
using UnityEngine;
|
||||
using UnityEngine.AddressableAssets;
|
||||
using UnityEngine.Rendering;
|
||||
using UnityEngine.Rendering.Universal;
|
||||
using UnityEngine.ResourceManagement.AsyncOperations;
|
||||
using CSNetwork.GPDataType;
|
||||
|
||||
namespace BrewMonster.Network
|
||||
{
|
||||
@@ -31,7 +33,7 @@ namespace BrewMonster.Network
|
||||
private static BrewMonster.CECStringTab m_ItemExtDesc; // Item extend description string table
|
||||
private static BrewMonster.CECStringTab m_ItemExtProp; // Item extend prop string table
|
||||
private static BrewMonster.CECStringTab ItemColTab; // Item color string table
|
||||
private static Dictionary<int, int> m_SuiteEquipTab; // Item suite string table
|
||||
private static Dictionary<int, int> m_SuiteEquipTab; // Item suite string table
|
||||
private static BrewMonster.CECStringTab m_SkillDesc = new CECStringTab(); // Skill description string table
|
||||
private static BrewMonster.CECStringTab m_BuffDesc; // Buff description string table
|
||||
|
||||
@@ -40,6 +42,16 @@ namespace BrewMonster.Network
|
||||
private static int m_iCurCursor; // Current cursor
|
||||
private static List<int> m_PetAutoSkills = new List<int>();
|
||||
|
||||
private static GameRunConfig gameRunConfigSO;
|
||||
private readonly static string keySettingViewDistance = "_keySettingViewDistance";
|
||||
private readonly static string keySettingViewDistanceNPC = "_keySettingViewDistanceNPC";
|
||||
private readonly static string keySettingViewDistanceEP = "_keySettingViewDistanceEP";
|
||||
private readonly static string keySettingActiveShadow = "_keySettingActiveShadow";
|
||||
private readonly static string keySettingActiveFullResolution = "_keySettingActiveFullResolution";
|
||||
private readonly static string keySettingActiveFog = "_keySettingActiveFog";
|
||||
private static ViewDistance m_viewDistance;
|
||||
private static ViewDistance m_viewDistanceNPC;
|
||||
private static ViewDistance m_viewDistanceEP;
|
||||
#endregion
|
||||
|
||||
#region Properties
|
||||
@@ -140,6 +152,7 @@ namespace BrewMonster.Network
|
||||
LoadPetAutoSkill();
|
||||
|
||||
GlobalDataManager.globaldata_load();
|
||||
InitSetting();
|
||||
return true;
|
||||
}
|
||||
public static CECConfigs GetConfigs() { return m_pConfigs; }
|
||||
@@ -615,6 +628,71 @@ namespace BrewMonster.Network
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public static GameRunConfig GameRunConfigSO
|
||||
{
|
||||
get
|
||||
{
|
||||
if(gameRunConfigSO == null)
|
||||
{
|
||||
gameRunConfigSO = Resources.Load<GameRunConfig>("GameRunConfig");
|
||||
}
|
||||
return gameRunConfigSO;
|
||||
}
|
||||
}
|
||||
|
||||
public static void InitSetting()
|
||||
{
|
||||
int index = PlayerPrefs.GetInt(keySettingViewDistance, defaultValue: 5);
|
||||
m_viewDistance = GameRunConfigSO.GetViewDistanceCfg[index];
|
||||
index = PlayerPrefs.GetInt(keySettingViewDistanceNPC, defaultValue: 5);
|
||||
m_viewDistanceNPC = GameRunConfigSO.GetViewDistanceNPCCfg[index];
|
||||
index = PlayerPrefs.GetInt(keySettingViewDistanceEP, defaultValue: 5);
|
||||
m_viewDistanceEP = GameRunConfigSO.GetViewDistanceEPCfg[index];
|
||||
}
|
||||
|
||||
public static ViewDistance GetSettingViewDistance()
|
||||
{
|
||||
return m_viewDistance;
|
||||
}
|
||||
|
||||
public static ViewDistance GetSettingViewDistanceNPC()
|
||||
{
|
||||
return m_viewDistanceNPC;
|
||||
}
|
||||
|
||||
public static ViewDistance GetSettingViewDistanceEP()
|
||||
{
|
||||
return m_viewDistanceEP;
|
||||
}
|
||||
|
||||
public static bool GetSettingActiveShadow()
|
||||
{
|
||||
int index = PlayerPrefs.GetInt(keySettingActiveShadow, defaultValue: 1);
|
||||
return index == 1;
|
||||
}
|
||||
|
||||
public static void SetSettingActiveShadow(bool value)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public static void SetSettingActiveFullResolution(bool value)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public static bool GetSettingActiveFullResolution()
|
||||
{
|
||||
int index = PlayerPrefs.GetInt(keySettingActiveFullResolution, defaultValue: 1);
|
||||
return index == 1;
|
||||
}
|
||||
|
||||
public static bool GetSettingActiveFog()
|
||||
{
|
||||
int index = PlayerPrefs.GetInt(keySettingActiveFog, defaultValue: 1);
|
||||
return index == 1;
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,7 +10,9 @@ using BrewMonster.Scripts.Chat;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using BrewMonster.Scripts.Skills;
|
||||
using BrewMonster.Network;
|
||||
using Animancer;
|
||||
|
||||
public class CECNPC : CECObject
|
||||
{
|
||||
[SerializeField] protected INFO m_NPCInfo;
|
||||
@@ -637,11 +639,11 @@ public class CECNPC : CECObject
|
||||
|
||||
if(m_modelVisual != null)
|
||||
{
|
||||
if(m_fDistToHostH < AddressResourceConfig.m_fDistShowModelVisual)
|
||||
if(m_fDistToHostH < EC_Game.GetSettingViewDistanceNPC().fShow)
|
||||
{
|
||||
m_modelVisual.SetActive(true);
|
||||
}
|
||||
else if(m_fDistToHostH > AddressResourceConfig.m_fDistHideModelVisual)
|
||||
else if(m_fDistToHostH > EC_Game.GetSettingViewDistanceNPC().fHide)
|
||||
{
|
||||
m_modelVisual.SetActive(false);
|
||||
}
|
||||
|
||||
@@ -449,11 +449,11 @@ namespace BrewMonster
|
||||
m_fDistToHostH = CalcDist(pHost.GetPos(), false);
|
||||
if (m_pPlayerModel != null)
|
||||
{
|
||||
if (m_fDistToHostH < AddressResourceConfig.m_fDistShowModelVisual)
|
||||
if (m_fDistToHostH < EC_Game.GetSettingViewDistanceEP().fShow)
|
||||
{
|
||||
m_pPlayerModel.SetActive(true);
|
||||
}
|
||||
else if (m_fDistToHostH > AddressResourceConfig.m_fDistHideModelVisual)
|
||||
else if (m_fDistToHostH > EC_Game.GetSettingViewDistanceEP().fHide)
|
||||
{
|
||||
m_pPlayerModel.SetActive(false);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
using BrewMonster.UI;
|
||||
using UnityEngine;
|
||||
|
||||
namespace BrewMonster
|
||||
{
|
||||
public class DlgSetting : AUIDialog
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e89b514fe463eaf46b81527aff05751a
|
||||
@@ -9,9 +9,5 @@ namespace BrewMonster
|
||||
public static string TestVfxPrefab = "Prefabs/Vfx/TestVfx";
|
||||
public static string PetServerPrefab = "Pet/PetPrefab";
|
||||
public static string PetMountServerPrefab = "Pet/PetMount/PetMountPrefab";
|
||||
|
||||
|
||||
public static float m_fDistShowModelVisual = 25f; // Display distance model NPC
|
||||
public static float m_fDistHideModelVisual = 40f; // Hide/display distance model NPC
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ using System.Collections.Generic;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using BrewMonster;
|
||||
using BrewMonster.Network;
|
||||
using BrewMonster.Scripts;
|
||||
using Cysharp.Threading.Tasks;
|
||||
using UnityEngine;
|
||||
@@ -15,9 +16,9 @@ public class LitModelHolder : MonoSingleton<LitModelHolder>
|
||||
|
||||
[Header("Distance Streaming")]
|
||||
[Tooltip("The distance from the host player to the object to be loaded immediately.")]
|
||||
[SerializeField] private float _loadImmediateDistance = 200f;
|
||||
[SerializeField] private float _loadImmediateDistance => EC_Game.GetSettingViewDistance().fShow; // 200f
|
||||
[Tooltip("Objects need to go outside of this distance to be unloaded.")]
|
||||
[SerializeField] private float _unloadDistance = 400f;
|
||||
[SerializeField] private float _unloadDistance => EC_Game.GetSettingViewDistance().fHide; // 400f
|
||||
|
||||
[Header("Performance")]
|
||||
[SerializeField] private float _checkIntervalSeconds = 0.25f;
|
||||
@@ -134,10 +135,10 @@ public class LitModelHolder : MonoSingleton<LitModelHolder>
|
||||
/// <returns></returns>
|
||||
private async UniTask LoadObjectBaseOnDistance(CancellationToken destroyToken)
|
||||
{
|
||||
if (_unloadDistance < _loadImmediateDistance)
|
||||
{
|
||||
_unloadDistance = _loadImmediateDistance;
|
||||
}
|
||||
//if (_unloadDistance < _loadImmediateDistance)
|
||||
//{
|
||||
// _unloadDistance = _loadImmediateDistance;
|
||||
//}
|
||||
|
||||
while (_hostPlayer == null)
|
||||
{
|
||||
@@ -174,10 +175,10 @@ public class LitModelHolder : MonoSingleton<LitModelHolder>
|
||||
return;
|
||||
}
|
||||
|
||||
if (_unloadDistance < _loadImmediateDistance)
|
||||
{
|
||||
_unloadDistance = _loadImmediateDistance;
|
||||
}
|
||||
//if (_unloadDistance < _loadImmediateDistance)
|
||||
//{
|
||||
// _unloadDistance = _loadImmediateDistance;
|
||||
//}
|
||||
|
||||
float immediateSqr = _loadImmediateDistance * _loadImmediateDistance;
|
||||
float paddingSqr = _unloadDistance * _unloadDistance;
|
||||
@@ -196,10 +197,10 @@ public class LitModelHolder : MonoSingleton<LitModelHolder>
|
||||
/// <returns></returns>
|
||||
private async UniTask StreamByDistanceLoop(CancellationToken destroyToken)
|
||||
{
|
||||
if (_unloadDistance < _loadImmediateDistance)
|
||||
{
|
||||
_unloadDistance = _loadImmediateDistance;
|
||||
}
|
||||
//if (_unloadDistance < _loadImmediateDistance)
|
||||
//{
|
||||
// _unloadDistance = _loadImmediateDistance;
|
||||
//}
|
||||
|
||||
float immediateSqr = _loadImmediateDistance * _loadImmediateDistance;
|
||||
float paddingSqr = _unloadDistance * _unloadDistance;
|
||||
|
||||
@@ -17,8 +17,8 @@ namespace BrewMonster
|
||||
public class TerrainHolder : MonoBehaviour
|
||||
{
|
||||
[SerializeField] private AddressableObject[] _addressableObjects;
|
||||
[SerializeField] private float _loadImmediateDistance = 150f;
|
||||
[SerializeField] private float _unloadDistance = 300f;
|
||||
[SerializeField] private float _loadImmediateDistance => EC_Game.GetSettingViewDistance().fShow; //150f;
|
||||
[SerializeField] private float _unloadDistance => EC_Game.GetSettingViewDistance().fHide; //300f;
|
||||
[SerializeField] private float _minHostMoveToUpdate = 5f;
|
||||
|
||||
private List<AddressableObject> _candidatesForLoading = new List<AddressableObject>();
|
||||
@@ -100,8 +100,8 @@ namespace BrewMonster
|
||||
if (_addressableObjects == null || _addressableObjects.Length == 0)
|
||||
return;
|
||||
|
||||
if (_unloadDistance < _loadImmediateDistance)
|
||||
_unloadDistance = _loadImmediateDistance;
|
||||
//if (_unloadDistance < _loadImmediateDistance)
|
||||
// _unloadDistance = _loadImmediateDistance;
|
||||
|
||||
float immediateSqr = _loadImmediateDistance * _loadImmediateDistance;
|
||||
float paddingSqr = _unloadDistance * _unloadDistance;
|
||||
|
||||
Reference in New Issue
Block a user