561 lines
16 KiB
C#
561 lines
16 KiB
C#
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using Games.GlobeDefine;
|
|
using GCGame;
|
|
using Module.Log;
|
|
using GCGame.Table;
|
|
using System;
|
|
using Games.ChatHistory;
|
|
|
|
public class TeamInfoWindow : UIControllerBase<TeamInfoWindow>
|
|
{
|
|
void Awake()
|
|
{
|
|
SetInstance(this);
|
|
}
|
|
|
|
public UITagPanel _TeamTagPanel;
|
|
public GameObject _SpeekTypeBtnGO;
|
|
public GameObject _HLSpeakTypeGO;
|
|
|
|
public void OnShowPage(int page)
|
|
{
|
|
if (page == 0)
|
|
{
|
|
UpdateTeamInfo();
|
|
}
|
|
else if(page == 1)
|
|
{
|
|
UpdateRequests();
|
|
}
|
|
}
|
|
|
|
void OnEnable()
|
|
{
|
|
SetInstance(this);
|
|
GUIData.delTeamDataUpdate += UpdateTeamInfo;
|
|
|
|
_TeamTagPanel.ShowPage(0);
|
|
UpdateTeamInfo();
|
|
UpdateReddotTip();
|
|
ShowCaptainWelfareRedIcon(GameManager.gameManager.PlayerDataPool.IsHaveCaptainWelfareRewCanGetted);
|
|
|
|
//if (GameManager.gameManager.PlayerDataPool.TeamInfo.TeamID > 0)
|
|
//{
|
|
// GameManager.gameManager.PlayerDataPool.TeamInfo.SetAutoTeam(GameManager.gameManager.PlayerDataPool.TeamInfo.IsAutoTeam);
|
|
//}
|
|
|
|
ShowRobotTips();
|
|
}
|
|
|
|
void OnDisable()
|
|
{
|
|
GUIData.delTeamDataUpdate -= UpdateTeamInfo;
|
|
HideSpeakType();
|
|
SetInstance(null);
|
|
|
|
HideRobotTips();
|
|
}
|
|
|
|
public void OnBtnClose()
|
|
{
|
|
UIManager.CloseUI(UIInfo.TeamInfoRoot);
|
|
}
|
|
|
|
#region Tab TeamInfo
|
|
|
|
public Text _TeamTarget;
|
|
public Text _TeamLevel;
|
|
//public UIContainerBase _TeamMembers;
|
|
public GameObject _BtnDismiss;
|
|
public Button _BtnFollow;
|
|
public Button _BtnStopFollow;
|
|
public Button _BtnAuto;
|
|
public Button _BtnCancelAuto;
|
|
public Toggle _AutoToggle;
|
|
public GameObject _CaptainPanel;
|
|
public GameObject _MemberPanel;
|
|
public GameObject _MemberFollow;
|
|
public GameObject _MemberCancelFollow;
|
|
|
|
public TeamInfoMemberItem[] MemberInfoItems;
|
|
public delegate void SetTeamTargetCB();
|
|
private SetTeamTargetCB teamTargetCB;
|
|
|
|
private int _LastTeamID
|
|
{
|
|
get { return GameManager.gameManager.PlayerDataPool.TeamInfo._LastTeamID; }
|
|
set { GameManager.gameManager.PlayerDataPool.TeamInfo._LastTeamID = value; }
|
|
}
|
|
private int _TargetID;
|
|
|
|
public void UpdateTeamInfo()
|
|
{
|
|
if (_TeamTagPanel.GetShowingPage() != 0)
|
|
return;
|
|
|
|
if (!Singleton<ObjManager>.GetInstance().MainPlayer.IsTeamLeader())
|
|
{
|
|
_CaptainPanel.SetActive(false);
|
|
_MemberPanel.SetActive(true);
|
|
//_MemberFollow.SetActive(true);
|
|
//_MemberCancelFollow.SetActive(false);
|
|
|
|
//if (GameManager.gameManager.PlayerDataPool.IsFollowTeam)
|
|
//{
|
|
// _MemberFollow.gameObject.SetActive(false);
|
|
// _MemberCancelFollow.gameObject.SetActive(true);
|
|
//}
|
|
//else
|
|
//{
|
|
// _MemberFollow.gameObject.SetActive(true);
|
|
// _MemberCancelFollow.gameObject.SetActive(false);
|
|
//}
|
|
}
|
|
else
|
|
{
|
|
_CaptainPanel.SetActive(true);
|
|
_MemberPanel.SetActive(false);
|
|
}
|
|
|
|
//HideSpeakType();
|
|
|
|
SetTeamID(GameManager.gameManager.PlayerDataPool.TeamInfo.TeamID);
|
|
|
|
TeamMember[] member = GameManager.gameManager.PlayerDataPool.TeamInfo.teamMember;
|
|
for (int i = 0; i < member.Length; ++i)
|
|
{
|
|
MemberInfoItems[i].InitTeamInfo(member[i]);
|
|
}
|
|
|
|
RefreshDest();
|
|
UpdateTeamAuto();
|
|
}
|
|
|
|
private void SetTeamID(int teamID)
|
|
{
|
|
//if (_LastTeamID != GameManager.gameManager.PlayerDataPool.TeamInfo.TeamID)
|
|
//{
|
|
// //GameManager.gameManager.PlayerDataPool.TeamInfo.IsAutoTeam = false;
|
|
// _LastTeamID = GameManager.gameManager.PlayerDataPool.TeamInfo.TeamID;
|
|
// _BtnAuto.gameObject.SetActive(true);
|
|
// _BtnCancelAuto.gameObject.SetActive(false);
|
|
// _AutoToggle.isOn = false;
|
|
//}
|
|
}
|
|
|
|
public void UpdateTeamAuto()
|
|
{
|
|
|
|
if (!GameManager.gameManager.PlayerDataPool.TeamInfo.IsAutoTeam)
|
|
{
|
|
//_BtnAuto.gameObject.SetActive(true);
|
|
//_BtnCancelAuto.gameObject.SetActive(false);
|
|
_AutoToggle.isOn = false;
|
|
}
|
|
else
|
|
{
|
|
//_BtnAuto.gameObject.SetActive(false);
|
|
//_BtnCancelAuto.gameObject.SetActive(true);
|
|
_AutoToggle.isOn = true;
|
|
}
|
|
|
|
RefreshDest();
|
|
if (teamTargetCB != null)
|
|
{
|
|
teamTargetCB();
|
|
teamTargetCB = null;
|
|
}
|
|
}
|
|
|
|
public void EnsureAutoTeam()
|
|
{
|
|
if (!_AutoToggle.isOn)
|
|
{
|
|
GameManager.gameManager.PlayerDataPool.TeamInfo.SetAutoTeam(true);
|
|
}
|
|
}
|
|
|
|
public void OnBtnAuto()
|
|
{
|
|
if (!GameManager.gameManager.PlayerDataPool.TeamInfo.IsCaptain())
|
|
{
|
|
GUIData.AddNotifyData(StrDictionary.GetClientDictionaryString("#{1356}"));
|
|
return;
|
|
}
|
|
|
|
if (_AutoToggle.isOn)
|
|
{
|
|
GameManager.gameManager.PlayerDataPool.TeamInfo.SetAutoTeam(false);
|
|
|
|
_AutoToggle.isOn = false;
|
|
}
|
|
else
|
|
{
|
|
if (GameManager.gameManager.PlayerDataPool.TeamInfo.LastTeamDest > 0)
|
|
{
|
|
}
|
|
else
|
|
{
|
|
GUIData.AddNotifyData(StrDictionary.GetClientDictionaryString("#{5147}"));
|
|
return;
|
|
}
|
|
|
|
GameManager.gameManager.PlayerDataPool.TeamInfo.SetAutoTeam(true);
|
|
_AutoToggle.isOn = true;
|
|
}
|
|
}
|
|
|
|
public void OnBtnCancelAuto()
|
|
{
|
|
|
|
}
|
|
|
|
public void OnBtnSpeak()
|
|
{ }
|
|
|
|
public void OnBtnLeaveTeam()
|
|
{
|
|
MessageBoxLogic.OpenOKCancelBox(5139, -1, LeaveTeamOK);
|
|
}
|
|
|
|
private void LeaveTeamOK()
|
|
{
|
|
if (GameManager.gameManager.PlayerDataPool.TeamInfo.TeamID != GlobeVar.INVALID_ID)
|
|
{
|
|
if (null != Singleton<ObjManager>.GetInstance().MainPlayer)
|
|
{
|
|
Singleton<ObjManager>.GetInstance().MainPlayer.ReqLeaveTeam();
|
|
}
|
|
}
|
|
|
|
OnBtnClose();
|
|
}
|
|
|
|
public void OnBtnDismissTeam()
|
|
{
|
|
MessageBoxLogic.OpenOKCancelBox(5140, -1, DismissTeamOK);
|
|
}
|
|
|
|
private void DismissTeamOK()
|
|
{
|
|
//非队长无法解散队伍
|
|
if (false == Singleton<ObjManager>.GetInstance().MainPlayer.IsTeamLeader())
|
|
{
|
|
return;
|
|
}
|
|
|
|
//队长自己踢自己,服务器则认为是解散队伍
|
|
Singleton<ObjManager>.GetInstance().MainPlayer.ReqKickTeamMember(GameManager.gameManager.PlayerDataPool.MainPlayerBaseAttr.Guid);
|
|
|
|
OnBtnClose();
|
|
}
|
|
|
|
public void OnBtnCaptainFollow()
|
|
{
|
|
if (null != Singleton<ObjManager>.GetInstance().MainPlayer)
|
|
{
|
|
Singleton<ObjManager>.GetInstance().MainPlayer.EnterTeamFollow();
|
|
}
|
|
}
|
|
|
|
public void OnBtnCaptainStopFollow()
|
|
{
|
|
if (null != Singleton<ObjManager>.GetInstance().MainPlayer)
|
|
{
|
|
Singleton<ObjManager>.GetInstance().MainPlayer.LeaveTeamFollow();
|
|
}
|
|
}
|
|
|
|
public void OnBtnFollowTeam()
|
|
{
|
|
if (null != Singleton<ObjManager>.GetInstance().MainPlayer)
|
|
{
|
|
Singleton<ObjManager>.GetInstance().MainPlayer.EnterTeamFollow();
|
|
}
|
|
|
|
_MemberFollow.gameObject.SetActive(false);
|
|
_MemberCancelFollow.gameObject.SetActive(true);
|
|
}
|
|
|
|
public void OnBtnCancelFollowTeam()
|
|
{
|
|
if (null != Singleton<ObjManager>.GetInstance().MainPlayer)
|
|
{
|
|
Singleton<ObjManager>.GetInstance().MainPlayer.LeaveTeamFollow();
|
|
}
|
|
|
|
_MemberFollow.gameObject.SetActive(true);
|
|
_MemberCancelFollow.gameObject.SetActive(false);
|
|
}
|
|
|
|
public void OnBtnStopFollowTeam()
|
|
{
|
|
if (null != Singleton<ObjManager>.GetInstance().MainPlayer)
|
|
{
|
|
Singleton<ObjManager>.GetInstance().MainPlayer.LeaveTeamFollow();
|
|
}
|
|
|
|
_MemberFollow.gameObject.SetActive(true);
|
|
_MemberCancelFollow.gameObject.SetActive(false);
|
|
}
|
|
|
|
public void OnBtnModifyTarget()
|
|
{
|
|
TeamTargetRoot.ShowTeamTarget(SelectedTargets);
|
|
OnBtnCancelAuto();
|
|
}
|
|
|
|
public void SelectedTargets(Tab_TeamTarget target, int levelMin, int levelMax, SetTeamTargetCB callBack = null)
|
|
{
|
|
if (callBack != null)
|
|
teamTargetCB = callBack;
|
|
SelectedTargets(target, levelMin, levelMax);
|
|
}
|
|
|
|
public void SelectedTargets(Tab_TeamTarget target, int levelMin, int levelMax)
|
|
{
|
|
UIManager.ShowUI(UIInfo.TeamInfoRoot);
|
|
int destIdx = target.Id;
|
|
GameManager.gameManager.PlayerDataPool.TeamInfo.ChangeTeamDest(destIdx, levelMin, levelMax);
|
|
|
|
RefreshDest();
|
|
}
|
|
|
|
private void RefreshDest()
|
|
{
|
|
int destIdx = GameManager.gameManager.PlayerDataPool.TeamInfo.LastTeamDest;
|
|
Tab_TeamTarget targetTab = TableManager.GetTeamTargetByID(destIdx, 0);
|
|
if (targetTab != null)
|
|
{
|
|
_TeamTarget.text = targetTab.Name;
|
|
int minLevel = GameManager.gameManager.PlayerDataPool.TeamInfo.LastTeamLevelMin <= 0 ? 1 : GameManager.gameManager.PlayerDataPool.TeamInfo.LastTeamLevelMin;
|
|
_TeamLevel.text = minLevel + "-" + (GameManager.gameManager.PlayerDataPool.TeamInfo.LastTeamLevelMax == -1 ? TableManager.GetLevelUp().Count + 1 : GameManager.gameManager.PlayerDataPool.TeamInfo.LastTeamLevelMax);
|
|
//_BtnAuto.interactable = true;
|
|
}
|
|
else
|
|
{
|
|
_TeamTarget.text = "";
|
|
_TeamLevel.text = "";
|
|
//_BtnAuto.interactable = false;
|
|
}
|
|
|
|
if (GameManager.gameManager.PlayerDataPool.TeamInfo.IsAutoTeam)
|
|
{
|
|
//_BtnAuto.gameObject.SetActive(false);
|
|
//_BtnCancelAuto.gameObject.SetActive(true);
|
|
_AutoToggle.isOn = true;
|
|
}
|
|
else
|
|
{
|
|
//_BtnAuto.gameObject.SetActive(true);
|
|
//_BtnCancelAuto.gameObject.SetActive(false);
|
|
_AutoToggle.isOn = false;
|
|
}
|
|
}
|
|
|
|
public void OnBtnInvate()
|
|
{
|
|
UIManager.ShowUI(UIInfo.TeamInvateRoot);
|
|
}
|
|
|
|
public void OnBtnInvateRobot()
|
|
{
|
|
//if (GameManager.gameManager.PlayerDataPool.TeamInfo.LastTeamDest > 0)
|
|
//{
|
|
// GUIData.AddNotifyData("#{7027}");
|
|
CG_CALL_TEAM_ROBOT packet = (CG_CALL_TEAM_ROBOT)PacketDistributed.CreatePacket(MessageID.PACKET_CG_CALL_TEAM_ROBOT);
|
|
packet.Nilparam = 1;
|
|
packet.SendPacket();
|
|
//}
|
|
//else
|
|
//{
|
|
// GUIData.AddNotifyData("#{7026}");
|
|
//}
|
|
|
|
}
|
|
#endregion
|
|
|
|
#region teamSpeak
|
|
|
|
public GameObject _SpeakPanel;
|
|
|
|
public void ShowSpeakType()
|
|
{
|
|
if (GameManager.gameManager.PlayerDataPool.TeamInfo.LastTeamDest > 0)
|
|
{
|
|
//_SpeekTypeBtnGO.SetActive(false);
|
|
//_HLSpeakTypeGO.SetActive(true);
|
|
// _SpeakPanel.SetActive(true);
|
|
//不再区分频道,全部发到组队信息频道
|
|
|
|
//区分一下帮派
|
|
var teamTarget = TableManager.GetTeamTargetByID(GameManager.gameManager.PlayerDataPool.TeamInfo.LastTeamDest,0);
|
|
if(teamTarget == null)
|
|
{
|
|
Debug.LogError("teamTarget IS NULL ID : " + GameManager.gameManager.PlayerDataPool.TeamInfo.LastTeamDest);
|
|
return;
|
|
}
|
|
|
|
if(teamTarget.TalkType == 2)
|
|
{
|
|
if (!GameManager.gameManager.PlayerDataPool.IsHaveGuild())
|
|
{
|
|
GUIData.AddNotifyData(StrDictionary.GetClientDictionaryString("#{2941}"));
|
|
return;
|
|
}
|
|
GameManager.gameManager.PlayerDataPool.TeamInfo.SendTeamChat(GC_CHAT.CHATTYPE.CHAT_TYPE_GUILD);
|
|
HideSpeakType();
|
|
return;
|
|
}
|
|
GameManager.gameManager.PlayerDataPool.TeamInfo.SendTeamChat(GC_CHAT.CHATTYPE.CHAT_TYPE_TEAM_INVITE);
|
|
HideSpeakType();
|
|
}
|
|
else
|
|
{
|
|
GUIData.AddNotifyData(StrDictionary.GetClientDictionaryString("#{5147}"));
|
|
return;
|
|
}
|
|
}
|
|
|
|
public void HideSpeakType()
|
|
{
|
|
//_SpeekTypeBtnGO.SetActive(true);
|
|
//_HLSpeakTypeGO.SetActive(false);
|
|
_SpeakPanel.SetActive(false);
|
|
}
|
|
|
|
public void OnBtnSpeakGuide()
|
|
{
|
|
if (GameManager.gameManager.PlayerDataPool.GuildInfo.GuildGuid == GlobeVar.INVALID_GUID)
|
|
{
|
|
GUIData.AddNotifyData(StrDictionary.GetClientDictionaryString("#{2941}"));
|
|
return;
|
|
}
|
|
GameManager.gameManager.PlayerDataPool.TeamInfo.SendTeamChat(GC_CHAT.CHATTYPE.CHAT_TYPE_TEAM_INVITE);
|
|
HideSpeakType();
|
|
}
|
|
|
|
public void OnBtnSpeakWorld()
|
|
{
|
|
GameManager.gameManager.PlayerDataPool.TeamInfo.SendTeamChat(GC_CHAT.CHATTYPE.CHAT_TYPE_TEAM_INVITE);
|
|
HideSpeakType();
|
|
}
|
|
|
|
|
|
#endregion
|
|
|
|
#region invater
|
|
|
|
public UIContainerSelect _TeamRequest;
|
|
public GameObject _NewRequestTip;
|
|
|
|
public void UpdateReddotTip()
|
|
{
|
|
if (GameManager.gameManager.PlayerDataPool.TeamInfo.NewRequest)
|
|
{
|
|
_NewRequestTip.SetActive(true);
|
|
GameManager.gameManager.PlayerDataPool.TeamInfo.NewRequest = false;
|
|
if (MissionDialogAndLeftTabsLogic.Instance() && MissionDialogAndLeftTabsLogic.Instance().gameObject.activeInHierarchy)
|
|
MissionDialogAndLeftTabsLogic.Instance().ShowTeamRedIcon(false);
|
|
}
|
|
else
|
|
{
|
|
_NewRequestTip.SetActive(false);
|
|
}
|
|
|
|
}
|
|
|
|
public void UpdateRequests()
|
|
{
|
|
if (_TeamTagPanel.GetShowingPage() == 1)
|
|
{
|
|
_TeamRequest.InitSelectContent(GameManager.gameManager.PlayerDataPool.TeamInfo.RequestList, null);
|
|
}
|
|
|
|
UpdateReddotTip();
|
|
}
|
|
|
|
public void ClearApplyList()
|
|
{
|
|
LogModule.ErrorLog("ClearApplyList");
|
|
GameManager.gameManager.PlayerDataPool.TeamInfo.RequestList.Clear();
|
|
UpdateRequests();
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region captainWelfare
|
|
public Image _redIcon;
|
|
public void OnBtnCaptainWelfare()
|
|
{
|
|
UIManager.ShowUI(UIInfo.CaptainWelfare);
|
|
}
|
|
public void ShowCaptainWelfareRedIcon(bool isShow)
|
|
{
|
|
if(_redIcon != null)
|
|
_redIcon.gameObject.SetActive(isShow);
|
|
}
|
|
#endregion
|
|
|
|
#region robot tips
|
|
|
|
public GameObject _RobotTipsGO;
|
|
public Text _RobotTipsText;
|
|
public float _RobotTipsShowTime;
|
|
public float _RobotTipsShowInStay = 8;
|
|
|
|
public void ShowRobotTips()
|
|
{
|
|
//StartCoroutine("ShowRobotTipsDelay");
|
|
//StartCoroutine("UpdateRobotTips");
|
|
}
|
|
|
|
public IEnumerator ShowRobotTipsDelay()
|
|
{
|
|
yield return new WaitForSeconds(0.5f);
|
|
if (GameManager.gameManager.PlayerDataPool.TeamInfo.IsCaptain() && GameManager.gameManager.PlayerDataPool.TeamInfo.GetTeamMemberCount() < 3)
|
|
{
|
|
_RobotTipsGO.gameObject.SetActive(true);
|
|
_RobotTipsText.text = StrDictionary.GetClientDictionaryString("#{52010}");
|
|
yield return new WaitForSeconds(_RobotTipsShowTime);
|
|
_RobotTipsGO.gameObject.SetActive(false);
|
|
}
|
|
}
|
|
|
|
public IEnumerator UpdateRobotTips()
|
|
{
|
|
while (true)
|
|
{
|
|
yield return new WaitForSeconds(_RobotTipsShowInStay);
|
|
if (GameManager.gameManager.PlayerDataPool.TeamInfo.IsCaptain() && GameManager.gameManager.PlayerDataPool.TeamInfo.GetTeamMemberCount() < 3)
|
|
{
|
|
StartCoroutine("ShowRobotTipsDelay");
|
|
}
|
|
}
|
|
}
|
|
|
|
public void HideRobotTips()
|
|
{
|
|
StopCoroutine("ShowRobotTipsDelay");
|
|
StopCoroutine("UpdateRobotTips");
|
|
_RobotTipsGO.gameObject.SetActive(false);
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region seting
|
|
public void OnSetingBtn()
|
|
{
|
|
UIManager.ShowUI(UIInfo.SystemAndAutoFight, delegate(bool bSucess, object param) {
|
|
if(bSucess)
|
|
{
|
|
SystemLogicList.Instance.ShowTeamSeting();
|
|
}
|
|
});
|
|
}
|
|
#endregion
|
|
}
|