Эх сурвалжийг харах

战斗卡牌特效修改以及卡牌得分和点击得分分开处理

zhangyuqian 1 жил өмнө
parent
commit
7abffb5096

+ 2 - 2
GameClient/Assets/Game/HotUpdate/Data/ScoreSystemData.cs

@@ -120,7 +120,7 @@ namespace GFGGame
         /// <param name="type">评分部位</param>
         /// <param name="showCard">是否展示词牌效果</param>
         /// <returns></returns>
-        public int GetRoundScore(FightData roleData, int roundId, int clickType, double skillScore)
+        public int GetRoundScore(FightData roleData, int roundId, int clickType, double skillScore = 0)
         {
 
             //部件评分=部件基础分*部件系数
@@ -141,7 +141,7 @@ namespace GFGGame
             //end--------------------------------------------------------
             //改为 点击评分 =(部件基础分+人物基础分)*点击系数
             double clickScore = (partBaseScore + roleScore) * clickCoefficient;
-            int score = (int)Math.Ceiling(partScore + clickScore + skillScore);
+            int score = (int)Math.Ceiling(partScore + clickScore );
             return Math.Max(0, score);
         }
 

+ 9 - 0
GameClient/Assets/Game/HotUpdate/FairyGUI/GenCode/Main/UI_ComSkillShow.cs

@@ -12,6 +12,9 @@ namespace UI.Main
         public UI_ComSkillScore m_ComSkillScore;
         public GTextField m_txtName;
         public GGraph m_holderTop;
+        public GGraph m_addScore;
+        public GGraph m_reduceScore;
+        public GTextField m_SkillScore;
         public Transition m_t0;
         public Transition m_t1;
         public const string URL = "ui://mfvz4q8kpsphiy";
@@ -66,6 +69,9 @@ namespace UI.Main
             m_ComSkillScore = (UI_ComSkillScore)UI_ComSkillScore.Create(comp.GetChild("ComSkillScore"));
             m_txtName = (GTextField)comp.GetChild("txtName");
             m_holderTop = (GGraph)comp.GetChild("holderTop");
+            m_addScore = (GGraph)comp.GetChild("addScore");
+            m_reduceScore = (GGraph)comp.GetChild("reduceScore");
+            m_SkillScore = (GTextField)comp.GetChild("SkillScore");
             m_t0 = comp.GetTransition("t0");
             m_t1 = comp.GetTransition("t1");
         }
@@ -78,6 +84,9 @@ namespace UI.Main
             m_ComSkillScore = null;
             m_txtName = null;
             m_holderTop = null;
+            m_addScore = null;
+            m_reduceScore = null;
+            m_SkillScore = null;
             m_t0 = null;
             m_t1 = null;
             if(disposeTarget && target != null)

+ 3 - 0
GameClient/Assets/Game/HotUpdate/FairyGUI/GenCode/Main/UI_StoryFightTargetScoreUI.cs

@@ -16,6 +16,7 @@ namespace UI.Main
         public UI_ProgressBarTargetScore m_proScore;
         public GComponent m_myHead;
         public GComponent m_targetHead;
+        public GGraph m_effReduceScore;
         public Transition m_t1;
         public Transition m_t2;
         public const string URL = "ui://mfvz4q8k8xpg3w";
@@ -74,6 +75,7 @@ namespace UI.Main
             m_proScore = (UI_ProgressBarTargetScore)UI_ProgressBarTargetScore.Create(comp.GetChild("proScore"));
             m_myHead = (GComponent)comp.GetChild("myHead");
             m_targetHead = (GComponent)comp.GetChild("targetHead");
+            m_effReduceScore = (GGraph)comp.GetChild("effReduceScore");
             m_t1 = comp.GetTransition("t1");
             m_t2 = comp.GetTransition("t2");
         }
@@ -92,6 +94,7 @@ namespace UI.Main
             m_proScore = null;
             m_myHead = null;
             m_targetHead = null;
+            m_effReduceScore = null;
             m_t1 = null;
             m_t2 = null;
             if(disposeTarget && target != null)

+ 2 - 2
GameClient/Assets/Game/HotUpdate/FairyGUI/GenCode/Studio/UI_StudioFilingRewardUI.cs

