use ConfigManager to load config

This commit is contained in:
in0finite 2021-01-26 23:29:01 +01:00
parent 3a662c34c8
commit df730095f3
6 changed files with 41 additions and 10 deletions

View file

@ -25,6 +25,7 @@ GameObject:
- component: {fileID: 7442340376164908290}
- component: {fileID: 8446601354455743255}
- component: {fileID: 5853763562556677784}
- component: {fileID: 7588617501852694525}
m_Layer: 0
m_Name: GameManager
m_TagString: Untagged
@ -181,8 +182,7 @@ MonoBehaviour:
ragdollDamageForceWhenDetached: 20
ragdollCollisionDetectionMode: 2
ragdollSyncRate: 10
ragdollPositionLerpFactor: 1
ragdollRotationLerpFactor: 1
ragdollInterpolationMode: 2
--- !u!114 &114560248511158306
MonoBehaviour:
m_ObjectHideFlags: 0
@ -327,3 +327,15 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: c77317cdc437f244b8d409c229aa2e95, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!114 &7588617501852694525
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1297494511425690}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 1f08780b55b9ede4cb0ffd248924ba25, type: 3}
m_Name:
m_EditorClassIdentifier:

View file

@ -86,7 +86,7 @@ namespace SanAndreasUnity.Behaviours
{
LoadingStep[] steps = new LoadingStep[] {
new LoadingStep ( StepLoadConfig, "Loading config", 0.02f ),
new LoadingStep ( StepConfigure, "Configuring", 0f ),
new LoadingStep ( StepSelectGTAPath(), "Select path to GTA", 0.0f ),
new LoadingStep ( StepLoadArchives, "Loading archives", 1.7f ),
new LoadingStep ( StepLoadSplashScreen, "Loading splash screen", 0.06f ),
@ -229,10 +229,9 @@ namespace SanAndreasUnity.Behaviours
{
FontsImporter.LoadFonts();
}
private static void StepLoadConfig ()
{
Config.Load ();
private static void StepConfigure ()
{
TextureDictionary.DontLoadTextures = Config.Get<bool>("dontLoadTextures");
}

View file

@ -26,7 +26,6 @@ namespace SanAndreasUnity.Net
{
_client = new HttpClient();
Config.Load();
_masterServerUrl = Config.Get<string>("masterserverurl");
if (string.IsNullOrWhiteSpace(_masterServerUrl))

View file

@ -40,9 +40,6 @@ namespace SanAndreasUnity.UI {
};
}
// load config
Config.Load ();
// set current directory to game directory
string currentGameDir = Config.GetPath (Config.const_game_dir);
if (!string.IsNullOrEmpty (currentGameDir))

View file

@ -0,0 +1,13 @@
using UnityEngine;
namespace SanAndreasUnity.Utilities
{
// Note about script execution order: execute this script before others to make sure config is loaded before their Awake() is called.
public class ConfigManager : MonoBehaviour
{
void Awake()
{
Config.Load();
}
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 1f08780b55b9ede4cb0ffd248924ba25
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: -31000
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant: