Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using Entitas.CodeGenerator.Api;
- using UniRx;
- using UnityEngine;
- using UnityEngine.UI;
- [UI, Unique]
- public class RestartDialog : Injectable
- {
- public Button YesButton;
- public Button NoButton;
- public Transform Root;
- public bool IsOpened
- {
- get { return Root.gameObject.activeSelf; }
- }
- void Awake()
- {
- YesButton.onClick.RemoveListener(OnYes);
- YesButton.onClick.AddListener(OnYes);
- NoButton.onClick.RemoveListener(OnNo);
- NoButton.onClick.AddListener(OnNo);
- Show(false);
- }
- private void OnNo()
- {
- Show(false);
- }
- private void OnYes()
- {
- Show(true);
- _contexts.uI.CreateEntity().isRestart = true;
- }
- protected override void OnInject()
- {
- _contexts.uI.ReplaceRestartDialog(this);
- }
- public void Show(bool state)
- {
- Root.gameObject.SetActive(state);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement