mirror of
https://udrimavric.com/MAVRIC/Stratasys-450mc-VR.git
synced 2025-01-23 07:38:33 -05:00
30 lines
861 B
C#
30 lines
861 B
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using SO;
|
|
using SO.Channels;
|
|
using UnityEngine;
|
|
using UnityEngine.UIElements;
|
|
|
|
public class DocumentUpdater : MonoBehaviour
|
|
{
|
|
[SerializeField] private StepChangeChannelSO stepChangeChannel;
|
|
[SerializeField] private SimpleChannelSO documentLoadedChannel;
|
|
[SerializeField] private UnityEngine.UI.Image currentImage;
|
|
|
|
private void OnEnable()
|
|
{
|
|
stepChangeChannel.OnStepChanged += OnStepChanged;
|
|
}
|
|
|
|
private void OnDisable()
|
|
{
|
|
stepChangeChannel.OnStepChanged -= OnStepChanged;
|
|
}
|
|
|
|
private void OnStepChanged(StepSO step)
|
|
{
|
|
currentImage.sprite = (Sprite.Create((Texture2D)step.Document, new Rect(0, 0, step.Document.width, step.Document.height), new Vector2(0.5f, 0.5f)));
|
|
documentLoadedChannel.RaiseEvent();
|
|
}
|
|
}
|