Skip to content
This repository was archived by the owner on Jan 24, 2023. It is now read-only.

Commit bbf50b1

Browse files
committed
Add Funny Slider
1 parent aee3e56 commit bbf50b1

9 files changed

Lines changed: 329 additions & 32 deletions

File tree

ReMod.Core.csproj

Lines changed: 18 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -41,76 +41,61 @@
4141
</PropertyGroup>
4242
<ItemGroup>
4343
<Reference Include="Assembly-CSharp">
44-
<HintPath>..\3rdparty\ml\Managed\Assembly-CSharp.dll</HintPath>
45-
<Private>False</Private>
44+
<HintPath>..\..\Program Files (x86)\Steam\steamapps\common\VRChat\MelonLoader\Managed\Assembly-CSharp.dll</HintPath>
4645
</Reference>
4746
<Reference Include="DataModel">
48-
<HintPath>..\3rdparty\ml\Managed\DataModel.dll</HintPath>
49-
<Private>False</Private>
47+
<HintPath>..\..\Program Files (x86)\Steam\steamapps\common\VRChat\MelonLoader\Managed\DataModel.dll</HintPath>
5048
</Reference>
5149
<Reference Include="Il2Cppmscorlib">
52-
<HintPath>..\3rdparty\ml\Managed\Il2Cppmscorlib.dll</HintPath>
53-
<Private>False</Private>
50+
<HintPath>..\..\Program Files (x86)\Steam\steamapps\common\VRChat\MelonLoader\Managed\Il2Cppmscorlib.dll</HintPath>
5451
</Reference>
5552
<Reference Include="MelonLoader">
56-
<HintPath>..\3rdparty\ml\MelonLoader.dll</HintPath>
57-
<Private>False</Private>
53+
<HintPath>..\..\Program Files (x86)\Steam\steamapps\common\VRChat\MelonLoader\MelonLoader.dll</HintPath>
5854
</Reference>
5955
<Reference Include="Photon-DotNet">
60-
<HintPath>..\3rdparty\ml\Managed\Photon-DotNet.dll</HintPath>
61-
<Private>False</Private>
56+
<HintPath>..\..\Program Files (x86)\Steam\steamapps\common\VRChat\MelonLoader\Managed\Photon-DotNet.dll</HintPath>
6257
</Reference>
6358
<Reference Include="System" />
6459
<Reference Include="System.Core" />
6560
<Reference Include="UnhollowerBaseLib">
66-
<HintPath>..\3rdparty\ml\Managed\UnhollowerBaseLib.dll</HintPath>
67-
<Private>False</Private>
61+
<HintPath>..\..\Program Files (x86)\Steam\steamapps\common\VRChat\MelonLoader\Managed\UnhollowerBaseLib.dll</HintPath>
6862
</Reference>
6963
<Reference Include="Unity.TextMeshPro">
70-
<HintPath>..\3rdparty\ml\Managed\Unity.TextMeshPro.dll</HintPath>
71-
<Private>False</Private>
64+
<HintPath>..\..\Program Files (x86)\Steam\steamapps\common\VRChat\MelonLoader\Managed\Unity.TextMeshPro.dll</HintPath>
7265
</Reference>
7366
<Reference Include="UnityEngine">
74-
<HintPath>..\3rdparty\ml\Managed\UnityEngine.dll</HintPath>
75-
<Private>False</Private>
67+
<HintPath>..\..\Program Files (x86)\Steam\steamapps\common\VRChat\MelonLoader\Managed\UnityEngine.dll</HintPath>
7668
</Reference>
7769
<Reference Include="UnityEngine.CoreModule">
78-
<HintPath>..\3rdparty\ml\Managed\UnityEngine.CoreModule.dll</HintPath>
79-
<Private>False</Private>
70+
<HintPath>..\..\Program Files (x86)\Steam\steamapps\common\VRChat\MelonLoader\Managed\UnityEngine.CoreModule.dll</HintPath>
8071
</Reference>
8172
<Reference Include="UnityEngine.ImageConversionModule">
82-
<HintPath>..\3rdparty\ml\Managed\UnityEngine.ImageConversionModule.dll</HintPath>
83-
<Private>False</Private>
73+
<HintPath>..\..\Program Files (x86)\Steam\steamapps\common\VRChat\MelonLoader\Managed\UnityEngine.ImageConversionModule.dll</HintPath>
8474
</Reference>
8575
<Reference Include="UnityEngine.TextRenderingModule">
86-
<HintPath>..\3rdparty\ml\Managed\UnityEngine.TextRenderingModule.dll</HintPath>
87-
<Private>False</Private>
76+
<HintPath>..\..\Program Files (x86)\Steam\steamapps\common\VRChat\MelonLoader\Managed\UnityEngine.TextRenderingModule.dll</HintPath>
8877
</Reference>
8978
<Reference Include="UnityEngine.UI">
90-
<HintPath>..\3rdparty\ml\Managed\UnityEngine.UI.dll</HintPath>
91-
<Private>False</Private>
79+
<HintPath>..\..\Program Files (x86)\Steam\steamapps\common\VRChat\MelonLoader\Managed\UnityEngine.UI.dll</HintPath>
9280
</Reference>
9381
<Reference Include="VRC.UI.Core">
94-
<HintPath>..\3rdparty\ml\Managed\VRC.UI.Core.dll</HintPath>
95-
<Private>False</Private>
82+
<HintPath>..\..\Program Files (x86)\Steam\steamapps\common\VRChat\MelonLoader\Managed\VRC.UI.Core.dll</HintPath>
9683
</Reference>
9784
<Reference Include="VRC.UI.Elements">
98-
<HintPath>..\3rdparty\ml\Managed\VRC.UI.Elements.dll</HintPath>
99-
<Private>False</Private>
85+
<HintPath>..\..\Program Files (x86)\Steam\steamapps\common\VRChat\MelonLoader\Managed\VRC.UI.Elements.dll</HintPath>
10086
</Reference>
10187
<Reference Include="VRCCore-Standalone">
102-
<HintPath>..\3rdparty\ml\Managed\VRCCore-Standalone.dll</HintPath>
103-
<Private>False</Private>
88+
<HintPath>..\..\Program Files (x86)\Steam\steamapps\common\VRChat\MelonLoader\Managed\VRCCore-Standalone.dll</HintPath>
10489
</Reference>
10590
<Reference Include="VRCSDKBase">
106-
<HintPath>..\3rdparty\ml\Managed\VRCSDKBase.dll</HintPath>
107-
<Private>False</Private>
91+
<HintPath>..\..\Program Files (x86)\Steam\steamapps\common\VRChat\MelonLoader\Managed\VRCSDKBase.dll</HintPath>
10892
</Reference>
10993
</ItemGroup>
11094
<ItemGroup>
11195
<Compile Include="EnumExtensions.cs" />
11296
<Compile Include="Managers\ConfigManager.cs" />
11397
<Compile Include="UI\QuickMenu\IButtonPage.cs" />
98+
<Compile Include="UI\QuickMenu\ReSliderCategory.cs" />
11499
<Compile Include="UI\Wings\ReMirroredWingButton.cs" />
115100
<Compile Include="UI\Wings\ReMirroredWingMenu.cs" />
116101
<Compile Include="UI\Wings\ReMirroredWingToggle.cs" />
@@ -128,6 +113,7 @@
128113
<Compile Include="UI\QuickMenu\ReMenuCategory.cs" />
129114
<Compile Include="UI\QuickMenu\ReMenuPage.cs" />
130115
<Compile Include="UI\QuickMenu\ReMenuToggle.cs" />
116+
<Compile Include="UI\QuickMenu\ReMenuSlider.cs" />
131117
<Compile Include="UI\QuickMenu\ReTabButton.cs" />
132118
<Compile Include="UI\ReUiButton.cs" />
133119
<Compile Include="UI\ReUiText.cs" />

