Skip to content

Commit

Permalink
Merge pull request #1 from o-tr/master
Browse files Browse the repository at this point in the history
v0.2.0をリリース
  • Loading branch information
o-tr authored Sep 3, 2024
2 parents cc72bd5 + 573f09e commit 581c1c4
Show file tree
Hide file tree
Showing 56 changed files with 1,432 additions and 659 deletions.
Binary file modified Assets/Models/image-slide-model.fbx
Binary file not shown.
Binary file modified Assets/Textures/SplashScreen/ImageSlide.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Assets/Textures/SplashScreen/ImageSlideViewer.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
41 changes: 17 additions & 24 deletions Prefabs/ImageSlideViewer.prefab
Original file line number Diff line number Diff line change
Expand Up @@ -1548,8 +1548,15 @@ MonoBehaviour:
PrefabModifications: []
SerializationNodes: []
_udonSharpBackingUdonBehaviour: {fileID: 36657328902437027}
logLevel: 0
splashImage: {fileID: 643319091859997542}
splashImageFitter: {fileID: 2269522274416780085}
isObjectSyncEnabled: 0
rootGameObject: {fileID: 7862952628220398662}
seekDisabled: 0
presentationTransform: {fileID: 5123357268474587353}
mainView: {fileID: 5369278872376500450}
slideList: {fileID: 9077831920044016191}
imageSlide: {fileID: 0}
animator: {fileID: 5470781304978789982}
slideMainView: {fileID: 7496012666510957034}
Expand Down Expand Up @@ -2002,10 +2009,10 @@ RectTransform:
- {fileID: 5199394745126046611}
m_Father: {fileID: 349200529895163626}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 960, y: -388}
m_SizeDelta: {x: 1920, y: 776}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &7299699285408374151
MonoBehaviour:
Expand Down Expand Up @@ -2393,7 +2400,7 @@ RectTransform:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5369278872376500450}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0.00008278423}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children:
Expand All @@ -2403,9 +2410,9 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 960, y: -388}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 1920, y: 776}
m_Pivot: {x: 0.5, y: 0.5}
m_Pivot: {x: 0, y: 1}
--- !u!222 &5921960647118335595
CanvasRenderer:
m_ObjectHideFlags: 0
Expand Down Expand Up @@ -3646,7 +3653,6 @@ GameObject:
- component: {fileID: 6321506635606379757}
- component: {fileID: 4802096402255859169}
- component: {fileID: 5470781304978789982}
- component: {fileID: 4884114067088642543}
m_Layer: 13
m_Name: GameObject
m_TagString: Untagged
Expand Down Expand Up @@ -3772,19 +3778,6 @@ Animator:
m_AllowConstantClipSamplingOptimization: 1
m_KeepAnimatorStateOnDisable: 0
m_WriteDefaultValuesOnDisable: 0
--- !u!114 &4884114067088642543
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7862952628220398662}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: -1783056023, guid: 661092b4961be7145bfbe56e1e62337b, type: 3}
m_Name:
m_EditorClassIdentifier:
AllowCollisionOwnershipTransfer: 1
--- !u!1 &7891373250867704291
GameObject:
m_ObjectHideFlags: 0
Expand Down Expand Up @@ -4310,7 +4303,7 @@ RectTransform:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 9077831920044016191}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalPosition: {x: 0, y: 0, z: 0.13189597}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children:
Expand All @@ -4320,9 +4313,9 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 960, y: -930}
m_AnchoredPosition: {x: 0, y: -780}
m_SizeDelta: {x: 1920, y: 300}
m_Pivot: {x: 0.5, y: 0.5}
m_Pivot: {x: 0, y: 1}
--- !u!114 &6958512940954748803
MonoBehaviour:
m_ObjectHideFlags: 0
Expand Down
6 changes: 4 additions & 2 deletions Runtime/Editor/ImageSlideEditor.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System;
#if UNITY_EDITOR
using System;
using System.Collections.Generic;
using System.Linq;
using jp.ootr.common;
Expand Down Expand Up @@ -332,4 +333,5 @@ public static void ApplyArray(this SerializedProperty property, string[] data)
for (var i = 0; i < data.Length; i++) property.GetArrayElementAtIndex(i).stringValue = data[i];
}
}
}
}
#endif
76 changes: 57 additions & 19 deletions Runtime/Editor/ImageSlideViewerEditor.cs
Original file line number Diff line number Diff line change
@@ -1,20 +1,26 @@
using jp.ootr.common;
#if UNITY_EDITOR
using jp.ootr.common;
using jp.ootr.ImageSlide.Viewer;
using UnityEditor;
using UnityEngine;
using VRC.SDK3.Components;
using VRC.SDKBase.Editor.BuildPipeline;

