79 lines
2.2 KiB
C#
79 lines
2.2 KiB
C#
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
using System.Collections;
|
|
using Games.GlobeDefine;
|
|
using GCGame.Table;
|
|
|
|
public class TeamCreateInfoItem : UIItemBase
|
|
{
|
|
#region
|
|
|
|
public Image _CapterIcon;
|
|
public Text _CapterName;
|
|
public Text _CapterLv;
|
|
public Image _CapterPro;
|
|
public Text _TeamMemCount;
|
|
public Slider _TeamMemPro;
|
|
public Text _TeamDirect;
|
|
public Button _BtnApply;
|
|
|
|
private TeamInfo _TeamInfo;
|
|
private bool _CG_REQ_TEAM_JOINSend = true;
|
|
#endregion
|
|
|
|
public override void Show(Hashtable hash)
|
|
{
|
|
base.Show();
|
|
|
|
var teamInfo = (TeamInfo)hash["InitObj"];
|
|
InitTeamInfo(teamInfo);
|
|
}
|
|
|
|
private void InitTeamInfo(TeamInfo teamInfo)
|
|
{
|
|
if (teamInfo == null)
|
|
return;
|
|
|
|
_TeamInfo = teamInfo;
|
|
|
|
LoadAssetBundle.Instance.SetImageSprite(_CapterIcon, GCGame.Utils.GetProfessionSpriteName(teamInfo.Profession));
|
|
LoadAssetBundle.Instance.SetImageSprite(_CapterPro, GCGame.Utils.GetProfessionIconName((CharacterDefine.PROFESSION)teamInfo.Profession));
|
|
_CapterName.text = _TeamInfo.Name;
|
|
_CapterLv.text = _TeamInfo.Level.ToString();
|
|
_TeamMemCount.text = _TeamInfo.MemberNum + " / 5";
|
|
_TeamMemPro.value = _TeamInfo.MemberNum / 5.0f;
|
|
var targetTab = TableManager.GetTeamTargetByID(_TeamInfo.DesID, 0);
|
|
if(targetTab != null)
|
|
_TeamDirect.text = targetTab.Name;
|
|
else
|
|
_TeamDirect.text = "";
|
|
|
|
_BtnApply.interactable = true;
|
|
}
|
|
|
|
public void BtnApply()
|
|
{
|
|
if (Singleton<ObjManager>.GetInstance() == null)
|
|
{
|
|
return;
|
|
}
|
|
|
|
if (_TeamInfo.Guid == GlobeVar.INVALID_GUID || _TeamInfo.TeamID == -1 || _TeamInfo.Guid == GameManager.gameManager.PlayerDataPool.MainPlayerBaseAttr.Guid)
|
|
{
|
|
Singleton<ObjManager>.GetInstance().MainPlayer.SendNoticMsg(false, "#{1930}");
|
|
return;
|
|
}
|
|
|
|
_CG_REQ_TEAM_JOINSend = false;
|
|
Singleton<ObjManager>.GetInstance().MainPlayer.ReqJoinTeam(_TeamInfo.TeamID);
|
|
|
|
_BtnApply.interactable = false;
|
|
}
|
|
|
|
|
|
public void OnCaptainHeadIcon()
|
|
{
|
|
PopMenuLogic.ShowMenu("ShowCaptainInfo", null, _TeamInfo.Guid);
|
|
}
|
|
}
|