-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGetGameMeiPic.py
1494 lines (1235 loc) · 52.7 KB
/
GetGameMeiPic.py
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
/**
* Button_SuitType
*/
/**
* Button_SuitType args;self.vars_.type ,changePage
*/
//判断是否有新获得标签
var fashionTable = game.configs.fashion;
var faceTable = game.configs.face;
var suitTable = game.configs.suit;
function judgeIsNew(fromId) {
//后期更改
current_scene.vars_.currentClothNew = [];
for (var k = 0; k < current_scene.vars_.currentClothNew.length; k++) {
if (Number(fromId) == Number(current_scene.vars_.currentClothNew[k])) {
return true;
}
}
return false;
}
function judgeInBag(_id) {
//套装中的部件是否全部都已经拥有
if (suitTable[_id]) {
var fashionIdArr = suitTable[_id].fashionId.toString().split("|");
for (var i = 0; i < fashionIdArr.length; i++) {
if (!arguments.callee(fashionIdArr[i])) {
return 0;
}
}
return 1;
}
return game.vars_.bagList.cloth[_id] ? game.vars_.bagList.cloth[_id] : 0;
}
//是否是新手服装
function judgeInNewMan(_id) {
var newManSuit = JSON.parse(game.configs.misc[1].value);
return (newManSuit[getConfig("suitType", game.vars_.curChangeType, "name")] == _id) || newManSuit[getConfig("suitType_face", game.vars_.curChangeType, "name")] == _id;
}
if (type <= 0)
return;
var index = 0;
var arr = [];
game.vars_.curChangeType = type;
if (game.vars_.curChangeType != 101) {
var suitArr = ["grou_mySuitBtn", "grou_mySuitEmpty", "grou_ChangeSuitLock"];
for (var k = 0; k < suitArr.length; k++) {
qyengine.forEach(function () {
this.destroy();
}, suitArr[k]);
}
}
var tujian = function () {
var configRecommond = game.configs.recommend[1];
var recommend_fashion = configRecommond.fashion == -1 ? 0 : configRecommond.fashion.split("|"),
recommend_suit = configRecommond.suit == -1 ? 0 : configRecommond.suit.split("|");
if (recommend_fashion) {
for (var i = 0; i < recommend_fashion.length; i++) {
var property = getConfig("fashion", recommend_fashion[i], "propertyInfo");
var itemName = getConfig("fashion", recommend_fashion[i], "name");
var itemInfo = getConfig("fashion", recommend_fashion[i], "info");
var isSearchCondition = current_game.scripts['al_scr_' + "filterClothesByTextOrProperty"].call(this, undefined, this, property, itemName, itemInfo);
if (!isSearchCondition) {
continue;
}
var isNew = judgeIsNew(recommend_fashion[i]);
var unGet = judgeInBag(recommend_fashion[i]);
arr[index] = [parseInt(recommend_fashion[i]), Number(fashionTable[recommend_fashion[i]].quality), isNew, unGet];
index++;
}
}
for (var i = 0; i < recommend_suit.length; i++) {
var property = getConfig("suit", recommend_suit[i], "propertyInfo");
var itemName = getConfig("suit", recommend_suit[i], "name");
var itemInfo = getConfig("suit", recommend_suit[i], "dec");
var isSearchCondition = current_game.scripts['al_scr_' + "filterClothesByTextOrProperty"].call(this, undefined, this, property, itemName, itemInfo);
if (!isSearchCondition) {
continue;
}
var unGet = 0;//judgeInBag(recommend_suit[i]);
arr[index] = [parseInt(recommend_suit[i]), Number(suitTable[recommend_suit[i]].quality), false, unGet];
index++;
}
return arr;
};
var suitPage = function () {
for (var i in suitTable) {
if (parseInt(suitTable[i].id) == 4802) {
continue;
}
var property = getConfig("suit", suitTable[i].id, "propertyInfo");
var itemName = getConfig("suit", suitTable[i].id, "name");
var itemInfo = getConfig("suit", suitTable[i].id, "dec");
var isSearchCondition = current_game.scripts['al_scr_' + "filterClothesByTextOrProperty"].call(this, undefined, this, property, itemName, itemInfo);
if (!isSearchCondition) {
continue;
}
var suitType = suitTable[i].type;
if (type == 101 && suitType == 1) {
arr[index] = [parseInt(suitTable[i].id), Number(suitTable[i].quality), false, 0];
index++;
} else if (type == 103 && suitType == 2) {
arr[index] = [parseInt(suitTable[i].id), Number(suitTable[i].quality), false, 0];
index++;
}
}
return arr;
};
var tuijian_face = function () {
var configRecommond = game.configs.recommend[2],
recommend_fashion = configRecommond.face.split("|");
if (recommend_fashion) {
for (var i = 0; i < recommend_fashion.length; i++) {
var property = getConfig("face", recommend_fashion[i], "propertyInfo");
var itemName = getConfig("face", recommend_fashion[i], "name");
var itemInfo = getConfig("face", recommend_fashion[i], "info");
var isSearchCondition = current_game.scripts['al_scr_' + "filterClothesByTextOrProperty"].call(this, undefined, this, property, itemName, itemInfo);
if (!isSearchCondition) {
continue;
}
var isNew = judgeIsNew(recommend_fashion[i]);
var unGet = judgeInBag(recommend_fashion[i]);
arr[index] = [Number(recommend_fashion[i]), Number(faceTable[recommend_fashion[i]].quality), isNew, unGet];
index++;
}
}
};
//推荐或者套装
if (type >= 100) {
switch (type) {
case 100:
tujian();
current_game.scripts['al_scr_' + "clothesPressChange"].call(this, undefined, this, arr);
break;
case 101:
current_game.scripts['al_scr_' + "Button_MySuit"].call(this, undefined, this);
//suitPage();
break;
case 102:
tuijian_face();
current_game.scripts['al_scr_' + "clothesPressChange"].call(this, undefined, this, arr);
break;
case 103:
suitPage();
break;
default:
break;
}
return;
}
//遍历道具表,符合当前服装类型的加入数组
var tableList = null;
if (grou_clothesPressPanel.vars_.faceOrClothes == undefined || grou_clothesPressPanel.vars_.faceOrClothes == 1) {
tableList = game.configs.fashion/*game.vars_.bagList.cloth*/;
} else {
tableList = game.configs.face;
}
for (var id in tableList) {
var property = getConfig("fashion", id, "propertyInfo") || getConfig("face", id, "propertyInfo");
var itemName = getConfig("fashion", id, "name") || getConfig("face", id, "name");
var itemInfo = getConfig("fashion", id, "info") || getConfig("face", id, "info");
var itemType = getConfig("fashion", id, "type") || getConfig("face", id, "type");
if (!property) {
continue;
}
//临时加一个
if (id == 30037) {
property = "5#7";
}
if (property == -1 || property == "-1") {
continue;
}
var isSearchCondition = current_game.scripts['al_scr_' + "filterClothesByTextOrProperty"].call(this, undefined, this, property, itemName, itemInfo);
if (!isSearchCondition) {
continue;
}
var idType = function () {
if ((getConfig("fashion", id, "type") && getConfig("fashion", id, "type") == type) || (getConfig("face", id, "type") && getConfig("face", id, "type") == type)) {
return true;
} else {
return false;
}
};
if (idType()) {
if (judgeInNewMan(id)) {
continue;
}
var quality = getConfig("fashion", id, "quality") || getConfig("face", id, "quality");
var isNew = judgeIsNew(id);
var unGet = judgeInBag(id);
if (game.vars_.searchCondition == 1 && !unGet) {
continue;
}
if (game.vars_.searchCondition == 2 && unGet) {
continue;
}
var tempArr = [parseInt(id), quality, isNew, unGet];
arr[index] = tempArr;
index++;
}
}
//排序:quality大的靠前,quality相同的情况下id小的靠前 后期更改
if (false && grou_propertySortSmallScreen.vars_ && Number(grou_propertySortSmallScreen.vars_.type) == 1) {
var data = {};
for (var i = 0; i < arr.length; i++) {
var temp;
if (arr[i][2]) {
temp = data[1] || (data[1] = {});
} else {
temp = data[0] || (data[0] = {});
}
var zhiliang = arr[i][1];
temp[zhiliang] || (temp[zhiliang] = {});
temp[zhiliang][arr[i][0]] = arr[i];
}
var data1 = [];
//遍历数组第二个元素
for (var key in data) {
var temp = data[key];
//遍历数组第1个元素
for (var key1 in temp) {
var temp1 = Object.keys(temp[key1]);
for (var i = temp1.length - 1; i >= 0; i--) {
data1.push(temp[key1][temp1[i]]);
}
// for (var key2 in temp1) {
// data1.push(temp1[key2]);
// }
}
}
data1.reverse();
arr = data1;
} else {
for (var i = 0; i < arr.length; i++) {
for (var j = i + 1; j < arr.length; j++) {
var temp = arr[i];
if (arr[j][1] > temp[1]) {
arr[i] = arr[j];
arr[j] = temp;
}
else if (arr[j][1] == temp[1]) {
if (arr[j][0] < temp[0]) {
arr[i] = arr[j];
arr[j] = temp;
}
}
}
}
}
//计算总页数
current_game.scripts['al_scr_' + "clothesPressChange"].call(this, undefined, this, arr);
if (self.id.indexOf("txt_cropParkShiFei_time")) {
self.currentSprite.style.font = "normal 800 24px/1.1 serif";
self.setStroke("#663300", 4);
} else {
self.currentSprite.style.font = "normal 800 24px/1.1 serif";
self.setStroke("#663300", 4);
}
/**
* whenStatusIsOne
*/
var table = game.configs.prop;
//先创建黑色的蒙版
qyengine.instance_create(510, 640, "obj_landBlackBg", {
"type": "obj_landBlackBg",
"id": "obj_landBlackBg",
"zIndex": grou_cropParkPanel.zIndex + 1,
"layer": "layer0"
});
var posX = self.currentSprite.worldTransform.tx + self.width / 2; //- gmx_.grou_fertilizeInLandPanel.defaultOpt.size.width/2 ;
var posY = grou_fertilizeInLandPanel.y = grou_cropLandItem_8.currentSprite.worldTransform.ty - grou_fertilizeInLandPanel.height;
var resultObj = qyengine.instance_create(posX, posY, "grou_fertilizeInLandPanel", {
"type": "grou_fertilizeInLandPanel",
"id": "grou_fertilizeInLandPanel",
"zIndex": grou_cropParkPanel.zIndex + 1,
"layer": "layer0"
});
var iconObj = qyengine.guardId("grou_fertilizeInLand").objects['obj_fertilize_0'];
var iconObj_1 = qyengine.guardId("grou_fertilizeInLand_1").objects['obj_plantation_home_14_1_1'];
var iconObj_2 = qyengine.guardId("grou_fertilizeInLand_2").objects['obj_plantation_home_14_1_2'];
var idTo = { 120: iconObj, 121: iconObj_1, 129: iconObj_2 };
for (var j in idTo) {
idTo[j].changeSprite("obj_" + table[j].icon + "_default");
}
resultObj.vars_.touchLandId = self.vars_.itemId;
var propIdArr = [120, 121, 129];
for (var i = 0; i < 3; i++) {
if (i == 0) {
var parentObj = resultObj.objects['grou_fertilizeInLand'];
var numObj = parentObj.objects['txt_cropParkShiFei'];
var timeObj = parentObj.objects['txt_cropParkShiFei_time'];
} else {
var parentObj = resultObj.objects['grou_fertilizeInLand_' + i];
var numObj = parentObj.objects['txt_cropParkShiFei_' + i];
var timeObj = parentObj.objects['txt_cropParkShiFei_time_' + i];
}
var num = 0;
if (game.vars_.playInfoJson.propItem[propIdArr[i]]) {
num = game.vars_.playInfoJson.propItem[propIdArr[i]];
}
numObj.text = num;
var time = Number(table[propIdArr[i]].time3) / 3600;
timeObj.text = time + "小时";
}
qyengine.pay.WeChatPay
current_game.scripts['al_scr_' + "hideRechargeTip"].call(this, undefined, this);
return;
//notGoodStateBySeed
//obj_plantation_home_14_2
/**
* notGoodStateBySeed
*/
/**
* notGoodStateBySeed obj envirState
*/
var envirStateSprite = { "-1": "plantation_home_06", 0: "plantation_home_06_2", 1: "plantation_home_06_1" };
obj.objects['obj_plantation_home_06'].changeSprite("obj_" + envirStateSprite[envirState] + "_default");
switch (Number(envirState)) {
case -1:
obj.objects['grou_wateringBtn'].hide();
break;
case 0: //杂草
obj.objects['grou_wateringBtn'].show();
obj.objects['grou_wateringBtn'].objects['obj_plantation_home_14_6'].changeSprite("obj_plantation_home_14_5_default");
break;
case 1:
obj.objects['grou_wateringBtn'].show();
obj.objects['grou_wateringBtn'].objects['obj_plantation_home_14_6'].changeSprite("obj_plantation_home_14_6_default");
break;
default:
break;
}
if (state && state == 2) {
obj.objects['grou_wateringBtn'].show();
obj.objects['grou_wateringBtn'].objects['obj_plantation_home_14_6'].changeSprite("obj_plantation_home_14_4_default");
}
obj.objects['grou_wateringBtn'].vars_.parentObj = obj;
/**
* faceAndSuitBtn
*/
/**
* faceAndSuitBtn 妆容 服饰 保存按钮的切换事件
*/
var whitchType = { 0: 21, 1: 100 };
var idArr = { "grou_clothesPressBtn_face": 0, "grou_clothesPressBtn_dress": 1, "grou_clothesPressBtn_keep": 2 };
var whitchBtn = 1;
whitchBtn = idArr[self.id];
if (self && self.id && grou_clothesPressPanel.vars_.faceOrClothes != whitchBtn && whitchBtn != 2) {
for (var i in idArr) {
qyengine.guardId(i).dispatchMessage({
"type": "message",
"message": "changeBtnSprite",
"argument0": (i == self.id)
});
}
}
if (grou_clothesPressPanel.vars_.faceOrClothes == whitchBtn && whitchBtn != 2) {
return;
} else {
//grou_clothesPressPanel.vars_.faceOrClothes = whitchBtn;
if (whitchBtn == 2) {
current_game.scripts['al_scr_' + "saveSuit"].call(this, undefined, this);
} else {
grou_clothesPressPanel.vars_.faceOrClothes = whitchBtn;
current_game.scripts['al_scr_' + "Change_Init"].call(this, undefined, this);
}
}
/**
* Change_Init
*/
/**
* Change_Init args:selectTab
*/
//Change_Init
var suit = game.vars_.playInfoJson.suit[game.vars_.changeSuitIndex];
if (!('texiao' in suit)) {
suit['texiao'] = 0;
}
if (!('bgPic' in suit)) {
suit['bgPic'] = 0;
}
var length = Object.keys(suit).length;
var tempCloth;
if (length > 0) {
if (!('texiao' in suit)) {
suit['texiao'] = 0;
}
if (!('bgPic' in suit)) {
suit['bgPic'] = 0;
}
tempCloth = JSON.parse(JSON.stringify(suit));
} else {
tempCloth = {
'name': '编辑套装名字',
'hairStyle': 10037,
'jacket': 0,
'pants': 0,
'dress': 25001,
'coat': 0,
'shoes': 0,
'hairpin': 0,
'earrings': 0,
'necklace': 0,
'bracelet': 0,
'handTake': 0,
'belt': 0,
'face': 0,
'special': 0,
'pet': 0,
'bgPic': 0,
'texiao': 0
};
}
if (current_scene.vars_.searchProperty == undefined)
current_scene.vars_.searchProperty = [0, 0];
if (current_scene.vars_.tempProperty == undefined)
current_scene.vars_.tempProperty = [0, 0];
current_scene.vars_.currentClothType = -1;
//装容||服饰
var tabStartValue = true;//2;
var tableSort = game.configs.wardrobe;
var tableConfig = game.configs.suitType
if (grou_clothesPressPanel.vars_.faceOrClothes != undefined && grou_clothesPressPanel.vars_.faceOrClothes == 0) {
tabStartValue = false;//1;
tableConfig = game.configs.suitType_face;
}
//创建推荐和套装
function createClothesTabScro() {
for (var k = 0; k < 2; k++) {
if (qyengine.guardId("grou_clothesPressBtn_Type_" + k) && !qyengine.guardId("grou_clothesPressBtn_Type_" + k).destroyed_) {
qyengine.grou_clothTypeInstance = qyengine.guardId("grou_clothesPressBtn_Type_" + k);
} else {
qyengine.grou_clothTypeInstance = qyengine.instance_create(0, 0, "grou_clothesPressBtn_Type", {
"type": "grou_clothesPressBtn_Type",
"id": "grou_clothesPressBtn_Type_" + k,
"zIndex": 0
});
}
qyengine.grou_clothTypeInstance.show();
if (!tabStartValue) {
qyengine.guardId("grou_clothesPressBtn_Type_" + k).vars_.type = 102 + k;
} else {
qyengine.guardId("grou_clothesPressBtn_Type_" + k).vars_.type = 100 + k;
}
var markIcon = k == 0 ? "obj_Chest_home_06_1" : "obj_Chest_home_06_2";
qyengine.guardId("grou_clothesPressBtn_Type_" + k).objects.obj_Chest_home_07_1.changeSprite(markIcon + "_default");
var textTypeName = ["推荐", "套装"];
qyengine.guardId("grou_clothesPressBtn_Type_" + k).objects.txt_closeDress_common_typeName.text = textTypeName[k];
if (selectTab != undefined && 100 + k == selectTab) {
qyengine.guardId("grou_clothesPressBtn_Type_" + k).objects.obj_Chest_home_02.show();
qyengine.guardId("grou_clothesPressBtn_Type_" + k).objects['txt_closeDress_common_typeName'].hide();
qyengine.guardId("grou_clothesPressBtn_Type_" + k).objects.obj_Chest_home_07_1.show();
} else {
if (k == 0) {
qyengine.guardId("grou_clothesPressBtn_Type_" + k).objects.obj_Chest_home_02.show();
qyengine.guardId("grou_clothesPressBtn_Type_" + k).objects.obj_Chest_home_07_1.show();
qyengine.guardId("grou_clothesPressBtn_Type_" + k).objects['txt_closeDress_common_typeName'].hide();
} else {
qyengine.guardId("grou_clothesPressBtn_Type_" + k).objects.obj_Chest_home_02.hide();
qyengine.guardId("grou_clothesPressBtn_Type_" + k).objects.obj_Chest_home_07_1.hide();
qyengine.guardId("grou_clothesPressBtn_Type_" + k).objects['txt_closeDress_common_typeName'].show();
}
}
scro_clothesType.appendChild("grou_clothesPressBtn_Type_" + k, 1, -1, 0, k, false, true);
}
var index = k;
for (var i in tableSort) {
if (i == 1 || i == 2) {
continue;
}
var markType = tabStartValue ? tableSort[i].fashion : tableSort[i].face;
if (tableConfig[markType].type == 5) {
//continue;
}
var cell = tableConfig[markType];
if (qyengine.guardId("grou_clothesPressBtn_Type_" + index) && !qyengine.guardId("grou_clothesPressBtn_Type_" + index).destroyed_) {
qyengine.grou_clothTypeInstance = qyengine.guardId("grou_clothesPressBtn_Type_" + index);
} else {
qyengine.grou_clothTypeInstance = qyengine.instance_create(0, 0, "grou_clothesPressBtn_Type", {
"type": "grou_clothesPressBtn_Type",
"id": "grou_clothesPressBtn_Type_" + index,
"zIndex": 0
});
}
qyengine.grou_clothTypeInstance.show();
qyengine.guardId("grou_clothesPressBtn_Type_" + index).vars_.type = markType;
qyengine.guardId("grou_clothesPressBtn_Type_" + index).objects.obj_Chest_home_07_1.changeSprite(cell.icon + "_default");
if (selectTab != undefined && markType == selectTab) {
qyengine.guardId("grou_clothesPressBtn_Type_" + index).objects.obj_Chest_home_02.show();
qyengine.guardId("grou_clothesPressBtn_Type_" + index).objects.obj_Chest_home_07_1.show();
qyengine.guardId("grou_clothesPressBtn_Type_" + index).objects['txt_closeDress_common_typeName'].hide();
} else {
qyengine.guardId("grou_clothesPressBtn_Type_" + index).objects.obj_Chest_home_02.hide();
qyengine.guardId("grou_clothesPressBtn_Type_" + index).objects.obj_Chest_home_07_1.hide();
qyengine.guardId("grou_clothesPressBtn_Type_" + index).objects['txt_closeDress_common_typeName'].show();
}
qyengine.guardId("grou_clothesPressBtn_Type_" + index).objects['txt_closeDress_common_typeName'].text = cell.comment;
scro_clothesType.appendChild("grou_clothesPressBtn_Type_" + index, 1, -1, 0, index, false, true);
index++;
}
}
qyengine.forEach(function () {
this.hide();
}, "grou_clothesPressBtn_Type");
createClothesTabScro();
//默认展示推荐
current_game.scripts['al_scr_' + "Button_SuitType"].call(this, undefined, this, !tabStartValue ? 102 : 100);
if (grou_clothesPressPanel.vars_.faceOrClothes == undefined) {
current_game.scripts['al_scr_' + "SetClothesBottonPos"].call(this, undefined, this);
grou_clothesPressPanel.vars_.faceOrClothes = 1;
}
if (window.adapt && window.adapt.isCanJoinQQGroup) {
window.adapt.JoinQQGroup();
}
if (self.currentSprite.parent.qyobj.id != "grou_cropLandItem_guide") {
}
/**
* overLevelCondition
*/
/**
* overLevelCondition tab通关条件相关~ 1畅玩卡 2制作
*/
if (tab == 1) {
grou_overLevelCondition.objects['obj_Chest_hint_02_1'].x = 397;
grou_overLevelCondition.objects.grou_goodPlay.show();
grou_overLevelMake.hide();
var tab = game.configs.suit;
var index = 0;
for (var i in tab) {
if (tab[i].card == 1) {
index++;
game.configs.config_goodPlayCard[index] = {
"id": index,
"icon": "obj_" + tab[i].icon + "_default",
"itemId": i,
"name": tab[i].name
};
}
}
qyengine.guardId("scro_goodPlay").refreshRelations();
grou_overLevelCondition.vars_.itemLength = index;
if (index > 3) {
grou_overLevelCondition.startTimeline();
}
if (game.vars_.playInfoJson.questCard) {
qyengine.guardId("grou_oneKeyPlayBtn").objects['txt_closeDress_common_oneKey'].text = "已开卡";
}
} else {
grou_overLevelCondition.objects['obj_Chest_hint_02_1'].x = 622;
grou_overLevelCondition.objects.grou_goodPlay.hide();
grou_overLevelMake.show();
//var overLevelData = game.configs.quest[game.vars_.selectQuestId];
var overLevelData = game.configs.quest[grou_clothesPressPanel.vars_.selectQuestId];
if (overLevelData.successTip == -1) {
game.configs.config_overLevelMust = {};
} else {
var overLevelClothes = overLevelData.successTip.toString().split("#");
var isSuit = null;
for (var i = 0; i < overLevelClothes.length; i++) {
if (game.configs.suit[overLevelClothes[i]]) {
var clothesTable = game.configs.suit[overLevelClothes[i]];
isSuit = 1;
} else {
var clothesTable = game.configs.fashion[overLevelClothes[i]] || game.configs.face[overLevelClothes[i]];
isSuit = 0;
}
var getWayText = current_game.scripts['al_scr_' + "getClothTapText"].call(this, undefined, this, overLevelClothes[i]);
game.configs.config_overLevelMust[i + 1] = {
"id": i + 1,
"name": clothesTable.name,
"icon": "obj_" + clothesTable.icon + "_default",
"getWayText": isSuit ? "" : getWayText,
"getWay": isSuit,
"itemId": overLevelClothes[i]
}
}
}
qyengine.guardId("scro_overLevelMust").refreshRelations();
if (overLevelData.perfectTip == -1) {
game.configs.config_overLevelPerfect = {};
} else {
var overLevelClothes = overLevelData.perfectTip.toString().split("#");
for (var i = 0; i < overLevelClothes.length; i++) {
var clothesTable = game.configs.fashion[overLevelClothes[i]] || game.configs.face[overLevelClothes[i]] || game.configs.suit[overLevelClothes[i]];
var getNum = getclothesNum(overLevelClothes[i]);
var getWayText = "";
if (!getNum) {
getWayText = current_game.scripts['al_scr_' + "getClothTapText"].call(this, undefined, this, overLevelClothes[i]);
}
game.configs.config_overLevelPerfect[i + 1] = {
"id": i + 1,
"name": clothesTable.name,
"icon": "obj_" + clothesTable.sicon + "_default",
"num": getNum ? getNum : "",
"getWayText": getWayText,
"getWay": overLevelClothes[i],
"itemId": overLevelClothes[i]
}
}
qyengine.guardId("scro_overlevelPerfect").refreshRelations();
}
}
function getclothesNum(_markId) {
var needLookNumTab = game.configs.fashion[overLevelClothes[i]] || game.configs.face[overLevelClothes[i]];
if (needLookNumTab) {
if (game.vars_.playInfoJson.bagList.cloth[_markId]) {
return game.vars_.playInfoJson.bagList.cloth[_markId].num;
} else {
return 0;
}
} else {
return 0;
}
}
/**
* OpenChange
*/
//OpenChange 打开衣柜
console.time("衣柜");
qyengine.instance_create(0, 0, "grou_gameLoadingBg", { "type": "grou_gameLoadingBg", "id": "grou_gameLoadingBg", "zIndex": 10000, "layer": "layer1" });
setTimeout(function () {
var obj = qyengine.getInstancesByType("grou_gameLoadingBg");
if (obj.length > 0) {
obj[0].destroy();
}
}, 600);
var suit = game.vars_.playInfoJson.suit[index];
var length = Object.keys(suit).length;
if (length > 0)
game.vars_.changeSuitIndex = index;
else
game.vars_.changeSuitIndex = game.vars_.playInfoJson.dressIndex;
game.scripts["al_scr_CommonInstanceCreate"](null, null, "grou_clothesPressPanel");
//10衣柜 0剧情换装
if (game.vars_.intoChangeType == 10) {
grou_clothesPressPanel.objects['grou_clothesPressBack_hint'].hide();
} else {
grou_clothesPressPanel.objects['grou_clothesPressBack_hint'].show();
//记录关卡 退出清零
if (!grou_clothesPressPanel.vars_.selectQuestId) {
grou_clothesPressPanel.vars_.selectQuestId = game.vars_.selectQuestId;
}
}
grou_clothesPressPanel.appendChild("grou_playerDress", 520, 550);
grou_playerDress.setScale(0.46, 0.46);
grou_playerDress.show();
game.scripts["al_scr_Change_Init"](null, null);
game.vars_.playerCurrentCloths = JSON.parse(JSON.stringify(game.vars_.playInfoJson.suit[game.vars_.changeSuitIndex]));
current_scene.vars_.searchProperty = [0, 0];
current_scene.vars_.tempProperty = [0, 0];
console.timeEnd("衣柜");
/**
* grou_seedItem
*/
console.log("释放~~~~~~~");
var tabType = qyengine.guardId("grou_cropBotton_left").vars_.nowTab;
if (self.vars_.isLongPress) {
judgeRelease();
qyengine.guardId("grou_seedItem_grow").destroy && qyengine.guardId("grou_seedItem_grow").destroy();
self.vars_.isLongPress = false;
}
function judgeRelease() {
var growObj = qyengine.guardId("grou_seedItem_grow");
var landObj = null;
qyengine.forEach(function () {
//console.log("growObjX-----", growObj.currentSprite.worldTransform.tx);
//console.log("growObjY-----", growObj.currentSprite.worldTransform.ty);
var judgeX = (growObj.currentSprite.worldTransform.tx + growObj.width / 2) >= this.currentSprite.worldTransform.tx && (growObj.currentSprite.worldTransform.tx + growObj.width / 2) <= (this.currentSprite.worldTransform.tx + this.width);
var judgeY = (growObj.currentSprite.worldTransform.ty + growObj.height / 2) >= this.currentSprite.worldTransform.ty && (growObj.currentSprite.worldTransform.ty + growObj.height / 2) <= (this.currentSprite.worldTransform.ty + this.height);
if (judgeX && judgeY) {
landObj = this;
game.vars_.landObj = landObj;
console.log(this.vars_);
return;
}
}, "grou_cropLandItem");
if (landObj) {
if (tabType == 4 && game.vars_.lastSelectObj.vars_.itemId == 122 && landObj.vars_.status == 0) {
current_game.scripts['al_scr_' + "AddTip_1"].call(this, undefined, this, "没用种植不能铲除!");
return;
}
//判断是否是可操作的道具
var isCanOperate = function () {
var miscTable = game.configs.misc[23].value.split("|");
if (miscTable.indexOf(game.vars_.lastSelectObj.vars_.itemId.toString()) > -1) {
return true;
} else {
return false;
}
};
//可种植
if (landObj.vars_.status == 0 && tabType == 5) {
function callBack() {
if (arguments[1]) {
current_game.scripts['al_scr_' + "growOneLand"].call(this, undefined, this, game.vars_.landObj, arguments[2].cellId, arguments[2].seedId);
//原种子数量需要减少1
var lastTextObj = game.vars_.lastSelectObj.objects['txt_cropParkCommon'];
var nowText = Number(lastTextObj.text) - 1;
if (nowText) {
lastTextObj.text = nowText;
} else {
lastTextObj.text = "";
}
game.vars_.lastSelectObj.vars_.num = nowText;
game.vars_.lastSelectObj.dispatchEvent({
"type": "message",
"message": "judgeHSL"
});
//稍后等陈政封装
current_game.scripts['al_scr_' + "RemoveFromBag"].call(this, undefined, this, arguments[2].seedId, 1, 1);
} else {
console.log(arguments[2].code);
game.scripts["al_scr_CodeTips"](null, null, arguments[2].code);
}
game.scripts["al_scr_gameloadDestroy"](null, null);
}
game.scripts["al_scr_gameloadCreate"](null, null);
QyRpc.growPlant(landObj.vars_.itemId, game.vars_.lastSelectObj.vars_.itemId, callBack);
} else if (landObj.vars_.status == 1 && tabType == 4 && isCanOperate) {
//使用道具 施肥或者铲除
useProp();
}
//不可种植提示
var tipSeed = { 3: "此土地已有作物", 2: "土地未解锁,请先解锁", 1: "此土地已有种子" };
tipSeed[landObj.vars_.status] && tabType == 5 && current_game.scripts['al_scr_' + "AddTip_1"].call(this, undefined, this, tipSeed[landObj.vars_.status]);
//不可施肥提示
someTip(landObj.vars_.status, tabType, landObj, game.vars_.lastSelectObj.vars_.itemId);
}
}
function someTip(objStatus, tabType, landObj, objSeedId) {
var tipSeed_铲除 = { 3: "不能铲除!", 0: "请先种植", 2: '土地未解锁,请先解锁' };
var tipSeed_施肥 = { 3: "作物已经成熟,不需要施肥!", 0: "请先种植", 2: '土地未解锁,请先解锁' };
if (objSeedId == 122) {
tipSeed_铲除[landObj.vars_.status] && tabType == 4 && current_game.scripts['al_scr_' + "AddTip_1"].call(this, undefined, this, tipSeed_铲除[landObj.vars_.status]);
} else {
tipSeed_施肥[landObj.vars_.status] && tabType == 4 && current_game.scripts['al_scr_' + "AddTip_1"].call(this, undefined, this, tipSeed_施肥[landObj.vars_.status]);
}
}
function useProp() {
var killPlant = true;
var allData = qyengine['grou_cropParkPanelInstance'].vars_.data[game.vars_.landObj.vars_.itemId];
function propBack() {
if (arguments[1]) {
if (killPlant) {
allData.envirState = -1;
allData.seedId = -1;
allData.state = 0;
allData.time = 0;
} else {
//施肥
for (var i in arguments[2]) {
allData[i] = arguments[2][i];
}
var useItemId = game.vars_.lastSelectObj.vars_.itemId;
var jianShaoTime = game.configs.prop[useItemId].time3 / 3600;
current_game.scripts['al_scr_' + "createCommonHint"].call(this, undefined, this, false, "施肥成功,药草成熟时间\n缩短" + jianShaoTime + "小时");
//稍后等陈政封装
current_game.scripts['al_scr_' + "RemoveFromBag"].call(this, undefined, this, game.vars_.lastSelectObj.vars_.itemId, 1, 1);
}
current_game.scripts['al_scr_' + "initLandInfo"].call(this, undefined, this);
var lastTextObj = game.vars_.lastSelectObj.objects['txt_cropParkCommon'];
var nowText = Number(lastTextObj.text) - 1;
if (nowText) {
lastTextObj.text = nowText;
} else {
lastTextObj.text = "";
}
} else {
console.log(arguments[2].code);
game.scripts["al_scr_CodeTips"](null, null, arguments[2].code);
}
game.scripts["al_scr_gameloadDestroy"](null, null);
}
game.scripts["al_scr_gameloadCreate"](null, null);
if (game.vars_.lastSelectObj.vars_.itemId == 122) {
QyRpc.killPlant(game.vars_.landObj.vars_.itemId, propBack);
} else {
killPlant = false;
var state = allData.state;
QyRpc.applyFertilizer(game.vars_.landObj.vars_.itemId, state, game.vars_.lastSelectObj.vars_.itemId, -1, propBack);
}
}
/**
* commonBuyGoodsSuccess
*/
var key = game.configs.prop[itemId].gatWay.split("|");
function callBack() {
console.log(arguments);
if (arguments[1]) {
//current_game.scripts['al_scr_' + "AddTip_1"].call(this, undefined, this, "购买成功");
game.vars_.playInfoJson.stone = arguments[2].stone;
game.vars_.playInfoJson.gold = arguments[2].gold
game.scripts["al_scr_RefreshPowerGoldStoneText"](null, null);
//InitAwardBg
game.vars_.dropList = [];
var isOwn = !(game.vars_.playInfoJson.seedItem[arguments[2].propId] || game.vars_.playInfoJson.propItem[arguments[2].propId] || game.vars_.playInfoJson.herbItem[arguments[2].propId]);
game.vars_.dropList.push({ 'id': arguments[2].propId, 'type': 1, 'num': arguments[2].num, 'isOwn': isOwn });
game.scripts["al_scr_AddToBag"](null, null, game.vars_.dropList[i]);
game.scripts["al_scr_InitAwardBg"](null, null, game.vars_.dropList, "layer1", 0, false);
//是否在种植界面~
var cropParkArr = qyengine.getInstancesByType("grou_cropParkPanel");
if (cropParkArr.length && cropParkArr[0].isVisible) {
var table = game.configs.prop[arguments[2].propId].type;
var jsonMark = { 4: game.vars_.playInfoJson.propItem, 5: game.vars_.playInfoJson.seedItem };
qyengine.guardId("grou_cropPropType_" + table).dispatchMessage({
"type": "message",
"message": "setSeedTab"
});
var fertilizeInLandPanelArr = qyengine.getInstancesByType("grou_fertilizeInLandPanel");
if (fertilizeInLandPanelArr.length) {
fertilizeInLandPanelArr.dispatchMessage({
"type": "message",
"message": "updateData"
});
}
} else {
current_game.scripts['al_scr_' + "ifBuyGoodPlaySuc"].call(this, undefined, this);
}
} else {
console.log(arguments[2].code);
game.scripts["al_scr_CodeTips"](null, null, arguments[2].code);
}
game.scripts["al_scr_gameloadDestroy"](null, null);
}
game.scripts["al_scr_gameloadCreate"](null, null);
QyRpc.buyProp(itemId, num, callBack);
/**
* grou_fertilizeInLandPanel 的updateData消息
*/
current_game.scripts['al_scr_whenStatusIsOne'].call(this, undefined, this);
/**
* whenStatusIsOne
*/
//先创建黑色的蒙版
qyengine.getInstancesByType("obj_landBlackBg").length == 0 && qyengine.instance_create(510, 640, "obj_landBlackBg", {
"type": "obj_landBlackBg",
"id": "obj_landBlackBg",
"zIndex": grou_cropParkPanel.zIndex + 1,
"layer": "layer0"
});
if (qyengine.getInstancesByType("grou_fertilizeInLandPanel").length == 0) {
var posX = current_scene.width / 2; //- gmx_.grou_fertilizeInLandPanel.defaultOpt.size.width/2 ;
var posY = self.y - gmx_.grou_fertilizeInLandPanel.defaultOpt.size.height;
var resultObj = qyengine.instance_create(posX, posY, "grou_fertilizeInLandPanel", {
"type": "grou_fertilizeInLandPanel",
"id": "grou_fertilizeInLandPanel",
"zIndex": grou_cropParkPanel.zIndex + 1,
"layer": "layer0"
});
resultObj.vars_.touchLandId = self.vars_.itemId;