Skip to content

Commit e20b27c

Browse files
committed
Initial commit
1 parent 9c7df27 commit e20b27c

File tree

5 files changed

+322
-2
lines changed

5 files changed

+322
-2
lines changed

CreateNewUIX.cs

Lines changed: 188 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,188 @@
1+
using BaseX;
2+
using FrooxEngine;
3+
using FrooxEngine.UIX;
4+
5+
using NeosModLoader;
6+
7+
namespace CreateNewUIX {
8+
public class CreateNewUIX : NeosMod {
9+
public override string Name => "CreateNewUIX";
10+
public override string Author => "Delta";
11+
public override string Version => "1.0.0";
12+
public override string Link => "https://github.com/XDelta/CreateNewUIX";
13+
public override void OnEngineInit() {
14+
/*Harmony harmony = new Harmony("net.deltawolf.CreateNewUIX");
15+
harmony.PatchAll();*/
16+
Engine.Current.RunPostInit(AddMenuOptions);
17+
}
18+
private static readonly float3 defaultScale = new float3(0.001f, 0.001f, 0.001f);
19+
void AddMenuOptions() {
20+
DevCreateNewForm.AddAction("Object\\Neos UIX", "Button", (x) => CreateButton(x));
21+
DevCreateNewForm.AddAction("Object\\Neos UIX", "Checkbox", (x) => CreateCheckBox(x));
22+
DevCreateNewForm.AddAction("Object\\Neos UIX", "Expander", (x) => CreateExpander(x));
23+
DevCreateNewForm.AddAction("Object\\Neos UIX", "Image", (x) => CreateImage(x));
24+
DevCreateNewForm.AddAction("Object\\Neos UIX", "Numeric UpDown", (x) => CreateNumericUpDownButtons(x));
25+
DevCreateNewForm.AddAction("Object\\Neos UIX", "Panel", (x) => CreatePanel(x));
26+
DevCreateNewForm.AddAction("Object\\Neos UIX", "Scroll Area", (x) => CreateScrollArea(x));
27+
DevCreateNewForm.AddAction("Object\\Neos UIX", "Slider", (x) => CreateSlider(x));
28+
DevCreateNewForm.AddAction("Object\\Neos UIX", "Text", (x) => CreateText(x));
29+
DevCreateNewForm.AddAction("Object\\Neos UIX", "Text Field", (x) => CreateTextField(x));
30+
}
31+
32+
/*
33+
*Button
34+
*Checkbox
35+
Dropdown
36+
+Expander/collaspable
37+
Horizontal Choice Bar
38+
Vertical Button layout
39+
+Image
40+
Numberic Choice Bar
41+
/Numeric UpDown
42+
*Panel
43+
Progress Bar
44+
Radio
45+
*Slider
46+
*Text Field
47+
URL Field with button to open as link
48+
*/
49+
50+
public static void CreateButton(Slot x) {
51+
x.Name = "Button";
52+
x.GlobalScale = defaultScale;
53+
x.AttachComponent<Grabbable>();
54+
var _canvas = x.AttachComponent<Canvas>();
55+
_canvas.Size.Value = new float2(245, 45);
56+
UIBuilder ui = new UIBuilder(_canvas);
57+
ui.Panel(color.Black, true);
58+
ui.Button("Button");
59+
x.PositionInFrontOfUser(float3.Backward, distance: 1f);
60+
}
61+
62+
public static void CreateCheckBox(Slot x) {
63+
x.Name = "Checkbox";
64+
x.GlobalScale = defaultScale;
65+
x.AttachComponent<Grabbable>();
66+
var _canvas = x.AttachComponent<Canvas>();
67+
_canvas.Size.Value = new float2(45, 45);
68+
UIBuilder ui = new UIBuilder(_canvas);
69+
ui.Checkbox();
70+
x.PositionInFrontOfUser(float3.Backward, distance: 1f);
71+
}
72+
public static void CreateExpander(Slot x) {
73+
x.Name = "Expander";
74+
x.GlobalScale = defaultScale;
75+
x.AttachComponent<Grabbable>();
76+
var _canvas = x.AttachComponent<Canvas>();
77+
_canvas.Size.Value = new float2(256, 256);
78+
UIBuilder ui = new UIBuilder(_canvas);
79+
ui.SplitVertically(0.2f, out RectTransform r1, out RectTransform r2, 0f);
80+
ui.NestInto(r1);
81+
ui.Button("Expander");
82+
var ex = ui.Current.AttachComponent<Expander>();
83+
ui.NestInto(r2);
84+
ui.Panel(color.White, true);
85+
var text = ui.Text("Some Text");
86+
text.Color.Value = color.Black;
87+
ex.SectionRoot.Target = r2.Slot;
88+
x.PositionInFrontOfUser(float3.Backward, distance: 1f);
89+
}
90+
public static void CreateImage(Slot x) {
91+
x.Name = "Image";
92+
x.GlobalScale = defaultScale;
93+
x.AttachComponent<Grabbable>();
94+
var _canvas = x.AttachComponent<Canvas>();
95+
_canvas.Size.Value = new float2(256, 256);
96+
UIBuilder ui = new UIBuilder(_canvas);
97+
ui.Image(color.White, true).Sprite.Target = ui.Root.AttachSprite(NeosAssets.Common.Icons.Camera, uncompressed: false, evenNull: false, getExisting: true, null);
98+
x.PositionInFrontOfUser(float3.Backward, distance: 1f);
99+
}
100+
public static void CreateNumericUpDownButtons(Slot x) {
101+
x.Name = "Numeric UpDown";
102+
x.GlobalScale = defaultScale;
103+
x.AttachComponent<Grabbable>();
104+
var _canvas = x.AttachComponent<Canvas>();
105+
var _dataValue = x.AttachComponent<ValueField<float>>();
106+
_canvas.Size.Value = new float2(245, 45);
107+
UIBuilder ui = new UIBuilder(_canvas);
108+
ui.Panel(color.Black, true);
109+
ui.HorizontalLayout(5, 2);
110+
var dec = ui.Button("-");
111+
var text = ui.Text("0.00");
112+
var inc = ui.Button("+");
113+
text.Color.Value = color.White;
114+
//Decrement
115+
var bvs = dec.Slot.AttachComponent<ButtonValueShift<float>>();
116+
bvs.TargetValue.Value = _dataValue.Value.ReferenceID;
117+
bvs.Delta.Value = -1f;
118+
//Increment
119+
var bvs2 = inc.Slot.AttachComponent<ButtonValueShift<float>>();
120+
bvs2.TargetValue.Value = _dataValue.Value.ReferenceID;
121+
bvs2.Delta.Value = 1f;
122+
//Text Driver from value
123+
var vtfd = text.Slot.AttachComponent<ValueTextFormatDriver<float>>();
124+
vtfd.Text.Value = text.Content.ReferenceID;
125+
vtfd.Format.Value = "{0:f2}";
126+
vtfd.Source.Value = _dataValue.Value.ReferenceID;
127+
x.PositionInFrontOfUser(float3.Backward, distance: 1f);
128+
}
129+
public static void CreatePanel(Slot x) {
130+
x.Name = "Panel";
131+
x.GlobalScale = defaultScale;
132+
x.AttachComponent<Grabbable>();
133+
var _canvas = x.AttachComponent<Canvas>();
134+
_canvas.Size.Value = new float2(1920, 1080);
135+
UIBuilder ui = new UIBuilder(_canvas);
136+
ui.Panel(color.Black, true);
137+
x.PositionInFrontOfUser(float3.Backward, distance: 1f);
138+
}
139+
public static void CreateScrollArea(Slot x) {
140+
x.Name = "Scroll Area";
141+
x.GlobalScale = defaultScale;
142+
x.AttachComponent<Grabbable>();
143+
var _canvas = x.AttachComponent<Canvas>();
144+
_canvas.Size.Value = new float2(512, 512);
145+
UIBuilder ui = new UIBuilder(_canvas);
146+
ui.Panel(color.White, true);
147+
ui.ScrollArea(null);
148+
ui.VerticalLayout(0f, 10f, null);
149+
ui.FitContent(SizeFit.Disabled, SizeFit.MinSize);
150+
ui.Text("Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec fermentum magna sapien. Vestibulum tempus tortor a ante pretium ultricies. In ligula lorem, varius quis malesuada ut, tincidunt at mi. Aenean non ante id ex faucibus convallis ac vitae mauris. Integer ante ex, porta ut sapien et, suscipit semper lorem. Vivamus elementum dui vitae risus gravida fermentum. Quisque aliquet rhoncus nunc, ac sagittis turpis mattis a. Cras rhoncus nunc a tortor egestas, eget posuere elit finibus. In hac habitasse platea dictumst. Maecenas lobortis elit sed neque porta, a mattis mauris mollis. Nunc condimentum augue ullamcorper pretium molestie. Praesent lacus tellus, sagittis eu imperdiet sagittis, tincidunt nec quam. Donec in lorem ac nisl suscipit consectetur at at enim.\r\n\r\nMaecenas vitae magna id nunc ultrices interdum finibus commodo nunc. In lorem mi, vehicula molestie tortor luctus, molestie congue nunc. Praesent aliquet mollis rhoncus. Cras rutrum nec augue ac lobortis. Sed viverra justo a laoreet imperdiet. Nam egestas fermentum magna, et varius lectus tempus ac. Vestibulum sed libero nunc. Donec tempus euismod urna vel dapibus. Vivamus nec enim nisi. In feugiat, lectus sed mattis vulputate, augue nisi efficitur turpis, ac vestibulum justo risus nec arcu. Nulla et lorem id nibh consectetur congue. Fusce vel turpis eget magna consectetur semper. Duis suscipit, dui eu suscipit accumsan, nisl mi ullamcorper elit, vitae congue est nunc a libero. Integer eget mi dui. Phasellus vel elit scelerisque, consectetur quam cursus, tincidunt tortor.\r\n\r\nOrci varius natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Phasellus tempor gravida purus quis volutpat. Suspendisse tortor felis, consequat nec porta in, imperdiet id arcu. Curabitur ut sagittis ligula, eget lacinia nisl. Vestibulum vulputate dui nec metus tincidunt, sed efficitur sapien tempor. Nunc libero nulla, dictum tempor euismod quis, posuere non metus. Aenean enim ligula, luctus sed turpis eget, dapibus tincidunt dolor.\r\n\r\nDuis lorem mi, aliquam at maximus vel, scelerisque sit amet ex. Sed quis congue nulla. Sed eu maximus lacus, sed convallis ante. Aliquam ligula lectus, vulputate id est non, semper accumsan arcu. Nam elementum massa velit, sodales dapibus felis porta vel. Fusce a nibh id nibh molestie venenatis. Cras ac tincidunt nisi. Cras gravida molestie risus, in pharetra turpis blandit vitae. Phasellus enim felis, vestibulum in lacus ut, vestibulum lacinia velit.", 16, false, Alignment.TopLeft).Color.Value = color.Black;
151+
x.PositionInFrontOfUser(float3.Backward, distance: 1f);
152+
}
153+
public static void CreateSlider(Slot x) {
154+
x.Name = "Slider";
155+
x.GlobalScale = defaultScale;
156+
x.AttachComponent<Grabbable>();
157+
var _canvas = x.AttachComponent<Canvas>();
158+
_canvas.Size.Value = new float2(500, 64);
159+
UIBuilder ui = new UIBuilder(_canvas);
160+
ui.Panel(color.Black, true);
161+
ui.Slider(64f, 0.5f,0f, 1f, false);
162+
x.PositionInFrontOfUser(float3.Backward, distance: 1f);
163+
}
164+
public static void CreateText(Slot x) {
165+
x.Name = "Text";
166+
x.GlobalScale = defaultScale;
167+
x.AttachComponent<Grabbable>();
168+
var _canvas = x.AttachComponent<Canvas>();
169+
_canvas.Size.Value = new float2(245, 45);
170+
UIBuilder ui = new UIBuilder(_canvas);
171+
ui.Panel(color.White, true);
172+
var text = ui.Text("Text");
173+
text.Color.Value = color.Black;
174+
x.PositionInFrontOfUser(float3.Backward, distance: 1f);
175+
}
176+
public static void CreateTextField(Slot x) {
177+
x.Name = "Text Field";
178+
x.GlobalScale = defaultScale;
179+
x.AttachComponent<Grabbable>();
180+
var _canvas = x.AttachComponent<Canvas>();
181+
_canvas.Size.Value = new float2(245, 45);
182+
UIBuilder ui = new UIBuilder(_canvas);
183+
ui.Panel(color.Black, true);
184+
ui.TextField("Text Field");
185+
x.PositionInFrontOfUser(float3.Backward, distance: 1f);
186+
}
187+
}
188+
}

