This repository has been archived by the owner on Aug 8, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
primaryView.go
98 lines (91 loc) · 2.97 KB
/
primaryView.go
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
package main
import (
"github.com/CCDirectLink/CCUpdaterOC/design"
"github.com/CCDirectLink/CCUpdaterOC/frenyard"
"github.com/CCDirectLink/CCUpdaterOC/frenyard/framework"
"github.com/CCDirectLink/CCUpdaterOC/frenyard/integration"
"github.com/CCDirectLink/CCUpdaterOC/middle"
)
// ShowPrimaryView shows the "Primary View" (the mod list right now)
func (app *upApplication) ShowPrimaryView() {
pkg, err := app.gameInstance.Get("browser")
installed := err == nil && pkg.Installed()
topLabelText := "Your selected game instance is: \"" + app.gameInstance.Path + "\""
topLabel := framework.FlexboxSlot{
Element: framework.NewUILabelPtr(integration.NewTextTypeChunk(topLabelText, design.GlobalFont), design.ThemeText, 0, frenyard.Alignment2i{}),
Grow: 1,
}
if installed {
middleLabelText := "You are ready to go!"
middleLabel := framework.FlexboxSlot{
Element: framework.NewUILabelPtr(integration.NewTextTypeChunk(middleLabelText, design.GlobalFont), design.ThemeText, 0, frenyard.Alignment2i{}),
Grow: 1,
}
bottomLabelText := "You can now install mods through your browser."
bottomLabel := framework.FlexboxSlot{
Element: framework.NewUILabelPtr(integration.NewTextTypeChunk(bottomLabelText, design.GlobalFont), design.ThemeText, 0, frenyard.Alignment2i{}),
Grow: 1,
}
thePage := design.LayoutDocument(design.Header{
Title: "Install",
Back: func() {
app.GSLeftwards()
app.ResetWithGameLocation(false, middle.GameFinderVFSPathDefault)
},
BackIcon: design.GameIconID,
ForwardIcon: design.MenuIconID,
Forward: func() {
app.GSRightwards()
app.ShowOptionsMenu(func() {
app.GSLeftwards()
app.ShowPrimaryView()
})
},
}, framework.NewUIFlexboxContainerPtr(framework.FlexboxContainer{
DirVertical: true,
Slots: []framework.FlexboxSlot{
topLabel,
middleLabel,
bottomLabel,
},
}), true)
app.Teleport(thePage)
} else {
bottomLabelText := "Your need to link your game with this tool."
bottomLabel := framework.FlexboxSlot{
Element: framework.NewUILabelPtr(integration.NewTextTypeChunk(bottomLabelText, design.GlobalFont), design.ThemeText, 0, frenyard.Alignment2i{}),
}
button := framework.FlexboxSlot{
Element: design.ButtonBar([]framework.UILayoutElement{
design.ButtonAction(design.ThemeOkActionButton, "LINK", func() {
pkg.Install()
app.ShowPrimaryView()
}),
}),
}
thePage := design.LayoutDocument(design.Header{
Title: "Install",
Back: func() {
app.GSLeftwards()
app.ResetWithGameLocation(false, middle.GameFinderVFSPathDefault)
},
BackIcon: design.GameIconID,
ForwardIcon: design.MenuIconID,
Forward: func() {
app.GSRightwards()
app.ShowOptionsMenu(func() {
app.GSLeftwards()
app.ShowPrimaryView()
})
},
}, framework.NewUIFlexboxContainerPtr(framework.FlexboxContainer{
DirVertical: true,
Slots: []framework.FlexboxSlot{
topLabel,
bottomLabel,
button,
},
}), true)
app.Teleport(thePage)
}
}