// Use this for initialization
        private static void Initialize()
        {
            if (isInit)
            {
                return;
            }
            isInit = true;

            AssetData[] res  = ResourcesManager.LoadAssetsByName(LanguagesTypeFileName);
            string      text = "";

            if (res.Length > 0)
            {
                TextAsset tx = (TextAsset)res[0].asset;
                text = tx.text;
            }
            LanguageTypeNames = JsonUtils.JsonToList <string>(text);

            string userSelect = GameRuntimeStoreManager.GetValue(GameRuntimeStore_UserSelectLanguage, "");

            if (!string.IsNullOrEmpty(userSelect))
            {
                LoadLanguageData(userSelect);
                return;
            }

            bool   IsUseSystemLanguage             = GameSettingStoreManager.GetValue(GameSettingKeyName_IsUseSystemLanguage, true);
            string PriorityLanguage                = GameSettingStoreManager.GetValue(GameSettingKeyName_PriorityLanguage, "");
            string ChineseLanguagePriorityLanguage = GameSettingStoreManager.GetValue(GameSettingKeyName_ChineseLanguagePriorityLanguage, "");

            if (IsUseSystemLanguage)
            {
                string sysLan = Application.systemLanguage.ToString();
                if (LanguageTypeNames.Contains(sysLan))
                {
                    LoadLanguageData(sysLan);
                    return;
                }
                else
                {
                    if (sysLan == SystemLanguage.Chinese.ToString())
                    {
                        if (LanguageTypeNames.Contains(ChineseLanguagePriorityLanguage))
                        {
                            LoadLanguageData(ChineseLanguagePriorityLanguage);
                        }
                        else if (LanguageTypeNames.Contains(chineseLangusge[0]))
                        {
                            LoadLanguageData(chineseLangusge[0]);
                        }
                        else if (LanguageTypeNames.Contains(chineseLangusge[1]))
                        {
                            LoadLanguageData(chineseLangusge[1]);
                        }
                    }
                }
            }

            LoadLanguageData(PriorityLanguage);
        }
Exemplo n.º 2
0
 private static void Init()
 {
     obj          = new GameObject("[AudioManager]");
     audioManager = obj.AddComponent <AudioManager>();
     GameObject.DontDestroyOnLoad(obj);
     Audio2DPlayer.audioObject = obj;
     Audio2DPlayer.mono        = audioManager;
     Audio3DPlayer.mono        = audioManager;
     Volume = GameRuntimeStoreManager.GetValue("AudioVolume", 1f);
 }