protected override void Close()
        {
            if (CurrentWaitableSpriteKey?.IsCompleted() == false)
            {
                CurrentWaitableSpriteKey.SetError(new Exception("Canceled"));
            }

            base.Close();
        }
        public virtual WaitableTask <string> SelectSprite(Encounter encounter, string spriteKey)
        {
            if (CurrentWaitableSpriteKey?.IsCompleted() == false)
            {
                CurrentWaitableSpriteKey.SetError(new Exception("New popup opened"));
            }

            gameObject.SetActive(true);
            Encounter = encounter;
            var isEncounterImage = KeyIsEncounterImage(spriteKey);

            CurrentKey = !isEncounterImage ? spriteKey : null;
            CurrentWaitableSpriteKey = new WaitableTask <string>();
            useEncounterImageToggle.SetIsOnWithoutNotify(isEncounterImage);

            SetImage();

            return(CurrentWaitableSpriteKey);
        }
        public virtual WaitableTask <string> SelectSprite(KeyedCollection <Sprite> sprites, string spriteKey)
        {
            if (CurrentWaitableSpriteKey?.IsCompleted() == false)
            {
                CurrentWaitableSpriteKey.SetError(new Exception("New popup opened"));
            }

            gameObject.SetActive(true);
            SpriteCollection         = sprites;
            CurrentKey               = spriteKey;
            CurrentWaitableSpriteKey = new WaitableTask <string>();

            if (spriteKey != null && SpriteCollection.ContainsKey(spriteKey))
            {
                SetImage(SpriteCollection[spriteKey]);
            }
            else
            {
                SetImage(null);
            }

            return(CurrentWaitableSpriteKey);
        }