Files
Simulation/Assets/WorkSpace/LH/ProjectDataManager.cs
lwj e855f49513 add resources
add worker
fix process logic
2025-06-26 15:55:03 +09:00

47 lines
1.3 KiB
C#

using UVC.Networks;
using UnityEngine;
using Newtonsoft.Json;
using UnityEngine.UI;
using TMPro;
using Octopus.Simulator.Networks;
namespace Octopus.Simulator
{
public class ProjectDataManager : MonoBehaviour
{
[SerializeField]
TMP_Text text;
[SerializeField]
Button projectMenuButton;
[SerializeField]
RectTransform menuPanel;
// Start is called once before the first execution of Update after the MonoBehaviour is created
void Start()
{
FindAnyObjectByType<WebReceiver>().onParameterRecived += RequestInfo;
projectMenuButton.onClick.AddListener(SetActive);
}
public void RequestInfo()
{
var reqeustURL = $"{WebManager.Instance.apiConfig.project}/{WebParameters.config.projectId}";
WebManager.Instance.Reqeust<ProjectInfoData>(reqeustURL, RequestType.GET, ProjectInfoCallback);
}
public void ProjectInfoCallback(ProjectInfoData response)
{
SetText(response.name);
}
void SetText(string data)
{
text.text = data;
}
void SetActive()
{
menuPanel.gameObject.SetActive(!menuPanel.gameObject.activeSelf);
}
}
}