备份CatanBuilding瘦身独立工程
This commit is contained in:
197
Assets/Scripts/UI/Social/FishingSocialPanel.cs
Normal file
197
Assets/Scripts/UI/Social/FishingSocialPanel.cs
Normal file
@@ -0,0 +1,197 @@
|
||||
using asap.core;
|
||||
using UniRx;
|
||||
using game;
|
||||
using GameCore;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class FishingSocialPanel : BasePanel
|
||||
{
|
||||
ClubService _socialData;
|
||||
public Button btn_close;
|
||||
List<Toggle> toggleList = new List<Toggle>();
|
||||
List<GameObject> selected_tab = new List<GameObject>();
|
||||
SocialFriends friends;
|
||||
SocialLeadboard leaderboard;
|
||||
GameObject clubOb;
|
||||
SocialClubApplication clubApplication;
|
||||
SocialClubJoined clubJoined;
|
||||
private void Awake()
|
||||
{
|
||||
_socialData = GContext.container.Resolve<ClubService>();
|
||||
btn_close = transform.Find("root/btn_close").GetComponent<Button>();
|
||||
for (int i = 1; i <= 3; i++)
|
||||
{
|
||||
toggleList.Add(transform.Find($"root/tab/text_tab{i}").GetComponent<Toggle>());
|
||||
selected_tab.Add(transform.Find($"root/tab/selected_tab{i}").gameObject);
|
||||
}
|
||||
friends = transform.Find("root/friends").GetComponent<SocialFriends>();
|
||||
friends.InitUI();
|
||||
leaderboard = transform.Find("root/leaderboard").GetComponent<SocialLeadboard>();
|
||||
clubOb = transform.Find("root/club").gameObject;
|
||||
clubApplication = transform.Find("root/club/club_application").GetComponent<SocialClubApplication>();
|
||||
clubJoined = transform.Find("root/club/club_joined").GetComponent<SocialClubJoined>();
|
||||
GContext.container.Resolve<GuideDataCenter>().InspectTriggerGuide("FishingSocialPanel");
|
||||
}
|
||||
protected override void Start()
|
||||
{
|
||||
base.Start();
|
||||
GContext.OnEvent<ClubStateChangeEvent>().Subscribe(OnChangeJoinedState).AddTo(disposables);
|
||||
GContext.OnEvent<SocialFriendListChangedData>().Subscribe(OnChangeFriendListData).AddTo(disposables);
|
||||
clubOb.gameObject.SetActive(false);
|
||||
friends.gameObject.SetActive(false);
|
||||
leaderboard.gameObject.SetActive(false);
|
||||
btn_close.onClick.AddListener(() =>
|
||||
{
|
||||
UIManager.Instance.DestroyUI(UITypes.FishingSocialFriendSearchPanel);
|
||||
UIManager.Instance.DestroyUI(UITypes.FishingSocialPanel);
|
||||
});
|
||||
|
||||
selected_tab[0].SetActive(false);
|
||||
selected_tab[1].SetActive(false);
|
||||
selected_tab[2].SetActive(false);
|
||||
|
||||
toggleList[0].onValueChanged.AddListener(OnToggleClub);
|
||||
toggleList[1].onValueChanged.AddListener(OnToggleFriends);
|
||||
toggleList[2].onValueChanged.AddListener(OnToggleLeaderboard);
|
||||
|
||||
OnToggle();
|
||||
_socialData.GetSelfClub();
|
||||
_socialData.SetOpenClubRed();
|
||||
|
||||
EventPopupData eventPopup = GContext.container.Resolve<ClubService>().eventPopupDataClub;
|
||||
if (eventPopup != null && !eventPopup.IsRead)
|
||||
{
|
||||
eventPopup.IsRead = true;
|
||||
_socialData.ReadClubEvent();
|
||||
switch (eventPopup.redirectID)
|
||||
{
|
||||
case 1:
|
||||
KickedOut();
|
||||
break;
|
||||
case 2:
|
||||
KickedOutMaster();
|
||||
break;
|
||||
case 3:
|
||||
case 4:
|
||||
Promote(eventPopup.content);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
//玩家被踢出首次进入俱乐部打开提示弹窗:
|
||||
// 您被会长踢出了俱乐部 You have been kicked out of the club by the club master
|
||||
void KickedOut()
|
||||
{
|
||||
string info = LocalizationMgr.GetText("UI_FishingSocialPanel_35");
|
||||
ShowTips(info);
|
||||
}
|
||||
//会长长时间不活跃被踢出后首次进入俱乐部打开提示弹窗:
|
||||
//由于长时间不活跃,您已被踢出俱乐部,会长已自动移交给他人
|
||||
//Due to inactivity, you have been kicked out of the club ,
|
||||
//the club master has been automatically transferred
|
||||
void KickedOutMaster()
|
||||
{
|
||||
string info = LocalizationMgr.GetText("UI_FishingSocialPanel_36");
|
||||
ShowTips(info);
|
||||
}
|
||||
//由于前任会长不活跃被踢出,被转让会长身份的玩家首次进入俱乐部打开的提示弹窗:
|
||||
//由于前任会长长时间不活跃,您已被任命成新的俱乐部会长
|
||||
//Due to the inactivity of the previous club master, you have been appointed as the new club master
|
||||
void BeenAppointed()
|
||||
{
|
||||
string info = LocalizationMgr.GetText("UI_FishingSocialPanel_37");
|
||||
ShowTips(info);
|
||||
}
|
||||
|
||||
//升职
|
||||
void Promote(string content)
|
||||
{
|
||||
_socialData.ShowPromote();
|
||||
}
|
||||
|
||||
async void ShowTips(string info)
|
||||
{
|
||||
GameObject go = await UIManager.Instance.ShowUI(UITypes.NoticeConfirmPopupPanel);
|
||||
var NoticeConfirmPopupPanel = go.GetComponent<NoticeConfirmPopupPanel>();
|
||||
NoticeConfirmPopupPanel.Init(1, "", info);
|
||||
}
|
||||
|
||||
void OnToggle()
|
||||
{
|
||||
if (_socialData.OpenPanelType == 2)
|
||||
{
|
||||
selected_tab[3].SetActive(true);
|
||||
toggleList[3].isOn = true;
|
||||
OnToggleLeaderboard(true);
|
||||
}
|
||||
else if (_socialData.OpenPanelType == 1)
|
||||
{
|
||||
selected_tab[1].SetActive(true);
|
||||
toggleList[1].isOn = true;
|
||||
OnToggleFriends(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
selected_tab[0].SetActive(true);
|
||||
toggleList[0].isOn = true;
|
||||
OnToggleClub(true);
|
||||
}
|
||||
}
|
||||
|
||||
void OnToggleClub(bool isOn)
|
||||
{
|
||||
selected_tab[0].SetActive(isOn);
|
||||
clubOb.gameObject.SetActive(isOn);
|
||||
if (isOn)
|
||||
{
|
||||
clubApplication.gameObject.SetActive(!_socialData.IsClubJoined());
|
||||
clubJoined.gameObject.SetActive(_socialData.IsClubJoined());
|
||||
}
|
||||
}
|
||||
|
||||
void OnToggleFriends(bool isOn)
|
||||
{
|
||||
friends.gameObject.SetActive(isOn);
|
||||
selected_tab[1].SetActive(isOn);
|
||||
}
|
||||
|
||||
void OnToggleLeaderboard(bool isOn)
|
||||
{
|
||||
leaderboard.gameObject.SetActive(isOn);
|
||||
selected_tab[2].SetActive(isOn);
|
||||
}
|
||||
void OnChangeFriendListData(SocialFriendListChangedData data)
|
||||
{
|
||||
if (friends == null) return;
|
||||
friends.SetScroll();
|
||||
}
|
||||
void OnChangeJoinedState(ClubStateChangeEvent stateData)
|
||||
{
|
||||
int state = stateData.state;
|
||||
if (state == 0)
|
||||
{
|
||||
clubApplication.gameObject.SetActive(!_socialData.IsClubJoined());
|
||||
clubJoined.gameObject.SetActive(_socialData.IsClubJoined());
|
||||
}
|
||||
else
|
||||
{
|
||||
//加入公会之后的搜索和返回
|
||||
clubApplication.gameObject.SetActive(state == 1);
|
||||
clubJoined.gameObject.SetActive(state == 2);
|
||||
}
|
||||
}
|
||||
private void OnDisable()
|
||||
{
|
||||
RestartShowHomeUIEvent restartShowHomeUIEvent = new RestartShowHomeUIEvent();
|
||||
GContext.Publish(restartShowHomeUIEvent);
|
||||
}
|
||||
protected override void OnDestroy()
|
||||
{
|
||||
base.OnDestroy();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user