@@ -10,7 +10,7 @@ namespace UI.Studio
         public GLoader m_bg;
         public GTextField m_txtScore;
         public GList m_list;
-        public GComponent m_btnGet;
+        public GButton m_btnGet;
         public GButton m_btnBack;
         public GGraph m_LeftTopEffect;
         public GGraph m_RightDownEffect;
@@ -64,7 +64,7 @@ namespace UI.Studio
             m_bg = (GLoader)comp.GetChild("bg");
             m_txtScore = (GTextField)comp.GetChild("txtScore");
             m_list = (GList)comp.GetChild("list");
-            m_btnGet = (GComponent)comp.GetChild("btnGet");
+            m_btnGet = (GButton)comp.GetChild("btnGet");
             m_btnBack = (GButton)comp.GetChild("btnBack");
             m_LeftTopEffect = (GGraph)comp.GetChild("LeftTopEffect");
             m_RightDownEffect = (GGraph)comp.GetChild("RightDownEffect");

+ 76 - 0
GameClient/Assets/Game/HotUpdate/ShakeCamera/SC_shakeCamera.cs

@@ -0,0 +1,76 @@
+using UnityEngine;
+using System.Collections;
+public class SC_shakeCamera : MonoBehaviour
+{
+
+    private float shakeTime = 0.0f;
+    private float fps = 60.0f;
+    private float frameTime = 0.0f;
+    private float shakeDelta = 0.002f;
+    public Camera cam;
+    public static bool isshakeCamera = false;
+	public static float shakeINT = 2;
+    // Use this for initialization
+    void Start()
+    {
+        shakeTime = 0.1f;
+        fps = 60.0f;
+        frameTime = 0.01f;
+        shakeDelta = 0.002f;
+        //cam = GameObject.FindGameObjectWithTag ("MainCamera").GetComponent<Camera> ();
+        cam = gameObject.GetComponent<Camera>();
+
+    }
+
+    private void OnEnable()
+    {
+    }
+
+    private void OnDisable()
+    {
+        cam.rect = new Rect(0.0f, 0.0f, 1.0f, 1.0f);
+    }
+
+    // Update is called once per frame
+    void Update()
+    {
+        if (isshakeCamera)
+        {
+            if (shakeTime > 0)
+            {
+                shakeTime -= Time.deltaTime;
+                if (shakeTime <= 0)
+                {
+                    cam.rect = new Rect(0.0f, 0.0f, 1.0f, 1.0f);
+                    isshakeCamera = false;
+                    shakeTime = 0.1f;
+                    fps = 60.0f;
+                    frameTime = 0.01f;
+                    shakeDelta = 0.005f;
+                }
+                else
+                {
+                    frameTime += Time.deltaTime;
+
+                    if (frameTime > 1.0 / fps)
+                    {
+                        frameTime = 0;
+						cam.rect = new Rect(shakeDelta * (-1.0f + shakeINT * Random.value), shakeDelta * (-1.0f + shakeINT * Random.value), 1.0f, 1.0f);
+
+                    }
+                }
+            }
+        }
+        //else if (Input.GetMouseButtonDown(0))
+        //{
+        //    shakeCamera();
+        //}
+
+    }
+
+    public static void shakeCamera(float shakeInt)
+    {
+		shakeINT = shakeInt;
+		isshakeCamera = true;
+    }
+}

+ 11 - 0
GameClient/Assets/Game/HotUpdate/ShakeCamera/SC_shakeCamera.cs.meta

@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 0ad660336e744dc4991ea1e3e632bea2
+MonoImporter:
+  externalObjects: {}
+  serializedVersion: 2
+  defaultReferences: []
+  executionOrder: 0
+  icon: {instanceID: 0}
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

+ 53 - 0
GameClient/Assets/Game/HotUpdate/ShakeCamera/shakecameraControl.cs

