1
This repository has been archived on 2025-03-15. You can view files and clone it, but cannot push or open issues or pull requests.
unity-vr-portoflio/Assets/04 - Scripts/Model/VarnishChoosingPanelModel.cs
2025-03-15 20:02:21 +01:00

94 lines
3.1 KiB
C#

using System;
using UnityEngine;
using EvolutStudio.tinysAPI.BaseClasses;
namespace EvolutStudio
{
namespace VRPortfolioWork
{
namespace ConfiguratorDemo
{
public class VarnishChoosingPanelModel : BaseClassModel
{
#region Public Attributes
// reference of the current selected material
public Material selectedMaterial;
// reference of the current tooltip state
public bool currentTooltipState { get { return _currentTooltipState; } }
// model definition for tooltip text
public string currentTooltipText { get { return _currentTooltipText; } }
#endregion
#region Private Attributes
// posible tooltip states (better readability)
private static class TooltipState
{
public static bool show = true;
public static bool hide = false;
}
// hidden reference for the current Tooltip state
private bool _currentTooltipState = TooltipState.hide;
private string _currentTooltipText = "ToBeFilled";
#endregion
#region Public Functions
// implementation of validate
public override bool Validate(string notification, UnityEngine.Object DataReference = null)
{
// check notification for validation
if (notification.Equals(BaseClassNotification.POINTERCLICKEVENT))
{
// get the material from the givenDataReference
selectedMaterial = ((GameObject)DataReference).GetComponent<Renderer>().material;
// hide the tooptip
_currentTooltipState = TooltipState.hide;
}
else if (notification.Equals(BaseClassNotification.POINTERENTEREVENT))
{
// set the current tooltip text to DataReference name
_currentTooltipText = ((GameObject)DataReference).name;
// set the current tooltip state to show
_currentTooltipState = TooltipState.show;
}
else if (notification.Equals(BaseClassNotification.POINTEREXITEVENT))
{
// set the current tooltip state to hide
_currentTooltipState = TooltipState.hide;
}
// because there is no condition in this simple demo, return true
return true;
}
#endregion
#region Private Functions
// Add your private functions
#endregion
#region Unity Events
// Use this for initialization
void Awake()
{
modulInstance.RegisterModel(this);
}
#endregion
}
}
}
}