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

Commit fabb331

Browse files
committed
Implement ReMirroredWingButton.Interactable and remove unneeded usings.
1 parent aee3e56 commit fabb331

16 files changed

Lines changed: 39 additions & 44 deletions

EnumExtensions.cs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
11
using System;
2-
using System.Collections.Generic;
3-
using System.Linq;
4-
using System.Text;
5-
using System.Threading.Tasks;
62

73
namespace ReMod.Core
84
{

Managers/ResourceManager.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
using System;
22
using System.Collections.Generic;
3-
using System.IO;
4-
using System.Reflection;
53
using UnityEngine;
64

75
namespace ReMod.Core.Managers

Managers/UiManager.cs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
1-
using System;
2-
using ReMod.Core.UI;
3-
using ReMod.Core.UI.QuickMenu;
1+
using ReMod.Core.UI.QuickMenu;
42
using ReMod.Core.VRChat;
53
using UnityEngine;
6-
using UnityEngine.UI;
7-
using VRC.UI.Elements;
84

95
namespace ReMod.Core.Managers
106
{

UI/QuickMenu/ReCategoryPage.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
using System;
2-
using System.Collections.Generic;
32
using System.Linq;
43
using ReMod.Core.VRChat;
54
using TMPro;

UI/QuickMenu/ReMenuCategory.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
using System;
2-
using System.Collections.Generic;
3-
using System.Linq;
42
using ReMod.Core.VRChat;
53
using TMPro;
64
using UnityEngine;

UI/QuickMenu/ReMenuPage.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
using System;
2-
using System.Collections.Generic;
32
using System.Linq;
43
using ReMod.Core.VRChat;
54
using TMPro;

UI/Wings/ReMirroredWingButton.cs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
11
using System;
2-
using System.Collections.Generic;
3-
using System.Linq;
4-
using System.Text;
5-
using System.Threading.Tasks;
62
using UnityEngine;
73
using Object = UnityEngine.Object;
84

UI/Wings/ReMirroredWingToggle.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,16 @@ public class ReMirroredWingToggle
77
{
88
private readonly ReWingToggle _leftToggle;
99
private readonly ReWingToggle _rightToggle;
10+
11+
public bool Interactable
12+
{
13+
get => _leftToggle.Interactable;
14+
set
15+
{
16+
_leftToggle.Interactable = value;
17+
_rightToggle.Interactable = value;
18+
}
19+
}
1020

1121
public ReMirroredWingToggle(string text, string tooltip, Action<bool> onToggle, Transform leftParent,
1222
Transform rightParent, bool defaultValue = false)

UI/Wings/ReWingButton.cs

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
using TMPro;
44
using UnityEngine;
55
using UnityEngine.UI;
6+
using VRC.UI.Core.Styles;
67

78
namespace ReMod.Core.UI.Wings
89
{
@@ -36,6 +37,19 @@ public Sprite Sprite
3637
}
3738
}
3839

40+
private readonly StyleElement _styleElement;
41+
private readonly Button _button;
42+
public bool Interactable
43+
{
44+
get => _button.interactable;
45+
set
46+
{
47+
_button.interactable = value;
48+
_styleElement.Method_Private_Void_Boolean_0(value);
49+
}
50+
}
51+
52+
3953
public ReWingButton(string text, string tooltip, Action onClick, Sprite sprite = null, bool left = true,
4054
bool arrow = true, bool background = true, bool separator = false) :
4155
this(text, tooltip, onClick,
@@ -59,9 +73,11 @@ public ReWingButton(string text, string tooltip, Action onClick, Transform paren
5973
tmp.text = text;
6074
tmp.richText = true;
6175

62-
var button = GameObject.GetComponent<Button>();
63-
button.onClick = new Button.ButtonClickedEvent();
64-
button.onClick.AddListener(new Action(onClick));
76+
_styleElement = GameObject.GetComponent<StyleElement>();
77+
78+
_button = GameObject.GetComponent<Button>();
79+
_button.onClick = new Button.ButtonClickedEvent();
80+
_button.onClick.AddListener(new Action(onClick));
6581

6682
var uiTooltip = GameObject.GetComponent<VRC.UI.Elements.Tooltips.UiTooltip>();
6783
uiTooltip.field_Public_String_0 = tooltip;

UI/Wings/ReWingToggle.cs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,7 @@
11
using System;
2-
using System.Collections.Generic;
3-
using System.Linq;
4-
using System.Text;
5-
using System.Threading.Tasks;
6-
using ReMod.Core.Managers;
72
using ReMod.Core.VRChat;
83
using UnityEngine;
4+
using UnityEngine.UI;
95

106
namespace ReMod.Core.UI.Wings
117
{
@@ -16,6 +12,12 @@ public class ReWingToggle
1612

1713
private bool _state;
1814

15+
public bool Interactable
16+
{
17+
get => _button.Interactable;
18+
set => _button.Interactable = value;
19+
}
20+
1921
public ReWingToggle(string text, string tooltip, Action<bool> onToggle, Transform parent, bool defaultValue = false)
2022
{
2123
_onToggle = onToggle;

0 commit comments

Comments
 (0)