update: 删除无用的属性
							parent
							
								
									0870e71cf9
								
							
						
					
					
						commit
						018fb2c35b
					
				|  | @ -3,7 +3,6 @@ namespace Guru | |||
|     using System; | ||||
|     using UnityEngine; | ||||
|     using System.Collections.Generic; | ||||
|     using Newtonsoft.Json; | ||||
|     using System.Linq; | ||||
|      | ||||
|      | ||||
|  | @ -38,8 +37,8 @@ namespace Guru | |||
|         private DateTime _lastSavedTime = new DateTime(1970,1,1); | ||||
|          | ||||
|         private bool _noAds = false; | ||||
|         private readonly BindableProperty<int> _bLevel; | ||||
|         private readonly BindableProperty<int> _bPlay; | ||||
|         private int _bLevel; | ||||
|         private int _bPlay; | ||||
|         private string _uid; | ||||
|         private List<PurchasedProduct> _purchased; | ||||
|          | ||||
|  | @ -60,33 +59,33 @@ namespace Guru | |||
|             GuruSDKSerializedModel model = LoadModel(); | ||||
|             _uid = model.uid; | ||||
|             _noAds = model.no_ads; | ||||
|             _bLevel = new BindableProperty<int>(model.b_level); | ||||
|             _bPlay = new BindableProperty<int>(model.b_play); | ||||
|             _bLevel = model.b_level; | ||||
|             _bPlay = model.b_play; | ||||
|             _purchased = model.purchased; | ||||
|         } | ||||
|          | ||||
|         public int BLevel | ||||
|         { | ||||
|             get => _bLevel.Value; | ||||
|             get => _bLevel; | ||||
|             set | ||||
|             { | ||||
|                 if (value < _bLevel.Value) | ||||
|                 if (value < _bLevel) | ||||
|                 { | ||||
|                     // b_level 必须比上一次的值大 | ||||
|                     Debug.LogWarning($"[SDK] :: Set b_level [{value}] should not be less than original value [{_bLevel.Value}]"); | ||||
|                     Debug.LogWarning($"[SDK] :: Set b_level [{value}] should not be less than original value [{_bLevel}]"); | ||||
|                     return; | ||||
|                 } | ||||
|                 _bLevel.Value = value; | ||||
|                 _bLevel = value; | ||||
|                 Save(); | ||||
|             } | ||||
|         } | ||||
| 
 | ||||
|         public int BPlay | ||||
|         { | ||||
|             get => _bPlay.Value; | ||||
|             get => _bPlay; | ||||
|             set | ||||
|             { | ||||
|                 _bPlay.Value = value; | ||||
|                 _bPlay = value; | ||||
|                 Save(); | ||||
|             } | ||||
|         } | ||||
|  | @ -113,18 +112,7 @@ namespace Guru | |||
|                 Save(); | ||||
|             } | ||||
|         } | ||||
| 
 | ||||
|         public void SetOnBLevelChanged(Action<int> action) | ||||
|         { | ||||
|             _bLevel.OnValueChanged += action; | ||||
|         } | ||||
|          | ||||
|         public void SetOnBPlayChanged(Action<int> action) | ||||
|         { | ||||
|             _bPlay.OnValueChanged += action; | ||||
|         } | ||||
|          | ||||
| 
 | ||||
|         #region 初始化 | ||||
| 
 | ||||
| 
 | ||||
|  | @ -153,14 +141,13 @@ namespace Guru | |||
|         /// <summary> | ||||
|         /// 保存至 PlayerPrefs 数据 | ||||
|         /// </summary> | ||||
|         /// <param name="writeToDisk"></param> | ||||
|         private void SetToMemory() | ||||
|         { | ||||
|             var model = new GuruSDKSerializedModel() | ||||
|             { | ||||
|                 uid = _uid, | ||||
|                 b_level = _bLevel.Value, | ||||
|                 b_play = _bPlay.Value, | ||||
|                 b_level = _bLevel, | ||||
|                 b_play = _bPlay, | ||||
|                 no_ads = _noAds, | ||||
|                 purchased = _purchased, | ||||
|             }; | ||||
|  |  | |||
|  | @ -57,11 +57,13 @@ namespace Guru | |||
| 
 | ||||
|         public static void SetUserBLevel(int bLevel) | ||||
|         { | ||||
|             Analytics.SetBLevel(bLevel); | ||||
|             Model.BLevel = bLevel; | ||||
|         } | ||||
|          | ||||
|         public static void SetUserBPlay(int bPlay) | ||||
|         { | ||||
|             Analytics.SetBPlay(bPlay); | ||||
|             Model.BPlay = bPlay; | ||||
|         } | ||||
|          | ||||
|  |  | |||
|  | @ -111,9 +111,6 @@ namespace Guru | |||
|         /// <param name="onComplete"></param> | ||||
|         private void StartWithConfig(GuruSDKInitConfig config, Action<bool> onComplete) | ||||
|         { | ||||
|             Model.SetOnBLevelChanged(OnBLevelChanged); | ||||
|             Model.SetOnBPlayChanged(OnBPlayChanged); | ||||
|              | ||||
|             IsInitialSuccess = false; | ||||
|             _initConfig = config; | ||||
|             _isDebugEnabled = config.DebugMode; | ||||
|  | @ -416,23 +413,6 @@ namespace Guru | |||
|             CheckAttStatus(); | ||||
|         } | ||||
| #endif | ||||
|         #endregion | ||||
|          | ||||
|         #region 数据 | ||||
| 
 | ||||
|         private void OnBLevelChanged(int bLevel) | ||||
|         { | ||||
|             Debug.Log($"[ANU][SDK] --- OnBLevelChanged: {bLevel}"); | ||||
|             Analytics.SetBLevel(bLevel); | ||||
|         } | ||||
| 
 | ||||
|         private void OnBPlayChanged(int bPlay) | ||||
|         { | ||||
|             Debug.Log($"[ANU][SDK] --- OnBPlayChanged: {bPlay}"); | ||||
|             Analytics.SetBPlay(bPlay); | ||||
|         } | ||||
|          | ||||
|          | ||||
|         #endregion | ||||
|          | ||||
|         #region Logging | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue