hxp
2024-09-18 458f8ad37f944f5a4334dc9e522e6640e4aa2def
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
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
#!/usr/bin/python
# -*- coding: GBK -*-
#---------------------------------------------------------------------
#
#---------------------------------------------------------------------
##@package PlayerExam
# @todo: ´ðÌâϵͳ
#
# @author: panwei
# @date 2011-04-01
# @version 2.8
#
# @change: "2011-04-05 16:20" panwei Íæ¼ÒÊÇ·ñ»Ø´ðÌí¼ÓĬÈϱêʾ
# @change: "2011-04-07 17:30" panwei PsycoÓÅ»¯
# @change: "2011-04-08 10:40" panwei ½«½øÈë´ðÌâºÍÍ˳ö´ðÌâ·Ö¿ª
# @change: "2011-04-27 11:00" Alee Íæ¼ÒÊý¾ÝÁ÷Ïò¼Ç¼
# @change: "2011-05-20 11:00" panwei ÐÂÔö´ðÌâ»î¶¯, ÕæÐÄ»°´óðÏÕ
# @change: "2011-05-23 16:00" panwei ÕæÐÄ»°Í³¼ÆÂʼÆËã×ÖµäKeyÐÞ¸Ä
# @change: "2012-03-14 18:00" wdb Ð޸ĴðÌâÌâÄ¿¸öÊý
# @change: "2012-04-17 18:00" wdb Ìí¼ÓÖÁÑÓ³ÙÌáʾ 
# @change: "2012-05-07 11:00" wdb ÕæÐÄ»°´óðÏÕÖ»Òª¼Ó·Ö¾ÍËã»Ø´ðÕýÈ·
# @change: "2012-05-16 14:30" jiang C++½Ó¿ÚÐÞ¸ÄMapServer_QueryPlayerResultºÍMapServer_QueryPlayerÐÞ¸Ä
# @change: "2012-05-23 12:00" wdb ÐÞ¸Äbug£¬³õʼ´ð¶ÔÌâÄ¿ÊýÁ¿Ê±»ú´íÎó
# @change: "2012-12-03 10:00" wdb ¿ç·þ·þÎñÆ÷¹¦ÄÜÏÞÖÆ
# @change: "2014-05-04 15:00" xcc ÐÞ¸ÄϵͳÏûÏ¢
# @change: "2014-05-12 11:30" xcc ÐÞ¸ÄÕæÐÄ»°´óðÏÕ£¬´ðÌâ·ÖÊý
# @change: "2014-05-19 15:30" xcc ½«Ò»Ð©´ðÌâ»î¶¯µÄдËÀµÄÅäÖÃÐÅÏ¢¿ªµ½ÅäÖÃÎļþÖÐ
# @change: "2014-11-13 11:00" hxp Ôö¼ÓÕæÐÄ»°³É¾Í
# @change: "2015-07-01 22:30" hxp Ð޸ĻÖÐËæÊ±¿É½øÈë´ðÌâ; Ê±¼äµ½Íæ¼Òδ´ðÌâÊ±Ëæ»ú°ïÍæ¼Ò´ðÌâ; ´ðÌâ³É¾Í£»Ôö¼ÓÈý±¶Ð§¹û1´Î
# @change: "2015-07-10 17:30" ljd ÅÅÐаñ¼ÓÍæ¼Òƽ̨²ÎÊýName2
#------------------------------------------------------------------------------------------------------------ 
"""Version = 2015-07-10 17:30""" 
#---------------------------------------------------------------------
import GameWorld
import ChConfig
import SubjectLib
import ShareDefine
import random
import ReadChConfig
import PlayerBillboard
import PlayerControl
import IPY_GameServer
#---------------------------------------------------------------------
(
Def_ExamStep_Close,               #´ðÌâ²½Öè, Î´¿ªÆô
Def_ExamStep_Wait,               #´ðÌâ²½Öè, µÈ´ýÍæ¼Ò½øÈë
Def_ExamStep_WaitCountDown,      #´ðÌâ²½Öè, ¿ªÊ¼µ¹¼ÆÊ±
Def_ExamStep_Begin,               #´ðÌâ²½Öè, ´ðÌ⿪ʼ
Def_ExamStep_Over,               #´ðÌâ²½Öè, ´ðÌâ½áÊø
) = range(0, 4 + 1)
 
#Ìâ¿â³¤¶È
Def_ExamSubjectLen = {
                      ShareDefine.Def_Game_Exam_ZGTX:1,      #ÖǹÚÌìÏÂ
                      ShareDefine.Def_Game_Exam_BSL:2,      #±äÉ«Áú
                      ShareDefine.Def_Game_Exam_JQBD:1,      #¾ÙÆì²»¶¨
                      ShareDefine.Def_Game_Exam_ZXH:0,      #ÕæÐÄ»°
                      }
 
##´ðÌâʱ¼ä(ºÁÃë)
#Def_ExamSubjectAnswerTick = {
#                      ShareDefine.Def_Game_Exam_ZGTX:1000*15,      #ÖǹÚÌìÏÂ
#                      ShareDefine.Def_Game_Exam_BSL:1000*5,      #±äÉ«Áú
#                      ShareDefine.Def_Game_Exam_JQBD:1000*10,      #¾ÙÆì²»¶¨
#                      ShareDefine.Def_Game_Exam_ZXH:1000*15,      #ÕæÐÄ»°(15Ãëºó»¹ÐèÒª5ÃëµÈ´ý·¢Ìâ, Õâʱºò¸øÍæ¼Ò¿´´ð°¸)
#                      }
#´ðÌâʱ¼ä(ºÁÃë)
Def_ExamSubjectAnswerTick = ReadChConfig.GetEvalChConfig("Exam_AnswerTick")
 
##´ðÌâ×î´óÊýÁ¿
#Def_ExamSubjectMaxCnt = {
#                      ShareDefine.Def_Game_Exam_ZGTX:10,      #ÖǹÚÌìÏÂ
#                      ShareDefine.Def_Game_Exam_BSL:18,      #±äÉ«Áú
#                      ShareDefine.Def_Game_Exam_JQBD:12,      #¾ÙÆì²»¶¨
#                      ShareDefine.Def_Game_Exam_ZXH:6,      #ÕæÐÄ»°
#                      }
#´ðÌâ×î´óÊýÁ¿
Def_ExamSubjectMaxCnt = ReadChConfig.GetEvalChConfig("Exam_SubjectMaxCnt")
 
#´ðÌâ·ÖÊý¹«Ê½
Def_ExamSubjectMarkFormula = {
                      ShareDefine.Def_Game_Exam_ZGTX:'ZGTX_MarkFormula',      #ÖǹÚÌìÏÂ
                      ShareDefine.Def_Game_Exam_BSL:'BSL_MarkFormula',      #±äÉ«Áú
                      ShareDefine.Def_Game_Exam_JQBD:'JQBD_MarkFormula',      #¾ÙÆì²»¶¨
                      }
 
##´ðÌâ»î¶¯Ê±¼ä
#Def_ExamLastTime = {
#                      ShareDefine.Def_Game_Exam_ZGTX:1000*60*10,      #ÖǹÚÌìÏÂ
#                      ShareDefine.Def_Game_Exam_BSL:1000*60*9,      #±äÉ«Áú
#                      ShareDefine.Def_Game_Exam_JQBD:1000*60*10,      #¾ÙÆì²»¶¨
#                      ShareDefine.Def_Game_Exam_ZXH:1000*60*5,      #ÕæÐÄ»°
#                      }
#´ðÌâ»î¶¯Ê±¼ä
Def_ExamLastTime = ReadChConfig.GetEvalChConfig("Exam_LastTime")
 
#´ðÌâʹÓÃÌØÊ⹦ÄÜ
Def_ExamUseFunc = {
                      ShareDefine.Def_Game_Exam_ZGTX:{
                                                        ShareDefine.Def_Game_Exam_Func_Double:1,
                                                        ShareDefine.Def_Game_Exam_Func_AnswerRight:1,
                                                        ShareDefine.Def_Game_Exam_Func_DelOper:0,
                                                        ShareDefine.Def_Game_Exam_Func_Three:1,
                                                        },      
                      ShareDefine.Def_Game_Exam_BSL:{
                                                        ShareDefine.Def_Game_Exam_Func_Double:1,
                                                        ShareDefine.Def_Game_Exam_Func_AnswerRight:1,
                                                        ShareDefine.Def_Game_Exam_Func_DelOper:0,
                                                        ShareDefine.Def_Game_Exam_Func_Three:0,
                                                        },
                      ShareDefine.Def_Game_Exam_JQBD:{
                                                        ShareDefine.Def_Game_Exam_Func_Double:1,
                                                        ShareDefine.Def_Game_Exam_Func_AnswerRight:1,
                                                        ShareDefine.Def_Game_Exam_Func_DelOper:1,
                                                        ShareDefine.Def_Game_Exam_Func_Three:0,
                                                        },
                      ShareDefine.Def_Game_Exam_ZXH:{
                                                        ShareDefine.Def_Game_Exam_Func_Double:1,
                                                        ShareDefine.Def_Game_Exam_Func_AnswerRight:0,
                                                        ShareDefine.Def_Game_Exam_Func_DelOper:0,
                                                        ShareDefine.Def_Game_Exam_Func_Three:1,
                                                        },
                                                        
                      }
 
#¾ÙÆì²»¶¨Í¼Æ¬ÊýÁ¿
Def_Exam_JQBD_ImageCnt = 36
 
#Íæ¼Òδ»Ø´ð±êʾ
Def_Exam_NoAnswersSign = 99
 
