少年修仙传客户端代码仓库
client_linchunjie
2019-03-04 2a86bfa84ad4ed870703022ea765e29f16d25a08
System/Skill/TalentTreeScriptable.cs
@@ -19,6 +19,16 @@
            get { return m_ContentSizeDelta; }
        }
        public int arrowCount
        {
            get { return arrowElements == null ? 0 : arrowElements.Count; }
        }
        public int skillCount
        {
            get { return skillElements == null ? 0 : skillElements.Count; }
        }
        public TalentElement GetTalentElement(int index)
        {
            if (skillElements != null && index < skillElements.Count)
@@ -26,6 +36,15 @@
                return skillElements[index];
            }
            return default(TalentElement);
        }
        public ArrowElement GetArrowElement(int index)
        {
            if (arrowElements != null && index < arrowElements.Count)
            {
                return arrowElements[index];
            }
            return default(ArrowElement);
        }
        public float GetPercentBySkillElement(int index, float viewHeight, float offset)
@@ -43,27 +62,60 @@
#if UNITY_EDITOR
        public void ApplyTalentElement(int index,Vector3 _position)
        {
            if (skillElements == null)
            {
                skillElements = new List<TalentElement>();
            }
            var element = new TalentElement()
            {
                position = _position,
            };
            if (index >= skillElements.Count)
            {
                skillElements.Add(new TalentElement()
                {
                    position = _position,
                });
                skillElements.Add(element);
            }
            else
            {
                skillElements[index] = new TalentElement()
                {
                    position = _position,
                };
                skillElements[index] = element;
            }
        }
        public void SyncElementsCount(int count)
        public void SyncTalentElementsCount(int count)
        {
            if (count < skillElements.Count)
            {
                skillElements.RemoveRange(count, skillElements.Count - count);
            }
        }
        public void ApplyArrowElement(int index, Vector3 _position, Vector2 _sizeDelta, Vector3 _rotation, string _iconKey)
        {
            if (arrowElements == null)
            {
                arrowElements = new List<ArrowElement>();
            }
            var element = new ArrowElement()
            {
                position = _position,
                sizeDelta = _sizeDelta,
                rotation = _rotation,
                iconKey = _iconKey,
            };
            if (index >= arrowElements.Count)
            {
                arrowElements.Add(element);
            }
            else
            {
                arrowElements[index] = element;
            }
        }
        public void SyncArrowElementsCount(int count)
        {
            if (count < arrowElements.Count)
            {
                arrowElements.RemoveRange(count, arrowElements.Count - count);
            }
        }
#endif
@@ -122,6 +174,7 @@
        [Serializable]
        public struct ArrowElement
        {
            public string iconKey;
            public Vector3 position;
            public Vector3 rotation;
            public Vector2 sizeDelta;