-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProgram.cs
More file actions
815 lines (781 loc) · 34.4 KB
/
Program.cs
File metadata and controls
815 lines (781 loc) · 34.4 KB
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
using System.Media;
using System.Net;
using System.Runtime.InteropServices;
using System.Xml.Linq;
using Windows.Media.Capture;
using Spectre.Console;
using SixLabors.ImageSharp;
using SCColor = Spectre.Console.Color;
namespace ClickBoxin
{
class Window
{
[DllImport("user32.dll")]
public static extern int GetAsyncKeyState(Int32 vKey);
static public CanvasImage image;
static public CanvasImage bossi;
static public SoundPlayer music;
static public SoundPlayer introm;
static public SoundPlayer outrom;
static public SoundPlayer bossm;
static public Table GameWin;
static public Table BossWin;
static public Table DailyBonus;
static public string stats = "";
static public string menu = "";
static public string[] daily = new string[7];
static public bool musicOn;
static public bool SpacebarPressed = false;
static public GamblingMachine GamblingMachine = new GamblingMachine();
static public void GetAssets()
{
image = new CanvasImage("../../../assets/hum.png");
image.MaxWidth(15);
music = new SoundPlayer("../../../assets/musci.wav");
introm = new SoundPlayer("../../../assets/introm.wav");
bossm = new SoundPlayer("../../../assets/bossm.wav");
outrom = new SoundPlayer("../../../assets/outrom.wav");
}
static public void CreateTable()
{
GameWin = new Table();
GameWin.Alignment(Justify.Center);
GameWin.Width(100);
GameWin.Border(TableBorder.Rounded);
GameWin.AddColumn(new TableColumn("[orange3]STATS[/]").Centered());
GameWin.AddColumn(new TableColumn("[yellow]TRAIN[/]").Centered());
GameWin.AddColumn(new TableColumn("[blue]MENU[/]").Centered());
GameWin.Columns[0].Width(30);
DailyBonus = new Table();
DailyBonus.Alignment(Justify.Center);
DailyBonus.Width(100);
DailyBonus.Border(TableBorder.Double);
for (int i = 0; i < 7; i++)
{
DailyBonus.AddColumn(new TableColumn($"[bold]DAY {i+1}[/]").Centered());
}
}
static public void UpdateStats()
{
stats = $"[bold]{Game.player.Name}[/]" + $"\nSTAGE: {Game.player.Stage}" +
$"\n[orange3]DMG: {Game.player.Dmg} X{Game.player.DmgMulti}[/]";
for (int i = 0; i < Game.farms.Count; i++)
{
var farm = Game.farms[i];
if(farm.ScorePP > 0) stats += $"\n+ {farm.ScorePP} score every {farm.TimeInterval} seconds \n{GenerateProgressBar(Game.time % farm.TimeInterval, farm.TimeInterval)}";
}
}
static public void UpdateTable()
{
menu = "[green]Press /Spacebar/ to attack!" + "\nPress /U/ to upgrade!" + "\nPress /Y/ to open ClickMenu";
if (Game.player.Stage > 2)
{
menu += "\nPress /R/ restart the game!";
}
menu += "\nPress /S/ to open settings!" + "\nPress /Backspace/ to exit the game![/]";
GameWin.Rows.Clear();
GameWin.AddRow(new Markup($"{stats}"), image, new Markup(menu));
GameWin.AddRow(new Markup(" "), new Markup($"score: {Game.player.Score}"), new Markup($"Press /B/ to FIGHT THE BOSS!\nCost: {Game.boss.Cost}"));
}
static public void UpdateDailyBonus()
{
DailyBonus.Rows.Clear();
for (int i = 0; i < 7; i++)
{
if((Game.player.DailyLoginStreak-1)%7 < i)
{
switch (i)
{
case 0:
daily[i] = "500 Score\n[green]CLAIM[/]";
break;
case 1:
daily[i] = "5000 Score\n[green]CLAIM[/]";
break;
case 2:
daily[i]= "3 Tickets\n[green]CLAIM[/]";
break;
case 3:
daily[i] = "10000 Score\n[green]CLAIM[/]";
break;
case 4:
daily[i] = "10 Ultra\n[green]CLAIM[/]";
break;
case 5:
daily[i] = "6 Tickets\n[green]CLAIM[/]";
break;
case 6:
daily[i] = "100000 Score\n[green]CLAIM[/]";
break;
}
}
else
{
switch (i)
{
case 0:
daily[i] = "500 Score\n[red]CLAIMED[/]";
break;
case 1:
daily[i] = "5000 Score\n[red]CLAIMED[/]";
break;
case 2:
daily[i] = "3 Tickets\n[red]CLAIMED[/]";
break;
case 3:
daily[i] = "10000 Score\n[red]CLAIMED[/]";
break;
case 4:
daily[i] = "10 Ultra\n[red]CLAIMED[/]";
break;
case 5:
daily[i] = "6 Tickets\n[red]CLAIMED[/]";
break;
case 6:
daily[i] = "100000 Score\n[red]CLAIMED[/]";
break;
}
}
}
DailyBonus.AddRow(daily[0], daily[1], daily[2], daily[3], daily[4], daily[5], daily[6]);
}
static public string GenerateProgressBar(int value, int interval)
{
int progress = Math.Min((value * 10) / interval, 10);
return progress switch
{
0 => "□□□□□□□□□□",
1 => "■□□□□□□□□□",
2 => "■■□□□□□□□□",
3 => "■■■□□□□□□□",
4 => "■■■■□□□□□□",
5 => "■■■■■□□□□□",
6 => "■■■■■■□□□□",
7 => "■■■■■■■□□□",
8 => "■■■■■■■■□□",
9 => "■■■■■■■■■□",
_ => "□□□□□□□□□□"
};
}
static public void SettingsMenu()
{
Game.WindowOpened = 5;
while (Game.WindowOpened == 5)
{
AnsiConsole.Clear();
AnsiConsole.MarkupLine($"[bold]SETTINGS MENU[/]");
AnsiConsole.MarkupLine($"[green]Settings for profile {Game.player.Name}[/]");
var choices = AnsiConsole.Prompt(
new SelectionPrompt<string>()
.PageSize(10)
.AddChoices("Exit", "Save Game", "Load Game", "Audio Off/On", "Reset All Progress"));
switch (choices)
{
case "Exit":
Game.WindowOpened = 0;
break;
case "Save Game":
Game.SaveGame();
AnsiConsole.Status()
.AutoRefresh(true)
.Start("[green]Saving...[/]", ctx =>
{
System.Threading.Thread.Sleep(1000);
ctx.Spinner(Spinner.Known.Balloon2);
ctx.SpinnerStyle(Style.Parse("green"));
System.Threading.Thread.Sleep(1000);
});
break;
case "Load Game":
LoadMenu();
break;
case "Audio Off/On":
if(musicOn)
{
music.Stop();
musicOn = false;
}
else
{
music.PlayLooping();
musicOn = true;
}
break;
case "Reset All Progress":
Game.ResetAllProgress();
AnsiConsole.Clear();
musicOn = false;
InitialLogin();
musicOn = true;
break;
}
UpdateStats();
UpdateTable();
}
}
static public void LoadMenu()
{
Game.WindowOpened = 6;
while (Game.WindowOpened == 6)
{
AnsiConsole.Clear();
AnsiConsole.MarkupLine($"[bold]LOAD MENU[/]");
AnsiConsole.MarkupLine($"[green]Choose the profile to load[/]");
var choices = new List<string> {"Exit"};
if(File.Exists("saves/users.txt"))
{
var Users = File.ReadAllText("saves/users.txt");
string[] users = Users.Split(",");
for(int i = 0;i<users.Count();i++)
{
choices.Add(users[i]);
}
}
var profile = AnsiConsole.Prompt(
new SelectionPrompt<string>()
.PageSize(10)
.AddChoices(choices));
if (profile == "Exit")
{
Game.WindowOpened = 0;
}
else
{
AnsiConsole.Status()
.AutoRefresh(true)
.Start("[green]Loading...[/]", ctx =>
{
System.Threading.Thread.Sleep(1000);
ctx.Spinner(Spinner.Known.Balloon);
ctx.SpinnerStyle(Style.Parse("green"));
System.Threading.Thread.Sleep(1000);
});
Game.LoadGame(profile);
Game.WindowOpened = 0;
}
}
}
static public void ClickMenu()
{
Game.WindowOpened = 7;
while (Game.WindowOpened == 7)
{
AnsiConsole.Clear();
UpdateDailyBonus();
AnsiConsole.MarkupLine($"[bold blue]DAILY LOGIN BONUS \t DAILY STREAK: {Game.player.DailyLoginStreak}[/]");
AnsiConsole.Write(DailyBonus);
AnsiConsole.WriteLine($"{Game.player.Name} STATS(Stage: {Game.player.Stage} Score: {Game.player.Score}[blue]Ultra: {Game.player.Ultra}[/] [orange3]Dmg: {Game.player.Dmg} [bold]Dmg Multi: {Game.player.DmgMulti}[/][/] Tickets: {Game.player.Tickets} Restarts: {Game.player.Restarts})");
AnsiConsole.MarkupLine($"[bold]CLICK MENU[/]");
var choices = AnsiConsole.Prompt(
new SelectionPrompt<string>()
.PageSize(10)
.AddChoices("Exit", "Claim Daily Reward", "Ultra Upgrade", "Achievements", "Gamble Machine"));
switch (choices)
{
case "Exit":
Game.WindowOpened = 0;
break;
case "Claim Daily Reward":
if(Game.player.HasClaimedRewardToday())
{
AnsiConsole.MarkupLine("[red]You have already claimed your reward today![/]");
}
else
{
Game.ClaimReward();
}
break;
case "Ultra Upgrade":
UltraUpgradeMenu();
break;
case "Achievements":
AchievementsMenu();
break;
case "Gamble Machine":
GambleMenu();
break;
}
UpdateStats();
UpdateTable();
}
}
static public void AchievementsMenu()
{
Game.WindowOpened = 8;
while (Game.WindowOpened == 8)
{
AnsiConsole.Clear();
AnsiConsole.MarkupLine($"[bold]ACHIEVEMENTS MENU[/]");
for(int i = 0; i<Game.Achievs.Count;i++)
{
if (Game.Achievs[i].IsUnlocked)
{
AnsiConsole.MarkupLine($"[green]UNLOCKED {Game.Achievs[i].Name}[/]\n{Game.Achievs[i].Description}");
}
else
{
AnsiConsole.MarkupLine($"[red]LOCKED {Game.Achievs[i].Name}[/]\n{Game.Achievs[i].Description}");
}
}
Console.ReadKey();
Game.WindowOpened = 0;
UpdateStats();
UpdateTable();
}
}
static public void GambleMenu()
{
Game.WindowOpened = 9;
while (Game.WindowOpened == 9)
{
AnsiConsole.Clear();
AnsiConsole.Write(new FigletText("GAMBLE").Color(SCColor.Yellow));
AnsiConsole.MarkupLine($"[bold]LET'S GO GAMBLING![/][green]Tickets: {Game.player.Tickets}[/] Score:{Game.player.Score} [blue]Ultra: {Game.player.Ultra} [/][bold]Stage: {Game.player.Stage}[/]");
AnsiConsole.MarkupLine($"[green bold]WARNING![/] [green]Gamble Machine can set the values at negative(except Stage) and also doesn't update current boss!\n\tThe game will also automatically save after gambling![/]");
var choices = AnsiConsole.Prompt(
new SelectionPrompt<string>()
.PageSize(10)
.AddChoices("Exit", "GAMBLE \t\t for 1 Ticket", "EPIC GAMBLE \t for 10 Tickets"));
switch (choices)
{
case "Exit":
Game.WindowOpened = 0;
break;
case "GAMBLE \t\t for 1 Ticket":
Game.Achievs[13].Unlock();
Game.player.Tickets--;
AnsiConsole.Status()
.AutoRefresh(true)
.Spinner(Spinner.Known.Balloon)
.SpinnerStyle(Style.Parse("bold red"))
.Start("[bold red]GAMBLE...[/]", ctx =>
{
System.Threading.Thread.Sleep(1000);
AnsiConsole.MarkupLine("[green]GAMBLE: +10000 Score[/]");
System.Threading.Thread.Sleep(50);
AnsiConsole.MarkupLine("[green]GAMBLE: +10 Ultra[/]");
System.Threading.Thread.Sleep(50);
AnsiConsole.MarkupLine("[green]GAMBLE: +2Tickets Score[/]");
System.Threading.Thread.Sleep(50);
AnsiConsole.MarkupLine("[green]GAMBLE: -10 Ultra[/]");
System.Threading.Thread.Sleep(50);
AnsiConsole.MarkupLine("[green]GAMBLE: +1 Stage[/]");
System.Threading.Thread.Sleep(50);
AnsiConsole.MarkupLine("[green]GAMBLE: -1 Ticket[/]");
System.Threading.Thread.Sleep(50);
AnsiConsole.MarkupLine("[green]GAMBLE: -10000 Score[/]");
System.Threading.Thread.Sleep(50);
AnsiConsole.MarkupLine("[green]GAMBLE: 10000 Score[/]");
System.Threading.Thread.Sleep(50);
});
GamblingMachine.SpinWheelBasic();
System.Threading.Thread.Sleep(5000);
Game.SaveGame();
break;
case "EPIC GAMBLE \t for 10 Tickets":
Game.Achievs[13].Unlock();
Game.player.Tickets--;
AnsiConsole.Status()
.AutoRefresh(true)
.Spinner(Spinner.Known.Balloon)
.SpinnerStyle(Style.Parse("bold red"))
.Start("[bold red]EPIC GAMBLE...[/]", ctx =>
{
System.Threading.Thread.Sleep(1000);
AnsiConsole.MarkupLine("[green]GAMBLE: +10000 Score[/]");
System.Threading.Thread.Sleep(50);
AnsiConsole.MarkupLine("[green]GAMBLE: +10 Ultra[/]");
System.Threading.Thread.Sleep(50);
AnsiConsole.MarkupLine("[green]GAMBLE: +2Tickets Score[/]");
System.Threading.Thread.Sleep(50);
AnsiConsole.MarkupLine("[green]GAMBLE: -10 Ultra[/]");
System.Threading.Thread.Sleep(50);
AnsiConsole.MarkupLine("[green]GAMBLE: +1 Stage[/]");
System.Threading.Thread.Sleep(50);
AnsiConsole.MarkupLine("[green]GAMBLE: -1 Ticket[/]");
System.Threading.Thread.Sleep(50);
AnsiConsole.MarkupLine("[green]GAMBLE: -10000 Score[/]");
System.Threading.Thread.Sleep(50);
AnsiConsole.MarkupLine("[green]GAMBLE: 10000 Score[/]");
System.Threading.Thread.Sleep(50);
});
GamblingMachine.SpinWheelAdvanced();
System.Threading.Thread.Sleep(5000);
Game.SaveGame();
break;
}
UpdateStats();
UpdateTable();
}
}
static public void UpgradeMenu()
{
Game.WindowOpened = 1;
while (Game.WindowOpened == 1)
{
AnsiConsole.Clear();
AnsiConsole.MarkupLine($"[bold]UPGRADE MENU[/]");
AnsiConsole.MarkupLine($"[blue]SCORE: {Game.player.Score}[/]\t[red]DMG: {Game.player.Dmg}[/]");
var choices = new List<string> { "Exit", $"DAMAGE \t\t cost:{(Game.player.Dmg * 100) * Game.player.Dmg}" };
for (int i = 0; i < Game.farms.Count; i++)
{
var farm = Game.farms[i];
choices.Add($"{farm.TimeInterval} SECOND FARM \t cost:{farm.Cost}");
}
var upgrade = AnsiConsole.Prompt(
new SelectionPrompt<string>()
.PageSize(10)
.AddChoices(choices));
if (upgrade == "Exit")
{
Game.WindowOpened = 0;
}
else if (upgrade == $"DAMAGE \t\t cost:{(Game.player.Dmg * 100) * Game.player.Dmg}")
{
Game.UpgradeLogic(-1);
}
else
{
int farmIndex = choices.IndexOf(upgrade) - 2;
Game.UpgradeLogic(farmIndex);
}
UpdateStats();
UpdateTable();
}
}
static public void UltraUpgradeMenu()
{
Game.WindowOpened = 3;
while (Game.WindowOpened == 3)
{
AnsiConsole.Clear();
AnsiConsole.MarkupLine($"[bold]ULTRA UPGRADE MENU[/]\n[green]Ultra upgrades stay after restart![/]");
AnsiConsole.MarkupLine($"[blue]ULTRA: {Game.player.Ultra}[/]\t[red]DMG: {Game.player.Dmg} X{Game.player.DmgMulti}[/]");
var choices = new List<string> { "Exit",
$"DAMAGE MULTIPLIER [green]for {Game.player.DmgMulti * Game.player.DmgMulti}[/]",
$"GREATER BOSS TIME! [green]for {Game.bosstime/2}[/]"
};
for (int i = 0; i < Game.farms.Count; i++)
{
var farm = Game.farms[i];
choices.Add($"LOWER FARM'S TIME! Current: {farm.TimeInterval} seconds [green]for {Game.farms[i].TimeCost}[/]");
}
var upgrade = AnsiConsole.Prompt(
new SelectionPrompt<string>()
.PageSize(10)
.AddChoices(choices));
if (upgrade == "Exit")
{
Game.WindowOpened = 0;
}
else if (upgrade == $"DAMAGE MULTIPLIER [green]for {Game.player.DmgMulti * Game.player.DmgMulti} ultra[/]")
{
Game.UltraUpgradeLogic(-1);
}
else if (upgrade == $"GREATER BOSS TIME! [green]for {Game.bosstime/2} ultra[/]")
{
Game.UltraUpgradeLogic(0);
}
else
{
int farmIndex = choices.IndexOf(upgrade) - 2;
Game.UltraUpgradeLogic(farmIndex);
}
UpdateStats();
UpdateTable();
}
}
static public void CreateBossTable()
{
BossWin = new Table();
BossWin.Alignment(Justify.Center);
BossWin.Width(100);
BossWin.Border(TableBorder.Ascii2);
BossWin.AddColumn(new TableColumn("[orange3]STATS[/]").Centered());
BossWin.AddColumn(new TableColumn("[red]BOSS[/]").Centered());
BossWin.AddColumn(new TableColumn("[blue]MENU[/]").Centered());
BossWin.Columns[0].Width(30);
}
static public void BossTable()
{
BossWin.Rows.Clear();
BossWin.AddRow(new Markup($"STAGE: {Game.player.Stage}\n[orange3]DMG: {Game.player.Dmg}[/]"), bossi
, new Markup("[green]Press /Spacebar/ to attack! " +
"\nPress /M/ to mute! " +
"\nPress /Backspace/ to exit the battle![/]"));
BossWin.AddRow(new Markup(" "), new Markup($"\n[red]BOSS HEALTH: {Game.boss.Health}[/]TIME LEFT: {Game.boss.Time}"));
}
static public void BossWindow()
{
Game.WindowOpened = 2;
var random = new Random();
int bossimage = random.Next(1, 5);
switch (bossimage)
{
case 1:
bossi = new CanvasImage("../../../assets/boss1.png");
break;
case 2:
bossi = new CanvasImage("../../../assets/boss2.png");
break;
case 3:
bossi = new CanvasImage("../../../assets/boss3.png");
break;
case 4:
bossi = new CanvasImage("../../../assets/boss4.png");
break;
case 5:
bossi = new CanvasImage("../../../assets/boss5.png");
break;
}
bossi.MaxWidth(15);
AnsiConsole.Clear();
AnsiConsole.Write(BossWin);
if(musicOn)
{
bossm.PlayLooping();
}
while(Game.boss.Time>0)
{
if (Game.boss.Health <= 0)
{
Game.BossWon();
bossm.Stop();
AnsiConsole.Write(new Markup("[bold green]You won![/]"));
Thread.Sleep(2000);
break;
}
if (Console.KeyAvailable)
{
var key = Console.ReadKey(true).Key;
switch (key)
{
case ConsoleKey.Spacebar:
Game.boss.Health -= (Game.player.Dmg*Game.player.DmgMulti);
break;
case ConsoleKey.M:
if(musicOn)
{
bossm.Stop();
musicOn = false;
}
else
{
bossm.PlayLooping();
musicOn = true;
}
break;
case ConsoleKey.Backspace:
Game.boss.Time = 0;
break;
}
AnsiConsole.Clear();
BossTable();
AnsiConsole.Write(BossWin);
}
}
Game.WindowOpened = 0;
music.PlayLooping();
Game.boss.Time = Game.bosstime;
}
static public void Intro()
{
introm.Play();
AnsiConsole.Clear();
System.Threading.Thread.Sleep(1000);
AnsiConsole.Write(new FigletText("CLICKBOXIN").Color(SCColor.Green));
System.Threading.Thread.Sleep(2000);
AnsiConsole.Status()
.AutoRefresh(true)
.Spinner(Spinner.Known.Ascii)
.SpinnerStyle(Style.Parse("yellow"))
.Start("[bold green]Starting the game...[/]", ctx =>
{
System.Threading.Thread.Sleep(1000);
ctx.Status("[bold yellow]Loading Assets...[/]");
System.Threading.Thread.Sleep(100);
AnsiConsole.MarkupLine($"[green]Images loaded[/]");
System.Threading.Thread.Sleep(100);
AnsiConsole.MarkupLine($"[green]Music loaded[/]");
System.Threading.Thread.Sleep(1000);
ctx.Status("[bold yellow]Loading player data...[/]");
System.Threading.Thread.Sleep(100);
AnsiConsole.MarkupLine($"[green]Score loaded[/]");
System.Threading.Thread.Sleep(100);
AnsiConsole.MarkupLine($"[green]Damage loaded[/]");
System.Threading.Thread.Sleep(100);
AnsiConsole.MarkupLine($"[green]Stage loaded[/]");
ctx.Status("[bold yellow]Loading more data...[/]");
System.Threading.Thread.Sleep(100);
AnsiConsole.MarkupLine($"[green]Upgrades loaded[/]");
System.Threading.Thread.Sleep(100);
AnsiConsole.MarkupLine($"[green]Bosses loaded[/]");
System.Threading.Thread.Sleep(100);
AnsiConsole.MarkupLine($"[green]Logic loaded[/]");
ctx.Status("[bold yellow]Finalizing...[/]");
System.Threading.Thread.Sleep(2000);
AnsiConsole.MarkupLine($"[green]Game loaded![/]");
System.Threading.Thread.Sleep(1000);
});
AnsiConsole.Clear();
}
static public void InitialLogin()
{
AnsiConsole.MarkupLine("[green]Start your adventure.[/]");
AnsiConsole.MarkupLine("[bold]Enter your username:[/]");
while(true)
{
Game.player.Name = Console.ReadLine();
if ((Game.player.Name.Length < 10&&Game.player.Name.Length>0)&&!(Game.player.Name.Contains("/")||Game.player.Name.Contains(",")||Game.player.Name.Contains(".")))
{
Directory.CreateDirectory("saves");
Game.SaveName(Game.player.Name);
break;
}
else
{
AnsiConsole.MarkupLine("[red]Username incorrect or is too long![/]");
}
}
}
static public void UltraRestartLoad()
{
Game.WindowOpened = 4;
music.Stop();
AnsiConsole.Clear();
AnsiConsole.Status()
.AutoRefresh(true)
.Spinner(Spinner.Known.Arrow2)
.SpinnerStyle(Style.Parse("yellow"))
.Start("[bold green]Uploading...[/]", ctx =>
{
System.Threading.Thread.Sleep(2000);
AnsiConsole.MarkupLine($"[green]Uploading the stats. Please hold on.[/]");
System.Threading.Thread.Sleep(3000);
AnsiConsole.MarkupLine($"[green]Player's score: {Game.player.Score}[/]");
System.Threading.Thread.Sleep(500);
AnsiConsole.MarkupLine($"[green]Player's Damage: {Game.player.Dmg}[/]");
System.Threading.Thread.Sleep(500);
AnsiConsole.MarkupLine($"[green]Player's Stage: {Game.player.Stage}[/]");
System.Threading.Thread.Sleep(500);
ctx.Spinner(Spinner.Known.Ascii);
ctx.Status("[bold yellow]Calculating Ultra...[/]");
System.Threading.Thread.Sleep(5000);
ctx.Spinner(Spinner.Known.Dots2);
ctx.Status("[bold yellow]Restarting...[/]");
AnsiConsole.MarkupLine($"[yellow]Restarting the game. Please hold on.[/]");
System.Threading.Thread.Sleep(5000);
AnsiConsole.MarkupLine("[bold]Restart Completed![/]");
System.Threading.Thread.Sleep(3000);
});
Intro();
Game.WindowOpened = 0;
}
static void Main(string[] args)
{
GetAssets();
CreateTable();
CreateBossTable();
if (!File.Exists("saves/users.txt"))
{
InitialLogin();
}
else
{
LoadMenu();
if(Game.player.Name == "")
{
InitialLogin();
}
}
Game.CreateBoss(Game.player.Stage,Game.bosstime);
Intro();
UpdateTable();
AnsiConsole.Write(GameWin);
music.PlayLooping();
musicOn = true;
Game.StartTimer();
while (Game.esc)
{
if (Console.KeyAvailable)
{
var key = Console.ReadKey(true).Key;
switch (key)
{
case ConsoleKey.Backspace:
Game.esc = false;
break;
case ConsoleKey.Spacebar:
SpacebarPressed = true;
break;
case ConsoleKey.U:
UpgradeMenu();
break;
case ConsoleKey.I:
{
UltraUpgradeMenu();
break;
}
case ConsoleKey.M:
if(musicOn)
{
music.Stop();
musicOn = false;
}
else
{
music.PlayLooping();
musicOn = true;
}
break;
case ConsoleKey.B:
{
if (Game.player.Score >= Game.boss.Cost)
{
Game.player.Score -= Game.boss.Cost;
BossWindow();
}
break;
}
case ConsoleKey.R:
{
Game.WindowOpened = 4;
AnsiConsole.Clear();
AnsiConsole.MarkupLine("[bold]Are you sure?[/]");
AnsiConsole.MarkupLine($"You will lose all your progress but gain [bold]{(Game.player.Score/10000) * Game.player.Stage * Game.player.Dmg} ULTRA![/]\n[italic grey]Ultra will be counted from 10000 score! || Ultra upgrades stay after restart![/]");
AnsiConsole.MarkupLine("[green]Press /spacebar/ to confirm[/] or [red]any other key to cancel[/]");
key = Console.ReadKey(true).Key;
if (key == ConsoleKey.Spacebar)
{
UltraRestartLoad();
Game.UltraRestart();
}
break;
}
case ConsoleKey.S:
SettingsMenu();
break;
case ConsoleKey.Y:
ClickMenu();
break;
}
UpdateTable();
UpdateStats();
AnsiConsole.Clear();
AnsiConsole.Write(GameWin);
}
else
{
if (SpacebarPressed == true)
{
Game.player.Score += (Game.player.Dmg*Game.player.DmgMulti);
SpacebarPressed = false;
}
}
}
outrom.Play();
AnsiConsole.MarkupLine("[bold red]Game Over! Thanks for playing![/]\n\nPress anything to close the game...");
Console.ReadKey();
}
}
}