feat: Setup MVP

This commit is contained in:
Gerard Gascón 2024-04-12 16:25:32 +02:00
parent 14fdd4558e
commit 1dd490b7ed
27 changed files with 555 additions and 52 deletions

View file

@ -0,0 +1,32 @@
using Domain;
using Presenter;
using SatorImaging.AppWindowUtility;
using TMPro;
using UnityEngine;
namespace View {
public class CTrencadaInput : MonoBehaviour, ICTrencadaInput {
[SerializeField] private TMP_Text text;
private CTrencadaClick _click;
private void Start() {
AppWindowUtility.AlwaysOnTop = true;
_click = FindObjectOfType<Dependencies>().CTrencadaClick;
}
private void Update() {
CheckInput();
}
private void CheckInput() {
Win32API.UpdateInput();
if (Win32API.CTrencadaDown())
_click.Execute();
}
public void UpdateView(int score) {
text.text = score.ToString();
}
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 7a6ab8726a3100840b7f1ba17e278262
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,20 @@
using UnityEngine;
using UnityEngine.UI;
namespace View {
public class CloseButton : MonoBehaviour {
private Button _button;
private void Start() {
_button = GetComponent<Button>();
_button.onClick.AddListener(CloseClicked);
}
private void CloseClicked() {
#if UNITY_EDITOR
Debug.Log("Quit");
#endif
Application.Quit();
}
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: f297a9343fac1cf42b0de26c43db994f
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,18 @@
using System;
using Domain;
using Presenter;
using UnityEngine;
namespace View {
public class Dependencies : MonoBehaviour {
public CTrencadaClick CTrencadaClick { private set; get; }
public Model Model { private set; get; }
private void Awake() {
Model = new Model(0);
ICTrencadaInput input = FindObjectOfType<CTrencadaInput>();
CTrencadaClick = new CTrencadaClick(Model, input);
}
}
}

View file

@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 2892d40567e945b585f5986911ae2bcd
timeCreated: 1712931517

View file

@ -0,0 +1,19 @@
{
"name": "SantJordi.View",
"rootNamespace": "",
"references": [
"GUID:23c7c01f8c5436c429399011615ce636",
"GUID:d9011953b32919841a6c357880a50fb3",
"GUID:6055be8ebefd69e48b49212b09b47b2f",
"GUID:1220ccfff01d26041a9bb8cd7ae584af"
],
"includePlatforms": [],
"excludePlatforms": [],
"allowUnsafeCode": false,
"overrideReferences": false,
"precompiledReferences": [],
"autoReferenced": true,
"defineConstraints": [],
"versionDefines": [],
"noEngineReferences": false
}

View file

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: fcb674ef5c27916468ce43c3ae3e4ccd
AssemblyDefinitionImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant: