少年修仙传客户端代码仓库
client_Wu Xijin
2018-08-14 57923ab6ebf227a0611540c5d2d66b2ae8b5d403
2492 【前端】小地图界面分线,支持更多线
3个文件已修改
2个文件已添加
105 ■■■■ 已修改文件
System/WorldMap/LocalMapWin.cs 16 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/WorldMap/MapLineBehaviour.cs 25 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
UI/Common/CyclicScroll.cs 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
UI/Common/DynamicCyclicScroll.cs 44 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
UI/Common/DynamicCyclicScroll.cs.meta 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/WorldMap/LocalMapWin.cs
@@ -19,7 +19,7 @@
        [SerializeField] ToggleButton m_MapLineSwitch;
        [SerializeField] Transform m_MapLineContainer;
        [SerializeField] Text m_CurrentLine;
        [SerializeField] MapLineBehaviour[] m_MapLineBehaviours;
        [SerializeField] DynamicCyclicScroll m_LinesScroll;
        [SerializeField] Button m_WorldMap;
        [SerializeField] Button m_Close;
@@ -210,19 +210,7 @@
            m_MapLineContainer.gameObject.SetActive(true);
            m_MapLineSwitch.isOn = true;
            for (int i = 0; i < m_MapLineBehaviours.Length; i++)
            {
                var behaviour = m_MapLineBehaviours[i];
                if (i < _mapLines.Count)
                {
                    behaviour.gameObject.SetActive(true);
                    behaviour.Display(i, m_MapLineContainer);
                }
                else
                {
                    behaviour.gameObject.SetActive(false);
                }
            }
            m_LinesScroll.Init(_mapLines);
        }
        private void CheckAchievementGuide()
System/WorldMap/MapLineBehaviour.cs
@@ -9,22 +9,26 @@
namespace Snxxz.UI
{
    public class MapLineBehaviour : MonoBehaviour
    public class MapLineBehaviour : ScrollItem
    {
        [SerializeField] Button m_Select;
        [SerializeField] Text m_Title;
        MapModel m_Model;
        MapModel model { get { return m_Model ?? (m_Model = ModelCenter.Instance.GetModel<MapModel>()); } }
        MapModel model { get { return ModelCenter.Instance.GetModel<MapModel>(); } }
        int lineId = 0;
        Transform m_ContainerLines;
        MapLine line;
        public void Display(int _lineId, Transform _parent)
        public override void Display(object _data)
        {
            lineId = _lineId;
            m_Title.text = Language.Get("line", _lineId + 1);
            m_ContainerLines = _parent;
            base.Display(_data);
            line = (MapLine)_data;
            m_Title.text = Language.Get("line", line.lineIndex);
        }
        public override void Dispose()
        {
            base.Dispose();
        }
        private void Awake()
@@ -34,8 +38,7 @@
        private void SelectLine()
        {
            m_ContainerLines.gameObject.SetActive(false);
            model.RequestSelectedLine(lineId);
            model.RequestSelectedLine(line.lineIndex - 1);
            WindowCenter.Instance.Close<WorldMapWin>();
            WindowCenter.Instance.Close<LocalMapWin>();
UI/Common/CyclicScroll.cs
@@ -12,13 +12,13 @@
        get { return m_Content; }
    }
    [SerializeField] BoundOffset m_BoundOffset;
    [SerializeField] Vector2 m_CellSize = new Vector2(100, 100);
    [SerializeField] protected BoundOffset m_BoundOffset;
    [SerializeField] protected Vector2 m_CellSize = new Vector2(100, 100);
    public Vector2 cellSize {
        get { return m_CellSize; }
    }
    [SerializeField] Vector2 m_Spacing;
    [SerializeField] protected Vector2 m_Spacing;
    public Vector2 spacing {
        get { return m_Spacing; }
    }
@@ -157,7 +157,7 @@
        get; set;
    }
    public virtual void Init<T>(List<T> _datas, bool _stepByStep = false)
    public virtual void Init<T>( List<T> _datas, bool _stepByStep = false)
    {
        if (_datas == null)
        {
UI/Common/DynamicCyclicScroll.cs
New file
@@ -0,0 +1,44 @@
//--------------------------------------------------------
//    [Author]:           第二世界
//    [  Date ]:           Tuesday, August 14, 2018
//--------------------------------------------------------
using UnityEngine;
using System.Collections;
using UnityEngine.UI;
using System.Collections.Generic;
namespace Snxxz.UI
{
    public class DynamicCyclicScroll : CyclicScroll
    {
        [SerializeField] int m_MaxDynamicElements;
        public override void Init<T>(List<T> _datas, bool _stepByStep = false)
        {
            var maxCount = Mathf.Min(m_MaxDynamicElements, _datas.Count);
            var beyond = _datas.Count > m_MaxDynamicElements;
            switch (align)
            {
                case Align.Bottom:
                case Align.Top:
                    var height = m_BoundOffset.top + m_BoundOffset.bottom + maxCount * m_CellSize.y + (maxCount - 1) * m_Spacing.y + (beyond ? m_CellSize.y * 0.5f : 0f);
                    rectTransform.sizeDelta = rectTransform.sizeDelta.SetY(height);
                    break;
                case Align.Left:
                case Align.Right:
                    var width = m_BoundOffset.left + m_BoundOffset.right + maxCount * m_CellSize.x + (maxCount - 1) * m_Spacing.x + (beyond ? m_CellSize.x * 0.5f : 0f);
                    rectTransform.sizeDelta = rectTransform.sizeDelta.SetX(width);
                    break;
            }
            this.enabled = beyond;
            base.Init(_datas, _stepByStep);
        }
    }
}
UI/Common/DynamicCyclicScroll.cs.meta
New file
@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 0e6d0c1b00a0f8d46998042f6368a2a8
timeCreated: 1534227370
licenseType: Pro
MonoImporter:
  serializedVersion: 2
  defaultReferences: []
  executionOrder: 0
  icon: {instanceID: 0}
  userData:
  assetBundleName:
  assetBundleVariant: