@@ -19,21 +19,11 @@ namespace UnityGameFramework.Runtime
1919 public class DefaultSettingHelper : SettingHelperBase
2020 {
2121 private const string SettingFileName = "GameFrameworkSetting.dat" ;
22+ private readonly string SettingFilePath = Utility . Path . GetRegularPath ( Path . Combine ( Application . persistentDataPath , SettingFileName ) ) ;
2223
2324 protected DefaultSetting m_Settings = null ;
2425 protected DefaultSettingSerializer m_Serializer = null ;
2526
26- /// <summary>
27- /// 获取游戏配置文件路径。
28- /// </summary>
29- public string FilePath
30- {
31- get
32- {
33- return Utility . Path . GetRegularPath ( Path . Combine ( Application . persistentDataPath , SettingFileName ) ) ;
34- }
35- }
36-
3727 /// <summary>
3828 /// 获取游戏配置项数量。
3929 /// </summary>
@@ -53,12 +43,12 @@ public override bool Load()
5343 {
5444 try
5545 {
56- if ( ! File . Exists ( FilePath ) )
46+ if ( ! File . Exists ( SettingFilePath ) )
5747 {
5848 return true ;
5949 }
6050
61- using ( FileStream fileStream = new FileStream ( FilePath , FileMode . Open , FileAccess . Read ) )
51+ using ( FileStream fileStream = new FileStream ( SettingFilePath , FileMode . Open , FileAccess . Read ) )
6252 {
6353 m_Serializer . Deserialize ( fileStream ) ;
6454 return true ;
@@ -79,7 +69,7 @@ public override bool Save()
7969 {
8070 try
8171 {
82- using ( FileStream fileStream = new FileStream ( FilePath , FileMode . Create , FileAccess . Write ) )
72+ using ( FileStream fileStream = new FileStream ( SettingFilePath , FileMode . Create , FileAccess . Write ) )
8373 {
8474 return m_Serializer . Serialize ( fileStream , m_Settings ) ;
8575 }
0 commit comments