-
Notifications
You must be signed in to change notification settings - Fork 2
/
apple clicker.pyw
1834 lines (1622 loc) · 91.4 KB
/
apple clicker.pyw
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
"""
苹果点点乐(Apple Clicker)
Copyright (c) 2023 轩哥啊哈OvO
"""
import sys # 导入模块
import time
import random
import pygame
import threading
import cryptocode
import tkinter as tk
import ttkbootstrap as ttk
from win10toast import ToastNotifier
ver: str = 'beta0.8.1' # 版本号
########## 初始化定义 ##########
apple_amount: int = 0 # 苹果数量
apple_amount_total: int = 0
cursor_amount: int = 0 # 建筑数量
basket_amount: int = 0
grandpa_amount: int = 0
tree_amount: int = 0
garden_amount: int = 0
town_amount: int = 0
factory_amount: int = 0
bank_amount: int = 0
wizardtower_amount: int = 0
plane_amount: int = 0
hole_amount: int = 0
timemachine_amount: int = 0
prism_amount: int = 0
python_console_amount: int = 0
building_amount: int = 0 # 建筑总数量
price_cursor: int = 10 # 建筑价格
price_basket: int = 80
price_grandpa: int = 340
price_tree: int = 1500
price_garden: int = 6200
price_town: int = 14000
price_factory: int = 89000
price_bank: int = 304000
price_wizardtower: int = 792000
price_plane: int = 1850000
price_hole: int = 4640000
price_timemachine: int = 27000000
price_prism: int = 315000000
price_python_console: int = 1710000000
value_cursor: float = 0.5 # 建筑每秒提供苹果数量
value_basket: int = 1
value_grandpa: int = 3
value_tree: int = 7
value_garden: int = 15
value_town: int = 30
value_factory: int = 75
value_bank: int = 110
value_wizardtower: int = 150
value_plane: int = 250
value_hole: int = 400
value_timemachine: int = 750
value_prism: int = 900
value_python_console: int = 1200
button_clicked_amount_2: int = 0 # 按钮点击次数
button_clicked_amount_3: int = 0
button_clicked_amount_4: int = 0
button_clicked_amount_5: int = 0
button_clicked_amount_6: int = 0
button_clicked_amount_7: int = 0
button_clicked_amount_8: int = 0
button_clicked_amount_9: int = 0
button_clicked_amount_10: int = 0
button_clicked_amount_11: int = 0
button_clicked_amount_12: int = 0
button_clicked_amount_13: int = 0
button_clicked_amount_14: int = 0
button_clicked_amount_15: int = 0
click_time: int = 0 # 点击总次数
upgrade_price: int = 200000 # 升级价格与次数
upgrade_button_clicked_time: int = 0
level_progress_now: int = 1 # 目前等级
difficulty_add_multiply: float = 1.2 # 难度加乘
level_1: int = 800 # 等级划分
level_2: int = 5000
level_3: int = 12000
level_4: int = 60000
level_5: int = 200000
level_6: int = 900000
level_7: int = 5000000
level_8: int = 18000000
level_9: int = 70000000
level_10: int = 250000000
level_11: int = 900000000
level_12: int = 5500000000
level_13: int = 20000000000
level_14: int = 75000000000
level_15: int = 200000000000
level_16: int = 800000000000
level_17: int = 4000000000000
level_18: int = 60000000000000
level_19: int = 200000000000000
level_20: int = 1000000000000000
achievement_1_on: int = 0 # 成就达到要求
achievement_2_on: int = 0
achievement_3_on: int = 0
achievement_4_on: int = 0
achievement_5_on: int = 0
achievement_6_on: int = 0
achievement_7_on: int = 0
achievement_8_on: int = 0
achievement_9_on: int = 0
achievement_10_on: int = 0
achievement_11_on: int = 0
achievement_12_on: int = 0
achievement_13_on: int = 0
achievement_14_on: int = 0
achievement_15_on: int = 0
achievement_16_on: int = 0
achievement_17_on: int = 0
achievement_18_on: int = 0
achievement_19_on: int = 0
achievement_20_on: int = 0
achievement_21_on: int = 0
achievement_22_on: int = 0
achievement_23_on: int = 0
achievement_24_on: int = 0
achievement_25_on: int = 0
achievement_26_on: int = 0
achievement_27_on: int = 0
achievement_28_on: int = 0
achievement_29_on: int = 0
achievement_30_on: int = 0
achievement_31_on: int = 0
achievement_32_on: int = 0
achievement_33_on: int = 0
achievement_34_on: int = 0
achievement_35_on: int = 0
achievement_36_on: int = 0
achievement_37_on: int = 0
achievement_38_on: int = 0
achievement_39_on: int = 0
achievement_40_on: int = 0
achievement_41_on: int = 0
achievement_42_on: int = 0
achievement_43_on: int = 0
achievement_44_on: int = 0
achievement_45_on: int = 0
achievement_46_on: int = 0
achievement_47_on: int = 0
achievement_48_on: int = 0
achievement_49_on: int = 0
achievement_50_on: int = 0
achievement_51_on: int = 0
achievement_52_on: int = 0
achievement_53_on: int = 0
achievement_54_on: int = 0
achievement_55_on: int = 0
achievement_56_on: int = 0
achievement_57_on: int = 0
achievement_58_on: int = 0
achievement_59_on: int = 0
achievement_60_on: int = 0
achievement_61_on: int = 0
achievement_62_on: int = 0
achievement_63_on: int = 0
achievement_64_on: int = 0
achievement_65_on: int = 0
achievement_66_on: int = 0
achievement_67_on: int = 0
achievement_68_on: int = 0
achievement_69_on: int = 0
achievement_70_on: int = 0
achievement_71_on: int = 0
achievement_72_on: int = 0
achievement_73_on: int = 0
achievement_74_on: int = 0
achievement_75_on: int = 0
achievement_76_on: int = 0
achievement_77_on: int = 0
achievement_78_on: int = 0
achievement_79_on: int = 0
achievement_80_on: int = 0
achievement_81_on: int = 0
achievement_82_on: int = 0
achievement_83_on: int = 0
achievement_84_on: int = 0
achievement_85_on: int = 0
achievement_1_get: int = 0 # 成就获得
achievement_2_get: int = 0
achievement_3_get: int = 0
achievement_4_get: int = 0
achievement_5_get: int = 0
achievement_6_get: int = 0
achievement_7_get: int = 0
achievement_8_get: int = 0
achievement_9_get: int = 0
achievement_10_get: int = 0
achievement_11_get: int = 0
achievement_12_get: int = 0
achievement_13_get: int = 0
achievement_14_get: int = 0
achievement_15_get: int = 0
achievement_16_get: int = 0
achievement_17_get: int = 0
achievement_18_get: int = 0
achievement_19_get: int = 0
achievement_20_get: int = 0
achievement_21_get: int = 0
achievement_22_get: int = 0
achievement_23_get: int = 0
achievement_24_get: int = 0
achievement_25_get: int = 0
achievement_26_get: int = 0
achievement_27_get: int = 0
achievement_28_get: int = 0
achievement_29_get: int = 0
achievement_30_get: int = 0
achievement_31_get: int = 0
achievement_32_get: int = 0
achievement_33_get: int = 0
achievement_34_get: int = 0
achievement_35_get: int = 0
achievement_36_get: int = 0
achievement_37_get: int = 0
achievement_38_get: int = 0
achievement_39_get: int = 0
achievement_40_get: int = 0
achievement_41_get: int = 0
achievement_42_get: int = 0
achievement_43_get: int = 0
achievement_44_get: int = 0
achievement_45_get: int = 0
achievement_46_get: int = 0
achievement_47_get: int = 0
achievement_48_get: int = 0
achievement_49_get: int = 0
achievement_50_get: int = 0
achievement_51_get: int = 0
achievement_52_get: int = 0
achievement_53_get: int = 0
achievement_54_get: int = 0
achievement_55_get: int = 0
achievement_56_get: int = 0
achievement_57_get: int = 0
achievement_58_get: int = 0
achievement_59_get: int = 0
achievement_60_get: int = 0
achievement_61_get: int = 0
achievement_62_get: int = 0
achievement_63_get: int = 0
achievement_64_get: int = 0
achievement_65_get: int = 0
achievement_66_get: int = 0
achievement_67_get: int = 0
achievement_68_get: int = 0
achievement_69_get: int = 0
achievement_70_get: int = 0
achievement_71_get: int = 0
achievement_72_get: int = 0
achievement_73_get: int = 0
achievement_74_get: int = 0
achievement_75_get: int = 0
achievement_76_get: int = 0
achievement_77_get: int = 0
achievement_78_get: int = 0
achievement_79_get: int = 0
achievement_80_get: int = 0
achievement_81_get: int = 0
achievement_82_get: int = 0
achievement_83_get: int = 0
achievement_84_get: int = 0
achievement_85_get: int = 0
music_on: int = 1 # 音效开启
recursion_time: int = 300 # 递归时间
news_all = ['你想种苹果,但没人捧\n场。', # 新闻
'你种的第一批苹果被扔\n进了垃圾堆。附近的浣\n熊都避而远之。',
'你的家人打算试尝一下\n你种的苹果。',
'你的苹果已经在邻里之\n间小有名气。',
'大家津津乐道于你的苹\n果。',
'方圆几里内的人都在讨\n论你的苹果。',
'你的苹果在整个镇上都\n有了名气!',
'孩子们都被你的苹果吸\n引了过来。',
'新闻: 男子抢劫银行,\n只为买苹果。',
'你的苹果卖出了很多钱。',
'你的苹果有了自己的专\n题网站。',
'“我们是优秀的老爷爷。\n”——老爷爷',
'“乖来亲爷爷一下。”——\n老爷爷',
'新闻:科学家说化石记\n录表明寒武纪大爆发时\n有苹果基的生物。',
'一家本地电视台对你的\n苹果进行了长达10分钟\n的新闻报导。你是成功人士了!\n(成功奖励是:一只苹果。)',
'新闻: 转基因苹果引发\n果农罢工!',
'新闻: 苹果工厂与全球\n变暖有关!',
'你的苹果已经畅销海外。\n',
'“有空给我打电话...”——\n老爷爷',
'人们跋山涉水只为品尝\n你的苹果。',
'新闻:苹果工厂罢工——\n工人们要求未来不再使\n用苹果做薪资!',
'新闻:专家称放养型农\n场苹果在小孩子们中流\n行。',
'新闻:全苹果菜谱的餐\n厅在市区开张。菜式包\n括红烧苹果、清蒸苹果、\n油炸苹果和苹果片。',
'新闻:小镇陷入苹果短\n缺,居民被迫吃梨,市\n长承认“还是不太一样”。',
'新闻:电影因缺少演员\n而被迫取消,导演哀痛\n表示 “每个人都待在家\n狂吃苹果”。',
'“扭曲吧” ——老爷爷',
'国王们都喜欢上你的苹\n果了。',
'“我们会再次升起。” \n——老爷爷',
'“荒芜吧” ——老爷爷',
'新闻:时光机被用于非\n法时间旅行!',
'新闻:“不得不说,苹果\n这东西确实有点不详” \n某些迷糊的白痴如此表示。',
'“仅仅是一个挫折。” ——\n老爷爷',
'“侵蚀吧” ——老爷爷',
'现在有专门为你的苹果\n而开设的博物馆了。',
'新闻:太空旅游业的蓬\n勃发展为遥远的行星吸引\n了更多无聊的百万富翁! ',
'“痛苦吧” ——老爷爷',
'国际上为你的苹果设立\n了一个纪念日。',
'新闻:喜剧演员因不相\n关的消化不良而被迫取消\n苹果常规。',
'“我们没有饱足感。” ——\n老爷爷',
'新闻:在遥远的星球上\n发现苹果基生物!',
'“太晚了。” ——老爷爷',
'新闻:在遥远的星球上\n发现古代的水果文物。”骇\n人听闻的暗示。“科\n学家指出。',
'新闻:发现新的苹果星\n球,成为苹果贸易飞船的\n目标!',
'新闻:研究指出工厂制\n造的苹果将导致过胖。',
'新闻:时光机被卷入全\n城范围内的灾难!',
'你的苹果被认证为世界\n第八大奇迹。',
'新闻:苹果农场涉嫌雇\n佣身份不明的老年劳工!',
'中央决定对你的苹果产\n业进行监控。',
'新闻:研究指出苹果世\n界传送门会引发快速衰老和\n沉迷于烘焙。',
'新闻:国民对传送门中\n钻出的奇怪生物表示担忧!',
'宇宙中的上古神明为了\n尝你的苹果而苏醒。',
'新闻:大量苹果星球被\n发现有99.8%的正品苹果\n核心!',
'新闻:新苹果宗教横扫\n全国。',
'新闻:外国政治家卷入\n苹果走私丑闻',
'新闻:时光机被用于改\n写历史的阴谋!真的吗?',
'异次元生物跨越维度来\n品尝你的苹果。',
'宇宙间所有分子都以苹\n果的形式存在。',
'“你本来可以制止这一切\n的。”——老爷爷',
'新闻:科学家说化石记\n录表明寒武纪大爆发时有\n苹果基的生物。',
'你的苹果已经享誉全球。',
'外星生物盼望能尝到你\n的苹果。',
'你的苹果开始拥有了感\n知。',
'新闻:“我看过了未来,”\n时间机器驾驶员说,“我\n再也不想去那了。”',
'史册上添加了一整章来\n介绍你的苹果。',
'新闻:从过去带回来的\n苹果"不适合人类消费",\n历史学家说。',
'新闻:神秘的非法苹果\n被缴获,警方表示“味道\n太糟了”。',
'你的苹果重建了宇宙规\n则。',
'“不久就该结束了。”——\n老爷爷',
'新闻: "宇宙中的循环\n太多了," 研究者说:\n"只有苹果才能解决问题。"',
'新闻:科学家预言与苹\n果相关的世界末日即将\n到来,成为茶余饭后的笑料。',
'应该放下游戏了。']
information: str = "欢迎来到 苹果点点乐©! 作者/版权: 轩哥啊哈OvO" # 初始信息
########## 声音系统 ##########
def achievement_get_sound(): # 获得成就声音
if music_on == 1:
pygame.mixer.init()
pygame.mixer.music.load(r"./sound/Random_levelup.wav")
pygame.mixer.music.play()
def click_sound(): # 按钮点击声音
if music_on == 1:
pygame.mixer.init()
pygame.mixer.music.load(r"./sound/click.wav")
pygame.mixer.music.play()
def pick_apple(): # 获得苹果声音
global sound_filepath
if music_on == 1:
sound_play = random.randint(1, 8)
if sound_play == 1:
sound_filepath = r"./sound/climb1.wav"
elif sound_play == 2:
sound_filepath = r"./sound/climb2.wav"
elif sound_play == 3:
sound_filepath = r"./sound/climb3.wav"
elif sound_play == 4:
sound_filepath = r"./sound/climb4.wav"
elif sound_play == 5:
sound_filepath = r"./sound/climb5.wav"
elif sound_play == 6:
sound_filepath = r"./sound/break2.wav"
elif sound_play == 7:
sound_filepath = r"./sound/break3.wav"
elif sound_play == 8:
sound_filepath = r"./sound/break4.wav"
pygame.mixer.init()
pygame.mixer.music.load(sound_filepath)
pygame.mixer.music.play()
def successful_bought_sound(): # 成功购买建筑声音
if music_on == 1:
pygame.mixer.init()
pygame.mixer.music.load(r"sound/Successful_Hit.wav")
pygame.mixer.music.play()
def unsuccessful_bought_sound(): # 未成功购买建筑声音
if music_on == 1:
global sound_filepath
unsuccessful_bought_sound_num = random.randint(1, 3)
if unsuccessful_bought_sound_num == 1:
sound_filepath = r"./sound/Villager_no1.wav"
elif unsuccessful_bought_sound_num == 2:
sound_filepath = r"./sound/Villager_no2.wav"
elif unsuccessful_bought_sound_num == 3:
sound_filepath = r"./sound/Villager_no3.wav"
pygame.mixer.init()
pygame.mixer.music.load(sound_filepath)
pygame.mixer.music.play()
########## 内部用法 ##########
def get_news():
news = []
if apple_amount_total == 0:
for news_num in range(0, 1): news.append(news_all[news_num])
elif apple_amount_total < 30:
for news_num in range(1, 3): news.append(news_all[news_num])
elif apple_amount_total < 100:
for news_num in range(1, 4): news.append(news_all[news_num])
elif apple_amount_total < 300:
for news_num in range(1, 6): news.append(news_all[news_num])
elif apple_amount_total < 700:
for news_num in range(6, 8): news.append(news_all[news_num])
elif apple_amount_total < 1500:
for news_num in range(6, 10): news.append(news_all[news_num])
elif apple_amount_total < 3000:
for news_num in range(6, 12): news.append(news_all[news_num])
elif apple_amount_total < 5000:
for news_num in range(13, 30): news.append(news_all[news_num])
elif apple_amount_total < 8000:
for news_num in range(13, 35): news.append(news_all[news_num])
elif apple_amount_total < 10000:
for news_num in range(13, 40): news.append(news_all[news_num])
elif apple_amount_total < 30000:
for news_num in range(13, 45): news.append(news_all[news_num])
elif apple_amount_total < 50000:
for news_num in range(13, 50): news.append(news_all[news_num])
elif apple_amount_total < 80000:
for news_num in range(13, 55): news.append(news_all[news_num])
elif apple_amount_total < 100000:
for news_num in range(13, 60): news.append(news_all[news_num])
elif apple_amount_total < 500000:
for news_num in range(13, 65): news.append(news_all[news_num])
elif apple_amount_total < 1000000:
for news_num in range(13, 70): news.append(news_all[news_num])
return news
########## 按钮点击运算 ##########
def click_button_clicked(): # 苹果按钮点击运算
global apple_amount, apple_amount_total, click_time
pick_apple()
apple_amount += add_per_click
apple_amount_total += add_per_click
click_time += 1
def cursor_button_clicked(): # 建筑购买运算
global apple_amount, price_cursor, cursor_amount, information, button_clicked_amount_2
if (apple_amount - price_cursor) < 0:
information = "没有足够的苹果。你需要至少 " + str(price_cursor) + " 个苹果 以购买 鼠标指针。"
unsuccessful_bought_sound()
else:
information = "你购买了 1 个 鼠标指针。"
successful_bought_sound()
apple_amount -= price_cursor
button_clicked_amount_2 += 1
price_cursor += button_clicked_amount_2
cursor_amount += 1
def basket_button_clicked():
global apple_amount, price_basket, basket_amount, information, button_clicked_amount_3
if (apple_amount - price_basket) < 0:
information = "没有足够的苹果。你需要至少 " + str(price_basket) + " 个苹果 以购买 果篮。"
unsuccessful_bought_sound()
else:
information = "你购买了 1 个 果篮。"
successful_bought_sound()
apple_amount -= price_basket
button_clicked_amount_3 += 1
price_basket += button_clicked_amount_3 * 2
basket_amount += 1
def grandpa_button_clicked():
global apple_amount, price_grandpa, grandpa_amount, information, button_clicked_amount_4
if (apple_amount - price_grandpa) < 0:
information = "没有足够的苹果。你需要至少 " + str(price_grandpa) + " 个苹果 以购买 老爷爷。"
unsuccessful_bought_sound()
else:
information = "你购买了 1 个 老爷爷。"
successful_bought_sound()
apple_amount -= price_grandpa
button_clicked_amount_4 += 1
price_grandpa += button_clicked_amount_4 * 3
grandpa_amount += 1
def tree_button_clicked():
global apple_amount, price_tree, tree_amount, information, button_clicked_amount_5
if (apple_amount - price_tree) < 0:
information = "没有足够的苹果。你需要至少 " + str(price_tree) + " 个苹果 以购买 苹果树。"
unsuccessful_bought_sound()
else:
information = "你购买了 1 个 苹果树。"
successful_bought_sound()
apple_amount -= price_tree
button_clicked_amount_5 += 1
price_tree += button_clicked_amount_5 * 4
tree_amount += 1
def garden_button_clicked():
global apple_amount, price_garden, garden_amount, information, button_clicked_amount_6
if (apple_amount - price_garden) < 0:
information = "没有足够的苹果。你需要至少 " + str(price_garden) + " 个苹果 以购买 果园。"
unsuccessful_bought_sound()
else:
information = "你购买了 1 个 果园。"
successful_bought_sound()
apple_amount -= price_garden
button_clicked_amount_6 += 1
price_garden += button_clicked_amount_6 * 5
garden_amount += 1
def town_button_clicked():
global apple_amount, price_town, town_amount, information, button_clicked_amount_7
if (apple_amount - price_town) < 0:
information = "没有足够的苹果。你需要至少 " + str(price_town) + " 个苹果 以购买 水果镇。"
unsuccessful_bought_sound()
else:
information = "你购买了 1 个 水果镇。"
successful_bought_sound()
apple_amount -= price_town
button_clicked_amount_7 += 1
price_town += button_clicked_amount_7 * 6
town_amount += 1
def factory_button_clicked():
global apple_amount, price_factory, factory_amount, information, button_clicked_amount_8
if (apple_amount - price_factory) < 0:
information = "没有足够的苹果。你需要至少 " + str(price_factory) + " 个苹果 以购买 苹果工厂。"
unsuccessful_bought_sound()
else:
information = "你购买了 1 个 苹果工厂。"
successful_bought_sound()
apple_amount -= price_factory
button_clicked_amount_8 += 1
price_factory += button_clicked_amount_8 * 7
factory_amount += 1
def bank_button_clicked():
global apple_amount, price_bank, bank_amount, information, button_clicked_amount_9
if (apple_amount - price_bank) < 0:
information = "没有足够的苹果。你需要至少 " + str(price_bank) + " 个苹果 以购买 水果银行。"
unsuccessful_bought_sound()
else:
information = "你购买了 1 个 水果银行。"
successful_bought_sound()
apple_amount -= price_bank
button_clicked_amount_9 += 1
price_bank += button_clicked_amount_9 * 8
bank_amount += 1
def wizardtower_button_clicked():
global apple_amount, price_wizardtower, wizardtower_amount, information, button_clicked_amount_10
if (apple_amount - price_wizardtower) < 0:
information = "没有足够的苹果。你需要至少 " + str(price_wizardtower) + " 个苹果 以购买 魔法巫师塔。"
unsuccessful_bought_sound()
else:
information = "你购买了 1 个 魔法巫师塔。"
successful_bought_sound()
apple_amount -= price_wizardtower
button_clicked_amount_10 += 1
price_wizardtower += button_clicked_amount_10 * 9
wizardtower_amount += 1
def plane_button_clicked():
global apple_amount, price_plane, plane_amount, information, button_clicked_amount_11
if (apple_amount - price_plane) < 0:
information = "没有足够的苹果。你需要至少 " + str(price_plane) + " 个苹果 以购买 宇宙飞船。"
unsuccessful_bought_sound()
else:
information = "你购买了 1 个 宇宙飞船。"
successful_bought_sound()
apple_amount -= price_plane
button_clicked_amount_11 += 1
price_plane += button_clicked_amount_11 * 10
plane_amount += 1
def hole_button_clicked():
global apple_amount, price_hole, hole_amount, information, button_clicked_amount_12
if (apple_amount - price_hole) < 0:
information = "没有足够的苹果。你需要至少 " + str(price_hole) + " 个苹果 以购买 虫洞。"
unsuccessful_bought_sound()
else:
information = "你购买了 1 个 虫洞。"
successful_bought_sound()
apple_amount -= price_hole
button_clicked_amount_12 += 1
price_hole += button_clicked_amount_12 * 11
hole_amount += 1
def timemachine_button_clicked():
global apple_amount, price_timemachine, timemachine_amount, information, button_clicked_amount_13
if (apple_amount - price_timemachine) < 0:
information = "没有足够的苹果。你需要至少 " + str(price_timemachine) + " 个苹果 以购买 时光机。"
unsuccessful_bought_sound()
else:
information = "你购买了 1 个 时光机。"
successful_bought_sound()
apple_amount -= price_timemachine
button_clicked_amount_13 += 1
price_timemachine += button_clicked_amount_13 * 12
timemachine_amount += 1
def prism_button_clicked():
global apple_amount, price_prism, prism_amount, information, button_clicked_amount_14
if (apple_amount - price_prism) < 0:
information = "没有足够的苹果。你需要至少 " + str(price_prism) + " 个苹果 以购买 三棱镜。"
unsuccessful_bought_sound()
else:
information = "你购买了 1 个 三棱镜。"
successful_bought_sound()
apple_amount -= price_prism
button_clicked_amount_14 += 1
price_prism += button_clicked_amount_14 * 13
prism_amount += 1
def python_console_button_clicked():
global apple_amount, price_python_console, python_console_amount, information, button_clicked_amount_15
if (apple_amount - price_python_console) < 0:
information = "没有足够的苹果。你需要至少 " + str(price_python_console) + " 个苹果 以购买 Python 控制台。"
unsuccessful_bought_sound()
else:
information = "你购买了 1 个 Python 控制台。"
successful_bought_sound()
apple_amount -= price_python_console
button_clicked_amount_15 += 1
price_python_console += button_clicked_amount_15 * 14
python_console_amount += 1
def upgrade_button_clicked(): # 升级运算
global apple_amount, information, upgrade_button_clicked_time
if (apple_amount - upgrade_price) < 0:
unsuccessful_bought_sound()
information = "没有足够的苹果。你需要至少 " + str(int(upgrade_price)) + " 个苹果以升级。"
else:
successful_bought_sound()
apple_amount -= upgrade_price
upgrade_button_clicked_time += 1
information = "你升级至了 Level " + str(upgrade_button_clicked_time + 1) + "!"
def refresh_newspaper(): # 报纸刷新
global newspaper
newspaper['text'] = "报纸\n\n" + get_news()[random.randint(0, len(get_news()) - 1)]
########## 递归显示运算 ##########
def apple_amount_entry_update(): # 左侧信息栏显示递归
global apple_amount, add_per_click, auto_add_per_second
apple_amount_entry.delete(0, "end")
apple_amount_entry.insert(0, str(apple_amount))
apple_per_click_entry.delete(0, "end")
apple_per_click_entry.insert(0, ("+ " + str(add_per_click) + " / click"))
apple_per_second_entry.delete(0, "end")
apple_per_second_entry.insert(0, ("+ " + str(auto_add_per_second) + " / s"))
apple_amount_entry.after(100, apple_amount_entry_update)
def entry_information_number_upgrade(): # 信息网格显示递归
global cursor_amount, basket_amount, grandpa_amount, tree_amount, garden_amount
global town_amount, factory_amount, bank_amount, wizardtower_amount, plane_amount
global hole_amount, timemachine_amount, prism_amount, python_console_amount
entry_information_number_23.delete(0, "end")
entry_information_number_23.insert(0, str(cursor_amount))
entry_information_number_33.delete(0, "end")
entry_information_number_33.insert(0, str(basket_amount))
entry_information_number_43.delete(0, "end")
entry_information_number_43.insert(0, str(grandpa_amount))
entry_information_number_53.delete(0, "end")
entry_information_number_53.insert(0, str(tree_amount))
entry_information_number_63.delete(0, "end")
entry_information_number_63.insert(0, str(garden_amount))
entry_information_number_73.delete(0, "end")
entry_information_number_73.insert(0, str(town_amount))
entry_information_number_83.delete(0, "end")
entry_information_number_83.insert(0, str(factory_amount))
entry_information_number_93.delete(0, "end")
entry_information_number_93.insert(0, str(bank_amount))
entry_information_number_103.delete(0, "end")
entry_information_number_103.insert(0, str(wizardtower_amount))
entry_information_number_113.delete(0, "end")
entry_information_number_113.insert(0, str(plane_amount))
entry_information_number_123.delete(0, "end")
entry_information_number_123.insert(0, str(hole_amount))
entry_information_number_133.delete(0, "end")
entry_information_number_133.insert(0, str(timemachine_amount))
entry_information_number_143.delete(0, "end")
entry_information_number_143.insert(0, str(prism_amount))
entry_information_number_153.delete(0, "end")
entry_information_number_153.insert(0, str(python_console_amount))
global price_cursor, price_basket, price_grandpa, price_tree, price_garden
global price_town, price_factory, price_bank, price_wizardtower, price_plane
global price_hole, price_timemachine, price_prism, price_python_console
entry_information_number_24.delete(0, "end")
entry_information_number_24.insert(0, str(price_cursor))
entry_information_number_34.delete(0, "end")
entry_information_number_34.insert(0, str(price_basket))
entry_information_number_44.delete(0, "end")
entry_information_number_44.insert(0, str(price_grandpa))
entry_information_number_54.delete(0, "end")
entry_information_number_54.insert(0, str(price_tree))
entry_information_number_64.delete(0, "end")
entry_information_number_64.insert(0, str(price_garden))
entry_information_number_74.delete(0, "end")
entry_information_number_74.insert(0, str(price_town))
entry_information_number_84.delete(0, "end")
entry_information_number_84.insert(0, str(price_factory))
entry_information_number_94.delete(0, "end")
entry_information_number_94.insert(0, str(price_bank))
entry_information_number_104.delete(0, "end")
entry_information_number_104.insert(0, str(price_wizardtower))
entry_information_number_114.delete(0, "end")
entry_information_number_114.insert(0, str(price_plane))
entry_information_number_124.delete(0, "end")
entry_information_number_124.insert(0, str(price_hole))
entry_information_number_134.delete(0, "end")
entry_information_number_134.insert(0, str(price_timemachine))
entry_information_number_144.delete(0, "end")
entry_information_number_144.insert(0, str(price_prism))
entry_information_number_154.delete(0, "end")
entry_information_number_154.insert(0, str(price_python_console))
global value_cursor, value_basket, value_grandpa, value_tree, value_garden
global value_hole, value_timemachine, value_prism, value_python_console
global value_town, value_factory, value_bank, value_wizardtower, value_plane
entry_information_number_30.delete(0, "end")
entry_information_number_30.insert(0, ("+" + str(value_cursor * cursor_amount)) + " / s")
entry_information_number_35.delete(0, "end")
entry_information_number_35.insert(0, ("+" + str(value_basket * basket_amount)) + " / s")
entry_information_number_45.delete(0, "end")
entry_information_number_45.insert(0, ("+" + str(value_grandpa * grandpa_amount)) + " / s")
entry_information_number_55.delete(0, "end")
entry_information_number_55.insert(0, ("+" + str(value_tree * tree_amount)) + " / s")
entry_information_number_65.delete(0, "end")
entry_information_number_65.insert(0, ("+" + str(value_garden * garden_amount)) + " / s")
entry_information_number_75.delete(0, "end")
entry_information_number_75.insert(0, ("+" + str(value_town * town_amount)) + " / s")
entry_information_number_85.delete(0, "end")
entry_information_number_85.insert(0, ("+" + str(value_factory * factory_amount)) + " / s")
entry_information_number_95.delete(0, "end")
entry_information_number_95.insert(0, ("+" + str(value_bank * bank_amount)) + " / s")
entry_information_number_105.delete(0, "end")
entry_information_number_105.insert(0, ("+" + str(value_wizardtower * wizardtower_amount)) + " / s")
entry_information_number_115.delete(0, "end")
entry_information_number_115.insert(0, ("+" + str(value_plane * plane_amount)) + " / s")
entry_information_number_130.delete(0, "end")
entry_information_number_130.insert(0, ("+" + str(value_hole * hole_amount)) + " / s")
entry_information_number_135.delete(0, "end")
entry_information_number_135.insert(0, ("+" + str(value_timemachine * timemachine_amount)) + " / s")
entry_information_number_145.delete(0, "end")
entry_information_number_145.insert(0, ("+" + str(value_prism * prism_amount)) + " / s")
entry_information_number_155.delete(0, "end")
entry_information_number_155.insert(0, ("+" + str(value_python_console * python_console_amount)) + " / s")
entry_information_number_155.after(recursion_time, entry_information_number_upgrade)
def entry_information_information_upgrade(): # 信息栏显示递归
entry_information_information.delete(0, "end")
entry_information_information.insert(0, information)
entry_information_information.after(recursion_time, entry_information_information_upgrade)
def statistics_text_upgrade(): # 统计信息显示递归
statistics_text.delete(1.0, tk.END)
statistics_text.insert("insert", ("现在的苹果数量:" + str(apple_amount) +
"\n总苹果数量:" + str(apple_amount_total) +
"\n总建筑数量:" + str(building_amount) +
"\n点击次数:" + str(click_time)))
statistics_text.after(recursion_time, statistics_text_upgrade)
def upgrade_button_entry_update(): # 升级显示递归
upgrade_button_entry.delete(0, "end")
upgrade_button_entry.insert(0, "Level " + str(upgrade_button_clicked_time + 1) + " 至 Level " + str(upgrade_button_clicked_time + 2))
upgrade_button_entry_price.delete(0, "end")
upgrade_button_entry_price.insert(0, "价格:" + str(int(upgrade_price)))
upgrade_button_entry.after(recursion_time, upgrade_button_entry_update)
def achievement_progress_update(): # 成就进度条显示递归
achievement_get_num = (achievement_1_get + achievement_2_get + achievement_3_get + achievement_4_get + achievement_5_get +
achievement_6_get + achievement_7_get + achievement_8_get + achievement_9_get + achievement_10_get +
achievement_11_get + achievement_12_get + achievement_13_get + achievement_14_get + achievement_15_get +
achievement_16_get + achievement_17_get + achievement_18_get + achievement_19_get + achievement_20_get +
achievement_21_get + achievement_22_get + achievement_23_get + achievement_24_get + achievement_25_get +
achievement_26_get + achievement_27_get + achievement_28_get + achievement_29_get + achievement_30_get +
achievement_31_get + achievement_32_get + achievement_33_get + achievement_34_get + achievement_35_get +
achievement_36_get + achievement_37_get + achievement_38_get + achievement_39_get + achievement_40_get +
achievement_41_get + achievement_42_get + achievement_43_get + achievement_44_get + achievement_45_get +
achievement_46_get + achievement_47_get + achievement_48_get + achievement_49_get + achievement_50_get +
achievement_51_get + achievement_52_get + achievement_53_get + achievement_54_get + achievement_55_get +
achievement_56_get + achievement_57_get + achievement_58_get + achievement_59_get + achievement_60_get +
achievement_61_get + achievement_62_get + achievement_63_get + achievement_64_get + achievement_65_get +
achievement_66_get + achievement_67_get + achievement_68_get + achievement_69_get + achievement_70_get +
achievement_71_get + achievement_72_get + achievement_73_get + achievement_74_get + achievement_75_get +
achievement_76_get + achievement_77_get + achievement_78_get + achievement_79_get + achievement_80_get +
achievement_81_get + achievement_82_get + achievement_83_get + achievement_84_get + achievement_85_get)
achievement_progress_bar['value'] = achievement_get_num
achievement_progress_entry.delete(0, "end")
achievement_progress_entry.insert(0, str(achievement_get_num) + "/" + str(achievement_num_all))
achievement_progress_entry.after(recursion_time, achievement_progress_update)
def time_entry_update(): # 时间显示递归
time_entry.delete(0, "end")
time_entry.insert(0, time.asctime(time.localtime(time.time())))
time_entry.after(300, time_entry_update)
def level_progress_bar_update(): # 等级进度条显示递归
if level_progress_now == 1:
level_progress_bar['maximum'] = level_1; level_progress_bar['value'] = apple_amount_total
elif level_progress_now == 2:
level_progress_bar['maximum'] = level_2 - level_1; level_progress_bar['value'] = apple_amount_total - level_1
elif level_progress_now == 3:
level_progress_bar['maximum'] = level_3 - level_2; level_progress_bar['value'] = apple_amount_total - level_2
elif level_progress_now == 4:
level_progress_bar['maximum'] = level_4 - level_3; level_progress_bar['value'] = apple_amount_total - level_3
elif level_progress_now == 5:
level_progress_bar['maximum'] = level_5 - level_4; level_progress_bar['value'] = apple_amount_total - level_4
elif level_progress_now == 6:
level_progress_bar['maximum'] = level_6 - level_5; level_progress_bar['value'] = apple_amount_total - level_5
elif level_progress_now == 7:
level_progress_bar['maximum'] = level_7 - level_6; level_progress_bar['value'] = apple_amount_total - level_6
elif level_progress_now == 8:
level_progress_bar['maximum'] = level_8 - level_7; level_progress_bar['value'] = apple_amount_total - level_7
elif level_progress_now == 9:
level_progress_bar['maximum'] = level_9 - level_8; level_progress_bar['value'] = apple_amount_total - level_8
elif level_progress_now == 10:
level_progress_bar['maximum'] = level_10 - level_9; level_progress_bar['value'] = apple_amount_total - level_9
elif level_progress_now == 11:
level_progress_bar['maximum'] = level_11 - level_10; level_progress_bar['value'] = apple_amount_total - level_10
elif level_progress_now == 12:
level_progress_bar['maximum'] = level_12 - level_11; level_progress_bar['value'] = apple_amount_total - level_11
elif level_progress_now == 13:
level_progress_bar['maximum'] = level_13 - level_12; level_progress_bar['value'] = apple_amount_total - level_12
elif level_progress_now == 14:
level_progress_bar['maximum'] = level_14 - level_13; level_progress_bar['value'] = apple_amount_total - level_13
elif level_progress_now == 15:
level_progress_bar['maximum'] = level_15 - level_14; level_progress_bar['value'] = apple_amount_total - level_14
elif level_progress_now == 16:
level_progress_bar['maximum'] = level_16 - level_15; level_progress_bar['value'] = apple_amount_total - level_15
elif level_progress_now == 17:
level_progress_bar['maximum'] = level_17 - level_16; level_progress_bar['value'] = apple_amount_total - level_16
elif level_progress_now == 18:
level_progress_bar['maximum'] = level_18 - level_17; level_progress_bar['value'] = apple_amount_total - level_17
elif level_progress_now == 19:
level_progress_bar['maximum'] = level_19 - level_18; level_progress_bar['value'] = apple_amount_total - level_18
elif level_progress_now == 20:
level_progress_bar['maximum'] = level_20 - level_19; level_progress_bar['value'] = apple_amount_total - level_19
level_progress_label_left.delete(0, "end")
level_progress_label_left.insert(0, "Level " + str(level_progress_now))
level_progress_label_right.delete(0, "end")
level_progress_label_right.insert(0, "Level " + str(level_progress_now + 1))
level_progress_bar.after(recursion_time, level_progress_bar_update)
########## 逻辑运算线程 ##########
def main_operation_logic(): # 主要运算逻辑线程
global apple_amount, apple_amount_total, building_amount, auto_add_per_second, add_per_click
while True:
auto_add_per_second = int(((cursor_amount * value_cursor) +
(basket_amount * value_basket) +
(grandpa_amount * value_grandpa) +
(tree_amount * value_tree) +
(garden_amount * value_garden) +
(town_amount * value_town) +
(factory_amount * value_factory) +
(bank_amount * value_bank) +
(wizardtower_amount * value_wizardtower) +
(plane_amount * value_plane) +
(hole_amount * value_hole) +
(timemachine_amount * value_timemachine) +
(prism_amount * value_prism) +
(python_console_amount * value_python_console)) * pow(1.03, upgrade_button_clicked_time + 1))
apple_amount += auto_add_per_second
apple_amount_total += auto_add_per_second
add_per_click = int((cursor_amount * 0.5) +
(basket_amount * 0.5) +
(grandpa_amount * 0.5) +
(tree_amount * 1) +
(garden_amount * 1) +
(town_amount * 1.5) +
(factory_amount * 1.5) +
(bank_amount * 2) +
(wizardtower_amount * 2) +
(plane_amount * 2.5) +
(hole_amount * 2.5) +
(timemachine_amount * 3) +
(prism_amount * 4) +
(python_console_amount * 5))
if add_per_click == 0: add_per_click = 1
building_amount = (cursor_amount + basket_amount + grandpa_amount + tree_amount + garden_amount +
town_amount + factory_amount + bank_amount + wizardtower_amount +
plane_amount + hole_amount + timemachine_amount + prism_amount + python_console_amount)
time.sleep(1)
def upgrade_price_logic(): # 升级价格逻辑线程
global upgrade_price
while True:
upgrade_price = int(200000 * pow(1.2, upgrade_button_clicked_time))
time.sleep(1)
def progress_bar_logic(): # 进度条逻辑线程
global level_progress_now
while True:
if apple_amount_total < level_1:
level_progress_now = 1
elif apple_amount_total < level_2:
level_progress_now = 2
elif apple_amount_total < level_3:
level_progress_now = 3
elif apple_amount_total < level_4:
level_progress_now = 4
elif apple_amount_total < level_5:
level_progress_now = 5
elif apple_amount_total < level_6:
level_progress_now = 6
elif apple_amount_total < level_7:
level_progress_now = 7
elif apple_amount_total < level_8:
level_progress_now = 8
elif apple_amount_total < level_9:
level_progress_now = 9
elif apple_amount_total < level_10:
level_progress_now = 10
elif apple_amount_total < level_11:
level_progress_now = 11
elif apple_amount_total < level_12:
level_progress_now = 12
elif apple_amount_total < level_13:
level_progress_now = 13
elif apple_amount_total < level_14:
level_progress_now = 14
elif apple_amount_total < level_15:
level_progress_now = 15
elif apple_amount_total < level_16:
level_progress_now = 16
elif apple_amount_total < level_17:
level_progress_now = 17
elif apple_amount_total < level_18:
level_progress_now = 18
elif apple_amount_total < level_19:
level_progress_now = 19
elif apple_amount_total < level_20:
level_progress_now = 20
else:
level_progress_now = 21
time.sleep(1)
def achievement_logic(): # 成就逻辑线程
global information
global achievement_1_get, achievement_2_get, achievement_3_get, achievement_4_get, achievement_5_get
global achievement_6_get, achievement_7_get, achievement_8_get, achievement_9_get, achievement_10_get
global achievement_11_get, achievement_12_get, achievement_13_get, achievement_14_get, achievement_15_get
global achievement_16_get, achievement_17_get, achievement_18_get, achievement_19_get, achievement_20_get
global achievement_21_get, achievement_22_get, achievement_23_get, achievement_24_get, achievement_25_get
global achievement_26_get, achievement_27_get, achievement_28_get, achievement_29_get, achievement_30_get
global achievement_31_get, achievement_32_get, achievement_33_get, achievement_34_get, achievement_35_get
global achievement_36_get, achievement_37_get, achievement_38_get, achievement_39_get, achievement_40_get
global achievement_41_get, achievement_42_get, achievement_43_get, achievement_44_get, achievement_45_get
global achievement_46_get, achievement_47_get, achievement_48_get, achievement_49_get, achievement_50_get
global achievement_51_get, achievement_52_get, achievement_53_get, achievement_54_get, achievement_55_get
global achievement_56_get, achievement_57_get, achievement_58_get, achievement_59_get, achievement_60_get
global achievement_61_get, achievement_62_get, achievement_63_get, achievement_64_get, achievement_65_get
global achievement_66_get, achievement_67_get, achievement_68_get, achievement_69_get, achievement_70_get
global achievement_71_get, achievement_72_get, achievement_73_get, achievement_74_get, achievement_75_get
global achievement_76_get, achievement_77_get, achievement_78_get, achievement_79_get, achievement_80_get
global achievement_81_get, achievement_82_get, achievement_83_get, achievement_84_get, achievement_85_get
achievement = ToastNotifier()
def achievement_get(title, rule):
global information
information = "恭喜你 获得成就 [" + title + "]:" + rule + "!"
achievement_get_sound()
toast_title = "获得成就 [" + title + "]"
achievements_information_text.insert(tk.END, toast_title + ": " + rule + "\n")
achievement.show_toast(title=toast_title, msg=rule, icon_path="./assets/app16x16.ico")
while True:
achievement_1_on = 1 if apple_amount >= 1 and achievement_1_get == 0 else 0
achievement_2_on = 1 if apple_amount >= 100 and achievement_2_get == 0 else 0
achievement_3_on = 1 if apple_amount >= 1000 and achievement_3_get == 0 else 0
achievement_4_on = 1 if apple_amount >= 10000 and achievement_4_get == 0 else 0