Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions Assets/ModalWindows/Scripts/ModalWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,8 @@ public virtual T SetHeader(string text)

return Instance;
}



public virtual T SetBody(string text)
{
Expand Down Expand Up @@ -119,6 +121,23 @@ protected virtual void OnBeforeShow()
}
}

protected virtual void Update()
{
CheckIgnorableForClose();
}

protected virtual void CheckIgnorableForClose()
{
if (Input.GetKeyDown(KeyCode.Escape))
{
if (!ReferenceEquals(Instance, null))
{
if (Instance.ignorable)
Instance.Close();
}
}
}

public virtual T Show()
{
OnBeforeShow();
Expand Down
5 changes: 2 additions & 3 deletions Assets/ModalWindows/Scripts/ModalWindows/InputModalWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,11 @@ void SubmitInput()
Close();
}

private void Update()
protected override void Update()
{
base.Update();
if (inputField.isFocused && inputField.text != "" && Input.GetKeyUp(KeyCode.Return))
{
SubmitInput();
}
}

public void UI_InputFieldOKButton()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System.Collections;
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

Expand All @@ -8,4 +9,5 @@ public class SimpleModalWindow : ModalWindow<SimpleModalWindow>
{
return ModalWindow<SimpleModalWindow>.Create(ignorable);
}

}