# WindowController

WindowController - UserWindowController.cs

This class handles switching between modal windows and holds their current state.

```
using System;
using metaproSDK.Scripts.Utils;
using UnityEngine;
using UnityEngine.UI;

namespace metaproSDK.Scripts.Controllers
{
    public class UserWindowController : MonoBehaviour
    {
        [SerializeField] private GameObject providerWindow;
        [SerializeField] private GameObject qrCodeWindow;
        [SerializeField] private GameObject waitLoginWeb3Window;
        [SerializeField] private AssetsWindowController assetsWindow;

        [SerializeField] private Image qrCodeImage;
        
        private ScreenType _currentScreenType;
        private bool _isScreenOpened;

        private void Start()
        {
            _currentScreenType = ScreenType.Providers;
        }

        public void HideAllScreens()
        {
            providerWindow.SetActive(false);
            qrCodeWindow.SetActive(false);
            waitLoginWeb3Window.SetActive(false);
            assetsWindow.gameObject.SetActive(false);
            _isScreenOpened = false;
        }
        
        public void ShowProviderScreen()
        {
            HideAllScreens();
            providerWindow.SetActive(true);
            _currentScreenType = ScreenType.Providers;
            _isScreenOpened = true;
        }
        
        public void ShowQRCodeScreen(Sprite qrCodeSprite)
        {
            HideAllScreens();
            qrCodeWindow.SetActive(true);
            _currentScreenType = ScreenType.QRCode;
            _isScreenOpened = true;
            qrCodeImage.sprite = qrCodeSprite;
        }
        
        public void ShowLoginWeb3Screen()
        {
            HideAllScreens();
            waitLoginWeb3Window.SetActive(true);
            _currentScreenType = ScreenType.LoginWeb3;
            _isScreenOpened = true;
        }
        
        public void ShowAssetsScreen()
        {
            HideAllScreens();
            assetsWindow.gameObject.SetActive(true);
            assetsWindow.ShowAssetsList();
            _currentScreenType = ScreenType.Assets;
            _isScreenOpened = true;
        }
        
        public void ShowAssetCardScreen()
        {
            HideAllScreens();
            assetsWindow.gameObject.SetActive(true);
            assetsWindow.ShowNftCard();
            _currentScreenType = ScreenType.NFTCard;
            _isScreenOpened = true;
        }

        public void EnableCurrentScreen(bool enable)
        {
            if (enable == false)
            {
                HideAllScreens();
                return;
            }
            switch (_currentScreenType)
            {
                case ScreenType.Providers:
                    ShowProviderScreen();
                    break;
                case ScreenType.QRCode:
                    PluginManager.Instance.ClearCurrentProvider();
                    ShowProviderScreen();
                    break;
                case ScreenType.LoginWeb3:
                    ShowLoginWeb3Screen();
                    break;
                case ScreenType.Assets:
                    ShowAssetsScreen();
                    break;
                case ScreenType.NFTCard:
                    ShowAssetCardScreen();
                    break;
                default:
                    throw new ArgumentOutOfRangeException();
            }

        }

        public void ToggleScreen()
        {
            if (_isScreenOpened)
            {
                EnableCurrentScreen(false);
                return;
            }
            EnableCurrentScreen(true);
        }
    }
}

```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.metaproprotocol.com/metapro-protocol/unity-plugin/reference/windowcontroller.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