##´ðÌâ¹Ø±Õʱ¼ä
#Def_Tick_ExamPrepareWaitTime = 1000*60*4     #´ðÌâ×¼±¸µÚÒ»½×¶Îʱ¼ä
#Def_Tick_ExamPrepareCountDown = 1000*60*1    #´ðÌâ×¼±¸µÚ¶þ½×¶Îʱ¼ä, ²¥·Åµ¹¼ÆÊ±ÌØÐ§
#Def_Tick_ExamCloseTime = 1000*60*1           #´ðÌâ¹Ø±Õʱ¼ä
##´ðÌâ¹Ø±Õʱ¼ä
Def_Tick_ExamPrepareWaitTime, \
Def_Tick_ExamPrepareCountDown, \
Def_Tick_ExamCloseTime = ReadChConfig.GetEvalChConfig("Exam_TimeSetting")
 
#ÕæÐÄ»°´óðÏÕ
#µ±Ç°²ÎÓë´ðÌâµÄ×ÜÍæ¼ÒÊý
Def_ExamZXH_TotalAnswerCntKey = 'ExamZXH_TotalAnswerCntKey'
#µ±Ç°»Ø´ðµÚÒ»ÌâµÄÍæ¼ÒÊý
Def_ExamZXH_AnswerOneCntKey = 'ExamZXH_AnswerOneCntKey'
#µ±Ç°»Ø´ðµÚ¶þÌâµÄÍæ¼ÒÊý
Def_ExamZXH_AnswerTwoCntKey = 'ExamZXH_AnswerTwoCntKey'
#µ±Ç°»Ø´ðµÚÈýÌâµÄÍæ¼ÒÊý
Def_ExamZXH_AnswerThreeCntKey = 'ExamZXH_AnswerThreeCntKey'
#·¢Ë͵±Ç°×´Ì¬¸øÍæ¼Ò(10Ãë·¢ËÍ)
Def_ExamZXHSendRightAnswerTick = 1000 * 10
Def_ExamZXHSendRightAnswerkey = 'ExamZXH_SendRightAnswerkey'
#Íæ¼Ò¿´´ð°¸
Def_ExamZXHSeeAnswerTick = Def_ExamSubjectAnswerTick[ShareDefine.Def_Game_Exam_ZXH] + 1000 * 5
Def_ExamZXHSeeAnswerkey = 'Def_ExamZXHSeeAnswerkey'
#ÕæÐÄ»°·ÖÊý
#Def_ExamZXH_SuperWinPoint = 10
#Def_ExamZXH_WinPoint = 5
#Def_ExamZXH_FailPoint = 0
Def_ExamZXH_SuperWinPoint, \
Def_ExamZXH_WinPoint, \
Def_ExamZXH_FailPoint = ReadChConfig.GetEvalChConfig("Exam_ZXH_Point")
#---------------------------------------------------------------------
 
 
#---------------------------------------------------------------------
##´ðÌâ״̬±ä»¯
# @param state ×´Ì¬(0¹Ø±Õ, Def_Game_Exam_Type)
# @return ·µ»ØÖµÎÞÒâÒå
# @remarks 
def Exam_ChangeState(state):
    # ¿ç·þ·þÎñÆ÷¹¦ÄÜÏÞÖÆ
    if GameWorld.IsCrossServer():
        return
    
    if state == 0:
        #´ðÌâ¹Ø±ÕÓɳÌÐò×Ô¼º¹Ø±Õ__Exam_Close
        return
    
    __Exam_Begin(state)
    return
 
#---------------------------------------------------------------------
##´ðÌâ¹Ø±Õ
# @param examType ´ðÌâÀàÐÍ
# @param tick Ê±¼ä´Á
# @return ·µ»ØÖµÎÞÒâÒå
# @remarks 
def __Exam_Close(examType, tick):
    #---´ðÌâ½áÊøTÈË---
    __DoLogic_ExamCloseKickPlayer(examType)
 
    #---ÉèÖôðÌâ״̬---
    __SetExamStep(Def_ExamStep_Close, tick)
    
#    GameWorld.Log('´ðÌâÀàÐÍ = %s, Def_ExamStep_Close'%(examType))
    return
 
#---------------------------------------------------------------------
##´ðÌâ½áÊøÌßÈË
# @param examType ´ðÌâÀàÐÍ
# @return ·µ»ØÖµÎÞÒâÒå
# @remarks 
def __DoLogic_ExamCloseKickPlayer(examType):
    examManager = GameWorld.GetGameWorld().GetPlayerExamManager()
#    GameWorld.Log("´ðÌâ½áÊø£¬·þÎñ¶Ë¿ªÊ¼ÌßÈË")
    for index in range(0, examManager.GetExamPlayerCount()):
        examPlayer = examManager.GetExamPlayer(index)
        
        if not examPlayer or not examPlayer.GetInitOK():
            #Íæ¼Ò²»ÔÚÏß
            continue
        
        #Çå³ýÍæ¼Ò´ðÌâ״̬
        examPlayer.GetPlayerExam().Clear()
        #֪ͨµØÍ¼·þÎñÆ÷ɾ³ýBuff
        examPlayer.MapServer_QueryPlayerResult(0, 0, 'ExamCloseKickPlayer', '', 0)
        #֪ͨ¿Í»§¶ËÍ˳ö´ðÌâ
        examPlayer.Sync_JoinActionOK(examType, False)
 
    return
#---------------------------------------------------------------------
##´ðÌ⿪ʼ
# @param examType ´ðÌâÀàÐÍDef_Game_Exam_Type
# @return ·µ»ØÖµÎÞÒâÒå
# @remarks 
def __Exam_Begin(examType):
    if examType not in ShareDefine.Def_Game_ExamTypeList:
        GameWorld.ErrLog('Ìâ¿âÒì³£, examType = %s, ÎÞ·¨¿ªÊ¼´ðÌâ'%(examType))
        return
    
    gameWorld = GameWorld.GetGameWorld()
    tick = gameWorld.GetTick()
    
    #ÉèÖñ¾´Î´ðÌâÀàÐÍ
    __SetExamType(examType)
    
    #---³õʼ»¯´ðÌâ²½Öè---
    __SetExamStep(Def_ExamStep_Wait, tick)
    
    #---³õʼ»¯ÒÑ·¢ÌâÄ¿---
    __ClearSendSubjectCnt()
    
    #---³õʼ»¯¹ú¼Ò´ðÌâ¹ÜÀíÆ÷¶ÔÏó---
    gameWorld.GetPlayerExamManager().Clear()
    
    #³õʼ»¯ÅÅÐаñ
    __ClearExamBillboard(examType)
    
    #ÉèÖÿªÊ¼Ê±¼ä´Á
    __SetExamBeginTick(tick)
    
    GameWorld.Log('´ðÌ⿪ʼ, examType = %s'%(examType))
    return
 
#---------------------------------------------------------------------
##Çå¿Õ´ðÌâÅÅÐаñ.
# @param examType ´ðÌâÀàÐÍ
# @return ·µ»ØÖµÎÞÒâÒå
# @remarks 
def __ClearExamBillboard(examType):
    billboardIndex = ChConfig.Def_ExamSubjectBTDict[examType]
 
    billBoard = GameWorld.GetBillboard().FindBillboard(billboardIndex)
    
    if not billBoard:
        GameWorld.ErrLog('__ClearExamBillboard, ÅÅÐаñ = %s ÎÞ·¨²éÕÒ'%(billboardIndex))
        return
 
    billBoard.Clear()
    return
#---------------------------------------------------------------------
##´ðÌⶨʱÆ÷
# @param tick Ê±¼ä´Á
# @return ·µ»ØÖµÎÞÒâÒå
# @remarks 
def Exam_Process(tick):
    #´ðÌâ²½Öè
    examStep = __GetExamStep()
    
    if examStep not in [Def_ExamStep_Wait, Def_ExamStep_WaitCountDown, Def_ExamStep_Begin, Def_ExamStep_Over]:
        #´ðÌâ먦Æô
        return
    
    #---´ðÌâ×¼±¸µÚÒ»½×¶Î---
    if examStep == Def_ExamStep_Wait:
        __DoLogic_ExamWait(tick)
    #---´ðÌâ×¼±¸µÚ¶þ½×¶Î---
    elif examStep == Def_ExamStep_WaitCountDown:
        __DoLogic_ExamBeginCountDown(tick)
    #---´ðÌâÖÐ---
    elif examStep == Def_ExamStep_Begin:
        __DoLogic_ExamBegin(tick)
    #---´ðÌâÍê±Ï---
    elif examStep == Def_ExamStep_Over:
        __DoLogic_ExamOver(tick)
    
    return
 
#---------------------------------------------------------------------
##´ðÌâ½áÊø
# @param tick Ê±¼ä´Á
# @return None
# @remarks 
def __DoLogic_ExamOver(tick):
    if tick - __GetExamStepTick() < Def_Tick_ExamCloseTime:
        return
    GameWorld.Log("´ðÌâ½áÊø£¬ÉèÖø±±¾Îª¹Ø±Õ״̬")
    examType = __GetExamType()
    
    #֪ͨËùÓдðÌâÍæ¼Ò´ðÌâ½áÊø
    examManager = GameWorld.GetGameWorld().GetPlayerExamManager()
    examManager.Broadcast_EndExam(examType)
    
    #ÉèÖø±±¾Îª¹Ø±Õ״̬
    __Exam_Close(examType, tick)
    return
 
#---------------------------------------------------------------------
##´ðÌâÖÐ
# @param tick Ê±¼ä´Á
# @return ÎÞ·µ»ØÖµ
# @remarks 
def __DoLogic_ExamBegin(tick):
    sendSubjectCnt = __GetSendSubjectCnt()
    
    if sendSubjectCnt == 0:
        #µÚÒ»ÌâÖ±½Ó·¢ËÍÌâÄ¿
