summaryrefslogtreecommitdiff
path: root/shiftos_next/shiftorium_cmd.vb
blob: 53d7b615503300d363c13eaccf7d4d9acf8111bc (plain) (blame)
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
Public Class shiftorium_cmd

    Public Sub shiftorium_load(s As Object, e As EventArgs) Handles MyBase.Load
        listboxtoaddto = lbitems
        determineitems()
        lbitems.SelectedItem = 0
        lbprice.Hide()
        btnbuy.Hide()
        lbcodepoints.Text = "Codepoints: " & codepoints
    End Sub

    Public Sub determineitems()
        lbitems.DrawMode = DrawMode.Normal
        lbitems.Items.Clear()
        Try
            If boughtbasicsettings = False Then
                AddItem("Basic Terminal Settings", 5)
            Else
                If boughtcustomusername = False Then
                    AddItem("Custom Username", 10)
                End If
            End If
            If boughtdirectorysurfing = False Then
                AddItem("Directory Surfing", 10)
            Else

            End If
            If boughtgray = False Then
                AddItem("Gray", 25)
            Else
                If boughtbasicgui = False Then
                    AddItem("Basic GUI Server", 100)
                End If
                If boughtterminalsettextcolor = False Then
                    AddItem("Set Terminal Text Color", 10)
                End If
            End If
            lbitems.SelectedIndex = 1
        Catch ex As Exception
            lbitems.Items.Add("No items available.")
        End Try
        lbitems.DrawMode = DrawMode.OwnerDrawFixed
    End Sub

    Public Sub lbitems_keydown(sender As System.Object, e As KeyEventArgs) Handles lbitems.KeyDown
        Select Case e.KeyCode
            Case Keys.Escape
                e.SuppressKeyPress = True
                Me.Close()
                Terminal.Focus()
            Case Keys.Down
                e.SuppressKeyPress = True
                If Not lbitems.SelectedIndex = lbitems.Items.Count - 1 Then
                    lbitems.SelectedIndex += 1
                End If
            Case Keys.Up
                e.SuppressKeyPress = True
                If Not lbitems.SelectedIndex = 0 Then
                    lbitems.SelectedIndex -= 1
                End If
            Case Keys.Enter
                handleitemdescription("Set Terminal Text Color - 10 CP", "Having a black and white color scheme on a Terminal is ibfact quite a cliche. This upgrade allows you to set the text color of the Terminal. It only allows for the basic colors, but it's better than just white!")
                handleitemdescription("Basic GUI Server - 100 CP", "Well, we've got Gray, and we've got the ability to write GUIs. Now, let's allow the users to run GUIs, and open a lot of possibilities up.")
                handleitemdescription("Gray - 25 CP", "Black, and white. Such a bland choice of colors. Black for the background, white for the text. What a hard way to develop an app. With this upgrade, the video card driver in ShiftOS will support the output of Gray (R=127, G=127, B=127) allowing for some better capabilities in application programming.")
                handleitemdescription("Directory Surfing - 10 CP", "ShiftOS came with a file system update. Instead of ShiftFS, we have ShiftFS Ultra. However, there's no point in using it... yet. This upgrade allows you to browse the filesystem in the terminal.")
                handleitemdescription("Custom Username - 10 CP", "Hello, user! Isn't that wierd that that's all we know you as? Buy this upgrade to change yourr name from ""user"" to anything you want!")
                handleitemdescription("Basic Terminal Settings - 5 CP", "Ever wanted to customize the terminal to act the way you'd like it to? This upgrade is for you. You won't be able to use it until you buy settings, but hey! The command is there.")
            Case Keys.Space
                handlebuy("Set Terminal Text Color - 10 CP", boughtterminalsettextcolor, "Awesome! Now, you can use 'set textcolor <colorname>' to set the Terminal text color. For a reference on supported colors, you can also type 'colors'.")
                handlebuy("Basic GUI Server - 100 CP", boughtbasicgui, "Amazing. Come time, and money, we may be able to collaborate with other companies to develop applications, upgrades, and eventually a window manager.")
                handlebuy("Gray - 25 CP", boughtgray, "Great. Right away, the Shiftorium is easier to use! Look at that amazing gray highlight.")
                handlebuy("Directory Surfing - 10 CP", boughtdirectorysurfing, "Now we can do basic file navigation using the cd, dir, and mkdir commands. Hopefully, with more research, we may be able to create some apps to handle files, like a text editor.")
                handlebuy("Custom Username - 10 CP", boughtcustomusername, "Amazing! Just type ""set username <value>"" into the Terminal, and presto!")
                handlebuy("Basic Terminal Settings - 5 CP", boughtbasicsettings, "Great! Now, a new command has been added to the terminal. Use it with ""set <setting> <value>"". There are no settings to set, though.")
            Case Else
                e.SuppressKeyPress = True
        End Select
    End Sub




    Private Sub handlebuy(ByVal name As String, ByRef bought As Boolean, ByVal boughttutorial As String)

        On Error Resume Next
        Dim pricegrab As String
        If lbitems.SelectedItem = name Then
            If btnbuy.Text = "Press SPACE to download." Then
                pricegrab = lbitems.SelectedItem.ToString.Substring(lbitems.SelectedItem.ToString.IndexOf("-") + 2, lbitems.SelectedItem.ToString.Length - lbitemname.Text.Length - 5)
                codepoints -= Convert.ToInt32(pricegrab)
                bought = True
                lbdescription.Text = boughttutorial
                btnbuy.Text = "Upgrade """ & name & """ installed, deducting " & pricegrab & " Codepoints."
                lbprice.Hide()
                determineitems()
                lbcodepoints.Text = "Codepoints: " & codepoints
                savegame()
            End If
        End If
    End Sub

    'UltraDOS Upgrade List renderer
    Private Sub udos_DrawItem(ByVal sender As Object, ByVal e As System.Windows.Forms.DrawItemEventArgs) Handles lbitems.DrawItem
        e.DrawBackground()
        If (e.State And DrawItemState.Selected) = DrawItemState.Selected Then
            If boughtgray Then
                e.Graphics.FillRectangle(Brushes.Gray, e.Bounds)
                Using b As New SolidBrush(e.ForeColor)
                    e.Graphics.DrawString(lbitems.GetItemText(lbitems.Items(e.Index)), e.Font, b, e.Bounds)
                End Using
            Else
                e.Graphics.FillRectangle(Brushes.White, e.Bounds)
                Using b As New SolidBrush(Color.Black)
                    e.Graphics.DrawString(lbitems.GetItemText(lbitems.Items(e.Index)), e.Font, b, e.Bounds)
                End Using
            End If
        Else

            Using b As New SolidBrush(e.ForeColor)
                e.Graphics.DrawString(lbitems.GetItemText(lbitems.Items(e.Index)), e.Font, b, e.Bounds)
            End Using
        End If
        e.DrawFocusRectangle()

    End Sub


    Private Sub handleitemdescription(ByVal itemname As String, ByVal itemdescription As String)
        On Error Resume Next
        If lbitems.SelectedItem.ToString = itemname Then
            lbitemname.Text = lbitems.SelectedItem.ToString.Substring(0, lbitems.SelectedItem.ToString.IndexOf("-"))
            lbdescription.Text = itemdescription
            lbprice.Text = "This item costs " & lbitems.SelectedItem.ToString.Substring(lbitems.SelectedItem.ToString.IndexOf("-") + 2, lbitems.SelectedItem.ToString.Length - lbitemname.Text.Length - 5) & " Codepoints"
            lbprice.Show()
            btnbuy.Show()
            If codepoints > Convert.ToInt32(lbitems.SelectedItem.ToString.Substring(lbitems.SelectedItem.ToString.IndexOf("-") + 2, lbitems.SelectedItem.ToString.Length - lbitemname.Text.Length - 5)) Then
                btnbuy.Text = "Press SPACE to download."
            Else
                btnbuy.Text = "Insufficient Codepoints!"
            End If
        End If
    End Sub

End Class