//-------------------------------------------------------- // [Author]: 第二世界 // [ Date ]: Monday, October 16, 2017 //-------------------------------------------------------- using UnityEngine; using System.Collections; using UnityEngine.UI; using TableConfig; namespace Snxxz.UI { public class TeamBriefInfoBehaviour : ScrollItem { [SerializeField] Image m_Realm; [SerializeField] Text m_PlayerName; [SerializeField] Text m_MemberCount; [SerializeField] Image m_LevelMinSign; [SerializeField] Text m_LevelMin; [SerializeField] Image m_LevelMaxSign; [SerializeField] Text m_LevelMax; [SerializeField] Button m_ApplyFor; TheirTeam teamInfo; TeamModel m_Model; TeamModel model { get { return m_Model ?? (m_Model = ModelCenter.Instance.GetModel()); } } public override void Display(object _data) { base.Display(_data); teamInfo = (TheirTeam)_data; m_PlayerName.text = teamInfo.captainerName; m_MemberCount.text = teamInfo.memberCount.ToString(); m_Realm.gameObject.SetActive(teamInfo.realm > 0); if (teamInfo.realm > 0) { var realmConfig = Config.Instance.Get(teamInfo.realm); if (realmConfig != null) { m_Realm.SetSprite(realmConfig.Img); } } m_ApplyFor.gameObject.SetActive(!(model.myTeam.inTeam && model.myTeam.GetIndexOfMember(teamInfo.captainer) != -1)); var isMinPickLevel = teamInfo.levelMin >= GeneralConfig.Instance.greatMasterStartLV; m_LevelMinSign.gameObject.SetActive(isMinPickLevel); m_LevelMin.text = (isMinPickLevel ? (teamInfo.levelMin - GeneralConfig.Instance.greatMasterStartLV) : teamInfo.levelMin).ToString(); var isMaxPickLevel = teamInfo.levelMax >= GeneralConfig.Instance.greatMasterStartLV; m_LevelMaxSign.gameObject.SetActive(isMaxPickLevel); m_LevelMax.text = (isMaxPickLevel ? (teamInfo.levelMax - GeneralConfig.Instance.greatMasterStartLV) : teamInfo.levelMax).ToString(); } public override void Dispose() { base.Dispose(); } private void Awake() { if (m_ApplyFor != null) { m_ApplyFor.AddListener(ApplyForJoin); } } private void ApplyForJoin() { if (model.myTeam.inTeam) { ConfirmCancel.ShowPopConfirm( "", Language.Get("PlayerJoinTeam_1"), (bool _ok) => { if (_ok) { model.RequestExitTeam(); model.RequestApplyForJoin(teamInfo.captainer); } } ); } else { model.RequestApplyForJoin(teamInfo.captainer); } } } }