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

86 lines
2.6 KiB
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using EvolutStudio.tinysAPI.BaseClasses;
namespace EvolutStudio
{
namespace tinysAPI
{
public class Modul : MonoBehaviour
{
#region Public Attributes
// public access references of the MVP.
public BaseClassModel Model { get { return _model; } }
public BaseClassPresenter Presenter { get { return _presenter; } }
public BaseClassView View { get { return _view; } }
#endregion
#region Private Attributes
// private reference of the MVP.
private BaseClassModel _model = null;
private BaseClassPresenter _presenter = null;
private BaseClassView _view = null;
#endregion
#region Public Functions
// public function for setting the model reference
public void RegisterModel(BaseClassModel model)
{
// check if _model is null, else log an error for trying to overwrite the current model
if (_model == null)
{
_model = model;
}
else
{
Debug.LogError(string.Format("Trying to overwrite the current model: {0} with {1}", _model, model));
}
}
// public function for setting the presenter reference
public void RegisterPresenter(BaseClassPresenter presenter)
{
// check if _presenter is null, else log an error for trying to overwrite the current presenter
if (_presenter == null)
{
_presenter = presenter;
}
else
{
Debug.LogError(string.Format("Trying to overwrite the current presenter: {0} with {1}", _presenter, presenter));
}
}
// public function for setting the view reference
public void RegisterView(BaseClassView view)
{
// check if _view is null, else log an error for trying to overwrite the current view
if (_view == null)
{
_view = view;
}
else
{
Debug.LogError(string.Format("Trying to overwrite the current view: {0} with {1}", _view, view));
}
}
#endregion
#region Private Functions
#endregion
}
}
}