@@ -0,0 +1,53 @@
+using UnityEngine;
+using System.Collections;
+
+public class shakecameraControl : MonoBehaviour {
+
+
+    private float time=0f;
+    public float StartTime = 0.7f;
+    private float Time0;
+    public float shaketime = 0.5f;
+	public float shakeInt;
+    public bool end = false;
+
+	// Use this for initialization
+	void Start () 
+    {
+
+        
+	
+	}
+
+    private void OnEnable()
+    {
+        Time0 = 0f;
+        time = 0f;
+        end = false;
+    }
+
+    private void OnDisable()
+    {
+        
+    }
+
+    // Update is called once per frame
+    void Update () 
+    {
+        if (!end)
+        {
+
+            time += Time.deltaTime;
+            if (time >= StartTime)
+            {
+                Time0+=Time.deltaTime;
+                SC_shakeCamera.shakeCamera(shakeInt);
+                if (Time0>=shaketime)
+                {
+                    end = true;
+                }
+            }
+        }
+	
+	}
+}

+ 11 - 0
GameClient/Assets/Game/HotUpdate/ShakeCamera/shakecameraControl.cs.meta

@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 2dc2d49ee76933f44b5da5e2407cf51b
+MonoImporter:
+  externalObjects: {}
+  serializedVersion: 2
+  defaultReferences: []
+  executionOrder: 0
+  icon: {instanceID: 0}
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

+ 33 - 7
GameClient/Assets/Game/HotUpdate/Views/MainStory/StoryFightSingleScoreView.cs

@@ -209,7 +209,11 @@ namespace GFGGame
             bool _showCard = ScoreSystemData.Instance.IsShowCard(InstanceZonesDataManager.currentCardId, vaildSkills);
             if (_showCard)
             {
-                ViewManager.Show<StorySkillView>(skillsToShowDic);
+                //第四个参数用于分数展示,和
+                ViewManager.Show<StorySkillView>(new object[] { skillsToShowDic ,null });
+                //这里可以写卡牌加分
+                _score += _skillScore;
+                Timers.inst.Add(2.0f, 1, UpdateProgressA);
             }
             else
             {
@@ -223,24 +227,24 @@ namespace GFGGame
             switch (_currentTime)
             {
                 case SkillBeginTime.FIGHT_BEGIN:
-                    _score += _skillScore;
+                    //_score += _skillScore;
                     CheckRoundBeginSkill(null);
                     break;
                 case SkillBeginTime.ERVERY_ROUND_BEGIN:
-                    _allSkillScore += _skillScore;
+                    //_allSkillScore += _skillScore;
                     //这里不把技能分加到总分里,因为技能分会算到部件分里
                     RoundStart();
                     break;
                 case SkillBeginTime.PERFECT_CLICK:
-                    _allSkillScore += _skillScore;
+                    //_allSkillScore += _skillScore;
                     PartScoreResultStart(ClickType.PERFECT_CLICK);
                     break;
                 case SkillBeginTime.ERVERY_ROUND_END:
-                    _score += _skillScore;
+                    //_score += _skillScore;
                     UpdateProgress();
                     break;
                 case SkillBeginTime.ALL_PERFECT_START:
-                    _score += _skillScore;
+                    //_score += _skillScore;
                     UpdateProgress();
                     break;
             }
@@ -320,7 +324,8 @@ namespace GFGGame
             // _ui.m_comClick.target.touchable = false;
 
             PartScoreResultEnd();
-            _partScore = ScoreSystemData.Instance.GetRoundScore(roleData, _partId, clickType, _allSkillScore);
+            //这里后面去掉第四个参数,因为不需要他参与计算了
+            _partScore = ScoreSystemData.Instance.GetRoundScore(roleData, _partId, clickType , _allSkillScore);
             _score += _partScore;
             _ui.m_comClick.m_comResult.target.GetChild("holder" + clickType).visible = true;
             _ui.m_comClick.m_comResult.m_c1.selectedIndex = clickType;
@@ -380,6 +385,26 @@ namespace GFGGame
                 });
         }
 
