UI 패널 활성화 토글 기능 개발
This commit is contained in:
@@ -51,6 +51,20 @@ using UnityEngine.Networking;
|
||||
/// </summary>
|
||||
namespace CHN
|
||||
{
|
||||
public class WorkTimeRequesttBody
|
||||
{
|
||||
public string startDate;
|
||||
public string endDate;
|
||||
public string MCHCD;
|
||||
public string WO;
|
||||
}
|
||||
public class WorkConditionsRequestBody
|
||||
{
|
||||
public string startDate;
|
||||
public string endDate;
|
||||
public string MCHCD;
|
||||
public string WO;
|
||||
}
|
||||
public class HTTPRequester : Protocol, ISingle, IOptionable
|
||||
{
|
||||
public Action<MachineKPIData> onMachineKPIData;
|
||||
|
||||
@@ -8,20 +8,7 @@ using System.Text;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Networking;
|
||||
|
||||
public class WorkTimeRequesttBody
|
||||
{
|
||||
public string startDate;
|
||||
public string endDate;
|
||||
public string MCHCD;
|
||||
public string WO;
|
||||
}
|
||||
public class WorkConditionsRequestBody
|
||||
{
|
||||
public string startDate;
|
||||
public string endDate;
|
||||
public string MCHCD;
|
||||
public string WO;
|
||||
}
|
||||
|
||||
public class HTTPTest : MonoBehaviour
|
||||
{
|
||||
public string apiKey = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6MywiZW1haWwiOiJ1dmMiLCJncm91cElkIjoyLCJncm91cENvZGUiOiJjaHVuaWxlbmciLCJyb2xlIjoiVGVuYW50QWRtaW4iLCJuYW1lIjoi7Jyg67mE7JSoIiwibGljZW5zZSI6ImJ1c2luZXNzIiwicGhvbmUiOiIiLCJpYXQiOjE3NDA1MzY0NzUsImV4cCI6NDg5NDEzNjQ3NX0.hr4D0bOA4K09Vhp12itiJgd-nVDQ3VZO8D7MVP5Ltw0";
|
||||
@@ -55,7 +42,7 @@ public class HTTPTest : MonoBehaviour
|
||||
}
|
||||
if(Input.GetKeyDown(KeyCode.O))
|
||||
{
|
||||
FindObjectOfType<Canvas_Popup>().panel_workconditionanalysis.Open();
|
||||
//FindObjectOfType<Canvas_Popup>().panel_workconditionanalysis.Open();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
53
Assets/WorkSpace/Personal/JYM/Panel_DashBoard.cs
Normal file
53
Assets/WorkSpace/Personal/JYM/Panel_DashBoard.cs
Normal file
@@ -0,0 +1,53 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using WI;
|
||||
namespace CHN
|
||||
{
|
||||
public class Panel_DashBoard : PanelBase
|
||||
{
|
||||
public UI_DashboardCheckListBox dashBoardCheckListBox;
|
||||
|
||||
public Panel_CompleteAlramHistory completeAlramHistory;
|
||||
public Panel_Library library;
|
||||
public Panel_WorkConditionAnalysis workConditionAnalysis;
|
||||
public Panel_WorkTimeAnalysis workTimeAnalysis;
|
||||
public override void AfterAwake()
|
||||
{
|
||||
dashBoardCheckListBox = GetComponentInChildren<UI_DashboardCheckListBox>(true);
|
||||
|
||||
completeAlramHistory = FindSingle<Panel_CompleteAlramHistory>();
|
||||
library = FindSingle<Panel_Library>();
|
||||
workConditionAnalysis = FindSingle<Panel_WorkConditionAnalysis>();
|
||||
workTimeAnalysis = FindSingle<Panel_WorkTimeAnalysis>();
|
||||
|
||||
PlayerPrefs.SetInt("isCompleteAlramHistory", 0);
|
||||
PlayerPrefs.SetInt("isLibrary", 0);
|
||||
PlayerPrefs.SetInt("isWorkConditionAnalysis", 0);
|
||||
PlayerPrefs.SetInt("isWorkTimeAnalysis", 0);
|
||||
|
||||
SetDashBoardCheckListBox();
|
||||
}
|
||||
public Dictionary<string, GameObject> GetDashboardItem()
|
||||
{
|
||||
var dic = new Dictionary<string, GameObject>();
|
||||
|
||||
dic.Add("완료 알람 시간", completeAlramHistory.gameObject);
|
||||
dic.Add("라이브러리", library.gameObject);
|
||||
dic.Add("작업 조건 분석", workConditionAnalysis.gameObject);
|
||||
dic.Add("작업 시간 분석", workTimeAnalysis.gameObject);
|
||||
|
||||
return dic;
|
||||
}
|
||||
private void SetDashBoardCheckListBox()
|
||||
{
|
||||
var dashboardItem = GetDashboardItem();
|
||||
|
||||
dashBoardCheckListBox.Init(dashboardItem);
|
||||
}
|
||||
public void Open()
|
||||
{
|
||||
SetActive(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
11
Assets/WorkSpace/Personal/JYM/Panel_DashBoard.cs.meta
Normal file
11
Assets/WorkSpace/Personal/JYM/Panel_DashBoard.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 31b5fb5f21f6cd34b88e0ddc726ab462
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -23,6 +23,7 @@ public class Panel_ToolBar : PanelBase
|
||||
|
||||
private CaptureBase capture;
|
||||
|
||||
public Action onClickDashBoard;
|
||||
public override void AfterAwake()
|
||||
{
|
||||
Button_TopView.onClick.AddListener(OnClickTopView);
|
||||
@@ -124,7 +125,7 @@ public class Panel_ToolBar : PanelBase
|
||||
|
||||
private void OnClickDashBoard()
|
||||
{
|
||||
Debug.Log("DashBorad");
|
||||
onClickDashBoard?.Invoke();
|
||||
}
|
||||
|
||||
private void OnClickShoulderView()
|
||||
|
||||
60
Assets/WorkSpace/Personal/JYM/UI_DashboardCheckListBox.cs
Normal file
60
Assets/WorkSpace/Personal/JYM/UI_DashboardCheckListBox.cs
Normal file
@@ -0,0 +1,60 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using UnityEngine;
|
||||
using UnityEngine.EventSystems;
|
||||
using UnityEngine.UI;
|
||||
using WI;
|
||||
|
||||
namespace CHN
|
||||
{
|
||||
public class UI_DashboardCheckListBox : UIBase
|
||||
{
|
||||
public UI_DashboardCheckListItem prf_item;
|
||||
|
||||
private Dictionary<string, GameObject> originDashBoardItems = new();
|
||||
private Dictionary<string, UI_DashboardCheckListItem> dashboardItemList = new();
|
||||
public void Init(Dictionary<string, GameObject> items)
|
||||
{
|
||||
prf_item = Resources.Load<UI_DashboardCheckListItem>("Prefabs/UI/UI_DashboardCheckListItem");
|
||||
|
||||
originDashBoardItems.Clear();
|
||||
foreach (var item in items)
|
||||
{
|
||||
var dashboardItem = CreateItem();
|
||||
dashboardItemList.Add(item.Key, dashboardItem);
|
||||
originDashBoardItems.Add(item.Key, item.Value);
|
||||
}
|
||||
SetMenuItem(items);
|
||||
}
|
||||
private void SetMenuItem(Dictionary<string, GameObject> items)
|
||||
{
|
||||
foreach (var item in items)
|
||||
{
|
||||
dashboardItemList[item.Key].SetItem(item.Key, item.Value);
|
||||
}
|
||||
}
|
||||
|
||||
public void OnCloseDashbordItem(string dahboardKey)
|
||||
{
|
||||
dashboardItemList[dahboardKey].ToggleOffItem();
|
||||
}
|
||||
private UI_DashboardCheckListItem CreateItem()
|
||||
{
|
||||
var item = Instantiate(prf_item, transform);
|
||||
item.transform.localScale = Vector3.one;
|
||||
return item;
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
if (Input.GetMouseButtonDown(0))
|
||||
{
|
||||
if (EventSystem.current.currentSelectedGameObject != null)
|
||||
return;
|
||||
transform.parent.gameObject.SetActive(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: eff661dc800ae2e4aba764004ec0bbae
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
86
Assets/WorkSpace/Personal/JYM/UI_DashboardCheckListItem.cs
Normal file
86
Assets/WorkSpace/Personal/JYM/UI_DashboardCheckListItem.cs
Normal file
@@ -0,0 +1,86 @@
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using WI;
|
||||
|
||||
namespace CHN
|
||||
{
|
||||
public class UI_DashboardCheckListItem : UIBase
|
||||
{
|
||||
private Toggle toggle;
|
||||
private TextMeshProUGUI toggleText;
|
||||
public GameObject dashboardItem;
|
||||
public bool isClick => toggle.isOn;
|
||||
|
||||
private string keyName;
|
||||
private string type;
|
||||
public void SetItem(string name, GameObject item)
|
||||
{
|
||||
toggle = GetComponentInChildren<Toggle>();
|
||||
toggleText = GetComponentInChildren<TextMeshProUGUI>();
|
||||
keyName = name;
|
||||
RefreshText();
|
||||
dashboardItem = item;
|
||||
type = Type();
|
||||
|
||||
var isBool = PlayerPrefs.GetInt(type) == 0 ? false : true;
|
||||
toggle.isOn = isBool;
|
||||
dashboardItem.gameObject.SetActive(isBool);
|
||||
toggle.onValueChanged.AddListener(OnValueChange);
|
||||
//LocaleService.Instance.OnChanged += OnChangeText;
|
||||
}
|
||||
|
||||
//private void OnChangeText(object sender, Locale e)
|
||||
//{
|
||||
// if (e.name.Contains("ko"))
|
||||
// {
|
||||
// toggleText.fontSize = 14f;
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// toggleText.fontSize = 9f;
|
||||
// }
|
||||
// RefreshText();
|
||||
//}
|
||||
|
||||
private void RefreshText()
|
||||
{
|
||||
toggleText.SetText(keyName);
|
||||
}
|
||||
|
||||
public void ToggleOffItem()
|
||||
{
|
||||
toggle.isOn = false;
|
||||
}
|
||||
|
||||
private void OnValueChange(bool isOn)
|
||||
{
|
||||
PlayerPrefs.SetInt(type, isOn ? 1 : 0);
|
||||
PlayerPrefs.Save();
|
||||
|
||||
dashboardItem.gameObject.SetActive(isOn);
|
||||
}
|
||||
|
||||
private string Type()
|
||||
{
|
||||
var type = "";
|
||||
switch (keyName)
|
||||
{
|
||||
case ("완료 알람 시간"):
|
||||
type = "isCompleteAlramHistory";
|
||||
break;
|
||||
case ("라이브러리"):
|
||||
type = "isLibrary";
|
||||
break;
|
||||
case ("작업 조건 분석"):
|
||||
type = "isWorkConditionAnalysis";
|
||||
break;
|
||||
case ("작업 시간 분석"):
|
||||
type = "isWorkTimeAnalysis";
|
||||
break;
|
||||
}
|
||||
return type;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 13bc29544d3917c4690335081de2a951
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user