MCPcopy Create free account
hub / github.com/candybox2/candybox2.github.io / deleteAndReAddEverything

Method deleteAndReAddEverything

code/main/StatusBar.ts:48–80  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

46
47 // Public methods
48 public deleteAndReAddEverything(): void{
49 // Delete tabs
50 this.tabs = [];
51
52 // Reset special hotkeys
53 this.game.resetSpecialHotkeys();
54
55 // Delete the player health bar
56 this.playerHealthBar = null;
57
58 // Add the player health bar
59 if(Saving.loadBool("statusBarUnlockedHealthBar")){
60 this.playerHealthBar = new Bar(BarType.HEALTH);
61 this.playerHealthBar.resize(72, 1);
62 }
63
64 // Add tabs
65 if(Saving.loadBool("statusBarUnlocked")) this.addTab(StatusBarTabType.CANDY_BOX, 0, " THE", "CANDY", " BOX", new CallbackCollection(this.game.goToCandyBox.bind(this.game)));
66 if(Saving.loadBool("statusBarUnlockedInventory")) this.addTab(StatusBarTabType.INVENTORY, 8, "INV", " ENT", "ORY", new CallbackCollection(this.game.goToInventory.bind(this.game)));
67 if(Saving.loadBool("statusBarUnlockedMap")) this.addTab(StatusBarTabType.MAP, 15, "", "MAP", "", new CallbackCollection(this.game.goToMap.bind(this.game)));
68 if(Saving.loadBool("statusBarUnlockedLollipopFarm")) this.addTab(StatusBarTabType.FARM, 21, "LOLL", "IPOP", "FARM", new CallbackCollection(this.game.goToLollipopFarm.bind(this.game)));
69 if(Saving.loadBool("statusBarUnlockedCauldron")) this.addTab(StatusBarTabType.CAULDRON, 28, "", "CLDR", "", new CallbackCollection(this.game.goToCauldron.bind(this.game)));
70 if(Saving.loadBool("statusBarUnlockedInsideYourBox")) this.addTab(StatusBarTabType.INSIDE_YOUR_BOX, 35, "INSIDE", " YOUR", " BOX!", new CallbackCollection(this.game.goToInsideYourBox.bind(this.game)));
71 if(Saving.loadBool("statusBarUnlockedTheComputer")) this.addTab(StatusBarTabType.THE_COMPUTER, 44, " THE", " COM", "PUTER", new CallbackCollection(this.game.goToTheComputer.bind(this.game)));
72 if(Saving.loadBool("statusBarUnlockedTheArena")) this.addTab(StatusBarTabType.THE_ARENA, 52, " THE", "ARENA", " /!\\", new CallbackCollection(this.game.goToTheArena.bind(this.game)));
73 if(Saving.loadBool("statusBarUnlockedSave")) this.addTab(StatusBarTabType.SAVE, 60, "", "SAVE", "", new CallbackCollection(this.game.goToSave.bind(this.game)));
74 if(Saving.loadBool("statusBarUnlockedCfg")) this.addTab(StatusBarTabType.CFG, 67, "C", "F", "G", new CallbackCollection(this.game.goToCfg.bind(this.game)));
75
76 // Add special hotkeys to go to the next or previous tab
77 if(Saving.loadBool("statusBarUnlocked")){
78 this.game.addSpecialHotkey(new Hotkey("n", new CallbackCollection(this.nextTab.bind(this))));
79 }
80 }
81
82 public selectTab(index: number): void{
83 this.selectedTabIndex = index;

Callers 2

constructorMethod · 0.95
updateStatusBarMethod · 0.80

Calls 5

addTabMethod · 0.95
resetSpecialHotkeysMethod · 0.80
bindMethod · 0.80
addSpecialHotkeyMethod · 0.80
resizeMethod · 0.65

Tested by

no test coverage detected