Skip to content

Commit

Permalink
Merge pull request #7 from o-tr/master
Browse files Browse the repository at this point in the history
v0.2.5をリリース
  • Loading branch information
o-tr authored Nov 14, 2024
2 parents 3f11057 + d836a29 commit e573b36
Show file tree
Hide file tree
Showing 13 changed files with 2,984 additions and 957 deletions.
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.
2,704 changes: 2,035 additions & 669 deletions Prefabs/ImageSlide.prefab

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions Prefabs/ImageSlideViewer.prefab
Original file line number Diff line number Diff line change
Expand Up @@ -5195,6 +5195,10 @@ PrefabInstance:
propertyPath: serializationData.Prefab
value:
objectReference: {fileID: 5377898870365832546, guid: 64e2e3ee2e403e34b8336a81ef4c95e5, type: 3}
- target: {fileID: 5377898870365832546, guid: 64e2e3ee2e403e34b8336a81ef4c95e5, type: 3}
propertyPath: scaleTargetGameObject.Array.data[0]
value:
objectReference: {fileID: 7862952628220398662}
- target: {fileID: 6328099632127614155, guid: 64e2e3ee2e403e34b8336a81ef4c95e5, type: 3}
propertyPath: m_AnchorMax.y
value: 0
Expand Down
40 changes: 35 additions & 5 deletions Runtime/Editor/ImageSlideEditor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,7 @@ protected override VisualElement GetContentTk()
container.AddToClassList("container");
container.Add(BuildDeviceList((ImageSlide)target));
container.Add(BuildDefinedUrls((ImageSlide)target));
var transformLockToggle = new Toggle("Transform Lock")
{
bindingPath = nameof(ImageSlide.isTransformLocked),
};
container.Add(transformLockToggle);
container.Add(ShowTransformLock());

var seekMode = new EnumField("Seek Mode")
{
Expand All @@ -68,6 +64,40 @@ protected override VisualElement GetContentTk()
protected override void ShowContent()
{
}

protected VisualElement ShowTransformLock()
{
var container = new VisualElement();
var label = new Label("Transform Lock");
label.style.unityFontStyleAndWeight = FontStyle.Bold;
container.Add(label);

var rootToggle = new Toggle("Root")
{
bindingPath = nameof(ImageSlide.rootTransformLocked),
};
container.Add(rootToggle);

var nextPreviewToggle = new Toggle("Next Preview")
{
bindingPath = nameof(ImageSlide.nextPreviewTransformLocked),
};
container.Add(nextPreviewToggle);

var noteToggle = new Toggle("Note")
{
bindingPath = nameof(ImageSlide.noteTransformLocked),
};
container.Add(noteToggle);

var thumbnailToggle = new Toggle("Thumbnail")
{
bindingPath = nameof(ImageSlide.thumbnailTransformLocked),
};
container.Add(thumbnailToggle);

return container;
}

protected override string GetScriptName()
{
Expand Down
3 changes: 2 additions & 1 deletion Runtime/jp.ootr.ImageSlide/Scripts/00_Utils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ public enum QueueType
SyncAll,
RemoveSource,
SeekTo,
UpdateList
UpdateList,
UpdateSeekMode,
}
}
37 changes: 37 additions & 0 deletions Runtime/jp.ootr.ImageSlide/Scripts/22_LogicQueue.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using jp.ootr.common;
using jp.ootr.ImageDeviceController;
using jp.ootr.ImageSlide.Viewer;
using UnityEngine;
using VRC.SDK3.Data;
using VRC.SDKBase;
Expand Down Expand Up @@ -100,6 +101,20 @@ protected void SeekTo(int index)
AddSyncQueue(json.String);
}

protected void UpdateSeekMode(SeekMode mode)
{
var dic = new DataDictionary();
dic.SetValue("type", (int)QueueType.UpdateSeekMode);
dic.SetValue("mode", (int)mode);
if (!VRCJson.TrySerializeToJson(dic, JsonExportType.Minify, out var json))
{
ConsoleError($"failed to serialize update seek mode json: {json}, {mode}", _logicQueuePrefix);
return;
}

AddSyncQueue(json.String);
}

private void ProcessQueue()
{
if (_queue.Length == 0)
Expand Down Expand Up @@ -143,8 +158,13 @@ private void ProcessQueue()
case QueueType.RequestSyncAll:
DoSyncAll();
break;
case QueueType.UpdateSeekMode:
ApplySeekMode(data);
break;
case QueueType.None:
break;
default:
ConsoleError($"unknown queue type: {type}", _logicQueuePrefix);
break;
}
}
Expand Down Expand Up @@ -330,6 +350,23 @@ private void DoSyncAll()
AddSyncQueue(json.String);
ProcessQueue();
}

private void ApplySeekMode(DataToken data)
{
if (!data.DataDictionary.TryGetValue("mode", TokenType.Double, out var modeToken))
{
ProcessQueue();
return;
}

var mode = (SeekMode)modeToken.Double;

SeekModeChanged(mode);
ProcessQueue();
}