#        GameWorld.Log("·¢Ë͵ÚÒ»µÀÌâ")
        __SendSubject(tick)
        return
    
    gameWorld = GameWorld.GetGameWorld()
    
    #´ðÌâ¹ÜÀíÆ÷
    examManager = GameWorld.GetGameWorld().GetPlayerExamManager()
    
    #±¾´Î´ðÌâÀàÐÍ
    examType = __GetExamType()
    
    #±¾´Î´ðÌâ¹ýȥʱ¼ä
    examSendSubjectLostTick = tick - examManager.GetSendSubjectTick()
    
    #ÕæÐÄ»°´óðÏÕÉèÖÿ¨×¡, ¸øÍæ¼Ò¿´´ð°¸
    if examType == ShareDefine.Def_Game_Exam_ZXH and gameWorld.GetDictByKey(Def_ExamZXHSeeAnswerkey):
        
        if examSendSubjectLostTick < Def_ExamZXHSeeAnswerTick:
            #ÕæÐÄ»°´óðÏÕ¿¨×¡5Ãë
            return
        
        #·¢ËÍÏÂÒ»Ìâ
        __SendNextSubject(examManager, examType, sendSubjectCnt, tick)
        return
    
    #ĬÈϻشð
    if examSendSubjectLostTick < Def_ExamSubjectAnswerTick[examType]:
        
        if examType == ShareDefine.Def_Game_Exam_ZXH:
            #ÕæÐÄ»°´óðÏÕÌØÊâ´¦Àí, Òª·¢ËÍÒ»´Îµ±Ç°Ñ¡ÏîÇé¿ö¸øÍæ¼Ò
            __ExamZXH_SendSelectOption(examSendSubjectLostTick)
        
        #·¢ÏÂÒ»Ìâ·¢Ìâʱ¼äδµ½
        return
    
    #ÕýÈ·´ð°¸
    rightAnswer = examManager.GetRightAnswer()
    #´ðÌâÅÅÐаñ
    billboardIndex = ChConfig.Def_ExamSubjectBTDict[examType]
    #²Î¼Ó´ðÌâµÄÍæ¼ÒÁбí
    examPlayerList = []
    
    for index in range(0, examManager.GetExamPlayerCount()):
        examPlayer = examManager.GetExamPlayer(index)
        
        if not examPlayer or not examPlayer.GetInitOK():
            #Íæ¼Ò²»ÔÚÏß
            continue
        
        examPlayerList.append(examPlayer)
    
    #¼ì²éÍæ¼Ò´ð°¸
    for curPlayer in examPlayerList:
        __CheckPlayerAnswer(curPlayer, rightAnswer, billboardIndex, tick)
    
    #ÅÅÐòÅÅÐаñ
    PlayerBillboard.SortBillboardByIndex(billboardIndex)
    
    #±éÀúÅÅÐаñÖеÄÍæ¼Ò, ÉèÖÃÍæ¼ÒÅÅÃû
    SetPlayerBillboardIndex(billboardIndex)
    
    for curPlayer in examPlayerList:
        #¹ã²¥ÅÅÐаñ¸ø¿Í»§¶Ë(µÚÒ»Ò³)
        curPlayer.Sync_Billboard(billboardIndex)
    
    #¹ã²¥ËùÓÐÍæ¼Ò´ðÌâ½á¹û
    examManager.Broadcast_ExamResult()
    
    #ÕæÐÄ»°´óðÏÕÉèÖõȴý±ê¼Çλ
    if examType == ShareDefine.Def_Game_Exam_ZXH:
        if gameWorld.GetDictByKey(Def_ExamZXHSeeAnswerkey) == 0:
            #ÕâÀ│ס²»Ö´ÐÐÂß¼­
            __ExamZXH_SendSeeAnswer(tick)
            return
        
        GameWorld.ErrLog('-----------ÕæÐÄ»°´óðÏÕÂß¼­Òì³£, ÑÓ³Ù·¢Ìâʧ°ÜÖ±½Ó·¢Ìâ, ±¯¾ç---------')
 
    #·¢ËÍÏÂÒ»ÌâÄ¿
    __SendNextSubject(examManager, examType, sendSubjectCnt, tick)
    return
 
#---------------------------------------------------------------------
##·¢ËÍÏÂÒ»ÌâÄ¿
# @param examManager ´ðÌâ¹ÜÀíÆ÷
# @param examType ´ðÌâÀàÐÍ
# @param sendSubjectCnt ·¢Ë͵ÄÌâÄ¿Êý
# @param tick Ê±¼ä´í
# @return ·µ»ØÖµÎÞÒâÒå
# @remarks ¿Í»§¶Ë·â°üÏìÓ¦
def __SendNextSubject(examManager, examType, sendSubjectCnt, tick):
    #È«²¿ÌâÄ¿¶¼·¢ÍêÁË
    if sendSubjectCnt == Def_ExamSubjectMaxCnt[examType]:
        #¸øÍæ¼Ò½±Àø
        GivePlayerReward(examType)
        
        #ÉèÖôðÌâ²½Öè
        __SetExamStep(Def_ExamStep_Over, tick)
        
#        GameWorld.Log('´ðÌâÀàÐÍ = %s, Def_ExamStep_Over sendSubjectCnt = %s'%(examType, sendSubjectCnt))
        return
    
    #·¢ËÍÌâÄ¿
#    GameWorld.Log('·¢ËÍÏÂÒ»ÌâÌâÄ¿')
    __SendSubject(tick)
    return
 
#---------------------------------------------------------------------
##¸øÍæ¼Ò½±Àø
# @param examType ´ðÌâÀàÐÍ
# @return ·µ»ØÖµÎÞÒâÒå
# @remarks 
def GivePlayerReward(examType):
    #GameWorld.Log("¸ø²Î¼Ó»î¶¯µÄÍæ¼Ò½±Àø")
    # ÅÅÐаñ
    billboardIndex = ChConfig.Def_ExamSubjectBTDict[examType]
    billBoard = GameWorld.GetBillboard().FindBillboard(billboardIndex)
    
    #´ðÌâ¹ÜÀíÆ÷
    examManager = GameWorld.GetGameWorld().GetPlayerExamManager()
    
    for index in range(0, examManager.GetExamPlayerCount()):
        curPlayer = examManager.GetExamPlayer(index)
        
        if not curPlayer or not curPlayer.GetInitOK():
            #Íæ¼Ò²»ÔÚÏß
            continue
        
        if billBoard:
            billBoardIndex = curPlayer.GetPlayerExam().GetBillboardIndex()
            # ÕæÐÄ»°µÚÒ»Ãû³É¾Í
#            if examType in [ShareDefine.Def_Game_Exam_ZXH, ShareDefine.Def_Game_Exam_ZGTX] and billBoardIndex == 0:
#                PlayerControl.DoAddSuccessProgress(curPlayer, ShareDefine.SuccType_ZXHFirst, 1)
        
        # »ñµÃ´ðÌâ¶Ô´íÊýÁ¿
        rightCnt = curPlayer.GetDictByKey(ChConfig.Def_Player_NoSave_Dict_PlayerExamRightCnt%examType)
        examResult = (rightCnt, Def_ExamSubjectMaxCnt.get(examType, 0) - rightCnt)
        
        #¸øÍæ¼Ò½±Àø[´ðÌâÀàÐÍ, »ý·Ö]
        sendMsg = '%s'%[examType, curPlayer.GetPlayerExam().GetMark(), examResult]
        curPlayer.MapServer_QueryPlayerResult(0, 0, 'ExamGivePlayerReward',
                                               sendMsg, len(sendMsg))
        
        #GeRen_liubo_570355 ´ðÌâ»î¶¯ÒѾ­½áÊø, ¸ÐлÄúµÄ²ÎÓë!
        PlayerControl.NotifyCode(curPlayer, "GeRen_liubo_570355")
        
        #·¢ËÍÀ뿪µ¹¼ÆÊ±
        curPlayer.Sync_TimeTick(ShareDefine.Def_TimeTickType_ExamLeaveMap, 0, Def_Tick_ExamCloseTime, True) 
    
    return
 
#---------------------------------------------------------------------
##¹ã²¥²Î¼Ó´ðÌâµÄÍæ¼Òµ¹¼ÆÊ±.
# @param tickType µ¹¼ÆÊ±ÀàÐÍ
# @param lastTick ³ÖÐøÊ±¼ä
# @return ·µ»ØÖµÎÞÒâÒå
# @remarks 
def __Sync_ExamPlayerTimeTick(tickType, lastTick):
    #´ðÌâ¹ÜÀíÆ÷
    examManager = GameWorld.GetGameWorld().GetPlayerExamManager()
#    GameWorld.Log("¹ã²¥µ¹¼ÆÊ±")
    for index in range(0, examManager.GetExamPlayerCount()):
        curPlayer = examManager.GetExamPlayer(index)
        
        if not curPlayer or not curPlayer.GetInitOK():
            #Íæ¼Ò²»ÔÚÏß
            continue
        
        curPlayer.Sync_TimeTick(tickType, 0, lastTick, True) 
 
    return
 
#---------------------------------------------------------------------
##ÉèÖÃÍæ¼ÒÅÅÐаñË÷Òý
# @param billboardIndex ÅÅÐаñË÷Òý
# @return ·µ»ØÖµÎÞÒâÒå
# @remarks 
def SetPlayerBillboardIndex(billboardIndex):
    billBoard = GameWorld.GetBillboard().FindBillboard(billboardIndex)
 
    if not billBoard:
        GameWorld.ErrLog('SetPlayerBillboardIndex, ÅÅÐаñ = %s ÎÞ·¨²éÕÒ'%(billboardIndex))
        return
 
    playerManager = GameWorld.GetPlayerManager()
 
    for index in range(0, billBoard.GetCount()):
        billboardData = billBoard.At(index)
        curPlayer = playerManager.FindPlayerByID(billboardData.GetID())
 
        if not curPlayer:
            #ûÕÒµ½Íæ¼Ò
            continue
 
        curPlayer.GetPlayerExam().SetBillboardIndex(index) 
 
    return
 