namespace jp.ootr.ImageSlide.Editor
namespace jp.ootr.ImageSlide.Editor.Viewer
{
[CustomEditor(typeof(ImageSlideViewer))]
public class ImageSlideViewerEditor : UnityEditor.Editor
{
private bool _debug;
private SerializedProperty _imageSlide;
private SerializedProperty _isObjectSyncEnabled;
private SerializedProperty _seekDisabled;

public virtual void OnEnable()
{
_imageSlide = serializedObject.FindProperty("imageSlide");
_seekDisabled = serializedObject.FindProperty("seekDisabled");
_isObjectSyncEnabled = serializedObject.FindProperty("isObjectSyncEnabled");
}

public override void OnInspectorGUI()
Expand Down Expand Up @@ -48,12 +54,24 @@ public override void OnInspectorGUI()

EditorGUILayout.Space();

serializedObject.Update();
EditorGUILayout.PropertyField(_seekDisabled, new GUIContent("Seek Disabled"));
serializedObject.ApplyModifiedProperties();

EditorGUILayout.Space();

serializedObject.Update();
EditorGUILayout.PropertyField(_isObjectSyncEnabled, new GUIContent("Object Sync Enabled"));
serializedObject.ApplyModifiedProperties();

script.splashImage.texture =
(Texture)EditorGUILayout.ObjectField("Splash Image", script.splashImage.texture, typeof(Texture),
false);


if (!EditorGUI.EndChangeCheck()) return;
script.SetSeekDisabled(script.seekDisabled);
ImageSlideViewerUtils.UpdateObjectSync(script);

EditorUtility.SetDirty(script);
}
Expand All @@ -65,9 +83,9 @@ private void ShowScriptName()
}

[InitializeOnLoad]
public class PlayModeNotifier_ImageSlideviewer
public class PlayModeNotifier
{
static PlayModeNotifier_ImageSlideviewer()
static PlayModeNotifier()
{
EditorApplication.playModeStateChanged += OnPlayModeStateChanged;
}
Expand All @@ -78,43 +96,63 @@ private static void OnPlayModeStateChanged(PlayModeStateChange state)
{
var imageSlideViewer = ComponentUtils.GetAllComponents<ImageSlideViewer>();

ImageSlideViewerUtils.ValidateImageSlide(imageSlideViewer.ToArray());
ImageSlideViewerUtils.ValidateImageSlides(imageSlideViewer.ToArray());
}
}
}

public class SetObjectReferences_ImageSlideViewer : UnityEditor.Editor, IVRCSDKBuildRequestedCallback
public class SetObjectReferences : UnityEditor.Editor, IVRCSDKBuildRequestedCallback
{
public int callbackOrder => 12;

public bool OnBuildRequested(VRCSDKRequestedBuildType requestedBuildType)
{
var imageSlideViewer = ComponentUtils.GetAllComponents<ImageSlideViewer>();

return ImageSlideViewerUtils.ValidateImageSlide(imageSlideViewer.ToArray());
return ImageSlideViewerUtils.ValidateImageSlides(imageSlideViewer.ToArray());
}
}

public static class ImageSlideViewerUtils
{
public static bool ValidateImageSlide(ImageSlideViewer[] imageSlideViewers)
public static bool ValidateImageSlides(ImageSlideViewer[] imageSlideViewers)
{
var flag = true;
foreach (var viewer in imageSlideViewers)
{
if (viewer.imageSlide == null)
{
Debug.LogWarning("ImageSlideViewer: ImageSlide is not assigned");
if (!ValidateImageSlide(viewer))
flag = false;
continue;
}

if (viewer.imageSlide.listeners.Has(viewer)) continue;
viewer.imageSlide.listeners = viewer.imageSlide.listeners.Append(viewer);
EditorUtility.SetDirty(viewer.imageSlide);
return flag;
}

public static bool ValidateImageSlide(ImageSlideViewer imageSlideViewer)
{
if (imageSlideViewer.imageSlide == null)
{
Debug.LogWarning("ImageSlideViewer: ImageSlide is not assigned");
return false;
}

return flag;
UpdateObjectSync(imageSlideViewer);

if (imageSlideViewer.imageSlide.listeners.Has(imageSlideViewer)) return true;
imageSlideViewer.imageSlide.listeners = imageSlideViewer.imageSlide.listeners.Append(imageSlideViewer);
EditorUtility.SetDirty(imageSlideViewer.imageSlide);
return true;
}

public static void UpdateObjectSync(ImageSlideViewer imageSlideViewer)
{
var currentSyncObj = imageSlideViewer.rootGameObject.GetComponent<VRCObjectSync>();
if (imageSlideViewer.isObjectSyncEnabled)
{
if (currentSyncObj == null) imageSlideViewer.rootGameObject.AddComponent<VRCObjectSync>();
}
else
{
if (currentSyncObj != null) Object.DestroyImmediate(currentSyncObj);
}
}
}
}
}
#endif
8 changes: 8 additions & 0 deletions Runtime/jp.ootr.ImageSlide/Scripts.meta

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

Original file line number Diff line number Diff line change
Expand Up @@ -49,4 +49,4 @@ public enum QueueType
SeekTo,
UpdateList
}
}
}
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,4 @@ public void OnCloseOverlay()
animator.SetInteger(_animatorOverlay, 0);
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,4 @@ public void CloseErrorModal()
errorModal.SetActive(false);
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,4 @@ protected virtual void HideSyncingModal()
syncingModal.SetActive(false);
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,4 @@ public override void _OnDeserialization()
SendCustomEventDelayedFrames(nameof(DoSyncQueue), 1, EventTiming.LateUpdate);
}
}
}
}
Loading

0 comments on commit 581c1c4

Please sign in to comment.