Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
xsd:complexType
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
xsd:complexType
xsd:sequence
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
xsd:complexType
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
xsd:complexType
xsd:sequence
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
xsd:complexType
xsd:sequence
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
text/microsoft-resx
2.0
System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
32, 9
186, 9
AAEAAAD/////AQAAAAAAAAAMAgAAAEZTeXN0ZW0uV2luZG93cy5Gb3JtcywgQ3VsdHVyZT1uZXV0cmFs
LCBQdWJsaWNLZXlUb2tlbj1iNzdhNWM1NjE5MzRlMDg5BQ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1Af8B
HQHmAbUB/wEdAeYBtQH/AR0B5gG1Af8BHQHmAbUB/wEdAeYBtQH/AR0B5gG1Af8BDwFzAVsB/wMAAf8B
6gHZAZkB/wHqAdkBmQH/AeoB2QGZAf8B6gHZAZkB/wHqAdkBmQH/AeoB2QGZAf8B6gHZAZkB/wHqAdkB
mQH/AeoB2QGZAf8B6gHZAZkB/wHqAdkBmQH/AeoB2QGZAf8B6gHZAZkB/wHqAdkBmQH/AXUBbQFNAf8D
AAH/AwAB/wMAAf8DAAH/AwAB/wMAAf8DAAH/AwAB/wMAAf8DAAH/AwAB/wMAAf8DAAH/AwAB/wMAAf8D
AAH/AwAB/wMAAf8DAAH/AwAB/wMAAf8DAAH/AwAB/wMAAf8DAAH/AwAB/wMAAf8DAAH/AwAB/wMAAf8D
AAH/AwAB/wMAAf8DAAH/AwAB/wMAAf8DAAH/AwAB/wMAAf8DAAH/AwAB/wMAAf8DAAH/AwAB/wMAAf8D
AAH/AwAB/wMAAf8DAAH/AwAB/wMAAf8DAAH/AwAB/wMAAf8DAAH/AwAB/wMAAf8DAAH/AwAB/wMAAf8D
AAH/AwAB/wMAAf8DAAH/AUIBTQE+BwABPgMAASgDAAFAAwABIAMAAQEBAAEBBgABARYAA///AAIACw==
Public Class FrmTriggerEditor
Inherits Form
' Properties for SQCOUNTX and SQCOUNTY
Public Property SQCOUNTX As Integer
Public Property SQCOUNTY As Integer
' Trigger data object
Public Property triggerData As New List(Of Triggers)
' Local variables for trigger details
Private triggeringItem As String
Private triggeringPoint As Point
Private triggerItemToCreate As String
Private triggerItemToRemove As String
Private triggerActionPoint As Point
Private triggerItemToCreateIsHorizontalWall As Boolean
Private triggerItemToCreateIsVerticalWall As Boolean
Private triggerItemToRemoveIsHorizontalWall As Boolean
Private triggerItemToRemoveIsVerticalWall As Boolean
Private TriggerIsWall As Boolean
Private triggerItemToExplode As String ' Add this property
Public Property AllowFloorSelectionOnly As Boolean = False
Public Property AllowWallSelectionOnly As Boolean = False
' Constructor to accept triggerData
Public Sub New(Optional ByVal initialTriggerData As List(Of Triggers) = Nothing)
InitializeComponent()
If initialTriggerData IsNot Nothing Then
triggerData = initialTriggerData
End If
End Sub
Private Sub FrmTriggerEditor_Load(sender As Object, e As EventArgs) Handles MyBase.Load
lstTriggerAction.Enabled = False
lstItemToCreate.Enabled = False
btnCreate.Enabled = False
' Enable owner-drawn nodes
trvTriggers.DrawMode = TreeViewDrawMode.OwnerDrawText
AddHandler trvTriggers.DrawNode, AddressOf trvTriggers_DrawNode
' Associate the ContextMenuStrip with the TreeView
trvTriggers.ContextMenuStrip = ctmTriggerOptions
' Populate trvTriggers with existing triggers
PopulateTriggersTreeView()
' Add handler for MouseDown event
AddHandler trvTriggers.MouseDown, AddressOf trvTriggers_MouseDown
End Sub
Private Sub trvTriggers_DrawNode(sender As Object, e As DrawTreeNodeEventArgs)
' Get the node text
Dim nodeText As String = e.Node.Text
' Measure the full width of the node text
Dim textSize As SizeF = e.Graphics.MeasureString(nodeText, e.Node.TreeView.Font)
Dim padding As Integer = 20 ' Add padding to cover the entire text
Dim adjustedBounds As New Rectangle(e.Bounds.X, e.Bounds.Y, CInt(textSize.Width) + padding, e.Bounds.Height)
' Apply formatting to the node text
ApplyFormattingToNode(e.Graphics, nodeText, adjustedBounds)
End Sub
Private Sub ApplyFormatting(rtb As RichTextBox, ParamArray items() As Object)
rtb.SelectionStart = 0
rtb.SelectionLength = rtb.Text.Length
rtb.SelectionColor = Color.Black
rtb.SelectionFont = New Font(rtb.Font, FontStyle.Regular)
For Each item In items
If TypeOf item Is String Then
Dim text As String = CType(item, String)
Dim startIndex As Integer = rtb.Text.IndexOf(text)
While startIndex >= 0
rtb.SelectionStart = startIndex
rtb.SelectionLength = text.Length
rtb.SelectionColor = Color.Green
rtb.SelectionFont = New Font(rtb.Font, FontStyle.Bold)
startIndex = rtb.Text.IndexOf(text, startIndex + text.Length)
End While
ElseIf TypeOf item Is Point Then
Dim point As Point = item
Dim pointText As String = $"{point}"
Dim startIndex As Integer = rtb.Text.IndexOf(pointText)
While startIndex >= 0
rtb.SelectionStart = startIndex
rtb.SelectionLength = pointText.Length
rtb.SelectionColor = Color.Blue
rtb.SelectionFont = New Font(rtb.Font, FontStyle.Italic)
startIndex = rtb.Text.IndexOf(pointText, startIndex + pointText.Length)
End While
End If
Next
End Sub
Private Sub ApplyFormattingToNode(graphics As Graphics, nodeText As String, bounds As Rectangle)
' Define the fonts and colors
Dim regularFont As Font = trvTriggers.Font
Dim boldFont As New Font(regularFont, FontStyle.Bold)
Dim italicFont As New Font(regularFont, FontStyle.Italic)
Dim darkRedBrush As New SolidBrush(Color.DarkRed)
Dim blueBrush As New SolidBrush(Color.Blue)
Dim blackBrush As New SolidBrush(Color.Black)
' Define the keywords to format
Dim triggeringItemKeywords As String() = {"Player", "Enemy", "Item", "Block", "Baddy"} ' Add other triggering items as needed
Dim triggerItemToRemoveKeywords As String() = {"Coin", "Bomb", "Key", "Gate", "picKey"} ' Add other items to remove as needed
' Split the text into words
Dim words As String() = nodeText.Split(" "c)
Dim x As Single = bounds.X
Dim y As Single = bounds.Y
For Each word As String In words
Dim currentBrush As Brush = blackBrush
Dim currentFont As Font = regularFont
If triggeringItemKeywords.Contains(word) OrElse triggerItemToRemoveKeywords.Contains(word) Then
currentBrush = darkRedBrush
currentFont = boldFont
ElseIf word.Contains("{X=") OrElse word.Contains("{Y=") Then
currentBrush = blueBrush
currentFont = italicFont
End If
' Draw the word
graphics.DrawString(word, currentFont, currentBrush, x, y)
' Measure the width of the word
Dim wordWidth As Single = graphics.MeasureString(word, currentFont).Width
x += wordWidth
Next
End Sub
Private Sub PopulateTriggersTreeView()
trvTriggers.Nodes.Clear()
For Each trigger As Triggers In triggerData
Dim node As New TreeNode(trigger.TriggerFull)
Dim unused = trvTriggers.Nodes.Add(node)
Next
End Sub
Private Sub lstTriggeringItem_SelectedIndexChanged(sender As Object, e As EventArgs) Handles lstTriggeringItem.SelectedIndexChanged
If lstTriggeringItem.SelectedItem IsNot Nothing Then
triggeringItem = lstTriggeringItem.SelectedItem.ToString()
' Enable selection mode in FrmDesigner
FrmDesigner.SelectionMode = True
FrmDesigner.SelectionRequestedByForm = Me
FrmDesigner.SelectionRequestedFor = "TriggeringPoint"
' Set the selection constraint
AllowFloorSelectionOnly = True
AllowWallSelectionOnly = False
' Show FrmDesigner and bring it to the foreground
FrmDesigner.Show()
Dim unused = FrmDesigner.Focus()
' Temporarily disable FrmTriggerEditor
Enabled = False
' Disable other controls
lstItemToCreate.Enabled = False
lstRegion.Enabled = False
lstItemsToClear.Enabled = False
lstItemsToFill.Enabled = False
btnCreate.Enabled = False
' Update rtbTriggers
Dim triggerText As String = $"When {GetItemFullName(triggeringItem)} enters cell... Please select a Triggering Point..."
rtbTriggers.Text = triggerText
ApplyFormatting(rtbTriggers, GetItemFullName(triggeringItem))
End If
End Sub
Public Sub SetTriggeringPoint(point As Point)
triggeringPoint = point
Dim triggerText = If(triggeringItem = "Player",
$"When the player enters cell {triggeringPoint}... Please select a Trigger Action...",
$"When a {GetItemFullName(triggeringItem)} enters cell {triggeringPoint}... Please select a Trigger Action...")
' Apply formatting
rtbTriggers.Text = triggerText
ApplyFormatting(rtbTriggers, GetItemFullName(triggeringItem), triggeringPoint)
lstTriggerAction.Enabled = True
lstItemToCreate.Enabled = False
btnCreate.Enabled = False
' Re-enable FrmTriggerEditor and bring it to the foreground
Enabled = True
Dim unused = Focus()
End Sub
Private Sub lstRegion_SelectedIndexChanged(sender As Object, e As EventArgs) Handles lstRegion.SelectedIndexChanged
If lstRegion.SelectedItem IsNot Nothing Then
If lstTriggerAction.SelectedItem.ToString() = "Clear Region" Then
lstItemsToClear.Enabled = True
lstItemsToFill.Enabled = False
ElseIf lstTriggerAction.SelectedItem.ToString() = "Fill Region" Then
lstItemsToFill.Enabled = True
lstItemsToClear.Enabled = False
Else
lstItemsToClear.Enabled = False
lstItemsToFill.Enabled = False
End If
' Update rtbTriggers
Dim triggerText As String = $"When {GetItemFullName(triggeringItem)} enters cell {triggeringPoint}, {lstTriggerAction.SelectedItem} {lstRegion.SelectedItem}... Please select items to {lstTriggerAction.SelectedItem.ToString().ToLower()}..."
rtbTriggers.Text = triggerText
ApplyFormatting(rtbTriggers, GetItemFullName(triggeringItem), triggeringPoint, lstRegion.SelectedItem.ToString())
End If
End Sub
Private Sub lstItemsToClear_SelectedIndexChanged(sender As Object, e As EventArgs) Handles lstItemsToClear.SelectedIndexChanged
If lstItemsToClear.SelectedItem IsNot Nothing Then
btnCreate.Enabled = True
' Update rtbTriggers
Dim triggerText As String = $"When {GetItemFullName(triggeringItem)} enters cell {triggeringPoint}, clear {lstItemsToClear.SelectedItem} from {lstRegion.SelectedItem}."
rtbTriggers.Text = triggerText
ApplyFormatting(rtbTriggers, GetItemFullName(triggeringItem), triggeringPoint, lstItemsToClear.SelectedItem.ToString(), lstRegion.SelectedItem.ToString())
End If
End Sub
Private Sub lstRegion_DrawItem(sender As Object, e As DrawItemEventArgs) Handles lstRegion.DrawItem
If e.Index < 0 Then Return
' Draw the background of the item.
e.DrawBackground()
' Determine the color based on whether the listbox is enabled
Dim textColor As Color = If(lstRegion.Enabled, e.ForeColor, Color.Gray)
' Draw the icon (if available)
Dim imageList As ImageList = RegionIcons ' Assuming your ImageList is named RegionIcons
Dim iconWidth As Integer
Dim iconHeight As Integer
Dim iconTop As Integer
If imageList IsNot Nothing AndAlso e.Index < imageList.Images.Count Then
iconWidth = imageList.ImageSize.Width
iconHeight = imageList.ImageSize.Height
' Center the icon vertically
iconTop = e.Bounds.Top + ((e.Bounds.Height - iconHeight) \ 2)
imageList.Draw(e.Graphics, e.Bounds.Left, iconTop, e.Index)
Else
' No icon, set iconWidth and iconHeight to 0
iconWidth = 0
iconHeight = 0
iconTop = e.Bounds.Top
End If
' Calculate the position for the text (after the icon)
Dim gapWidth As Integer = 2 ' Adjust the gap between the icon and the text
Dim textX As Integer = e.Bounds.Left + iconWidth + gapWidth
' Measure the height of the text
Dim text As String = lstRegion.Items(e.Index).ToString()
Dim textSize As Size = TextRenderer.MeasureText(text, e.Font)
' Center the text vertically based on the icon's position and size
Dim textY As Integer = iconTop + ((iconHeight - textSize.Height) \ 2)
' Draw the text
TextRenderer.DrawText(e.Graphics, text, e.Font, New Point(textX, textY), textColor)
' Draw the focus rectangle if the item is selected.
e.DrawFocusRectangle()
End Sub
Private Sub lstItemsToFill_SelectedIndexChanged(sender As Object, e As EventArgs) Handles lstItemsToFill.SelectedIndexChanged
If lstItemsToFill.SelectedItem IsNot Nothing Then
btnCreate.Enabled = True
' Update rtbTriggers
Dim triggerText As String = $"When {GetItemFullName(triggeringItem)} enters cell {triggeringPoint}, fill {lstRegion.SelectedItem} with {lstItemsToFill.SelectedItem}."
rtbTriggers.Text = triggerText
ApplyFormatting(rtbTriggers, GetItemFullName(triggeringItem), triggeringPoint, lstItemsToFill.SelectedItem.ToString(), lstRegion.SelectedItem.ToString())
End If
End Sub
Private Sub lstTriggerAction_SelectedIndexChanged(sender As Object, e As EventArgs) Handles lstTriggerAction.SelectedIndexChanged
If lstTriggerAction.SelectedItem IsNot Nothing Then
Dim actionText As String = String.Empty
' Reset selection constraints
AllowFloorSelectionOnly = False
AllowWallSelectionOnly = False
' Disable other controls
lstItemToCreate.Enabled = False
lstRegion.Enabled = False
lstItemsToClear.Enabled = False
lstItemsToFill.Enabled = False
btnCreate.Enabled = False
Select Case lstTriggerAction.SelectedItem.ToString()
Case "Clear Region"
lstRegion.Enabled = True
Case "Fill Region"
lstRegion.Enabled = True
Case "Create"
actionText = If(triggeringItem = "Player",
$"When the player enters cell {triggeringPoint}, create a... Please select an item to create...",
$"When {GetItemFullName(triggeringItem)} enters cell {triggeringPoint}, create a... Please select an item to create...")
lstItemToCreate.Enabled = True
btnCreate.Enabled = False
Case "Remove"
' Enable selection mode in FrmDesigner
FrmDesigner.SelectionMode = True
FrmDesigner.SelectionRequestedByForm = Me
FrmDesigner.SelectionRequestedFor = "TriggerItemToRemove"
' Show FrmDesigner and bring it to the foreground
FrmDesigner.Show()
Dim unused1 = FrmDesigner.Focus()
' Temporarily disable FrmTriggerEditor
Enabled = False
Case "Explode"
' Enable selection mode in FrmDesigner
FrmDesigner.SelectionMode = True
FrmDesigner.SelectionRequestedByForm = Me
FrmDesigner.SelectionRequestedFor = "TriggerItemToExplode"
' Show FrmDesigner and bring it to the foreground
FrmDesigner.Show()
Dim unused = FrmDesigner.Focus()
' Temporarily disable FrmTriggerEditor
Enabled = False
Case "Flip Horizontal"
actionText = If(triggeringItem = "Player",
$"When the player enters cell {triggeringPoint}, flip the game horizontally.",
$"When {GetItemFullName(triggeringItem)} enters cell {triggeringPoint}, flip the game horizontally.")
btnCreate.Enabled = True
Case "Flip Vertical"
actionText = If(triggeringItem = "Player",
$"When the player enters cell {triggeringPoint}, flip the game vertically.",
$"When {GetItemFullName(triggeringItem)} enters cell {triggeringPoint}, flip the game vertically.")
btnCreate.Enabled = True
End Select
' Apply formatting
rtbTriggers.Text = actionText
ApplyFormatting(rtbTriggers, GetItemFullName(triggeringItem), triggeringPoint)
End If
End Sub
Private Sub lstItemToCreate_SelectedIndexChanged(sender As Object, e As EventArgs) Handles lstItemToCreate.SelectedIndexChanged
If lstItemToCreate.SelectedItem IsNot Nothing Then
triggerItemToCreate = lstItemToCreate.SelectedItem.ToString()
' Enable selection mode in FrmDesigner
FrmDesigner.SelectionMode = True
FrmDesigner.SelectionRequestedByForm = Me
FrmDesigner.SelectionRequestedFor = "TriggerActionPoint"
' Set the selection constraint based on the item
Select Case triggerItemToCreate
Case "Wall", "Flipper Left", "Flipper Right", "Flipper Up", "Flipper Down", "Vertical Laser", "Horizontal Laser"
AllowWallSelectionOnly = True
AllowFloorSelectionOnly = False
Case Else
AllowFloorSelectionOnly = True
AllowWallSelectionOnly = False
End Select
' Show FrmDesigner and bring it to the foreground
FrmDesigner.Show()
Dim unused = FrmDesigner.Focus()
' Temporarily disable FrmTriggerEditor
Enabled = False
' Disable other controls
lstRegion.Enabled = False
lstItemsToClear.Enabled = False
lstItemsToFill.Enabled = False
btnCreate.Enabled = False
' Update rtbTriggers
Dim triggerText As String = $"When {GetItemFullName(triggeringItem)} enters cell {triggeringPoint}, create a {GetItemFullName(triggerItemToCreate)}... Please select a Trigger Action Point..."
rtbTriggers.Text = triggerText
ApplyFormatting(rtbTriggers, GetItemFullName(triggeringItem), triggeringPoint, GetItemFullName(triggerItemToCreate))
End If
End Sub
Public Sub SetTriggerActionPoint(point As Point, itemType As String, Optional item As String = "Nothing")
triggerActionPoint = point
Dim triggerText As String = String.Empty ' Initialize triggerText to an empty string
If triggeringItem = "Player" Then
If itemType = "Floor" Then
triggerText = $"When the player enters cell {triggeringPoint}, explode in cell {triggerActionPoint}."
ElseIf itemType = "HorizontalWall" Then
triggerText = $"When the player enters cell {triggeringPoint}, explode on Horizontal Wall {triggerActionPoint}."
ElseIf itemType = "VerticalWall" Then
triggerText = $"When the player enters cell {triggeringPoint}, explode on Vertical Wall {triggerActionPoint}."
End If
Else
If itemType = "Floor" Then
triggerText = $"When a {GetItemFullName(triggeringItem)} enters cell {triggeringPoint}, explode in cell {triggerActionPoint}."
ElseIf itemType = "HorizontalWall" Then
triggerText = $"When a {GetItemFullName(triggeringItem)} enters cell {triggeringPoint}, explode on Horizontal Wall {triggerActionPoint}."
ElseIf itemType = "VerticalWall" Then
triggerText = $"When a {GetItemFullName(triggeringItem)} enters cell {triggeringPoint}, explode on Vertical Wall {triggerActionPoint}."
End If
End If
' Apply formatting
rtbTriggers.Text = triggerText
ApplyFormatting(rtbTriggers, GetItemFullName(triggeringItem), triggeringPoint, triggerActionPoint)
' Enable btnCreate after selecting an item to create
btnCreate.Enabled = True
' Re-enable FrmTriggerEditor and bring it to the foreground
Enabled = True
Dim unused = Focus()
' Set the new properties
If itemType = "HorizontalWall" Then
triggerItemToCreateIsHorizontalWall = True
triggerItemToCreateIsVerticalWall = False
ElseIf itemType = "VerticalWall" Then
triggerItemToCreateIsHorizontalWall = False
triggerItemToCreateIsVerticalWall = True
Else
triggerItemToCreateIsHorizontalWall = False
triggerItemToCreateIsVerticalWall = False
End If
' Set TriggerIsWall based on itemType
TriggerIsWall = itemType = "HorizontalWall" OrElse itemType = "VerticalWall"
' Set TriggerItemToExplode
triggerItemToExplode = item
End Sub
Public Sub SetTriggerItemToRemove(point As Point, item As String, itemType As String)
triggerActionPoint = point
triggerItemToRemove = item
Dim triggerText As String = String.Empty ' Initialize triggerText to an empty string
If triggerItemToRemove = "Nothing" Then
If triggeringItem = "Player" Then
If itemType = "Floor" Then
triggerText = $"When the player enters cell {triggeringPoint}, clear anything in cell {triggerActionPoint} from the game."
ElseIf itemType = "HorizontalWall" Then
triggerText = $"When the player enters cell {triggeringPoint}, clear anything in horizontal wall {triggerActionPoint} from the game."
ElseIf itemType = "VerticalWall" Then
triggerText = $"When the player enters cell {triggeringPoint}, clear anything in vertical wall {triggerActionPoint} from the game."
End If
Else
If itemType = "Floor" Then
triggerText = $"When a {GetItemFullName(triggeringItem)} enters cell {triggeringPoint}, clear anything in cell {triggerActionPoint} from the game."
ElseIf itemType = "HorizontalWall" Then
triggerText = $"When a {GetItemFullName(triggeringItem)} enters cell {triggeringPoint}, clear anything in horizontal wall {triggerActionPoint} from the game."
ElseIf itemType = "VerticalWall" Then
triggerText = $"When a {GetItemFullName(triggeringItem)} enters cell {triggeringPoint}, clear anything in vertical wall {triggerActionPoint} from the game."
End If
End If
Else
' Include TriggerActionPoint in the text
If triggeringItem = "Player" Then
If itemType = "Floor" Then
triggerText = $"When the player enters cell {triggeringPoint}, remove {GetItemFullName(triggerItemToRemove)} in cell {triggerActionPoint} from the game."
ElseIf itemType = "HorizontalWall" Then
triggerText = $"When the player enters cell {triggeringPoint}, remove {GetItemFullName(triggerItemToRemove)} on horizontal wall {triggerActionPoint} from the game."
ElseIf itemType = "VerticalWall" Then
triggerText = $"When the player enters cell {triggeringPoint}, remove {GetItemFullName(triggerItemToRemove)} on vertical wall {triggerActionPoint} from the game."
End If
Else
If itemType = "Floor" Then
triggerText = $"When a {GetItemFullName(triggeringItem)} enters cell {triggeringPoint}, remove {GetItemFullName(triggerItemToRemove)} in cell {triggerActionPoint} from the game."
ElseIf itemType = "HorizontalWall" Then
triggerText = $"When a {GetItemFullName(triggeringItem)} enters cell {triggeringPoint}, remove {GetItemFullName(triggerItemToRemove)} on horizontal wall {triggerActionPoint} from the game."
ElseIf itemType = "VerticalWall" Then
triggerText = $"When a {GetItemFullName(triggeringItem)} enters cell {triggeringPoint}, remove {GetItemFullName(triggerItemToRemove)} on vertical wall {triggerActionPoint} from the game."
End If
End If
End If
' Apply formatting
rtbTriggers.Text = triggerText
ApplyFormatting(rtbTriggers, GetItemFullName(triggeringItem), triggeringPoint, GetItemFullName(triggerItemToRemove), triggerActionPoint)
btnCreate.Enabled = True
Enabled = True
Dim unused = Focus()
' Set the new properties
If itemType = "HorizontalWall" Then
triggerItemToRemoveIsHorizontalWall = True
triggerItemToRemoveIsVerticalWall = False
ElseIf itemType = "VerticalWall" Then
triggerItemToRemoveIsHorizontalWall = False
triggerItemToRemoveIsVerticalWall = True
Else
triggerItemToRemoveIsHorizontalWall = False
triggerItemToRemoveIsVerticalWall = False
End If
' Set TriggerIsWall based on itemType
TriggerIsWall = itemType = "HorizontalWall" OrElse itemType = "VerticalWall"
End Sub
Private Sub btnCreate_Click(sender As Object, e As EventArgs) Handles btnCreate.Click
' Add the content of rtbTriggers to trvTriggers
Dim node As New TreeNode(rtbTriggers.Text)
Dim unused = trvTriggers.Nodes.Add(node)
' Create a new Triggers object and populate it with the current trigger data
Dim newTrigger As New Triggers With {
.TriggeringItem = triggeringItem,
.TriggeringPoint = (triggeringPoint.X, triggeringPoint.Y),
.TriggerAction = lstTriggerAction.SelectedItem.ToString(),
.TriggerActionPoint = (triggerActionPoint.X, triggerActionPoint.Y),
.TriggerFull = rtbTriggers.Text,
.TriggerEnabled = chkEnabled.Checked,
.TriggerTurnOff = chkTurnOff.Checked
}
' Handle different actions
Select Case newTrigger.TriggerAction
Case "Create"
newTrigger.TriggerItemToCreate = lstItemToCreate.SelectedItem.ToString()
newTrigger.TriggerActionIsWall = TriggerIsWall
newTrigger.TriggerActionIsHorizontalWall = triggerItemToCreateIsHorizontalWall
newTrigger.TriggerActionIsVerticalWall = triggerItemToCreateIsVerticalWall
rtbTriggers.Text = $"When {GetItemFullName(triggeringItem)} enters cell {triggeringPoint}, create a {GetItemFullName(newTrigger.TriggerItemToCreate)} in cell {triggerActionPoint}."
Case "Remove"
newTrigger.TriggerItemToRemove = triggerItemToRemove
newTrigger.TriggerActionIsWall = TriggerIsWall
newTrigger.TriggerActionIsHorizontalWall = triggerItemToRemoveIsHorizontalWall
newTrigger.TriggerActionIsVerticalWall = triggerItemToRemoveIsVerticalWall
rtbTriggers.Text = $"When {GetItemFullName(triggeringItem)} enters cell {triggeringPoint}, remove {GetItemFullName(newTrigger.TriggerItemToRemove)} in cell {triggerActionPoint} from the game."
Case "Explode"
newTrigger.TriggerItemToExplode = triggerItemToExplode
newTrigger.TriggerActionIsWall = TriggerIsWall
newTrigger.TriggerActionIsHorizontalWall = triggerItemToCreateIsHorizontalWall
newTrigger.TriggerActionIsVerticalWall = triggerItemToCreateIsVerticalWall
rtbTriggers.Text = $"When {GetItemFullName(triggeringItem)} enters cell {triggeringPoint}, explode {GetItemFullName(newTrigger.TriggerItemToExplode)} in cell {triggerActionPoint}."
Case "Clear Region"
newTrigger.TriggerRegion = lstRegion.SelectedItem.ToString()
newTrigger.TriggerItemsToClear = lstItemsToClear.SelectedItem.ToString()
rtbTriggers.Text = $"When {GetItemFullName(triggeringItem)} enters cell {triggeringPoint}, clear {newTrigger.TriggerItemsToClear} from {newTrigger.TriggerRegion}."
Case "Fill Region"
newTrigger.TriggerRegion = lstRegion.SelectedItem.ToString()
newTrigger.TriggerItemsToFill = lstItemsToFill.SelectedItem.ToString()
rtbTriggers.Text = $"When {GetItemFullName(triggeringItem)} enters cell {triggeringPoint}, fill {newTrigger.TriggerRegion} with {newTrigger.TriggerItemsToFill}."
Case "Flip Region Horizontal"
newTrigger.TriggerRegion = lstRegion.SelectedItem.ToString()
rtbTriggers.Text = $"When {GetItemFullName(triggeringItem)} enters cell {triggeringPoint}, flip {newTrigger.TriggerRegion} horizontally."
Case "Flip Region Vertical"
newTrigger.TriggerRegion = lstRegion.SelectedItem.ToString()
rtbTriggers.Text = $"When {GetItemFullName(triggeringItem)} enters cell {triggeringPoint}, flip {newTrigger.TriggerRegion} vertically."
Case "Flip Game Horizontal"
rtbTriggers.Text = $"When {GetItemFullName(triggeringItem)} enters cell {triggeringPoint}, flip the game horizontally."
Case "Flip Game Vertical"
rtbTriggers.Text = $"When {GetItemFullName(triggeringItem)} enters cell {triggeringPoint}, flip the game vertically."
Case Else
' Handle other actions if needed
End Select
' Debug statement to check the newTrigger properties
Debug.WriteLine($"New Trigger: {newTrigger.TriggerFull}, TriggeringItem: {newTrigger.TriggeringItem}, " &
$"TriggeringPoint: {newTrigger.TriggeringPoint}, TriggerAction: {newTrigger.TriggerAction}, " &
$"TriggerItemToCreate: {newTrigger.TriggerItemToCreate}, TriggerItemToRemove: {newTrigger.TriggerItemToRemove}, " &
$"TriggerActionPoint: {newTrigger.TriggerActionPoint}, TriggerIsWall: {newTrigger.TriggerActionIsWall}, " &
$"TriggerIsHorizontalWall: {newTrigger.TriggerActionIsHorizontalWall}, TriggerIsVerticalWall: {newTrigger.TriggerActionIsVerticalWall}, " &
$"TriggerRegion: {newTrigger.TriggerRegion}, ItemsToClear: {newTrigger.TriggerItemsToClear}, ItemsToFill: {newTrigger.TriggerItemsToFill}, " &
$"TriggerEnabled: {newTrigger.TriggerEnabled}, TriggerTurnOff: {newTrigger.TriggerTurnOff}")
' Add the new trigger to the triggerData list
triggerData.Add(newTrigger)
' Reset the UI
lstTriggerAction.Enabled = False
lstItemToCreate.Enabled = False
lstRegion.Enabled = False
lstItemsToClear.Enabled = False
lstItemsToFill.Enabled = False
btnCreate.Enabled = False
' Update FrmDesigner with the new trigger data
FrmDesigner.triggerData = New List(Of Triggers)(triggerData)
FrmDesigner.picGame.Invalidate() ' Force a redraw of the picGame control
End Sub
Private Function IsWall(point As Point) As Boolean
' Check if the action point is a wall
Return point.X = 0 OrElse point.X = SQCOUNTX OrElse point.Y = 0 OrElse point.Y = SQCOUNTY
End Function
Private Sub mnuDelete_Click(sender As Object, e As EventArgs) Handles mnuDelete.Click
If trvTriggers.SelectedNode IsNot Nothing Then
' Remove the selected node from the TreeView
Dim selectedNode As TreeNode = trvTriggers.SelectedNode
trvTriggers.Nodes.Remove(selectedNode)
' Find and remove the corresponding trigger from the triggerData list
Dim selectedTriggerText As String = selectedNode.Text
Dim triggerToRemove As Triggers = triggerData.FirstOrDefault(Function(t) t.TriggerFull = selectedTriggerText)
If triggerToRemove IsNot Nothing Then
Dim unused = triggerData.Remove(triggerToRemove)
End If
End If
End Sub
Private Sub mnuClearAll_Click(sender As Object, e As EventArgs) Handles mnuClearAll.Click
trvTriggers.Nodes.Clear()
triggerData.Clear()
End Sub
Private Sub mnuCopy_Click(sender As Object, e As EventArgs) Handles mnuCopy.Click
Dim triggerText As String = String.Empty
For Each node As TreeNode In trvTriggers.Nodes
triggerText &= node.Text & vbCrLf
Next
Clipboard.SetText(triggerText)
End Sub
Private Sub trvTriggers_MouseDown(sender As Object, e As MouseEventArgs)
If e.Button = MouseButtons.Right Then
' Get the node at the mouse position
Dim hitTestInfo As TreeViewHitTestInfo = trvTriggers.HitTest(e.Location)
If hitTestInfo.Node IsNot Nothing Then
' Select the node
trvTriggers.SelectedNode = hitTestInfo.Node
End If
End If
End Sub
Private Sub trvTriggers_AfterSelect(sender As Object, e As TreeViewEventArgs) Handles trvTriggers.AfterSelect
If trvTriggers.SelectedNode IsNot Nothing Then
Dim selectedTriggerText As String = trvTriggers.SelectedNode.Text
Dim selectedTrigger As Triggers = triggerData.FirstOrDefault(Function(t) t.TriggerFull = selectedTriggerText)
If selectedTrigger IsNot Nothing Then
' Update the highlighted trigger in FrmDesigner
FrmDesigner.hoveredTrigger = selectedTrigger
FrmDesigner.picGame.Invalidate() ' Force a redraw of the picGame control
End If
End If
End Sub
End Class
Resource "RegionIcons.ImageStream" of type "System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" may be deserialized via BinaryFormatter at runtime. BinaryFormatter is deprecated due to known security risks and is removed from .NET 9+. If you wish to continue using it, set property "GenerateResourceWarnOnBinaryFormatterUse" to false.
More information: https://aka.ms/binaryformatter-migration-guide
Can you update the resx file please