57 lines
1.6 KiB
C#
57 lines
1.6 KiB
C#
|
using System;
|
||
|
using System.Collections;
|
||
|
using System.Collections.Generic;
|
||
|
using UnityEngine;
|
||
|
using UnityEngine.UI;
|
||
|
|
||
|
public class Panel : AbstractPanel
|
||
|
{
|
||
|
public string Header { get; set; }
|
||
|
public string Content { get; set; }
|
||
|
|
||
|
public GameObject PanelInstance { get; set; }
|
||
|
|
||
|
|
||
|
public Panel() { }
|
||
|
|
||
|
public Panel(Vector3 _position, Vector2 _size, Vector3 _scale) : base (_position, _size, _scale){ }
|
||
|
|
||
|
public override GameObject BuildPanel()
|
||
|
{
|
||
|
GameObject panelPrefab = PanelComponentFactory.BuildCustomPanel(Position, Size, Scale);
|
||
|
|
||
|
panelPrefab.transform.Find("Header").gameObject.GetComponent<UnityEngine.UI.Text>().text = Header;
|
||
|
panelPrefab.transform.Find("Content").gameObject.GetComponent<UnityEngine.UI.Text>().text = Content;
|
||
|
|
||
|
return panelPrefab;
|
||
|
}
|
||
|
|
||
|
public void SetContinueButtonAction(Action<DialogueController> onClickFunction, DialogueController dialogControllerModel)
|
||
|
{
|
||
|
PanelInstance.transform.Find("ContinueButton").GetComponent<Button>().onClick.AddListener(() => onClickFunction(dialogControllerModel));
|
||
|
}
|
||
|
|
||
|
// support method
|
||
|
protected Transform FindButtonByName(string _buttonName)
|
||
|
{
|
||
|
var panelButtonInstance = PanelInstance.transform.Find(_buttonName);
|
||
|
|
||
|
if (!panelButtonInstance)
|
||
|
throw new Exception($"Button {_buttonName} not found in composed panel");
|
||
|
|
||
|
return panelButtonInstance;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
// continue button
|
||
|
|
||
|
// remove current game object instance from scene\
|
||
|
|
||
|
// do declared action
|
||
|
// - in dialogue - set current panel as "readed" + open next / close
|
||
|
|
||
|
// accept button
|
||
|
// - the same what "continue"
|
||
|
//
|
||
|
// - add task to user /
|