aboutsummaryrefslogtreecommitdiff
path: root/features/soopyGui/GuiPage.js
blob: 7a21d268b49281b80b7a9301325f9e56f5d57212 (plain)
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
import SoopyGuiElement from '../../../guimanager/GuiElement/SoopyGuiElement.js';
import categoryManager from './categoryManager.js';

class GuiPage {
    constructor(priority) {
        this.currentPageId = 0;
        this.priority = priority

        this.name = ""

        this.pages = {}

        this.showBackButton = true
        this.finalisedLoading = false
    }

    finaliseLoading() {
        categoryManager.addCategory(this);
    }

    getSoopyGui() {
        if (global.soopyv2featuremanagerthing.features["soopyGui"]) return global.soopyv2featuremanagerthing.features["soopyGui"].class;
    }

    isOpen() {
        if (!this.getSoopyGui()?.gui?.ctGui?.isOpen()) return false

        return this.getSoopyGui()?.currCategory === this
    }

    newPage() {
        this.currentPageId++
        let page = new SoopyGuiElement().setLocation(1 * this.currentPageId, 0, 1, 1)

        page._soopyAddonsPageId = this.currentPageId

        this.pages[this.currentPageId] = page

        return page
    }

    goToPage(page, anim) {
        this.getSoopyGui().goToPageNum(page, anim)
    }

    openSidebarPage(child) {
        this.getSoopyGui().openSidebarPage(child)
    }
    closeSidebarPage() {
        this.getSoopyGui().closeSidebarPage()
    }

    delete() {
        categoryManager.deleteCategory(this)
    }

    //Override me :D
    onOpen() {

    }

    //Override me :D
    onOpenPage(page) {

    }
}

export default GuiPage;