| //-------------------------------------------------------- | 
| //    [Author]:           玩个游戏 | 
| //    [  Date ]:           Wednesday, January 10, 2018 | 
| //-------------------------------------------------------- | 
| using UnityEngine; | 
| using System.Collections; | 
| using UnityEngine.UI; | 
|   | 
|   | 
| public class ServerGroupToggle : ScrollItem | 
| { | 
|     [SerializeField] Toggle m_Toggle; | 
|     public Toggle toggle { get { return m_Toggle; } } | 
|     [SerializeField] Text m_Title; | 
|     // [SerializeField] FontColorSizeConfig m_FontColor; | 
|   | 
|     int startIndex = 0; | 
|     int count = 0; | 
|   | 
|     string groupName; | 
|   | 
|     public override void Display(object _data) | 
|     { | 
|         base.Display(_data); | 
|   | 
|         groupName = (string)_data; | 
|         m_Title.text = groupName; | 
|   | 
|         m_Toggle.isOn = groupName == ServerListCenter.Instance.currentServerGroup; | 
|         // m_Title.color = m_FontColor.GetColorSize(m_Toggle.isOn ? "Selected" : "Normal").color; | 
|   | 
|         m_Toggle.RemoveAllListeners(); | 
|         m_Toggle.AddListener(OnSelected); | 
|     } | 
|   | 
|     public override void Dispose() | 
|     { | 
|         base.Dispose(); | 
|     } | 
|   | 
|     private void OnSelected(bool _value) | 
|     { | 
|         // m_Title.color = m_FontColor.GetColorSize(_value ? "Selected" : "Normal").color; | 
|         if (_value) | 
|         { | 
|             ServerListCenter.Instance.currentServerGroup = groupName; | 
|         } | 
|     } | 
| } |