ReMod.Core.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 17
4+
VisualStudioVersion = 17.0.31919.166
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ReMod.Core", "ReMod.Core.csproj", "{C87FE758-ACB9-4FA2-AF6F-10AA9AA0023C}"
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+
{C87FE758-ACB9-4FA2-AF6F-10AA9AA0023C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15+
{C87FE758-ACB9-4FA2-AF6F-10AA9AA0023C}.Debug|Any CPU.Build.0 = Debug|Any CPU
16+
{C87FE758-ACB9-4FA2-AF6F-10AA9AA0023C}.Release|Any CPU.ActiveCfg = Release|Any CPU
17+
{C87FE758-ACB9-4FA2-AF6F-10AA9AA0023C}.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 = {21C666F1-F555-4FA6-9C95-81D581FAD122}
24+
EndGlobalSection
25+
EndGlobal

UI/QuickMenu/IButtonPage.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ public interface IButtonPage
88
ReMenuButton AddButton(string text, string tooltip, Action onClick, Sprite sprite = null);
99
ReMenuToggle AddToggle(string text, string tooltip, Action<bool> onToggle, bool defaultValue = false);
1010
ReMenuToggle AddToggle(string text, string tooltip, ConfigValue<bool> configValue);
11+
ReMenuSlider AddSlider(string text, string tooltip, Action<float> onSlide, float defaultValue = 0, float minValue = 0, float maxValue = 10);
12+
ReMenuSlider AddSlider(string text, string tooltip, ConfigValue<float> configValue, float defaultValue = 0, float minValue = 0, float maxValue = 10);
1113
ReMenuPage AddMenuPage(string text, string tooltip = "", Sprite sprite = null);
1214
ReCategoryPage AddCategoryPage(string text, string tooltip = "", Sprite sprite = null);
1315
ReMenuPage GetMenuPage(string name);

UI/QuickMenu/ReCategoryPage.cs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,21 @@ public ReMenuCategory GetCategory(string name)
134134
return new ReMenuCategory(header, buttonContainer);
135135
}
136136