#---------------------------------------------------------------------
##¼ì²éÍæ¼Ò´ð°¸
# @param curPlayer Íæ¼ÒʵÀý
# @param rightAnswer ÕýÈ·´ð°¸
# @param billBoardIndex ÅÅÐаñÀàÐÍ
# @param tick Ê±¼ä´Á
# @return
# @remarks
def __CheckPlayerAnswer(curPlayer, rightAnswer, billboardIndex, tick):
    #´ðÌ⹦ÄÜö¾Ù Def_Game_Exam_Func_Cnt
    playerExamMgr = curPlayer.GetPlayerExam()
#    GameWorld.Log("¼ì²éÍæ¼Ò´ð°¸")
    #´ðÌâÀàÐÍ
    examType = __GetExamType()
    
    if playerExamMgr.GetExtraOpt2():
        #ʹÓÃÌø¹ý¹¦ÄÜ
        isAnswerRight = True
    else:
        currentAnswer = playerExamMgr.GetCurrentAnswer()
        # Èç¹ûÍæ¼Òû´ðÌ⣬ÔòËæ»ú°ïÍæ¼Òѡһ¸ö
        if examType == ShareDefine.Def_Game_Exam_ZGTX and currentAnswer == Def_Exam_NoAnswersSign:
            currentAnswer = random.randint(1, 4)
            playerExamMgr.SetCurrentAnswer(currentAnswer)
            playerExamMgr.SetAnswerSubjectTick(max(0, 
                                    tick - GameWorld.GetGameWorld().GetPlayerExamManager().GetSendSubjectTick()))
            #GameWorld.DebugLog("Ëæ»ú°ïÍæ¼ÒÑ¡Ôñ´ð°¸: %s, ÕýÈ·´ð°¸: %s" % (currentAnswer, rightAnswer))
            
        isAnswerRight = (currentAnswer == rightAnswer)
    
    # ÕýÈ·Êý¼Ó1(ÕæÐÄ»°´óðÏÕÌØÊâ´¦Àí)
    playerDictKey = ChConfig.Def_Player_NoSave_Dict_PlayerExamRightCnt%examType
    if isAnswerRight and examType != ShareDefine.Def_Game_Exam_ZXH:
        curPlayer.SetDict(playerDictKey, curPlayer.GetDictByKey(playerDictKey) + 1)
    
    #¼ÆËãÍæ¼Ò´ðÌâ»ý·Ö
    curMark = __GetExamMark(playerExamMgr, isAnswerRight)
    
    # ÕæÐÄ»°ÖÐÖ»Òª¼Ó·Ö¾ÍËã´ð¶Ô
    if curMark > 0 and examType == ShareDefine.Def_Game_Exam_ZXH:
        curPlayer.SetDict(playerDictKey, curPlayer.GetDictByKey(playerDictKey) + 1)
        
    if examType == ShareDefine.Def_Game_Exam_ZXH:
        isRight = (curMark > 0)
    else:
        isRight = isAnswerRight
        
    # Á¬Ðø´ð¶Ôͳ¼Æ
    examCRightCntKey = ChConfig.Def_Player_NoSave_Dict_PlayerExamCRightCnt % examType
    updCRightCnt = 0 if not isRight else curPlayer.GetDictByKey(examCRightCntKey) + 1
    curPlayer.SetDict(examCRightCntKey, updCRightCnt)
    # ÕæÐÄ»°Á¬Ðø´ð¶ÔxÌâ³É¾Í(10ÌâÒÔÉϲÅͬ²½)
#    if examType in [ShareDefine.Def_Game_Exam_ZXH, ShareDefine.Def_Game_Exam_ZGTX] and updCRightCnt >= 10:
#        PlayerControl.DoAddSuccessProgress(curPlayer, ShareDefine.SuccType_ZXHConRight, 1, updCRightCnt)
        
    if curMark != 0:
        #»ý·ÖÓпÉÄÜΪ¸ºÊý
        playerExamMgr.SetMark(max(0, playerExamMgr.GetMark() + curMark))
        #Íæ¼Ò»ý·Ö²åÈëÅÅÐаñ
        PlayerBillboard.UpdatePlayerBillboard(curPlayer.GetID(), curPlayer.GetName(), curPlayer.GetOperateInfo(),
                                               billboardIndex, 0, 0, playerExamMgr.GetMark(),
                                                playerExamMgr.GetMark(), autoSort = False)
    
    #ÉèÖÃÍæ¼Ò´ðÌâÊôÐÔ
    playerExamMgr.SetExtraOpt1(0)
    playerExamMgr.SetExtraOpt2(0)
    playerExamMgr.SetExtraOpt3(0)
    playerExamMgr.SetExtraOpt4(0)
    playerExamMgr.SetCurrentAnswer(Def_Exam_NoAnswersSign)
    playerExamMgr.SetAnswerSubjectTick(0)
    playerExamMgr.SetIsSuccess(isAnswerRight)
    playerExamMgr.SetBillboardIndex(ShareDefine.Def_Game_Exam_NoInBillboardSign)
    #ÉèÖÃÊÇ·ñ¿ÉÒÔÔÙ´ÎÑ¡Ôñ´ð°¸
    playerExamMgr.SetCombo(0)               
    return
 
#---------------------------------------------------------------------
##»ñµÃ´ðÌâµÄ»ý·Ö.
# @param playerExamMgr Íæ¼Ò´ðÌâ¹ÜÀíÆ÷
# @param isAnswerRight ÊÇ·ñ»Ø´ðÕýÈ·
# @return ±¾Ìâ»ñµÃµÄ»ý·Ö
# @remarks 
def __GetExamMark(playerExamMgr, isAnswerRight):
    #´ðÌâÀàÐÍ
    examType = __GetExamType()
    
    #---ÕæÐÄ»°¹¦ÄÜÌØÊâ´¦Àí---
    if examType == ShareDefine.Def_Game_Exam_ZXH:
        curMark = __GetExamZXHMark(playerExamMgr.GetCurrentAnswer())
    else:
        #·ÖÊý¼ÆËã, ¸ù¾Ý´ðÌâʱ¼ä¸øÓè
        curMark = __GetPlayerAnswerMark(isAnswerRight, playerExamMgr.GetAnswerSubjectTick())
    
    #ʹÓÃË«±¶¹¦ÄÜ
    if playerExamMgr.GetExtraOpt1():
        curMark = curMark * 2
    #ʹÓÃÈý±¶¹¦ÄÜ
    elif playerExamMgr.GetExtraOpt4():
        curMark = curMark * 3
        
    return curMark
#---------------------------------------------------------------------
##»ñµÃÕæÐÄ»°´ðÌâµÄ»ý·Ö.
# @param playerAnswer Íæ¼ÒµÄÑ¡Ïî
# @return ±¾Ìâ»ñµÃµÄ»ý·Ö
# @remarks 
def __GetExamZXHMark(playerAnswer):
    addMark = 0
    
    if playerAnswer == Def_Exam_NoAnswersSign:
        #Íæ¼ÒÎÞÑ¡Ôñ
        return addMark
    
    answerOnePer, answerTwoPer, answerThreePer = __GetExamZXH_AnswerScale()
    
    if playerAnswer == 1:
        playerAnswerPer = answerOnePer
    
    elif playerAnswer == 2:
        playerAnswerPer = answerTwoPer 
    
    elif playerAnswer == 3:
        playerAnswerPer = answerThreePer 
    
    else:
        GameWorld.ErrLog('__GetExamZXHMark playerAnswer = %s'%(playerAnswer))
        return addMark
    
    #¹¹½¨×îСѡÏîºÍ×î´óÑ¡ÏîÁбí
    answerList = [answerOnePer, answerTwoPer, answerThreePer]
    answerList.sort()
    answerMinPer = answerList[0]
    answerMaxPer = answerList[-1]
        
    #Õý³£Çé¿ö3¸öÑ¡Ïî²»Ò»ÖÂ
    if answerOnePer != answerTwoPer and answerOnePer != answerThreePer and answerThreePer != answerTwoPer:
        if playerAnswerPer == answerMinPer:
            return Def_ExamZXH_SuperWinPoint
        
        if playerAnswerPer == answerMaxPer:
            return Def_ExamZXH_FailPoint
        
        return Def_ExamZXH_WinPoint
    
    #ÓÐ2¸öÑ¡ÏîÒ»ÖÂ(3¸öÑ¡ÏîÒ»Ö²»¿ÉÄÜ)
    if playerAnswerPer == answerMinPer:
        return Def_ExamZXH_SuperWinPoint
 
    return Def_ExamZXH_WinPoint
 
#---------------------------------------------------------------------
##»ñÈ¡Íæ¼Ò±¾´Î´ðÌâ·ÖÊý
# @param isAnswerRight ÊÇ·ñ´ð¶Ô
# @param lostTick Ê¹ÓõĺÁÃë
# @return ·µ»ØÖµÎÞÒâÒå
# @remarks »ñÈ¡Íæ¼Ò±¾´Î´ðÌâ·ÖÊý
def __GetPlayerAnswerMark(isAnswerRight, lostTick):
    if not isAnswerRight:
        #»Ø´ð´íÎóÎÞ»ý·Ö
        return 0
    
    examType = __GetExamType()
    foumulaStr = Def_ExamSubjectMarkFormula.get(examType)
    
    if not foumulaStr:
        GameWorld.ErrLog('examType = %s, NoFindMarkFormul'%(examType))
        return 0
 
    foumula = ReadChConfig.GetChConfig(foumulaStr)
    return int(eval(foumula))
