Browse Source

手动从git重新拉取中文

HerobrineXia 4 years ago
parent
commit
d6f60c35a2

+ 12 - 10
Assets/Resources/Dice/DiceEntity.cs

@@ -1,3 +1,5 @@
+
+
 using System.Collections;
 using System.Collections.Generic;
 using UnityEngine;
@@ -22,11 +24,11 @@ public class DiceEntity : MonoBehaviour {
     private void OnCollisionEnter2D(Collision2D collision) {
         if (!collision.gameObject.CompareTag("Player")) return;
         AudioM.Play("DicePickup1");
-        // 关闭其他移动
+        // 鍏抽棴鍏朵粬绉诲姩
         GetComponent<Collider2D>().enabled = false;
         GetComponent<Rigidbody2D>().gravityScale = 0;
         GetComponent<Rigidbody2D>().velocity = Vector2.zero;
-        // 开始旋转
+        // 寮€濮嬫棆杞�
         transform.DORotate(new Vector3(0, 0, 360f * Mathf.RoundToInt(rollTime * 1.5f)), rollTime, RotateMode.FastBeyond360);
         transform.DOScale(2, rollTime);
         transform.DOMoveY(transform.position.y + 3, rollTime);
@@ -34,34 +36,34 @@ public class DiceEntity : MonoBehaviour {
     }
     IEnumerator Roll() {
         for (int i = 0; i < rollTime * 8; i++) {
-            currentLetter = Modules.RandomOne("wasdlr".ToList()).ToString();
+            currentLetter = Module.RandomOne("wasdlr".ToList()).ToString();
             UpdateSpriteText();
             yield return new WaitForSeconds(0.1f);
         }
         for (int i = 0; i < Mathf.RoundToInt(rollTime * 0.333f); i++) {
-            currentLetter = Modules.RandomOne("wasdlr".ToList()).ToString();
+            currentLetter = Module.RandomOne("wasdlr".ToList()).ToString();
             UpdateSpriteText();
             yield return new WaitForSeconds(0.333f);
         }
-        // 最终确定
+        // 鏈€缁堢‘瀹�
         string possible = InputM.GetPossibleResults(key, canRestore);
         Debug.Log(possible);
-        currentLetter = Modules.RandomOne(possible.ToCharArray().ToList()).ToString();
+        currentLetter = Module.RandomOne(possible.ToCharArray().ToList()).ToString();
         UpdateSpriteText();
         yield return new WaitForSeconds(0.5f);
-        // 强调动画
+        // 寮鸿皟鍔ㄧ敾
         AudioM.Play("DicePickup2");
         transform.DOScale(2.5f, 0.1f);
         yield return new WaitForSeconds(0.1f);
         transform.DOScale(2.3f, 0.1f);
         yield return new WaitForSeconds(0.7f);
-        // 结束动画
+        // 缁撴潫鍔ㄧ敾
         transform.DOScale(1, endTime);
         GameObject endObj = InputM.GetDiceUI(key);
         Vector2 screenPos = RectTransformUtility.WorldToScreenPoint(Camera.allCameras[0], endObj.transform.position);
         transform.DOMove((Vector2) Camera.allCameras[0].ScreenToWorldPoint(screenPos), endTime);
         yield return new WaitForSeconds(endTime);
-        // 设置
+        // 璁剧疆
         InputM.SetKey(key, currentLetter);
         endObj.GetComponent<DiceUI>().isDropped = false;
         endObj.GetComponent<DiceUI>().UpdateColor();
@@ -70,4 +72,4 @@ public class DiceEntity : MonoBehaviour {
     }
 
 
-}
+}

+ 1 - 1
Assets/Resources/Dice/DiceUI.cs

@@ -39,7 +39,7 @@ public class DiceUI : MonoBehaviour {
     void Update() {
         if (!Input.GetMouseButtonUp(0) || !(allowPress || Input.GetKey(KeyCode.LeftControl)) || 
             !RectTransformUtility.RectangleContainsScreenPoint(rectTransform, Input.mousePosition, Camera.allCameras[0])) return;
-        // µã»÷
+        // ?
         DropDice();
     }
 

+ 4 - 4
Assets/Resources/Entities/EnemyBase.cs

@@ -12,16 +12,16 @@ public abstract class EnemyBase : EntityBase {
 
     public int hp; internal int currentHp = -1;
     internal override void OnHitBullet() {
-        // 受伤动画
+        // 鍙椾激鍔ㄧ敾
         sprite.DOColor(new Color(1f, 0.5f, 0.5f), 0.04f).SetLoops(2, LoopType.Yoyo);
-        // 死亡判断
+        // 姝讳骸鍒ゆ柇
         if (currentHp == -1) currentHp = hp;
         currentHp--;
         if (currentHp < 0) {
             AudioM.Play("enemy_die");
             transform.localScale = Vector3.zero;
-            Destroy(gameObject, 1); // 防止动画没播放完导致报错
+            Destroy(gameObject, 1); // 闃叉�鍔ㄧ敾娌℃挱鏀惧畬瀵艰嚧鎶ラ敊
         }
     }
 
-}
+}

+ 17 - 19
Assets/Resources/Entities/EntityBase.cs

@@ -17,25 +17,24 @@ public abstract class EntityBase : MonoBehaviour {
 
     public bool canCrouch = false;
     public float movementSpeed = 10f, jumpForce = 20f, horizontalF = 0.9f, horizontalA = 0.3f, jumpThreshold = 0.1f, downA = 0.3f, fallA = 0.1f, filpSpeed = 0.3f;
-    public float jumpBufferTime = 0.2f, jumpWolfTime = 0.2f, baseMass = 1f;
-    internal float jumpBuffer = 0f, jumpWolf = 0f, jumping = 0f;
+    public float jumpBufferTime = 0.2f, jumpWolfTime = 0.2f; internal float jumpBuffer = 0f, jumpWolf = 0f, jumping = 0f;
     internal bool towardsRight = true, isLand = false;
     void Update() {
         OnUpdate();
-        // 获取当前情况
+        // 鑾峰彇褰撳墠鎯呭喌
         float speedX = rb.velocity.x, speedY = rb.velocity.y;
         bool isCrouch = isPressingCrouch();
-        isLand = Physics2D.OverlapCircle(transform.position + Vector3.left * 0.1f, jumpThreshold, LayerMask.GetMask("Tilemap")) || 
+        isLand = Physics2D.OverlapCircle(transform.position + Vector3.left * 0.1f, jumpThreshold, LayerMask.GetMask("Tilemap")) ||
             Physics2D.OverlapCircle(transform.position + Vector3.left * -0.1f, jumpThreshold, LayerMask.GetMask("Tilemap"));
-        float moveHorizontal = (isCrouch && isLand ? 0.35f : 1) * // 下蹲减速
-            (isPressingLeft() == isPressingRight() ? 0 : // 没有同时按住左右
-            (isPressingLeft() ? -1 : 1)); // 获取方向
-        // 判断跳跃
+        float moveHorizontal = (isCrouch && isLand ? 0.35f : 1) * // 涓嬭共鍑忛€�
+            (isPressingLeft() == isPressingRight() ? 0 : // 娌℃湁鍚屾椂鎸変綇宸﹀彸
+            (isPressingLeft() ? -1 : 1)); // 鑾峰彇鏂瑰悜
+        // 鍒ゆ柇璺宠穬
         jumpBuffer -= Time.deltaTime; jumpWolf -= Time.deltaTime; jumping -= Time.deltaTime;
         if (isPressDownJump()) jumpBuffer = jumpBufferTime;
         if (isLand) jumpWolf = jumpWolfTime;
         if (jumpBuffer > 0 && jumpWolf > 0 && jumping < 0) {
-            // 播放音效
+            // 鎾�斁闊虫晥
             AudioM.Play("jump");
 
             speedY = jumpForce;
@@ -44,14 +43,14 @@ public abstract class EntityBase : MonoBehaviour {
         } else if (isCrouch) {
             speedY -= downA;
         }
-        // 加速下落
+        // 鍔犻€熶笅钀�
         if (speedY < 0) speedY -= fallA;
-        // 横向移动
+        // 妯�悜绉诲姩
         if (moveHorizontal != 0) {
             speedX = speedX * (1 - horizontalA) + movementSpeed * horizontalA * moveHorizontal;
         }
         speedX *= horizontalF;
-        // 蹲下
+        // 韫蹭笅
         if (canCrouch) {
             if (isCrouch) {
                 sprite.sprite = spriteDown;
@@ -63,11 +62,10 @@ public abstract class EntityBase : MonoBehaviour {
                 coll.offset = new Vector2(0, 0.7f);
             }
         }
-        // 设置
+        // 璁剧疆
         rb.velocity = new Vector2(speedX, speedY);
-        rb.mass = baseMass * (towardsRight ? 1.2f : 0.8f);
         if (towardsRight != (Mathf.Abs(speedX) > filpSpeed ? speedX > 0 : towardsRight)) {
-            // 反向
+            // 鍙嶅悜
             towardsRight = !towardsRight;
             transform.DOScaleX(towardsRight ? 1 : -1, 0.1f);
         }
@@ -76,9 +74,9 @@ public abstract class EntityBase : MonoBehaviour {
     internal abstract bool isPressingRight();
     internal abstract bool isPressDownJump();
     internal abstract bool isPressingCrouch();
-    internal virtual void OnUpdate() {}
+    internal virtual void OnUpdate() { }
 
-    // 碰撞检测
+    // 纰版挒妫€娴�
     private void OnCollisionEnter2D(Collision2D collision) {
         if (collision.gameObject.CompareTag("Border")) OnHitBorder();
         if (collision.gameObject.CompareTag("Bullet")) OnHitBullet();
@@ -86,7 +84,7 @@ public abstract class EntityBase : MonoBehaviour {
         if (collision.gameObject.CompareTag("Player") && gameObject.CompareTag("Enemy")) OnHitEnemy(collision);
     }
     internal abstract void OnHitBorder();
-    internal virtual void OnHitBullet() {}
+    internal virtual void OnHitBullet() { }
     internal abstract void OnHitEnemy(Collision2D collision);
 
-}
+}

+ 10 - 18
Assets/Resources/Entities/Player.cs

@@ -12,7 +12,7 @@ public class Player : EntityBase {
     internal override bool isPressingLeft() => InputM.GetKeyEvent(InputM.KeyType.Left);
     internal override bool isPressingRight() => InputM.GetKeyEvent(InputM.KeyType.Right);
 
-    // ����
+    // 生命
     public RectTransform[] hearts;
     private int _hp = 3;
     private int hp {
@@ -42,7 +42,7 @@ public class Player : EntityBase {
         Camera.current.DOShakePosition(0.3f, 0.3f, 20).SetId("ScreenShake");
     }
 
-    // ����
+    // 治疗
     public float healTime = 4f; private float currentHealTime = 0f;
     private void RefreshHearts() {
         float totalHp = Mathf.Clamp(hp + Mathf.Pow(currentHealTime / healTime, 7f) * 0.7f + currentHealTime / healTime * 0.3f, 0, 3);
@@ -51,14 +51,14 @@ public class Player : EntityBase {
         }
     }
 
-    // ���
+    // 射击
     public int maxBullet = 20, currentBullet = 20;
     public float shootDelay = 0.15f; private float currentShootDelay = 0f;
     public float reloadDelay = 1.5f; private float currentReloadDelay = 0f;
     public float bulletSpeed = 50f, bulletKnockback = 1f;
     public GameObject bullet; public TMPro.TextMeshProUGUI textBullet;
     internal override void OnUpdate() {
-        // ����
+        // 治疗
         if (isPressingCrouch() && hp < 3 && isLand) {
             currentHealTime += Time.deltaTime;
             if (currentHealTime > healTime) {
@@ -70,7 +70,7 @@ public class Player : EntityBase {
             currentHealTime = 0f;
             RefreshHearts();
         }
-        // װ��
+        // 装填
         if (InputM.GetKeyEvent(InputM.KeyType.Reload) && currentBullet < maxBullet && currentReloadDelay <= 0f) {
             AudioM.Play("reload");
             currentReloadDelay = reloadDelay;
@@ -79,8 +79,7 @@ public class Player : EntityBase {
         } else if (currentReloadDelay > 0) {
             currentReloadDelay -= Time.deltaTime;
         }
-        // ����
-        bool autoReload = false;
+        // 开火
         if (InputM.GetKeyEvent(InputM.KeyType.Fire) && currentBullet > 0 && currentShootDelay <= 0f && currentReloadDelay <= 0f) {
             AudioM.Play("fire");
             currentBullet--; currentShootDelay = shootDelay;
@@ -90,23 +89,16 @@ public class Player : EntityBase {
             GameObject newBullet = Instantiate(bullet, fromPos, Quaternion.identity);
             newBullet.GetComponent<Rigidbody2D>().velocity = bulletSpeed * shootVector;
             newBullet.transform.eulerAngles = (shootVector.x > 0 ? -1 : 1) * Vector2.Angle(shootVector, Vector2.up) * Vector3.forward;
-            // ������
+            // 后座力
             rb.velocity += bulletKnockback * -shootVector;
         } else if (currentShootDelay > 0) {
             currentShootDelay -= Time.deltaTime;
-        }else if (autoReload && InputM.GetKeyEvent(InputM.KeyType.Fire) && currentBullet == 0 && currentShootDelay <= 0f && currentReloadDelay <= 0f)
-        {
-            AudioM.Play("reload");
-            currentReloadDelay = reloadDelay;
-        }
-        {
-
         }
-        // ���� UI
+        // 更新 UI
         textBullet.text = currentReloadDelay > 0f ?
-            "".PadLeft(maxBullet - Mathf.RoundToInt(currentReloadDelay / reloadDelay * maxBullet), "|".ToCharArray().First()) : 
+            "".PadLeft(maxBullet - Mathf.RoundToInt(currentReloadDelay / reloadDelay * maxBullet), "|".ToCharArray().First()) :
             "".PadLeft(currentBullet, "|".ToCharArray().First());
         textBullet.color = currentReloadDelay > 0f ? new Color(0.6f, 0.6f, 0.6f) : new Color(0.6588235f, 1f, 0.6941177f);
     }
 
-}
+}

+ 12 - 12
Assets/Resources/System/InputM.cs

@@ -5,7 +5,7 @@ using System.Linq;
 
 public class InputM : MonoBehaviour {
     public GameObject dicePrefab;
-    
+
     public static string keyLeft = "a", keyRight = "d", keyJump = "w", keyCrouch = "s", keyFire = "l", keyReload = "r";
     public enum KeyType { Left, Right, Jump, Crouch, Fire, Reload }
 
@@ -90,31 +90,31 @@ public class InputM : MonoBehaviour {
     public static string GetPossibleResults(KeyType key, bool doRestore) {
         List<string> accepted = "wasdlr".ToList().Select(c => c.ToString()).ToList();
         List<string> refused = new();
-        // 删除冲突键位
-        //  - 不能同时跳跃、蹲下
-        if (key == KeyType.Jump) refused.Add(GetKeyRaw(KeyType.Crouch)); 
+        // 鍒犻櫎鍐茬獊閿�綅
+        //  - 涓嶈兘鍚屾椂璺宠穬銆佽共涓�
+        if (key == KeyType.Jump) refused.Add(GetKeyRaw(KeyType.Crouch));
         if (key == KeyType.Crouch) refused.Add(GetKeyRaw(KeyType.Jump));
-        //  - 不能同时向左、向右
+        //  - 涓嶈兘鍚屾椂鍚戝乏銆佸悜鍙�
         if (key == KeyType.Left) refused.Add(GetKeyRaw(KeyType.Right));
         if (key == KeyType.Right) refused.Add(GetKeyRaw(KeyType.Left));
-        //  - 不能同时开火、装弹
+        //  - 涓嶈兘鍚屾椂寮€鐏�€佽�寮�
         if (key == KeyType.Fire) refused.Add(GetKeyRaw(KeyType.Reload));
         if (key == KeyType.Reload) refused.Add(GetKeyRaw(KeyType.Fire));
-        // 禁止选择已经有两个绑定项的字母、尽量选择没有绑定项的字母
+        // 绂佹�閫夋嫨宸茬粡鏈変袱涓�粦瀹氶」鐨勫瓧姣嶃€佸敖閲忛€夋嫨娌℃湁缁戝畾椤圭殑瀛楁瘝
         foreach (string letter in "wasdlr".ToCharArray().Select(c => c.ToString())) {
             if (keyTypes.Count(keyType => GetKeyRaw(keyType) == letter) >= 2) refused.Add(letter);
             if (keyTypes.Count(keyType => GetKeyRaw(keyType) == letter) == 0) { accepted.Add(letter); accepted.Add(letter); }
         }
-        // 禁止与当前项相同
+        // 绂佹�涓庡綋鍓嶉」鐩稿悓
         refused.Add(GetKeyRaw(key));
-        // 是否可以还原回原始键位
+        // 鏄�惁鍙�互杩樺師鍥炲師濮嬮敭浣�
         if (!doRestore) refused.Add(GetKeyRawDefault(key));
         if (doRestore) for (int i = 0; i < 10; i++) accepted.Add(GetKeyRawDefault(key));
-        // 输出
+        // 杈撳嚭
         string resultStr = "";
         accepted.ForEach(resultChar => {
             foreach (string refusedChar in refused) if (resultChar == refusedChar) return;
-            resultStr += resultChar; 
+            resultStr += resultChar;
         });
         return resultStr;
     }
@@ -123,4 +123,4 @@ public class InputM : MonoBehaviour {
         GetDiceUI(key).GetComponent<DiceUI>().DropDice();
     }
 
-}
+}

+ 15 - 15
Assets/Resources/System/StoryM.cs

@@ -8,21 +8,21 @@ using System.Linq;
 
 public class StoryM : MonoBehaviour {
 
-    // 文本
+    // 鏂囨湰
     public TMPro.TextMeshProUGUI textStory;
     public RectTransform shapeBack;
     /// <summary>
-    /// 设置旁白,并返回预期时间。旁白字幕将在预期时间后消失。
+    /// 璁剧疆鏃佺櫧锛屽苟杩斿洖棰勬湡鏃堕棿銆傛梺鐧藉瓧骞曞皢鍦ㄩ�鏈熸椂闂村悗娑堝け銆�
     /// </summary>
     public float SetStoryText(string textCn, string textEn = "English") {
         bool isCn = LocalizationSettings.SelectedLocale.LocaleName == "Chinese (Simplified) (zh-CN)";
         textStory.text = isCn ? textCn : textEn;
         LayoutRebuilder.ForceRebuildLayoutImmediate(textStory.rectTransform);
-        // 动画
+        // 鍔ㄧ敾
         textStory.color = Color.black;
         DOTween.Kill("StoryFont"); textStory.DOColor(Color.white, 0.25f).SetId("StoryFont");
         DOTween.Kill("StoryBackground"); shapeBack.DOScaleX((textStory.rectTransform.rect.width + 40f) / 100f, 0.15f).SetId("StoryBackground");
-        // 消失
+        // 娑堝け
         float time = 1.5f + (isCn ? textCn.Length / 1.5f : textEn.Split(" ").Length / 2f);
         StopCoroutine(nameof(WaitForHideStoryText)); StartCoroutine(WaitForHideStoryText(time));
         return time;
@@ -36,10 +36,10 @@ public class StoryM : MonoBehaviour {
         DOTween.Kill("StoryBackground"); shapeBack.DOScaleX(0, 0.2f).SetId("StoryBackground");
     }
 
-    // 刷怪
+    // 鍒锋€�
     private Dictionary<Spawner.EnemyType, List<Spawner>> spawners = null;
     public void Spawn(Spawner.EnemyType type, int count = 1) {
-        // 初始化
+        // 鍒濆�鍖�
         if (spawners == null) {
             spawners = new();
             foreach (Spawner spawner in FindObjectsOfType<Spawner>()) {
@@ -50,16 +50,16 @@ public class StoryM : MonoBehaviour {
                 }
             }
         }
-        // 实际刷怪
+        // 瀹為檯鍒锋€�
         spawners[type].Shuffle();
         for (int i = 0; i < Mathf.Min(6, count); i++) {
             spawners[type][i].Spawn();
         }
     }
 
-    // 流程控制
+    // 娴佺▼鎺у埗
     IEnumerator WaitUntilClear(int remain = 0) {
-        while (FindObjectsOfType<EnemyBase>().Length - FindObjectsOfType<EnemyArrow>().Length > remain) { // 要算上自己
+        while (FindObjectsOfType<EnemyBase>().Length - FindObjectsOfType<EnemyArrow>().Length > remain) { // 瑕佺畻涓婅嚜宸�
             yield return new WaitForSeconds(0.1f);
         }
     }
@@ -69,7 +69,7 @@ public class StoryM : MonoBehaviour {
         }
     }
 
-    // 故事
+    // 鏁呬簨
     public int stage = 0;
     void Start() {
         StartCoroutine(test());
@@ -80,19 +80,19 @@ public class StoryM : MonoBehaviour {
         while (true) {
             canSpawnArrow = true;
             Spawn(Spawner.EnemyType.Mover, 3);
-            SetStoryText("先刷几个瞎晃悠的", "");
+            SetStoryText("鍏堝埛鍑犱釜鐬庢檭鎮犵殑", "");
             yield return new WaitForSeconds(4f);
 
             Spawn(Spawner.EnemyType.Heavy, 2);
-            SetStoryText("然后是两个贼硬的……", "");
+            SetStoryText("鐒跺悗鏄�袱涓�醇纭�殑鈥︹€�", "");
             yield return StartCoroutine(WaitUntilClear(2));
 
             canSpawnArrow = false;
             InputM.DropDice(Modules.RandomOne(InputM.keyTypes.ToList()));
-            SetStoryText("来一个骰子吧……?", "");
+            SetStoryText("鏉ヤ竴涓��瀛愬惂鈥︹€︼紵", "");
             yield return StartCoroutine(WaitUntilPickDice());
 
-            yield return StartCoroutine(WaitForStoryText("准备好,下一轮要来了!", ""));
+            yield return StartCoroutine(WaitForStoryText("鍑嗗�濂斤紝涓嬩竴杞��鏉ヤ簡锛�", ""));
         }
     }
     IEnumerator spawnArrow() {
@@ -102,4 +102,4 @@ public class StoryM : MonoBehaviour {
         }
     }
 
-}
+}

+ 1 - 2
Assets/Resources/UI/LocalesProvider.cs

@@ -1,8 +1,7 @@
 using System.Collections.Generic;
 using UnityEngine.Localization.Settings;
 
-public class LocalesProvider : ILocalesProvider
-{
+public class LocalesProvider : ILocalesProvider{
     public List<UnityEngine.Localization.Locale> Locales { get; } = new List<UnityEngine.Localization.Locale>();
 
     public UnityEngine.Localization.Locale GetLocale(UnityEngine.Localization.LocaleIdentifier id) => Locales.Find(l => l.Identifier == id);