| Core/NetworkPackage/ServerPack/HA3_Function/HA309_tagMCSkillElementInfo.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
| Lua/Gen/SnxxzUITreasureSkillModelWrap.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
| System/Skill/ExpertSkillConditionCell.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
| System/Skill/ExpertSkillCyclicScroll.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
| System/Skill/ExpertSkillCyclicScroll.cs.meta | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
| System/Skill/ExpertSkillSelectWin.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
| System/Skill/TreasurePotentialLevelUpWin.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
| System/Skill/TreasureSkillModel.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 |
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; // 激活等级 } } 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); System/Skill/ExpertSkillConditionCell.cs
@@ -1,20 +1,46 @@ using System.Collections; using 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); } } } System/Skill/ExpertSkillCyclicScroll.cs
New file @@ -0,0 +1,76 @@ using 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; } } } System/Skill/ExpertSkillCyclicScroll.cs.meta
File was renamed from System/Skill/TreasurePotentialLevelUpWin.cs.meta @@ -1,6 +1,6 @@ fileFormatVersion: 2 guid: e0638481d824bb1458261240ff26eba0 timeCreated: 1550653809 guid: bc9e4396145b4434d8fa6358555e7381 timeCreated: 1557215991 licenseType: Pro MonoImporter: serializedVersion: 2 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) System/Skill/TreasurePotentialLevelUpWin.cs
File was deleted 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; @@ -174,7 +184,7 @@ 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,6 +539,7 @@ 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) @@ -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)