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

Commit

Permalink
Added paste button to VRChat popups.
Browse files Browse the repository at this point in the history
  • Loading branch information
RequiDev committed Aug 14, 2021
1 parent b84f1db commit 53c7931
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 0 deletions.
34 changes: 34 additions & 0 deletions ReModCE/Components/PopupExComponent.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using ReModCE.Core;
using ReModCE.Managers;
using UnityEngine;
using UnityEngine.UI;
using Object = UnityEngine.Object;

namespace ReModCE.Components
{
internal class PopupExComponent : ModComponent
{
public override void OnUiManagerInit(UiManager uiManager)
{
var inputPopup = GameObject.Find("UserInterface/MenuContent/Popups/InputPopup").transform;
var pasteButton = Object.Instantiate(inputPopup.Find("ButtonRight").gameObject, inputPopup);
pasteButton.name = "ButtonPaste";
pasteButton.transform.localPosition += new Vector3(320f, 0f);
pasteButton.GetComponentInChildren<Text>().text = "Paste";

var inputField = inputPopup.GetComponentInChildren<InputField>();

var button = pasteButton.GetComponentInChildren<Button>();
button.onClick = new Button.ButtonClickedEvent();
button.onClick.AddListener(new Action(() =>
{
inputField.text = GUIUtility.systemCopyBuffer;
}));
}
}
}
5 changes: 5 additions & 0 deletions ReModCE/ReModCE.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,10 @@
<SpecificVersion>False</SpecificVersion>
<HintPath>..\Dependencies\Managed\UnityEngine.CoreModule.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.IMGUIModule, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\Dependencies\Managed\UnityEngine.IMGUIModule.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.InputLegacyModule, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<Private>false</Private>
<SpecificVersion>False</SpecificVersion>
Expand Down Expand Up @@ -182,6 +186,7 @@
<Compile Include="Components\AvatarFavoritesComponent.cs" />
<Compile Include="Components\DynamicBonesComponent.cs" />
<Compile Include="Components\FlyComponent.cs" />
<Compile Include="Components\PopupExComponent.cs" />
<Compile Include="Components\RecentAvatarsComponent.cs" />
<Compile Include="Components\ThirdPersonComponent.cs" />
<Compile Include="Core\EnableDisableListener.cs" />
Expand Down

0 comments on commit 53c7931

Please sign in to comment.