mirror of
https://github.com/TheUltimateHacker/shiftos-next.git
synced 2025-01-23 00:42:14 +00:00
1fcbee8dab
I've added some new Shiftorium upgrades, as well as some save engine fixes. If you add to the engine, and try to load, say a Boolean value from a line containing a blank String value, it'll detect that and tell you it'll rewrite that line. It preserves what it has already loaded. I've also added some new terminal commands, and some Shiftorium bugfixes.
144 lines
No EOL
7.9 KiB
VB.net
144 lines
No EOL
7.9 KiB
VB.net
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 |