Skip to content

Commit

Permalink
First release
Browse files Browse the repository at this point in the history
  • Loading branch information
ImAxel0 committed Feb 26, 2024
1 parent 2438db2 commit 2037c64
Show file tree
Hide file tree
Showing 13 changed files with 53 additions and 46 deletions.
6 changes: 6 additions & 0 deletions RedNodeEditor.sln
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,19 @@ EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Debug|x64 = Debug|x64
Release|Any CPU = Release|Any CPU
Release|x64 = Release|x64
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{7884F559-F834-436A-9C60-FC0F7BBA08BB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{7884F559-F834-436A-9C60-FC0F7BBA08BB}.Debug|Any CPU.Build.0 = Debug|Any CPU
{7884F559-F834-436A-9C60-FC0F7BBA08BB}.Debug|x64.ActiveCfg = Debug|x64
{7884F559-F834-436A-9C60-FC0F7BBA08BB}.Debug|x64.Build.0 = Debug|x64
{7884F559-F834-436A-9C60-FC0F7BBA08BB}.Release|Any CPU.ActiveCfg = Release|Any CPU
{7884F559-F834-436A-9C60-FC0F7BBA08BB}.Release|Any CPU.Build.0 = Release|Any CPU
{7884F559-F834-436A-9C60-FC0F7BBA08BB}.Release|x64.ActiveCfg = Release|x64
{7884F559-F834-436A-9C60-FC0F7BBA08BB}.Release|x64.Build.0 = Release|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
13 changes: 6 additions & 7 deletions RedNodeEditor/EventNodes/SubscribeEventToNode.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
using Newtonsoft.Json;
using Sons.Atmosphere;
using System.Xml.Serialization;
using static RedNodeEditor.GlobalEnums;

namespace RedNodeEditor.EventNodes;

Expand All @@ -13,15 +15,9 @@ public class SubscribeEventToNode : SonsNode
[IgnoreProperty]
public BaseNode EnumValue { get; set; } = BaseNode.OnUpdate;

[XmlType("SubscribeEventToNode_BaseNode")]
public enum BaseNode
{
OnInitializeMod, OnSdkInitialized, OnGameStart, OnWorldUpdate, OnUpdate
}

[XmlIgnore]
[JsonIgnore]
public List<Enum> BaseNodeList { get; set; } = new() { BaseNode.OnInitializeMod, BaseNode.OnSdkInitialized, BaseNode.OnGameStart, BaseNode.OnWorldUpdate, BaseNode.OnUpdate };
public List<Enum> BaseNodeList { get; set; } = new();

public SubscribeEventToNode()
{
Expand All @@ -30,6 +26,9 @@ public SubscribeEventToNode()
NodeCategory = NodeCategories.FlowChange;
SizeOverride = new(270, 190);

foreach (var baseNode in Enum.GetValues(typeof(BaseNode)))
BaseNodeList.Add((BaseNode)baseNode);

ArgsIn.Add(new ArgIn { Type = typeof(string), ArgName = nameof(EventName), Hide = true });
ArgsIn.Add(new ArgIn { Type = typeof(string), ArgName = nameof(EventName), Hide = true });
ArgsIn.Add(new ArgIn { Type = typeof(BaseNode), ArgName = nameof(BaseNode) });
Expand Down
12 changes: 5 additions & 7 deletions RedNodeEditor/EventNodes/UnsubscribeEventFromNode.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using Newtonsoft.Json;
using System.Xml.Serialization;
using static RedNodeEditor.GlobalEnums;

namespace RedNodeEditor.EventNodes;

Expand All @@ -13,15 +14,9 @@ public class UnsubscribeEventFromNode : SonsNode
[IgnoreProperty]
public BaseNode EnumValue { get; set; } = BaseNode.OnUpdate;

[XmlType("UnsubscribeEventFromNode_BaseNode")]
public enum BaseNode
{
OnInitializeMod, OnSdkInitialized, OnGameStart, OnWorldUpdate, OnUpdate
}

[XmlIgnore]
[JsonIgnore]
public List<Enum> BaseNodeList { get; set; } = new() { BaseNode.OnInitializeMod, BaseNode.OnSdkInitialized, BaseNode.OnGameStart, BaseNode.OnWorldUpdate, BaseNode.OnUpdate };
public List<Enum> BaseNodeList { get; set; } = new();

public UnsubscribeEventFromNode()
{
Expand All @@ -30,6 +25,9 @@ public UnsubscribeEventFromNode()
NodeCategory = NodeCategories.FlowChange;
SizeOverride = new(270, 190);

foreach (var baseNode in Enum.GetValues(typeof(BaseNode)))
BaseNodeList.Add((BaseNode)baseNode);

ArgsIn.Add(new ArgIn { Type = typeof(string), ArgName = nameof(EventName), Hide = true });
ArgsIn.Add(new ArgIn { Type = typeof(string), ArgName = nameof(EventName), Hide = true });
ArgsIn.Add(new ArgIn { Type = typeof(BaseNode), ArgName = nameof(BaseNode) });
Expand Down
5 changes: 5 additions & 0 deletions RedNodeEditor/GlobalEnums.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@

public class GlobalEnums
{
public enum BaseNode
{
OnInitializeMod, OnSdkInitialized, OnGameStart, OnWorldUpdate, OnUpdate, OnFixedUpdate
}

public enum RangedWeaponEnum
{
Bow, CompactPistol, Crossbow, Grenade, Molotov, Revolver,
Expand Down
3 changes: 0 additions & 3 deletions RedNodeEditor/GraphEditor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -203,9 +203,6 @@ static Vector2 GetWhatSizeNodeShouldBe(SonsNode node, int propertiesCount)
if (node.SizeOverride != Vector2.Zero)
return node.SizeOverride;

//if (propertiesCount == 0 && node.ArgsOut.Count <= 1 && node.ArgsIn.Count <= 1)
//return new Vector2(250, 120);

switch (node.ArgsIn.Count)
{
case 0:
Expand Down
14 changes: 14 additions & 0 deletions RedNodeEditor/ModBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,20 @@ public class ModBuilder

public static ModData MakeModData(string modAuthor, string modVersion)
{
if (string.IsNullOrEmpty(modAuthor))
{
Logger.Append("Error building the mod: mod author field can't be empty");
User32.MessageBox(IntPtr.Zero, "Mod author field can't be empty", "Error building the mod", User32.MB_FLAGS.MB_ICONWARNING | User32.MB_FLAGS.MB_TOPMOST);
return null;
}

if (string.IsNullOrEmpty(modVersion))
{
Logger.Append("Error building the mod: mod version field can't be empty");
User32.MessageBox(IntPtr.Zero, "Mod version field can't be empty", "Error building the mod", User32.MB_FLAGS.MB_ICONWARNING | User32.MB_FLAGS.MB_TOPMOST);
return null;
}

foreach (var connList in BasePair.Values)
connList.Clear();

Expand Down
2 changes: 1 addition & 1 deletion RedNodeEditor/RedNodeEditor.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<OutputType>WinExe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
Expand Down
2 changes: 1 addition & 1 deletion RedNodeLoader/AXSUI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1245,7 +1245,7 @@ public static SPanelOptions AxCreateSidePanel(string id, bool canResize, string

var titleContainer = SContainer.Background((Color)color, style).PaddingVertical(10).PHeight(50).Id("titlecontainer")
- AxTextAutoSize(title).Id("menutitle")
- AxButton("X", CloseMenuPanel, new Vector2(50, 50), AnchorType.TopRight).Background(EBackground.RoundedStandard).Id($"close{id}");
- AxButton("X", CloseMenuPanel, new Vector2(50, 50), AnchorType.TopRight).Background(EBackground.RoundedStandard).Color(new Color(1.00f, 0.13f, 0.29f)).Id($"close{id}");

if (canResize)
{
Expand Down
15 changes: 1 addition & 14 deletions RedNodeLoader/ActorsNodes/SpawnActorNode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,6 @@ public class SpawnActorNode : SonsNode
public override void Execute()
{
List<object> args = RedNodeLoader.GetArgumentsOf(this);
SpawnCharacter((VailActorTypeId)args[0]);
}

private void SpawnCharacter(VailActorTypeId typeId)
{
int family = VailWorldSimulation.NewFamily();

var prefab = ActorTools.GetPrefab(typeId);
var spawnedActor = VailWorldSimulation.Instance().SpawnActor(prefab, SonsTools.GetPositionInFrontOfPlayer(5, 3), Pathfinding.GraphMask.everything, null, State.None, family);
VailWorldSimulation.Instance().ConvertToRealActor(spawnedActor, false, prefab);
AreaMask currentAreaMask = CaveEntranceManager.CurrentAreaMask;
spawnedActor.SetAreaMask(currentAreaMask);
spawnedActor.SetGraphMask(VailWorldSimulation.Instance().GetNavGraphMaskForArea(currentAreaMask));
spawnedActor.IsDebugSpawned = true;
ActorTools.Spawn((VailActorTypeId)args[0], SonsTools.GetPositionInFrontOfPlayer(4, 2));
}
}
10 changes: 4 additions & 6 deletions RedNodeLoader/EventsNodes/SubscribeEventToNode.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using RedLoader;
using SonsSdk;
using System.Xml.Serialization;
using static RedNodeLoader.GlobalEnums;

namespace RedNodeLoader.EventsNodes;

Expand All @@ -10,12 +11,6 @@ public class SubscribeEventToNode : SonsNode
public string EventName { get; set; }
public BaseNode EnumValue { get; set; }

[XmlType("SubscribeEventToNode_BaseNode")]
public enum BaseNode
{
OnInitializeMod, OnSdkInitialized, OnGameStart, OnWorldUpdate, OnUpdate
}

public override void Execute()
{
List<object> args = RedNodeLoader.GetArgumentsOf(this);
Expand All @@ -39,6 +34,9 @@ public override void Execute()
case BaseNode.OnUpdate:
GlobalEvents.OnUpdate.Subscribe(cEvent.Execute);
break;
case BaseNode.OnFixedUpdate:
GlobalEvents.OnFixedUpdate.Subscribe(cEvent.Execute);
break;
}
}
}
10 changes: 4 additions & 6 deletions RedNodeLoader/EventsNodes/UnsubscribeEventFromNode.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using RedLoader;
using SonsSdk;
using System.Xml.Serialization;
using static RedNodeLoader.GlobalEnums;

namespace RedNodeLoader.EventsNodes;

Expand All @@ -10,12 +11,6 @@ public class UnsubscribeEventFromNode : SonsNode
public string EventName { get; set; }
public BaseNode EnumValue { get; set; }

[XmlType("UnsubscribeEventFromNode_BaseNode")]
public enum BaseNode
{
OnInitializeMod, OnSdkInitialized, OnGameStart, OnWorldUpdate, OnUpdate
}

public override void Execute()
{
List<object> args = RedNodeLoader.GetArgumentsOf(this);
Expand All @@ -39,6 +34,9 @@ public override void Execute()
case BaseNode.OnUpdate:
GlobalEvents.OnUpdate.Unsubscribe(cEvent.Execute);
break;
case BaseNode.OnFixedUpdate:
GlobalEvents.OnFixedUpdate.Unsubscribe(cEvent.Execute);
break;
}
}
}
5 changes: 5 additions & 0 deletions RedNodeLoader/GlobalEnums.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@

public class GlobalEnums
{
public enum BaseNode
{
OnInitializeMod, OnSdkInitialized, OnGameStart, OnWorldUpdate, OnUpdate, OnFixedUpdate
}

public enum RangedWeaponEnum
{
Bow, CompactPistol, Crossbow, Grenade, Molotov, Revolver,
Expand Down
2 changes: 1 addition & 1 deletion RedNodeLoader/ModListUi.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public static void Create()
var toniContainer = GetPanel(ModManagerUi.MOD_LIST_ID)
- AxButton("", ShowModList, new(100, 100), AnchorType.TopLeft).Color(Color.white.WithAlpha(0.95f)).Background(logoSprite).Position(20, -120);

var modsPanel = AxCreateSidePanel(ModListId, false, "<color=#454545>INSTALLED MODS</color>", Side.Left, 600, new Color(0.07f, 0.05f, 0.03f))
var modsPanel = AxCreateSidePanel(ModListId, false, "<color=#454545>INSTALLED MODS</color>", Side.Left, 600, new Color(0f, 0.01f, 0.02f, 0.99f))
.OverrideSorting(999)
.Active(false);

Expand Down

0 comments on commit 2037c64

Please sign in to comment.