/
crypt
/
NumbersPlay
Обзор
Документация
Войти
/
crypt
/
NumbersPlay
Код
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
Assets/PluginYourGames/Scripts/Basic/WindowGame.cs
52 строки
1 KB
Crypt
start
16 ноя 2025, 14:28
16 ноя 2025, 14:28
1482007
Код
Авторство
О чём код?
using System; namespace YG { public static partial class YG2 { public static bool isFocusWindowGame { get { return visibilityWindowGame; } } private static bool visibilityWindowGame = true; public static Action<bool> onFocusWindowGame; public static Action onShowWindowGame, onHideWindowGame; #if UNITY_EDITOR || !PLATFORM_WEBGL [InitYG] private static void InitWindowGame() => UnityEngine.Application.focusChanged += SetFocusWindowGame; #endif public static void SetFocusWindowGame(bool visible) { if (visible) { visibilityWindowGame = true; #if !UNITY_EDITOR && !YandexGamesPlatform_yg if (!nowAdsShow) PauseGame(false); #endif onFocusWindowGame?.Invoke(true); onShowWindowGame?.Invoke(); } else { #if !UNITY_EDITOR && !YandexGamesPlatform_yg if (!nowAdsShow) PauseGame(true); #endif visibilityWindowGame = false; onFocusWindowGame?.Invoke(false); onHideWindowGame?.Invoke(); } } } } #if PLATFORM_WEBGL namespace YG.Insides { public partial class YGSendMessage { public void SetFocusWindowGame(string visible) => YG2.SetFocusWindowGame(visible == "true"); } } #endif