CreateNewUIX.csproj

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
4+
<PropertyGroup>
5+
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
6+
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
7+
<OutputType>Library</OutputType>
8+
<AppDesignerFolder>Properties</AppDesignerFolder>
9+
<RootNamespace>CreateNewUIX</RootNamespace>
10+
<AssemblyName>CreateNewUIX</AssemblyName>
11+
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
12+
<LangVersion>latestMajor</LangVersion>
13+
<FileAlignment>512</FileAlignment>
14+
<Deterministic>true</Deterministic>
15+
<TargetFrameworkProfile />
16+
<ProjectGuid>{F0A7A3C6-FA98-4B3D-BF98-E91B0B1BE75B}</ProjectGuid>
17+
<!-- If you don't want to provide a NeosPath in dotnet build, you can specify one here -->
18+
<!-- <NeosPath Condition="'$(NeosPath)'==''"></NeosPath> -->
19+
</PropertyGroup>
20+
<PropertyGroup Condition="'$(NeosPath)'==''">
21+
<!-- Windows steam -->
22+
<NeosPath Condition="Exists('C:\Program Files (x86)\Steam\steamapps\common\NeosVR\')">C:\Program Files (x86)\Steam\steamapps\common\NeosVR\</NeosPath>
23+
<!-- Windows standalone -->
24+
<NeosPath Condition="Exists('C:\Neos\app\')">C:\Neos\app\</NeosPath>
25+
<!-- Linux steam -->
26+
<NeosPath Condition="Exists('$(HOME)/.steam/steam/steamapps/common/NeosVR/')">$(HOME)/.steam/steam/steamapps/common/NeosVR/</NeosPath>
27+
</PropertyGroup>
28+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
29+
<DebugSymbols>true</DebugSymbols>
30+
<DebugType>full</DebugType>
31+
<Optimize>false</Optimize>
32+
<OutputPath>bin\Debug\</OutputPath>
33+
<DefineConstants>DEBUG;TRACE</DefineConstants>
34+
<ErrorReport>prompt</ErrorReport>
35+
<WarningLevel>4</WarningLevel>
36+
</PropertyGroup>
37+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
38+
<DebugType>pdbonly</DebugType>
39+
<Optimize>true</Optimize>
40+
<OutputPath>bin\Release\</OutputPath>
41+
<DefineConstants>TRACE</DefineConstants>
42+
<ErrorReport>prompt</ErrorReport>
43+
<WarningLevel>4</WarningLevel>
44+
</PropertyGroup>
45+
<ItemDefinitionGroup>
46+
<Reference>
47+
<Private>false</Private>
48+
</Reference>
49+
</ItemDefinitionGroup>
50+
<ItemGroup>
51+
<Reference Include="FrooxEngine">
52+
<HintPath>$(NeosPath)\Neos_Data\Managed\FrooxEngine.dll</HintPath>
53+
</Reference>
54+
<Reference Include="NeosModLoader">
55+
<HintPath>$(NeosPath)\Libraries\NeosModLoader.dll</HintPath>
56+
</Reference>
57+
<Reference Include="BaseX">
58+
<HintPath>$(NeosPath)\Neos_Data\Managed\BaseX.dll</HintPath>
59+
</Reference>
60+
<Reference Include="System" />
61+
</ItemGroup>
62+
<ItemGroup>
63+
<Compile Include="CreateNewUIX.cs" />
64+
<Compile Include="Properties\AssemblyInfo.cs" />
65+
</ItemGroup>
66+
<ItemGroup>
67+
<None Include="README.md" />
68+
</ItemGroup>
69+
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
70+
<PropertyGroup>
71+
<PostBuildEvent>
72+
</PostBuildEvent>
73+
</PropertyGroup>
74+
</Project>

