101 lines
2.1 KiB
C#
101 lines
2.1 KiB
C#
using System;
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
|
|
public class CharCreationUIManager : MonoBehaviour
|
|
{
|
|
public enum Categories
|
|
{
|
|
All = 0,
|
|
Hairs = 1,
|
|
Shirts = 2,
|
|
Jackets = 3,
|
|
Pants = 4,
|
|
Boots = 5,
|
|
Hats = 6,
|
|
Accesories = 7
|
|
}
|
|
|
|
public enum CategoriesFiltrs
|
|
{
|
|
All = 0,
|
|
Owned = 1,
|
|
Not_Owned = 2,
|
|
Available = 3
|
|
}
|
|
|
|
[SerializeField]
|
|
private InputField SearchInputField;
|
|
|
|
[SerializeField]
|
|
private GameObject CosmeticItemPrefab;
|
|
|
|
[SerializeField]
|
|
private Text acctualPanelName;
|
|
|
|
[SerializeField]
|
|
private Transform ContentTransform;
|
|
|
|
public Transform PopUpTransform;
|
|
|
|
public Categories categories = Categories.Hairs;
|
|
|
|
public CategoriesFiltrs categoriesFiltr;
|
|
|
|
[SerializeField]
|
|
private Button[] CategoriesButtons;
|
|
|
|
[SerializeField]
|
|
private Button[] CategoriesFiltrButtons;
|
|
|
|
[HideInInspector]
|
|
public GameObject RenderPopUp;
|
|
|
|
[SerializeField]
|
|
private GameObject CosmeticPopUpPrefab;
|
|
|
|
[SerializeField]
|
|
public CosmeticPopUpItem CurrentCosmeticPopUp;
|
|
|
|
private void Start()
|
|
{
|
|
setCategory(0);
|
|
}
|
|
|
|
private void Update()
|
|
{
|
|
}
|
|
|
|
public void setCategory(int id)
|
|
{
|
|
SearchInputField.text = "";
|
|
categories = (Categories)id;
|
|
categoriesFiltr = CategoriesFiltrs.All;
|
|
for (int i = 0; i < CategoriesButtons.Length; i++)
|
|
{
|
|
CategoriesButtons[i].GetComponent<Hover>().isSelected = false;
|
|
}
|
|
CategoriesButtons[id].GetComponent<Hover>().isSelected = true;
|
|
for (int j = 0; j < CategoriesFiltrButtons.Length; j++)
|
|
{
|
|
CategoriesFiltrButtons[j].GetComponent<Hover>().isSelected = false;
|
|
}
|
|
CategoriesFiltrButtons[0].GetComponent<Hover>().isSelected = true;
|
|
acctualPanelName.text = categories.ToString();
|
|
}
|
|
|
|
public void setCategoryFiltr(int filtrid)
|
|
{
|
|
categoriesFiltr = (CategoriesFiltrs)filtrid;
|
|
SearchInputField.text = "";
|
|
}
|
|
|
|
public void CreateCosmeticPopUp(string title, string content, Action action)
|
|
{
|
|
CurrentCosmeticPopUp = UnityEngine.Object.Instantiate(CosmeticPopUpPrefab, PopUpTransform).GetComponent<CosmeticPopUpItem>();
|
|
CurrentCosmeticPopUp.title = title;
|
|
CurrentCosmeticPopUp.content = content;
|
|
CurrentCosmeticPopUp.action = action;
|
|
}
|
|
}
|