137+
public ReMenuSliderCategory AddSliderCategory(string title)
138+
{
139+
return GetSliderCategory(title) ?? new ReMenuSliderCategory(title, _container);
140+
}
141+
142+
public ReMenuSliderCategory GetSliderCategory(string name)
143+
{
144+
var headerTransform = _container.Find($"Header_{GetCleanName(name)}");
145+
if (headerTransform == null) return null;
146+
147+
var header = new ReMenuHeader(headerTransform);
148+
var sliderContainer = new ReMenuSliderContainer(_container.Find($"Buttons_{GetCleanName(name)}"));
149+
return new ReMenuSliderCategory(header, sliderContainer);
150+
}
151+
137152
public static ReCategoryPage Create(string text, bool isRoot)
138153
{
139154
return new ReCategoryPage(text, isRoot);

UI/QuickMenu/ReMenuCategory.cs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,18 @@ public ReMenuToggle AddToggle(string text, string tooltip, ConfigValue<bool> con
192192
return toggle;
193193
}
194194

195+
public ReMenuSlider AddSlider(string text, string tooltip, Action<float> onSlide, float defaultValue = 0, float minValue = 0, float maxValue = 10)
196+
{
197+
var slider = new ReMenuSlider(text, tooltip, onSlide, _buttonContainer.RectTransform, defaultValue, minValue, maxValue);
198+
return slider;
199+
}
200+
201+
public ReMenuSlider AddSlider(string text, string tooltip, ConfigValue<float> configValue, float defaultValue = 0, float minValue = 0, float maxValue = 10)
202+
{
203+
var slider = new ReMenuSlider(text, tooltip, configValue.SetValue, _buttonContainer.RectTransform, configValue, minValue, maxValue);
204+
return slider;
205+
}
206+
195207
public ReMenuPage AddMenuPage(string text, string tooltip = "", Sprite sprite = null)
196208
{
197209
var existingPage = GetMenuPage(text);

UI/QuickMenu/ReMenuPage.cs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,18 @@ public ReMenuToggle AddToggle(string text, string tooltip, ConfigValue<bool> con
156156
return new ReMenuToggle(text, tooltip, configValue.SetValue, _container, configValue);
157157
}
158158

159+
public ReMenuSlider AddSlider(string text, string tooltip, Action<float> onSlide, float defaultValue = 0, float minValue = 0, float maxValue = 10)
160+
{
161+
var slider = new ReMenuSlider(text, tooltip, onSlide, _container, defaultValue, minValue, maxValue);
162+
return slider;
163+
}
164+
165+
public ReMenuSlider AddSlider(string text, string tooltip, ConfigValue<float> configValue, float defaultValue = 0, float minValue = 0, float maxValue = 10)
166+
{
167+
var slider = new ReMenuSlider(text, tooltip, configValue.SetValue, _container, configValue, minValue, maxValue);
168+
return slider;
169+
}
170+
159171
public ReMenuPage AddMenuPage(string text, string tooltip = "", Sprite sprite = null)
160172
{
161173
var existingPage = GetMenuPage(text);

UI/QuickMenu/ReMenuSlider.cs

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
using System;
2+
using ReMod.Core.Unity;
3+
using ReMod.Core.VRChat;
4+
using TMPro;
5+
using UnityEngine;
6+
using UnityEngine.UI;
7+
using VRC.UI.Elements.Controls;
8+
9+
namespace ReMod.Core.UI.QuickMenu
10+
{
11+
public class ReMenuSlider : UiElement
12+
{
13+
private readonly Slider _sliderComponent;
14+
15+
public bool Interactable
16+
{
17+
get => _sliderComponent.interactable;
18+
set => _sliderComponent.interactable = value;
19+
}
20+
21+
private float _valueHolder;
22+
23+
public ReMenuSlider(string text, string tooltip, Action<float> onSlide, Transform parent, float defaultValue = 0, float minValue = 0, float maxValue = 10) : base(QuickMenuEx.SliderPrefab, parent, $"Slider_{text}")
24+
{
25+
GameObject.DestroyImmediate(GameObject.GetComponent<UIInvisibleGraphic>()); // Fix for having clickable area overlap main quickmenu ui
26+
27+
var name = GameObject.transform.GetChild(0).GetComponentInChildren<TextMeshProUGUI>();
28+
name.text = text;
29+
30+
var value = GameObject.transform.GetChild(1).GetComponentInChildren<TextMeshProUGUI>();
31+
value.text = defaultValue.ToString(); //This shit don't work
32+
33+
_sliderComponent = GameObject.GetComponentInChildren<Slider>();
34+
_sliderComponent.onValueChanged = new Slider.SliderEvent();
35+
_sliderComponent.onValueChanged.AddListener(new Action<float>(onSlide));
36+
_sliderComponent.onValueChanged.AddListener((Action<float>)delegate (float val) { value.text = val.ToString(); });
37+
_sliderComponent.minValue = minValue;
38+
_sliderComponent.maxValue = maxValue;
39+
_sliderComponent.value = defaultValue;
40+
41+
var uiTooltip = GameObject.GetComponent<VRC.UI.Elements.Tooltips.UiTooltip>();
42+
uiTooltip.field_Public_String_0 = tooltip;
43+
uiTooltip.field_Public_String_1 = tooltip;
44+
45+
Slide(defaultValue,false);
46+
47+
EnableDisableListener.RegisterSafe();
48+
var edl = GameObject.AddComponent<EnableDisableListener>();
49+
}
50+
51+
public ReMenuSlider(Transform transform) : base(transform)
52+
{
53+
_sliderComponent = GameObject.GetComponent<Slider>();
54+
}
55+
56+
public void Slide(float value, bool callback = true)
57+
{
58+
_valueHolder = value;
59+
_sliderComponent.Set(value, callback);
60+
}
61+
}
62+
}

0 commit comments

Comments
 (0)