diff options
Diffstat (limited to 'Client/Assets/Scripts/XMainClient/UI/XMentorshipApplicationsView.cs')
-rw-r--r-- | Client/Assets/Scripts/XMainClient/UI/XMentorshipApplicationsView.cs | 267 |
1 files changed, 267 insertions, 0 deletions
diff --git a/Client/Assets/Scripts/XMainClient/UI/XMentorshipApplicationsView.cs b/Client/Assets/Scripts/XMainClient/UI/XMentorshipApplicationsView.cs new file mode 100644 index 00000000..8489f3e6 --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/UI/XMentorshipApplicationsView.cs @@ -0,0 +1,267 @@ +using System;
+using KKSG;
+using UILib;
+using UnityEngine;
+using XMainClient.UI.UICommon;
+using XUtliPoolLib;
+
+namespace XMainClient.UI
+{
+ internal class XMentorshipApplicationsView : DlgBase<XMentorshipApplicationsView, XMentorshipApplicationBehavior>
+ {
+ public override string fileName
+ {
+ get
+ {
+ return "GameSystem/Teachermessage";
+ }
+ }
+
+ 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();
+ XMentorshipDocument.Doc.SendCandidatesOpReq(EMentorMsgOpType.EMentorMsgOp_Get, 0UL, MentorMsgApplyType.MentorMsgApplyMax, 0, false);
+ base.uiBehaviour.OneShotBtn.gameObject.SetActive(false);
+ }
+
+ public void RefreshUI()
+ {
+ int beenApplyMsgCount = XMentorshipDocument.Doc.GetBeenApplyMsgCount();
+ base.uiBehaviour.WrapContent.SetContentCount(beenApplyMsgCount, false);
+ base.uiBehaviour.scrollView.ResetPosition();
+ base.uiBehaviour.OneShotBtn.gameObject.SetActive(XMentorshipDocument.Doc.GetBeenApplyReportsMsgCount() > 0);
+ }
+
+ private void InitProperties()
+ {
+ base.uiBehaviour.CloseBtn.RegisterClickEventHandler(new ButtonClickEventHandler(this.OnCloseView));
+ base.uiBehaviour.ClearBtn.RegisterClickEventHandler(new ButtonClickEventHandler(this.OnClearNews));
+ base.uiBehaviour.WrapContent.RegisterItemInitEventHandler(new WrapItemInitEventHandler(this.OnWrapContentItemInit));
+ base.uiBehaviour.WrapContent.RegisterItemUpdateEventHandler(new WrapItemUpdateEventHandler(this.OnWrapContentItemUpdate));
+ base.uiBehaviour.OneShotBtn.RegisterClickEventHandler(new ButtonClickEventHandler(this.OnShotAcceptReports));
+ }
+
+ private bool OnShotAcceptReports(IXUIButton button)
+ {
+ XMentorshipDocument.Doc.SendCandidatesOpReq(EMentorMsgOpType.EMentorMsgOpType_Agree, 0UL, MentorMsgApplyType.MentorMsgApplyReportTask, 0, true);
+ return true;
+ }
+
+ private bool OnClearNews(IXUIButton button)
+ {
+ XMentorshipDocument.Doc.SendCandidatesOpReq(EMentorMsgOpType.EMentorMsgOpType_Clear, 0UL, MentorMsgApplyType.MentorMsgApplyMax, 0, false);
+ return true;
+ }
+
+ private bool OnCloseView(IXUIButton button)
+ {
+ this.SetVisibleWithAnimation(false, null);
+ return true;
+ }
+
+ private void OnWrapContentItemUpdate(Transform itemTransform, int index)
+ {
+ MentorBeenApplyedInfo beenApplyInfoByIndex = XMentorshipDocument.Doc.GetBeenApplyInfoByIndex(index);
+ bool flag = beenApplyInfoByIndex != null;
+ if (flag)
+ {
+ IXUILabel ixuilabel = itemTransform.Find("level").GetComponent("XUILabel") as IXUILabel;
+ ixuilabel.SetText(beenApplyInfoByIndex.roleInfo.level.ToString());
+ IXUISprite ixuisprite = itemTransform.Find("head").GetComponent("XUISprite") as IXUISprite;
+ ixuisprite.spriteName = XSingleton<XProfessionSkillMgr>.singleton.GetProfHeadIcon2((int)((int)beenApplyInfoByIndex.roleInfo.type % 10));
+ XFriendData friendDataById = DlgBase<XFriendsView, XFriendsBehaviour>.singleton.GetFriendDataById(beenApplyInfoByIndex.roleInfo.roleID);
+ IXUISprite ixuisprite2 = itemTransform.Find("Profession").GetComponent("XUISprite") as IXUISprite;
+ IXUILabelSymbol ixuilabelSymbol = itemTransform.Find("Name").GetComponent("XUILabelSymbol") as IXUILabelSymbol;
+ IXUILabel ixuilabel2 = itemTransform.Find("Name").GetComponent("XUILabel") as IXUILabel;
+ ixuisprite2.SetSprite(XSingleton<XProfessionSkillMgr>.singleton.GetProfIcon((int)((int)beenApplyInfoByIndex.roleInfo.type % 10)));
+ bool flag2 = friendDataById != null;
+ if (flag2)
+ {
+ ixuilabelSymbol.InputText = XSingleton<XCommon>.singleton.StringCombine(XTitleDocument.GetTitleWithFormat(friendDataById.titleID, friendDataById.name), XWelfareDocument.GetMemberPrivilegeIconString(friendDataById.paymemberid), XRechargeDocument.GetVIPIconString(friendDataById.viplevel));
+ }
+ else
+ {
+ ixuilabelSymbol.InputText = "";
+ ixuilabel2.SetText(beenApplyInfoByIndex.roleInfo.name);
+ }
+ IXUILabel ixuilabel3 = itemTransform.Find("MsgType").GetComponent("XUILabel") as IXUILabel;
+ switch (beenApplyInfoByIndex.applyType)
+ {
+ case MentorMsgApplyType.MentorMsgApplyMaster:
+ ixuilabel3.SetText(XSingleton<XStringTable>.singleton.GetString("MentorMsgApplyMaster"));
+ break;
+ case MentorMsgApplyType.MentorMsgApplyStudent:
+ ixuilabel3.SetText(XSingleton<XStringTable>.singleton.GetString("MentorMsgApplyStudent"));
+ break;
+ case MentorMsgApplyType.MentorMsgApplyInherit:
+ ixuilabel3.SetText(XSingleton<XStringTable>.singleton.GetString("MentorMsgApplyInherit"));
+ break;
+ case MentorMsgApplyType.MentorMsgApplyReportTask:
+ {
+ MentorTaskTable.RowData tableTaskInfoByTaskID = XMentorshipDocument.Doc.GetTableTaskInfoByTaskID((uint)beenApplyInfoByIndex.reportTaskID);
+ bool flag3 = tableTaskInfoByTaskID != null;
+ if (flag3)
+ {
+ ixuilabel3.SetText(tableTaskInfoByTaskID.TaskName);
+ }
+ else
+ {
+ ixuilabel3.SetText(XSingleton<XStringTable>.singleton.GetString("MentorPupilToReport"));
+ }
+ break;
+ }
+ case MentorMsgApplyType.MentorMsgApplyBreak:
+ ixuilabel3.SetText(XSingleton<XStringTable>.singleton.GetString("MentorMsgApplyBreak"));
+ break;
+ }
+ IXUIButton ixuibutton = itemTransform.Find("RefuseBtn").GetComponent("XUIButton") as IXUIButton;
+ ixuibutton.gameObject.SetActive(beenApplyInfoByIndex.applyType == MentorMsgApplyType.MentorMsgApplyStudent || beenApplyInfoByIndex.applyType == MentorMsgApplyType.MentorMsgApplyMaster);
+ ixuibutton.ID = (ulong)((long)index);
+ IXUIButton ixuibutton2 = itemTransform.Find("AcceptBtn").GetComponent("XUIButton") as IXUIButton;
+ ixuibutton2.gameObject.SetActive(beenApplyInfoByIndex.applyType == MentorMsgApplyType.MentorMsgApplyStudent || beenApplyInfoByIndex.applyType == MentorMsgApplyType.MentorMsgApplyMaster);
+ ixuibutton2.ID = (ulong)((long)index);
+ bool flag4 = beenApplyInfoByIndex.applyType == MentorMsgApplyType.MentorMsgApplyInherit || beenApplyInfoByIndex.applyType == MentorMsgApplyType.MentorMsgApplyReportTask || beenApplyInfoByIndex.applyType == MentorMsgApplyType.MentorMsgApplyBreak;
+ Transform transform = itemTransform.Find("OneBtn");
+ transform.gameObject.SetActive(flag4);
+ bool flag5 = flag4;
+ if (flag5)
+ {
+ IXUIButton ixuibutton3 = transform.GetComponent("XUIButton") as IXUIButton;
+ IXUILabel ixuilabel4 = itemTransform.Find("OneBtn/opStr").GetComponent("XUILabel") as IXUILabel;
+ bool flag6 = beenApplyInfoByIndex.applyType == MentorMsgApplyType.MentorMsgApplyReportTask;
+ if (flag6)
+ {
+ ixuibutton3.RegisterClickEventHandler(new ButtonClickEventHandler(this.OnClickToAgreeReport));
+ ixuilabel4.SetText(XSingleton<XStringTable>.singleton.GetString("AcceptReport"));
+ ixuibutton3.ID = (ulong)((long)index);
+ }
+ else
+ {
+ bool flag7 = beenApplyInfoByIndex.applyType == MentorMsgApplyType.MentorMsgApplyInherit;
+ if (flag7)
+ {
+ ixuibutton3.RegisterClickEventHandler(new ButtonClickEventHandler(this.OnClickToInherit));
+ ixuilabel4.SetText(XSingleton<XStringTable>.singleton.GetString("ToAccept"));
+ ixuibutton3.ID = (ulong)((long)index);
+ }
+ else
+ {
+ bool flag8 = beenApplyInfoByIndex.applyType == MentorMsgApplyType.MentorMsgApplyBreak;
+ if (flag8)
+ {
+ ixuibutton3.RegisterClickEventHandler(new ButtonClickEventHandler(this.OnClickToBreak));
+ ixuilabel4.SetText(XSingleton<XStringTable>.singleton.GetString("ToConfirm"));
+ ixuibutton3.ID = (ulong)((long)index);
+ }
+ }
+ }
+ }
+ }
+ }
+
+ private bool OnClickToBreak(IXUIButton button)
+ {
+ int index = (int)button.ID;
+ MentorBeenApplyedInfo beenApplyInfoByIndex = XMentorshipDocument.Doc.GetBeenApplyInfoByIndex(index);
+ bool flag = beenApplyInfoByIndex != null;
+ if (flag)
+ {
+ XMentorshipDocument.Doc.SendCandidatesOpReq(EMentorMsgOpType.EMentorMsgOpType_Agree, beenApplyInfoByIndex.roleInfo.roleID, beenApplyInfoByIndex.applyType, 0, false);
+ }
+ return true;
+ }
+
+ private bool OnClickToInherit(IXUIButton button)
+ {
+ int index = (int)button.ID;
+ MentorBeenApplyedInfo beenApplyInfoByIndex = XMentorshipDocument.Doc.GetBeenApplyInfoByIndex(index);
+ bool flag = beenApplyInfoByIndex != null;
+ if (flag)
+ {
+ XMentorshipDocument.Doc.SendCandidatesOpReq(EMentorMsgOpType.EMentorMsgOpType_Agree, beenApplyInfoByIndex.roleInfo.roleID, beenApplyInfoByIndex.applyType, 0, false);
+ }
+ return true;
+ }
+
+ private void OnWrapContentItemInit(Transform itemTransform, int index)
+ {
+ IXUIButton ixuibutton = itemTransform.Find("RefuseBtn").GetComponent("XUIButton") as IXUIButton;
+ ixuibutton.RegisterClickEventHandler(new ButtonClickEventHandler(this.OnRefuseApply));
+ IXUIButton ixuibutton2 = itemTransform.Find("AcceptBtn").GetComponent("XUIButton") as IXUIButton;
+ ixuibutton2.RegisterClickEventHandler(new ButtonClickEventHandler(this.OnAcceptApply));
+ }
+
+ private bool OnClickToAgreeReport(IXUIButton button)
+ {
+ int index = (int)button.ID;
+ MentorBeenApplyedInfo beenApplyInfoByIndex = XMentorshipDocument.Doc.GetBeenApplyInfoByIndex(index);
+ bool flag = beenApplyInfoByIndex != null;
+ if (flag)
+ {
+ XMentorshipDocument.Doc.SendCandidatesOpReq(EMentorMsgOpType.EMentorMsgOpType_Agree, beenApplyInfoByIndex.roleInfo.roleID, beenApplyInfoByIndex.applyType, beenApplyInfoByIndex.reportTaskID, false);
+ }
+ return true;
+ }
+
+ private bool OnAcceptApply(IXUIButton button)
+ {
+ MentorBeenApplyedInfo beenApplyInfoByIndex = XMentorshipDocument.Doc.GetBeenApplyInfoByIndex((int)button.ID);
+ bool flag = beenApplyInfoByIndex != null;
+ if (flag)
+ {
+ XMentorshipDocument.Doc.SendCandidatesOpReq(EMentorMsgOpType.EMentorMsgOpType_Agree, beenApplyInfoByIndex.roleInfo.roleID, beenApplyInfoByIndex.applyType, 0, false);
+ }
+ return true;
+ }
+
+ private bool OnRefuseApply(IXUIButton button)
+ {
+ MentorBeenApplyedInfo beenApplyInfoByIndex = XMentorshipDocument.Doc.GetBeenApplyInfoByIndex((int)button.ID);
+ bool flag = beenApplyInfoByIndex != null;
+ if (flag)
+ {
+ XMentorshipDocument.Doc.SendCandidatesOpReq(EMentorMsgOpType.EMentorMsgOpType_Reject, beenApplyInfoByIndex.roleInfo.roleID, beenApplyInfoByIndex.applyType, 0, false);
+ }
+ return true;
+ }
+ }
+}
|