Ver código fonte

中文key翻译

lvjincheng 3 anos atrás
pai
commit
b8332a3560

+ 9 - 1
Assets/BowArrow/Scripts/Components/TextAutoLanguage2/Resources/TextAutoLanguage2/cn.json

@@ -9,5 +9,13 @@
     "course_title_8": "靠位",
     "course_title_9": "瞄准",
     "course_title_10": "撒放",
-    "course_title_11": "结束动作"
+    "course_title_11": "结束动作",
+    "tip_about-us": "关于我们-智能弓箭App!",
+    "tip_friend-receive-request": "收到好友添加请求,可到好友界面查看!",
+    "tip_pk_gametype_1": "静止靶PK",
+    "tip_pk_gametype_2": "野兔闯关PK",
+    "tip_pk_gametype_3": "野鸡闯关PK",
+    "tip_pk_gametype_4": "野狼闯关PK",
+    "tip_pk_friend-invite-join": "好友邀请你参加",
+    "tip_pk_invite-try-again": "对方邀请你再来一次"
 }

+ 12 - 1
Assets/BowArrow/Scripts/Components/TextAutoLanguage2/Resources/TextAutoLanguage2/en.json

@@ -9,5 +9,16 @@
     "course_title_8": "Leaning position",
     "course_title_9": "Aim",
     "course_title_10": "Release",
-    "course_title_11": "Finish up job"
+    "course_title_11": "Finish up job",
+    "tip_about-us": "About us - Smart bow app !",
+    "tip_friend-receive-request": "Has friend requet, can check at friend view!",
+    "tip_pk_gametype_1": "Fixed Target PK",
+    "tip_pk_gametype_2": "Rabbit Challenge PK",
+    "tip_pk_gametype_3": "Pheasant Challenge PK",
+    "tip_pk_gametype_4": "Wolf Challenge PK",
+    "tip_pk_friend-invite-join": "Friend Invite ",
+    "tip_pk_invite-try-again": "Invite Again ",
+    "当前正处于匹配状态,无法接受好友PK邀请!": "In matching, can't accept PK!",
+    "目前状态下,无法接受该邀请!": "In current state, can't accept invite!",
+    "某方退出或掉线,联机游戏终止!": "One quit or outline, game stop!"
 }

+ 8 - 0
Assets/BowArrow/Scripts/Components/TextAutoLanguage2/TextAutoLanguage2.cs

@@ -48,6 +48,14 @@ public class TextAutoLanguage2 : MonoBehaviour
         return languageDictionary[textKey];
     }
 
