Exemplo n.º 1
0
        public static Promise <IPopupResult> ShowPopup(IPopupConfig popupConfig, SignalBus signalBus)
        {
            OpenPopupSignal openPopupParams =
                new OpenPopupSignal
            {
                OnPopupComplete = new Promise <IPopupResult>(),
                PopupConfig     = popupConfig
            };

            signalBus.Fire(openPopupParams);

            return(openPopupParams.OnPopupComplete);
        }
        public bool CanShow(IPopupConfig config, BaseCallElement item, out int priority)
        {
            var itemNameStartIndex = item.Title.LastIndexOf(config.Separator, StringComparison.Ordinal);
            var itemName           = itemNameStartIndex == -1 ? item.Title : item.Title.Substring(itemNameStartIndex + 1);

            var  itemNameShortLower = itemName.ToLower().Replace(" ", string.Empty);
            bool all       = true;
            bool any       = false;
            bool startWith = false;

            for (int i = 0; i < searchLowerWords.Length; i++)
            {
                var searchLowerWord = searchLowerWords[i];
                if (!itemNameShortLower.Contains(searchLowerWord))
                {
                    all = false;
                    continue;
                }
                else
                {
                    any = true;
                    if (i == 0 && itemNameShortLower.StartsWith(searchLowerWord))
                    {
                        startWith = true;
                    }
                }
            }

            if (!any)
            {
                priority = 0;
                return(false);
            }

            if (all && startWith)
            {
                priority = 3;
            }
            else if (all || startWith)
            {
                priority = 2;
            }
            else
            {
                priority = 1;
            }

            return(true);
        }
        /// <summary> Создание окна </summary>
        public static PopupWindow Create(Vector2 pos, bool gui, Popup popup, IPopupConfig config)
        {
            var window = CreateInstance <PopupWindow>();

            window.mPopup = popup;
            window.config = config;
            window.mUnconvertedPosition = pos;
            window.mScreenPosition      = gui ? GUIUtility.GUIToScreenPoint(pos) : pos;
            if (s_Instance && !s_Instance.mNeedUpdate)
            {
                s_Instance.Close();
            }
            s_Instance = window;
            return(window);
        }
Exemplo n.º 4
0
        protected static IPopupConfig PopulatedConfigInstance(IPopupConfig popupConfig, string title, string description, params string[] buttonsTexts)
        {
            popupConfig.Title       = title;
            popupConfig.Description = description;
            popupConfig.ButtonData  = new List <IPopupButtonData>();

            if (buttonsTexts != null)
            {
                foreach (string buttonText in buttonsTexts)
                {
                    popupConfig.ButtonData.Add(new PopupButtonData(buttonText));
                }
            }

            return(popupConfig);
        }
Exemplo n.º 5
0
        public static Promise <IPopupResult> ShowPopup(SignalBus signalBus, IPopupConfig popupConfig)
        {
            try
            {
                OpenPopupSignal openPopupParams = new OpenPopupSignal
                {
                    OnPopupComplete = new Promise <IPopupResult>(),
                    PopupConfig     = popupConfig
                };

                signalBus.TryFire(openPopupParams);

                return(openPopupParams.OnPopupComplete);
            }
            catch (Exception e)
            {
                Debug.LogError(e);
                throw;
            }
        }
 public virtual Promise <IPopupResult> ShowPopup(IPopupConfig popupConfig)
 {
     return(OpenPopupSignal.ShowPopup(SignalBus, popupConfig));
 }
Exemplo n.º 7
0
 /// <summary> Создание окна </summary>
 public Popup(IPopupConfig config)
 {
     this.config = config;
     Root        = new GroupElement(config.RootName, null);
     Search      = new GroupElement("Search", null);
 }