|
@@ -3,6 +3,7 @@ using UnityEngine;
|
|
using UI.Main;
|
|
using UI.Main;
|
|
using System.Collections;
|
|
using System.Collections;
|
|
using System;
|
|
using System;
|
|
|
|
+using System.Collections.Generic;
|
|
|
|
|
|
namespace GFGGame
|
|
namespace GFGGame
|
|
{
|
|
{
|
|
@@ -11,14 +12,14 @@ namespace GFGGame
|
|
private UI_StoryFightSingleScoreUI _ui;
|
|
private UI_StoryFightSingleScoreUI _ui;
|
|
private GameObject _sceneObject;
|
|
private GameObject _sceneObject;
|
|
private GameObject _scenePrefab;
|
|
private GameObject _scenePrefab;
|
|
- private int _index;//当前评分part
|
|
|
|
|
|
+ private int _partId;//当前评分part
|
|
private int _score;//当前总分数
|
|
private int _score;//当前总分数
|
|
- private double _skillScore = 0;//当前卡牌技能分
|
|
|
|
|
|
+ private int _skillScore = 0;//当前卡牌技能分
|
|
private int _partScore = 0;//当前部件分+技能评分(_skillScore)
|
|
private int _partScore = 0;//当前部件分+技能评分(_skillScore)
|
|
- private bool _showCard = false;//当前是否显示卡牌技能
|
|
|
|
|
|
+ private int _currentTime = BeginTime.PART_ALL_FIGHT_BEGIN;
|
|
private double _mainScore;//总主属性分
|
|
private double _mainScore;//总主属性分
|
|
private const int _range = 100;//圆圈随机范围
|
|
private const int _range = 100;//圆圈随机范围
|
|
- private const float _prefectScale = 60f;//完美缩放比
|
|
|
|
|
|
+ private const float _prefectScale = 0.866f;//完美缩放比
|
|
private NTexture _nTexture;
|
|
private NTexture _nTexture;
|
|
private bool _stopFight = false;
|
|
private bool _stopFight = false;
|
|
|
|
|
|
@@ -67,7 +68,8 @@ namespace GFGGame
|
|
_ui.m_btnBack.onClick.Add(OnBtnBackClick);
|
|
_ui.m_btnBack.onClick.Add(OnBtnBackClick);
|
|
_ui.m_btnSpeedUp.onClick.Add(OnBtnSpeedUp);
|
|
_ui.m_btnSpeedUp.onClick.Add(OnBtnSpeedUp);
|
|
|
|
|
|
- _ui.m_comClickCircle.target.onClick.Add(OnComClickCircle);
|
|
|
|
|
|
+ // _ui.m_comClickCircle.target.onClick.Add(OnComClickCircle);
|
|
|
|
+ _ui.m_comClick.target.onClick.Add(CheckPerfectSkill);
|
|
|
|
|
|
_ui.m_loaBg.url = ResPathUtil.GetFightBgImgPath("fightBg");
|
|
_ui.m_loaBg.url = ResPathUtil.GetFightBgImgPath("fightBg");
|
|
_ui.m_LoaMask.url = ResPathUtil.GetFightBgImgPath("fightBg");
|
|
_ui.m_LoaMask.url = ResPathUtil.GetFightBgImgPath("fightBg");
|
|
@@ -90,17 +92,16 @@ namespace GFGGame
|
|
protected override void AddEventListener()
|
|
protected override void AddEventListener()
|
|
{
|
|
{
|
|
base.AddEventListener();
|
|
base.AddEventListener();
|
|
- EventAgent.AddEventListener(ConstMessage.CARD_SKILL, PartScoreStart);
|
|
|
|
|
|
+ EventAgent.AddEventListener(ConstMessage.SHOW_CARD_SKILL_END, SkillScoreEnd);
|
|
}
|
|
}
|
|
protected override void OnShown()
|
|
protected override void OnShown()
|
|
{
|
|
{
|
|
base.OnShown();
|
|
base.OnShown();
|
|
ScoreSystemData.Instance.SetEquipDicWithType();
|
|
ScoreSystemData.Instance.SetEquipDicWithType();
|
|
|
|
|
|
- _ui.m_comClickCircle.target.touchable = false;
|
|
|
|
|
|
+ // _ui.m_comClickCircle.target.touchable = false;
|
|
_nTexture = new NTexture(FightDataManager.Instance.RoleTextuex);
|
|
_nTexture = new NTexture(FightDataManager.Instance.RoleTextuex);
|
|
|
|
|
|
- // _ui.m_loaRole.texture = _nTexture;//EquipDataCache.cacher.FightRoleRes;
|
|
|
|
ET.Log.Debug("Screen:" + UnityEngine.Screen.width + " " + UnityEngine.Screen.height + " _nTexture:" + _nTexture.width + " " + _nTexture.height);
|
|
ET.Log.Debug("Screen:" + UnityEngine.Screen.width + " " + UnityEngine.Screen.height + " _nTexture:" + _nTexture.width + " " + _nTexture.height);
|
|
_ui.m_imgRole.SetSize(GRoot.inst.width, GRoot.inst.height);
|
|
_ui.m_imgRole.SetSize(GRoot.inst.width, GRoot.inst.height);
|
|
_ui.m_imgRole.texture = _nTexture;
|
|
_ui.m_imgRole.texture = _nTexture;
|
|
@@ -119,70 +120,151 @@ namespace GFGGame
|
|
_gameObject1.SetActive(false);
|
|
_gameObject1.SetActive(false);
|
|
_gameObject2.SetActive(false);
|
|
_gameObject2.SetActive(false);
|
|
_ui.m_proScore.m_txtCount.text = "总分 0";
|
|
_ui.m_proScore.m_txtCount.text = "总分 0";
|
|
|
|
+ _ui.m_comClick.target.touchable = false;
|
|
|
|
|
|
- _stopFight = false;
|
|
|
|
- _index = 0;
|
|
|
|
|
|
+ _currentTime = BeginTime.PART_ALL_FIGHT_BEGIN;
|
|
|
|
+ // _stopFight = false;
|
|
|
|
+ _partId = FightScoreCfgArray.Instance.dataArray[0].id;
|
|
_score = 0;
|
|
_score = 0;
|
|
|
|
+ _skillScore = 0;//技能附加分
|
|
_mainScore = ScoreSystemData.Instance.GetMainScore();
|
|
_mainScore = ScoreSystemData.Instance.GetMainScore();
|
|
|
|
|
|
- // if (_index == 0 && GuideDataManager.IsGuideFinish(ConstGuideId.SINGLE_FIGHT) <= 0)//引导中禁止自动战斗
|
|
|
|
- // {
|
|
|
|
- // EquipDataCache.cacher.fightSpeed = 1;
|
|
|
|
- // EquipDataCache.cacher.autoPlay = false;
|
|
|
|
- // }
|
|
|
|
- Timers.inst.Add(0.5f, 1, (param) =>
|
|
|
|
- {
|
|
|
|
- SkillScore(null);
|
|
|
|
- });//评分结束
|
|
|
|
- // Timers.inst.AddUpdate(CheckGuide);
|
|
|
|
|
|
+ Timers.inst.Add(0.5f, 1, SkillScoreStart);//评分结束
|
|
}
|
|
}
|
|
|
|
|
|
- private void SkillScore(object param)
|
|
|
|
|
|
+ private void SkillScoreStart(object param)
|
|
{
|
|
{
|
|
- if (_stopFight) return;
|
|
|
|
- Debug.Log("_index:" + _index + " length:" + FightScoreCfgArray.Instance.dataArray.Length);
|
|
|
|
- int partId = FightScoreCfgArray.Instance.dataArray[_index].id;
|
|
|
|
|
|
|
|
- _skillScore = 0;//技能附加分
|
|
|
|
- _showCard = false;
|
|
|
|
- ScoreSystemData.Instance.GetPartItemCardScore(_mainScore, partId, out _skillScore, out _showCard);
|
|
|
|
|
|
+ List<PassivitySkillLvlCfg> vaildSkills = ScoreSystemData.Instance.GetValidSkills(_currentTime, InstanceZonesDataManager.currentCardId, 0, _partId);
|
|
|
|
+ _skillScore = ScoreSystemData.Instance.GetPartItemSkillScore(vaildSkills, _mainScore);
|
|
|
|
+ bool _showCard = ScoreSystemData.Instance.IsShowCard(InstanceZonesDataManager.currentCardId, vaildSkills);
|
|
if (_showCard)
|
|
if (_showCard)
|
|
{
|
|
{
|
|
ViewManager.Show<StorySkillView>(_skillScore);
|
|
ViewManager.Show<StorySkillView>(_skillScore);
|
|
}
|
|
}
|
|
else
|
|
else
|
|
{
|
|
{
|
|
- PartScoreStart();
|
|
|
|
|
|
+ EventAgent.DispatchEvent(ConstMessage.SHOW_CARD_SKILL_END);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ private void SkillScoreEnd()
|
|
|
|
+ {
|
|
|
|
+ switch (_currentTime)
|
|
|
|
+ {
|
|
|
|
+ case BeginTime.PART_ALL_FIGHT_BEGIN:
|
|
|
|
+ _score += _skillScore;
|
|
|
|
+ CheckPartBeginSkill(null);
|
|
|
|
+ break;
|
|
|
|
+ case BeginTime.PART_FIGHT_BEGIN:
|
|
|
|
+ //这里不把技能分加到总分里,因为技能分会算到部件分里
|
|
|
|
+ PartScoreStart();
|
|
|
|
+ break;
|
|
|
|
+ case BeginTime.PART_PREFACT_CLICK:
|
|
|
|
+ _score += _skillScore;
|
|
|
|
+ PartScoreResultStart(ClickType.PREFACT_CLICK);
|
|
|
|
+ break;
|
|
|
|
+ case BeginTime.PART_FIGHT_END:
|
|
|
|
+ _score += _skillScore;
|
|
|
|
+ UpdateProgress();
|
|
|
|
+ break;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+ private void CheckPartBeginSkill(object param)
|
|
|
|
+ {
|
|
|
|
+ _currentTime = BeginTime.PART_FIGHT_BEGIN;
|
|
|
|
+ SkillScoreStart(null);
|
|
|
|
|
|
|
|
+ }
|
|
private void PartScoreStart()
|
|
private void PartScoreStart()
|
|
{
|
|
{
|
|
- int partId = FightScoreCfgArray.Instance.dataArray[_index].id;
|
|
|
|
- _ui.m_comClickCircle.m_txtPart.text = FightScoreCfgArray.Instance.GetCfg(_index + 1).name;
|
|
|
|
- _partScore = ScoreSystemData.Instance.GetPartScore(partId, _mainScore, _skillScore);
|
|
|
|
- _ui.m_comClickCircle.m_txtScore.text = _partScore.ToString();
|
|
|
|
- _score += _partScore;
|
|
|
|
|
|
+ _ui.m_comClick.target.touchable = !FightDataManager.Instance.autoPlay;
|
|
|
|
|
|
- Debug.Log("index:" + _index);
|
|
|
|
- Vector2 pos = (_ui.target.GetChild("grh_" + _index).asGraph).xy;
|
|
|
|
|
|
+ Vector2 pos = (_ui.m_comClick.target.GetChild("grh_" + (_partId - 1)).asGraph).xy;
|
|
float x = 0f;
|
|
float x = 0f;
|
|
float y = 0f;
|
|
float y = 0f;
|
|
- // EquipDataCache.cacher.GetCirclePos(pos, _range, out x, out y);
|
|
|
|
|
|
+
|
|
x = pos.x;
|
|
x = pos.x;
|
|
y = pos.y;
|
|
y = pos.y;
|
|
- _ui.m_comClickCircle.target.SetXY(x, y);
|
|
|
|
_ui.m_loaGlass.SetXY(x, y);
|
|
_ui.m_loaGlass.SetXY(x, y);
|
|
_ui.m_loaGlass.url = string.Format("ui://Main/zd_bl_{0}", UnityEngine.Random.Range(0, 3));
|
|
_ui.m_loaGlass.url = string.Format("ui://Main/zd_bl_{0}", UnityEngine.Random.Range(0, 3));
|
|
|
|
+ _ui.m_comClick.m_comResult.target.SetXY(x, y);
|
|
|
|
+ _ui.m_comClick.m_comResult.m_t0.ignoreEngineTimeScale = false;
|
|
|
|
+ _ui.m_comClick.m_comResult.m_t0.timeScale = FightDataManager.Instance.fightSpeed;
|
|
|
|
+ if (FightDataManager.Instance.autoPlay)
|
|
|
|
+ {
|
|
|
|
+ _ui.m_comClick.m_comResult.m_t0.SetHook("perfect", CheckPerfectSkill);
|
|
|
|
+ _ui.m_comClick.m_comResult.m_t0.Play();
|
|
|
|
+ }
|
|
|
|
+ else
|
|
|
|
+ {
|
|
|
|
+ _ui.m_comClick.m_comResult.m_t0.Play(CheckPerfectSkill);
|
|
|
|
+ }
|
|
|
|
+ _ui.m_comClick.m_comResult.m_txtPart.text = FightScoreCfgArray.Instance.GetCfg(_partId).name;
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ private void CheckPerfectSkill()
|
|
|
|
+ {
|
|
|
|
+ _skillScore = 0;
|
|
|
|
+ _ui.m_comClick.target.touchable = false;
|
|
|
|
+ int clickType = GetClickType();
|
|
|
|
+ _ui.m_comClick.m_comResult.m_t0.Stop(true, false);
|
|
|
|
+
|
|
|
|
+ if (clickType == ClickType.PREFACT_CLICK)
|
|
|
|
+ {
|
|
|
|
+ _currentTime = BeginTime.PART_PREFACT_CLICK;
|
|
|
|
+ SkillScoreStart(null);
|
|
|
|
+ }
|
|
|
|
+ else
|
|
|
|
+ {
|
|
|
|
+ PartScoreResultStart(clickType);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ private void PartScoreResultStart(int clickType)
|
|
|
|
+ {
|
|
|
|
+ Debug.Log("_partId:" + _partId);
|
|
|
|
+
|
|
|
|
+ _ui.m_comClick.target.touchable = false;
|
|
|
|
+
|
|
|
|
+ _ui.m_comClick.m_comResult.m_t1.ignoreEngineTimeScale = false;
|
|
|
|
+ _ui.m_comClick.m_comResult.m_t1.timeScale = FightDataManager.Instance.fightSpeed;
|
|
|
|
+ _ui.m_comClick.m_comResult.m_t1.Play();
|
|
|
|
+ _partScore = ScoreSystemData.Instance.GetPartScore(_partId, clickType, _skillScore);
|
|
|
|
+ _score += _partScore;
|
|
|
|
+
|
|
|
|
+ _ui.m_comClick.m_comResult.m_c1.selectedIndex = clickType;
|
|
|
|
+ switch (clickType)
|
|
|
|
+ {
|
|
|
|
+ case ClickType.MISS_CLICK:
|
|
|
|
+ _ui.m_comClick.m_comResult.m_txtCount0.text = _partScore.ToString();
|
|
|
|
+ break;
|
|
|
|
+ case ClickType.GREAT_CLICK:
|
|
|
|
+ _ui.m_comClick.m_comResult.m_txtCount1.text = _partScore.ToString();
|
|
|
|
+ break;
|
|
|
|
+ case ClickType.PREFACT_CLICK:
|
|
|
|
+ _ui.m_comClick.m_comResult.m_txtCount2.text = _partScore.ToString();
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+ PartScoreResultEnd();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private void PartScoreResultEnd()
|
|
|
|
+ {
|
|
_ui.m_t1.ignoreEngineTimeScale = false;
|
|
_ui.m_t1.ignoreEngineTimeScale = false;
|
|
_ui.m_t1.timeScale = FightDataManager.Instance.fightSpeed;
|
|
_ui.m_t1.timeScale = FightDataManager.Instance.fightSpeed;
|
|
_ui.m_t1.SetValue("start", _ui.m_loaGlass.x, _ui.m_loaGlass.y);
|
|
_ui.m_t1.SetValue("start", _ui.m_loaGlass.x, _ui.m_loaGlass.y);
|
|
- _ui.m_t1.SetValue("end", _ui.m_proScore.m_imgAni.LocalToGlobal(Vector2.zero).x - _ui.m_loaGlass.width / 2, _ui.m_proScore.target.y - _ui.m_loaGlass.height / 2);
|
|
|
|
-
|
|
|
|
- _ui.m_t1.Play(UpdateProgress);
|
|
|
|
|
|
+ float x = _ui.m_proScore.m_imgAni.LocalToGlobal(Vector2.zero).x - _ui.m_loaGlass.width / 2;
|
|
|
|
+ float y = _ui.m_proScore.target.y - _ui.m_loaGlass.height / 2;
|
|
|
|
+ _ui.m_t1.SetValue("end", x, y);
|
|
|
|
|
|
|
|
+ _ui.m_t1.Play(CheckPartEndSkill);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ private void CheckPartEndSkill()
|
|
|
|
+ {
|
|
|
|
+ _skillScore = 0;
|
|
|
|
+ _currentTime = BeginTime.PART_FIGHT_END;
|
|
|
|
+ SkillScoreStart(null);
|
|
|
|
+ }
|
|
private void UpdateProgress()
|
|
private void UpdateProgress()
|
|
{
|
|
{
|
|
double proportion = _score / _ui.m_proScore.target.max;
|
|
double proportion = _score / _ui.m_proScore.target.max;
|
|
@@ -203,17 +285,15 @@ namespace GFGGame
|
|
_gameObject0.SetActive(star > 0 ? true : false);
|
|
_gameObject0.SetActive(star > 0 ? true : false);
|
|
_gameObject1.SetActive(star > 1 ? true : false);
|
|
_gameObject1.SetActive(star > 1 ? true : false);
|
|
_gameObject2.SetActive(star > 2 ? true : false);
|
|
_gameObject2.SetActive(star > 2 ? true : false);
|
|
- CircleResuleEnd();
|
|
|
|
|
|
+ PartScoreEnd();
|
|
});
|
|
});
|
|
}
|
|
}
|
|
|
|
|
|
- private void CircleResuleEnd()
|
|
|
|
|
|
+ private void PartScoreEnd()
|
|
{
|
|
{
|
|
- _index++;
|
|
|
|
- if (_index >= FightScoreCfgArray.Instance.dataArray.Length)
|
|
|
|
|
|
+ _partId++;
|
|
|
|
+ if (_partId > FightScoreCfgArray.Instance.dataArray.Length)
|
|
{
|
|
{
|
|
- // GetCurStar(out int star, out Transition transition);
|
|
|
|
-
|
|
|
|
_ui.m_comRoleResult.m_comRole.m_imgRole.SetSize(GRoot.inst.width, GRoot.inst.height);
|
|
_ui.m_comRoleResult.m_comRole.m_imgRole.SetSize(GRoot.inst.width, GRoot.inst.height);
|
|
_ui.m_comRoleResult.m_comRole.m_imgRole.texture = _nTexture;
|
|
_ui.m_comRoleResult.m_comRole.m_imgRole.texture = _nTexture;
|
|
_ui.m_comRoleResult.m_c1.selectedIndex = 0;
|
|
_ui.m_comRoleResult.m_c1.selectedIndex = 0;
|
|
@@ -227,7 +307,8 @@ namespace GFGGame
|
|
}
|
|
}
|
|
else
|
|
else
|
|
{
|
|
{
|
|
- Timers.inst.Add(ConstScoreSystem.REFRESH_CIRCLE_WITE_TIME / FightDataManager.Instance.fightSpeed, 1, SkillScore);//下个部分评分
|
|
|
|
|
|
+ // _currentTime = BeginTime.PART_FIGHT_BEGIN;
|
|
|
|
+ Timers.inst.Add(ConstScoreSystem.REFRESH_CIRCLE_WITE_TIME / FightDataManager.Instance.fightSpeed, 1, CheckPartBeginSkill);//下个部分评分
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -253,13 +334,29 @@ namespace GFGGame
|
|
transition = _ui.m_comRoleResult.m_t3;
|
|
transition = _ui.m_comRoleResult.m_t3;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
-
|
|
|
|
-
|
|
|
|
- private void OnComClickCircle()
|
|
|
|
|
|
+ private int GetClickType()
|
|
{
|
|
{
|
|
- _ui.m_comClickCircle.target.touchable = false;
|
|
|
|
- _ui.m_t1.Play(1, 0, 2f, 2.5f, UpdateProgress);
|
|
|
|
|
|
+ float scaleX = _ui.m_comClick.m_comResult.m_imgCircle.scale.x;// _ui.m_comClickCircle.m_imgCircle.scaleX;
|
|
|
|
+ int clickType = ClickType.MISS_CLICK;
|
|
|
|
+ if (FightDataManager.Instance.autoPlay == true)
|
|
|
|
+ {
|
|
|
|
+ return ClickType.PREFACT_CLICK;
|
|
|
|
+ }
|
|
|
|
+ if (scaleX <= _prefectScale && scaleX > 0.65f)
|
|
|
|
+ {
|
|
|
|
+ clickType = ClickType.PREFACT_CLICK;
|
|
|
|
+ }
|
|
|
|
+ else if (scaleX <= 0.216f)
|
|
|
|
+ {
|
|
|
|
+ clickType = ClickType.MISS_CLICK;
|
|
|
|
+ }
|
|
|
|
+ else
|
|
|
|
+ {
|
|
|
|
+ clickType = ClickType.GREAT_CLICK;
|
|
|
|
+ }
|
|
|
|
+ return clickType;
|
|
}
|
|
}
|
|
|
|
+
|
|
private void OnBtnSpeedUp()
|
|
private void OnBtnSpeedUp()
|
|
{
|
|
{
|
|
FightDataManager.Instance.fightSpeed = FightDataManager.Instance.fightSpeed == 1 ? FightDataManager.Instance.maxFightSpeed : 1;
|
|
FightDataManager.Instance.fightSpeed = FightDataManager.Instance.fightSpeed == 1 ? FightDataManager.Instance.maxFightSpeed : 1;
|
|
@@ -279,11 +376,11 @@ namespace GFGGame
|
|
protected override void RemoveEventListener()
|
|
protected override void RemoveEventListener()
|
|
{
|
|
{
|
|
base.RemoveEventListener();
|
|
base.RemoveEventListener();
|
|
- EventAgent.RemoveEventListener(ConstMessage.CARD_SKILL, PartScoreStart);
|
|
|
|
|
|
+ EventAgent.RemoveEventListener(ConstMessage.SHOW_CARD_SKILL_END, SkillScoreEnd);
|
|
}
|
|
}
|
|
private void Reset()
|
|
private void Reset()
|
|
{
|
|
{
|
|
- Timers.inst.Remove(SkillScore);
|
|
|
|
|
|
+ Timers.inst.Remove(SkillScoreStart);
|
|
Timers.inst.Remove(Skip);
|
|
Timers.inst.Remove(Skip);
|
|
GTween.Kill(_ui.m_proScore.m_comBar);
|
|
GTween.Kill(_ui.m_proScore.m_comBar);
|
|
_ui.m_t1.Stop(true, false);
|
|
_ui.m_t1.Stop(true, false);
|
|
@@ -312,6 +409,9 @@ namespace GFGGame
|
|
_gameObject0.SetActive(false);
|
|
_gameObject0.SetActive(false);
|
|
_gameObject1.SetActive(false);
|
|
_gameObject1.SetActive(false);
|
|
_gameObject2.SetActive(false);
|
|
_gameObject2.SetActive(false);
|
|
|
|
+
|
|
|
|
+ // ScoreSystemData.Instance.mainScore = 0;
|
|
|
|
+ _mainScore = 0;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|