Exemple #1
0
        public void Loading(Action <UIActivityIndicator> callback)
        {
            if (this.uiLoading)
            {
                callback?.Invoke(this.uiLoading);
                return;
            }

            UIManAssetLoader.Load <GameObject>(ACTIVITY_INDICATOR_NAME, (key, asset) => OnLoading(key, asset, callback));
        }
Exemple #2
0
        /// <summary>
        /// Preload the specified uiType.
        /// </summary>
        /// <param name="uiType">User interface type.</param>
        public void Preload(Type uiType)
        {
            // Ignore if preloaded
            if (uiType.BaseType == typeof(UIManScreen))
            {
                if (this.screenDict.ContainsKey(uiType))
                {
                    return;
                }
            }
            else
            {
                if (this.dialogDict.ContainsKey(uiType))
                {
                    return;
                }
            }

            // Preload
            UIManAssetLoader.Load <GameObject>(uiType.Name, (key, asset) => PreprocessPreload(key, asset, uiType));
        }
Exemple #3
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="content">Content.</param>
        /// <param name="seal">If set to <c>true</c> seal.</param>
        /// <param name="args">Arguments.</param>
        private void ShowScreen(Type uiType, bool seal, params object[] args)
        {
            if (this.CurrentScreen != null && this.CurrentScreen.State != UIState.Busy && this.CurrentScreen.State != UIState.Hide)
            {
                this.CurrentScreen.HideMe();
            }

            if (!this.screenDict.TryGetValue(uiType, out UIManScreen screen))
            {
                UIManAssetLoader.Load <GameObject>(uiType.Name, (key, asset) => PreprocessScreen(key, asset, uiType, seal, args));
                return;
            }

            if (!screen.gameObject.activeInHierarchy)
            {
                screen.gameObject.SetActive(true);
            }

            if (screen.useBackground)
            {
                this.background.gameObject.SetActive(true);

                UIManAssetLoader.Load <Texture2D>(screen.background, SetScreenBackground);
            }

            BringToFront(this.screenRoot, screen.transform, 2);

            screen.OnShow(args);
            OnShowUI(screen, args);
            DoAnimShow(screen);

            this.CurrentScreen = screen;

            if (!seal)
            {
                this.screenQueue.Add(screen);
            }
        }
Exemple #4
0
        /// <summary>
        /// Shows the dialog.
        /// </summary>
        /// <param name="type">Type.</param>
        /// <param name="callbacks">Callbacks.</param>
        /// <param name="args">Arguments.</param>
        private void ShowDialog(Type uiType, UICallback callbacks, params object[] args)
        {
            if (this.IsInDialogTransition || this.IsLoadingDialog)
            {
                EnqueueDialog(uiType, UITransitionType.Show, args, callbacks);
                return;
            }

            if (!this.dialogDict.TryGetValue(uiType, out UIManDialog dialog))
            {
                this.IsLoadingDialog = true;
                UIManAssetLoader.Load <GameObject>(uiType.Name, (key, asset) => PreprocessDialogue(key, asset, uiType, callbacks, args));
                return;
            }

            if (dialog.IsActive)
            {
                return;
            }

            if (dialog.useCover)
            {
                this.cover.gameObject.SetActive(true);
                BringToFront(this.dialogRoot, this.cover, 1);
            }

            BringToFront(this.dialogRoot, dialog.transform, 2);

            this.activeDialog.Push(uiType);
            this.IsInDialogTransition = true;
            dialog.SetCallbacks(callbacks);
            dialog.OnShow(args);

            OnShowUI(dialog, args);
            DoAnimShow(dialog);
        }
Exemple #5
0
 public void ShowImage(string spritePath)
 {
     this.backgroundImage.enabled = true;
     UIManAssetLoader.Load <Sprite>(spritePath, OnLoadedImage);
 }