#---------------------------------------------------------------------
##´ðÌâ×¼±¸ÖÐÂß¼­´¦Àí
# @param tick Ê±¼ä´Á
# @return ·µ»ØÖµÎÞÒâÒå
# @remarks 
def __DoLogic_ExamWait(tick):
    if tick - __GetExamStepTick() < Def_Tick_ExamPrepareWaitTime:
        return
    
    GameWorld.Log('´ðÌâÀàÐÍ = %s, Def_ExamStep_WaitCountDown'%(__GetExamType()))
    
    #½øÈë´ðÌâµ¹¼ÆÊ±½×¶Î
    __SetExamStep(Def_ExamStep_WaitCountDown, tick)
    
    #֪ͨËùÓÐÍæ¼Ò²¥·Åµ¹¼ÆÊ±ÌØÐ§
    __Sync_ExamPlayerTimeTick(ShareDefine.Def_TimeTickType_ExamBeginCountDown, Def_Tick_ExamPrepareCountDown)
    return
 
#---------------------------------------------------------------------
##´ðÌâ×¼±¸Öе¹¼ÆÊ±´¦Àí
# @param tick Ê±¼ä´Á
# @return ·µ»ØÖµÎÞÒâÒå
# @remarks 
def __DoLogic_ExamBeginCountDown(tick):
    if tick - __GetExamStepTick() < Def_Tick_ExamPrepareCountDown:
        return
    
    examType = __GetExamType()
    
    GameWorld.Log('´ðÌâÀàÐÍ = %s, Def_ExamStep_Begin'%(examType))
    
    #´ðÌ⿪ʼ
    __SetExamStep(Def_ExamStep_Begin, tick)
 
    # ³õʼ´ð¶ÔÌâÄ¿Êý
    __ClearPlayerRightCnt(examType)
        
    gameWorld = GameWorld.GetGameWorld()
    examManager = gameWorld.GetPlayerExamManager()
    examManager.Broadcast_BeginExam(examType)
    
    return
 
#---------------------------------------------------------------------
##·¢ËÍÌâÄ¿.
# @param tick Ê±¼ä´Á
# @return ÎÞÒâÒå
# @remarks 
def __SendSubject(tick):
    examManager = GameWorld.GetGameWorld().GetPlayerExamManager()
    
    #±¾´Î´ðÌâÀàÐÍ
    examType = __GetExamType()
    
    #ÕæÐÄ»°·¢ÌâÄ¿µÄʱºòÇå³ýÉÏ»ØÍæ¼Ò²ÎÓë»Ø´ðµÄÊýÁ¿
    if examType == ShareDefine.Def_Game_Exam_ZXH:
        __ClearExamZXH_SaveDict()
 
    #³éÈ¡ÌâÄ¿
    subjectTuple = SubjectLib.GetSubject(examType)
    
    if not subjectTuple:
        #»ñÈ¡ÌâÄ¿Òì³£
        return
    
    subjectIndex, subjectList = subjectTuple
    
    #ÉèÖõ±Ç°·¢ÌâÐòºÅ×Öµä
    __AddSendSubjectCnt(tick)
    #ÉèÖñ¾´Î·¢ÌâË÷Òý
    examManager.SetQuestionIndex(__GetSendSubjectCnt())
    
    if len(subjectList) != Def_ExamSubjectLen[examType]:
        #Ìâ¿âÒì³£
        GameWorld.ErrLog('²ß»®Ìâ¿â = %s ÌâÄ¿ = %s, ÅäÖôíÎó'%(examType, subjectIndex))
        return
    
    #ÕæÐÄ»°´óðÏÕÎÞÕýÈ·´ð°¸
    if examType != ShareDefine.Def_Game_Exam_ZXH:
        #ĬÈϵÚÒ»¸öÔªËØ¶¼ÎªÕýÈ·´ð°¸
        examManager.SetRightAnswer(subjectList[0])
    
    #¸½¼ÓÌõ¼þ1ÓÃÓÚ´¢´æµ±Ç°ÌâºÅ
    examManager.SetQuestionExrtaValue1(subjectIndex)
    
    #±äÉ«Áú¸½¼ÓÌõ¼þ2ÓÃÓÚ´¢´æÑÕÉ«
    if examType == ShareDefine.Def_Game_Exam_BSL:
        examManager.SetQuestionExrtaValue2(subjectList[1])
    #¾ÙÆì²»¶¨¸½¼þÌõ¼þ2,3,4ÓÃÓÚËæ¼´³éȡͼƬË÷Òý
    elif examType == ShareDefine.Def_Game_Exam_JQBD:
        imageIndexList = __GetExam_JQBD_ImageList(subjectList[0])
        examManager.SetQuestionExrtaValue2(imageIndexList[0])
        examManager.SetQuestionExrtaValue3(imageIndexList[1])
        examManager.SetQuestionExrtaValue4(imageIndexList[2])
        examManager.SetQuestionExrtaValue5(imageIndexList[3])
#    GameWorld.Log('examManager.Broadcast_QuestionToAllPlayer()')
    #¹ã²¥Íæ¼Ò´ðÌâÌâÄ¿
    examManager.Broadcast_QuestionToAllPlayer()
    return
 
#---------------------------------------------------------------------
##¾ÙÆì²»¶¨Í¼Æ¬³éÈ¡
# @param rightAnswer ÕýÈ·Ë÷Òý
# @return [1,2,3,4]ÁÐ±í³¤¶È±ØÐëÊÇ4
# @remarks 
def __GetExam_JQBD_ImageList(rightAnswer):
    #Ò»¸öÕýÈ·µÄË÷Òý, ´ÓÁíÍâ36ÕÅͼƬÖгéÈ¡3ÕÅ, ºÍÕýÈ·Ë÷Òý×é³ÉÁбí
    rangeList = range(1, Def_Exam_JQBD_ImageCnt + 1)
    
    if rightAnswer not in rangeList:
        GameWorld.ErrLog('JQBD£¬ ²ß»®Ìâ¿âÅäÖÃÒì³£, rightAnswer = %s'%(rightAnswer))
        return rangeList[0:4]
    
    #ɾ³ýÕýÈ·ÔªËØ
    rangeList.remove(rightAnswer)
    #Ëæ»úÔÚÈ¡3¸ö
    returnList = random.sample(rangeList, 3)
    #½«ÕýÈ·´ð°¸Ëæ»ú²åÈëÁбíÖÐ
    returnList.insert(random.randint(0, 3), rightAnswer)
    return returnList
 
#---------------------------------------------------------------------
##ÉèÖôðÌâ²½Öè.
# @param step ²½ÖèDef_ExamStep 
# @param tick Ê±¼ä´Á
# @return ·µ»ØÖµÎÞÒâÒå
# @remarks 
def __SetExamStep(step, tick):
    gameWorld = GameWorld.GetGameWorld()
    gameWorld.SetDict(ChConfig.Def_WorldKey_ExamStep, step)
    gameWorld.SetDict(ChConfig.Def_WorldKey_ExamStepTick, tick)
    return
 
#---------------------------------------------------------------------
##»ñÈ¡´ðÌâ²½Öè.
# @param ÎÞ²ÎÊý 
# @return ²½ÖèDef_ExamStep
# @remarks 
def __GetExamStep():
    return GameWorld.GetGameWorld().GetDictByKey(ChConfig.Def_WorldKey_ExamStep)
 
#---------------------------------------------------------------------
##»ñÈ¡´ðÌâ²½ÖèTick
# @param ÎÞ²ÎÊý 
# @return Ê±¼ä´Á
# @remarks 
def __GetExamStepTick():
    return GameWorld.GetGameWorld().GetDictByKey(ChConfig.Def_WorldKey_ExamStepTick)
 
#---------------------------------------------------------------------
##ÉèÖôðÌâÀàÐÍ.
# @param examType ´ðÌâÀàÐÍDef_Game_Exam_Type
# @return ·µ»ØÖµÎÞÒâÒå
# @remarks 
def __SetExamType(examType):
    GameWorld.GetGameWorld().SetDict(ChConfig.Def_WorldKey_ExamType, examType)
    return
 
#---------------------------------------------------------------------
##»ñÈ¡´ðÌâÀàÐÍ.
# @param ÎÞ²ÎÊý
# @return Def_Game_Exam_Type
# @remarks 
def __GetExamType():
    return GameWorld.GetGameWorld().GetDictByKey(ChConfig.Def_WorldKey_ExamType)
 
#---------------------------------------------------------------------
##ÉèÖôðÌ⿪ʼʱ¼ä´ê.
# @param tick Ê±¼ä´Á
# @return ·µ»ØÖµÎÞÒâÒå
# @remarks 
def __SetExamBeginTick(tick):
    GameWorld.GetGameWorld().SetDict(ChConfig.Def_WorldKey_ExamBeginTick, tick)
    return
 
#---------------------------------------------------------------------
##³õÊ¼Íæ¼Ò´ð¶ÔÌâÊý
# @param examType
# @return ·µ»ØÖµÎÞÒâÒå
def __ClearPlayerRightCnt(examType):
 
    examManager = GameWorld.GetGameWorld().GetPlayerExamManager()
    for index in range(0, examManager.GetExamPlayerCount()):
        examPlayer = examManager.GetExamPlayer(index)
    
        if not examPlayer or not examPlayer.GetInitOK():
            #Íæ¼Ò²»ÔÚÏß
            continue
        examPlayer.SetDict(ChConfig.Def_Player_NoSave_Dict_PlayerExamRightCnt%examType, 0)
        examPlayer.SetDict(ChConfig.Def_Player_NoSave_Dict_PlayerExamCRightCnt%examType, 0)
    return
 
#---------------------------------------------------------------------
##»ñÈ¡´ðÌ⿪ʼʱ¼ä´Á.
# @param ÎÞ²ÎÊý
# @return tick
# @remarks 
def __GetExamBeginTick():
    return GameWorld.GetGameWorld().GetDictByKey(ChConfig.Def_WorldKey_ExamBeginTick)
 
