Forráskód Böngészése

鸭子更新。。。

lvjincheng 3 éve
szülő
commit
424816ce8e

+ 2 - 0
Assets/BowArrow/Scripts/Expand/AutoResetView.cs

@@ -17,6 +17,8 @@ public class AutoResetView : MonoBehaviour
     public static void DoIdentity() {
         if (UnityEngine.SceneManagement.SceneManager.GetActiveScene().name.StartsWith("Game")) {
             GameObject.Instantiate(Resources.Load<GameObject>("Prefabs/Views/AutoResetView"));
+        } else if (UnityEngine.SceneManagement.SceneManager.GetActiveScene().name.StartsWith("DuckHunter")) {
+            GameObject.Instantiate(Resources.Load<GameObject>("Prefabs/Views/AutoResetView"));
         } else {
             AimHandler.ins.DoIdentity();
         }

+ 7 - 3
Assets/BowArrow/Scripts/Expand/UserGameAnalyse1.cs

@@ -24,7 +24,8 @@ public class UserGameAnalyse1 : MonoBehaviour
     {
         _Instance = this;
         DontDestroyOnLoad(gameObject);
-        gameType = 13;
+        // gameType = 13;
+        gameType = 4; //代替野鸡
         startTime = JCUnityLib.TimeUtils.GetTimestamp();
         sceneTimeOnStart = Time.realtimeSinceStartup;
     }
@@ -52,8 +53,11 @@ public class UserGameAnalyse1 : MonoBehaviour
     public void UploadData() 
     {
         int durationTime = (int) duration;
-        UserPlayer.ins.call("UserGameAnalyseComp.uploadUserGameRecord", gameType, startTime, durationTime);
-        Debug.Log("上传用户打鸭子游戏时长统计数据:" + durationTime);
+        if (UserPlayer.ins != null) 
+        {
+            UserPlayer.ins.call("UserGameAnalyseComp.uploadUserGameRecord", gameType, startTime, durationTime);
+            Debug.Log("上传用户打鸭子游戏时长统计数据:" + durationTime);
+        }
     }
 
     bool IsTargetScene()

+ 3 - 2
Assets/BowArrow/Scripts/View/Home/ChallengeOptionView.cs

@@ -8,7 +8,8 @@ public class ChallengeOptionView : JCUnityLib.ViewBase, MenuBackInterface
     public override void OnInitView()
     {
         //激活鸭子选项卡
-        transform.Find("EntryList/Item3").gameObject.SetActive(GlobalDataTemp.pkMatchType == PKMatchType.None);
+        // transform.Find("EntryList/Item3").gameObject.SetActive(GlobalDataTemp.pkMatchType == PKMatchType.None);
+        transform.Find("EntryList/Item3").gameObject.SetActive(false);
     }
 
     void Start() {
@@ -39,7 +40,7 @@ public class ChallengeOptionView : JCUnityLib.ViewBase, MenuBackInterface
         }
         GlobalData.pkMatchType = GlobalDataTemp.pkMatchType;
         GameMgr.gameType = gameType;
-        if (gameType == 13) {
+        if (gameType == 4) {
             SceneManager.LoadScene("DuckHunter", LoadSceneMode.Single);
         } else {
             SceneManager.LoadScene("GameChallenge", LoadSceneMode.Single);

+ 3 - 3
Assets/DuckHunter/Scenes/DuckHunter.unity

@@ -3146,14 +3146,14 @@ MonoBehaviour:
     m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0}
     m_FontSize: 48
     m_FontStyle: 0
-    m_BestFit: 0
+    m_BestFit: 1
     m_MinSize: 24
     m_MaxSize: 48
     m_Alignment: 4
     m_AlignByGeometry: 0
     m_RichText: 1
-    m_HorizontalOverflow: 1
-    m_VerticalOverflow: 1
+    m_HorizontalOverflow: 0
+    m_VerticalOverflow: 0
     m_LineSpacing: 1
   m_Text: 10000
 --- !u!222 &1086628888

+ 45 - 24
Assets/DuckHunter/Scripts/GameManager.cs

@@ -22,6 +22,11 @@ namespace DuckHunter
         {
             Instance = this;
             dogObject.SetActive(true);
+            if (!AutoNextLevel)
+            {
+                DefaultLevel = 1;
+                _CumulativeScore = 0;
+            }
             level = DefaultLevel;
         }
 
@@ -249,7 +254,9 @@ namespace DuckHunter
             int scoreToPlus = duck.config.type * 500;
             hitScore += scoreToPlus;
             GameUI.Instance.RenderHitDuckCount(duck.config.type);
-            GameUI.Instance.RenderHitScore(hitScore, GetBestScore());
+            // GameUI.Instance.RenderHitScore(hitScore, GetBestScore());
+            _CumulativeScore += scoreToPlus;
+            GameUI.Instance.RenderHitScore(_CumulativeScore, GetBestScore());
             GameUI.Instance.ShowTextHitScore(scoreToPlus, duck.transform.position);
             RemoveArrows(duck);
         }
@@ -325,7 +332,8 @@ namespace DuckHunter
             }, startImmediate);
             NoArrows();
             GameUI.Instance.RenderLevel(level);
-            GameUI.Instance.RenderHitScore(hitScore, GetBestScore());
+            // GameUI.Instance.RenderHitScore(hitScore, GetBestScore());
+            GameUI.Instance.RenderHitScore(_CumulativeScore, GetBestScore());
         }
 
         void SettleGame()
