52 lines
1.3 KiB
C#
52 lines
1.3 KiB
C#
using UnityEngine;
|
|
using UnityEngine.Serialization;
|
|
using UnityEngine.UI;
|
|
|
|
namespace Runtime.UI.Other
|
|
{
|
|
public class NotebookLineBar: MonoBehaviour
|
|
{
|
|
public GameObject notebookLine;// material
|
|
// public NormalThreedeeProduct notebook;
|
|
public Texture[] colorTexs;
|
|
public Sprite[] sprites;
|
|
public Button buttonPfb;
|
|
public Transform holder;
|
|
|
|
void OnEnable()
|
|
{
|
|
Init();
|
|
}
|
|
|
|
private void Init()
|
|
{
|
|
foreach(Transform t in holder)
|
|
{
|
|
Destroy(t.gameObject);
|
|
}
|
|
|
|
for (int i = 0; i < colorTexs.Length; i++)
|
|
{
|
|
var spawn = Instantiate(buttonPfb, holder);
|
|
|
|
|
|
|
|
spawn.image.sprite = sprites[i];
|
|
var tex = colorTexs[i];
|
|
int current = i;
|
|
|
|
// bool isHave = notebook.CheckLayoutQuantity(i);
|
|
// if (!isHave)
|
|
// {
|
|
// spawn.transform.GetChild(0).gameObject.SetActive(true);
|
|
// continue;
|
|
// }
|
|
//
|
|
// spawn.onClick.AddListener(() =>
|
|
// {
|
|
// notebook.ChangeLayout(tex, current);
|
|
// });
|
|
}
|
|
}
|
|
}
|
|
} |