+        //重写关系得分进度条
+        private void UpdateProgressA(object param = null)
+        {
+            double proportion = _score / _ui.m_proScore.target.max;
+            float width = (float)(proportion * _ui.m_proScore.target.width);
+            width = width > _ui.m_proScore.m_comBar.target.initWidth ? _ui.m_proScore.m_comBar.target.initWidth : width;
+            GTween.To(_ui.m_proScore.m_comBar.target.width, width, 0.3f).SetTarget(_ui.m_proScore.m_comBar).OnUpdate((GTweener t) =>
+            {
+                _ui.m_proScore.m_comBar.target.width = t.value.x;
+            }).OnComplete(() =>
+            {
+                FightDataManager.Instance.totalScore = _score;
+                _ui.m_proScore.m_txtCount.text = string.Format("总分 {0}", _score);
+                GetCurStar(out int star);
+                _ui.m_proScore.m_comFirstScore.m_c1.selectedIndex = star > 0 ? 1 : 0;
+                _ui.m_proScore.m_comSecondScore.m_c1.selectedIndex = star > 1 ? 1 : 0;
+                _ui.m_proScore.m_comThirdScore.m_c1.selectedIndex = star > 2 ? 1 : 0;
+            });
+        }
+
         //回合结束
         private void PartScoreEnd()
         {
@@ -521,6 +546,7 @@ namespace GFGGame
             Timers.inst.Remove(TryShowCardSkill);
             Timers.inst.Remove(Skip);
             Timers.inst.Remove(CheckRoundBeginSkill);
+            Timers.inst.Remove(UpdateProgressA);
             GTween.Kill(_ui.m_proScore.m_comBar);
 
             _ui.m_proScore.target.value = 0;

+ 33 - 1
GameClient/Assets/Game/HotUpdate/Views/MainStory/StoryFightTargetScoreView.cs

@@ -33,6 +33,7 @@ namespace GFGGame
         private EffectUI _effectUI13;
         private EffectUI _effectUI14;
         private EffectUI _effectUI15;
+        private EffectUI _effectUI16;
 
         private NTexture _nTexture;
         private bool _isAutoPlay = false;
@@ -85,6 +86,8 @@ namespace GFGGame
             _effectUI14 = null;
             EffectUIPool.Recycle(_effectUI15);
             _effectUI15 = null;
+            EffectUIPool.Recycle(_effectUI16);
+            _effectUI16 = null;
             if (_ui != null)
             {
                 _ui.Dispose();
@@ -109,6 +112,7 @@ namespace GFGGame
             _effectUI13 = EffectUIPool.CreateEffectUI(_ui.m_comClick.m_comAllPerfect.m_holder, "ui_fight_new", "3S_textAppear01");
             _effectUI14 = EffectUIPool.CreateEffectUI(_ui.m_comClick.m_comAllPerfect.m_holderSmokeIn, "ui_fight_new", "smoke_Approach");
             _effectUI15 = EffectUIPool.CreateEffectUI(_ui.m_comClick.m_comAllPerfect.m_holderSmokeOut, "ui_fight_new", "smoke_out");
+            _effectUI16 = EffectUIPool.CreateEffectUI(_ui.m_effReduceScore, "ui_fight_new", "CFKP_Down_end");
         }
 
         protected override void OnInit()
@@ -267,9 +271,16 @@ namespace GFGGame
         }
         private void ShowSkillCard(Dictionary<int, int> skillScoreDic, bool showCard)
         {
+            List<int> roundTimes = ScoreSystemData.Instance.GetRoundTime(roleData.cardId, roleData.skillLvs);
+            List<PassivitySkillLvlCfg> vaildSkills = ScoreSystemData.Instance.GetValidSkills(_currentTime, _partId, roleData.cardId, roleData.skillLvs, 0, null, roundTimes, new List<int>());
             if (showCard)
             {
-                ViewManager.Show<StorySkillView>(skillScoreDic);
+                ViewManager.Show<StorySkillView>(new object[] { skillScoreDic, _ui.m_effReduceScore});
+                _score += _skillScore;
+                _targetScore += _targetSkillScore;
+                _skillScore = 0;
+                _targetSkillScore = 0;
+                Timers.inst.Add(2.0f, 1, UpdateProgressA);
             }
             else
             {
@@ -542,6 +553,25 @@ namespace GFGGame
                     if (onFinish != null) onFinish();
                 });
         }
