62 lines
		
	
	
		
			1.9 KiB
		
	
	
	
		
			C#
		
	
	
	
			
		
		
	
	
			62 lines
		
	
	
		
			1.9 KiB
		
	
	
	
		
			C#
		
	
	
	
| using System.Collections;
 | |
| using System.Collections.Generic;
 | |
| using System.IO;
 | |
| using UnityEngine;
 | |
| 
 | |
| namespace Touka
 | |
| {
 | |
|     public class TKGLoadPropertiesConfig : MonoBehaviour
 | |
|     {
 | |
|         static string resourcePath = Application.dataPath + "/"; // + "Configs/";
 | |
|         static string toukaconfigConfigPath = "Configs/";
 | |
|         static string toukaconfigPathCN = "CN/";
 | |
|         static string toukaconfigPathGB = "GB/";
 | |
|         static string toukaConfigFileName = "tkg_config";
 | |
| 
 | |
|         static string extraStr = ".properties";
 | |
| 
 | |
|         public static PlayerPrefPair[] GetToukaConfig(AppChannel _appChannel)
 | |
|         {
 | |
|             string configpath = "";
 | |
|             if(_appChannel == AppChannel.GooglePlay)
 | |
|             {
 | |
|                 configpath = toukaconfigPathGB;
 | |
|             }
 | |
|             else
 | |
|             {
 | |
|                 configpath = toukaconfigPathCN;
 | |
|             }
 | |
| 
 | |
|             return GetAllFromProperties(toukaconfigConfigPath + configpath + toukaConfigFileName + extraStr);
 | |
|         }
 | |
| 
 | |
|         public static PlayerPrefPair[] GetAllFromProperties(string _configPath)
 | |
|         {
 | |
|             string path = resourcePath + _configPath;
 | |
|             TKGDebugger.LogDebug("GetAllFromProperties path : " + path + " , _configPath : " + _configPath);
 | |
| 
 | |
|             Hashtable ht = TKGProperties.Load(path);
 | |
|             if(ht.Count > 0)
 | |
|             {
 | |
|                 PlayerPrefPair[] tempPlayerPrefs = new PlayerPrefPair[ht.Count];
 | |
|                 int i = 0;
 | |
|                 foreach (string key in ht.Keys)
 | |
|                 {
 | |
|                     tempPlayerPrefs[i] = new PlayerPrefPair() { Key = key, Value = ht[key] };
 | |
|                     i++;
 | |
|                 }
 | |
| 
 | |
|                 return tempPlayerPrefs;
 | |
|             }
 | |
|             else
 | |
|             {
 | |
|                 TKGDebugger.LogDebug("Config is null, path : " + path);
 | |
|                 return new PlayerPrefPair[0];
 | |
|             }
 | |
| 
 | |
| 
 | |
|         }
 | |
|     }
 | |
| 
 | |
| }
 |