summaryrefslogtreecommitdiff
path: root/Client/Assets/Scripts/XMainClient/RecruitGroupPublishView.cs
blob: 0728ee24190f7c229cc40f9e4234ef9c4ca7f47a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
using System;
using KKSG;
using UILib;
using XMainClient.UI;
using XUtliPoolLib;

namespace XMainClient
{
	internal class RecruitGroupPublishView : RecruitPublishView<RecruitGroupPublishView, RecruitGroupPublishBehaviour>
	{
		public override string fileName
		{
			get
			{
				return "Team/RecruitGroupPublishFrame";
			}
		}

		private RecruitStepCounter _StepCounter;

		private RecruitSelectGroupHandler _SelectGroupHandle;

		private GroupChatFindTeamInfo _TeamInfo;

		protected override void OnUnload()
		{
			DlgHandlerBase.EnsureUnload<RecruitSelectGroupHandler>(ref this._SelectGroupHandle);
			DlgHandlerBase.EnsureUnload<RecruitStepCounter>(ref this._StepCounter);
			base.OnUnload();
		}

		protected override void Init()
		{
			base.Init();
			this._StepCounter = DlgHandlerBase.EnsureCreate<RecruitStepCounter>(ref this._StepCounter, base.uiBehaviour.m_BattlePoint.gameObject, null, true);
			this._SelectGroupHandle = DlgHandlerBase.EnsureCreate<RecruitSelectGroupHandler>(ref this._SelectGroupHandle, base.uiBehaviour.m_SelectGroup.gameObject, null, true);
		}

		protected override void OnShow()
		{
			base.OnShow();
			this.OnStageSelect();
			bool flag = this._SelectGroupHandle != null;
			if (flag)
			{
				this._SelectGroupHandle.RefreshData();
			}
		}

		protected override void OnStageSelect()
		{
			uint selectStageID = base.GetSelectStageID();
			bool flag = selectStageID == 0u;
			if (!flag)
			{
				XExpeditionDocument specificDocument = XDocuments.GetSpecificDocument<XExpeditionDocument>(XExpeditionDocument.uuID);
				ExpeditionTable.RowData expeditionDataByID = specificDocument.GetExpeditionDataByID((int)selectStageID);
				int @int = XSingleton<XGlobalConfig>.singleton.GetInt("TeamSettingPPTStep");
				int displayPPT = (int)expeditionDataByID.DisplayPPT;
				this._StepCounter.Setup(displayPPT, -1, displayPPT, @int, new RecruitStepCounterUpdate(this.OnPPTStepUpdate));
			}
		}

		protected override bool OnSubmitClick(IXUIButton btn)
		{
			bool flag = this._SelectGroupHandle == null || this._SelectGroupHandle.SelectGroup == null;
			bool result;
			if (flag)
			{
				XSingleton<UiUtility>.singleton.ShowSystemTip(XStringDefineProxy.GetString("GroupChat_UnSelectGroup"), "fece00");
				result = false;
			}
			else
			{
				bool flag2 = this._TeamInfo == null;
				if (flag2)
				{
					this._TeamInfo = new GroupChatFindTeamInfo();
				}
				this._TeamInfo.groupchatID = this._SelectGroupHandle.SelectGroup.id;
				this._TeamInfo.groupchatName = this._SelectGroupHandle.SelectGroup.name;
				this._TeamInfo.stageID = base.GetSelectStageID();
				this._TeamInfo.fighting = (uint)this._StepCounter.Cur;
				this._TeamInfo.type = base.GetMemberType();
				this._TeamInfo.time = (uint)base.GetTime();
				this._doc.SendGroupChatLeaderInfo(this._TeamInfo);
				result = base.OnSubmitClick(btn);
			}
			return result;
		}

		private void OnPPTStepUpdate(IXUILabel label)
		{
			label.SetText(this._StepCounter.Cur.ToString());
		}
	}
}