protected virtual void SeekModeChanged(SeekMode mode)
{}

private void UpdateList(DataToken data)
{
Expand Down
3 changes: 0 additions & 3 deletions Runtime/jp.ootr.ImageSlide/Scripts/23_LogicViewerSeekMode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,5 @@ public void UpdateSeekMode()
break;
}
}

protected virtual void SeekModeChanged(SeekMode mode)
{}
}
}
7 changes: 7 additions & 0 deletions Runtime/jp.ootr.ImageSlide/Scripts/24_LogicResetTransform.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
using UnityEngine;
using VRC.SDK3.Components;

namespace jp.ootr.ImageSlide
{
public class LogicResetTransform : LogicViewerSeekMode {
[SerializeField] private VRCObjectSync rootObjectSync;
[SerializeField] private GameObject nextPreviewTransformResetTarget;
[SerializeField] private GameObject noteTransformResetTarget;
[SerializeField] private GameObject thumbnailTransformResetTarget;
Expand Down Expand Up @@ -30,6 +32,11 @@ public override void InitController()
_thumbnailTransformResetScale = thumbnailTransformResetTarget.transform.localScale;
}

public void ResetRootTransform()
{
rootObjectSync.Respawn();
}

public void ResetNextPreviewTransform()
{
nextPreviewTransformResetTarget.transform.localPosition = _nextPreviewTransformResetPosition;
Expand Down
2 changes: 1 addition & 1 deletion Runtime/jp.ootr.ImageSlide/Scripts/42_UISlide.cs
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ private void SetTexture(int index)
ConsoleDebug($"slide index updated: {index} / {slideCount}");

var texture = Textures.GetByIndex(index, out var sourceIndex, out var fileIndex);
animator.SetBool(_animatorSplash, texture == null);
animator.SetBool(_animatorSplash, texture == null || slideCount == 0);
if (texture != null)
{
slideMainView.texture = texture;
Expand Down
55 changes: 42 additions & 13 deletions Runtime/jp.ootr.ImageSlide/Scripts/72_TransformLock.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,29 +3,58 @@
namespace jp.ootr.ImageSlide
{
public class TransformLock : Module {
[SerializeField] private Collider[] targetColliders;
[SerializeField] private GameObject transformLockButtonActiveIcon;
[SerializeField] internal bool isTransformLocked = false;
[SerializeField] private Collider rootCollider;
[SerializeField] private GameObject rootTransformLockButtonIcon;
[SerializeField] internal bool rootTransformLocked = false;
[SerializeField] private Collider nextPreviewCollider;
[SerializeField] private GameObject nextPreviewTransformLockButtonIcon;
[SerializeField] internal bool nextPreviewTransformLocked = false;
[SerializeField] private Collider noteCollider;
[SerializeField] private GameObject noteTransformLockButtonIcon;
[SerializeField] internal bool noteTransformLocked = false;
[SerializeField] private Collider thumbnailCollider;
[SerializeField] private GameObject thumbnailTransformLockButtonIcon;
[SerializeField] internal bool thumbnailTransformLocked = false;

public override void InitController()
{
base.InitController();
ApplyTransformLock();
rootCollider.enabled = !rootTransformLocked;
rootTransformLockButtonIcon.SetActive(rootTransformLocked);
nextPreviewCollider.enabled = !nextPreviewTransformLocked;
nextPreviewTransformLockButtonIcon.SetActive(nextPreviewTransformLocked);
noteCollider.enabled = !noteTransformLocked;
noteTransformLockButtonIcon.SetActive(noteTransformLocked);
thumbnailCollider.enabled = !thumbnailTransformLocked;
thumbnailTransformLockButtonIcon.SetActive(thumbnailTransformLocked);
}

public void OnLockToggle()
public void OnRootLockToggle()
{
isTransformLocked = !isTransformLocked;
ApplyTransformLock();
rootTransformLocked = !rootTransformLocked;
rootCollider.enabled = !rootTransformLocked;
rootTransformLockButtonIcon.SetActive(rootTransformLocked);
}

private void ApplyTransformLock()
public void OnNextPreviewLockToggle()
{
transformLockButtonActiveIcon.SetActive(isTransformLocked);
foreach (var targetCollider in targetColliders)
{
targetCollider.enabled = !isTransformLocked;
}
nextPreviewTransformLocked = !nextPreviewTransformLocked;
nextPreviewCollider.enabled = !nextPreviewTransformLocked;
nextPreviewTransformLockButtonIcon.SetActive(nextPreviewTransformLocked);
}

public void OnNoteLockToggle()
{
noteTransformLocked = !noteTransformLocked;
noteCollider.enabled = !noteTransformLocked;
noteTransformLockButtonIcon.SetActive(noteTransformLocked);
}

public void OnThumbnailLockToggle()
{
thumbnailTransformLocked = !thumbnailTransformLocked;
thumbnailCollider.enabled = !thumbnailTransformLocked;
thumbnailTransformLockButtonIcon.SetActive(thumbnailTransformLocked);
}
}
}
Loading

0 comments on commit e573b36

Please sign in to comment.