Skip to content

Commit

Permalink
Add Re-Sync Button & Global Sync Button
Browse files Browse the repository at this point in the history
  • Loading branch information
JLChnToZ committed Sep 1, 2023
1 parent 783a3b4 commit 8b20fb2
Show file tree
Hide file tree
Showing 8 changed files with 904 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.SceneManagement;
using UnityEditor.Build;
using UnityEditor.Build.Reporting;
using UnityEditor.Events;
using UdonSharpEditor;

namespace JLChnToZ.VRC.VVMW.Designer {
internal sealed class ResyncButtonPreprocessor : IProcessSceneWithReport {
public int callbackOrder => -1;

public void OnProcessScene(Scene scene, BuildReport report) {
foreach (var entry in scene.IterateAllComponents<ResyncButtonConfigurator>()) {
if (!entry.TryGetComponent(out Button button)) {
Debug.LogWarning($"[ResyncButton] No button component in {entry.name}. This should not happen.", entry);
continue;
}
if (entry.core == null) {
Debug.LogWarning($"[ResyncButton] Core component in {entry.name} is not assigned.", entry);
continue;
}
var udon = UdonSharpEditorUtility.GetBackingUdonBehaviour(entry.core);
if (udon == null) {
Debug.LogWarning($"[ResyncButton] Misconfigurated Core component in {entry.name}.", entry);
continue;
}
UnityEventTools.AddStringPersistentListener(
button.onClick,
udon.SendCustomEvent,
entry.globalSync ? nameof(Core.GlobalSync) : nameof(Core.LocalSync)
);
}
}
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

152 changes: 152 additions & 0 deletions Packages/idv.jlchntoz.vvmw/Prefabs/Global Sync Button.prefab
Original file line number Diff line number Diff line change
@@ -0,0 +1,152 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1001 &1667209002103275573
PrefabInstance:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
m_TransformParent: {fileID: 0}
m_Modifications:
- target: {fileID: 2135834656162038991, guid: a9c62789c705a85428df158bfee22825,
type: 3}
propertyPath: serializationData.Prefab
value:
objectReference: {fileID: 2135834656162038991, guid: a9c62789c705a85428df158bfee22825,
type: 3}
- target: {fileID: 3129433485070536689, guid: a9c62789c705a85428df158bfee22825,
type: 3}
propertyPath: m_AnchorMax.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3129433485070536689, guid: a9c62789c705a85428df158bfee22825,
type: 3}
propertyPath: m_AnchorMin.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3129433485070536689, guid: a9c62789c705a85428df158bfee22825,
type: 3}
propertyPath: m_SizeDelta.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3129433485070536689, guid: a9c62789c705a85428df158bfee22825,
type: 3}
propertyPath: m_SizeDelta.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3129433485070536689, guid: a9c62789c705a85428df158bfee22825,
type: 3}
propertyPath: m_AnchoredPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3129433485070536689, guid: a9c62789c705a85428df158bfee22825,
type: 3}
propertyPath: m_AnchoredPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3180401798966787971, guid: a9c62789c705a85428df158bfee22825,
type: 3}
propertyPath: m_Size.x
value: 300
objectReference: {fileID: 0}
- target: {fileID: 3274486473114602996, guid: a9c62789c705a85428df158bfee22825,
type: 3}
propertyPath: m_RootOrder
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3274486473114602996, guid: a9c62789c705a85428df158bfee22825,
type: 3}
propertyPath: m_LocalPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3274486473114602996, guid: a9c62789c705a85428df158bfee22825,
type: 3}
propertyPath: m_LocalPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3274486473114602996, guid: a9c62789c705a85428df158bfee22825,
type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3274486473114602996, guid: a9c62789c705a85428df158bfee22825,
type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3274486473114602996, guid: a9c62789c705a85428df158bfee22825,
type: 3}
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3586576509636266015, guid: a9c62789c705a85428df158bfee22825,
type: 3}
propertyPath: globalSync
value: 1
objectReference: {fileID: 0}
- target: {fileID: 6947233848682010541, guid: a9c62789c705a85428df158bfee22825,
type: 3}
propertyPath: m_AnchorMax.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 6947233848682010541, guid: a9c62789c705a85428df158bfee22825,
type: 3}
propertyPath: m_AnchorMin.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 6947233848682010541, guid: a9c62789c705a85428df158bfee22825,
type: 3}
propertyPath: m_SizeDelta.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 6947233848682010541, guid: a9c62789c705a85428df158bfee22825,
type: 3}
propertyPath: m_SizeDelta.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 6947233848682010541, guid: a9c62789c705a85428df158bfee22825,
type: 3}
propertyPath: m_AnchoredPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 6947233848682010541, guid: a9c62789c705a85428df158bfee22825,
type: 3}
propertyPath: m_AnchoredPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 6966352474747331409, guid: a9c62789c705a85428df158bfee22825,
type: 3}
propertyPath: m_Name
value: Global Sync Button Variant
objectReference: {fileID: 0}
- target: {fileID: 8604344439434953016, guid: a9c62789c705a85428df158bfee22825,
type: 3}
propertyPath: m_AnchorMax.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 8604344439434953016, guid: a9c62789c705a85428df158bfee22825,
type: 3}
propertyPath: m_AnchorMin.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 8604344439434953016, guid: a9c62789c705a85428df158bfee22825,
type: 3}
propertyPath: m_SizeDelta.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 8604344439434953016, guid: a9c62789c705a85428df158bfee22825,
type: 3}
propertyPath: m_SizeDelta.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 8604344439434953016, guid: a9c62789c705a85428df158bfee22825,
type: 3}
propertyPath: m_AnchoredPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 8604344439434953016, guid: a9c62789c705a85428df158bfee22825,
type: 3}
propertyPath: m_AnchoredPosition.y
value: 0
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: a9c62789c705a85428df158bfee22825, type: 3}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 8b20fb2

Please sign in to comment.