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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
|
using System;
using System.Collections.Generic;
using UILib;
using XMainClient.UI;
using XMainClient.UI.UICommon;
using XUtliPoolLib;
namespace XMainClient
{
internal class XDramaDocument : XDocComponent
{
public override uint ID
{
get
{
return XDramaDocument.uuID;
}
}
public XDramaOperate CurOperate
{
get
{
return this.m_CurOperate;
}
}
public new static readonly uint uuID = XSingleton<XCommon>.singleton.XHash("DramaDocument");
private Dictionary<XSysDefine, XDramaOperate> _DramaOperateDic = new Dictionary<XSysDefine, XDramaOperate>(default(XFastEnumIntEqualityComparer<XSysDefine>));
public bool bBlockClose = false;
private XSysDefine m_CurOperateSys;
private XDramaOperate m_CurOperate;
private XNPCFavorDrama favorDrama;
private XNpc _npc = null;
public override void OnAttachToHost(XObject host)
{
base.OnAttachToHost(host);
this.bBlockClose = false;
this.m_CurOperate = null;
this.m_CurOperateSys = XSysDefine.XSys_Invalid;
this._DramaOperateDic.Clear();
this._DramaOperateDic.Add(XSysDefine.XSys_Mentorship, new XMentorshipPupilsDramaOperate());
this._DramaOperateDic.Add(XSysDefine.XSys_Partner, new XPartnerDramaOperate());
this._DramaOperateDic.Add(XSysDefine.XSys_Wedding, new XWeddingDramaOperate());
this.favorDrama = new XNPCFavorDrama();
this.favorDrama.BDeprecated = true;
}
protected override void EventSubscribe()
{
base.EventSubscribe();
base.RegisterEvent(XEventDefine.XEvent_MentorshipRelationOperation, new XComponent.XEventHandler(this.OnOperatingMentorship));
}
public void OnMeetNpc(XNpc npc)
{
bool flag = npc == null;
if (!flag)
{
switch (npc.NPCType)
{
case 1u:
this.CommonNpc(npc);
break;
case 2u:
HomePlantDocument.Doc.ClickFarmModle(npc);
break;
case 3u:
HomePlantDocument.Doc.CliclTroubleMakerModle(npc);
break;
case 4u:
DlgBase<DramaDlg, DramaDlgBehaviour>.singleton.ShowNpcDialog(npc);
break;
case 5u:
{
XGuildCollectDocument specificDocument = XDocuments.GetSpecificDocument<XGuildCollectDocument>(XGuildCollectDocument.uuID);
specificDocument.OnMeetLottery(npc.TypeID);
break;
}
case 6u:
{
XWeddingLitterGirlDramaOperate xweddingLitterGirlDramaOperate = new XWeddingLitterGirlDramaOperate();
xweddingLitterGirlDramaOperate.ShowNpc(npc);
break;
}
case 7u:
{
XWeddingLitterBoyDramaOperate xweddingLitterBoyDramaOperate = new XWeddingLitterBoyDramaOperate();
xweddingLitterBoyDramaOperate.ShowNpc(npc);
break;
}
case 8u:
{
XGuildHuntDramaOperate xguildHuntDramaOperate = new XGuildHuntDramaOperate();
xguildHuntDramaOperate.ShowNpc(npc);
break;
}
}
}
}
public void CommonNpc(XNpc npc)
{
this._npc = npc;
XTaskDocument specificDocument = XDocuments.GetSpecificDocument<XTaskDocument>(XTaskDocument.uuID);
XTaskInfo xtaskInfo = null;
NpcTaskState npcTaskState = specificDocument.GetNpcTaskState(npc.TypeID, ref xtaskInfo);
bool flag = false;
bool flag2 = XSingleton<XGameSysMgr>.singleton.IsSystemOpened(XSysDefine.XSys_NPCFavor);
if (flag2)
{
XNPCFavorDocument specificDocument2 = XDocuments.GetSpecificDocument<XNPCFavorDocument>(XNPCFavorDocument.uuID);
EFavorState state = specificDocument2.GetState(npc.TypeID);
flag = (state > EFavorState.None);
}
bool flag3 = npcTaskState == NpcTaskState.TaskBegin || npcTaskState == NpcTaskState.TaskEnd || (npcTaskState == NpcTaskState.TaskInprocess && !flag) || (npc._linkSys == 0 && !flag);
if (flag3)
{
DlgBase<DramaDlg, DramaDlgBehaviour>.singleton.ShowNpcDialog(npc);
}
else
{
bool flag4 = npc._linkSys != 0;
if (flag4)
{
XSysDefine linkSys = (XSysDefine)npc._linkSys;
bool flag5 = !XSingleton<XGameSysMgr>.singleton.IsSystemOpened(linkSys);
if (flag5)
{
DlgBase<DramaDlg, DramaDlgBehaviour>.singleton.ShowNpcDialog(npc);
}
else
{
XDramaOperate xdramaOperate;
bool flag6 = this._DramaOperateDic.TryGetValue(linkSys, out xdramaOperate);
if (!flag6)
{
bool flag7 = flag;
if (flag7)
{
string @string = XStringDefineProxy.GetString(Enum.GetName(typeof(XSysDefine), linkSys));
XSingleton<UiUtility>.singleton.ShowModalDialog(string.Format(XStringDefineProxy.GetString("ChooseSYS_OR_NPC"), @string), @string, XStringDefineProxy.GetString("ChooseNPCFavor"), new ButtonClickEventHandler(this.OnClickSys), new ButtonClickEventHandler(this.OnShowNpc), false, XTempTipDefine.OD_START, 50);
}
else
{
XSingleton<XGameSysMgr>.singleton.OpenSystem(linkSys, 0UL);
}
return;
}
this.m_CurOperate = xdramaOperate;
this.m_CurOperateSys = linkSys;
xdramaOperate.ShowNpc(npc);
}
}
else
{
bool flag8 = flag;
if (flag8)
{
bool flag9 = this.favorDrama != null;
if (flag9)
{
this.favorDrama.BDeprecated = false;
this.favorDrama.ShowNpc(npc);
}
}
}
}
XCameraCloseUpEventArgs @event = XEventPool<XCameraCloseUpEventArgs>.GetEvent();
@event.Target = XSingleton<XInput>.singleton.LastNpc;
@event.Firer = XSingleton<XScene>.singleton.GameCamera;
XSingleton<XEventMgr>.singleton.FireEvent(@event);
}
private bool OnClickSys(IXUIButton btn)
{
bool flag = this._npc == null;
bool result;
if (flag)
{
result = true;
}
else
{
XSysDefine linkSys = (XSysDefine)this._npc._linkSys;
XSingleton<XGameSysMgr>.singleton.OpenSystem(linkSys, 0UL);
DlgBase<ModalDlg, ModalDlgBehaviour>.singleton.SetVisible(false, true);
result = true;
}
return result;
}
private bool OnShowNpc(IXUIButton btn)
{
bool flag = this.favorDrama != null && this._npc != null;
if (flag)
{
this.favorDrama.BDeprecated = false;
this.favorDrama.ShowNpc(this._npc);
this._npc = null;
}
DlgBase<ModalDlg, ModalDlgBehaviour>.singleton.SetVisible(false, true);
return true;
}
public void OnUIClose()
{
this.m_CurOperate = null;
this.m_CurOperateSys = XSysDefine.XSys_Invalid;
this.favorDrama.BDeprecated = true;
}
public XDramaOperate GetOpenedOperate(XSysDefine sys)
{
bool flag = this.m_CurOperateSys == sys;
XDramaOperate result;
if (flag)
{
result = this.m_CurOperate;
}
else
{
result = null;
}
return result;
}
protected override void OnReconnected(XReconnectedEventArgs arg)
{
this.bBlockClose = false;
}
protected bool OnOperatingMentorship(XEventArgs e)
{
XDramaOperate openedOperate = this.GetOpenedOperate(XSysDefine.XSys_Mentorship);
bool flag = openedOperate != null;
if (flag)
{
XMentorRelationOpArgs xmentorRelationOpArgs = e as XMentorRelationOpArgs;
XMentorshipPupilsDramaOperate xmentorshipPupilsDramaOperate = openedOperate as XMentorshipPupilsDramaOperate;
bool flag2 = xmentorshipPupilsDramaOperate != null;
if (flag2)
{
xmentorshipPupilsDramaOperate.OnMentorRelationOp(xmentorRelationOpArgs.oArg, xmentorRelationOpArgs.oRes);
}
}
return true;
}
public XNPCFavorDrama GetFavorDrama()
{
bool flag = !this.favorDrama.BDeprecated;
XNPCFavorDrama result;
if (flag)
{
result = this.favorDrama;
}
else
{
result = null;
}
return result;
}
}
}
|