From e0ec52ef7cd8aaa9687b8f8b9b68aec1d372a2ca Mon Sep 17 00:00:00 2001
From: client_linchunjie <461730578@qq.com>
Date: 星期三, 08 五月 2019 10:56:33 +0800
Subject: [PATCH] 6680 子 【2.0】【开发】五行专精激活方式变更 / 【2.0】【前端】五行专精激活方式变更
---
/dev/null | 203 ------------------
System/Skill/ExpertSkillSelectWin.cs | 118 ++++++++--
Core/NetworkPackage/ServerPack/HA3_Function/HA309_tagMCSkillElementInfo.cs | 16 +
System/Skill/ExpertSkillCyclicScroll.cs | 76 ++++++
System/Skill/ExpertSkillCyclicScroll.cs.meta | 4
Lua/Gen/SnxxzUITreasureSkillModelWrap.cs | 33 ---
System/Skill/ExpertSkillConditionCell.cs | 65 +++++
System/Skill/TreasureSkillModel.cs | 133 +++++++----
8 files changed, 329 insertions(+), 319 deletions(-)
diff --git a/Core/NetworkPackage/ServerPack/HA3_Function/HA309_tagMCSkillElementInfo.cs b/Core/NetworkPackage/ServerPack/HA3_Function/HA309_tagMCSkillElementInfo.cs
index 2e92e27..b1c4d90 100644
--- a/Core/NetworkPackage/ServerPack/HA3_Function/HA309_tagMCSkillElementInfo.cs
+++ b/Core/NetworkPackage/ServerPack/HA3_Function/HA309_tagMCSkillElementInfo.cs
@@ -18,12 +18,26 @@
InfoList[i] = new tagMCSkillElementData();
TransBytes (out InfoList[i].MainSkillID, vBytes, NetDataType.DWORD);
TransBytes (out InfoList[i].ElementSkillID, vBytes, NetDataType.DWORD);
+ TransBytes (out InfoList[i].SkillCnt, vBytes, NetDataType.BYTE);
+ InfoList[i].ActiveSkill = new tagMCSkillElementActiveData[InfoList[i].SkillCnt];
+ for (int j = 0; j < InfoList[i].SkillCnt; j ++) {
+ InfoList[i].ActiveSkill[j] = new tagMCSkillElementActiveData();
+ TransBytes (out InfoList[i].ActiveSkill[j].SkillID, vBytes, NetDataType.DWORD);
+ TransBytes (out InfoList[i].ActiveSkill[j].ActiveLV, vBytes, NetDataType.BYTE);
+ }
}
}
public struct tagMCSkillElementData {
public uint MainSkillID; // 主技能ID
- public uint ElementSkillID; // 专精技能ID
+ public uint ElementSkillID; // 选择的专精技能ID
+ public byte SkillCnt; // 数量
+ public tagMCSkillElementActiveData[] ActiveSkill; // 激活的技能ID
+ }
+
+ public struct tagMCSkillElementActiveData {
+ public uint SkillID; // 技能ID
+ public byte ActiveLV; // 激活等级
}
}
diff --git a/Lua/Gen/SnxxzUITreasureSkillModelWrap.cs b/Lua/Gen/SnxxzUITreasureSkillModelWrap.cs
index fc271ff..67a5cc2 100644
--- a/Lua/Gen/SnxxzUITreasureSkillModelWrap.cs
+++ b/Lua/Gen/SnxxzUITreasureSkillModelWrap.cs
@@ -32,7 +32,6 @@
Utils.RegisterFunc(L, Utils.METHOD_IDX, "TryGetPotential", _m_TryGetPotential);
Utils.RegisterFunc(L, Utils.METHOD_IDX, "OnReceivePackage", _m_OnReceivePackage);
Utils.RegisterFunc(L, Utils.METHOD_IDX, "TryLevelUpTreasureSkill", _m_TryLevelUpTreasureSkill);
- Utils.RegisterFunc(L, Utils.METHOD_IDX, "TryLevelUpPotential", _m_TryLevelUpPotential);
Utils.RegisterFunc(L, Utils.METHOD_IDX, "DisplayLevelUpError", _m_DisplayLevelUpError);
Utils.RegisterFunc(L, Utils.METHOD_IDX, "ContainsSkill", _m_ContainsSkill);
Utils.RegisterFunc(L, Utils.METHOD_IDX, "SetAlreadyRemind", _m_SetAlreadyRemind);
@@ -346,38 +345,6 @@
int _error;
bool gen_ret = gen_to_be_invoked.TryLevelUpTreasureSkill( _skillId, out _error );
- LuaAPI.lua_pushboolean(L, gen_ret);
- LuaAPI.xlua_pushinteger(L, _error);
-
-
-
-
- return 2;
- }
-
- } catch(System.Exception gen_e) {
- return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
- }
-
- }
-
- [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
- static int _m_TryLevelUpPotential(RealStatePtr L)
- {
- try {
-
- ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
-
-
- Snxxz.UI.TreasureSkillModel gen_to_be_invoked = (Snxxz.UI.TreasureSkillModel)translator.FastGetCSObj(L, 1);
-
-
-
- {
- int _skillId = LuaAPI.xlua_tointeger(L, 2);
- int _error;
-
- bool gen_ret = gen_to_be_invoked.TryLevelUpPotential( _skillId, out _error );
LuaAPI.lua_pushboolean(L, gen_ret);
LuaAPI.xlua_pushinteger(L, _error);
diff --git a/System/Skill/ExpertSkillConditionCell.cs b/System/Skill/ExpertSkillConditionCell.cs
index 10c1782..bbdccd8 100644
--- a/System/Skill/ExpertSkillConditionCell.cs
+++ b/System/Skill/ExpertSkillConditionCell.cs
@@ -1,20 +1,46 @@
-锘縰sing System.Collections;
+锘縰sing System;
+using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
namespace Snxxz.UI
{
- public class ExpertSkillConditionCell : CellView
+ public class ExpertSkillConditionCell : ScrollItem
{
+ [SerializeField] UIAlphaTween m_AlphaTween;
+ [SerializeField] UILinerMove m_LinerMove;
[SerializeField] Text m_Condition;
[SerializeField] Text m_Description;
[SerializeField] Image m_Line;
+ [SerializeField] UIEffect m_Effect;
+
+ public UIAlphaTween alphaTween
+ {
+ get { return m_AlphaTween; }
+ }
+
+ public UILinerMove linerMove
+ {
+ get { return m_LinerMove; }
+ }
+
+ int skillId = 0;
+ int level = 0;
TreasureSkillModel model { get { return ModelCenter.Instance.GetModel<TreasureSkillModel>(); } }
- public void Display(int skillId, int level)
+ public override void Display(object _data)
{
+ var data = (int)_data;
+ skillId = data / 100;
+ level = data % 100;
+
+ m_AlphaTween.SetStartState();
+
+ var activeLevel = 0;
+ model.TryGetExpertActiveLevel(skillId, out activeLevel);
+
var skillConfig = SkillConfig.Get(skillId + level - 1);
var property = skillConfig.RequireProperty();
var propertyConfig = PlayerPropertyConfig.Get(property);
@@ -25,13 +51,44 @@
var currentValue = UIHelper.GetPropertyValue((PropertyType)property);
- if (currentValue >= skillConfig.RequirePropertyValue())
+ if (activeLevel >= level)
{
m_Description.color = UIHelper.s_LightYellow;
+ m_Condition.color = UIHelper.s_Gold;
}
else
{
m_Description.color = UIHelper.s_BrightWhiteColor;
+ m_Condition.color = UIHelper.s_BrightWhiteColor;
+ if (currentValue >= skillConfig.RequirePropertyValue())
+ {
+ m_Condition.text += UIHelper.AppendColor(TextColType.Green, "锛堝彲婵�娲伙級");
+ }
+ }
+
+ model.expertActiveRefresh -= ExpertActiveRefresh;
+ model.expertActiveRefresh += ExpertActiveRefresh;
+ }
+
+ public override void Dispose()
+ {
+ base.Dispose();
+ m_AlphaTween.SetStartState();
+
+ model.expertActiveRefresh -= ExpertActiveRefresh;
+ }
+
+ private void ExpertActiveRefresh(int id)
+ {
+ if (skillId == id)
+ {
+ var activeLevel = 0;
+ model.TryGetExpertActiveLevel(id, out activeLevel);
+ if (activeLevel == level)
+ {
+ m_Effect.Play();
+ }
+ Display(skillId * 100 + level);
}
}
}
diff --git a/System/Skill/ExpertSkillCyclicScroll.cs b/System/Skill/ExpertSkillCyclicScroll.cs
new file mode 100644
index 0000000..835ac56
--- /dev/null
+++ b/System/Skill/ExpertSkillCyclicScroll.cs
@@ -0,0 +1,76 @@
+锘縰sing System;
+using System.Collections;
+using System.Collections.Generic;
+using UnityEngine;
+namespace Snxxz.UI
+{
+ public class ExpertSkillCyclicScroll : CyclicScroll
+ {
+ [SerializeField] float m_FadeInTime = 0.2f;
+
+ bool m_IsPlaying = false;
+ public bool IsPlaying
+ {
+ get { return m_IsPlaying; }
+ private set
+ {
+ m_IsPlaying = value;
+ this.enabled = !m_IsPlaying;
+ }
+ }
+
+ Coroutine m_Coroutine = null;
+
+ public override void Init<T>(List<T> _datas, bool _stepByStep = false)
+ {
+ base.Init(_datas, _stepByStep);
+ IsPlaying = false;
+
+ if (m_Coroutine != null)
+ {
+ StopCoroutine(m_Coroutine);
+ m_Coroutine = null;
+ }
+ }
+
+ public void DisplayAnimation(Action callback)
+ {
+ IsPlaying = true;
+
+ m_Coroutine = StartCoroutine(Co_DisplayAnimation(callback));
+ }
+
+ IEnumerator Co_DisplayAnimation(Action callback)
+ {
+ var behaviour = infiniteItems[0] as ExpertSkillConditionCell;
+ behaviour.alphaTween.SetStartState();
+ behaviour.alphaTween.Play();
+ yield return WaitingForSecondConst.GetWaitForSeconds(behaviour.alphaTween.duration);
+ behaviour.gameObject.SetActive(false);
+
+ var time = 0f;
+
+ for (int i = 1; i < infiniteItems.Count; i++)
+ {
+ behaviour = infiniteItems[i] as ExpertSkillConditionCell;
+ var fromY = behaviour.rectTransform.anchoredPosition.y;
+ behaviour.linerMove.from = behaviour.rectTransform.anchoredPosition.SetY(fromY);
+ var toY = behaviour.rectTransform.anchoredPosition.y + cellSize.y;
+ behaviour.linerMove.to = behaviour.rectTransform.anchoredPosition.SetY(toY);
+ behaviour.linerMove.Begin();
+
+ time = behaviour.linerMove.duration;
+ }
+
+ yield return WaitingForSecondConst.GetWaitForSeconds(time);
+
+ if (callback != null)
+ {
+ callback();
+ }
+
+ IsPlaying = false;
+ }
+ }
+}
+
diff --git a/System/Skill/TreasurePotentialLevelUpWin.cs.meta b/System/Skill/ExpertSkillCyclicScroll.cs.meta
similarity index 75%
rename from System/Skill/TreasurePotentialLevelUpWin.cs.meta
rename to System/Skill/ExpertSkillCyclicScroll.cs.meta
index 2194938..e1e0c09 100644
--- a/System/Skill/TreasurePotentialLevelUpWin.cs.meta
+++ b/System/Skill/ExpertSkillCyclicScroll.cs.meta
@@ -1,6 +1,6 @@
fileFormatVersion: 2
-guid: e0638481d824bb1458261240ff26eba0
-timeCreated: 1550653809
+guid: bc9e4396145b4434d8fa6358555e7381
+timeCreated: 1557215991
licenseType: Pro
MonoImporter:
serializedVersion: 2
diff --git a/System/Skill/ExpertSkillSelectWin.cs b/System/Skill/ExpertSkillSelectWin.cs
index bdf4d83..68e65f0 100644
--- a/System/Skill/ExpertSkillSelectWin.cs
+++ b/System/Skill/ExpertSkillSelectWin.cs
@@ -20,7 +20,10 @@
[SerializeField] Image m_SkillIcon;
[SerializeField] Text m_SkillName;
[SerializeField] Text m_Reiki;
- [SerializeField] ScrollerController m_Controller;
+ [SerializeField] Text m_ReikiPoint;
+ [SerializeField] ExpertSkillCyclicScroll m_CyclicScroll;
+ [SerializeField] LayoutElement m_LayoutElement;
+ [SerializeField] Button m_Active;
[SerializeField] Button m_Select;
[SerializeField] Button m_Close1;
[SerializeField] Button m_Close2;
@@ -49,6 +52,10 @@
}
}
+ int selectActiveLevel = 0;
+
+ List<int> datas = new List<int>();
+
TreasureSkillModel model { get { return ModelCenter.Instance.GetModel<TreasureSkillModel>(); } }
#region Built-in
protected override void BindController()
@@ -57,10 +64,11 @@
protected override void AddListeners()
{
- m_Controller.OnRefreshCell += OnRefreshCell;
+ //m_Controller.OnRefreshCell += OnRefreshCell;
m_Select.AddListener(OnSelect);
m_Close1.AddListener(CloseClick);
m_Close2.AddListener(CloseClick);
+ m_Active.AddListener(OnActiveSkill);
}
protected override void OnPreOpen()
@@ -70,7 +78,11 @@
m_OpenDetail = false;
+ m_CyclicScroll.enabled = false;
+
Display();
+
+ model.expertActiveRefresh += ExpertActiveRefresh;
}
protected override void OnAfterOpen()
@@ -79,6 +91,11 @@
protected override void OnPreClose()
{
+ m_CyclicScroll.Dispose();
+
+ StopAllCoroutines();
+
+ model.expertActiveRefresh -= ExpertActiveRefresh;
}
protected override void OnAfterClose()
@@ -97,7 +114,6 @@
void SetDefaultSelect()
{
m_SelectExpert = 0;
- //model.TryGetExpertSkill(selectSkillId, out m_SelectExpert);
}
void DisplayExperts()
@@ -125,24 +141,12 @@
{
if (selectExpert != 0)
{
- var level = 0;
- TreasurePotential expert;
- if (model.TryGetPotential(selectExpert, out expert))
- {
- level = expert.level;
- }
+ selectActiveLevel = 0;
+ model.TryGetExpertActiveLevel(selectExpert, out selectActiveLevel);
- m_Select.gameObject.SetActive(PlayerDatas.Instance.baseData.LV >= expert.limitLevel);
+ DisplayButtonState();
- SkillConfig skillConfig;
- if (level == 0)
- {
- skillConfig = SkillConfig.Get(selectExpert);
- }
- else
- {
- skillConfig = SkillConfig.Get(selectExpert + level - 1);
- }
+ var skillConfig = SkillConfig.Get(selectExpert);
m_SkillIcon.SetSprite(skillConfig.IconName);
m_SkillName.text = skillConfig.SkillName;
@@ -152,12 +156,44 @@
m_Reiki.text = propertyConfig.Name;
m_Reiki.color = UIHelper.GetPropertyColor(property);
- m_Controller.Refresh();
+ m_ReikiPoint.text = string.Format("鎴戠殑{0}鐏垫牴锛歿1}",
+ propertyConfig.Name, UIHelper.GetPropertyValue((PropertyType)property));
+
+ datas.Clear();
for (int i = 1; i <= skillConfig.SkillMaxLV; i++)
{
- m_Controller.AddCell(ScrollerDataType.Header, i);
+ if (i >= selectActiveLevel)
+ {
+ datas.Add(selectExpert * 100 + i);
+ }
}
- m_Controller.Restart();
+
+ //m_LayoutElement.preferredHeight = datas.Count > 2 ? 440 : 302;
+
+ m_CyclicScroll.enabled = true;
+
+ m_CyclicScroll.Dispose();
+ m_CyclicScroll.Init(datas);
+ StartCoroutine(Co_Arrange());
+ }
+ }
+
+ IEnumerator Co_Arrange()
+ {
+ yield return null;
+ m_CyclicScroll.ReArrange();
+ }
+
+ void DisplayButtonState()
+ {
+ TreasurePotential expert;
+ if (model.TryGetPotential(selectExpert, out expert))
+ {
+ var satisfyActive = model.SatisfyActiveExpert(selectExpert);
+ var activeLevel = 0;
+ model.TryGetExpertActiveLevel(selectExpert, out activeLevel);
+ m_Select.gameObject.SetActive(activeLevel > 0 && !satisfyActive);
+ m_Active.gameObject.SetActive(satisfyActive);
}
}
@@ -178,17 +214,44 @@
CloseImmediately();
}
+ private void OnActiveSkill()
+ {
+ if (m_CyclicScroll.IsPlaying)
+ {
+ return;
+ }
+ var pak = new CA516_tagCMSelectSkillElement();
+ pak.SkillTypeID = (uint)selectExpert;
+ GameNetSystem.Instance.SendInfo(pak);
+ }
+
private void OnSelect(int skillId)
{
+ if (m_CyclicScroll.IsPlaying)
+ {
+ return;
+ }
selectExpert = skillId;
}
- private void OnRefreshCell(ScrollerDataType type, CellView cell)
+ private void ExpertActiveRefresh(int id)
{
- var expertCell = cell as ExpertSkillConditionCell;
- expertCell.Display(selectExpert, cell.index);
+ if (selectExpert == id)
+ {
+ var level = 0;
+ if (model.TryGetExpertActiveLevel(selectExpert, out level))
+ {
+ if (level > selectActiveLevel && level > 1)
+ {
+ m_CyclicScroll.DisplayAnimation(()=>
+ {
+ DisplayDetail();
+ });
+ }
+ }
+ DisplayButtonState();
+ }
}
-
#endregion
@@ -203,6 +266,7 @@
[SerializeField] Transform m_ContainerSelect;
[SerializeField] Text m_Use;
[SerializeField] Text m_Limit;
+ [SerializeField] RedpointBehaviour m_Redpoint;
[SerializeField] Button m_Select;
public int skillId { get; private set; }
@@ -237,6 +301,8 @@
m_Icon.gray = !unlock;
m_ReikiBottom.gray = !unlock;
+ m_Redpoint.redpointId = expert.activeRedpoint.id;
+
m_Select.SetListener(() =>
{
if (func != null)
diff --git a/System/Skill/TreasurePotentialLevelUpWin.cs b/System/Skill/TreasurePotentialLevelUpWin.cs
deleted file mode 100644
index c9fc523..0000000
--- a/System/Skill/TreasurePotentialLevelUpWin.cs
+++ /dev/null
@@ -1,203 +0,0 @@
-锘�//--------------------------------------------------------
-// [Author]: 绗簩涓栫晫
-// [ Date ]: Wednesday, February 20, 2019
-//--------------------------------------------------------
-
-using System;
-using System.Collections;
-using System.Collections.Generic;
-using UnityEngine;
-using UnityEngine.UI;
-
-namespace Snxxz.UI
-{
-
- public class TreasurePotentialLevelUpWin : Window
- {
- [SerializeField] Image m_SkillIcon;
- [SerializeField] Text m_SkillName;
- [SerializeField] Text m_SkillLevel;
- [SerializeField] Text m_FightPower;
- [SerializeField] Transform m_ContainerNow;
- [SerializeField] Text m_SkillDescNow;
- [SerializeField] Transform m_ContainerNext;
- [SerializeField] Text m_SkillDescNext;
- [SerializeField] Transform m_ContainerLevelUp;
- [SerializeField] Text m_PreSkillCondition;
- [SerializeField] ItemBehaviour m_Item;
- [SerializeField] Transform m_ContainerMax;
- [SerializeField] Button m_Learn;
- [SerializeField] Button m_LevelUp;
- [SerializeField] Button m_GetWay;
- [SerializeField] Button m_Close;
- [SerializeField] UIEffect m_LevelUpEffect;
-
- public static int selectPotentialId = 0;
-
- TreasureSkillModel model
- {
- get { return ModelCenter.Instance.GetModel<TreasureSkillModel>(); }
- }
-
- PackModel packModel
- {
- get { return ModelCenter.Instance.GetModel<PackModel>(); }
- }
- #region Built-in
- protected override void BindController()
- {
-
- }
-
- protected override void AddListeners()
- {
- m_LevelUp.AddListener(LevelUp);
- m_Learn.AddListener(LevelUp);
- m_Close.AddListener(CloseClick);
- m_GetWay.AddListener(GetWay);
- }
-
- protected override void OnPreOpen()
- {
- Display();
- model.skillLevelUpRefresh += SkillLevelUpRefresh;
- packModel.refreshItemCountEvent += RefreshItemCountEvent;
- }
-
- protected override void OnAfterOpen()
- {
- }
-
- protected override void OnPreClose()
- {
- model.skillLevelUpRefresh -= SkillLevelUpRefresh;
- packModel.refreshItemCountEvent -= RefreshItemCountEvent;
- }
-
- protected override void OnAfterClose()
- {
- }
- #endregion
-
- private void SkillLevelUpRefresh(int id)
- {
- if (selectPotentialId == id)
- {
- Display();
- m_LevelUpEffect.Play();
- }
- }
-
- public void Display()
- {
- TreasurePotential potential;
- if (model.TryGetPotential(selectPotentialId, out potential))
- {
- var config = potential.GetSkillConfig(potential.level);
- m_SkillIcon.SetSprite(config.IconName);
- m_SkillName.text = config.SkillName;
- m_SkillLevel.text = StringUtility.Contact("LV", potential.level);
- m_FightPower.text = StringUtility.Contact("+", config.FightPower);
-
- var isMax = potential.level >= potential.maxLevel;
- m_ContainerNext.gameObject.SetActive(!isMax);
-
- if (potential.level == 0)
- {
- m_SkillDescNow.text = Language.Get("TreasurePotentialNowEffect", Language.Get("TreasurePotentialUnLearn"));
- }
- else
- {
- m_SkillDescNow.text = Language.Get("TreasurePotentialNowEffect", config.Description);
- }
-
- if (!isMax)
- {
- var nextConfig = potential.GetSkillConfig(potential.level + 1);
- m_SkillDescNext.text = Language.Get("TreasurePotentialNextEffect", nextConfig.Description);
-
- var preSkill = config.LearnSkillReq;
-
- m_PreSkillCondition.gameObject.SetActive(preSkill != 0 && config.LearnSkillLV > 0);
- if (preSkill != 0 && config.LearnSkillLV > 0)
- {
- TreasurePotential prePotential;
- var satisfyLevel = false;
- var preSkillLevel = 0;
- if (model.TryGetPotential(preSkill, out prePotential))
- {
- preSkillLevel = prePotential.level;
- satisfyLevel = preSkillLevel >= config.LearnSkillLV;
- }
- var preSkillConfig = SkillConfig.Get(preSkill);
- var displayLevel = StringUtility.Contact(
- UIHelper.AppendColor(satisfyLevel ? TextColType.Green : TextColType.Red, preSkillLevel.ToString())
- , "/", config.LearnSkillLV);
- m_PreSkillCondition.text = Language.Get("PotentialPreSkillCondition",
- preSkillConfig.SkillName, displayLevel);
- }
- }
-
- m_ContainerLevelUp.gameObject.SetActive(!isMax);
- m_ContainerMax.gameObject.SetActive(isMax);
- m_GetWay.gameObject.SetActive(!isMax);
-
- if (!isMax)
- {
- var nextConfig = potential.GetSkillConfig(potential.level + 1);
- m_Item.SetItem(nextConfig.ExAttr4, nextConfig.ExAttr5);
- }
- }
-
- var potentialLevel = 0;
- if (potential != null)
- {
- potentialLevel = potential.level;
- }
-
- var error = 0;
- bool satisfyLevelUp = model.TryLevelUpPotential(selectPotentialId, out error);
- m_LevelUp.gameObject.SetActive(satisfyLevelUp && potentialLevel > 0);
- m_Learn.gameObject.SetActive(satisfyLevelUp && potentialLevel == 0);
- }
-
- private void GetWay()
- {
- TreasurePotential potential;
- if (model.TryGetPotential(selectPotentialId, out potential))
- {
- var upConfig = potential.GetSkillConfig(potential.level + 1);
- ItemTipUtility.Show(upConfig.ExAttr4);
- }
- }
-
- private void LevelUp()
- {
- var error = 0;
- if (model.TryLevelUpPotential(selectPotentialId, out error))
- {
- var pak = new C0304_tagCAddSkillPoint();
- pak.SkillID = (ushort)selectPotentialId;
- GameNetSystem.Instance.SendInfo(pak);
- }
- else
- {
- model.DisplayLevelUpError(error);
- }
- }
-
- private void RefreshItemCountEvent(PackType packType, int arg2, int itemId)
- {
- if (packType == PackType.Item && model.skillLevelUpItems.Contains(itemId))
- {
- Display();
- }
- }
-
- }
-
-}
-
-
-
-
diff --git a/System/Skill/TreasureSkillModel.cs b/System/Skill/TreasureSkillModel.cs
index 8dc92cc..478cc0f 100644
--- a/System/Skill/TreasureSkillModel.cs
+++ b/System/Skill/TreasureSkillModel.cs
@@ -11,6 +11,7 @@
Dictionary<int, TreasureSkill> treasureSkills = new Dictionary<int, TreasureSkill>();
Dictionary<int, List<int>> jobTreasureSkills = new Dictionary<int, List<int>>();
Dictionary<int, int> m_ExpertSkills = new Dictionary<int, int>();
+ Dictionary<int, int> m_ExpertActiveLevels = new Dictionary<int, int>();
public List<int> skillLevelUpItems = new List<int>();
@@ -46,6 +47,7 @@
public event Action<int> skillLevelUpRefresh;
public event Action<int, int> potentialLevelRefresh;
public event Action expertSkillRefresh;
+ public event Action<int> expertActiveRefresh;
public override void Init()
{
ParseConfig();
@@ -62,6 +64,7 @@
skill.Reset();
}
m_ExpertSkills.Clear();
+ m_ExpertActiveLevels.Clear();
serverInited = false;
}
@@ -81,7 +84,16 @@
private void PlayerDataRefreshEvent(PlayerDataType dataType)
{
- if (dataType == PlayerDataType.LV)
+ if (!serverInited)
+ {
+ return;
+ }
+ if (dataType == PlayerDataType.LV
+ || dataType == PlayerDataType.CDBPlayerRefresh_Mater
+ || dataType == PlayerDataType.CDBPlayerRefresh_Wood
+ || dataType == PlayerDataType.CDBPlayerRefresh_Water
+ || dataType == PlayerDataType.CDBPlayerRefresh_Fire
+ || dataType == PlayerDataType.CDBPlayerRefresh_Earth)
{
UpdateRedpoint();
}
@@ -110,17 +122,15 @@
void ParseConfig()
{
var configs = TreasureSkillConfig.GetValues();
- var index = 0;
foreach (var config in configs)
{
TreasureSkill treasureSkill;
if (!treasureSkills.TryGetValue(config.limitSkillId, out treasureSkill))
{
- treasureSkill = new TreasureSkill(config.limitSkillId, index);
+ treasureSkill = new TreasureSkill(config.limitSkillId);
treasureSkills.Add(config.limitSkillId, treasureSkill);
- index++;
}
- treasureSkill.potentials.Add(new TreasurePotential(config.id, 0, config.limitLevel, treasureSkill.redpoint.id));
+ treasureSkill.potentials.Add(new TreasurePotential(config.id, 0, config.limitLevel, treasureSkill.expertRedpoint.id));
var skillConfig = SkillConfig.Get(config.limitSkillId);
List<int> skills;
@@ -172,9 +182,9 @@
return treasureSkills.TryGetValue(skillId, out treasureSkill);
}
- public bool TryGetExpertSkill(int skillId,out int _skill)
+ public bool TryGetExpertSkill(int skillId, out int _skill)
{
- return m_ExpertSkills.TryGetValue(skillId, out _skill);
+ return m_ExpertSkills.TryGetValue(skillId, out _skill) && _skill != 0;
}
public bool TryGetPotential(int skillId, out TreasurePotential potential)
@@ -191,6 +201,11 @@
return potential != null;
}
return false;
+ }
+
+ public bool TryGetExpertActiveLevel(int skillId, out int level)
+ {
+ return m_ExpertActiveLevels.TryGetValue(skillId, out level);
}
public void OnReceivePackage(int oldSkillID, int newSkillID)
@@ -260,6 +275,18 @@
{
var data = package.InfoList[i];
m_ExpertSkills[(int)data.MainSkillID] = (int)data.ElementSkillID;
+
+ for (int j = 0; j < data.SkillCnt; j++)
+ {
+ m_ExpertActiveLevels[(int)data.ActiveSkill[j].SkillID] = data.ActiveSkill[j].ActiveLV;
+ if (serverInited)
+ {
+ if (expertActiveRefresh != null)
+ {
+ expertActiveRefresh((int)data.ActiveSkill[j].SkillID);
+ }
+ }
+ }
}
if (expertSkillRefresh != null)
{
@@ -309,39 +336,6 @@
return true;
}
- public bool TryLevelUpPotential(int skillId, out int error)
- {
- error = 0;
- TreasurePotential potential;
- if (TryGetPotential(skillId, out potential))
- {
- if (potential.level >= potential.maxLevel)
- {
- error = 11;
- return false;
- }
- var config = potential.GetSkillConfig(potential.level);
- if (config.LearnSkillReq != 0 && config.LearnSkillLV > 0)
- {
- TreasurePotential requirePotential;
- if (!TryGetPotential(config.LearnSkillReq, out requirePotential)
- || requirePotential.level < config.LearnSkillLV)
- {
- error = 12;
- return false;
- }
- }
- var upConfig = potential.GetSkillConfig(potential.level + 1);
- var count = packModel.GetItemCountByID(PackType.Item, upConfig.ExAttr4);
- if (count < upConfig.ExAttr5)
- {
- error = 13;
- return false;
- }
- }
- return true;
- }
-
public void DisplayLevelUpError(int error)
{
switch (error)
@@ -382,20 +376,41 @@
return false;
}
- public bool ExistAnyUnlockPotential(int skillId)
+ public bool ExistAnyActiveExpert(int skillId)
{
TreasureSkill treasureSkill;
if (TryGetSkill(skillId, out treasureSkill))
{
for (int i = 0; i < treasureSkill.potentials.Count; i++)
{
- if (PlayerDatas.Instance.baseData.LV >= treasureSkill.potentials[i].limitLevel)
+ var level = 0;
+ if (TryGetExpertActiveLevel(treasureSkill.potentials[i].id, out level)
+ && level > 0)
{
return true;
}
}
}
return false;
+ }
+
+ public bool SatisfyActiveExpert(int skillId)
+ {
+ TreasurePotential expert;
+ if (!TryGetPotential(skillId, out expert))
+ {
+ return false;
+ }
+ if (PlayerDatas.Instance.baseData.LV < expert.limitLevel)
+ {
+ return false;
+ }
+ var level = 0;
+ TryGetExpertActiveLevel(skillId, out level);
+ var skillConfig = SkillConfig.Get(skillId + level);
+ var requireProperty = skillConfig.RequireProperty();
+ var requireValue = skillConfig.RequirePropertyValue();
+ return UIHelper.GetPropertyValue((PropertyType)requireProperty) >= requireValue;
}
public void SetAlreadyRemind()
@@ -422,15 +437,26 @@
}
var expertSkill = 0;
- if (funcOpen && skill.level > 0
- && !TryGetExpertSkill(skill.skillId, out expertSkill)
- && ExistAnyUnlockPotential(skill.skillId))
+ if (funcOpen && !TryGetExpertSkill(skill.skillId, out expertSkill)
+ && ExistAnyActiveExpert(skill.skillId))
{
- skill.expertRedpoint.state = RedPointState.Simple;
+ skill.expertSelectRedpoint.state = RedPointState.Simple;
}
else
{
- skill.expertRedpoint.state = RedPointState.None;
+ skill.expertSelectRedpoint.state = RedPointState.None;
+ }
+
+ foreach (var expert in skill.potentials)
+ {
+ if (funcOpen && skill.level > 0 && SatisfyActiveExpert(expert.id))
+ {
+ expert.activeRedpoint.state = RedPointState.Simple;
+ }
+ else
+ {
+ expert.activeRedpoint.state = RedPointState.None;
+ }
}
}
}
@@ -445,9 +471,10 @@
public Redpoint redpoint { get; private set; }
public Redpoint levelUpRedpoint { get; private set; }
public Redpoint expertRedpoint { get; private set; }
+ public Redpoint expertSelectRedpoint { get; private set; }
public List<TreasurePotential> potentials { get; private set; }
- public TreasureSkill(int skillId, int redpointIndex)
+ public TreasureSkill(int skillId)
{
this.skillId = skillId;
potentials = new List<TreasurePotential>();
@@ -456,10 +483,12 @@
maxLevel = config.SkillMaxLV;
redpoint = new Redpoint(10304,
- TreasureSkillModel.REDPOINTID_BASE + redpointIndex);
+ TreasureSkillModel.REDPOINTID_BASE + TreasureSkillModel.redpointIndex++);
levelUpRedpoint = new Redpoint(redpoint.id,
TreasureSkillModel.REDPOINTID_BASE + TreasureSkillModel.redpointIndex++);
expertRedpoint = new Redpoint(redpoint.id,
+ TreasureSkillModel.REDPOINTID_BASE + TreasureSkillModel.redpointIndex++);
+ expertSelectRedpoint = new Redpoint(expertRedpoint.id,
TreasureSkillModel.REDPOINTID_BASE + TreasureSkillModel.redpointIndex++);
}
@@ -510,9 +539,10 @@
public readonly int id;
public readonly int maxLevel;
public readonly int limitLevel;
+ public readonly Redpoint activeRedpoint;
public int level { get; private set; }
- public TreasurePotential(int id, int level,int limitLevel, int redpointBase)
+ public TreasurePotential(int id, int level, int limitLevel, int redpointBase)
{
this.id = id;
this.level = level;
@@ -520,6 +550,9 @@
var config = SkillConfig.Get(id);
maxLevel = config.SkillMaxLV;
+
+ activeRedpoint = new Redpoint(redpointBase,
+ TreasureSkillModel.REDPOINTID_BASE + TreasureSkillModel.redpointIndex++);
}
public SkillConfig GetSkillConfig(int level)
--
Gitblit v1.8.0