mirror of
https://github.com/TheUltimateHacker/shiftos-next.git
synced 2025-01-22 16:42:14 +00:00
New Shiftorium Upgrades, Better Save System.
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.
This commit is contained in:
parent
37c68cce0c
commit
1fcbee8dab
10 changed files with 716 additions and 305 deletions
|
@ -1,13 +1,18 @@
|
|||
Public Class Terminal
|
||||
|
||||
Public currentdir As String = root
|
||||
Public prompttoupdatesave As Boolean = False
|
||||
Dim trackpos As Integer = 0
|
||||
|
||||
Public Sub terminal_Innitiate(sender As Object, e As EventArgs) Handles MyBase.Load
|
||||
Me.FormBorderStyle = Windows.Forms.FormBorderStyle.None
|
||||
Me.WindowState = FormWindowState.Maximized
|
||||
AddLine("user@shiftos " & currentdir.ToLower.Replace("c:\shiftos", "~") & "$> ")
|
||||
loadgame()
|
||||
AddLine(username + "@" + osname + " " & currentdir.ToLower.Replace("c:\shiftos", "~") & "$> ")
|
||||
SelectBottom()
|
||||
If prompttoupdatesave = True Then
|
||||
AddLine("ShiftOS has encountered an error loading configuration files. Press any key to reset damaged files.")
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Public Sub SelectBottom()
|
||||
|
@ -19,6 +24,7 @@
|
|||
If command Like "help" Then
|
||||
ShowHelp()
|
||||
ElseIf command Like "cd *" Then
|
||||
If boughtdirectorysurfing = True Then
|
||||
Dim folder As String = command.Replace("cd ", "")
|
||||
|
||||
If folder = ".." Then
|
||||
|
@ -36,7 +42,11 @@
|
|||
AddLine("cd: Directory """ & folder & """ doesn't exist.")
|
||||
End If
|
||||
End If
|
||||
Else
|
||||
wrongcommand()
|
||||
End If
|
||||
ElseIf command = "dir" Or command = "ls" Then
|
||||
If boughtdirectorysurfing Then
|
||||
AddLine("Type | Name ")
|
||||
AddLine("-------+-------------------------------------------")
|
||||
For Each Dir As String In IO.Directory.GetDirectories(currentdir)
|
||||
|
@ -47,7 +57,11 @@
|
|||
Dim filinf As New IO.FileInfo(file)
|
||||
AddLine(filinf.Extension & " | " & filinf.Name)
|
||||
Next
|
||||
Else
|
||||
wrongcommand()
|
||||
End If
|
||||
ElseIf command Like "mkdir *" Then
|
||||
If boughtdirectorysurfing = True Then
|
||||
Dim foldertomake As String = command.Replace("mkdir ", "")
|
||||
If IO.Directory.Exists(currentdir + "\" + foldertomake) Then
|
||||
AddLine("Directory already exists!")
|
||||
|
@ -55,31 +69,164 @@
|
|||
IO.Directory.CreateDirectory(currentdir + "\" + foldertomake)
|
||||
AddLine("mkdir: Directory created successfully.")
|
||||
End If
|
||||
Else
|
||||
wrongcommand()
|
||||
End If
|
||||
ElseIf command Like "give me * codepoints" Then
|
||||
Dim args() As String = command.Split(" ")
|
||||
Dim cp As String = args(2)
|
||||
AddCP(cp)
|
||||
AddLine("Added " & cp & " to your existing ammount of Codepoints.")
|
||||
ElseIf command Like "set * *" Then
|
||||
Dim args() As String = command.Split(" ")
|
||||
Select Case args(1)
|
||||
Case "username"
|
||||
If boughtcustomusername Then
|
||||
username = args(2)
|
||||
Else
|
||||
wrongcommand()
|
||||
End If
|
||||
Case "textcolor"
|
||||
If boughtterminalsettextcolor Then
|
||||
Select Case args(2)
|
||||
Case "black"
|
||||
AddLine("Error! Black and black don't go too well...")
|
||||
Case "white"
|
||||
txtterm.ForeColor = Color.White
|
||||
Case "gray"
|
||||
If boughtgray Then
|
||||
txtterm.ForeColor = Color.Gray
|
||||
Else
|
||||
AddLine("Error! Unsupported color.")
|
||||
End If
|
||||
Case "red"
|
||||
If boughtred Then
|
||||
txtterm.ForeColor = Color.Red
|
||||
Else
|
||||
AddLine("Error! Unsupported color.")
|
||||
End If
|
||||
Case "green"
|
||||
If boughtgreen Then
|
||||
txtterm.ForeColor = Color.Green
|
||||
Else
|
||||
AddLine("Error! Unsupported color.")
|
||||
End If
|
||||
Case "blue"
|
||||
If boughtblue Then
|
||||
txtterm.ForeColor = Color.Blue
|
||||
Else
|
||||
AddLine("Error! Unsupported color.")
|
||||
End If
|
||||
Case "yellow"
|
||||
If boughtyellow Then
|
||||
txtterm.ForeColor = Color.Yellow
|
||||
Else
|
||||
AddLine("Error! Unsupported color.")
|
||||
End If
|
||||
Case "orange"
|
||||
If boughtorange Then
|
||||
txtterm.ForeColor = Color.Orange
|
||||
Else
|
||||
AddLine("Error! Unsupported color.")
|
||||
End If
|
||||
Case "pink"
|
||||
If boughtpink Then
|
||||
txtterm.ForeColor = Color.Pink
|
||||
Else
|
||||
AddLine("Error! Unsupported color.")
|
||||
End If
|
||||
Case "purple"
|
||||
If boughtpurple Then
|
||||
txtterm.ForeColor = Color.Purple
|
||||
Else
|
||||
AddLine("Error! Unsupported color.")
|
||||
End If
|
||||
Case "brown"
|
||||
If boughtbrown Then
|
||||
txtterm.ForeColor = Color.Brown
|
||||
Else
|
||||
AddLine("Error! Unsupported color.")
|
||||
End If
|
||||
Case Else
|
||||
AddLine("Error! Unsupported color, check 'colors' for a list of supported colors.")
|
||||
End Select
|
||||
End If
|
||||
Case Else
|
||||
AddLine("set: No valid setting node in configuration file for """ & args(1) & """.")
|
||||
End Select
|
||||
ElseIf command Like "open *" Then
|
||||
Dim progtoopen As String = command.Replace("open ", "")
|
||||
Select Case progtoopen
|
||||
Case "shiftorium", "packages", "pacman", "code shop"
|
||||
shiftorium_cmd.Show()
|
||||
Case Else
|
||||
AddLine("open: Invalid program """ & progtoopen & """.")
|
||||
End Select
|
||||
ElseIf command Like "shutdown" Then
|
||||
savegame()
|
||||
Me.Close()
|
||||
ElseIf command = "colors" Then
|
||||
ShowTerminalColors()
|
||||
ElseIf command Like "" Then
|
||||
'This is here to make it so that the Terminal doesn't say "Wrong Command" if the user doesn't input anything.
|
||||
Else
|
||||
AddLine("Invalid command! Type ""help"" for a list of commands.")
|
||||
wrongcommand()
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Public Sub wrongcommand()
|
||||
AddLine("Invalid command! Type ""help"" for a list of commands.")
|
||||
End Sub
|
||||
|
||||
Public Sub showterminalcolors()
|
||||
AddLine(" ==== SUPPORTED TERMINAL COLORS ==== " & vbNewLine)
|
||||
AddLine("Below is a list of values that you can specify in <colorname> arguments. Note that only certain colors are supported; and if the video driver can output a color but it isn't on this list, it is not supported by the Terminal display engine." & vbNewLine)
|
||||
If boughtgray Then AddLine("gray")
|
||||
AddLine("white")
|
||||
AddLine("black")
|
||||
If boughtred Then AddLine("red")
|
||||
If boughtgreen Then AddLine("green")
|
||||
If boughtblue Then AddLine("blue")
|
||||
If boughtyellow Then AddLine("yellow")
|
||||
If boughtorange Then AddLine("orange")
|
||||
If boughtpink Then AddLine("pink")
|
||||
If boughtpurple Then AddLine("purple")
|
||||
If boughtbrown Then AddLine("brown")
|
||||
End Sub
|
||||
|
||||
Public Sub ShowHelp()
|
||||
AddLine("ShiftOS Help" & vbNewLine)
|
||||
AddLine("Usage tips: " & vbNewLine)
|
||||
AddLine(" - The terminal runs in full-screen.")
|
||||
AddLine(" - There are no window managers or desktop environments.")
|
||||
If boughtbasicgui = True Then
|
||||
AddLine(" - Applications can use the GUI server to display a proper GUI.")
|
||||
Else
|
||||
AddLine(" - Applications are fully text-based.")
|
||||
AddLine(" - Terminal commands are case-insensitive.")
|
||||
AddLine(" - The screen can only display Black and White." & vbNewLine)
|
||||
End If
|
||||
AddLine(" - Terminal commands are case-insensitive." & vbNewLine)
|
||||
AddLine("Commands: " & vbNewLine)
|
||||
If boughtdirectorysurfing Then
|
||||
AddLine(" - cd: Change to the specified directory.")
|
||||
AddLine(" - mkdir: Create a directory inside the current directory (marked before the %)")
|
||||
AddLine(" - ls, dir: View the contents of the current directory.")
|
||||
End If
|
||||
If boughtbasicsettings Then
|
||||
AddLine(" - set <setting> <value>: Change some minimal settings in ShiftOS.")
|
||||
If boughtcustomusername Then
|
||||
AddLine(" Settings: ")
|
||||
AddLine(" username <string>: Set the username of the OS.")
|
||||
End If
|
||||
If boughtterminalsettextcolor = True Then
|
||||
AddLine(" textcolor <colorname>: Set the terminal text color.")
|
||||
End If
|
||||
End If
|
||||
AddLine(" - shutdown: Shuts the system down.")
|
||||
AddLine(" - help: Shows this screen.")
|
||||
|
||||
|
||||
AddLine(" - colors: Shows the colors supported by both the Terminal display engine, and the video driver.")
|
||||
AddLine(" - help: Shows this screen." & vbNewLine)
|
||||
AddLine("Installed Programs:" & vbNewLine)
|
||||
AddLine("Below is a list of all the programs on your computer, followed by what they do. You can open one by typing ""open <name>""." & vbNewLine)
|
||||
AddLine(" - shiftorium: Upgrade the OS with Codepoints using this application.")
|
||||
End Sub
|
||||
|
||||
Public Sub AddLine(text As String)
|
||||
|
@ -116,6 +263,8 @@
|
|||
End Sub
|
||||
|
||||
Private Sub txtterm_KeyDown(sender As Object, e As KeyEventArgs) Handles txtterm.KeyDown
|
||||
If prompttoupdatesave = False Then
|
||||
|
||||
Select Case e.KeyCode
|
||||
Case Keys.ShiftKey
|
||||
trackpos = trackpos - 1
|
||||
|
@ -150,15 +299,15 @@
|
|||
|
||||
If e.KeyCode = Keys.Enter Then
|
||||
e.SuppressKeyPress = True
|
||||
Dim command As String = txtterm.Lines(txtterm.Lines.Length - 1).Replace("user@shiftos " & currentdir.ToLower.Replace("c:\shiftos", "~") & "$> ", "").ToLower
|
||||
Dim command As String = txtterm.Lines(txtterm.Lines.Length - 1).Replace(username + "@" + osname + " " & currentdir.ToLower.Replace("c:\shiftos", "~") & "$> ", "").ToLower
|
||||
Interpret(command)
|
||||
|
||||
If command = "clear" Then
|
||||
txtterm.Text = "user@shiftos " & currentdir.ToLower.Replace("c:\shiftos", "~") & "$> "
|
||||
txtterm.Text = username + "@" + osname + " " & currentdir.ToLower.Replace("c:\shiftos", "~") & "$> "
|
||||
txtterm.Select(txtterm.Text.Length, 0)
|
||||
|
||||
Else
|
||||
AddLine("user@shiftos " & currentdir.ToLower.Replace("c:\shiftos", "~") & "$> ")
|
||||
AddLine(username + "@" + osname + " " & currentdir.ToLower.Replace("c:\shiftos", "~") & "$> ")
|
||||
txtterm.Select(txtterm.Text.Length, 0)
|
||||
End If
|
||||
|
||||
|
@ -183,5 +332,13 @@
|
|||
End If
|
||||
|
||||
SelectBottom()
|
||||
Else
|
||||
e.SuppressKeyPress = True
|
||||
savegame()
|
||||
loadgame()
|
||||
AddLine("Self-repair complete with no errors.")
|
||||
prompttoupdatesave = False
|
||||
AddLine(username + "@" + osname + " " & currentdir.ToLower.Replace("c:\shiftos", "~") & "$> ")
|
||||
End If
|
||||
End Sub
|
||||
End Class
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -2,7 +2,21 @@
|
|||
'Core for Save Engine
|
||||
|
||||
Public username As String = "user"
|
||||
Public osname As String = "shiftos"
|
||||
|
||||
'
|
||||
' NEWER UPGRADES: These are partly from UltraDOS, partially from Orion, and a few others created just for this project.
|
||||
'
|
||||
|
||||
Public boughtdirectorysurfing As Boolean = False
|
||||
Public boughtbasicsettings As Boolean = False
|
||||
Public boughtbasicgui As Boolean = False
|
||||
Public boughtterminalsettextcolor As Boolean = False
|
||||
|
||||
|
||||
'
|
||||
' OLD SHIFTOS UPGRADES: These upgrades may be useful, so I've added them.
|
||||
'
|
||||
|
||||
'Shiftorium Upgrades
|
||||
Public boughttitlebar As Boolean = False
|
||||
|
@ -273,6 +287,13 @@
|
|||
If boughtpink2 = True Then savelines(81) = 11 Else savelines(81) = 10
|
||||
If boughtpink3 = True Then savelines(82) = 11 Else savelines(82) = 10
|
||||
If boughtpink4 = True Then savelines(83) = 11 Else savelines(83) = 10
|
||||
If boughtdirectorysurfing = True Then savelines(84) = 11 Else savelines(84) = 10
|
||||
savelines(85) = osname
|
||||
If boughtbasicsettings = True Then savelines(86) = 11 Else savelines(86) = 10
|
||||
If boughtbasicgui = True Then savelines(87) = 11 Else savelines(87) = 10
|
||||
If boughtterminalsettextcolor = True Then savelines(88) = 11 Else savelines(88) = 10
|
||||
|
||||
|
||||
|
||||
'Large gap in file. Add new features here.
|
||||
|
||||
|
@ -382,7 +403,8 @@
|
|||
|
||||
|
||||
|
||||
Private Sub loadgame()
|
||||
Public Sub loadgame()
|
||||
Try
|
||||
Dim loadlines() As String = IO.File.ReadAllLines(save)
|
||||
If loadlines(0) = 11 Then boughttitlebar = True Else boughttitlebar = False
|
||||
If loadlines(1) = 11 Then boughtgray = True Else boughtgray = False
|
||||
|
@ -467,6 +489,18 @@
|
|||
If loadlines(81) = 11 Then boughtpink2 = True Else boughtpink2 = False
|
||||
If loadlines(82) = 11 Then boughtpink3 = True Else boughtpink3 = False
|
||||
If loadlines(83) = 11 Then boughtpink4 = True Else boughtpink4 = False
|
||||
If loadlines(84) = 11 Then boughtdirectorysurfing = True Else boughtdirectorysurfing = False
|
||||
osname = loadlines(85)
|
||||
If loadlines(86) = 11 Then boughtbasicsettings = True Else boughtbasicsettings = False
|
||||
If loadlines(87) = 11 Then boughtbasicgui = True Else boughtbasicgui = False
|
||||
If loadlines(88) = 11 Then boughtterminalsettextcolor = True Else boughtterminalsettextcolor = False
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
'Add appropriate features here.
|
||||
|
||||
|
@ -568,7 +602,9 @@
|
|||
virusscannergrade = loadlines(511)
|
||||
If loadlines(512) = 11 Then boughttextpadtrm = True Else boughttextpadtrm = False
|
||||
If loadlines(513) = 11 Then boughtshiftapplauncheritems = True Else boughtshiftapplauncheritems = False
|
||||
|
||||
Catch ex As Exception
|
||||
Terminal.prompttoupdatesave = True
|
||||
End Try
|
||||
End Sub
|
||||
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
Module shiftorium_api
|
||||
'API for Shiftorium Applications.
|
||||
|
||||
Public listboxtoaddto As ListBox
|
||||
Public codepoints As Integer
|
||||
|
||||
Public Sub DeductCP(ammount As Integer)
|
||||
|
@ -12,4 +13,9 @@
|
|||
codepoints += ammount
|
||||
savegame()
|
||||
End Sub
|
||||
|
||||
Public Sub AddItem(name As String, CP As Integer)
|
||||
listboxtoaddto.Items.Add(name & " - " & CP & " CP")
|
||||
End Sub
|
||||
|
||||
End Module
|
||||
|
|
93
shiftos_next/shiftorium_cmd.Designer.vb
generated
93
shiftos_next/shiftorium_cmd.Designer.vb
generated
|
@ -25,12 +25,19 @@ Partial Class shiftorium_cmd
|
|||
Me.pnltop = New System.Windows.Forms.Panel()
|
||||
Me.Label1 = New System.Windows.Forms.Label()
|
||||
Me.pnlbottom = New System.Windows.Forms.Panel()
|
||||
Me.lbcontrols = New System.Windows.Forms.Label()
|
||||
Me.lbcodepoints = New System.Windows.Forms.Label()
|
||||
Me.lbcontrols = New System.Windows.Forms.Label()
|
||||
Me.pnldetails = New System.Windows.Forms.Panel()
|
||||
Me.lbitems = New System.Windows.Forms.ListBox()
|
||||
Me.lbitemname = New System.Windows.Forms.Label()
|
||||
Me.lbdescription = New System.Windows.Forms.Label()
|
||||
Me.pnlbuy = New System.Windows.Forms.Panel()
|
||||
Me.lbprice = New System.Windows.Forms.Label()
|
||||
Me.btnbuy = New System.Windows.Forms.Button()
|
||||
Me.pnltop.SuspendLayout()
|
||||
Me.pnlbottom.SuspendLayout()
|
||||
Me.pnldetails.SuspendLayout()
|
||||
Me.pnlbuy.SuspendLayout()
|
||||
Me.SuspendLayout()
|
||||
'
|
||||
'pnltop
|
||||
|
@ -62,16 +69,6 @@ Partial Class shiftorium_cmd
|
|||
Me.pnlbottom.Size = New System.Drawing.Size(1007, 22)
|
||||
Me.pnlbottom.TabIndex = 1
|
||||
'
|
||||
'lbcontrols
|
||||
'
|
||||
Me.lbcontrols.Dock = System.Windows.Forms.DockStyle.Left
|
||||
Me.lbcontrols.Location = New System.Drawing.Point(0, 0)
|
||||
Me.lbcontrols.Name = "lbcontrols"
|
||||
Me.lbcontrols.Size = New System.Drawing.Size(815, 22)
|
||||
Me.lbcontrols.TabIndex = 0
|
||||
Me.lbcontrols.Text = "Controls: UP/DOWN - Choose item, ENTER - View details, SPACE: Download"
|
||||
Me.lbcontrols.TextAlign = System.Drawing.ContentAlignment.MiddleLeft
|
||||
'
|
||||
'lbcodepoints
|
||||
'
|
||||
Me.lbcodepoints.Dock = System.Windows.Forms.DockStyle.Fill
|
||||
|
@ -82,8 +79,21 @@ Partial Class shiftorium_cmd
|
|||
Me.lbcodepoints.Text = "Codepoints: {0}"
|
||||
Me.lbcodepoints.TextAlign = System.Drawing.ContentAlignment.MiddleRight
|
||||
'
|
||||
'lbcontrols
|
||||
'
|
||||
Me.lbcontrols.Dock = System.Windows.Forms.DockStyle.Left
|
||||
Me.lbcontrols.Location = New System.Drawing.Point(0, 0)
|
||||
Me.lbcontrols.Name = "lbcontrols"
|
||||
Me.lbcontrols.Size = New System.Drawing.Size(815, 22)
|
||||
Me.lbcontrols.TabIndex = 0
|
||||
Me.lbcontrols.Text = "Controls: UP/DOWN - Choose item, ENTER - View details, SPACE: Download"
|
||||
Me.lbcontrols.TextAlign = System.Drawing.ContentAlignment.MiddleLeft
|
||||
'
|
||||
'pnldetails
|
||||
'
|
||||
Me.pnldetails.Controls.Add(Me.pnlbuy)
|
||||
Me.pnldetails.Controls.Add(Me.lbdescription)
|
||||
Me.pnldetails.Controls.Add(Me.lbitemname)
|
||||
Me.pnldetails.Dock = System.Windows.Forms.DockStyle.Top
|
||||
Me.pnldetails.Location = New System.Drawing.Point(0, 30)
|
||||
Me.pnldetails.Name = "pnldetails"
|
||||
|
@ -103,6 +113,60 @@ Partial Class shiftorium_cmd
|
|||
Me.lbitems.Size = New System.Drawing.Size(1007, 335)
|
||||
Me.lbitems.TabIndex = 3
|
||||
'
|
||||
'lbitemname
|
||||
'
|
||||
Me.lbitemname.Dock = System.Windows.Forms.DockStyle.Top
|
||||
Me.lbitemname.Location = New System.Drawing.Point(0, 0)
|
||||
Me.lbitemname.Name = "lbitemname"
|
||||
Me.lbitemname.Size = New System.Drawing.Size(1007, 28)
|
||||
Me.lbitemname.TabIndex = 0
|
||||
Me.lbitemname.Text = "Welcome to the Shiftorium!"
|
||||
Me.lbitemname.TextAlign = System.Drawing.ContentAlignment.MiddleCenter
|
||||
'
|
||||
'lbdescription
|
||||
'
|
||||
Me.lbdescription.Dock = System.Windows.Forms.DockStyle.Fill
|
||||
Me.lbdescription.Location = New System.Drawing.Point(0, 28)
|
||||
Me.lbdescription.Name = "lbdescription"
|
||||
Me.lbdescription.Size = New System.Drawing.Size(1007, 177)
|
||||
Me.lbdescription.TabIndex = 1
|
||||
Me.lbdescription.Text = "The Shiftorium lets you upgrade different aspects of ShiftOS using Codepoints. Yo" & _
|
||||
"u can download anything from color support, terminal commands, programs, and eve" & _
|
||||
"n desktop environments."
|
||||
Me.lbdescription.TextAlign = System.Drawing.ContentAlignment.MiddleCenter
|
||||
'
|
||||
'pnlbuy
|
||||
'
|
||||
Me.pnlbuy.Controls.Add(Me.btnbuy)
|
||||
Me.pnlbuy.Controls.Add(Me.lbprice)
|
||||
Me.pnlbuy.Dock = System.Windows.Forms.DockStyle.Bottom
|
||||
Me.pnlbuy.Location = New System.Drawing.Point(0, 176)
|
||||
Me.pnlbuy.Name = "pnlbuy"
|
||||
Me.pnlbuy.Size = New System.Drawing.Size(1007, 29)
|
||||
Me.pnlbuy.TabIndex = 2
|
||||
'
|
||||
'lbprice
|
||||
'
|
||||
Me.lbprice.Dock = System.Windows.Forms.DockStyle.Left
|
||||
Me.lbprice.Location = New System.Drawing.Point(0, 0)
|
||||
Me.lbprice.Name = "lbprice"
|
||||
Me.lbprice.Size = New System.Drawing.Size(815, 29)
|
||||
Me.lbprice.TabIndex = 0
|
||||
Me.lbprice.Text = "This item costs {0} Codepoints."
|
||||
Me.lbprice.TextAlign = System.Drawing.ContentAlignment.MiddleLeft
|
||||
'
|
||||
'btnbuy
|
||||
'
|
||||
Me.btnbuy.Dock = System.Windows.Forms.DockStyle.Fill
|
||||
Me.btnbuy.FlatAppearance.BorderSize = 0
|
||||
Me.btnbuy.FlatStyle = System.Windows.Forms.FlatStyle.Flat
|
||||
Me.btnbuy.Location = New System.Drawing.Point(815, 0)
|
||||
Me.btnbuy.Name = "btnbuy"
|
||||
Me.btnbuy.Size = New System.Drawing.Size(192, 29)
|
||||
Me.btnbuy.TabIndex = 1
|
||||
Me.btnbuy.Text = "Press SPACE to buy"
|
||||
Me.btnbuy.UseVisualStyleBackColor = True
|
||||
'
|
||||
'shiftorium_cmd
|
||||
'
|
||||
Me.AutoScaleDimensions = New System.Drawing.SizeF(7.0!, 14.0!)
|
||||
|
@ -121,6 +185,8 @@ Partial Class shiftorium_cmd
|
|||
Me.WindowState = System.Windows.Forms.FormWindowState.Maximized
|
||||
Me.pnltop.ResumeLayout(False)
|
||||
Me.pnlbottom.ResumeLayout(False)
|
||||
Me.pnldetails.ResumeLayout(False)
|
||||
Me.pnlbuy.ResumeLayout(False)
|
||||
Me.ResumeLayout(False)
|
||||
|
||||
End Sub
|
||||
|
@ -131,4 +197,9 @@ Partial Class shiftorium_cmd
|
|||
Friend WithEvents lbcontrols As System.Windows.Forms.Label
|
||||
Friend WithEvents pnldetails As System.Windows.Forms.Panel
|
||||
Friend WithEvents lbitems As System.Windows.Forms.ListBox
|
||||
Friend WithEvents pnlbuy As System.Windows.Forms.Panel
|
||||
Friend WithEvents btnbuy As System.Windows.Forms.Button
|
||||
Friend WithEvents lbprice As System.Windows.Forms.Label
|
||||
Friend WithEvents lbdescription As System.Windows.Forms.Label
|
||||
Friend WithEvents lbitemname As System.Windows.Forms.Label
|
||||
End Class
|
||||
|
|
|
@ -1,3 +1,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
|
Loading…
Reference in a new issue