using UnityEngine;
using UnityEngine.UI;
public static class PanelComponentFactory
{
///
///
///
///
///
///
///
public static GameObject BuildCustomPanel(Vector3 position, Vector2 size, Vector3 scale)
{
var panel = DialoguePanelsPrefabsList.GetPanel();
panel.GetComponent().position = position;
panel.GetComponent().localScale = scale;
panel.GetComponent().sizeDelta = size;
GameObject prefab = MonoBehaviour.Instantiate(panel, panel.GetComponent().localPosition, panel.transform.rotation) as GameObject;
prefab.name = "DialoguePanel";
prefab.transform.SetParent(GameObject.FindGameObjectWithTag("GUI").transform, false);
GameObject continueButton = BuildContinueButton(new Vector3(-100, 150, 0), new Vector2(115, 90), new Vector3(1.2f, 1.2f, 1));
continueButton.transform.SetParent(prefab.transform, false);
return prefab;
}
public static GameObject BuildCustomButton(ButtonPanelModel answerModel)
{
var panel = DialoguePanelsPrefabsList.GetBaseButton();
panel.GetComponent().position = answerModel.Position;
panel.GetComponent().localScale = answerModel.Scale;
panel.GetComponent().sizeDelta = answerModel.Size;
GameObject prefab = MonoBehaviour.Instantiate(panel, panel.GetComponent().localPosition, panel.transform.rotation) as GameObject;
prefab.name = answerModel.Response;
// Assign content
prefab.transform.Find("Text").GetComponent().text = answerModel.Response;
// Assign actions
prefab.GetComponent