diff options
Diffstat (limited to 'Client/Assets/Scripts/XMainClient/UI/XMentorshipCandidatesView.cs')
-rw-r--r-- | Client/Assets/Scripts/XMainClient/UI/XMentorshipCandidatesView.cs | 311 |
1 files changed, 311 insertions, 0 deletions
diff --git a/Client/Assets/Scripts/XMainClient/UI/XMentorshipCandidatesView.cs b/Client/Assets/Scripts/XMainClient/UI/XMentorshipCandidatesView.cs new file mode 100644 index 00000000..c0f026aa --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/UI/XMentorshipCandidatesView.cs @@ -0,0 +1,311 @@ +using System;
+using KKSG;
+using UILib;
+using UnityEngine;
+using XMainClient.UI.UICommon;
+using XUtliPoolLib;
+
+namespace XMainClient.UI
+{
+ internal class XMentorshipCandidatesView : DlgBase<XMentorshipCandidatesView, XMentorshipCandidatesBehavior>
+ {
+ public override string fileName
+ {
+ get
+ {
+ return "GameSystem/TeacherPupilInvitation";
+ }
+ }
+
+ public override int layer
+ {
+ get
+ {
+ return 1;
+ }
+ }
+
+ public override int group
+ {
+ get
+ {
+ return 1;
+ }
+ }
+
+ public override bool autoload
+ {
+ get
+ {
+ return true;
+ }
+ }
+
+ protected override void Init()
+ {
+ this.InitProperties();
+ }
+
+ protected override void OnUnload()
+ {
+ base.OnUnload();
+ }
+
+ public override void RegisterEvent()
+ {
+ base.RegisterEvent();
+ }
+
+ protected override void OnShow()
+ {
+ base.OnShow();
+ this.RefreshTitleAndDownBtn();
+ bool flag = XMentorshipDocument.Doc.CurViewType == CandidatesViewType.Application;
+ if (flag)
+ {
+ XMentorshipDocument.Doc.SendCandidatesOpReq(EMentorMsgOpType.EMentorMsgOp_Get, 0UL, MentorMsgApplyType.MentorMsgApplyMax, 0, false);
+ }
+ else
+ {
+ bool flag2 = XMentorshipDocument.Doc.CurViewType == CandidatesViewType.Recommend;
+ if (flag2)
+ {
+ bool flag3 = XMentorshipDocument.Doc.CurRecommendType == CandidatesViewRecommendType.Master;
+ if (flag3)
+ {
+ XMentorshipDocument.Doc.SendToGetMyApplyMasterInfo(false);
+ }
+ else
+ {
+ XMentorshipDocument.Doc.SendToGetMyApplyPupilsInfo(false);
+ }
+ }
+ }
+ }
+
+ private void RefreshTitleAndDownBtn()
+ {
+ bool flag = XMentorshipDocument.Doc.CurViewType == CandidatesViewType.Application;
+ if (flag)
+ {
+ base.uiBehaviour.titleContent.SetText(XSingleton<XStringTable>.singleton.GetString("MentorshipApply"));
+ base.uiBehaviour.btnContent.SetText(XSingleton<XStringTable>.singleton.GetString("MentorshipClear"));
+ }
+ else
+ {
+ bool flag2 = XMentorshipDocument.Doc.CurViewType == CandidatesViewType.Recommend;
+ if (flag2)
+ {
+ base.uiBehaviour.titleContent.SetText(XSingleton<XStringTable>.singleton.GetString("MentorshipRecommend"));
+ base.uiBehaviour.btnContent.SetText(XSingleton<XStringTable>.singleton.GetString("FRIEND_ADDDLG_NO_COUNTDOWN"));
+ }
+ }
+ base.uiBehaviour.ClearBtn.SetEnable(true, false);
+ base.uiBehaviour.btnContent.SetText(XStringDefineProxy.GetString("FRIEND_ADDDLG_NO_COUNTDOWN"));
+ }
+
+ protected override void OnHide()
+ {
+ base.OnHide();
+ XMentorshipDocument.Doc.ResetCandidatesView();
+ }
+
+ public void RefreshUI()
+ {
+ int canidatesShowMsgCount = XMentorshipDocument.Doc.GetCanidatesShowMsgCount();
+ base.uiBehaviour.WrapContent.SetContentCount(canidatesShowMsgCount, false);
+ base.uiBehaviour.ScrollView.ResetPosition();
+ }
+
+ public void RefreshAllVisible()
+ {
+ base.uiBehaviour.WrapContent.RefreshAllVisibleContents();
+ }
+
+ public void RefreshCDTimeLabel(int leftTime)
+ {
+ bool flag = leftTime > 0;
+ if (flag)
+ {
+ base.uiBehaviour.ClearBtn.SetEnable(false, false);
+ base.uiBehaviour.btnContent.SetText(string.Format(XStringDefineProxy.GetString("FRIEND_ADDDLG_COUNTDOWN_FMT"), leftTime));
+ }
+ else
+ {
+ base.uiBehaviour.ClearBtn.SetEnable(true, false);
+ base.uiBehaviour.btnContent.SetText(XStringDefineProxy.GetString("FRIEND_ADDDLG_NO_COUNTDOWN"));
+ }
+ }
+
+ private void InitProperties()
+ {
+ base.uiBehaviour.CloseBtn.RegisterClickEventHandler(new ButtonClickEventHandler(this.OnCloseDialog));
+ base.uiBehaviour.ClearBtn.RegisterClickEventHandler(new ButtonClickEventHandler(this.OnClearNews));
+ base.uiBehaviour.WrapContent.RegisterItemInitEventHandler(new WrapItemInitEventHandler(this.OnWrapContentItemInit));
+ base.uiBehaviour.WrapContent.RegisterItemUpdateEventHandler(new WrapItemUpdateEventHandler(this.OnWrapContentItemUpdate));
+ }
+
+ private bool OnClearNews(IXUIButton button)
+ {
+ bool flag = XMentorshipDocument.Doc.CurViewType == CandidatesViewType.Application;
+ if (flag)
+ {
+ XMentorshipDocument.Doc.SendCandidatesOpReq(EMentorMsgOpType.EMentorMsgOpType_Clear, 0UL, MentorMsgApplyType.MentorMsgApplyMax, 0, false);
+ }
+ else
+ {
+ bool flag2 = XMentorshipDocument.Doc.CurViewType == CandidatesViewType.Recommend;
+ if (flag2)
+ {
+ bool flag3 = XMentorshipDocument.Doc.CurRecommendType == CandidatesViewRecommendType.Master;
+ if (flag3)
+ {
+ XMentorshipDocument.Doc.SendToGetMyApplyMasterInfo(true);
+ }
+ else
+ {
+ XMentorshipDocument.Doc.SendToGetMyApplyPupilsInfo(true);
+ }
+ }
+ }
+ return true;
+ }
+
+ private bool OnCloseDialog(IXUIButton button)
+ {
+ this.SetVisibleWithAnimation(false, null);
+ return true;
+ }
+
+ private void OnWrapContentItemUpdate(Transform itemTransform, int index)
+ {
+ IXUIButton ixuibutton = itemTransform.Find("Accept").GetComponent("XUIButton") as IXUIButton;
+ ixuibutton.gameObject.SetActive(XMentorshipDocument.Doc.CurViewType == CandidatesViewType.Application);
+ IXUIButton ixuibutton2 = itemTransform.Find("Refuse").GetComponent("XUIButton") as IXUIButton;
+ ixuibutton2.gameObject.SetActive(XMentorshipDocument.Doc.CurViewType == CandidatesViewType.Application);
+ IXUIButton ixuibutton3 = itemTransform.Find("Mentorship").GetComponent("XUIButton") as IXUIButton;
+ ixuibutton3.gameObject.SetActive(XMentorshipDocument.Doc.CurViewType == CandidatesViewType.Recommend);
+ MessageShowInfoItem candidateMsgShowInfo = XMentorshipDocument.Doc.GetCandidateMsgShowInfo(index);
+ bool flag = candidateMsgShowInfo != null;
+ if (flag)
+ {
+ IXUILabel ixuilabel = itemTransform.Find("level").GetComponent("XUILabel") as IXUILabel;
+ ixuilabel.SetText(candidateMsgShowInfo.roleInfo.level.ToString());
+ uint titleID = (candidateMsgShowInfo.roleInfo.outlook != null && candidateMsgShowInfo.roleInfo.outlook.title != null) ? candidateMsgShowInfo.roleInfo.outlook.title.titleID : 0u;
+ IXUILabelSymbol ixuilabelSymbol = itemTransform.Find("Name").GetComponent("XUILabelSymbol") as IXUILabelSymbol;
+ ixuilabelSymbol.InputText = XTitleDocument.GetTitleWithFormat(titleID, candidateMsgShowInfo.roleInfo.name);
+ IXUISprite ixuisprite = itemTransform.Find("head").GetComponent("XUISprite") as IXUISprite;
+ ixuisprite.spriteName = XSingleton<XProfessionSkillMgr>.singleton.GetProfHeadIcon2((int)((int)candidateMsgShowInfo.roleInfo.type % 10));
+ IXUISprite ixuisprite2 = itemTransform.Find("Profession").GetComponent("XUISprite") as IXUISprite;
+ ixuisprite2.spriteName = XSingleton<XProfessionSkillMgr>.singleton.GetProfIcon((int)((int)candidateMsgShowInfo.roleInfo.type % 10));
+ IXUILabel ixuilabel2 = itemTransform.Find("PromiseWords").GetComponent("XUILabel") as IXUILabel;
+ ixuilabel2.SetText(candidateMsgShowInfo.promiseWords);
+ IXUILabel ixuilabel3 = itemTransform.Find("Mentorship/T").GetComponent("XUILabel") as IXUILabel;
+ bool flag2 = XMentorshipDocument.Doc.CurViewType == CandidatesViewType.Application;
+ if (flag2)
+ {
+ ixuibutton.ID = (ulong)((long)index);
+ ixuibutton2.ID = (ulong)((long)index);
+ }
+ else
+ {
+ ixuibutton3.ID = candidateMsgShowInfo.roleInfo.roleID;
+ bool applied = candidateMsgShowInfo.applied;
+ if (applied)
+ {
+ ixuibutton3.SetEnable(false, false);
+ ixuilabel3.SetText(XSingleton<XStringTable>.singleton.GetString("CHAT_SENT"));
+ }
+ else
+ {
+ ixuibutton3.SetEnable(true, false);
+ bool flag3 = XMentorshipDocument.Doc.CurRecommendType == CandidatesViewRecommendType.Master;
+ if (flag3)
+ {
+ ixuilabel3.SetText(XSingleton<XStringTable>.singleton.GetString("MentorshipMaster"));
+ }
+ else
+ {
+ ixuilabel3.SetText(XSingleton<XStringTable>.singleton.GetString("MentorshipPupil"));
+ }
+ }
+ }
+ }
+ }
+
+ private void OnStartPlayAudio(IXUISprite uiSprite)
+ {
+ }
+
+ private void OnStopSignPlay(object ob)
+ {
+ IXUISpriteAnimation ixuispriteAnimation = (IXUISpriteAnimation)ob;
+ bool flag = ixuispriteAnimation != null;
+ if (flag)
+ {
+ ixuispriteAnimation.SetFrameRate(0);
+ ixuispriteAnimation.Reset();
+ }
+ }
+
+ private void UpdateOpBtnState(Transform itemTransform)
+ {
+ IXUIButton ixuibutton = itemTransform.Find("Accept").GetComponent("XUIButton") as IXUIButton;
+ ixuibutton.gameObject.SetActive(XMentorshipDocument.Doc.CurViewType == CandidatesViewType.Application);
+ IXUIButton ixuibutton2 = itemTransform.Find("Refuse").GetComponent("XUIButton") as IXUIButton;
+ ixuibutton2.gameObject.SetActive(XMentorshipDocument.Doc.CurViewType == CandidatesViewType.Application);
+ IXUIButton ixuibutton3 = itemTransform.Find("Mentorship").GetComponent("XUIButton") as IXUIButton;
+ ixuibutton3.gameObject.SetActive(XMentorshipDocument.Doc.CurViewType == CandidatesViewType.Recommend);
+ }
+
+ private void OnPlayPromiseVoice(IXUISprite uiSprite)
+ {
+ }
+
+ private void OnWrapContentItemInit(Transform itemTransform, int index)
+ {
+ IXUIButton ixuibutton = itemTransform.Find("Accept").GetComponent("XUIButton") as IXUIButton;
+ ixuibutton.RegisterClickEventHandler(new ButtonClickEventHandler(this.OnClickAcceptCandidate));
+ IXUIButton ixuibutton2 = itemTransform.Find("Refuse").GetComponent("XUIButton") as IXUIButton;
+ ixuibutton2.RegisterClickEventHandler(new ButtonClickEventHandler(this.OnClickRefuseCandidate));
+ IXUIButton ixuibutton3 = itemTransform.Find("Mentorship").GetComponent("XUIButton") as IXUIButton;
+ ixuibutton3.RegisterClickEventHandler(new ButtonClickEventHandler(this.OnMentorshipClicked));
+ }
+
+ private bool OnMentorshipClicked(IXUIButton button)
+ {
+ bool flag = XMentorshipDocument.Doc.CurRecommendType == CandidatesViewRecommendType.Master;
+ if (flag)
+ {
+ XMentorshipDocument.Doc.SendMentorRelationOp(MentorRelationOpType.MentorRelationOp_ApplyMaster, button.ID, 0);
+ }
+ else
+ {
+ XMentorshipDocument.Doc.SendMentorRelationOp(MentorRelationOpType.MentorRelationOp_ApplyStudent, button.ID, 0);
+ }
+ return true;
+ }
+
+ private bool OnClickRefuseCandidate(IXUIButton button)
+ {
+ MessageShowInfoItem candidateMsgShowInfo = XMentorshipDocument.Doc.GetCandidateMsgShowInfo((int)button.ID);
+ bool flag = candidateMsgShowInfo != null;
+ if (flag)
+ {
+ XMentorshipDocument.Doc.SendCandidatesOpReq(EMentorMsgOpType.EMentorMsgOpType_Reject, candidateMsgShowInfo.roleInfo.roleID, candidateMsgShowInfo.msgType, 0, false);
+ }
+ return true;
+ }
+
+ private bool OnClickAcceptCandidate(IXUIButton button)
+ {
+ MessageShowInfoItem candidateMsgShowInfo = XMentorshipDocument.Doc.GetCandidateMsgShowInfo((int)button.ID);
+ bool flag = candidateMsgShowInfo != null;
+ if (flag)
+ {
+ XMentorshipDocument.Doc.SendCandidatesOpReq(EMentorMsgOpType.EMentorMsgOpType_Agree, candidateMsgShowInfo.roleInfo.roleID, candidateMsgShowInfo.msgType, 0, false);
+ }
+ return true;
+ }
+ }
+}
|