Ver código fonte

app初始语言

lvjincheng 3 anos atrás
pai
commit
5d1829b6ea

+ 2 - 0
Assets/BowArrow/Scripts/CommonConfig.cs

@@ -5,6 +5,8 @@ using UnityEngine;
 /**通用配置(2021/12/18新增) */
 public class CommonConfig
 {
+    //App初始语言设置
+    public static readonly int AppLanguage = 0;
     public static bool ReleaseVersion2 = true;
     /*
         特定版本功能

+ 11 - 0
Assets/BowArrow/Scripts/Entry.cs

@@ -8,6 +8,17 @@ using UnityEngine.SceneManagement;
 /* 程序启动入口 */
 public class Entry : MonoBehaviour
 {
+    void Awake()
+    {
+        //设置新装app初始语言
+        int curAppLanguage = PlayerPrefs.GetInt("AppLanguage", -1);
+        if (curAppLanguage != CommonConfig.AppLanguage) {
+            PlayerPrefs.SetInt("AppLanguage", CommonConfig.AppLanguage);
+            PlayerPrefs.SetInt("Language", CommonConfig.AppLanguage);
+            Debug.Log("SetAppLanguage");
+        }
+    }
+
     void Start()
     {
         Screen.orientation = ScreenOrientation.AutoRotation;//设置方向为自动(根据需要自动旋转屏幕朝向任何启用的方向。)