#---------------------------------------------------------------------
##ÉèÖôðÌâ×ÜÊý
# @param µ±Ç°Ê±¼ä´Á
# @return ·µ»ØÖµÎÞÒâÒå
# @remarks 
def __AddSendSubjectCnt(tick):
    gameWorld = GameWorld.GetGameWorld()
    #ÉèÖ÷¢ÌâÊý
    gameWorld.SetDict(ChConfig.Def_WorldKey_ExamSendSubjectCnt, __GetSendSubjectCnt() + 1)
    #ÉèÖ÷¢Ìâ¼ä¸ô
    gameWorld.GetPlayerExamManager().SetSendSubjectTick(tick)
    return
 
#---------------------------------------------------------------------
##Çå³ý×ÜÊý
# @param ÎÞ²ÎÊý
# @return ·µ»ØÖµÎÞÒâÒå
# @remarks 
def __ClearSendSubjectCnt():
    #ÉèÖ÷¢ÌâÊý
    GameWorld.GetGameWorld().SetDict(ChConfig.Def_WorldKey_ExamSendSubjectCnt, 0)
    return
 
#---------------------------------------------------------------------
##»ñÈ¡´ðÌâ×ÜÊý
# @param ÎÞ²ÎÊý
# @return ´ðÌâÊý
# @remarks 
def __GetSendSubjectCnt():
    return GameWorld.GetGameWorld().GetDictByKey(ChConfig.Def_WorldKey_ExamSendSubjectCnt)
 
#---------------------------------------------------------------------
##µØÍ¼·þÎñÆ÷ÇëÇóÍ˳ö´ðÌâ»î¶¯.
# @param curPlayerID Íæ¼ÒID
# @return None
# @remarks 
def MapServer_ExitAction(curPlayerID):
    #´ðÌâ¹ÜÀíÆ÷
    examManager = GameWorld.GetGameWorld().GetPlayerExamManager()
    #´ðÌâ¹ÜÀíÆ÷ɾ³ýÍæ¼Ò
    if examManager.FindExamPlayerByID(curPlayerID):
        examManager.DeleteExamPlayerByID(curPlayerID)
    else:
        GameWorld.ErrLog('MapServer_ExitExam PlayerNoInExam = %s'%(curPlayerID))
 
    #Íæ¼ÒʵÀý
    curPlayer = GameWorld.GetPlayerManager().FindPlayerByID(curPlayerID)
        
    if not curPlayer:
        #Íæ¼ÒÒѾ­ÏÂÏß
        return
        
    playeExamMgr = curPlayer.GetPlayerExam()
    
    if not playeExamMgr.GetIsExaming():
        #GameWorld.Log('MapServer_ExitExam, Íæ¼Ò²»ÔÚ´ðÌâ»î¶¯ÖÐ', curPlayer.GetID())
        return
 
    #Çå¿ÕÍæ¼Ò´ðÌâ״̬
    playeExamMgr.Clear()
 
    #֪ͨ¿Í»§¶ËÍ˳ö´ðÌâ
    curPlayer.Sync_JoinActionOK(__GetExamType(), False)
    return
#---------------------------------------------------------------------
##µØÍ¼·þÎñÆ÷ÇëÇó¼ÓÈë´ðÌâ»î¶¯.
# @param curPlayer Íæ¼ÒʵÀý
# @param jionExamType Íæ¼ÒÏëÒª²Î¼ÓµÄ´ðÌâ
# @param tick Ê±¼ä´Á
# @return None
# @remarks 
def MapServer_JoinAction(curPlayer, jionExamType, tick):
#    GameWorld.Log("µØÍ¼·þÎñÆ÷ÇëÇó¼ÓÈë´ðÌâ»î¶¯")
    serverExamType = __GetExamType() 
    
    if (jionExamType != serverExamType) or (serverExamType not in ShareDefine.Def_Game_ExamTypeList):
        GameWorld.ErrLog('MapServer_JoinActionErr, jionExamType = %s, serverExamType = %s'%(jionExamType,
                                                                                            serverExamType))
        return
    
    examStep = __GetExamStep()
    
    if examStep not in [Def_ExamStep_Wait, Def_ExamStep_WaitCountDown, Def_ExamStep_Begin]:
        #FB_liubo_254483 »î¶¯ÒѾ­¿ªÊ¼
        PlayerControl.NotifyCode(curPlayer, "FB_liubo_254483")
        return
    
    playerExamMgr = curPlayer.GetPlayerExam()
    
    if playerExamMgr.GetIsExaming():
        #GameWorld.Log('Íæ¼ÒÒѾ­ÔڻÖÐÖØ¸´±¨Ãû', curPlayer.GetID())
        return
    
    #Çå¿ÕÍæ¼Ò´ðÌâ¹ÜÀí
    playerExamMgr.Clear()
    
    #ÉèÖÃÍæ¼Òδ¿ªÊ¼´ðÌâ
    playerExamMgr.SetIsExaming(True)
    #ÉèÖõ±Ç°Ñ¡ÏîĬÈÏÄÚÈÝ
    playerExamMgr.SetCurrentAnswer(Def_Exam_NoAnswersSign)
    
    #ÊÀ½ç´ðÌâ¹ÜÀíÆ÷Ìí¼ÓÍæ¼Ò
    examManager = GameWorld.GetGameWorld().GetPlayerExamManager()
    examManager.AddExamPlayer(curPlayer)
    
    #֪ͨ±¨Ãû³É¹¦
    curPlayer.Sync_JoinActionOK(jionExamType, True)
    
#===============================================================================
#    #¸±±¾Ê£Óàʱ¼ä, ¸±±¾×Üʱ¼ä - ÒѾ­¹ýÈ¥µÄʱ¼ä
#    remainTime = max(0, Def_ExamLastTime[serverExamType] - (tick - __GetExamBeginTick()))
#    
#    #֪ͨ¸±±¾×ÜÊ£Óàʱ¼ä
#    curPlayer.Sync_TimeTick(ShareDefine.Def_TimeTickType_ExamLeaveMap, 0, remainTime, True) 
#===============================================================================
    
    #֪ͨµÈ´ýµ¹¼ÆÊ±
    if examStep == Def_ExamStep_Wait:
        lastTime = max(0, (Def_Tick_ExamPrepareWaitTime + Def_Tick_ExamPrepareCountDown) \
                        - (tick - __GetExamStepTick()))
        
        curPlayer.Sync_TimeTick(ShareDefine.Def_TimeTickType_ExamWaitStart, 0, lastTime, True)
    #Í¨ÖªÌØÐ§µ¹¼ÆÊ±
    else:
        lastTime = max(0, Def_Tick_ExamPrepareCountDown - (tick - __GetExamStepTick()))
        curPlayer.Sync_TimeTick(ShareDefine.Def_TimeTickType_ExamBeginCountDown, 0, lastTime, True)
 
    #֪ͨµØÍ¼·þÎñÆ÷, Íæ¼Ò½øÈë´ðÌâ
    curPlayer.MapServer_QueryPlayerResult(0, 0, 'ExamJoinOK', '', 0)
    return
#---------------------------------------------------------------------
#===============================================================================
# //13 02 ÎÊÌâ´ð°¸#tagCQuestionAnswer
# ////////////////////////////////////////////////////////////////
#===============================================================================
## ÎÊÌâ´ð°¸
# @param index Íæ¼ÒË÷Òý
# @param tick Ê±¼ä´Á
# @return ²¼¶ûÖµ
def Client_QuestionAnswer(index, tick):
    curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
    curPlayer.Sync_ExamAnswerOK(__DoLogic_QuestionAnswer(curPlayer, tick))
    return
 
#---------------------------------------------------------------------
##½ÓÊܿͻ§¶Ë·¢Ë͵ÄÎÊÌâ´ð°¸
# @param curPlayer Íæ¼ÒʵÀý
# @param tick Ê±¼ä´Á
# @return ²¼¶ûÖµ
# @remarks 
def __DoLogic_QuestionAnswer(curPlayer, tick):
    examType = __GetExamType()
    
    if examType not in ShareDefine.Def_Game_ExamTypeList:
        #GameWorld.Log('·¢ËÍ´ðÌâ´ð°¸Ê±»ú²»¶Ô examType = %s'%(examType))
        return False
    
    if __GetExamStep() != Def_ExamStep_Begin:
        #²»ÔڻشðÎÊÌâ»·½Ú
        #GameWorld.Log('²»ÔڻشðÎÊÌâ»·½Ú %s'%(__GetExamStep()))
        return False
    
    playerExamMgr = curPlayer.GetPlayerExam()
    
    if not playerExamMgr.GetIsExaming():
        #²»ÔÚ´ðÌâÖÐ
        #GameWorld.Log('Íæ¼Ò²»ÔÚ´ðÌâÖÐ')
        return False
    
    playerAnswer = playerExamMgr.GetCurrentAnswer()
    
    if not playerExamMgr.GetCombo() and playerAnswer != Def_Exam_NoAnswersSign:
        #ÒѾ­»Ø´ð¹ýÁË
        #GameWorld.Log('Íæ¼ÒÒѾ­»Ø´ð¹ýÁË')
        return False
    
    sendPack = IPY_GameServer.IPY_CQuestionAnswer()
    
    if sendPack.GetSubjectIndex() != __GetSendSubjectCnt():
        #²»ÊÇÕâµÀÌâµÄ´ð°¸
