Skip to content
Open
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
1,593 changes: 235 additions & 1,358 deletions Assets/MenuUi/Prefabs/Panels/DropDownButton.prefab

Large diffs are not rendered by default.

437 changes: 406 additions & 31 deletions Assets/MenuUi/Prefabs/Panels/DropDownMenuPanel.prefab

Large diffs are not rendered by default.

375 changes: 5 additions & 370 deletions Assets/MenuUi/Prefabs/Panels/TopPanel Alt1.prefab

Large diffs are not rendered by default.

380 changes: 9 additions & 371 deletions Assets/MenuUi/Prefabs/Panels/TopPanel Alt2.prefab

Large diffs are not rendered by default.

378 changes: 7 additions & 371 deletions Assets/MenuUi/Prefabs/Panels/TopPanel.prefab

Large diffs are not rendered by default.

435 changes: 426 additions & 9 deletions Assets/MenuUi/Prefabs/Panels/UIOverlayPanel.prefab

Large diffs are not rendered by default.

651 changes: 533 additions & 118 deletions Assets/MenuUi/Prefabs/Panels/WatchPopup.prefab

Large diffs are not rendered by default.

77 changes: 77 additions & 0 deletions Assets/MenuUi/Scripts/TopPanel/StoryPopup.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
using System.Collections;
using System.Collections.Generic;
using Prg.Scripts.Common;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.UI;

public class StoryPopup : MonoBehaviour
{
[SerializeField] private Button _openStoryPopupButton1;
[SerializeField] private Button _openStoryPopupButton2;
[SerializeField] private Button _openStoryPopupButton3;
[SerializeField] private GameObject _watchPopup;

void Start()
{
_openStoryPopupButton1.onClick.AddListener(() => OpenStoryPopup());
_openStoryPopupButton2.onClick.AddListener(() => OpenStoryPopup());
_openStoryPopupButton3.onClick.AddListener(() => OpenStoryPopup());
}

private void OpenStoryPopup()
{
_watchPopup.SetActive(true);
}


// for closing the popup and registering inputs correctly
private bool _closing = false;

private void LateUpdate()
{
if (ClickStateHandler.GetClickState() is ClickState.Start)
{
if (_watchPopup.activeSelf)
{
if (!CheckIfPanel()) _closing = true;
}
}
if (ClickStateHandler.GetClickState() is ClickState.End && _closing)
{
if (!CheckIfPanel()) Hide();
_closing = false;
}
}

private bool CheckIfPanel()
{
List<RaycastResult> results = new List<RaycastResult>();
PointerEventData data = new(EventSystem.current);
data.position = ClickStateHandler.GetClickPosition();
if (data.position == Vector2.negativeInfinity) return false;
var modules = RaycasterManager.GetRaycasters();
foreach (var module in modules)
{
module.Raycast(data, results);
}
foreach (RaycastResult result in results)
{
if (result.gameObject == _watchPopup) return true;
}
return false;
}

public void Hide()
{
StartCoroutine(WaitMenuClose());
}

IEnumerator WaitMenuClose()
{
//Wait for 0.3 seconds
yield return new WaitForSecondsRealtime(0.3f);

_watchPopup.SetActive(false);
}
}
11 changes: 11 additions & 0 deletions Assets/MenuUi/Scripts/TopPanel/StoryPopup.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.