@@ -356,7 +364,9 @@ namespace DuckHunter
                     //奖励额外积分
                     int plusScore = 10000;
                     hitScore += plusScore;
-                    GameUI.Instance.RenderHitScore(hitScore, GetBestScore());
+                    // GameUI.Instance.RenderHitScore(hitScore, GetBestScore());
+                    _CumulativeScore += plusScore;
+                    GameUI.Instance.RenderHitScore(_CumulativeScore, GetBestScore());
                     TextGameScreenCenter.Instance.ShowText(TextGameScreenCenter.TextName.SUPER_ARCHER, new object[] { plusScore }, ShowGamePass);
                     AudioManager.Instance.PlayFullScore();
                 }
@@ -385,14 +395,15 @@ namespace DuckHunter
             AudioManager.Instance.PlayGamePass();
             Debug.Log("通关成功");
         }
-
+        int _arrowCount;
         int arrowCount
         {
             get
             {
-                int count = 0;
-                _duckCanShootCountList.ForEach(e => count += e.shootCount);
-                return count;
+                // int count = 0;
+                // _duckCanShootCountList.ForEach(e => count += e.shootCount);
+                // return count;
+                return _arrowCount;
             }
         }
         List<DuckCanShootCount> _duckCanShootCountList = new List<DuckCanShootCount>();
@@ -408,27 +419,29 @@ namespace DuckHunter
         }
         void ResumeArrows(Duck duck)
         {
-            _duckCanShootCountList.Add(new DuckCanShootCount(duck, 3));
+            // _duckCanShootCountList.Add(new DuckCanShootCount(duck, 3));
+            _arrowCount = 3;
             GameUI.Instance.RenderArrowCount(arrowCount);
         }
         void RemoveArrows(Duck duck)
         {
-            _duckCanShootCountList.RemoveAll(e => e.duck == duck);
-            GameUI.Instance.RenderArrowCount(arrowCount);
+            // _duckCanShootCountList.RemoveAll(e => e.duck == duck);
+            // GameUI.Instance.RenderArrowCount(arrowCount);
         }
 
         bool UseOneArrow()
         {
             if (arrowCount > 0)
             {
-                foreach (var e in _duckCanShootCountList)
-                {
-                    if (e.shootCount > 0)
-                    {
-                        e.shootCount--;
-                        break;
-                    }
-                }
+                // foreach (var e in _duckCanShootCountList)
+                // {
+                //     if (e.shootCount > 0)
+                //     {
+                //         e.shootCount--;
+                //         break;
+                //     }
+                // }
+                _arrowCount--;
                 GameUI.Instance.RenderArrowCount(arrowCount);
                 return true;
             }
@@ -437,27 +450,35 @@ namespace DuckHunter
 
         void NoArrows()
         {
-            _duckCanShootCountList = new List<DuckCanShootCount>();
+            // _duckCanShootCountList = new List<DuckCanShootCount>();
+            _arrowCount = 0;
             GameUI.Instance.RenderArrowCount(arrowCount);
         }
 
         void CheckNotifyFlyAway()
         {
-            foreach (var e in _duckCanShootCountList)
-                if (e.shootCount == 0)
-                    e.duck.NotifyFlyAway();
+            // foreach (var e in _duckCanShootCountList)
+            //     if (e.shootCount == 0)
+            //         e.duck.NotifyFlyAway();
+            if (arrowCount <= 0)
+                foreach (var duck in Duck.DuckList)
+                    duck.NotifyFlyAway();
         }
 
+        //累计得分
+        private static int _CumulativeScore = 0;
         private static int _BestScoreVersion = 1;
         string GetBestScoreKey()
         {
-            return "BestScore_Level" + level + "_V" + _BestScoreVersion;
+            // return "BestScore_Level" + level + "_V" + _BestScoreVersion;
+            return "DuckHunter_" + LoginMgr.myUserInfo.id + "_" + _BestScoreVersion;
         }
         void SaveBestScore()
         {
             string k = GetBestScoreKey();
             int s = PlayerPrefs.GetInt(k, 0);
-            if (hitScore > s) PlayerPrefs.SetInt(k, hitScore);
+            // if (hitScore > s) PlayerPrefs.SetInt(k, hitScore);
+            if (_CumulativeScore > s) PlayerPrefs.SetInt(k, _CumulativeScore);
         }
         int GetBestScore()
         {

+ 2 - 1
Assets/DuckHunter/Scripts/SmartBowController.cs

@@ -33,7 +33,8 @@ namespace DuckHunter
         }
 
         public void ResetAim() {
-            AimHandler.ins.DoIdentity();
+            // AimHandler.ins.DoIdentity();
+            AutoResetView.DoIdentity();
         }
     }
 }

+ 2 - 1
Assets/DuckHunter/Scripts/Text/TextGameScreenCenter.cs

@@ -103,7 +103,8 @@ namespace DuckHunter
             }
             else if (textName == TextName.GAME_COMPLETED)
             {
-                _mainTextAutoLanguage2.SetTextKey("SC-GAME_COMPLETED");
+                // _mainTextAutoLanguage2.SetTextKey("SC-GAME_COMPLETED");
+                _mainTextAutoLanguage2.SetTextKey(""); //游戏通关不显示文字
                 SetAlpha(_mainText, 1);
                 _mainSequence = DOTween.Sequence();
                 _mainSequence.AppendInterval(3);