#        GameWorld.Log('·¢ËÍ´ðÌâ·â°üË÷Òý´íÎó server = %s, client = %s'%(__GetSendSubjectCnt(),
#                                                              sendPack.GetSubjectIndex()))
        return False
    
    #·â°üµÄ´ð°¸
    sendPackAnswer = sendPack.GetAnswer()
    
    playerExamMgr.SetCurrentAnswer(sendPackAnswer)
    playerExamMgr.SetCombo(0)
    playerExamMgr.SetAnswerSubjectTick(max(0, 
                            tick - GameWorld.GetGameWorld().GetPlayerExamManager().GetSendSubjectTick()))
 
    if examType == ShareDefine.Def_Game_Exam_ZXH:
        #ÕæÐÄ»°´óðÏÕÐèҪͳ¼Æ»Ø´ðµÄÍæ¼Ò
        __CalcExamZXH_AnswerCnt(playerAnswer, sendPackAnswer)
    
    #·â°üÇëÇóʹÓÃÌØÊ⹦ÄÜ Def_Game_Exam_Func_Cnt
    __UseExamFunc(examType, playerExamMgr, sendPack.GetExtraOpt1(), sendPack.GetExtraOpt2(), 
                                                  sendPack.GetExtraOpt3(), sendPack.GetExtraOpt4())
    #·µ»Ø½ÓÊܴ𰸳ɹ¦
    return True
 
#---------------------------------------------------------------------
##ÇëÇóʹÓÃÌØÊ⹦ÄÜ
# @param examType ´ðÌâÀàÐÍ
# @param playerExamMgr Íæ¼Ò´ðÌâ¹ÜÀíÆ÷
# @param useDouble Ê¹ÓÃË«±¶
# @param useAnswerRight Ê¹ÓÃÉèÖÃÕýÈ·´ð°¸
# @param useDelOper É¾³ýÑ¡Ïî
# @param useThree Ê¹ÓÃ3±¶»ý·Ö
# @return ²¼¶ûÖµ
# @remarks 
def __UseExamFunc(examType, playerExamMgr, useDouble, useAnswerRight, useDelOper, useThree):
    examUseFuncDict = Def_ExamUseFunc[examType]
    useExamFuncResult = False
    
    #ÇëÇóʹÓÃÌØÊ⹦ÄÜ Def_Game_Exam_Func_Cnt
    if useDouble and playerExamMgr.GetUseExtraOpt1Count() < examUseFuncDict[ShareDefine.Def_Game_Exam_Func_Double]:
        playerExamMgr.SetUseExtraOpt1Count(playerExamMgr.GetUseExtraOpt1Count() + 1)
        playerExamMgr.SetExtraOpt1(1)
        useExamFuncResult = True
    
    if useAnswerRight and playerExamMgr.GetUseExtraOpt2Count() < \
     examUseFuncDict[ShareDefine.Def_Game_Exam_Func_AnswerRight]:
        
        playerExamMgr.SetUseExtraOpt2Count(playerExamMgr.GetUseExtraOpt2Count() + 1)
        playerExamMgr.SetExtraOpt2(1)
        useExamFuncResult = True
        
    if useDelOper and playerExamMgr.GetUseExtraOpt3Count() < examUseFuncDict[ShareDefine.Def_Game_Exam_Func_DelOper]:
        playerExamMgr.SetUseExtraOpt3Count(playerExamMgr.GetUseExtraOpt3Count() + 1)
        playerExamMgr.SetExtraOpt3(1) 
        useExamFuncResult = True
    
    if useThree and playerExamMgr.GetUseExtraOpt4Count() < examUseFuncDict[ShareDefine.Def_Game_Exam_Func_Three]:
        playerExamMgr.SetUseExtraOpt4Count(playerExamMgr.GetUseExtraOpt4Count() + 1)
        playerExamMgr.SetExtraOpt4(1) 
        useExamFuncResult = True
 
    return useExamFuncResult
 
#---------------------------------------------------------------------
#===============================================================================
# //13 03 ¼¤»î´ðÌâÌØÊ⹦ÄÜ#tagCActivateExamSpecialFunction
# // ¶ÔÐÔÄÜÓÐÒ»¶¨Ó°Ïì
#===============================================================================
## ¼¤»î´ðÌâÌØÊ⹦ÄÜ
# @param index Íæ¼ÒË÷Òý
# @param tick Ê±¼ä´Á
# @return None
def Client_ActivateExamSpecialFunction(index, tick):
    GameWorld.GetPsycoFunc(__Func_Client_ActivateExamSpecialFunction)(index, tick)
    return
 
 
## ¼¤»î´ðÌâÌØÊ⹦ÄÜ
# @param index Íæ¼ÒË÷Òý
# @param tick Ê±¼ä´Á
# @return None  
def __Func_Client_ActivateExamSpecialFunction(index, tick):
#===============================================================================
#    #Ŀǰ´Ë·â°ü½öÓÃÓÚ¾ÙÆå²»¶¨, É¾³ýÌØÊâÑ¡Ïî
#===============================================================================
    curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
    #»ñÈ¡·â°ü
    sendPack = IPY_GameServer.IPY_CActivateExamSpecialFunction()
    packExamType = sendPack.GetType()
    packQuestionNO = sendPack.GetQuestionNO()
    packFunctionNO = sendPack.GetFunctionNO()
    
    #µ±Ç°´ðÌâÀàÐÍ
    examType = __GetExamType()
    
    if examType != packExamType:
        #²»ÊÇÕâ¸ö´ðÌâ»î¶¯
        return
 
    if packQuestionNO != __GetSendSubjectCnt():
        #²»ÊÇÕâÌâ
        return
 
    if __GetExamStep() != Def_ExamStep_Begin:
        #²»ÔڻشðÎÊÌâ»·½Ú
        #GameWorld.Log('ExamSpecialFunction ²»ÔڻشðÎÊÌâ»·½Ú %s'%(__GetExamStep()))
        return
    
    if examType == ShareDefine.Def_Game_Exam_JQBD:
        __DoLogic_ActivateExamSpecialFunction_JQBD(curPlayer, packQuestionNO, packFunctionNO)
 
    else:
        GameWorld.ErrLog('µ±Ç°´ðÌâÀàÐÍ = %sÎÞ·¨Ê¹Óô˹¦ÄÜ'%(examType))
        return
 
    return
 
#---------------------------------------------------------------------
##¼¤»î¾ÙÆì²»¶¨ÌØÊ⹦ÄÜ
# @param curPlayer Íæ¼ÒʵÀý
# @param questionNO µ±Ç°ÌâÄ¿ºÅ
# @param functionNO ¹¦ÄܺÅ
# @return ·µ»ØÖµÎÞÒâÒå
# @remarks 
def __DoLogic_ActivateExamSpecialFunction_JQBD(curPlayer, questionNO, functionNO):
    playerExamMgr = curPlayer.GetPlayerExam()
 
    if not playerExamMgr.GetIsExaming():
        #²»ÔÚ´ðÌâÖÐ
        #GameWorld.Log('ExamSpecialFunction Íæ¼Ò²»ÔÚ´ðÌâÖÐ')
        return
 
    #·â°üÇëÇóʹÓÃÌØÊ⹦ÄÜ Def_Game_Exam_Func_Cnt
    if not __UseExamFunc(ShareDefine.Def_Game_Exam_JQBD, playerExamMgr, 0, 0, 1, 0):
        return
 
    #ɾ³ý2¸ö´íÎóÑ¡Ïî
    examManager = GameWorld.GetGameWorld().GetPlayerExamManager()
    examAnswerList = [examManager.GetQuestionExrtaValue2(), examManager.GetQuestionExrtaValue3(), 
                      examManager.GetQuestionExrtaValue4(), examManager.GetQuestionExrtaValue5()]
 
    examRightAnswer = examManager.GetRightAnswer()
 
    if examRightAnswer not in examAnswerList:
        GameWorld.ErrLog('¾ÙÆì²»¶¨´ðÌâÑ¡Ïî´íÎó, examRightAnswer = %s, examAnswerList = %s'%(examRightAnswer,
                                                                                           examAnswerList))
        return
 
    #ɾ³ýÕýÈ·´ð°¸
    examAnswerList.remove(examRightAnswer)
    #Ëæ¼´Ñ¡2¸öɾ³ý
    delImageList = random.sample(examAnswerList, 2)
    
    #֪ͨ¿Í»§¶Ë
    curPlayer.Sync_ActivateExamSpelFuncAnswer(ShareDefine.Def_Game_Exam_JQBD, questionNO,
                                               functionNO, delImageList[0], delImageList[1], 0, 0)
    return
 
#---------------------------------------------------------------------
##Çå³ýÕæÐÄ»°»º´æµÄ×Öµä
# @param ÎÞ²ÎÊý
# @return ·µ»ØÖµÎÞÒâÒå
# @remarks 
def __ClearExamZXH_SaveDict():
    #Çå³ý´ð°¸Ñ¡Ôñ¼ÆÊý
    gameWorld = GameWorld.GetGameWorld()
    gameWorld.SetDict(Def_ExamZXH_TotalAnswerCntKey, 0)
    gameWorld.SetDict(Def_ExamZXH_AnswerOneCntKey, 0)
    gameWorld.SetDict(Def_ExamZXH_AnswerTwoCntKey, 0)
    gameWorld.SetDict(Def_ExamZXH_AnswerThreeCntKey, 0)
    #Çå³ýÌáʾ±ê¼Ç
    gameWorld.SetDict(Def_ExamZXHSendRightAnswerkey, 0)
    #Çå³ýµÈ´ýÍæ¼Ò²é¿´±ê¼Ç
    gameWorld.SetDict(Def_ExamZXHSeeAnswerkey, 0)
    return
 
