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/Presenter/SimpleMaterialChooserDemoPresenter.cs
2025-03-15 20:02:21 +01:00

87 lines
2.9 KiB
C#

using EvolutStudio.tinysAPI.BaseClasses;
using EvolutStudio.VRPortfolioWork.Components;
namespace EvolutStudio
{
namespace VRPortfolioWork
{
namespace SimpleMaterialChooserDemo
{
public class SimpleMaterialChooserDemoPresenter : BaseClassPresenter
{
#region Public Attributes
// Add your public attributes
#endregion
#region Private Attributes
// Add your private attributes
#endregion
#region Public Functions
// implementation of notify
override public void Notify(string notification, UnityEngine.Object DataReference = null)
{
if (modulInstance.Model.Validate(notification))
{
modulInstance.View.FireValidationSucceededEvent(notification);
}
else
{
modulInstance.View.FireValidationFailedEvent(notification);
}
}
// implementation of init given component
public override void InitComponent(BaseClassComponent component)
{
CopyValues(component);
}
// implementation of update given component
public override void UpdateComponent(BaseClassComponent component)
{
CopyValues(component);
}
#endregion
#region Private Functions
// private function to copy all values from model to subview
private void CopyValues(BaseClassComponent component)
{
if (component.GetType().Equals(typeof(SimpleTooltipComponent)))
{
((SimpleTooltipComponent)component).currentTooltipState = ((SimpleMaterialChooserDemoModel)modulInstance.Model).currentTooltipState;
}
else if (component.GetType().Equals(typeof(SimpleParticleBurstComponent)))
{
((SimpleParticleBurstComponent)component).selectedMaterialColor = ((SimpleMaterialChooserDemoModel)modulInstance.Model).selectedMaterial.color;
}
else if (component.GetType().Equals(typeof(SimpleMaterialChangeComponent)))
{
((SimpleMaterialChangeComponent)component).selectedMaterial = ((SimpleMaterialChooserDemoModel)modulInstance.Model).selectedMaterial;
}
}
#endregion
#region Unity Events
// Use this for initialization
void Awake()
{
modulInstance.RegisterPresenter(this);
}
#endregion
}
}
}
}