using TMPro;
using System;
using PhxhSDK;
using UnityEngine;
using Framework.UI;
using UnityEngine.UI;
using Gameplay.Level;
using Framework.Event;
using Gameplay.Manager;
using Framework.Manager;
using Sirenix.OdinInspector;
using System.Collections.Generic;
public class BuildBoot : MonoBehaviour
{
[LabelText("当前条件")] public int CurCondition;
///
/// 节点类
///
private class Node
{
public string Name;
public GameObject NodeObj;
public GameObject BubbleObj;
public Dictionary Options;
public Node(GameObject root)
{
Name = root.name;
Options = new Dictionary();
foreach (Transform child in root.transform)
{
if (!child.gameObject.name.Equals("Btn"))
{
var option = new Option(child.gameObject);
Options.Add(child.gameObject.name, option);
}
else
{
BubbleObj = child.gameObject;
}
}
}
public Option GetOption(string optionName)
{
return Options.GetValueOrDefault(optionName);
}
///
/// 关闭其他选项表现
///
public void OptionDisplay(Option option)
{
if (option == null)
{
CloseAllOptionButBubble(true);
return;
}
foreach (var optionInfo in Options.Values)
{
optionInfo.SetOptionActive(option);
}
BubbleObj.SetActive(false);
}
public void CloseAllOptionButBubble(bool butBubble)
{
foreach (var optionInfo in Options.Values)
{
optionInfo.SetOptionActive(false);
}
BubbleObj.SetActive(butBubble);
}
}
///
/// 选项类
///
private class Option
{
public string Name;
public GameObject NodeObj;
public GameObject OptionObj;
public GameObject NormalObj;
public Option(GameObject root)
{
Name = root.name;
NodeObj = root.transform.parent.gameObject;
OptionObj = root;
NormalObj = root.transform.Find("Normal").gameObject;
}
public void SetOptionActive(Option option)
{
if (option == null)
{
OptionObj.SetActive(false);
return;
}
OptionObj.SetActive(Name.Equals(option.Name));
}
public void SetOptionActive(bool active)
{
OptionObj.SetActive(active);
}
}
///
/// 物品栏类
///
private class BuildBar
{
private GameObject _bar;
private Dictionary _buildItem;
private Dictionary _itemTrans;
private TMP_Text _condition;
private const string ContentPath = "Bar_Tip/Scroll View/Viewport/Content";
private const string IconItemTemplate = "Bar_Tip/Scroll View/Viewport/Content/Item";
private const string TipPath = "Bar_Tip";
private const string ConditionText = "Level\n{0}/{1}";
private const string ItemName = "Item{0}";
private readonly Color _lockColor = new Color(152f / 255f, 0f, 0f);
private readonly Color _unlockColor = new Color(255f, 255f, 255f);
private Action