+
+
+        //重写关系得分进度条
+        private void UpdateProgressA(object param = null)
+        {
+            _ui.m_proScore.m_txtMineScore.text = " " + _score;
+            _ui.m_proScore.m_txtNpcScore.text = " " + _targetScore;
+
+            double proportion = _score + _targetScore == 0 ? 0.5 : _score / (_score + _targetScore);
+            float width = (float)(proportion * _ui.m_proScore.target.width);
+            width = width > _ui.m_proScore.m_comBar.target.initWidth ? _ui.m_proScore.m_comBar.target.initWidth : width;
+            GTween.To(_ui.m_proScore.m_comBar.target.width, width, 0.3f).SetTarget(_ui.m_proScore.m_comBar).OnUpdate((GTweener t) =>
+            {
+                _ui.m_proScore.m_comBar.target.width = t.value.x;
+            }).OnComplete(() =>
+            {
+               
+            });
+        }
         private void OnePartScoreEnd()
         {
             _partId++;
@@ -652,6 +682,8 @@ namespace GFGGame
             }
 
             Timers.inst.Remove(CheckGuide);
+
+            Timers.inst.Remove(UpdateProgressA);
         }
 
         private async void Skip(object param = null)

+ 100 - 3
GameClient/Assets/Game/HotUpdate/Views/MainStory/StorySkillView.cs

@@ -13,6 +13,13 @@ namespace GFGGame
         private Dictionary<int, int> skillScoreDic;
         private EffectUI _effectUI1;
         private EffectUI _effectUI2;
+        private EffectUI _effectUI3;
+        private EffectUI _effectUI4;
+        private GGraph _m_effReduceScore;
+
+        private bool isFirst;
+        private GameObject mainCamera;
+        private GameObject stageCamera;
 
         public override void Dispose()
         {
@@ -20,6 +27,10 @@ namespace GFGGame
             _effectUI1 = null;
             EffectUIPool.Recycle(_effectUI2);
             _effectUI2 = null;
+            EffectUIPool.Recycle(_effectUI3);
+            _effectUI3 = null;
+            EffectUIPool.Recycle(_effectUI4);
+            _effectUI4 = null;
             if (_ui != null)
             {
                 _ui.Dispose();
@@ -34,22 +45,28 @@ namespace GFGGame
             viewCom = _ui.target;
             isfullScreen = true;
             // this.modal = false;
-            _effectUI1 = EffectUIPool.CreateEffectUI(_ui.m_comSkillShow.m_holderBottom, "ui_fight_new", "CFKP_TX_down");
-            _effectUI2 = EffectUIPool.CreateEffectUI(_ui.m_comSkillShow.m_holderTop, "ui_fight_new", "CFKP_TX_up");
+            //_effectUI1 = EffectUIPool.CreateEffectUI(_ui.m_comSkillShow.m_holderBottom, "ui_fight_new", "CFKP_TX_down");
+            //_effectUI2 = EffectUIPool.CreateEffectUI(_ui.m_comSkillShow.m_holderTop, "ui_fight_new", "CFKP_TX_up");
+            _effectUI3 = EffectUIPool.CreateEffectUI(_ui.m_comSkillShow.m_addScore, "ui_fight_new", "CFKP_UP");
+            _effectUI4 = EffectUIPool.CreateEffectUI(_ui.m_comSkillShow.m_reduceScore, "ui_fight_new", "CFKP_Down");
 
             _ui.m_comSkillShow.m_t0.ignoreEngineTimeScale = false;
             _ui.m_comSkillShow.m_t1.ignoreEngineTimeScale = false;
             _ui.m_t1.ignoreEngineTimeScale = false;
 
+            isFirst = true;
+
         }
         protected override void OnShown()
         {
             base.OnShown();
-            skillScoreDic = this.viewData as Dictionary<int, int>;
+            skillScoreDic = (this.viewData as object[])[0] as Dictionary<int, int>;
+            _m_effReduceScore = (this.viewData as object[])[1] as GGraph;
             UpdateView();
         }
         private void UpdateView()
         {
+
             if (skillScoreDic.Count > 0)
             {
                 int skillId = 0;
@@ -63,6 +80,9 @@ namespace GFGGame
                 _ui.m_comSkillShow.m_ComSkillScore.m_txtCount.SetVar("value", skillScoreDic[skillId].ToString()).FlushVars();
                 _ui.m_comSkillShow.m_ComSkillScore.m_txtCount1.SetVar("value", Math.Abs(skillScoreDic[skillId]).ToString()).FlushVars();
                 _ui.m_comSkillShow.m_ComSkillScore.m_c1.selectedIndex = skillScoreDic[skillId] >= 0 ? 0 : 1;
+
+                _ui.m_comSkillShow.m_SkillScore.SetVar("value", skillScoreDic[skillId].ToString()).FlushVars();
+
                 string res = skillCfg.res;
 
                 res = ItemCfgArray.Instance.GetCfg(skillCfg.cardId).res;
@@ -90,6 +110,9 @@ namespace GFGGame
                         });
                     }
                 });