+    public static string GetTextByCNKey(string textKey) {
+        Init();
+        if (currentLanguageEnum == LanguageEnum.Chinese) {
+            return textKey;
+        }
+        return languageDictionary[textKey];
+    }
+
     void Awake()
     {
         Init();

+ 8 - 8
Assets/BowArrow/Scripts/Network/SocketComp/PKComp.cs

@@ -58,7 +58,7 @@ public class PKComp : Singleton<PKComp>
     public void onInviteFriendGamePK(MatchPlayerInfo matchPlayerInfo, int gameType, string roomKey) {
         string pkTypeName = GetPKTypeName(gameType);
         if (pkTypeName == null) return;
-        string tip = $"好友邀请你参加{pkTypeName}PK";
+        string tip = TextAutoLanguage2.GetTextByKey("tip_pk_friend-invite-join") + pkTypeName;
         System.Action cb = delegate() {
             if (CanShowFriendInviteOrMatch()) {
                 PKMatchingView view = PKMatchingView.Create();
@@ -67,7 +67,7 @@ public class PKComp : Singleton<PKComp>
                 GlobalData.pkMatchType = PKMatchType.OnlinePK;
                 GlobalData.matchGameType = gameType;
             } else if (PKMatchingView.ins) {
-                PopupMgr.ins.ShowTip("当前正处于匹配状态,无法接受好友PK邀请!");
+                PopupMgr.ins.ShowTip(TextAutoLanguage2.GetTextByCNKey("当前正处于匹配状态,无法接受好友PK邀请!"));
             }
         };
         System.Action cbCancel = delegate() {
@@ -80,7 +80,7 @@ public class PKComp : Singleton<PKComp>
     public void onInviteOtherTryAgainGamePK(MatchPlayerInfo matchPlayerInfo, int gameType, string roomKey) {
         string pkTypeName = GetPKTypeName(gameType);
         if (pkTypeName == null) return;
-        string tip = $"对方邀请你再来一次{pkTypeName}PK";
+        string tip = TextAutoLanguage2.GetTextByKey("tip_pk_invite-try-again") + pkTypeName;
         System.Action cb = delegate() {
             if (CanShowTryAgainInviteOrMatch(matchPlayerInfo)) {
                 PKMatchingView view = PKMatchingView.Create();
@@ -89,7 +89,7 @@ public class PKComp : Singleton<PKComp>
                 GlobalData.pkMatchType = PKMatchType.OnlinePK;
                 GlobalData.matchGameType = gameType;
             } else {
-                PopupMgr.ins.ShowTip("目前状态下,无法接受该邀请!");
+                PopupMgr.ins.ShowTip(TextAutoLanguage2.GetTextByCNKey("目前状态下,无法接受该邀请!"));
             }
         };
         System.Action cbCancel = delegate() {
@@ -113,16 +113,16 @@ public class PKComp : Singleton<PKComp>
         string pkTypeName = null;
         switch (gameType) {
             case 9:
-                pkTypeName = "静止靶";
+                pkTypeName = TextAutoLanguage2.GetTextByKey("tip_pk_gametype_1");
                 break;
             case 10:
-                pkTypeName = "野兔闯关";
+                pkTypeName = TextAutoLanguage2.GetTextByKey("tip_pk_gametype_2");
                 break;
             case 11:
-                pkTypeName = "野鸡闯关";
+                pkTypeName = TextAutoLanguage2.GetTextByKey("tip_pk_gametype_3");
                 break;
             case 12:
-                pkTypeName = "野狼闯关";
+                pkTypeName = TextAutoLanguage2.GetTextByKey("tip_pk_gametype_4");
                 break;
         }
         return pkTypeName;

+ 1 - 1
Assets/BowArrow/Scripts/Network/SocketPlayer.cs

@@ -47,7 +47,7 @@ public class SocketPlayer : JC.SocketIO.SocketIOClient
             return;
         }
         if (!isGameOver) {
-            PopupMgr.ins.ShowBGTip("某方退出或掉线,联机游戏终止!");
+            PopupMgr.ins.ShowBGTip(TextAutoLanguage2.GetTextByCNKey("某方退出或掉线,联机游戏终止!"));
             SceneManager.LoadScene("Home", LoadSceneMode.Single);
         }
     }

+ 1 - 1
Assets/BowArrow/Scripts/Network/UserPlayer.cs

@@ -103,7 +103,7 @@ public class UserPlayer : JCEntity
     }
 
     public void onRequestAddFriend() {
-        PopupMgr.ins.ShowTipTop("收到好友添加请求,可到好友界面查看!");
+        PopupMgr.ins.ShowTipTop(TextAutoLanguage2.GetTextByKey("tip_friend-receive-request"));
         tempData.hasFriendRequest = true;
     }
 

+ 1 - 1
Assets/BowArrow/Scripts/View/SetUpView1.cs

@@ -20,7 +20,7 @@ public class SetUpView1 : MonoBehaviour
 
     public void AboutUs() {
         AudioMgr.ins.PlayBtn();
-        PopupMgr.ins.ShowTip("关于我们-智能弓箭App!");
+        PopupMgr.ins.ShowTip(TextAutoLanguage2.GetTextByKey("tip_about-us"));
     }
 
     public void GoToUserAgreement() {