CreateNewUIX.sln

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio Version 16
4+
VisualStudioVersion = 16.0.32228.343
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CreateNewUIX", "CreateNewUIX.csproj", "{F0A7A3C6-FA98-4B3D-BF98-E91B0B1BE75B}"
7+
EndProject
8+
Global
9+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
10+
Debug|Any CPU = Debug|Any CPU
11+
Release|Any CPU = Release|Any CPU
12+
EndGlobalSection
13+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
14+
{F0A7A3C6-FA98-4B3D-BF98-E91B0B1BE75B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15+
{F0A7A3C6-FA98-4B3D-BF98-E91B0B1BE75B}.Debug|Any CPU.Build.0 = Debug|Any CPU
16+
{F0A7A3C6-FA98-4B3D-BF98-E91B0B1BE75B}.Release|Any CPU.ActiveCfg = Release|Any CPU
17+
{F0A7A3C6-FA98-4B3D-BF98-E91B0B1BE75B}.Release|Any CPU.Build.0 = Release|Any CPU
18+
EndGlobalSection
19+
GlobalSection(SolutionProperties) = preSolution
20+
HideSolutionNode = FALSE
21+
EndGlobalSection
22+
GlobalSection(ExtensibilityGlobals) = postSolution
23+
SolutionGuid = {BABA468A-EB1B-4F65-A492-336CABE87349}
24+
EndGlobalSection
25+
EndGlobal

Properties/AssemblyInfo.cs

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
using System.Reflection;
2+
using System.Runtime.InteropServices;
3+
4+
// General Information about an assembly is controlled through the following
5+
// set of attributes. Change these attribute values to modify the information
6+
// associated with an assembly.
7+
[assembly: AssemblyTitle("CreateNewUIX")]
8+
[assembly: AssemblyDescription("")]
9+
[assembly: AssemblyConfiguration("")]
10+
[assembly: AssemblyCompany("XDelta")]
11+
[assembly: AssemblyProduct("CreateNewUIX")]
12+
[assembly: AssemblyCopyright("Copyright © XDelta 2023")]
13+
[assembly: AssemblyTrademark("")]
14+
[assembly: AssemblyCulture("")]
15+
16+
// Setting ComVisible to false makes the types in this assembly not visible
17+
// to COM components. If you need to access a type in this assembly from
18+
// COM, set the ComVisible attribute to true on that type.
19+
[assembly: ComVisible(false)]
20+
21+
// The following GUID is for the ID of the typelib if this project is exposed to COM
22+
[assembly: Guid("f0a7a3c6-fa98-4b3d-bf98-e91b0b1be75b")]
23+
24+
// Version information for an assembly consists of the following four values:
25+
//
26+
// Major Version
27+
// Minor Version
28+
// Build Number
29+
// Revision
30+
//
31+
// You can specify all the values or you can default the Build and Revision Numbers
32+
// by using the '*' as shown below:
33+
// [assembly: AssemblyVersion("1.0.*")]
34+
[assembly: AssemblyVersion("1.0.0")]
35+
[assembly: AssemblyFileVersion("1.0.0")]

README.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@ New UIX options will be found in `Create New > Object > Neos UIX`<br>
88
<br>
99
![image](https://user-images.githubusercontent.com/7883807/227723891-2a48839b-f0d8-4749-bccc-a684c36f6189.png)
1010

11-
12-
1311
## Installation
1412
1. Install [NeosModLoader](https://github.com/neos-modding-group/NeosModLoader).
1513
1. Place [CreateNewUIX.dll](https://github.com/XDelta/CreateNewUIX/releases/latest/download/CreateNewUIX.dll) into your `nml_mods` folder. This folder should be at `C:\Program Files (x86)\Steam\steamapps\common\NeosVR\nml_mods` for a default install. You can create it if it's missing, or if you launch the game once with NeosModLoader installed it will create the folder for you.

0 commit comments

Comments
 (0)