Commit 01e68bdf authored by ATREVI Dieudonne's avatar ATREVI Dieudonne
Browse files

- Fix bug on higlighting pause and play button

- Fix mutually exclusive constraint on followX and followY
- Add Camera type on parameters modification panel
parent cb8133bd
This diff is collapsed.
......@@ -27,6 +27,7 @@ using System.IO;
using UnityEditor;
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.EventSystems;
using UnityEngine.SceneManagement;
using SFB;
......@@ -50,7 +51,7 @@ public class MenuManager : MonoBehaviour
public GameObject topMenuPanel; // the top menu panel
public GameObject slider; // Slider for the progress state bar
LoadEnv env; // Contain datas for the environnement
public InputField FollowAgentID, LookAgentID;
/// <summary>
/// initialize the menu
/// </summary>
......@@ -62,6 +63,7 @@ public class MenuManager : MonoBehaviour
menu = GameObject.FindGameObjectWithTag("Menu");
panel = GameObject.FindGameObjectWithTag("Panel");
controlPanel = GameObject.Find("/controlCanvas/buttonControlPanel");
controlPanel.SetActive(false);
......@@ -72,6 +74,9 @@ public class MenuManager : MonoBehaviour
topMenuPanel.SetActive(false);
cameraMovPanel = GameObject.Find("/controlCanvas/cameraMovPanel");
LookAgentID = cameraMovPanel.transform.Find("LookAgentID").GetComponent<InputField>();
FollowAgentID = cameraMovPanel.transform.Find("FollowAgentID").GetComponent<InputField>();
cameraMovPanel.SetActive(false);
configPanel = GameObject.FindGameObjectWithTag("configPanel");
......@@ -85,14 +90,46 @@ public class MenuManager : MonoBehaviour
Time.timeScale = 0;
}
/// <summary>
/// Update the active button on the control panel
/// </summary>
void Update()
{
if(controlPanel.activeSelf)
{
if(!cameraMovPanel.transform.Find("Lookat").GetComponent<Toggle>().isOn && !cameraMovPanel.transform.Find("Followat").GetComponent<Toggle>().isOn)
{
updateControlPanel();
}
else{
if(EventSystem.current.currentSelectedGameObject==null)
{
updateControlPanel();
}
if(!LookAgentID.isFocused && !FollowAgentID.isFocused)
{
updateControlPanel();
}
}
}
}
public void updateControlPanel()
{
if(Time.timeScale == 1)
{
controlPanel.transform.Find("play").GetComponent<Button>().Select();
}
else{
controlPanel.transform.Find("pause").GetComponent<Button>().Select();
}
}
/// <summary>
/// Function to play the scenario
/// </summary>
public void Play()
{
Time.timeScale = 1;
controlPanel = GameObject.Find("/controlCanvas/buttonControlPanel");
controlPanel.transform.Find("play").GetComponent<Button>().Select();
}
/// <summary>
......@@ -101,8 +138,6 @@ public class MenuManager : MonoBehaviour
public void Pause()
{
Time.timeScale = 0;
controlPanel = GameObject.Find("/controlCanvas/buttonControlPanel");
controlPanel.transform.Find("pause").GetComponent<Button>().Select();
}
/// <summary>
......@@ -158,7 +193,11 @@ public class MenuManager : MonoBehaviour
menu.SetActive(false);
configPanel.SetActive(false);
controlPanel.SetActive(false);
slider.SetActive(false);
topMenuPanel.SetActive(false);
cameraMovPanel.SetActive(false);
Time.timeScale = 1;
}
}
......@@ -233,6 +272,8 @@ public class MenuManager : MonoBehaviour
//slider.SetActive(true);
GameObject.Find("/controlCanvas/fakePanel/topMenu").SetActive(false);
updateControlPanel();
}
public void checkLookatToggleOnScene(){
GameObject PanelMovCamera = GameObject.Find("/controlCanvas/cameraMovPanel");
......@@ -304,11 +345,15 @@ public class MenuManager : MonoBehaviour
//slider.SetActive(!panel.activeSelf);
topMenuPanel.SetActive(true);
cameraMovPanel.SetActive(true);
//Play(); // start after the parameters modification
// Update Camera type on the screen
cameraMovPanel.transform.Find("cameraType").GetComponent<Dropdown>().value = ConfigReader.camType;
updateControlPanel();
}
/// <summary>
/// close the config panel without save the parameters
/// close the config panel without saving the parameters
/// </summary>
public void cancelConfig()
{
......@@ -318,7 +363,8 @@ public class MenuManager : MonoBehaviour
//slider.SetActive(!panel.activeSelf);
topMenuPanel.SetActive(true);
cameraMovPanel.SetActive(true);
controlPanel.transform.Find("pause").GetComponent<Button>().Select();
updateControlPanel();
}
/// <summary>
......
......@@ -131,8 +131,6 @@ public class CamMvt : MonoBehaviour
public void readCameraMovParamOnScene()
{
//GameObject PanelMovCamera = GameObject.Find("/controlCanvas/cameraMovPanel");
activateLookAt = panelMovCamera.transform.Find("Lookat").GetComponent<Toggle>().isOn;
activateFollow = panelMovCamera.transform.Find("Followat").GetComponent<Toggle>().isOn;
lookAt_Id = int.Parse(panelMovCamera.transform.Find("LookAgentID").GetComponent<InputField>().text);
......
......@@ -46,9 +46,11 @@ public class ConfigManager : MonoBehaviour
public static void showConfig()
{
/// Get Camera Config
//Type of Camera
PanelCamera = GameObject.Find("/ConfigMenu/Panel/PanelCamera/Button/Panel");
PanelCamera.transform.Find("cameraType").GetComponent<Dropdown>().value = ConfigReader.camType;
// Position
Vector3 camPos = ConfigReader.camPosition;
PanelCamera = GameObject.Find("/ConfigMenu/Panel/PanelCamera/Button/Panel");
PanelCamera.transform.Find("PosX").GetComponent<InputField>().text = camPos.x.ToString();
PanelCamera.transform.Find("PosY").GetComponent<InputField>().text = camPos.y.ToString();
PanelCamera.transform.Find("PosZ").GetComponent<InputField>().text = camPos.z.ToString();
......@@ -111,9 +113,11 @@ public class ConfigManager : MonoBehaviour
public static void SaveConfig(string configPath)
{
//// Set Camera Config
// Type of camera
PanelCamera = GameObject.Find("/ConfigMenu/Panel/PanelCamera/Button/Panel");
ConfigReader.camType = PanelCamera.transform.Find("cameraType").GetComponent<Dropdown>().value;
// Position
Vector3 camPos;
PanelCamera = GameObject.Find("/ConfigMenu/Panel/PanelCamera/Button/Panel");
camPos.x = float.Parse(PanelCamera.transform.Find("PosX").GetComponent<InputField>().text);
camPos.y = float.Parse(PanelCamera.transform.Find("PosY").GetComponent<InputField>().text);
camPos.z = float.Parse(PanelCamera.transform.Find("PosZ").GetComponent<InputField>().text);
......@@ -176,8 +180,7 @@ public class ConfigManager : MonoBehaviour
ConfigReader.imgOpticalFlow.record = PanelRecording.transform.Find("imgOF").GetComponent<Toggle>().isOn;
ConfigReader.bboxeBody.record = PanelRecording.transform.Find("imgBBox").GetComponent<Toggle>().isOn;
ConfigReader.bboxeHead.record = PanelRecording.transform.Find("imgHBox").GetComponent<Toggle>().isOn;
ConfigReader.SaveConfig(configPath);
}
......@@ -324,21 +327,6 @@ public class ConfigManager : MonoBehaviour
}
}
public void checkFollowXToggle(){
PanelCamera = GameObject.Find("/ConfigMenu/Panel/PanelCamera/Button/Panel");
if(PanelCamera.transform.Find("Followat").GetComponent<Toggle>().isOn){
PanelCamera.transform.Find("FollowY").GetComponent<Toggle>().isOn = !PanelCamera.transform.Find("FollowX").GetComponent<Toggle>().isOn;
}
}
public void checkFollowYToggle(){
PanelCamera = GameObject.Find("/ConfigMenu/Panel/PanelCamera/Button/Panel");
if(PanelCamera.transform.Find("Followat").GetComponent<Toggle>().isOn){
PanelCamera.transform.Find("FollowX").GetComponent<Toggle>().isOn = !PanelCamera.transform.Find("FollowY").GetComponent<Toggle>().isOn;
}
}
public void checkLookatToggleOnScene(){
GameObject PanelMovCamera = GameObject.Find("/controlCanvas/cameraMovPanel");
GameObject LookAgentIDtxt = GameObject.Find("/controlCanvas/cameraMovPanel/LookAgentIDtxt");
......@@ -363,20 +351,4 @@ public class ConfigManager : MonoBehaviour
PanelMovCamera.transform.Find("LockPerson").GetComponent<Toggle>().interactable = true;
}
}
public void checkFollowXToggleOnScene(){
GameObject PanelMovCamera = GameObject.Find("/controlCanvas/cameraMovPanel");
if(PanelMovCamera.transform.Find("Followat").GetComponent<Toggle>().isOn){
PanelMovCamera.transform.Find("FollowY").GetComponent<Toggle>().isOn = !PanelMovCamera.transform.Find("FollowX").GetComponent<Toggle>().isOn;
}
}
public void checkFollowYToggleOnScene(){
GameObject PanelMovCamera = GameObject.Find("/controlCanvas/cameraMovPanel");
if(PanelMovCamera.transform.Find("Followat").GetComponent<Toggle>().isOn){
PanelMovCamera.transform.Find("FollowX").GetComponent<Toggle>().isOn = !PanelMovCamera.transform.Find("FollowY").GetComponent<Toggle>().isOn;
}
}
}
\ No newline at end of file
......@@ -8,7 +8,7 @@
<rotation x="0" y="0" z="0" />
</env_stageInfos>
<cam>
<cameraType typeID="2" />
<cameraType typeID="4" />
<position x="-30" y="-3" z="5" />
<rotation x="30" y="0" z="90.03349" />
<lookAtAgent agentID="-1" />
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment