From e43df5edfae9d2f6e53df1f9c2cd88469cbf35d8 Mon Sep 17 00:00:00 2001
From: client_Hale <339726288@qq.com>
Date: 星期三, 05 十二月 2018 15:22:46 +0800
Subject: [PATCH] 5224 子 【1.3.100】游戏帧数优化(一) / 【1.3.100】【前端】游戏帧数优化(一)

---
 Fight/GameActor/GAMgr.cs |   68 ++++++++++++++++++++++++++++++++++
 1 files changed, 68 insertions(+), 0 deletions(-)

diff --git a/Fight/GameActor/GAMgr.cs b/Fight/GameActor/GAMgr.cs
index ffbc0e4..a4dc4fe 100644
--- a/Fight/GameActor/GAMgr.cs
+++ b/Fight/GameActor/GAMgr.cs
@@ -96,6 +96,74 @@
 
             SystemSetting.Instance.playerSyncCountChangeEvent += OnPlayerSyncCountChange;
             SystemSetting.Instance.OnSettingChanged += OnSettingChanged;
+            SystemSetting.Instance.qualityLevelChangeEvent += OnQualityLevelChange;
+        }
+    }
+
+    private void OnQualityLevelChange()
+    {
+        List<GActor> _list = GetTypeList(E_ActorClassType.Pet);
+
+        if (_list == null || _list.Count == 0)
+        {
+            return;
+        }
+
+        //Debug.LogFormat("鍏辨湁: {0} 鍙疇鐗�", _petList.Count);
+        GA_Player _player = null;
+        foreach (var _pet in _list)
+        {
+            var _parentID = _pet.ActorInfo.ownerSID;
+            if (_parentID == PlayerDatas.Instance.PlayerId)
+            {
+                continue;
+            }
+
+            _player = GetBySID(_parentID) as GA_Player;
+            if (_player == null || !_player.ShowOrHide)
+            {
+                _pet.ShowOrHideModel(false);
+                //Debug.LogFormat("瀹犵墿: {0} 鐨勬嫢鏈夎��: {1} 涓嶅彲瑙�, 杩欓噷闅愯棌.", _pet.ServerInstID, _parentID);
+                continue;
+            }
+
+            var _index = BattleEffectPlayRule.Instance.GetIndex(_parentID);
+            if (_index != -1 && _index < BattleEffectPlayRule.Instance.petLimit)
+            {
+                _pet.ShowOrHideModel(true);
+                //Debug.LogFormat("瀹犵墿: {0} 鐨勬嫢鏈夎��: {1} 鍦ㄥ垪琛ㄤ腑涓斾綅浜�: {2}, 灏忎簬闄愬埗鏁伴噺: {3}", _pet.ServerInstID, _parentID, _index, BattleEffectPlayRule.Instance.petLimit);
+            }
+            else
+            {
+                _pet.ShowOrHideModel(false);
+                //Debug.LogFormat("瀹犵墿: {0} 鐨勬嫢鏈夎��: {1} 鍦ㄥ垪琛ㄤ腑涓斾綅浜�: {2}, 澶т簬闄愬埗鏁伴噺: {3}", _pet.ServerInstID, _parentID, _index, BattleEffectPlayRule.Instance.petLimit);
+            }
+        }
+
+        _list = GetTypeList(E_ActorClassType.Player);
+
+        //Debug.LogFormat("鍏辨湁: {0} 鍙畧鎶�", _list.Count);
+        foreach (var _chkPlayer in _list)
+        {
+            _player = _chkPlayer as GA_Player;
+            if (_chkPlayer == null || !_chkPlayer.ShowOrHide)
+            {
+                _player.SwitchGuard(0);
+                //Debug.LogFormat("_list: {0} 鐨勬嫢鏈夎��: {1} 涓嶅彲瑙�, 杩欓噷闅愯棌.", _chkPlayer.ServerInstID, _player.ServerInstID);
+                continue;
+            }
+
+            var _index = BattleEffectPlayRule.Instance.GetIndex(_player.ServerInstID);
+            if (_index != -1 && _index < BattleEffectPlayRule.Instance.petLimit)
+            {
+                _player.SwitchGuard((uint)_player.serverGuardId);
+                //Debug.LogFormat("_list: {0} 鐨勬嫢鏈夎��: {1} 鍦ㄥ垪琛ㄤ腑涓斾綅浜�: {2}, 灏忎簬闄愬埗鏁伴噺: {3}", _chkPlayer.ServerInstID, _player.ServerInstID, _index, BattleEffectPlayRule.Instance.petLimit);
+            }
+            else
+            {
+                _player.SwitchGuard(0);
+                //Debug.LogFormat("_list: {0} 鐨勬嫢鏈夎��: {1} 鍦ㄥ垪琛ㄤ腑涓斾綅浜�: {2}, 澶т簬闄愬埗鏁伴噺: {3}", _chkPlayer.ServerInstID, _player.ServerInstID, _index, BattleEffectPlayRule.Instance.petLimit);
+            }
         }
     }
 

--
Gitblit v1.8.0