Commit 5476b9d3 authored by Samuel Gaudemer's avatar Samuel Gaudemer
Browse files

commit sam

parent 6d7ed872
......@@ -270,11 +270,6 @@ PrefabInstance:
m_Modification:
m_TransformParent: {fileID: 1568014123}
m_Modifications:
- target: {fileID: 3326570245739987560, guid: fe604fd8db41d3c47867bdaa0d401b0a,
type: 3}
propertyPath: m_Name
value: ReplayRender
objectReference: {fileID: 0}
- target: {fileID: 3326570245739987559, guid: fe604fd8db41d3c47867bdaa0d401b0a,
type: 3}
propertyPath: m_LocalPosition.x
......@@ -380,6 +375,11 @@ PrefabInstance:
propertyPath: m_Pivot.y
value: 0.5
objectReference: {fileID: 0}
- target: {fileID: 3326570245739987560, guid: fe604fd8db41d3c47867bdaa0d401b0a,
type: 3}
propertyPath: m_Name
value: ReplayRender
objectReference: {fileID: 0}
- target: {fileID: 5015899096742261411, guid: fe604fd8db41d3c47867bdaa0d401b0a,
type: 3}
propertyPath: Reader
......@@ -429,7 +429,7 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 1, y: 0}
m_AnchorMax: {x: 1, y: 0}
m_AnchoredPosition: {x: -109, y: -48}
m_AnchoredPosition: {x: -109, y: -48.000008}
m_SizeDelta: {x: 160, y: 35}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &144489198
......@@ -1169,9 +1169,9 @@ RectTransform:
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 0}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 0, y: 20}
m_SizeDelta: {x: -17, y: 20}
m_Pivot: {x: 0, y: 0}
--- !u!114 &372751280
MonoBehaviour:
......@@ -1771,7 +1771,7 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 0, y: 99.99985}
m_AnchoredPosition: {x: 0, y: 99.99986}
m_SizeDelta: {x: 600, y: 204}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &541575376
......@@ -3124,7 +3124,7 @@ RectTransform:
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 20, y: 20}
m_Pivot: {x: 0.5, y: 0.5}
......@@ -3448,9 +3448,9 @@ RectTransform:
m_RootOrder: 2
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 1, y: 0}
m_AnchorMax: {x: 1, y: 0}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 20, y: 0}
m_SizeDelta: {x: 20, y: -17}
m_Pivot: {x: 1, y: 1}
--- !u!114 &1274384426
MonoBehaviour:
......@@ -3698,7 +3698,7 @@ RectTransform:
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 20, y: 20}
m_Pivot: {x: 0.5, y: 0.5}
......@@ -4399,7 +4399,7 @@ GameObject:
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
m_IsActive: 0
--- !u!224 &1568014123
RectTransform:
m_ObjectHideFlags: 0
......@@ -4571,7 +4571,7 @@ RectTransform:
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: -0.0000104904175, y: -0.00006246567}
m_SizeDelta: {x: 877, y: 0}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0, y: 1}
--- !u!114 &1660857148
MonoBehaviour:
......@@ -4628,7 +4628,7 @@ GameObject:
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 0
m_IsActive: 1
--- !u!114 &1669768147
MonoBehaviour:
m_ObjectHideFlags: 0
......@@ -4723,9 +4723,9 @@ RectTransform:
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 0, y: 0}
m_SizeDelta: {x: -17, y: -17}
m_Pivot: {x: 0, y: 1}
--- !u!114 &1679522085
MonoBehaviour:
......@@ -5280,7 +5280,7 @@ RectTransform:
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: -0.0000076293945, y: -0.000011444092}
m_SizeDelta: {x: 0, y: 0}
m_SizeDelta: {x: -280.7, y: 0}
m_Pivot: {x: 0, y: 1}
--- !u!114 &1814500317
MonoBehaviour:
......@@ -5602,7 +5602,7 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 96, y: -48}
m_AnchoredPosition: {x: 96, y: -48.000008}
m_SizeDelta: {x: 160, y: 35}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &1943472032
......
This diff is collapsed.
fileFormatVersion: 2
guid: 436dc9c7d3f5c1f488ef06248cf7b049
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: ac32300b89ce31f44b3f8edd7d3c2a69
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: 3877d9094f079254b9cfc1c671f4f624
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
using Recognizer;
using Recognizer.DataTools;
using Recognizer.DemonstrationClient;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Text;
using UnityEngine;
namespace Menus.UserApp.Controller
{
public class UserAppController : MenuController<UserAppApplication>
{
private DemonstrationClient _AIClient;
private bool _recordPlaying = false;
private StringBuilder _outData;
private List<StringBuilder> _outDataJoints;
private StringBuilder _outDataInkML;
private Double[] _frameWithTime;
private Double[] _deviceFrame;
private bool _isConnected;
protected override void OnEnable()
{
base.lateOnEnable();
UserAppNotification.Record += Record;
UserAppNotification.OnSelectedUser += OnUser;
UserAppNotification.ActiveConfigPanel += ActiveConfigPanel;
UserAppNotification.Validate += Validate;
UserAppNotification.ActiveDemonstrationPanel += ActiveDemonstrationPanel;
}
// Start is called before the first frame update
protected override void Start()
{
base.Start();
app.view.InitView();
app.model.SetDevice(DevicesInfos.Device.KinectAzure); //setKinectAzure
RecoManager.GetInstance().SetInfos(app.model.GetDevice());
_deviceFrame = new double[RecoManager.GetInstance().DeviceInfo.FrameSize];
_frameWithTime = new double[RecoManager.GetInstance().DeviceInfo.FrameSize +
RecoManager.GetInstance().DeviceInfo.FrameSize / 3];
}
private void Record(bool start)
{
StartRecord();
}
/// <summary>
/// Démarre l'enregistrement
/// </summary>
private void StartRecord()
{
_recordPlaying = true;
_outData = new StringBuilder();
_outDataJoints = new List<StringBuilder>();
_outDataInkML = new StringBuilder();
for (int i = 0; i < _frameWithTime.Length / 4; i++)
{
_outDataJoints.Add(new StringBuilder().Append("\n\t\t<trace>"));
}
StartCoroutine(Recording());
}
private IEnumerator Recording()
{
Debug.Log("Yes it is Recording ! :)");
var watch = new System.Diagnostics.Stopwatch();
watch.Start();
string line;
while (true)
{
if (_recordPlaying)
{
StringBuilder frame = new StringBuilder("");
double timestamp = watch.ElapsedMilliseconds / 1000.0;
RecoManager.GetInstance().DetectAndFillPositionDeviceInkML(ref _frameWithTime, timestamp);
RecoManager.GetInstance().DetectAndFillPositionDevice(ref _deviceFrame);
int i = 3;
for (int j = 0; j < _outDataJoints.Count; j++)
{
_outDataJoints[j]
.Append(_frameWithTime[i - 3].ToString(System.Globalization.CultureInfo.InvariantCulture))
.Append(" ")
.Append(_frameWithTime[i - 2].ToString(System.Globalization.CultureInfo.InvariantCulture))
.Append(" ")
.Append(_frameWithTime[i - 1].ToString(System.Globalization.CultureInfo.InvariantCulture))
.Append(" ")
.Append(_frameWithTime[i].ToString(System.Globalization.CultureInfo.InvariantCulture))
.Append(", ");
i += 4;
}
for (int k = 0; k < _deviceFrame.Length; k++)
{
_frameWithTime[k] = _deviceFrame[k];
frame.Append(_deviceFrame[k].ToString(System.Globalization.CultureInfo.InvariantCulture))
.Append(" ");
}
if (_isConnected)
{
/*
if ((line = file.ReadLine()) != null)
{
_AIClient.SendFrame(line, timestamp);
}*/
_AIClient.SendFrame(frame.ToString(), timestamp);
app.model.SetAIResult(_AIClient.GetAIResult());
app.view.RefreshGestures();
Debug.Log(_AIClient.GetAIResult().ToString());
}
_outData.Append(frame).Append("\n");
}
else
{
yield break;
}
yield return new WaitForSeconds(RecoManager.FREQUENCY_RECORD_SEND_DATA);
}
}
//Active le jeu
public void ActiveDemonstrationPanel()
{
// this.ClosePanels();
app.view.DisplayGesture();
app.view.UserAppPanel.SetActive(true);
}
protected override void Enter()
{
app.view.StartRecord();
}
protected override void MoveLeft()
{
throw new System.NotImplementedException();
}
protected override void MoveRight()
{
throw new System.NotImplementedException();
}
// Update is called once per frame
protected override void Update()
{
}
protected void OnUser(UserData userSelected)
{
app.model.SetCurrentUser(userSelected);
app.view.currentConfigValue.text = userSelected.FirstName + " " + userSelected.LastName;
}
public void ClosePanels()
{
}
public void ActiveConfigPanel()
{
this.ClosePanels();
app.view.ConfigPanel.SetActive(true);
IDeviceProvider[] devicesProvider = GameObject.FindObjectsOfType<IDeviceProvider>();
foreach (IDeviceProvider device in devicesProvider)
{
GameObject.Destroy(device.gameObject);
}
_AIClient?.Disconnect();
UserAppNotification.Validate("user");
}
protected void Validate(string configcase)
{
switch (configcase)
{
case "user":
app.view.CleanConfigPanel();
app.view.SelectUser();
break;
}
}
}
}
fileFormatVersion: 2
guid: d7b39dc74745d3e489e9e2dfc7ae16b3
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: ff7b40d10e1bb604eb7380569b6021df
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
using Recognizer;
using Recognizer.DemonstrationClient;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using UnityEngine;
namespace Menus.UserApp.Model
{
public class UserAppModel : MonoBehaviour
{
private UserData _currentUser;
private List<UserData> _users = new List<UserData>();
private AIResult _result = new AIResult(-1.0, 0.0, new[] { 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 }.ToList());
private DevicesInfos.Device _device;
public void SetCurrentUser(UserData newCurrentUser)
{
this._currentUser = newCurrentUser;
}
public List<UserData> GetUsers()
{
return this._users;
}
public void SetAIResult(AIResult res)
{
_result = res;
}
public void SetDevice(DevicesInfos.Device device)
{
this._device = device;
}
public DevicesInfos.Device GetDevice()
{
return this._device;
}
}
}
\ No newline at end of file
fileFormatVersion: 2
guid: 5cd3be2a7791a2e4a86b36875f6d3a49
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
using Menus;
using Menus.UserApp.Model;
using Menus.UserApp.View;
using System;
using UnityEditor;
using UnityEngine;
namespace Menus.UserApp
{
public class UserAppElement : MenuElement<UserAppApplication>
{
}
public class UserAppApplication : AppMenuItem
{
[NonSerialized]
public UserAppModel model;
public UserAppView view;
private void Awake()
{
model = new UserAppModel();
}
public override string GetTitle()
{
return "User Application MOP !";
}
}
}
\ No newline at end of file
fileFormatVersion: 2
guid: eba41b0af15495f4fb4389abcdbaa619
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
using UnityEditor;
using UnityEngine;
namespace Menus.UserApp
{
public class UserAppNotification
{
public static System.Action<UserData> OnSelectedUser;
public static System.Action ActiveConfigPanel;
public static System.Action<bool> Record;
public static System.Action<string> Validate;
public static System.Action ActiveDemonstrationPanel;
}
}
\ No newline at end of file
fileFormatVersion: 2
guid: 4f7fc2d3d9d8ec745a6a00d24a071f26
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: b974c76748fe9964a874a58301c070d9
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
using Menus.Demonstration.View;
using System.Collections;
using System.Collections.Generic;
using TMPro;
using UnityEngine;
using UnityEngine.UI;
namespace Menus.UserApp.View
{
public class UserAppView : UserAppElement
{
// Start is called before the first frame update
public Text currentConfigValue;
public AnimationFileReader fileReader;
public GameObject ConfigPanel;
public GameObject UserAppPanel;
public GameObject RecapPanel;
public Text titleConfigPanel;
public Button validate;
public TextMeshProUGUI StartStopButtonText;
private IEnumerator _delayedStart;
public RectTransform ConfigContent;
public Button CreateOrModifyUsersButton;
public UserButton UserButton;
public bool RecordPlaying = false;
void Start()
{
}
// Update is called once per frame
void Update()
{
}
public void InitView()
{
UserAppNotification.ActiveDemonstrationPanel();
}
public void CleanConfigPanel()
{
this.currentConfigValue.text = "";
this.titleConfigPanel.text = "";
validate.onClick.RemoveAllListeners();
foreach (Transform child in ConfigContent.transform)
{
GameObject.Destroy(child.gameObject);
}
CreateOrModifyUsersButton.gameObject.SetActive(false);
}
public void SelectUser()
{
CreateOrModifyUsersButton.gameObject.SetActive(true);
this.titleConfigPanel.text = "Select User";
List<UserData> listUsers = app.model.GetUsers();
foreach (UserData user in listUsers)
{
UserButton newButton = Instantiate(UserButton, ConfigContent.transform, false);
newButton.gameObject.name = user.FirstName + " " + user.LastName;