Skip to content
Merged

Wip #11

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 12 additions & 15 deletions ActionEditor.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,4 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Windows.Forms;
using Microsoft.VisualBasic;
using Microsoft.VisualBasic.CompilerServices;


namespace DS_Game_Maker
{

Expand Down Expand Up @@ -66,7 +59,7 @@ private void ActionsTreeView_NodeMouseDoubleClick(object sender, TreeNodeMouseCl
string ActLine = ActLine_;
if (ActLine.StartsWith("TYPE "))
{
ActionType = Conversions.ToByte(ActLine.Substring(5));
ActionType = Convert.ToByte(ActLine.Substring(5));
continue;
}
if (ActLine.StartsWith("DISPLAY"))
Expand Down Expand Up @@ -133,7 +126,7 @@ private void ActionsTreeView_NodeMouseDoubleClick(object sender, TreeNodeMouseCl
{
var ToAdd = new ListViewItem();
ToAdd.Text = ArgNames[X];
ToAdd.SubItems.Add(ScriptsLib.ArgumentTypeToString(Conversions.ToByte(ArgTypes[X])));
ToAdd.SubItems.Add(ScriptsLib.ArgumentTypeToString(Convert.ToByte(ArgTypes[X])));
ArgumentsListView.Items.Add(ToAdd);
}
}
Expand Down Expand Up @@ -298,7 +291,7 @@ private void AddArgumentButton_Click(object sender, EventArgs e)
if (ArgumentForm.ArgumentName.Length == 0)
return;
string NewName = ArgumentForm.ArgumentName;
string NewType = ScriptsLib.ArgumentTypeToString(Conversions.ToByte(ArgumentForm.ArgumentType));
string NewType = ScriptsLib.ArgumentTypeToString(Convert.ToByte(ArgumentForm.ArgumentType));
ArgumentForm.Dispose();
if (!DSGMlib.ValidateSomething(NewName, (byte)DSGMlib.ValidateLevel.Loose))
{
Expand All @@ -318,7 +311,7 @@ private void AddArgumentButton_Click(object sender, EventArgs e)
}
var Y = new ListViewItem();
Y.Text = ArgumentForm.ArgumentName;
Y.SubItems.Add(ScriptsLib.ArgumentTypeToString(Conversions.ToByte(ArgumentForm.ArgumentType)));
Y.SubItems.Add(ScriptsLib.ArgumentTypeToString(Convert.ToByte(ArgumentForm.ArgumentType)));
ArgumentsListView.Items.Add(Y);
}

Expand All @@ -336,7 +329,7 @@ private void EditArgumentButton_Click(object sender, EventArgs e)
if (ArgumentForm.ArgumentName.Length == 0)
return;
string NewName = ArgumentForm.ArgumentName;
string NewType = ScriptsLib.ArgumentTypeToString(Conversions.ToByte(ArgumentForm.ArgumentType));
string NewType = ScriptsLib.ArgumentTypeToString(Convert.ToByte(ArgumentForm.ArgumentType));
if (!DSGMlib.ValidateSomething(NewName, (byte)DSGMlib.ValidateLevel.Loose))
{
DSGMlib.MsgWarn("You must enter a valid name for the Argument.");
Expand Down Expand Up @@ -369,9 +362,13 @@ private void DeleteActionButton_Click(object sender, EventArgs e)
return;
}
string ActionName = ActionsTreeView.SelectedNode.Text;
byte Response = (byte)MessageBox.Show("Are you sure you want to delete '" + ActionName + "'?", Application.ProductName, MessageBoxButtons.YesNo, MessageBoxIcon.Question);
if (!(Response == (int)MsgBoxResult.Yes))

DialogResult Response = MessageBox.Show("Are you sure you want to delete '" + ActionName + "'?", Application.ProductName, MessageBoxButtons.YesNo, MessageBoxIcon.Question);
if (Response != DialogResult.No)
{
return;
}

File.Delete(Constants.AppDirectory + "Actions/" + ActionName + ".action");
ActionsTreeView.SelectedNode.Remove();
if (ActionsTreeView.Nodes.Count == 0)
Expand Down
6 changes: 3 additions & 3 deletions ActionsLib.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,9 @@ public static string ActionEquateDisplay(string ActionName, string ActionArgumen
return Returnable;
}

public static bool ActionIsConditional(object ActionName)
public static bool ActionIsConditional(string ActionName)
{
foreach (string X_ in File.ReadAllLines(Constants.AppDirectory + "Actions/" + ActionName + ".action"))
foreach (string X_ in File.ReadAllLines(Constants.AppDirectory + "Actions/" + ActionName.Split('\\')[1] + ".action"))
{
string X = X_;
if (X.StartsWith("CONDITION "))
Expand All @@ -64,7 +64,7 @@ public static bool ActionIsConditional(object ActionName)
public static string ActionGetIconPath(string ActionName, bool UseFullPath)
{
string Returnable = "Empty.png";
foreach (string X in File.ReadAllLines(Constants.AppDirectory + "Actions/" + ActionName + ".action"))
foreach (string X in File.ReadAllLines(Constants.AppDirectory + "Actions/" + ActionName.Split('\\')[1] + ".action"))
{
if (X.StartsWith("ICON "))
Returnable = X.Substring(5);
Expand Down
16 changes: 8 additions & 8 deletions Background.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,14 @@ private void Background_Load(object sender, EventArgs e)
private void DAcceptButton_Click(object sender, EventArgs e)
{
string NewName = NameTextBox.Text;
if (!((BackgroundName ?? "") == (NewName ?? "")))
if (BackgroundName != NewName)
{
if (DSGMlib.GUIResNameChecker(NewName))
return;
}
File.Delete(RealPath);
File.Move(TempPath, RealPath);
if (!((NewName ?? "") == (BackgroundName ?? "")))
if (NewName != BackgroundName)
{
DSGMlib.XDSChangeLine("BACKGROUND " + BackgroundName, "BACKGROUND " + NewName);
DSGMlib.SilentMoveFile(RealPath, SessionsLib.SessionPath + "Backgrounds/" + NewName + ".png");
Expand All @@ -73,7 +73,7 @@ private void DAcceptButton_Click(object sender, EventArgs e)
byte P = 0;
foreach (string D in DSGMlib.BGsToRedo)
{
if ((D ?? "") == (BackgroundName ?? ""))
if (D == BackgroundName)
break;
P = (byte)(P + 1);
}
Expand All @@ -88,9 +88,9 @@ private void DAcceptButton_Click(object sender, EventArgs e)
X = X.Substring(5);
bool TopChange = false;
bool BottomChange = false;
if ((DSGMlib.iGet(X, (byte)4, ",") ?? "") == (BackgroundName ?? ""))
if (DSGMlib.iGet(X, (byte)4, ",") == BackgroundName)
TopChange = true;
if ((DSGMlib.iGet(X, (byte)8, ",") ?? "") == (BackgroundName ?? ""))
if (DSGMlib.iGet(X, (byte)8, ",") == BackgroundName)
BottomChange = true;
if (TopChange & BottomChange)
{
Expand Down Expand Up @@ -136,11 +136,11 @@ private void DAcceptButton_Click(object sender, EventArgs e)
{
if (!(X.Name == "Room"))
continue;
if ((((Room)X).TopBG ?? "") == (NewName ?? ""))
if (((Room)X).TopBG == NewName)
{
((Room)X).RefreshRoom(true);
}
if ((((Room)X).BottomBG ?? "") == (NewName ?? ""))
if (((Room)X).BottomBG == NewName)
{
((Room)X).RefreshRoom(false);
}
Expand Down Expand Up @@ -230,7 +230,7 @@ private void DAcceptButton_Click(object sender, EventArgs e)
foreach (string X_ in DSGMlib.StringToLines(DSGMlib.PathToString(SessionsLib.CompilePath + "gfx/dsgm_gfx.h")))
{
string X = X_;
if ((X ?? "") == ("extern const PA_BgStruct " + BackgroundName + ";" ?? ""))
if (X == ("extern const PA_BgStruct " + BackgroundName + ";"))
X = "extern const PA_BgStruct " + NewName + ";";
NewString += X + Constants.vbCrLf;
}
Expand Down
16 changes: 0 additions & 16 deletions DObject.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading