Merge branch 'master' into Equip
| | |
| | | public class Bhv_Evt_RefreshMonster : Bhv_Evt |
| | | { |
| | | [HideInInspector] |
| | | public Evt_RefreshMonster.E_OverCondition overCondition = Evt_RefreshMonster.E_OverCondition.None; |
| | | public Evt_RefreshMonster.E_OverCondition overCondition = Evt_RefreshMonster.E_OverCondition.DeadCount; |
| | | [HideInInspector] |
| | | public Evt_RefreshMonster.E_RefreshType refreshType = Evt_RefreshMonster.E_RefreshType.All; |
| | | [HideInInspector] |
| | |
| | | public int conditionParam; |
| | | [HideInInspector] |
| | | public int overParam; |
| | | [HideInInspector] |
| | | public int nextEventID = -1; |
| | | |
| | | #if UNITY_EDITOR |
| | | |
| | | [HideInInspector] |
| | | private bool showMonsterList = false; |
| | | private int npcID = -1; |
| | | private string resName; |
| | | |
| | | public override void Save(BinaryWriter bw) |
| | | { |
| | |
| | | bw.Write((byte)refreshType); |
| | | bw.Write(conditionParam); |
| | | bw.Write(overParam); |
| | | bw.Write(nextEventID); |
| | | bw.Write(monsterList.Count); |
| | | foreach (var _monster in monsterList) |
| | | { |
| | |
| | | bw.Write((byte)refreshType); |
| | | bw.Write(conditionParam); |
| | | bw.Write(overParam); |
| | | bw.Write(nextEventID); |
| | | bw.Write(monsterList.Count); |
| | | foreach (var _monster in monsterList) |
| | | { |
| | |
| | | refreshType = (Evt_RefreshMonster.E_RefreshType)br.ReadByte(); |
| | | conditionParam = br.ReadInt32(); |
| | | overParam = br.ReadInt32(); |
| | | nextEventID = br.ReadInt32(); |
| | | int _count = br.ReadInt32(); |
| | | for (int i = 0; i < _count; ++i) |
| | | { |
| | |
| | | } |
| | | EditorGUILayout.EndHorizontal(); |
| | | |
| | | EditorGUILayout.BeginHorizontal(guiSkin.customStyles[1], GUILayout.Height(22)); |
| | | EditorGUILayout.LabelField("下一事件", guiSkin.customStyles[0], GUILayout.Height(22), GUILayout.Width(60)); |
| | | nextEventID = EditorGUILayout.IntField(nextEventID, guiSkin.textField, GUILayout.Height(22)); |
| | | EditorGUILayout.EndHorizontal(); |
| | | |
| | | EditorGUILayout.BeginVertical(guiSkin.customStyles[1]); |
| | | |
| | | EditorGUILayout.BeginHorizontal(GUILayout.Height(22)); |
| | | showMonsterList = EditorGUILayout.Foldout(showMonsterList, " 刷怪列表", true, guiSkin.customStyles[3]); |
| | | EditorGUILayout.LabelField("NPCID", guiSkin.customStyles[0], GUILayout.Height(22), GUILayout.Width(50)); |
| | | npcID = EditorGUILayout.IntField(npcID, guiSkin.textField, GUILayout.Height(22), GUILayout.Width(70)); |
| | | EditorGUILayout.LabelField("模型名", guiSkin.customStyles[0], GUILayout.Height(22), GUILayout.Width(50)); |
| | | resName = EditorGUILayout.TextField(resName, guiSkin.textField, GUILayout.Height(22), GUILayout.Width(70)); |
| | | if (GUILayout.Button("添加", guiSkin.button, GUILayout.Width(60), GUILayout.Height(22))) |
| | | { |
| | | var _go = new GameObject("RefreshMonster"); |
| | | _go.transform.SetParent(transform); |
| | | _go.transform.localPosition = Vector3.zero; |
| | | _go.transform.eulerAngles = Vector3.zero; |
| | | _go.transform.localScale = Vector3.one; |
| | | var _monsterData = CreateNPC(npcID, resName); |
| | | if (_monsterData) |
| | | { |
| | | monsterList.Add(_monsterData); |
| | | showMonsterList = true; |
| | | |
| | | var _monsterData = _go.AddComponent<Bhv_MonsterData>(); |
| | | monsterList.Add(_monsterData); |
| | | |
| | | showMonsterList = true; |
| | | Selection.activeGameObject = _monsterData.gameObject; |
| | | if (Selection.activeGameObject) |
| | | { |
| | | SceneView.lastActiveSceneView.LookAt(Selection.activeGameObject.transform.position); |
| | | } |
| | | } |
| | | } |
| | | EditorGUILayout.EndHorizontal(); |
| | | if (showMonsterList) |
| | |
| | | for (int i = monsterList.Count - 1; i >= 0; --i) |
| | | { |
| | | EditorGUILayout.BeginHorizontal(GUILayout.Height(22)); |
| | | EditorGUILayout.LabelField("NPCID", guiSkin.customStyles[0], GUILayout.Height(22), GUILayout.Width(60)); |
| | | var _npcID = monsterList[i].npcID; |
| | | monsterList[i].npcID = EditorGUILayout.IntField(monsterList[i].npcID, guiSkin.textField, GUILayout.Height(20)); |
| | | if (_npcID != monsterList[i].npcID) |
| | | { |
| | | monsterList[i].name = monsterList[i].npcID + "_RefreshNPC"; |
| | | } |
| | | EditorGUILayout.LabelField("NPCID", guiSkin.customStyles[0], GUILayout.Height(22), GUILayout.Width(50)); |
| | | EditorGUILayout.LabelField(monsterList[i].npcID.ToString(), guiSkin.textField, GUILayout.Height(20)); |
| | | EditorGUILayout.LabelField("模型名", guiSkin.customStyles[0], GUILayout.Height(22), GUILayout.Width(50)); |
| | | EditorGUILayout.LabelField(monsterList[i].resName, guiSkin.textField, GUILayout.Height(22), GUILayout.Width(70)); |
| | | if (GUILayout.Button("定高", guiSkin.button, GUILayout.Width(60), GUILayout.Height(20))) |
| | | { |
| | | Vector3 _pos = monsterList[i].transform.position; |
| | |
| | | EditorGUILayout.EndVertical(); |
| | | return _result; |
| | | } |
| | | |
| | | private Bhv_MonsterData CreateNPC(int id, string name) |
| | | { |
| | | if (id <= 0) |
| | | { |
| | | Debug.Log("NPCID非法"); |
| | | return null; |
| | | } |
| | | |
| | | if (string.IsNullOrEmpty(name.Trim())) |
| | | { |
| | | Debug.Log("模型名不应该为空"); |
| | | return null; |
| | | } |
| | | |
| | | string _path = "Assets/ResourcesOut/Mob/Prefab_Race_" + name + ".prefab"; |
| | | var _obj = AssetDatabase.LoadAssetAtPath<GameObject>(_path); |
| | | if (!_obj) |
| | | { |
| | | Debug.LogError("所要创建的资源不存在: " + _path); |
| | | return null; |
| | | } |
| | | |
| | | _obj = Instantiate(_obj); |
| | | |
| | | RaycastHit _hit; |
| | | Ray _ray = SceneView.lastActiveSceneView.camera.ViewportPointToRay(new Vector3(.5f, .5f, 0)); |
| | | if (Physics.Raycast(_ray, out _hit, 1000f, LayerUtility.WalkbleMask)) |
| | | { |
| | | _obj.transform.position = _hit.point; |
| | | } |
| | | _obj.transform.SetParent(transform); |
| | | _obj.transform.eulerAngles = Vector3.zero; |
| | | _obj.transform.localScale = Vector3.one; |
| | | |
| | | var _monsterData = _obj.AddComponent<Bhv_MonsterData>(); |
| | | _monsterData.npcID = id; |
| | | _monsterData.resName = name; |
| | | |
| | | return _monsterData; |
| | | } |
| | | #endif |
| | | } |
| | | } |
| | |
| | | _sceneObjData.resName = sceneName; |
| | | RaycastHit _hit; |
| | | Ray _ray = SceneView.lastActiveSceneView.camera.ViewportPointToRay(new Vector3(.5f, .5f, 0)); |
| | | if (Physics.Raycast(_ray, out _hit, 1000f, LayerUtility.WalkbleMask)) |
| | | if (Physics.Raycast(_ray, out _hit, 10000f, LayerUtility.WalkbleMask)) |
| | | { |
| | | _sceneObjData.transform.position = _hit.point; |
| | | } |
| | |
| | | [HideInInspector] |
| | | public int prevID = -1; |
| | | [HideInInspector] |
| | | public int nextID = -1; |
| | | [HideInInspector] |
| | | public List<int> eventIDList = new List<int>(); |
| | | |
| | | #if UNITY_EDITOR |
| | |
| | | bw.Write((byte)triggerType); |
| | | bw.Write((byte)type); |
| | | bw.Write(prevID); |
| | | bw.Write(nextID); |
| | | bw.Write((float)System.Math.Round(transform.position.x, 2)); |
| | | bw.Write((float)System.Math.Round(transform.position.y, 2)); |
| | | bw.Write((float)System.Math.Round(transform.position.z, 2)); |
| | |
| | | triggerType = (MapTrigger.E_TriggerType)br.ReadByte(); |
| | | type = (Evt.E_EventType)br.ReadByte(); |
| | | prevID = br.ReadInt32(); |
| | | nextID = br.ReadInt32(); |
| | | float _pX = br.ReadSingle(); |
| | | float _pY = br.ReadSingle(); |
| | | float _pZ = br.ReadSingle(); |
| | |
| | | if (showDetail) |
| | | { |
| | | EditorGUILayout.BeginHorizontal(GUILayout.Height(22)); |
| | | EditorGUILayout.LabelField("前置触发器", guiSkin.customStyles[0], GUILayout.Height(22), GUILayout.Width(80)); |
| | | prevID = EditorGUILayout.IntField(prevID, guiSkin.textField, GUILayout.Height(20)); |
| | | EditorGUILayout.LabelField("触发器类型", guiSkin.customStyles[0], GUILayout.Height(22), GUILayout.Width(80)); |
| | | triggerType = (MapTrigger.E_TriggerType)EditorGUILayout.EnumPopup(triggerType, guiSkin.customStyles[1], GUILayout.Height(20), GUILayout.Width(100)); |
| | | if (triggerType != MapTrigger.E_TriggerType.EnterStage) |
| | | { |
| | | var _descript = string.Empty; |
| | | if (triggerType == MapTrigger.E_TriggerType.Trigger) |
| | | { |
| | | _descript = "前置ID"; |
| | | } |
| | | else if (triggerType == MapTrigger.E_TriggerType.Mission) |
| | | { |
| | | _descript = "任务ID"; |
| | | } |
| | | EditorGUILayout.LabelField(_descript, guiSkin.customStyles[0], GUILayout.Height(22), GUILayout.Width(55)); |
| | | prevID = EditorGUILayout.IntField(prevID, guiSkin.textField, GUILayout.Height(20)); |
| | | } |
| | | EditorGUILayout.LabelField("结束触发", guiSkin.customStyles[0], GUILayout.Height(22), GUILayout.Width(55)); |
| | | nextID = EditorGUILayout.IntField(nextID, guiSkin.textField, GUILayout.Height(20)); |
| | | EditorGUILayout.EndHorizontal(); |
| | | |
| | | EditorGUILayout.BeginVertical(guiSkin.customStyles[1]); |
| | |
| | | [HideInInspector] |
| | | public int npcID; |
| | | [HideInInspector] |
| | | public string resName; |
| | | [HideInInspector] |
| | | public byte ai; |
| | | |
| | | #if UNITY_EDITOR |
| | |
| | | public void Save(BinaryWriter bw) |
| | | { |
| | | bw.Write(npcID); |
| | | bw.Write(resName); |
| | | bw.Write(ai); |
| | | bw.Write((float)System.Math.Round(transform.position.x, 2)); |
| | | bw.Write((float)System.Math.Round(transform.position.y, 2)); |
| | |
| | | public void Load(BinaryReader br) |
| | | { |
| | | npcID = br.ReadInt32(); |
| | | resName = br.ReadString(); |
| | | ai = br.ReadByte(); |
| | | float _x = br.ReadSingle(); |
| | | float _y = br.ReadSingle(); |
| | |
| | | |
| | | public void Export(BinaryWriter bw) |
| | | { |
| | | Save(bw); |
| | | bw.Write(npcID); |
| | | bw.Write(ai); |
| | | bw.Write((float)System.Math.Round(transform.position.x, 2)); |
| | | bw.Write((float)System.Math.Round(transform.position.y, 2)); |
| | | bw.Write((float)System.Math.Round(transform.position.z, 2)); |
| | | } |
| | | |
| | | #endif |
| | |
| | | { |
| | | public enum E_OverCondition |
| | | { |
| | | None, |
| | | DeadCount, |
| | | Time, |
| | | } |
| | |
| | | } |
| | | |
| | | public MonsterData[] monsters; |
| | | public E_OverCondition overCondition = E_OverCondition.None; |
| | | public E_OverCondition overCondition = E_OverCondition.DeadCount; |
| | | public E_RefreshType refreshType = E_RefreshType.All; |
| | | /// <summary> |
| | | /// 参数 |
| | |
| | | /// <para>刷新类型: OneByOneTime, 作为时间(毫秒)</para> |
| | | /// </summary> |
| | | public int refreshParam; |
| | | public int nextEventID = -1; |
| | | |
| | | public override void Load(BinaryReader br) |
| | | { |
| | |
| | | refreshType = (Evt_RefreshMonster.E_RefreshType)br.ReadByte(); |
| | | refreshParam = br.ReadInt32(); |
| | | conditionParam = br.ReadInt32(); |
| | | nextEventID = br.ReadInt32(); |
| | | int _count = br.ReadInt32(); |
| | | monsters = new MonsterData[_count]; |
| | | for (int i = 0; i < _count; ++i) |
| | |
| | | public enum E_TriggerType |
| | | { |
| | | Trigger, |
| | | EnterStage |
| | | EnterStage, |
| | | Mission, |
| | | } |
| | | |
| | | public Evt.E_EventType type; |
| | |
| | | _root.AddComponent<MeshCollider>(); |
| | | _root.transform.position = _go.transform.position; |
| | | _root.transform.rotation = _go.transform.rotation; |
| | | _root.layer = LayerUtility.Walkble; |
| | | break; |
| | | } |
| | | } |
| | |
| | | _movementVector.Normalize();
|
| | | if (_hero != null)
|
| | | {
|
| | | _hero.destForward = _movementVector;
|
| | | if (IsMoveValid())
|
| | | {
|
| | | _hero.destForward = _movementVector;
|
| | | if (!_hero.SkillMgr.DoingPrepareSkill
|
| | | && (_hero.SkillMgr.CurCastSkill == null
|
| | | || _hero.SkillMgr.CurCastSkill.SkillCompelete))
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | public Vector3 GetCloseTransPoint(Vector3 pos)
|
| | | {
|
| | | // 遍历找到离给定点最近并且可寻路至的传送点 P
|
| | | // 找到 P点的 另一端 P1
|
| | | // 判断当前传入的点是否可以寻路至 P1
|
| | | // 不行的话重新寻找 可以的话返回 P1 的坐标
|
| | | float _compareDis;
|
| | | float _dis;
|
| | |
|
| | | foreach (var _p in m_TransferGroupList)
|
| | | {
|
| | |
|
| | | }
|
| | |
|
| | | return Vector3.zero;
|
| | | }
|
| | |
|
| | | private void SceneResourceReplace10010()
|
| | | {
|
| | | for (var i = 100101; i <= 100109; i++)
|
| | |
| | | private int m_CurrentIndex; |
| | | private byte m_Step; |
| | | private int targetPoint; |
| | | private int startPoint; |
| | | private List<SFXController> m_EffectList = new List<SFXController>(); |
| | | |
| | | public TransferGroup(H2Engine.MapTrasfer data) |
| | |
| | | private Vector3 m_StartPos; |
| | | private bool isPositive = true; |
| | | |
| | | private SFXController m_FlyingEffect; |
| | | |
| | | public void Update() |
| | | { |
| | | if (m_Data.transferPoints == null |
| | |
| | | _distance = MathUtility.DistanceSqrtXZ(_hero.Pos, _p.position); |
| | | if (_distance < _p.radius * _p.radius) |
| | | { |
| | | m_Step = 1; |
| | | m_InCreaseTime = 0; |
| | | _hero.Pos = m_StartPos = m_Data.transferPoints[i].position; |
| | | m_Step = 11; |
| | | GA_Hero.s_MapSwitching = true; |
| | | _hero.StopPathFind(); |
| | | startPoint = i; |
| | | if (i == 0) |
| | | { |
| | | isPositive = true; |
| | |
| | | targetPoint = i - 1; |
| | | isPositive = false; |
| | | } |
| | | if (!_hero.IsRun()) |
| | | { |
| | | _hero.RunImmediate(); |
| | | } |
| | | break; |
| | | } |
| | | } |
| | | break; |
| | | case 11: |
| | | _p = m_Data.transferPoints[startPoint]; |
| | | var _dir = MathUtility.ForwardXZ(_p.position, _hero.Pos); |
| | | _hero.Pos += _hero.ActorInfo.moveSpeed * Time.deltaTime * _dir; |
| | | _hero.destForward = _hero.Forward = _dir; |
| | | _distance = MathUtility.DistanceSqrtXZ(_p.position, _hero.Pos); |
| | | _hero.Run(); |
| | | if (_distance < 0.01f) |
| | | { |
| | | _hero.Pos = m_StartPos = m_Data.transferPoints[startPoint].position; |
| | | m_Step = 1; |
| | | m_InCreaseTime = 0; |
| | | m_FlyingEffect = SFXPlayUtility.Instance.PlayBattleEffect(1180, _hero); |
| | | _hero.Idle(); |
| | | _hero.SwitchHeadNameBindNode(true); |
| | | } |
| | | break; |
| | | case 1: |
| | |
| | | m_Data.transferPoints.Length, |
| | | targetPoint); |
| | | m_Step = 0; |
| | | GA_Hero.s_MapSwitching = false; |
| | | } |
| | | else |
| | | { |
| | |
| | | DTC0428_tagPlayerRideHorse.Send_tagPlayerRideHorse(false); |
| | | _hero.Play(GAStaticDefine.State_Fly); |
| | | _hero.Idle(); |
| | | CameraController.Instance.LookAtTarget = _hero.Root.GetChildTransformDeeply("Bip001"); |
| | | } |
| | | } |
| | | else |
| | |
| | | break; |
| | | case 2:// 执行坐标改变 |
| | | _p = m_Data.transferPoints[targetPoint]; |
| | | _hero.Forward = MathUtility.ForwardXZ(_p.position, _hero.Pos); |
| | | _hero.destForward = _hero.Forward = MathUtility.ForwardXZ(_p.position, _hero.Pos); |
| | | m_InCreaseTime += .5f * Time.deltaTime; |
| | | _hero.Pos = Vector3.Lerp(m_StartPos, _p.position, m_InCreaseTime); |
| | | _distance = MathUtility.DistanceSqrtXZ(_hero.Pos, _p.position); |
| | |
| | | { |
| | | m_Step = 3; |
| | | GA_Hero.s_MapSwitching = false; |
| | | if (m_FlyingEffect) |
| | | { |
| | | SFXPlayUtility.Instance.Release(m_FlyingEffect); |
| | | m_FlyingEffect = null; |
| | | } |
| | | _hero.SwitchHeadNameBindNode(false); |
| | | _hero.StopPathFind(); |
| | | CameraController.Instance.LookAtTarget = _hero.Root; |
| | | } |
| | | } |
| | | break; |
| | |
| | | SFXPlayUtility.Instance.Release(_effect); |
| | | } |
| | | m_EffectList.Clear(); |
| | | |
| | | if (m_FlyingEffect) |
| | | { |
| | | SFXPlayUtility.Instance.Release(m_FlyingEffect); |
| | | m_FlyingEffect = null; |
| | | } |
| | | |
| | | m_Data = null; |
| | | } |
| | | } |
| | |
| | | [SerializeField] Image m_PotentialIcon;
|
| | | [SerializeField] Button m_Func;
|
| | | [SerializeField] RedpointBehaviour m_Redpoint;
|
| | | [SerializeField] UIEffect m_UnlockEffect;
|
| | |
|
| | | int skillId = 0;
|
| | |
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | public void StartUnlock()
|
| | | {
|
| | | m_UnlockEffect.Play();
|
| | | }
|
| | |
|
| | | public void StopUnlock()
|
| | | {
|
| | | m_UnlockEffect.StopImediatly();
|
| | | }
|
| | |
|
| | | private void OnFunc()
|
| | | {
|
| | | bool isOpen = model.IsPotentialUnlock(skillId);
|
| | |
| | | [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()
|
| | |
| | | {
|
| | | 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()
|
| | |
| | | if (selectPotentialId == id)
|
| | | {
|
| | | Display();
|
| | | m_LevelUpEffect.Play();
|
| | | }
|
| | | }
|
| | |
|
| | |
| | |
|
| | | if (!isMax)
|
| | | {
|
| | | var requireSkillConfig = SkillConfig.Get(config.LearnSkillReq);
|
| | | TreasurePotential requirePotential;
|
| | | if (model.TryGetPotential(config.LearnSkillReq, out requirePotential))
|
| | | {
|
| | | m_Item.SetItem(config.ExAttr4, config.ExAttr5);
|
| | | }
|
| | | m_Item.SetItem(config.ExAttr4, config.ExAttr5);
|
| | | }
|
| | | }
|
| | |
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | private void RefreshItemCountEvent(PackType packType, int arg2, int itemId)
|
| | | {
|
| | | if (packType == PackType.Item && model.skillLevelUpItems.Contains(itemId))
|
| | | {
|
| | | Display();
|
| | | }
|
| | | }
|
| | |
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | var treasureId = treasureModel.GetTreasureBySkillId(skillId);
|
| | |
|
| | | var isSkillUnlock = false;
|
| | |
|
| | | Treasure treasure;
|
| | | if (treasureModel.TryGetTreasure(treasureId, out treasure))
|
| | | TreasureSkill treasureSkill;
|
| | | if (model.TryGetSkill(skillId, out treasureSkill))
|
| | | {
|
| | | isSkillUnlock = treasure.state == TreasureState.Collected;
|
| | | isSkillUnlock = treasureSkill.level > 0;
|
| | | m_SkillLevel.text = StringUtility.Contact("LV.", treasureSkill.level);
|
| | | m_Redpoint.redpointId = treasureSkill.redpoint.id;
|
| | | }
|
| | |
|
| | | m_ContainerLock.gameObject.SetActive(!isSkillUnlock);
|
| | |
| | | m_ContainerSelect.gameObject.SetActive(skillId == model.selectSkill);
|
| | | m_SkillLevel.gameObject.SetActive(isSkillUnlock);
|
| | |
|
| | | TreasureSkill treasureSkill;
|
| | | if (model.TryGetSkill(skillId, out treasureSkill))
|
| | | {
|
| | | m_SkillLevel.text = StringUtility.Contact("LV.", treasureSkill.level);
|
| | | m_Redpoint.redpointId = treasureSkill.redpoint.id;
|
| | | }
|
| | | |
| | | }
|
| | |
|
| | | void DisplayBase()
|
| | |
| | | {
|
| | | Dictionary<int, TreasureSkill> treasureSkills = new Dictionary<int, TreasureSkill>();
|
| | | Dictionary<int, List<int>> jobTreasureSkills = new Dictionary<int, List<int>>();
|
| | | List<int> skillLevelUpItems = new List<int>();
|
| | |
|
| | | public List<int> skillLevelUpItems = new List<int>();
|
| | |
|
| | | int m_SelectSkill;
|
| | | public int selectSkill
|
| | |
| | |
|
| | | foreach (var potential in skill.potentials)
|
| | | {
|
| | | if (requireRemind && funcOpen &&
|
| | | if (requireRemind && funcOpen && IsPotentialUnlock(potential.id) &&
|
| | | TryLevelUpPotential(potential.id, out error)
|
| | | && skill.level > 0)
|
| | | {
|
| | |
| | | [SerializeField] Button m_GetWay;
|
| | | [SerializeField] Button m_LevelUp;
|
| | | [SerializeField] RedpointBehaviour m_LevelRedpoint;
|
| | | [SerializeField] UIEffect m_LevelUpEffect;
|
| | | [SerializeField] Transform m_ContainerMax;
|
| | | [SerializeField] TreasurePotentialBehaviour[] m_TreasurePotentials;
|
| | |
|
| | | List<Clock> clocks = new List<Clock>();
|
| | |
|
| | | TreasureSkillModel model
|
| | | {
|
| | | get { return ModelCenter.Instance.GetModel<TreasureSkillModel>(); }
|
| | | }
|
| | |
|
| | | PackModel packModel
|
| | | {
|
| | | get { return ModelCenter.Instance.GetModel<PackModel>(); }
|
| | | }
|
| | |
|
| | | #region Built-in
|
| | |
| | | model.treasureSkillRefresh += TreasureSkillRefresh;
|
| | | model.selectRefresh += SelectRefresh;
|
| | | model.skillLevelUpRefresh += SkillLevelUpRefresh;
|
| | | packModel.refreshItemCountEvent += RefreshItemCountEvent;
|
| | | }
|
| | |
|
| | | protected override void OnAfterOpen()
|
| | |
| | | model.treasureSkillRefresh -= TreasureSkillRefresh;
|
| | | model.selectRefresh -= SelectRefresh;
|
| | | model.skillLevelUpRefresh -= SkillLevelUpRefresh;
|
| | | packModel.refreshItemCountEvent -= RefreshItemCountEvent;
|
| | | model.SetAlreadyRemind();
|
| | |
|
| | | for (int i = 0; i < m_TreasurePotentials.Length; i++)
|
| | | {
|
| | | m_TreasurePotentials[i].StopUnlock();
|
| | | }
|
| | | foreach (var clock in clocks)
|
| | | {
|
| | | clock.Stop();
|
| | | }
|
| | | clocks.Clear();
|
| | | }
|
| | |
|
| | | protected override void OnAfterClose()
|
| | |
| | | {
|
| | | DisplaySkills();
|
| | | DisplaySkillDetial();
|
| | | DisplayPotentials();
|
| | | }
|
| | |
|
| | | private void DisplaySkills()
|
| | |
| | | WindowJumpMgr.Instance.WindowJumpTo(JumpUIType.Daily_EmperorRelic);
|
| | | });
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | for (int i = 0; i < m_TreasurePotentials.Length; i++)
|
| | | {
|
| | | if (i < skill.potentials.Count)
|
| | | {
|
| | | m_TreasurePotentials[i].gameObject.SetActive(true);
|
| | | m_TreasurePotentials[i].Display(skill.potentials[i].id);
|
| | | }
|
| | | else
|
| | | {
|
| | | m_TreasurePotentials[i].gameObject.SetActive(false);
|
| | | }
|
| | | }
|
| | | private void DisplayPotentials()
|
| | | {
|
| | | for (int i = 0; i < m_TreasurePotentials.Length; i++)
|
| | | {
|
| | | DisplayPotential(i);
|
| | | }
|
| | | }
|
| | |
|
| | | private void DisplayPotential(int index)
|
| | | {
|
| | | TreasureSkill skill;
|
| | | if (!model.TryGetSkill(model.selectSkill, out skill))
|
| | | {
|
| | | return;
|
| | | }
|
| | | if (index < m_TreasurePotentials.Length)
|
| | | {
|
| | | m_TreasurePotentials[index].gameObject.SetActive(index < skill.potentials.Count);
|
| | | m_TreasurePotentials[index].Display(skill.potentials[index].id);
|
| | | }
|
| | | }
|
| | |
|
| | |
| | |
|
| | | private void SelectRefresh()
|
| | | {
|
| | | for (int i = 0; i < m_TreasurePotentials.Length; i++)
|
| | | {
|
| | | m_TreasurePotentials[i].StopUnlock();
|
| | | }
|
| | | foreach (var clock in clocks)
|
| | | {
|
| | | clock.Stop();
|
| | | }
|
| | | clocks.Clear();
|
| | | m_Controller.m_Scorller.RefreshActiveCellViews();
|
| | | DisplaySkillDetial();
|
| | | DisplayPotentials();
|
| | | }
|
| | |
|
| | | private void SkillLevelUpRefresh(int id)
|
| | |
| | | {
|
| | | m_Controller.m_Scorller.RefreshActiveCellViews();
|
| | | DisplaySkillDetial();
|
| | |
|
| | | m_LevelUpEffect.Play();
|
| | |
|
| | | TreasureSkill skill;
|
| | | if (model.TryGetSkill(model.selectSkill, out skill))
|
| | | {
|
| | | for (int i = 0; i < skill.potentials.Count; i++)
|
| | | {
|
| | | var index = i;
|
| | | if (index < m_TreasurePotentials.Length &&
|
| | | skill.potentials[index].openLevel == skill.level)
|
| | | {
|
| | | m_TreasurePotentials[index].StartUnlock();
|
| | | Clock clock = null;
|
| | | clock = Clock.Create(1, () =>
|
| | | {
|
| | | DisplayPotential(index);
|
| | | if (clock != null && clocks.Contains(clock))
|
| | | {
|
| | | clocks.Remove(clock);
|
| | | }
|
| | | });
|
| | | clocks.Add(clock);
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | | else
|
| | | {
|
| | | var skillId = 0;
|
| | | if (model.ContainsSkill(id, out skillId))
|
| | | {
|
| | | if (skillId == model.selectSkill)
|
| | | {
|
| | | DisplayPotentials();
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | private void RefreshItemCountEvent(PackType packType, int arg2, int itemId)
|
| | | {
|
| | | if (packType == PackType.Item && model.skillLevelUpItems.Contains(itemId))
|
| | | {
|
| | | DisplaySkillDetial();
|
| | | }
|
| | | }
|
| | | }
|