#---------------------------------------------------------------------
##·¢Ë͸ø¿Í»§¶Ë´ðÌâÑ¡Ïî
# @param tick Ê±¼ä´Á
# @return ·µ»ØÖµÎÞÒâÒå
# @remarks 
def __ExamZXH_SendSeeAnswer(tick):
    gameWorld = GameWorld.GetGameWorld()
    
    if gameWorld.GetDictByKey(Def_ExamZXHSeeAnswerkey):
        #ÕâÀïÖ»»áµ½Ò»´Î
        GameWorld.ErrLog('__ExamZXH_SendSeeAnswer Err = %s'%(gameWorld.GetDictByKey(Def_ExamZXHSeeAnswerkey)))
        return
    
    #·¢ËÍÑ¡Ïî¸øÍæ¼Ò
    __DoLogic_ExamZXH_SendSelectOption(ShareDefine.Def_ExamZXH_FunctionNO_SendAnswer)
    #ÉèÖñê¼Çλ
    gameWorld.SetDict(Def_ExamZXHSeeAnswerkey, 1)
    return
 
#---------------------------------------------------------------------
##·¢Ë͸ø¿Í»§¶Ë´ðÌâÑ¡Ïî, Ñ¡ÔñÇé¿ö.
# @param sendSubjectLostTick ´ðÌâ¹ÜÀíÆ÷
# @return ·µ»ØÖµÎÞÒâÒå
# @remarks 
def __ExamZXH_SendSelectOption(sendSubjectLostTick):
    gameWorld = GameWorld.GetGameWorld()
    
    if gameWorld.GetDictByKey(Def_ExamZXHSendRightAnswerkey):
        #ÒѾ­·¢¹ýÁË
        return
    
    if sendSubjectLostTick < Def_ExamZXHSendRightAnswerTick:
        #¼ä¸ôδµ½
        return
    
    #·¢ËÍÑ¡Ïî¸øÍæ¼Ò
    __DoLogic_ExamZXH_SendSelectOption(ShareDefine.Def_ExamZXH_FunctionNO_SendSelectOption)
    
    #ÉèÖñê¼Çλ
    gameWorld.SetDict(Def_ExamZXHSendRightAnswerkey, 1)
    return
 
#---------------------------------------------------------------------
##·¢ËÍÍæ¼Ò´ðÌâÑ¡ÏîÇé¿ö.
# @param funcNo Ñ¡ÏÄܺÅ
# @return ·µ»ØÖµÎÞÒâÒå
# @remarks 
def __DoLogic_ExamZXH_SendSelectOption(funcNo):
    examType = ShareDefine.Def_Game_Exam_ZXH
    #»ñµÃ´ðÌâ±ÈÀý
    answerOnePer, answerTwoPer, answerThreePer = __GetExamZXH_AnswerScale()
    
    #´ðÌâ¹ÜÀíÆ÷
    examManager = GameWorld.GetGameWorld().GetPlayerExamManager()
    
    for index in range(0, examManager.GetExamPlayerCount()):
        examPlayer = examManager.GetExamPlayer(index)
        
        if not examPlayer or not examPlayer.GetInitOK():
            #Íæ¼Ò²»ÔÚÏß
            continue
        
        if funcNo == ShareDefine.Def_ExamZXH_FunctionNO_SendSelectOption:
            #Íæ¼Ò¿ÉÒÔÔÙ´ÎÑ¡Ôñ´ð°¸
            examPlayer.GetPlayerExam().SetCombo(1)
        
        #֪ͨ¿Í»§¶Ëµ±Ç°»Ø´ðÇé¿ö
        examPlayer.Sync_ActivateExamSpelFuncAnswer(examType, 0, funcNo,
                                                          answerOnePer, answerTwoPer, answerThreePer, 0)
    return
 
##»ñµÃÕæÐÄ»°´ðÌâÒѻشðÍæ¼ÒÊý
# @param index Íæ¼ÒË÷Òý
# @param tick Ê±¼ä´Á
# @return ·µ»ØÖµÎÞÒâÒå
# @remarks ¿Í»§¶Ë·â°üÏìÓ¦
def __GetExamZXH_TotalAnswerCnt():
    return GameWorld.GetGameWorld().GetDictByKey(Def_ExamZXH_TotalAnswerCntKey)
 
#---------------------------------------------------------------------
##¼ÆËã´ðÌâͳ¼ÆÂÊ
# @param playerAnswer Íæ¼ÒÉϴεÄÑ¡Ôñ 
# @param answerIndex Íæ¼ÒÑ¡ÔñµÄ´ð°¸Ë÷Òý 
# @return ·µ»ØÖµÎÞÒâÒå
# @remarks 
def __CalcExamZXH_AnswerCnt(playerAnswer, answerIndex):
    if playerAnswer == Def_Exam_NoAnswersSign:
        #Íæ¼Ò½øÐеÚÒ»´Î´ðÌâ
        __AddExamZXH_AnswerCnt(answerIndex)
        return
    
    #Íæ¼Ò±ä¸üÑ¡Ïî
    __ChangeExamZXH_AnswerCnt(playerAnswer, answerIndex)
    return
#---------------------------------------------------------------------
##ÀÛ¼ÓÑ¡ÔñÌâÄ¿µÄÍæ¼ÒÊý
# @param answerIndex Íæ¼ÒÑ¡ÔñµÄ´ð°¸Ë÷Òý 
# @return ·µ»ØÖµÎÞÒâÒå
# @remarks 
def __AddExamZXH_AnswerCnt(answerIndex):
    gameWorld = GameWorld.GetGameWorld()
    
    #ÀÛ¼Óͳ¼ÆÂÊ
    if not __AddExamZXHAnswerCntKey(gameWorld, answerIndex):
        return
    
    #Àۼӻشð×ÜÈËÊý
    gameWorld.SetDict(Def_ExamZXH_TotalAnswerCntKey, gameWorld.GetDictByKey(Def_ExamZXH_TotalAnswerCntKey) + 1)
    return
 
#---------------------------------------------------------------------
##±ä¸üÑ¡ÔñÌâÄ¿µÄÍæ¼ÒÊý
# @param playerAnswer Íæ¼ÒÉϴεÄÑ¡Ôñ 
# @param answerIndex Íæ¼ÒÑ¡ÔñµÄ´ð°¸Ë÷Òý 
# @return ·µ»ØÖµÎÞÒâÒå
# @remarks 
def __ChangeExamZXH_AnswerCnt(playerAnswer, answerIndex):
    gameWorld = GameWorld.GetGameWorld()
    
    if playerAnswer == answerIndex:
        #2´Î»Ø´ðÒ»Ñù²»ÖØÐÂͳ¼Æ
        return
    
    if playerAnswer == 1:
        gameWorld.SetDict(Def_ExamZXH_AnswerOneCntKey,
                           max(0, gameWorld.GetDictByKey(Def_ExamZXH_AnswerOneCntKey) - 1))
    
    elif playerAnswer == 2:
        gameWorld.SetDict(Def_ExamZXH_AnswerTwoCntKey,
                           max(0, gameWorld.GetDictByKey(Def_ExamZXH_AnswerTwoCntKey) - 1))
        
    elif playerAnswer == 3:
        gameWorld.SetDict(Def_ExamZXH_AnswerThreeCntKey,
                           max(0, gameWorld.GetDictByKey(Def_ExamZXH_AnswerThreeCntKey) - 1))
    
    else:
        GameWorld.ErrLog('ExamZXH playerAnswer = %s Error'%(playerAnswer))
        return
    
    #ÀÛ¼Óͳ¼ÆÂÊ
    __AddExamZXHAnswerCntKey(gameWorld, answerIndex)
    return
 
#---------------------------------------------------------------------
##ÀÛ¼Ó¸÷Ñ¡ÏîµÄͳ¼ÆÂÊ.
# @param gameWorld Íæ¼ÒË÷Òý
# @param answerIndex »Ø´ðË÷Òý
# @return ²¼¶ûÖµ
# @remarks 
def __AddExamZXHAnswerCntKey(gameWorld, answerIndex):
    if answerIndex == 1:
        gameWorld.SetDict(Def_ExamZXH_AnswerOneCntKey, gameWorld.GetDictByKey(Def_ExamZXH_AnswerOneCntKey) + 1)
        
    elif answerIndex == 2:
        gameWorld.SetDict(Def_ExamZXH_AnswerTwoCntKey, gameWorld.GetDictByKey(Def_ExamZXH_AnswerTwoCntKey) + 1)
    
    elif answerIndex == 3:
        gameWorld.SetDict(Def_ExamZXH_AnswerThreeCntKey, gameWorld.GetDictByKey(Def_ExamZXH_AnswerThreeCntKey) + 1)
    
    else:
        GameWorld.ErrLog('ExamZXH AnswerIndex = %s Error'%(answerIndex))
        return False
     
    return True
#---------------------------------------------------------------------
##»ñµÃÕæÐÄ»°Ñ¡ÔñµÄ´ð°¸±ÈÀý.
# @param ÎÞ²ÎÊý
# @return µÚһѡÏî±ÈÀý, µÚ¶þÑ¡Ïî±ÈÀý, µÚÈýÑ¡Ïî±ÈÀý
# @remarks 
def __GetExamZXH_AnswerScale():
    #»ñµÃ´ðÌâ±ÈÀý
    gameWorld = GameWorld.GetGameWorld()
    totalAnswerCnt = gameWorld.GetDictByKey(Def_ExamZXH_TotalAnswerCntKey)
    
    if totalAnswerCnt == 0:
        #ÎÞÈ˻شð
        return 0, 0, 0
    
    #±¶ÂÊ
    per = 100
    answerOnePer = int(gameWorld.GetDictByKey(Def_ExamZXH_AnswerOneCntKey) / float(totalAnswerCnt) * per)
    answerTwoPer = int(gameWorld.GetDictByKey(Def_ExamZXH_AnswerTwoCntKey) / float(totalAnswerCnt) * per)
    answerThreePer = max(0, per - answerOnePer - answerTwoPer)
    return answerOnePer, answerTwoPer, answerThreePer