|
@@ -3,6 +3,8 @@ using UnityEngine;
|
|
|
using UI.Main;
|
|
|
using System.Collections;
|
|
|
using System;
|
|
|
+using System.Collections.Generic;
|
|
|
+
|
|
|
namespace GFGGame
|
|
|
{
|
|
|
public class StoryFightTargetScoreView : BaseView
|
|
@@ -10,13 +12,24 @@ namespace GFGGame
|
|
|
private UI_StoryFightTargetScoreUI _ui;
|
|
|
private GameObject _sceneObject;
|
|
|
private GameObject _scenePrefab;
|
|
|
- private int _index;
|
|
|
- private int _score;
|
|
|
- private int _targetScore;
|
|
|
+
|
|
|
+
|
|
|
+ private double _targetScore;
|
|
|
+ private double _score;//当前总分数
|
|
|
+ private int _index;//当前评分part
|
|
|
+ private double _skillScore = 0;//当前卡牌技能分
|
|
|
+ private bool _showCard = false;//当前是否显示卡牌技能
|
|
|
+ private double _mainScore;//总主属性分
|
|
|
+ private double _targetMainScore;//战斗目标总主属性分
|
|
|
+ private int _prefectCount = 0;//卓越点击数量
|
|
|
+ private const int _range = 30;//圆圈随机范围
|
|
|
+ private float _time = 0;// 登峰造极按住的时间
|
|
|
+
|
|
|
+ private Dictionary<int, RoleSkillCfg> _npcSkillDic;
|
|
|
|
|
|
public override void Dispose()
|
|
|
{
|
|
|
- if(_scenePrefab != null)
|
|
|
+ if (_scenePrefab != null)
|
|
|
{
|
|
|
GameObject.Destroy(_scenePrefab);
|
|
|
_scenePrefab = null;
|
|
@@ -32,12 +45,22 @@ namespace GFGGame
|
|
|
isfullScreen = true;
|
|
|
|
|
|
_scenePrefab = GFGAsset.Load<GameObject>(ResPathUtil.GetPrefabPath("SceneFightTargetScore"));
|
|
|
+
|
|
|
+ RoleSkillCfg[] roleSkillCfgs = RoleSkillCfgArray.Instance.dataArray;
|
|
|
+ for (int i = 0; i < roleSkillCfgs.Length; i++)
|
|
|
+ {
|
|
|
+ GComponent btnSkill = _ui.target.GetChild("btnSkill" + i).asCom;
|
|
|
+ btnSkill.data = roleSkillCfgs[i];
|
|
|
+ GLoader icon = btnSkill.GetChild("icon").asLoader;
|
|
|
+ icon.onClick.Add(() => { OnBtnSkillClick(btnSkill); });
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
protected override void OnInit()
|
|
|
{
|
|
|
base.OnInit();
|
|
|
- _ui.m_btnSkip.onClick.Add(() => {
|
|
|
+ _ui.m_btnSkip.onClick.Add(() =>
|
|
|
+ {
|
|
|
Skip();
|
|
|
});
|
|
|
}
|
|
@@ -45,7 +68,7 @@ namespace GFGGame
|
|
|
protected override void OnShown()
|
|
|
{
|
|
|
base.OnShown();
|
|
|
- if(_sceneObject == null)
|
|
|
+ if (_sceneObject == null)
|
|
|
{
|
|
|
_sceneObject = GameObject.Instantiate(_scenePrefab);
|
|
|
}
|
|
@@ -55,56 +78,260 @@ namespace GFGGame
|
|
|
SceneController.UpdateFightTarget(fightCfg.targetRes, _sceneObject);
|
|
|
_ui.m_selfName.m_txtName.text = RoleDataManager.roleName;
|
|
|
_ui.m_targetName.m_txtName.text = fightCfg.targetName;
|
|
|
+
|
|
|
+ UpdateNormal();
|
|
|
+
|
|
|
+ ScoreSystemData.Instance.SetEquipDicWithType();
|
|
|
+ _npcSkillDic = SkillDataManager.Instance.GetNpcSkill();
|
|
|
_index = 0;
|
|
|
- _targetScore = fightCfg.score1;
|
|
|
- RoleLevelCfg roleLevelCfg = RoleLevelCfgArray.Instance.GetCfg(RoleDataManager.lvl);
|
|
|
- _score = roleLevelCfg.baseScore;
|
|
|
- int targetScore = (int)Math.Floor((double)_targetScore/(EquipDataCache.cacher.equipDatas.Length + 1));
|
|
|
- _ui.m_selfScore.m_txtScore.text = "" + _score;
|
|
|
- _ui.m_targetScore.m_txtScore.text = "" + targetScore;
|
|
|
- Timers.inst.Add(0.1f, 0, UpdateScore);
|
|
|
+ _score = 0;
|
|
|
+ _targetScore = 0;
|
|
|
+ _mainScore = ScoreSystemData.Instance.GetMainScore();
|
|
|
+ _targetMainScore = fightCfg.targetMainScore;
|
|
|
+
|
|
|
+ Timers.inst.Add(0.5f, 1, (param) =>
|
|
|
+ {
|
|
|
+ CircleScoreStart(null);
|
|
|
+ });//评分结束
|
|
|
+ }
|
|
|
+ private void UpdateNormal()
|
|
|
+ {
|
|
|
+ _ui.m_btnSkill0.m_proCD.visible = false;
|
|
|
+ _ui.m_btnSkill1.m_proCD.visible = false;
|
|
|
+ _ui.m_btnSkill2.m_proCD.visible = false;
|
|
|
+ _ui.m_btnSkill3.m_proCD.visible = false;
|
|
|
+ _ui.m_ComMinusNpc.target.visible = false;
|
|
|
+ _ui.m_ComMinusMine.target.visible = false;
|
|
|
+ _ui.m_ComShieldNpc.target.visible = false;
|
|
|
+ _ui.m_ComShieldMine.target.visible = false;
|
|
|
+ _ui.m_proScore.target.max = 100;
|
|
|
+ _ui.m_proScore.target.value = 50;
|
|
|
}
|
|
|
|
|
|
- protected override void OnHide()
|
|
|
+ private void CircleScoreStart(object param)
|
|
|
{
|
|
|
- base.OnHide();
|
|
|
- if(_sceneObject != null)
|
|
|
+ _skillScore = 0;//技能附加分
|
|
|
+ _showCard = false;
|
|
|
+
|
|
|
+ int partId = FightScoreCfgArray.Instance.dataArray[_index].id;
|
|
|
+ ScoreSystemData.Instance.GetPartItemCardScore(_mainScore, partId, out _skillScore, out _showCard);
|
|
|
+
|
|
|
+ if (_showCard)
|
|
|
{
|
|
|
- GameObject.Destroy(_sceneObject);
|
|
|
- _sceneObject = null;
|
|
|
+ ViewManager.Show<StorySkillView>(_skillScore);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ UpdateCircleResult();
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- private void UpdateScore(object param)
|
|
|
+
|
|
|
+ private void UpdateCircleResult()
|
|
|
{
|
|
|
- int[] equipDatas = EquipDataCache.cacher.equipDatas;
|
|
|
- int len = equipDatas.Length;
|
|
|
- if(_index < len)
|
|
|
+ int partId = FightScoreCfgArray.Instance.dataArray[_index].id;
|
|
|
+ double partScore = ScoreSystemData.Instance.GetPartItemScore(partId);
|
|
|
+ _ui.m_comMineCircle.m_txtCount0.text = ((int)partScore).ToString();
|
|
|
+ _score += (partScore + _skillScore);
|
|
|
+ EquipDataCache.cacher.totalScore = (int)Math.Round(_score);
|
|
|
+
|
|
|
+
|
|
|
+ StoryLevelCfg levelCfg = StoryLevelCfgArray.Instance.GetCfg(StoryDataManager.currentLevelID);
|
|
|
+ StoryFightCfg fightCfg = StoryFightCfgArray.Instance.GetCfg(levelCfg.fightID);
|
|
|
+ double targetScore = fightCfg.targetPartsScoreArr[_index] * ConstScoreSystem.PART_SCORE;
|
|
|
+ _ui.m_comTargetCircle.m_txtCount0.text = targetScore.ToString();
|
|
|
+ _targetScore += targetScore;
|
|
|
+ EquipDataCache.cacher.npcTotalScore = (int)Math.Round(_targetScore);
|
|
|
+
|
|
|
+ UpdateProgressBar();
|
|
|
+ SetCirclePos();
|
|
|
+ ReleaseNpcSkill();
|
|
|
+ }
|
|
|
+ private void UpdateProgressBar()
|
|
|
+ {
|
|
|
+ _ui.m_proScore.m_txtMineScore.text = ((int)_score).ToString();
|
|
|
+ _ui.m_proScore.m_txtNpcScore.text = ((int)_targetScore).ToString();
|
|
|
+ double value = _score / (_score + _targetScore) * _ui.m_proScore.target.max;
|
|
|
+ _ui.m_proScore.target.TweenValue(value, 0.5f);
|
|
|
+ }
|
|
|
+ private void SetCirclePos()
|
|
|
+ {
|
|
|
+ Vector2 pos = (_ui.target.GetChild("grh_" + _index).asGraph).xy;
|
|
|
+ float x = 0f;
|
|
|
+ float y = 0f;
|
|
|
+ EquipDataCache.cacher.GetCirclePos(pos, _range, out x, out y);
|
|
|
+ _ui.m_comMineCircle.target.SetXY(x, y);
|
|
|
+ _ui.m_comMineCircle.target.visible = true;
|
|
|
+ _ui.m_comMineCircle.m_t0.Play(CircleScoreEnd);
|
|
|
+
|
|
|
+ _ui.m_comTargetCircle.target.SetXY(_ui.target.width - x, y);
|
|
|
+ _ui.m_comTargetCircle.target.visible = true;
|
|
|
+ _ui.m_comTargetCircle.m_t0.Play();
|
|
|
+ }
|
|
|
+ private void CircleScoreEnd()
|
|
|
+ {
|
|
|
+ _index++;
|
|
|
+ if (_index >= FightScoreCfgArray.Instance.dataArray.Length)
|
|
|
{
|
|
|
- int itemID = equipDatas[_index];
|
|
|
- _score += DressUpMenuItemDataManager.GetItemScore(itemID);
|
|
|
- _ui.m_selfScore.m_txtScore.text = "" + _score;
|
|
|
- _index++;
|
|
|
- int targetScore = (int)Math.Floor((double)_targetScore*(_index + 1)/(len + 1));
|
|
|
- _ui.m_targetScore.m_txtScore.text = "" + targetScore;
|
|
|
+ Timers.inst.Add(0.5f, 1, Skip);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- _ui.m_selfScore.m_txtScore.text = "" + EquipDataCache.cacher.score;
|
|
|
- _ui.m_targetScore.m_txtScore.text = "" + _targetScore;
|
|
|
- Timers.inst.Remove(UpdateScore);
|
|
|
- Timers.inst.Add(0.5f, 1, Skip);
|
|
|
+ Timers.inst.Add(0.5f, 1, (param) =>
|
|
|
+ {
|
|
|
+ CircleScoreStart(null);
|
|
|
+ });//评分结束
|
|
|
+ }
|
|
|
+ }
|
|
|
+ private void ReleaseNpcSkill()
|
|
|
+ {
|
|
|
+ if (_npcSkillDic.ContainsKey(_index))
|
|
|
+ {
|
|
|
+ SetSkillValue(_npcSkillDic[_index], SkillDataManager.NPC);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /***************************************************主动技能**************************************************/
|
|
|
+
|
|
|
+ private void OnBtnSkillClick(GComponent obj)
|
|
|
+ {
|
|
|
+ UI_ComBtnSkill item = UI_ComBtnSkill.Proxy(obj);
|
|
|
+ RoleSkillCfg cfg = item.target.data as RoleSkillCfg;
|
|
|
+
|
|
|
+ SetCdState(item.m_proCD, cfg.cd);
|
|
|
+ SetSkillValue(cfg, SkillDataManager.MINE);
|
|
|
+ }
|
|
|
+ private void SetCdState(GProgressBar bar, float time)
|
|
|
+ {
|
|
|
+ bar.visible = true;
|
|
|
+ bar.value = 100;
|
|
|
+ bar.TweenValue(0, time).OnComplete(() => { bar.visible = false; });
|
|
|
+ }
|
|
|
+
|
|
|
+ private void SetSkillValue(RoleSkillCfg cfg, int role)
|
|
|
+ {
|
|
|
+ if (cfg.buff == SkillDataManager.SKILL_ADD)
|
|
|
+ {
|
|
|
+ UpdateAddUI(cfg, role);
|
|
|
+ }
|
|
|
+ else if (cfg.buff == SkillDataManager.SKILL_MINUS)
|
|
|
+ {
|
|
|
+ UpdateMinusUI(cfg, role);
|
|
|
+ }
|
|
|
+ else if (cfg.buff == SkillDataManager.SKILL_BREAK)
|
|
|
+ {
|
|
|
+ UpdateBreakUI(cfg, role);
|
|
|
+ }
|
|
|
+ else if (cfg.buff == SkillDataManager.SKILL_SHIELD)
|
|
|
+ {
|
|
|
+ UpdateShieldUI(cfg, role);
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ private void UpdateAddUI(RoleSkillCfg cfg, int role)
|
|
|
+ {
|
|
|
+ UI_ComRoleSkillScore comRoleSkillScore = role == SkillDataManager.MINE ? _ui.m_ComRoleSkillMineAdd : _ui.m_ComRoleSkillNpcAdd;
|
|
|
+ comRoleSkillScore.m_c1.selectedIndex = 0;
|
|
|
+ int score = 0;
|
|
|
+ if (role == SkillDataManager.MINE)
|
|
|
+ {
|
|
|
+ score = (int)_mainScore * cfg.value / 100;
|
|
|
+ _score += score;
|
|
|
}
|
|
|
+ else
|
|
|
+ {
|
|
|
+ score = (int)_targetMainScore * cfg.value / 100;
|
|
|
+ _targetScore += score;
|
|
|
+ }
|
|
|
+ comRoleSkillScore.m_txtScore.SetVar("count", score.ToString()).FlushVars();
|
|
|
+ comRoleSkillScore.m_t0.Play();
|
|
|
+
|
|
|
+ UpdateProgressBar();
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ //荆钗效果
|
|
|
+ private void UpdateMinusUI(RoleSkillCfg cfg, int role)
|
|
|
+ {
|
|
|
+ UI_ComSkillMinus comSkillMinus = role == SkillDataManager.MINE ? _ui.m_ComMinusMine : _ui.m_ComMinusNpc;
|
|
|
+ UI_ComSkillShield targetComSkillShield = role == SkillDataManager.MINE ? _ui.m_ComShieldNpc : _ui.m_ComShieldMine;
|
|
|
+
|
|
|
+ comSkillMinus.target.visible = true;
|
|
|
+ comSkillMinus.m_proMinus.target.value = 0;
|
|
|
+ comSkillMinus.m_proMinus.target.TweenValue(100, 2f).OnComplete(() =>
|
|
|
+ {
|
|
|
+ comSkillMinus.target.visible = false;
|
|
|
+ if (targetComSkillShield.target.visible)
|
|
|
+ {
|
|
|
+ targetComSkillShield.target.visible = false;
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ UI_ComRoleSkillScore comRoleSkillScore = role == SkillDataManager.MINE ? _ui.m_ComRoleSkillNpcMinus : _ui.m_ComRoleSkillMineMinus;
|
|
|
+
|
|
|
+ int score = 0;
|
|
|
+ if (role == SkillDataManager.MINE)
|
|
|
+ {
|
|
|
+ score = (int)_targetMainScore * cfg.value / 100;
|
|
|
+ _targetScore -= score;
|
|
|
+
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ score = (int)_mainScore * cfg.value / 100;
|
|
|
+ _score -= score;
|
|
|
+ }
|
|
|
+
|
|
|
+ comRoleSkillScore.m_c1.selectedIndex = 1;
|
|
|
+ comRoleSkillScore.m_txtScore.SetVar("count", score.ToString()).FlushVars();
|
|
|
+ comRoleSkillScore.m_t0.Play();
|
|
|
+
|
|
|
+ UpdateProgressBar();
|
|
|
+
|
|
|
+ });
|
|
|
+ }
|
|
|
+ private void UpdateBreakUI(RoleSkillCfg cfg, int role)
|
|
|
+ {
|
|
|
+
|
|
|
+ UI_ComSkillMinus targetSkillMinus = role == SkillDataManager.MINE ? _ui.m_ComMinusNpc : _ui.m_ComMinusMine;
|
|
|
+ targetSkillMinus.target.visible = false;
|
|
|
+
|
|
|
+ GTweener twener = GTween.GetTween(targetSkillMinus.m_proMinus, TweenPropType.Progress);
|
|
|
+ if (twener != null)
|
|
|
+ {
|
|
|
+ twener.Kill(true);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //锦衣效果
|
|
|
+ private void UpdateShieldUI(RoleSkillCfg cfg, int role)
|
|
|
+ {
|
|
|
+ UI_ComSkillShield comSkillShield = role == SkillDataManager.MINE ? _ui.m_ComShieldMine : _ui.m_ComShieldNpc;
|
|
|
+ comSkillShield.target.visible = true;
|
|
|
+
|
|
|
+ Timers.inst.Add(cfg.duration, 1, (param) => { comSkillShield.target.visible = false; });
|
|
|
+ }
|
|
|
+
|
|
|
+ protected override void OnHide()
|
|
|
+ {
|
|
|
+ base.OnHide();
|
|
|
+ if (_sceneObject != null)
|
|
|
+ {
|
|
|
+ GameObject.Destroy(_sceneObject);
|
|
|
+ _sceneObject = null;
|
|
|
+ }
|
|
|
+ _npcSkillDic.Clear();
|
|
|
}
|
|
|
|
|
|
private void Skip(object param = null)
|
|
|
{
|
|
|
- Timers.inst.Remove(UpdateScore);
|
|
|
+ Timers.inst.Remove((param) =>
|
|
|
+ {
|
|
|
+ CircleScoreStart(null);
|
|
|
+ });
|
|
|
+
|
|
|
Timers.inst.Remove(Skip);
|
|
|
this.Hide();
|
|
|
ViewManager.Show(ViewName.STORY_FIGHT_RESULT_VIEW);
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
}
|
|
|
}
|