修复无子步骤时bug
This commit is contained in:
parent
fe5169e55a
commit
bf6b7c057a
@ -7,6 +7,7 @@ using TMPro;
|
||||
using System.Collections.Generic;
|
||||
using static OperationController;
|
||||
using System;
|
||||
using UnityEditor.Hardware;
|
||||
namespace QFramework.Example
|
||||
{
|
||||
public class UIOperationListData : UIPanelData
|
||||
@ -87,6 +88,9 @@ namespace QFramework.Example
|
||||
op = OperationController.Instance.operation;
|
||||
StepContent.RemoveAllChildren();
|
||||
foreach (var item in op.Steps)
|
||||
{
|
||||
|
||||
if (item.SubSteps != null && item.SubSteps.Count > 0)
|
||||
{
|
||||
GameObject obj = GameObject.Instantiate(Step.gameObject, StepContent);
|
||||
Transform title = obj.transform.Find("Title");
|
||||
@ -102,11 +106,8 @@ namespace QFramework.Example
|
||||
btns.Add(btn);
|
||||
arrow.gameObject.SetActive(subContent.transform.childCount > 0);
|
||||
btn.onClick.AddListener(() =>
|
||||
{
|
||||
if (subContent.transform.childCount > 0)
|
||||
{
|
||||
subContent.SetActive(!subContent.activeSelf);
|
||||
}
|
||||
if (op.freeStep)
|
||||
{
|
||||
if (highIcon.color != highColor)
|
||||
@ -115,13 +116,23 @@ namespace QFramework.Example
|
||||
}
|
||||
}
|
||||
});
|
||||
if (item.SubSteps != null)
|
||||
{
|
||||
foreach (var sub in item.SubSteps)
|
||||
{
|
||||
GameObject subObj = GameObject.Instantiate(SubStep.gameObject, subContent.transform);
|
||||
StepItemFactory(subContent.transform, sub.Name);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
StepItemFactory(StepContent, item.Name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void StepItemFactory(Transform content, string txt)
|
||||
{
|
||||
GameObject subObj = GameObject.Instantiate(SubStep.gameObject, content.transform);
|
||||
var stepLabel = subObj.transform.Find("StepLabel").GetComponent<TextMeshProUGUI>();
|
||||
stepLabel.text = sub.Name;
|
||||
stepLabel.text = txt;
|
||||
Button subBtn = subObj.GetComponent<Button>();
|
||||
subBtn.name = btns.Count.ToString();
|
||||
btns.Add(subBtn);
|
||||
@ -134,11 +145,6 @@ namespace QFramework.Example
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
protected override void OnShow()
|
||||
{
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user