Exemplo n.º 1
0
    public void Initialize(MessageOfTheDayConfig config)
    {
        this.config = config;

        if (!isPopupRoutineRunning)
        {
            StartPopupRoutine();
        }
        else
        {
            ResetPopupDelayed();
        }
    }
Exemplo n.º 2
0
    public void Initialize(UnityAction <int> OnConfirm, UnityAction OnClose, MessageOfTheDayConfig config)
    {
        if (config == null)
        {
            CleanUp();
            return;
        }

        ClearButtons();
        titleText.text = config.title;
        bodyText.text  = config.body;

        SetupButtons(config.buttons, OnConfirm);
        closeButton.onPointerDown -= OnCloseButtonPressed;
        OnCloseButtonPressed       = () => OnClose?.Invoke();
        closeButton.onPointerDown += OnCloseButtonPressed;

        CleanUpPromise();
        if (!String.IsNullOrEmpty(config.background_banner))
        {
            texturePromise = new AssetPromise_Texture(config.background_banner);
            texturePromise.OnSuccessEvent += OnTextureRetrieved;
        }

        AssetPromiseKeeper_Texture.i.Keep(texturePromise);

        if (config.endUnixTimestamp > 0)
        {
            timeLeftText.gameObject.SetActive(false);
            if (updateTimeCoroutine == null)
            {
                updateTimeCoroutine = StartCoroutine(UpdateTimer(DateTimeOffset.FromUnixTimeSeconds(config.endUnixTimestamp).LocalDateTime));
            }
        }
        else
        {
            timeLeftText.gameObject.SetActive(false);
            if (updateTimeCoroutine != null)
            {
                StopCoroutine(updateTimeCoroutine);
            }
        }
    }