summaryrefslogtreecommitdiff
path: root/Client/Assets/Scripts/XMainClient/XMentorshipPupilsHandler.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Client/Assets/Scripts/XMainClient/XMentorshipPupilsHandler.cs')
-rw-r--r--Client/Assets/Scripts/XMainClient/XMentorshipPupilsHandler.cs881
1 files changed, 881 insertions, 0 deletions
diff --git a/Client/Assets/Scripts/XMainClient/XMentorshipPupilsHandler.cs b/Client/Assets/Scripts/XMainClient/XMentorshipPupilsHandler.cs
new file mode 100644
index 00000000..6663ab5a
--- /dev/null
+++ b/Client/Assets/Scripts/XMainClient/XMentorshipPupilsHandler.cs
@@ -0,0 +1,881 @@
+using System;
+using KKSG;
+using UILib;
+using UnityEngine;
+using XMainClient.UI;
+using XMainClient.UI.UICommon;
+using XUtliPoolLib;
+
+namespace XMainClient
+{
+ internal class XMentorshipPupilsHandler : DlgHandlerBase
+ {
+ protected override string FileName
+ {
+ get
+ {
+ return "GameSystem/TeacherPupil";
+ }
+ }
+
+ private IXUILabel _pupilCondition;
+
+ private IXUILabel _masterCondition;
+
+ private Transform _noMentorship;
+
+ private Transform _hasMentorship;
+
+ private Transform _setting;
+
+ private Transform _pupilRewards;
+
+ private Transform _gongKuTaskItemTrans;
+
+ private IXUIScrollView _scrollView;
+
+ private IXUIWrapContent _reportWrapContent;
+
+ private IXUILabel _footPrintLabel;
+
+ private IXUICheckBox _footPrintCheck;
+
+ private IXUIInput _PromiseContentInput;
+
+ private bool _isCancelRecord;
+
+ private Vector2 _dragDistance;
+
+ private ulong _currentRoleID = 0UL;
+
+ private IXUIButton _reportBtn;
+
+ protected override void Init()
+ {
+ base.Init();
+ this.InitProperties();
+ }
+
+ public override void RegisterEvent()
+ {
+ base.RegisterEvent();
+ }
+
+ protected override void OnShow()
+ {
+ base.OnShow();
+ this._currentRoleID = 0UL;
+ XMentorshipDocument.Doc.SendMentorshipInfoReq();
+ }
+
+ protected override void OnHide()
+ {
+ base.OnHide();
+ }
+
+ public override void OnUnload()
+ {
+ this._currentRoleID = 0UL;
+ base.OnUnload();
+ }
+
+ public void RefreshUI()
+ {
+ MyMentorship myMentorShip = XMentorshipDocument.Doc.GetMyMentorShip();
+ this.InitItemsShowOrNot(myMentorShip);
+ switch (myMentorShip)
+ {
+ case MyMentorship.None:
+ this.UpdateNoneRelationUI();
+ break;
+ case MyMentorship.Mentorship_Pupil:
+ this.UpdatePupilUI();
+ break;
+ case MyMentorship.Mentorship_Master:
+ this.UpdateMasterUI();
+ break;
+ }
+ }
+
+ public void OnSettingOk()
+ {
+ this._setting.gameObject.SetActive(false);
+ this.UpdateMentorshipPromise();
+ }
+
+ public void RefreshTaskItems()
+ {
+ this._reportWrapContent.RefreshAllVisibleContents();
+ this.RefreshRelationRightViewByRoleID();
+ this.RefreshRedPoint();
+ }
+
+ public void UpdateInheritTaskItem()
+ {
+ MentorRelationInfo relationTargetInfoByRoleID = XMentorshipDocument.Doc.GetRelationTargetInfoByRoleID(this._currentRoleID);
+ bool flag = relationTargetInfoByRoleID != null;
+ if (flag)
+ {
+ this.RefreshRedPoint();
+ IXUIButton ixuibutton = this._gongKuTaskItemTrans.Find("Operation").GetComponent("XUIButton") as IXUIButton;
+ ixuibutton.ID = this._currentRoleID;
+ IXUILabel ixuilabel = this._gongKuTaskItemTrans.Find("Operation/GetLabel").GetComponent("XUILabel") as IXUILabel;
+ IXUILabel ixuilabel2 = this._gongKuTaskItemTrans.Find("Rewards").GetComponent("XUILabel") as IXUILabel;
+ IXUISprite ixuisprite = this._gongKuTaskItemTrans.Find("Rewards/Icon").GetComponent("XUISprite") as IXUISprite;
+ SeqList<int> sequenceList = XSingleton<XGlobalConfig>.singleton.GetSequenceList("TeacherInheritRewards", true);
+ ixuilabel2.SetText((sequenceList[0, 1] == 0) ? "" : sequenceList[0, 1].ToString());
+ ItemList.RowData itemConf = XBagDocument.GetItemConf(sequenceList[0, 0]);
+ ixuisprite.SetSprite(itemConf.ItemIcon1[0]);
+ Transform transform = this._gongKuTaskItemTrans.Find("Operation/RedPoint");
+ transform.gameObject.SetActive(false);
+ ixuibutton.SetEnable(true, false);
+ EMentorTaskStatus inheritStatus = relationTargetInfoByRoleID.inheritStatus;
+ if (inheritStatus != EMentorTaskStatus.EMentorTask_CanReport)
+ {
+ if (inheritStatus != EMentorTaskStatus.EMentorTask_AlreadyReport)
+ {
+ ixuilabel.SetText(XSingleton<XStringTable>.singleton.GetString("InheritFinishMentor"));
+ ixuibutton.SetEnable(false, false);
+ }
+ else
+ {
+ bool flag2 = relationTargetInfoByRoleID.inheritApplyRoleID != XSingleton<XAttributeMgr>.singleton.XPlayerData.RoleID;
+ if (flag2)
+ {
+ ixuilabel.SetText(XSingleton<XStringTable>.singleton.GetString("ToAccept"));
+ transform.gameObject.SetActive(true);
+ }
+ else
+ {
+ ixuibutton.SetEnable(false, false);
+ ixuilabel.SetText(XSingleton<XStringTable>.singleton.GetString("CHAT_SENT"));
+ }
+ }
+ }
+ else
+ {
+ ixuilabel.SetText(XSingleton<XStringTable>.singleton.GetString("InheritMentor"));
+ }
+ }
+ }
+
+ public void RefreshRedPoint()
+ {
+ int relationIndexByRoleID = XMentorshipDocument.Doc.GetRelationIndexByRoleID(this._currentRoleID);
+ bool flag = relationIndexByRoleID >= 0;
+ if (flag)
+ {
+ Transform transform = this._hasMentorship.Find("Pupil" + (relationIndexByRoleID + 1) + "/RedPoint");
+ transform.gameObject.SetActive(XMentorshipDocument.Doc.GetOneRedStausByIndex(relationIndexByRoleID));
+ bool flag2 = XMentorshipDocument.Doc.GetMyMentorShip() == MyMentorship.Mentorship_Pupil;
+ if (flag2)
+ {
+ bool active = !XMentorshipDocument.Doc.IsAllReported(this._currentRoleID);
+ this._reportBtn.gameObject.transform.Find("RedPoint").gameObject.SetActive(active);
+ }
+ }
+ }
+
+ private void InitProperties()
+ {
+ this.InitStateTransProperties();
+ this.InitNoMentorshipProperties();
+ this.InitHasMentorShipProperties();
+ this.InitSettingProperties();
+ this.InitPupilRewardsProperties();
+ }
+
+ private void InitPupilRewardsProperties()
+ {
+ IXUIButton ixuibutton = this._pupilRewards.Find("Close").GetComponent("XUIButton") as IXUIButton;
+ ixuibutton.RegisterClickEventHandler(new ButtonClickEventHandler(this.OnClosePupilRewards));
+ }
+
+ private bool OnClosePupilRewards(IXUIButton button)
+ {
+ this._pupilRewards.gameObject.SetActive(false);
+ return true;
+ }
+
+ private void InitSettingProperties()
+ {
+ this._footPrintCheck = (this._setting.Find("CheckMentorship").GetComponent("XUICheckBox") as IXUICheckBox);
+ this._footPrintCheck.RegisterOnCheckEventHandler(new CheckBoxOnCheckEventHandler(this.OnLeaveFootPrintToggle));
+ IXUIButton ixuibutton = this._setting.Find("ok").GetComponent("XUIButton") as IXUIButton;
+ ixuibutton.RegisterClickEventHandler(new ButtonClickEventHandler(this.OnConfirmSetting));
+ IXUIButton ixuibutton2 = this._setting.Find("Close").GetComponent("XUIButton") as IXUIButton;
+ ixuibutton2.RegisterClickEventHandler(new ButtonClickEventHandler(this.OnCloseSettingDialog));
+ this._footPrintLabel = (this._footPrintCheck.gameObject.transform.Find("Mentorship").GetComponent("XUILabel") as IXUILabel);
+ this._PromiseContentInput = (this._setting.Find("PromiseContentBg").GetComponent("XUIInput") as IXUIInput);
+ }
+
+ private bool OnConfirmSetting(IXUIButton button)
+ {
+ bool flag = (this._footPrintCheck.bChecked ^ !XMentorshipDocument.Doc.LeaveFootprint) || !this._PromiseContentInput.GetText().Equals(XMentorshipDocument.Doc.MentorshipApplyWords);
+ if (flag)
+ {
+ XMentorshipDocument.Doc.SendUpdateMentorshopSetting(this._PromiseContentInput.GetText(), this._footPrintCheck.bChecked);
+ }
+ else
+ {
+ this._setting.gameObject.SetActive(false);
+ }
+ return true;
+ }
+
+ private void OnDragPressBtn(IXUIButton button, Vector2 delta)
+ {
+ this._dragDistance += delta;
+ this._isCancelRecord = (this._dragDistance.magnitude >= 100f);
+ }
+
+ private bool OnCloseSettingDialog(IXUIButton button)
+ {
+ this._setting.gameObject.SetActive(false);
+ return true;
+ }
+
+ private bool OnLeaveFootPrintToggle(IXUICheckBox iXUICheckBox)
+ {
+ XMentorshipDocument.Doc.LeaveFootprint = iXUICheckBox.bChecked;
+ return true;
+ }
+
+ private void InitHasMentorShipProperties()
+ {
+ IXUIButton ixuibutton = this._hasMentorship.Find("MentorshipMall").GetComponent("XUIButton") as IXUIButton;
+ ixuibutton.RegisterClickEventHandler(new ButtonClickEventHandler(this.OnClickMallBtn));
+ IXUIButton ixuibutton2 = this._hasMentorship.Find("RewardsRules").GetComponent("XUIButton") as IXUIButton;
+ ixuibutton2.RegisterClickEventHandler(new ButtonClickEventHandler(this.OnClickRewardsBtn));
+ IXUIButton ixuibutton3 = this._hasMentorship.Find("PrivateChat").GetComponent("XUIButton") as IXUIButton;
+ ixuibutton3.RegisterClickEventHandler(new ButtonClickEventHandler(this.OnClickPrivateChatBtn));
+ this._reportBtn = (this._hasMentorship.Find("AllReport").GetComponent("XUIButton") as IXUIButton);
+ this._reportBtn.RegisterClickEventHandler(new ButtonClickEventHandler(this.OnClickAllReportBtn));
+ IXUIButton ixuibutton4 = this._hasMentorship.Find("AddMentorship/Add").GetComponent("XUIButton") as IXUIButton;
+ ixuibutton4.RegisterClickEventHandler(new ButtonClickEventHandler(this.OnClickAddMentorShipBtn));
+ IXUISprite ixuisprite = this._hasMentorship.Find("CurrentMentorInstruction/NextStep").GetComponent("XUISprite") as IXUISprite;
+ ixuisprite.RegisterSpriteClickEventHandler(new SpriteClickEventHandler(this.OnClickNextStep));
+ IXUISprite ixuisprite2 = this._noMentorship.Find("NextStep").GetComponent("XUISprite") as IXUISprite;
+ ixuisprite2.RegisterSpriteClickEventHandler(new SpriteClickEventHandler(this.OnClickNextStep));
+ this._reportWrapContent = (this._hasMentorship.Find("MentorshipTask/ScrollPanel/WrapContent").GetComponent("XUIWrapContent") as IXUIWrapContent);
+ this._scrollView = (this._hasMentorship.Find("MentorshipTask/ScrollPanel").GetComponent("XUIScrollView") as IXUIScrollView);
+ this._reportWrapContent.RegisterItemInitEventHandler(new WrapItemInitEventHandler(this.ReportWrapContentInit));
+ this._reportWrapContent.RegisterItemUpdateEventHandler(new WrapItemUpdateEventHandler(this.ReportWrapContentUpdate));
+ }
+
+ private void ReportWrapContentUpdate(Transform itemTransform, int index)
+ {
+ MyMentorship myMentorShip = XMentorshipDocument.Doc.GetMyMentorShip();
+ bool flag = myMentorShip == MyMentorship.Mentorship_Pupil;
+ MentorshipTaskInfo mentorshipTaskInfo;
+ if (flag)
+ {
+ mentorshipTaskInfo = XMentorshipDocument.Doc.GetMyMentorshipTaskInfoByIndex(index);
+ }
+ else
+ {
+ mentorshipTaskInfo = XMentorshipDocument.Doc.GetTaskInfoWithIndexAndRoleID(index, this._currentRoleID);
+ }
+ bool flag2 = mentorshipTaskInfo != null;
+ if (flag2)
+ {
+ MentorTaskTable.RowData tableTaskInfoByTaskID = XMentorshipDocument.Doc.GetTableTaskInfoByTaskID((uint)mentorshipTaskInfo.taskID);
+ bool flag3 = tableTaskInfoByTaskID != null;
+ if (flag3)
+ {
+ IXUILabel ixuilabel = itemTransform.Find("taskDes").GetComponent("XUILabel") as IXUILabel;
+ ixuilabel.SetText(tableTaskInfoByTaskID.TaskName);
+ IXUILabel ixuilabel2 = itemTransform.Find("Rewards").GetComponent("XUILabel") as IXUILabel;
+ IXUISprite ixuisprite = itemTransform.Find("Rewards/Icon").GetComponent("XUISprite") as IXUISprite;
+ bool flag4 = myMentorShip == MyMentorship.Mentorship_Master;
+ if (flag4)
+ {
+ bool flag5 = tableTaskInfoByTaskID.MasterReward.count > 0;
+ if (flag5)
+ {
+ ixuilabel2.SetText(tableTaskInfoByTaskID.MasterReward[0, 1].ToString());
+ ItemList.RowData itemConf = XBagDocument.GetItemConf(tableTaskInfoByTaskID.MasterReward[0, 0]);
+ ixuisprite.SetSprite(itemConf.ItemIcon1[0]);
+ }
+ }
+ else
+ {
+ bool flag6 = tableTaskInfoByTaskID.StudentReward.count > 0;
+ if (flag6)
+ {
+ ixuilabel2.SetText(tableTaskInfoByTaskID.StudentReward[0, 1].ToString());
+ ItemList.RowData itemConf2 = XBagDocument.GetItemConf(tableTaskInfoByTaskID.StudentReward[0, 0]);
+ ixuisprite.SetSprite(itemConf2.ItemIcon1[0]);
+ }
+ }
+ IXUILabel ixuilabel3 = itemTransform.Find("Progress").GetComponent("XUILabel") as IXUILabel;
+ ixuilabel3.gameObject.SetActive(false);
+ bool flag7 = tableTaskInfoByTaskID.TaskType == 3u || tableTaskInfoByTaskID.TaskType == 29u;
+ int num = flag7 ? 1 : tableTaskInfoByTaskID.TaskVar[1];
+ int num2 = mentorshipTaskInfo.completeProgress;
+ bool flag8 = flag7;
+ if (flag8)
+ {
+ num2 = ((mentorshipTaskInfo.completeTime == 0) ? 0 : 1);
+ }
+ ixuilabel3.SetText(num2 + "/" + num);
+ IXUIButton ixuibutton = itemTransform.Find("Operation").GetComponent("XUIButton") as IXUIButton;
+ ixuibutton.ID = (ulong)((long)mentorshipTaskInfo.taskID);
+ Transform transform = ixuibutton.gameObject.transform.Find("RedPoint");
+ transform.gameObject.SetActive(false);
+ IXUILabel ixuilabel4 = ixuibutton.gameObject.transform.Find("GetLabel").GetComponent("XUILabel") as IXUILabel;
+ ixuibutton.gameObject.SetActive(true);
+ ixuibutton.SetEnable(true, false);
+ EMentorTaskStatus ementorTaskStatus = EMentorTaskStatus.EMentorTask_UnComplete;
+ for (int i = 0; i < mentorshipTaskInfo.taskStatusList.Count; i++)
+ {
+ MentorshipTaskStatus mentorshipTaskStatus = mentorshipTaskInfo.taskStatusList[i];
+ bool flag9 = mentorshipTaskStatus.roleID == this._currentRoleID;
+ if (flag9)
+ {
+ ementorTaskStatus = (EMentorTaskStatus)mentorshipTaskStatus.status;
+ break;
+ }
+ }
+ bool flag10 = ementorTaskStatus == EMentorTaskStatus.EMentorTask_UnComplete;
+ if (flag10)
+ {
+ ixuibutton.gameObject.SetActive(false);
+ ixuilabel3.gameObject.SetActive(true);
+ }
+ else
+ {
+ bool flag11 = ementorTaskStatus == EMentorTaskStatus.EMentorTask_CanReport;
+ if (flag11)
+ {
+ bool flag12 = myMentorShip == MyMentorship.Mentorship_Pupil;
+ if (flag12)
+ {
+ transform.gameObject.SetActive(true);
+ ixuilabel4.SetText(XSingleton<XStringTable>.singleton.GetString("Report"));
+ }
+ else
+ {
+ ixuibutton.gameObject.SetActive(false);
+ ixuilabel3.gameObject.SetActive(true);
+ }
+ }
+ else
+ {
+ bool flag13 = ementorTaskStatus == EMentorTaskStatus.EMentorTask_AlreadyReport;
+ if (flag13)
+ {
+ bool flag14 = myMentorShip == MyMentorship.Mentorship_Pupil;
+ if (flag14)
+ {
+ ixuilabel4.SetText(XSingleton<XStringTable>.singleton.GetString("Reported"));
+ ixuibutton.SetEnable(false, false);
+ }
+ else
+ {
+ transform.gameObject.SetActive(true);
+ ixuilabel4.SetText(XSingleton<XStringTable>.singleton.GetString("ToConfirm"));
+ }
+ }
+ else
+ {
+ ixuilabel4.SetText(XSingleton<XStringTable>.singleton.GetString("Completed"));
+ ixuibutton.SetEnable(false, false);
+ }
+ }
+ }
+ }
+ }
+ }
+
+ private void ReportWrapContentInit(Transform itemTransform, int index)
+ {
+ IXUIButton ixuibutton = itemTransform.Find("Operation").GetComponent("XUIButton") as IXUIButton;
+ ixuibutton.RegisterClickEventHandler(new ButtonClickEventHandler(this.OnClickOperation));
+ }
+
+ private bool OnClickOperation(IXUIButton button)
+ {
+ MyMentorship myMentorShip = XMentorshipDocument.Doc.GetMyMentorShip();
+ bool flag = myMentorShip == MyMentorship.Mentorship_Master;
+ if (flag)
+ {
+ XMentorshipDocument.Doc.SendCandidatesOpReq(EMentorMsgOpType.EMentorMsgOpType_Agree, this._currentRoleID, MentorMsgApplyType.MentorMsgApplyReportTask, (int)button.ID, false);
+ }
+ else
+ {
+ XMentorshipDocument.Doc.SendMentorRelationOp(MentorRelationOpType.MentorRelationOp_ReportTask, this._currentRoleID, (int)button.ID);
+ }
+ return true;
+ }
+
+ private bool OnClickAllReportBtn(IXUIButton button)
+ {
+ bool flag = !XMentorshipDocument.Doc.IsAllReported(this._currentRoleID);
+ if (flag)
+ {
+ XMentorshipDocument.Doc.SendMentorRelationOp(MentorRelationOpType.MentorRelationOp_ReportAllTask, this._currentRoleID, 0);
+ }
+ else
+ {
+ XSingleton<UiUtility>.singleton.ShowSystemTip(XSingleton<XStringTable>.singleton.GetString("CompleteTaskToReport"), "fece00");
+ }
+ return true;
+ }
+
+ private bool OnClickPrivateChatBtn(IXUIButton button)
+ {
+ XFriendData friendDataById = DlgBase<XFriendsView, XFriendsBehaviour>.singleton.GetFriendDataById(this._currentRoleID);
+ bool flag = friendDataById != null;
+ if (flag)
+ {
+ ChatFriendData chatFriendData = new ChatFriendData();
+ chatFriendData.name = friendDataById.name;
+ chatFriendData.roleid = friendDataById.roleid;
+ chatFriendData.powerpoint = friendDataById.powerpoint;
+ chatFriendData.profession = friendDataById.profession;
+ chatFriendData.viplevel = friendDataById.viplevel;
+ chatFriendData.isfriend = true;
+ chatFriendData.msgtime = DateTime.Now;
+ chatFriendData.setid = friendDataById.setid;
+ DlgBase<XChatView, XChatBehaviour>.singleton.PrivateChatTo(chatFriendData);
+ }
+ return true;
+ }
+
+ private void InitNoMentorshipProperties()
+ {
+ IXUIButton ixuibutton = this._noMentorship.Find("MentorshipMall").GetComponent("XUIButton") as IXUIButton;
+ ixuibutton.RegisterClickEventHandler(new ButtonClickEventHandler(this.OnClickMallBtn));
+ IXUIButton ixuibutton2 = this._noMentorship.Find("RewarsRules").GetComponent("XUIButton") as IXUIButton;
+ ixuibutton2.RegisterClickEventHandler(new ButtonClickEventHandler(this.OnClickRewardsBtn));
+ IXUIButton ixuibutton3 = this._noMentorship.Find("Setting").GetComponent("XUIButton") as IXUIButton;
+ ixuibutton3.RegisterClickEventHandler(new ButtonClickEventHandler(this.OnClickSettingBtn));
+ IXUIButton ixuibutton4 = this._noMentorship.Find("Bg/Pupil/PupilBg").GetComponent("XUIButton") as IXUIButton;
+ ixuibutton4.RegisterClickEventHandler(new ButtonClickEventHandler(this.OnToGetPupils));
+ IXUIButton ixuibutton5 = this._noMentorship.Find("Bg/Master/MasterBg").GetComponent("XUIButton") as IXUIButton;
+ ixuibutton5.RegisterClickEventHandler(new ButtonClickEventHandler(this.OnToGetMaster));
+ this._pupilCondition = (this._noMentorship.Find("Bg/Pupil/PupilCondition").GetComponent("XUILabel") as IXUILabel);
+ this._masterCondition = (this._noMentorship.Find("Bg/Master/MasterCondition").GetComponent("XUILabel") as IXUILabel);
+ }
+
+ private bool OnToGetMaster(IXUIButton button)
+ {
+ bool flag = XMentorshipDocument.Doc.GetMyPossibleMentorship() == MyMentorship.Mentorship_Pupil;
+ if (flag)
+ {
+ XMentorshipDocument.Doc.SetCandidatesViewVisible(CandidatesViewType.Recommend, CandidatesViewRecommendType.Master);
+ XMentorshipDocument.Doc.SendToGetMyApplyMasterInfo(false);
+ }
+ else
+ {
+ XSingleton<UiUtility>.singleton.ShowSystemTip(XSingleton<XStringTable>.singleton.GetString("CantApplyMaster"), "fece00");
+ }
+ return true;
+ }
+
+ private bool OnToGetPupils(IXUIButton button)
+ {
+ bool flag = XMentorshipDocument.Doc.GetMyPossibleMentorship() == MyMentorship.Mentorship_Master;
+ if (flag)
+ {
+ XMentorshipDocument.Doc.SetCandidatesViewVisible(CandidatesViewType.Recommend, CandidatesViewRecommendType.Pupil);
+ XMentorshipDocument.Doc.SendToGetMyApplyPupilsInfo(false);
+ }
+ else
+ {
+ XSingleton<UiUtility>.singleton.ShowSystemTip(XSingleton<XStringTable>.singleton.GetString("CantApplyPupil"), "fece00");
+ }
+ return true;
+ }
+
+ private bool OnClickSettingBtn(IXUIButton button)
+ {
+ this._setting.gameObject.SetActive(true);
+ return true;
+ }
+
+ private bool OnClickRewardsBtn(IXUIButton button)
+ {
+ this._pupilRewards.gameObject.SetActive(true);
+ this.UpdatePupilRewardsDialog();
+ return true;
+ }
+
+ private void UpdatePupilRewardsDialog()
+ {
+ IXUILabel ixuilabel = this._pupilRewards.Find("Normal/Base").GetComponent("XUILabel") as IXUILabel;
+ ixuilabel.SetText(string.Format(XSingleton<XStringTable>.singleton.GetString("CompletMentorTask"), XSingleton<XGlobalConfig>.singleton.GetInt("Mentor_NormalComplete"), "<" + XSingleton<XGlobalConfig>.singleton.GetInt("Mentor_PerfectComplete")));
+ IXUILabel ixuilabel2 = this._pupilRewards.Find("Perfect/More").GetComponent("XUILabel") as IXUILabel;
+ ixuilabel2.SetText(string.Format(XSingleton<XStringTable>.singleton.GetString("CompletMentorTask"), XSingleton<XGlobalConfig>.singleton.GetInt("Mentor_PerfectComplete"), ""));
+ MentorCompleteRewardTable mentorCompleteReward = XMentorshipDocument.MentorCompleteReward;
+ MentorCompleteRewardTable.RowData byType = mentorCompleteReward.GetByType(1);
+ SeqListRef<int> seqListRef = (XMentorshipDocument.Doc.GetMyMentorShip() == MyMentorship.Mentorship_Master) ? byType.MasterReward : byType.StudentReward;
+ Transform transform = this._pupilRewards.Find("Normal/PupilRewards");
+ Transform transform2 = this._pupilRewards.Find("Normal/MasterRewards");
+ XSingleton<XItemDrawerMgr>.singleton.normalItemDrawer.DrawItem(transform.gameObject, seqListRef[0, 0], seqListRef[0, 1], false);
+ IXUISprite ixuisprite = transform.Find("Icon").GetComponent("XUISprite") as IXUISprite;
+ ixuisprite.ID = (ulong)((long)seqListRef[0, 0]);
+ ixuisprite.RegisterSpriteClickEventHandler(new SpriteClickEventHandler(XSingleton<UiUtility>.singleton.OnItemClick));
+ XSingleton<XItemDrawerMgr>.singleton.normalItemDrawer.DrawItem(transform2.gameObject, seqListRef[1, 0], seqListRef[1, 1], false);
+ IXUISprite ixuisprite2 = transform2.Find("Icon").GetComponent("XUISprite") as IXUISprite;
+ ixuisprite2.ID = (ulong)((long)seqListRef[1, 0]);
+ ixuisprite2.RegisterSpriteClickEventHandler(new SpriteClickEventHandler(XSingleton<UiUtility>.singleton.OnItemClick));
+ MentorCompleteRewardTable.RowData byType2 = mentorCompleteReward.GetByType(2);
+ seqListRef = ((XMentorshipDocument.Doc.GetMyMentorShip() == MyMentorship.Mentorship_Master) ? byType2.MasterReward : byType2.StudentReward);
+ Transform transform3 = this._pupilRewards.Find("Perfect/PupilRewards");
+ Transform transform4 = this._pupilRewards.Find("Perfect/MasterRewards");
+ XSingleton<XItemDrawerMgr>.singleton.normalItemDrawer.DrawItem(transform3.gameObject, seqListRef[0, 0], seqListRef[0, 1], false);
+ ixuisprite = (transform3.Find("Icon").GetComponent("XUISprite") as IXUISprite);
+ ixuisprite.ID = (ulong)((long)seqListRef[0, 0]);
+ ixuisprite.RegisterSpriteClickEventHandler(new SpriteClickEventHandler(XSingleton<UiUtility>.singleton.OnItemClick));
+ XSingleton<XItemDrawerMgr>.singleton.normalItemDrawer.DrawItem(transform4.gameObject, seqListRef[1, 0], seqListRef[1, 1], false);
+ ixuisprite2 = (transform4.Find("Icon").GetComponent("XUISprite") as IXUISprite);
+ ixuisprite2.ID = (ulong)((long)seqListRef[1, 0]);
+ ixuisprite2.RegisterSpriteClickEventHandler(new SpriteClickEventHandler(XSingleton<UiUtility>.singleton.OnItemClick));
+ }
+
+ private bool OnClickMallBtn(IXUIButton button)
+ {
+ DlgBase<MallSystemDlg, MallSystemBehaviour>.singleton.ShowShopSystem(XSysDefine.XSys_Mall_Mentorship, 0UL);
+ return true;
+ }
+
+ private bool OnClickApplyNewsBtn(IXUIButton button)
+ {
+ XMentorshipDocument.Doc.SetCandidatesViewVisible(CandidatesViewType.Application, CandidatesViewRecommendType.None);
+ return true;
+ }
+
+ private void InitStateTransProperties()
+ {
+ this._noMentorship = base.transform.Find("NoMentorship");
+ this._hasMentorship = base.transform.Find("HasMentorship");
+ this._setting = base.transform.Find("ReName");
+ this._pupilRewards = base.transform.Find("Pupilreward");
+ this._gongKuTaskItemTrans = this._hasMentorship.Find("MentorshipTask/Gongku");
+ this._noMentorship.gameObject.SetActive(true);
+ this._hasMentorship.gameObject.SetActive(true);
+ this._setting.gameObject.SetActive(true);
+ this._pupilRewards.gameObject.SetActive(true);
+ IXUIButton ixuibutton = this._gongKuTaskItemTrans.Find("Operation").GetComponent("XUIButton") as IXUIButton;
+ ixuibutton.RegisterClickEventHandler(new ButtonClickEventHandler(this.OnClickToInherit));
+ }
+
+ private bool OnClickToInherit(IXUIButton button)
+ {
+ MentorRelationInfo relationTargetInfoByRoleID = XMentorshipDocument.Doc.GetRelationTargetInfoByRoleID(this._currentRoleID);
+ bool flag = relationTargetInfoByRoleID == null;
+ bool result;
+ if (flag)
+ {
+ result = false;
+ }
+ else
+ {
+ bool flag2 = relationTargetInfoByRoleID.inheritApplyRoleID == this._currentRoleID;
+ if (flag2)
+ {
+ XMentorshipDocument.Doc.SendCandidatesOpReq(EMentorMsgOpType.EMentorMsgOpType_Agree, this._currentRoleID, MentorMsgApplyType.MentorMsgApplyInherit, 0, false);
+ }
+ else
+ {
+ XMentorshipDocument.Doc.SendMentorRelationOp(MentorRelationOpType.MentorRelationOp_Inherit, this._currentRoleID, 0);
+ }
+ result = true;
+ }
+ return result;
+ }
+
+ private void InitItemsShowOrNot(MyMentorship relation)
+ {
+ this._pupilRewards.gameObject.SetActive(false);
+ this._setting.gameObject.SetActive(false);
+ this._noMentorship.gameObject.SetActive(relation == MyMentorship.None);
+ this._hasMentorship.gameObject.SetActive(relation == MyMentorship.Mentorship_Pupil || relation == MyMentorship.Mentorship_Master);
+ this._PromiseContentInput.SetText(XMentorshipDocument.Doc.MentorshipApplyWords);
+ this._footPrintCheck.bChecked = !XMentorshipDocument.Doc.LeaveFootprint;
+ }
+
+ private void UpdateMasterUI()
+ {
+ this.UpdateTargetsLeftUI();
+ this.UpdateDefaultSelectRole();
+ }
+
+ private void UpdateMasterRightUI()
+ {
+ this._reportBtn.gameObject.SetActive(false);
+ int myPupilTaskTotalNumber = XMentorshipDocument.Doc.GetMyPupilTaskTotalNumber(this._currentRoleID);
+ this._reportWrapContent.SetContentCount(myPupilTaskTotalNumber, false);
+ this._scrollView.ResetPosition();
+ this.UpdateInheritTaskItem();
+ }
+
+ private void UpdatePupilUI()
+ {
+ this.UpdateTargetsLeftUI();
+ this.UpdateDefaultSelectRole();
+ this.UpdatePupilRightUI();
+ }
+
+ private void UpdateDefaultSelectRole()
+ {
+ bool flag = this._currentRoleID == 0UL;
+ if (flag)
+ {
+ this.RefreshDefaultOneRelation();
+ }
+ else
+ {
+ int relationIndexByRoleID = XMentorshipDocument.Doc.GetRelationIndexByRoleID(this._currentRoleID);
+ bool flag2 = relationIndexByRoleID >= 0;
+ if (flag2)
+ {
+ Transform transform = this._hasMentorship.Find("Pupil" + (relationIndexByRoleID + 1));
+ IXUICheckBox ixuicheckBox = transform.GetComponent("XUICheckBox") as IXUICheckBox;
+ bool bChecked = ixuicheckBox.bChecked;
+ if (bChecked)
+ {
+ this.OnToggleRelationTarget(ixuicheckBox);
+ }
+ else
+ {
+ ixuicheckBox.ForceSetFlag(true);
+ }
+ }
+ else
+ {
+ this.RefreshDefaultOneRelation();
+ }
+ }
+ }
+
+ private void RefreshDefaultOneRelation()
+ {
+ int relationTargetsCount = XMentorshipDocument.Doc.GetRelationTargetsCount();
+ bool flag = relationTargetsCount <= 0;
+ if (!flag)
+ {
+ this._currentRoleID = XMentorshipDocument.Doc.GetRelationTargetInfo(0).roleInfo.roleID;
+ Transform transform = this._hasMentorship.Find("Pupil1");
+ IXUICheckBox ixuicheckBox = transform.GetComponent("XUICheckBox") as IXUICheckBox;
+ bool bChecked = ixuicheckBox.bChecked;
+ if (bChecked)
+ {
+ this.OnToggleRelationTarget(ixuicheckBox);
+ }
+ else
+ {
+ ixuicheckBox.ForceSetFlag(true);
+ }
+ }
+ }
+
+ private void UpdatePupilRightUI()
+ {
+ this._reportBtn.gameObject.SetActive(true);
+ int myMentorshipTaskCount = XMentorshipDocument.Doc.GetMyMentorshipTaskCount();
+ this._reportWrapContent.SetContentCount(myMentorshipTaskCount, false);
+ this._scrollView.ResetPosition();
+ this.UpdateInheritTaskItem();
+ }
+
+ private void UpdateTargetsLeftUI()
+ {
+ this.UpdateMentorshipPromise();
+ int relationTargetsCount = XMentorshipDocument.Doc.GetRelationTargetsCount();
+ bool flag = relationTargetsCount <= 0;
+ if (!flag)
+ {
+ Transform item = this._hasMentorship.Find("Pupil1");
+ this.UpdatePupilsItem(item, XMentorshipDocument.Doc.GetRelationTargetInfo(0).roleInfo);
+ Transform transform = this._hasMentorship.Find("Pupil2");
+ Transform transform2 = this._hasMentorship.Find("AddMentorship");
+ bool flag2 = relationTargetsCount > 1;
+ if (flag2)
+ {
+ transform.gameObject.SetActive(true);
+ transform2.gameObject.SetActive(false);
+ this.UpdatePupilsItem(transform, XMentorshipDocument.Doc.GetRelationTargetInfo(1).roleInfo);
+ }
+ else
+ {
+ transform2.gameObject.SetActive(true);
+ transform.gameObject.SetActive(false);
+ }
+ }
+ }
+
+ private void UpdateMentorshipPromise()
+ {
+ Transform transform = this._hasMentorship.Find("MentorshipPromise");
+ IXUILabel ixuilabel = transform.Find("title").GetComponent("XUILabel") as IXUILabel;
+ IXUILabel ixuilabel2 = transform.Find("Promise").GetComponent("XUILabel") as IXUILabel;
+ MyMentorship myMentorShip = XMentorshipDocument.Doc.GetMyMentorShip();
+ bool flag = myMentorShip == MyMentorship.Mentorship_Pupil;
+ if (flag)
+ {
+ ixuilabel.SetText(XSingleton<XStringTable>.singleton.GetString("MaterPromiseTitle"));
+ }
+ else
+ {
+ ixuilabel.SetText(XSingleton<XStringTable>.singleton.GetString("PupilPromiseTitle"));
+ }
+ ixuilabel2.SetText(XMentorshipDocument.Doc.MentorshipApplyWords);
+ IXUIButton ixuibutton = transform.Find("Setting").GetComponent("XUIButton") as IXUIButton;
+ ixuibutton.RegisterClickEventHandler(new ButtonClickEventHandler(this.OnClickSettingBtn));
+ }
+
+ private bool OnClickAddMentorShipBtn(IXUIButton button)
+ {
+ MyMentorship myMentorShip = XMentorshipDocument.Doc.GetMyMentorShip();
+ bool flag = myMentorShip == MyMentorship.Mentorship_Master;
+ if (flag)
+ {
+ XMentorshipDocument.Doc.SetCandidatesViewVisible(CandidatesViewType.Recommend, CandidatesViewRecommendType.Pupil);
+ }
+ else
+ {
+ bool flag2 = myMentorShip == MyMentorship.Mentorship_Pupil;
+ if (flag2)
+ {
+ XMentorshipDocument.Doc.SetCandidatesViewVisible(CandidatesViewType.Recommend, CandidatesViewRecommendType.Master);
+ }
+ }
+ return true;
+ }
+
+ private bool OnClickPlayVoiceBtn(IXUIButton button)
+ {
+ return true;
+ }
+
+ private void OnStopSignPlay(object ob)
+ {
+ IXUISpriteAnimation ixuispriteAnimation = (IXUISpriteAnimation)ob;
+ bool flag = ixuispriteAnimation != null;
+ if (flag)
+ {
+ ixuispriteAnimation.SetFrameRate(0);
+ ixuispriteAnimation.Reset();
+ }
+ }
+
+ private void UpdatePupilsItem(Transform item, RoleBriefInfo info)
+ {
+ IXUILabel ixuilabel = item.Find("level").GetComponent("XUILabel") as IXUILabel;
+ ixuilabel.SetText(info.level.ToString());
+ IXUISprite ixuisprite = item.Find("head/p").GetComponent("XUISprite") as IXUISprite;
+ ixuisprite.spriteName = ((XMentorshipDocument.Doc.GetMyMentorShip() == MyMentorship.Mentorship_Master) ? "bs_1" : "bs_0");
+ IXUISprite ixuisprite2 = item.Find("head").GetComponent("XUISprite") as IXUISprite;
+ ixuisprite2.spriteName = XSingleton<XProfessionSkillMgr>.singleton.GetProfHeadIcon2((int)((int)info.type % 10));
+ XFriendData friendDataById = DlgBase<XFriendsView, XFriendsBehaviour>.singleton.GetFriendDataById(info.roleID);
+ IXUILabelSymbol ixuilabelSymbol = item.Find("Name").GetComponent("XUILabelSymbol") as IXUILabelSymbol;
+ IXUILabel ixuilabel2 = item.Find("Name").GetComponent("XUILabel") as IXUILabel;
+ IXUISprite ixuisprite3 = item.Find("ProfIcon").GetComponent("XUISprite") as IXUISprite;
+ ixuisprite3.SetSprite(XSingleton<XProfessionSkillMgr>.singleton.GetProfIcon((int)((int)info.type % 10)));
+ bool flag = friendDataById != null;
+ if (flag)
+ {
+ ixuilabel2.SetText("");
+ 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(info.name);
+ }
+ IXUICheckBox ixuicheckBox = item.GetComponent("XUICheckBox") as IXUICheckBox;
+ ixuicheckBox.ID = info.roleID;
+ ixuicheckBox.RegisterOnCheckEventHandler(new CheckBoxOnCheckEventHandler(this.OnToggleRelationTarget));
+ Transform transform = item.Find("RedPoint");
+ bool flag2 = XMentorshipDocument.Doc.GetMyMentorShip() == MyMentorship.Mentorship_Pupil;
+ if (flag2)
+ {
+ transform.gameObject.SetActive(!XMentorshipDocument.Doc.IsAllReported(info.roleID));
+ }
+ else
+ {
+ transform.gameObject.SetActive(!XMentorshipDocument.Doc.IsAllAgreed(info.roleID));
+ }
+ }
+
+ private bool OnToggleRelationTarget(IXUICheckBox iXUICheckBox)
+ {
+ bool bChecked = iXUICheckBox.bChecked;
+ if (bChecked)
+ {
+ this._currentRoleID = iXUICheckBox.ID;
+ bool flag = XMentorshipDocument.Doc.GetMyMentorShip() == MyMentorship.Mentorship_Master;
+ if (flag)
+ {
+ this.UpdateMasterRightUI();
+ }
+ else
+ {
+ this.UpdatePupilRightUI();
+ }
+ this.RefreshRelationRightViewByRoleID();
+ this.RefreshRedPoint();
+ }
+ return true;
+ }
+
+ private void RefreshRelationRightViewByRoleID()
+ {
+ ulong currentRoleID = this._currentRoleID;
+ MyMentorship myMentorShip = XMentorshipDocument.Doc.GetMyMentorShip();
+ bool flag = myMentorShip == MyMentorship.Mentorship_Master;
+ string @string;
+ if (flag)
+ {
+ @string = XSingleton<XStringTable>.singleton.GetString("HasPupil");
+ }
+ else
+ {
+ @string = XSingleton<XStringTable>.singleton.GetString("HasMaster");
+ }
+ int relationTargetsCount = XMentorshipDocument.Doc.GetRelationTargetsCount();
+ IXUILabel ixuilabel = this._hasMentorship.Find("CurrentMentorInstruction").GetComponent("XUILabel") as IXUILabel;
+ ixuilabel.SetText(string.Concat(new object[]
+ {
+ @string,
+ relationTargetsCount.ToString(),
+ "/",
+ XMentorshipDocument.Doc.MaxRelationCount
+ }));
+ IXUILabel ixuilabel2 = this._hasMentorship.Find("MentorshipTask/ConditionBg/ConditonsLabel").GetComponent("XUILabel") as IXUILabel;
+ int num = XMentorshipDocument.Doc.GetRelationPassedDays(this._currentRoleID, MentorRelationStatus.MentorRelationIn) + 1;
+ int completedTaskCount = XMentorshipDocument.Doc.GetCompletedTaskCount(this._currentRoleID);
+ ixuilabel2.SetText(string.Format(XSingleton<XStringTable>.singleton.GetString("MentorOverConditions"), completedTaskCount + "/" + XSingleton<XGlobalConfig>.singleton.GetInt("Mentor_NormalComplete"), num + "/" + XSingleton<XGlobalConfig>.singleton.GetInt("Mentor_NormalCompleteDay")));
+ }
+
+ private void UpdateNoneRelationUI()
+ {
+ this.RefreshAcceptPupilConditions();
+ this.RefreshApplyMasterConditions();
+ }
+
+ private void RefreshApplyMasterConditions()
+ {
+ XLevelSealDocument specificDocument = XDocuments.GetSpecificDocument<XLevelSealDocument>(XLevelSealDocument.uuID);
+ uint sealType = specificDocument.GetSealType();
+ LevelSealTypeTable.RowData levelSealType = XLevelSealDocument.GetLevelSealType(sealType);
+ int num = (levelSealType == null) ? 30 : levelSealType.ApplyStudentLevel;
+ string format = XSingleton<UiUtility>.singleton.ReplaceReturn(XSingleton<XStringTable>.singleton.GetString("ToBeMasterCondition"));
+ this._pupilCondition.SetText(string.Format(format, num));
+ }
+
+ private void RefreshAcceptPupilConditions()
+ {
+ string text = XSingleton<UiUtility>.singleton.ReplaceReturn(XSingleton<XStringTable>.singleton.GetString("ToBePupilConditon"));
+ this._masterCondition.SetText(text);
+ }
+
+ private void OnClickNextStep(IXUISprite uiSprite)
+ {
+ DlgBase<XCommonHelpTipView, XCommonHelpTipBehaviour>.singleton.ShowHelp(XSysDefine.XSys_Mentorship);
+ }
+ }
+}