+
+                //战斗卡牌特效处理
+                Timers.inst.Add(0.5f, 1, SetEffVisible);
             }
             else
             {
@@ -99,11 +122,85 @@ namespace GFGGame
         protected override void OnHide()
         {
             base.OnHide();
+                _ui.m_comSkillShow.m_addScore.visible = false;
+                _ui.m_comSkillShow.m_reduceScore.visible = false;
+                if (_m_effReduceScore != null)
+                {
+                    _m_effReduceScore.visible = false;
+                }
+            SetCamera(false);
+            Timers.inst.Remove(SetEffReduceScore);
+            Timers.inst.Remove(SetEffVisible);
             _ui.m_comSkillShow.m_t0.Stop(true, false);
             _ui.m_comSkillShow.m_t1.Stop(true, false);
             _ui.m_t1.Stop(true, false);
             _ui.m_t2.Play();
             EventAgent.DispatchEvent(ConstMessage.SHOW_CARD_SKILL_END);
         }
+
+        private void SetEffReduceScore(object param)
+        {
+            _m_effReduceScore.visible = true;
+        }
+        
+        private void SetEffVisible(object param)
+        {
+            if (skillScoreDic.Count == 0)
+            {
+                return;
+            }
+            int skillId = 0;
+            foreach (int key in skillScoreDic.Keys)
+            {
+                skillId = key;
+                break;
+            }
+            //战斗卡牌特效处理
+            if (skillScoreDic[skillId] > 0)
+            {
+                _ui.m_comSkillShow.m_reduceScore.visible = false;
+                _ui.m_comSkillShow.m_addScore.visible = true;  
+                SetCamera(true);
+            }
+            else if (skillScoreDic[skillId] < 0)
+            {
+                _ui.m_comSkillShow.m_addScore.visible = false;
+                _ui.m_comSkillShow.m_reduceScore.visible = true;
+                Timers.inst.Add(1.3f, 1, SetEffReduceScore);
+            }
+        }
+
+        private void SetCamera(bool isshake)
+        {
+            if (isFirst)
+            {
+                mainCamera = Camera.main.gameObject;
+                mainCamera.AddComponent<SC_shakeCamera>();
+                mainCamera.AddComponent<shakecameraControl>();
+                stageCamera = GameObject.Find("Stage Camera").gameObject;
+                stageCamera.AddComponent<SC_shakeCamera>();
+                stageCamera.AddComponent<shakecameraControl>();
+                mainCamera.GetComponent<SC_shakeCamera>().enabled = false;
+                mainCamera.GetComponent<shakecameraControl>().enabled = false;
+                stageCamera.GetComponent<SC_shakeCamera>().enabled = false;
+                stageCamera.GetComponent<shakecameraControl>().enabled = false;
+                isFirst = false;
+            }
+            if (isshake)
+            {
+                mainCamera.GetComponent<SC_shakeCamera>().enabled = true;
+                mainCamera.GetComponent<shakecameraControl>().enabled = true;
+                stageCamera.GetComponent<SC_shakeCamera>().enabled = true;
+                stageCamera.GetComponent<shakecameraControl>().enabled = true;
+            }
+            else
+            {
+                mainCamera.GetComponent<SC_shakeCamera>().enabled = false;
+                mainCamera.GetComponent<shakecameraControl>().enabled = false;
+                stageCamera.GetComponent<SC_shakeCamera>().enabled = false;
+                stageCamera.GetComponent<shakecameraControl>().enabled = false;
+            }
+
+        }
     }
 }

BIN
GameClient/Assets/ResIn/UI/Main/Main_fui.bytes