|
|
@@ -2,147 +2,153 @@ using UnityEngine;
|
|
|
using UnityEngine.UI;
|
|
|
using QFramework;
|
|
|
using DG.Tweening;
|
|
|
+using System.Collections.Generic;
|
|
|
|
|
|
namespace QFramework
|
|
|
{
|
|
|
- public class PartListPanelData : UIPanelData
|
|
|
- {
|
|
|
- public PartInfo m_PartInfo;
|
|
|
+ public class PartListPanelData : UIPanelData
|
|
|
+ {
|
|
|
+ public PartInfo m_PartInfo;
|
|
|
|
|
|
- }
|
|
|
- public partial class PartListPanel : UIPanel
|
|
|
- {
|
|
|
- bool m_Expand = false;
|
|
|
+ }
|
|
|
+ public partial class PartListPanel : UIPanel
|
|
|
+ {
|
|
|
+ bool m_Expand = false;
|
|
|
|
|
|
- public ShowState m_ShowState;
|
|
|
+ protected override void OnInit(IUIData uiData = null)
|
|
|
+ {
|
|
|
+ mData = uiData as PartListPanelData ?? new PartListPanelData();
|
|
|
+
|
|
|
+ ExpandBtn.onClick.AddListener(OnExpandBtnClick);
|
|
|
|
|
|
- protected override void ProcessMsg(int eventId, QMsg msg)
|
|
|
- {
|
|
|
- throw new System.NotImplementedException();
|
|
|
- }
|
|
|
-
|
|
|
- protected override void OnInit(IUIData uiData = null)
|
|
|
- {
|
|
|
- mData = uiData as PartListPanelData ?? new PartListPanelData();
|
|
|
+ OperationTitle.text = DeviceController.instance.DeviceName;
|
|
|
|
|
|
- ExpandBtn.onClick.AddListener(OnExpandBtnClick);
|
|
|
+ CloseBtn.onClick.AddListener(() => Application.Quit());
|
|
|
|
|
|
- OperationTitle.text = DeviceController.instance.DeviceName;
|
|
|
+ HidetBtn.onClick.AddListener(OnHideBtnClick);
|
|
|
|
|
|
- CloseBtn.onClick.AddListener(() => Application.Quit());
|
|
|
+ TransflectiveBtn.onClick.AddListener(OnTransflectiveBtnClick);
|
|
|
|
|
|
- HidetBtn.onClick.AddListener(OnHideBtnClick);
|
|
|
+ RevokeBtn.onClick.AddListener(OnRevokeBtnClick);
|
|
|
|
|
|
- TransflectiveBtn.onClick.AddListener(OnTransflectiveBtnClick);
|
|
|
+ RevokeAllBtn.onClick.AddListener(OnRevokeAllBtnClick);
|
|
|
|
|
|
- OnHideBtnClick();
|
|
|
- }
|
|
|
-
|
|
|
- protected override void OnOpen(IUIData uiData = null)
|
|
|
- {
|
|
|
- mData = uiData as PartListPanelData ?? new PartListPanelData();
|
|
|
+ OnHideBtnClick();
|
|
|
+ }
|
|
|
+
|
|
|
+ protected override void OnOpen(IUIData uiData = null)
|
|
|
+ {
|
|
|
+ mData = uiData as PartListPanelData ?? new PartListPanelData();
|
|
|
|
|
|
- CheckDropdown.onValueChanged.AddListener(OnCheckDropDownValueChange);
|
|
|
+ GameObject tmpObj = Instantiate(PartItem.gameObject, Content);
|
|
|
+ tmpObj.gameObject.SetActive(true);
|
|
|
|
|
|
- GameObject tmpObj = Instantiate(PartItem.gameObject, Content);
|
|
|
- tmpObj.gameObject.SetActive(true);
|
|
|
+ PartItem tmpPartItem = tmpObj.GetComponent<PartItem>();
|
|
|
|
|
|
- PartItem tmpPartItem = tmpObj.GetComponent<PartItem>();
|
|
|
+ tmpPartItem.InitData(mData.m_PartInfo);
|
|
|
|
|
|
- tmpPartItem.InitData(mData.m_PartInfo);
|
|
|
+ tmpPartItem.OnSelectToggleChange(true, true);
|
|
|
+ tmpPartItem.ExpandChildPartItem();
|
|
|
+
|
|
|
+ CameraSurround.instance.SetCameraPosition(true);
|
|
|
+ }
|
|
|
+
|
|
|
+ protected override void OnShow()
|
|
|
+ {
|
|
|
+ }
|
|
|
|
|
|
- tmpPartItem.OnSelectToggleChange(true, true);
|
|
|
- tmpPartItem.ExpandChildPartItem();
|
|
|
+ protected override void OnHide()
|
|
|
+ {
|
|
|
+ }
|
|
|
|
|
|
- CameraSurround.instance.SetCameraPosition(true);
|
|
|
- }
|
|
|
-
|
|
|
- protected override void OnShow()
|
|
|
- {
|
|
|
- }
|
|
|
-
|
|
|
- protected override void OnHide()
|
|
|
- {
|
|
|
- }
|
|
|
-
|
|
|
- protected override void OnClose()
|
|
|
- {
|
|
|
- }
|
|
|
+ protected override void OnClose()
|
|
|
+ {
|
|
|
+ }
|
|
|
|
|
|
- public void SetPartItemState(PartMark partMark)
|
|
|
+ public void SetPartItemState(PartMark partMark, bool state)
|
|
|
{
|
|
|
- PartItem[] tmpPartItems = transform.GetComponentsInChildren<PartItem>(true);
|
|
|
+ PartItem[] tmpPartItems = transform.GetComponentsInChildren<PartItem>(true);
|
|
|
|
|
|
foreach (var item in tmpPartItems)
|
|
|
{
|
|
|
if (item.m_PartMark == partMark)
|
|
|
{
|
|
|
- item.SelectBtn.gameObject.SetActive(true);
|
|
|
- item.UnSelectBtn.gameObject.SetActive(false);
|
|
|
- break;
|
|
|
+ item.OnSelectToggleChange(state);
|
|
|
+ break;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- public void OnCheckDropDownValueChange(int value)
|
|
|
- {
|
|
|
- PartItem[] tmpPartItems = transform.GetComponentsInChildren<PartItem>(false);
|
|
|
-
|
|
|
- foreach (var item in tmpPartItems)
|
|
|
- {
|
|
|
- Debug.LogError(item.name + item.m_PartMark == null);
|
|
|
- item.m_PartMark.RefreshState();
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- /// <summary>
|
|
|
- /// 展开按钮点击
|
|
|
- /// </summary>
|
|
|
- public void OnExpandBtnClick()
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 展开按钮点击
|
|
|
+ /// </summary>
|
|
|
+ public void OnExpandBtnClick()
|
|
|
{
|
|
|
- m_Expand = !m_Expand;
|
|
|
+ m_Expand = !m_Expand;
|
|
|
|
|
|
if (m_Expand)
|
|
|
{
|
|
|
- Panel.transform.DOMove(UnExpandTarget.transform.position,0.5f);
|
|
|
- }else
|
|
|
+ Panel.transform.DOMove(UnExpandTarget.transform.position, 0.5f);
|
|
|
+ }
|
|
|
+ else
|
|
|
{
|
|
|
- Panel.transform.DOMove(ExpandTarget.transform.position, 0.5f);
|
|
|
- }
|
|
|
-
|
|
|
- }
|
|
|
+ Panel.transform.DOMove(ExpandTarget.transform.position, 0.5f);
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
- private void OnHideBtnClick()
|
|
|
+ private void OnHideBtnClick()
|
|
|
{
|
|
|
- HidetBtn.GetComponent<DownBGButton>().SetBtnState(BtnState.select);
|
|
|
- TransflectiveBtn.GetComponent<DownBGButton>().SetBtnState(BtnState.normal);
|
|
|
+ HidetBtn.GetComponent<DownBGButton>().SetBtnState(BtnState.select);
|
|
|
+ TransflectiveBtn.GetComponent<DownBGButton>().SetBtnState(BtnState.normal);
|
|
|
|
|
|
- m_ShowState = ShowState.Hide;
|
|
|
+ DeviceController.instance.m_ShowState = ShowState.Hide;
|
|
|
+ }
|
|
|
|
|
|
- PartItem[] tmpPartItems = transform.GetComponentsInChildren<PartItem>(false);
|
|
|
+ private void OnTransflectiveBtnClick()
|
|
|
+ {
|
|
|
+ HidetBtn.GetComponent<DownBGButton>().SetBtnState(BtnState.normal);
|
|
|
+ TransflectiveBtn.GetComponent<DownBGButton>().SetBtnState(BtnState.select);
|
|
|
|
|
|
- foreach (var item in tmpPartItems)
|
|
|
- {
|
|
|
- Debug.LogError(item.name + item.m_PartMark == null);
|
|
|
- item.m_PartMark.RefreshState();
|
|
|
- }
|
|
|
- }
|
|
|
+ DeviceController.instance.m_ShowState = ShowState.Tran;
|
|
|
+ }
|
|
|
|
|
|
- private void OnTransflectiveBtnClick()
|
|
|
- {
|
|
|
- HidetBtn.GetComponent<DownBGButton>().SetBtnState(BtnState.normal);
|
|
|
- TransflectiveBtn.GetComponent<DownBGButton>().SetBtnState(BtnState.select);
|
|
|
+ /// <summary>
|
|
|
+ /// 撤销按钮点击
|
|
|
+ /// </summary>
|
|
|
+ private void OnRevokeBtnClick()
|
|
|
+ {
|
|
|
+ if (DeviceController.instance.m_OperationPartMarkStruct.Count != 0)
|
|
|
+ {
|
|
|
+ PartMark tmpPartMark = DeviceController.instance.m_OperationPartMarkStruct.Pop();
|
|
|
+
|
|
|
+ if (tmpPartMark != null)
|
|
|
+ {
|
|
|
+ tmpPartMark.SetInitState();
|
|
|
+ UIKit.GetPanel<PartListPanel>().SetPartItemState(tmpPartMark, true);
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
- m_ShowState = ShowState.Tran;
|
|
|
+ CameraSurround.instance.SetCameraPosition(true);
|
|
|
+ }
|
|
|
|
|
|
- PartItem[] tmpPartItems = transform.GetComponentsInChildren<PartItem>(false);
|
|
|
+ /// <summary>
|
|
|
+ /// 撤销所有按钮点击
|
|
|
+ /// </summary>
|
|
|
+ private void OnRevokeAllBtnClick()
|
|
|
+ {
|
|
|
+ while (DeviceController.instance.m_OperationPartMarkStruct.Count > 0)
|
|
|
+ {
|
|
|
+ PartMark tmpPartMark = DeviceController.instance.m_OperationPartMarkStruct.Pop();
|
|
|
|
|
|
- foreach (var item in tmpPartItems)
|
|
|
- {
|
|
|
- Debug.LogError(item.name + item.m_PartMark == null);
|
|
|
- item.m_PartMark.RefreshState();
|
|
|
- }
|
|
|
+ if (tmpPartMark != null)
|
|
|
+ {
|
|
|
+ tmpPartMark.SetInitState();
|
|
|
+ UIKit.GetPanel<PartListPanel>().SetPartItemState(tmpPartMark, true);
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
- }
|
|
|
- }
|
|
|
+ CameraSurround.instance.SetCameraPosition(true);
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|