public void ShowPopup(ePopupType type, string title, string content, System.Action <bool> callback)
    {
        GameObject popupObj = (GameObject)Instantiate(m_PopupPrefab, m_Canvas.transform);

        popupObj.transform.SetSiblingIndex(0);                  // make sure it doesn't show up over the Fade Scrim
        m_CurrentPopup     = popupObj.GetComponent <UIPopup>(); // TODO should probably use a stack for easily managing multiple popups
        m_CurrentPopupType = type;
        m_CloseCallback    = callback;

        List <UIPromptInfo> prompts = new List <UIPromptInfo>()
        {
            m_Prompts[0]
        };

        switch (m_CurrentPopupType)
        {
        case ePopupType.Confirm:
            m_Prompts[0].m_LabelText = "Okay";
            break;

        case ePopupType.YesNo:
            m_Prompts[0].m_LabelText = "Yes";
            m_Prompts[1].m_LabelText = "No";

            prompts.Add(m_Prompts[1]);
            break;
        }

        m_CurrentPopup.SetData(title, content, prompts);
        m_CurrentPopup.Show();

        InputManager.Instance.AddInputEventDelegate(OnInputUpdate, UpdateLoopType.Update);
    }
 private void Start()
 {
     m_Raycaster   = GameObject.Find("Canvas").GetComponent <GraphicRaycaster>();
     m_EventSystem = GameObject.Find("EventSystem").GetComponent <EventSystem>();
     network       = GameObject.Find("NetworkManager").GetComponent <NetworkManagerMMO>();
     popup         = GameObject.Find("Popup").GetComponent <UIPopup>();
 }
        public void ShowPopup()
        {
            //get a clone of the UIPopup, with the given PopupName, from the UIPopup Database
            UIPopup popup = UIPopup.GetPopup(PopupName);

            //make sure that a popup clone was actually created
            if (popup == null)
            {
                return;
            }

            //we assume (because we know) this UIPopup has a Title and a Message text objects referenced, thus we set their values
            popup.Data.SetLabelsTexts(Title, Message);

            //update the hide settings
            popup.HideOnBackButton     = HideOnBackButton;
            popup.HideOnClickAnywhere  = HideOnClickAnywhere;
            popup.HideOnClickOverlay   = HideOnClickOverlay;
            popup.HideOnClickContainer = HideOnClickContainer;

            //if the developer did not enable at least one hide option, make the UIPopup automatically hide itself (to avoid blocking the UI)
            if (!HideOnBackButton && !HideOnClickAnywhere && !HideOnClickOverlay && !HideOnClickContainer)
            {
                popup.AutoHideAfterShow      = true;
                popup.AutoHideAfterShowDelay = 3f;
                DDebug.Log("Popup '" + PopupName + "' is set to auto-hide in " + popup.AutoHideAfterShowDelay + " seconds because you did not enable any hide option");
            }

            popup.Show(); //show the popup
        }
Beispiel #4
0
        private IEnumerator ShowPopupAfterAllControlsHide(UIPopup popup)
        {
            yield return(new WaitUntil(AreAllControlsHidden));

            _waitUntilAllControlsHidden = false;
            ShowPopup(popup, true);
        }
Beispiel #5
0
    private void UpdateBackBtn()
    {
        if (false == Input.GetKeyDown(KeyCode.Escape))
        {
            return;
        }

        //if (GameManager.IsNetworkLoading)
        //	return;

        UIPopup popup = GetTopPopup();

        if (popup != null)
        {
            if (popup.IsEnableBackBtn)
            {
                popup.OnBackKeyEvent();
            }
        }
        else
        {
            //switch (GameManager.instance.CurrentState)
            //{
            //case GameManager.GameState.LOBBY: UIManager.ExitGameDialog(Application.Quit); break;
            //case GameManager.GameState.SLOT:
            //	{
            //		if (BaseSlotManager.a.GetState() == (int)BaseSlotManager.GameState.READY && !BaseSlotManager.a.IsFreeSpinMode)
            //			UIManager.ExitToLobbyDialog(GameManager.instance.BackToLobby);
            //	}
            //	break;
            //}
        }
    }
Beispiel #6
0
 public UIPopup()
 {
     if (singleton == null)
     {
         singleton = this;
     }
 }
    void Start()
    {
        popup       = FindObjectOfType <UIPopup>();
        inputFilter = gameObject.GetComponentInChildren <InputField>();

        GameObject go = new GameObject();

        go.AddComponent <QryMaterials>();
        qryMaterials = go.GetComponent <QryMaterials>();

        materialManager = FindObjectOfType <MaterialManager>();

        try
        {
            materialList = qryMaterials.GetAllMaterials();
        }
        catch (Exception e)
        {
            Debug.LogError("PopulateMaterialList :: Ocurrió un error al buscar Todos los Materiales de la Base: " + e.Message);
            popup.MostrarPopUp("Materiales Qry DB", "Error Obteniendo Todos los Materiales de la Base");
            return;
        }

        // cargo todos los materiales a la lista
        foreach (MaterialData material in materialList)
        {
            LoadMaterialToList(material);
        }
    }
    void Start()
    {
        popup       = FindObjectOfType <UIPopup>();
        inputFilter = gameObject.GetComponentInChildren <InputField>();

        GameObject go = new GameObject();

        go.AddComponent <QryMoleculas>();
        qryMolecule = go.GetComponent <QryMoleculas>();

        moleculeManager = FindObjectOfType <MoleculeManager>();

        try
        {
            moleculeList = qryMolecule.GetAllMolecules();
        }
        catch (Exception e)
        {
            Debug.LogError("PopulateMoleculeList :: Ocurrio un error al buscar Todas las Moleculas de la Base: " + e.Message);
            popup.MostrarPopUp("Elementos Qry DB", "Error Obteniendo Todas las Moleculas de la Base");
            return;
        }

        // cargo todas las moleculas a la lista
        foreach (MoleculeData molecule in moleculeList)
        {
            LoadMoleculeToList(molecule);
        }
    }
Beispiel #9
0
    public void CreateObject()
    {
        GameItem[] items   = GetCurrentCraftingBar();
        var        created = CraftingSystem.Instance.Craft(items);

        if (created != null && created.type == ItemType.Equipment)
        {
            Equipment.Add(created);
            if (created.prefab.GetComponent <Thruster>() != null)
            {
                _player.AddThruster(created.prefab.GetComponent <Thruster>());
            }
        }

        if (created != null && created.type == ItemType.Ingredient)
        {
            AddItem(created);
        }

        if (created != null && created.type == ItemType.Repair)
        {
            FindObjectOfType <PlayerScript>().Heal(created.CraftingValue);
        }

        if (created != null && created.type == ItemType.Finder)
        {
            if (!_earthFinder)
            {
                UIPopup popup = UIPopupManager.ShowPopup("EarthFinder", false, false);
                _earthFinder = true;
            }
        }

        ClearAllSlots(false);
    }
        public void ShowAchievement(int achievementId)
        {
            //make sure the achievement we want to show has been defined in the Achievements list
            //the achievementId is actually the index of the achievement as it has been defined in the list
            if (Achievements == null || achievementId < 0 || achievementId > Achievements.Count - 1)
            {
                return;
            }

            //get the achievement from the list
            AchievementData achievement = Achievements[achievementId];

            //make sure we got an achievement and that the entry was not null
            if (achievement == null)
            {
                return;
            }

            //get a clone of the UIPopup, with the given PopupName, from the UIPopup Database
            m_popup = UIPopupManager.GetPopup(PopupName);

            //make sure that a popup clone was actually created
            if (m_popup == null)
            {
                return;
            }

            //set the achievement icon
            m_popup.Data.SetImagesSprites(achievement.Icon);
            //set the achievement title and message
            m_popup.Data.SetLabelsTexts(achievement.Achievement, achievement.Description);

            //show the popup
            UIPopupManager.ShowPopup(m_popup, m_popup.AddToPopupQueue, false);
        }
Beispiel #11
0
    public virtual void Destroy()
    {
        if (null == gameObject || !gameObject.activeSelf)
        {
            return;
        }

        if (UIManager.a.IsSound)
        {
            Sound.Play("");// ("Meta_se_button_5");
        }
        if (OnBackEvent != null)
        {
            OnBackEvent();
        }

        UIPopup pre = UIManager.a.GetPrePopup();

        if (pre != null)
        {
            pre.Show();
        }

        Destroy(gameObject);
    }
Beispiel #12
0
        /// <summary> Fires the 'Back' button event (if it can be executed and is enabled) </summary>
        public void Execute()
        {
            if (!CanExecuteBackButton)
            {
                return;
            }
            if (BackButtonDisabled)
            {
                return;
            }

            if (UIPopup.AnyPopupVisible)
            {
                UIPopup popup = UIPopup.LastShownPopup;
                if (popup.HideOnBackButton)
                {
                    popup.Hide();
                }
                return;
            }

            if (UIDrawer.AnyDrawerOpened)
            {
                UIDrawer.OpenedDrawer.Close();
                return;
            }

            Message.Send(new UIButtonMessage(NAME, UIButtonBehaviorType.OnClick));
            m_lastBackButtonPressTime = Time.realtimeSinceStartup;
        }
Beispiel #13
0
 private void SetUpUiObj()
 {
     txtTitle   = GameObject.Find("Popup_Title").GetComponent <Text>();
     txtMessage = GameObject.Find("Popup_Message").GetComponent <Text>();
     uIPopup    = gameObject.GetComponent <UIPopup>();
     btnOk      = gameObject.GetComponentInChildren <Button>();
 }
Beispiel #14
0
    // Start is called before the first frame update
    void Start()
    {
        //instancio la clase de metodos sobre la base de datos
        GameObject go = new GameObject();

        go.AddComponent <QryElementos>();
        qryElement = go.GetComponent <QryElementos>();

        //busca en este caso en el panel "this" que es el llamador un componente especifico, esto reemplaza enviar el gameobject por interface
        glg = this.GetComponent <GridLayoutGroup>();

        popup = FindObjectOfType <UIPopup>();

        //Recorro todas las celdas que tienen un game object
        for (int i = 0; i < glg.transform.childCount; i++)
        {
            button = glg.transform.GetChild(i).GetComponent <Button>();

            //si no es NULL quiere decir que MAPEO un boton ahi tengo que ir a la base de datos
            if (button != null)
            {
                LoadData(button);
            }
        }
    }
Beispiel #15
0
    public void ShowPopup(string displayString, int displayTime)
    {
        GameObject uiPopupInstance = Instantiate(uiPopupObject, uiPopupLayer.transform);
        UIPopup    uiPopup         = uiPopupInstance.GetComponent <UIPopup>();

        uiPopup.displayString = displayString;
        uiPopup.displayTime   = displayTime;
    }
Beispiel #16
0
    public void AddPopup(string title, string message)
    {
        GameObject go  = GameObject.Instantiate(Resources.Load <GameObject>("Prefabs/Popup"), Vector3.zero, Quaternion.identity, transform);
        UIPopup    pop = go.GetComponent <UIPopup>();

        pop.title.text   = title.ToUpper();
        pop.message.text = message;
    }
Beispiel #17
0
    public void ShowFailedPopup()
    {
        _popup = GameObject.Instantiate(gameOverPopup, _gameManager.masterCanvas.transform);
        Button button = _popup.transform.GetChild(1).GetChild(2).GetComponent <Button>();

        button.onClick.AddListener(this.hidePopup);
        _popup.Show();
    }
Beispiel #18
0
 private void SetupTest()
 {
     _cameraBehaviour = GameObject.FindWithTag("Lab").GetComponent <CameraBehaviour>();
     _world           = GameObject.FindWithTag("World").GetComponent <World>();
     _character       = GameObject.FindObjectOfType <Character>();
     _cameraBehaviour.AttachToCharacter(_character);
     _uiPopup = _character.GetComponentInChildren <UIPopup>();
 }
Beispiel #19
0
 public UIPopup()
 {
     // assign singleton only once (to work with DontDestroyOnLoad when
     // using Zones / switching scenes)
     if (singleton == null)
     {
         singleton = this;
     }
 }
    public void ClosePopup()
    {
        InputManager.Instance.RemoveInputEventDelegate(OnInputUpdate);

        m_CurrentPopup.Hide();

        Destroy(m_CurrentPopup.gameObject, 1f); // awful! need a delay based on the animation finishing
        m_CurrentPopup  = null;
        m_CloseCallback = null;
    }
 public UIPopup Popup()
 {
     if (m_popup == null && m_popupTemplate != null)
     {
         GameObject go = GameObject.Instantiate(m_popupTemplate) as GameObject;
         m_popup = go.GetComponent <UIPopup>();
         go.transform.SetParent(transform, false);
     }
     return(m_popup);
 }
Beispiel #22
0
    private void PrevPopupActive(bool isActive_)
    {
        UIPopup popup = GetTopPopup();

        if (popup != null)
        {
            popup.Show();
            //popup.transform.Show();
        }
    }
Beispiel #23
0
 public static void StopPopupPreview(UIPopup popup)
 {
     DOTweenEditorPreview.Stop(true);
     popup.ResetToStartValues();
     popup.Container.ResetToStartValues();
     if (popup.HasOverlay)
     {
         popup.Overlay.ResetToStartValues();
     }
     s_previewIsPlaying = false;
 }
Beispiel #24
0
    public void ShowWinPopup()
    {
        _popup = GameObject.Instantiate(gameWinPopup, _gameManager.masterCanvas.transform);
        Text text = _popup.transform.GetChild(1).GetChild(1).GetComponent <Text>();

        text.text = _gameManager.getCostTime().ToString("耗费时间:#0.0s");
        Button button = _popup.transform.GetChild(1).GetChild(2).GetComponent <Button>();

        button.onClick.AddListener(this.hidePopup);
        _popup.Show();
    }
Beispiel #25
0
        public void ShowPopup(PopupType popupType)
        {
            //get a clone of the UIPopup, with the given PopupName, from the UIPopup Database
            m_popup = UIPopup.GetPopup(PopupName);

            //make sure that a popup clone was actually created
            if (m_popup == null)
            {
                return;
            }

            var icon    = m_popup.Data.Images[0];
            var title   = m_popup.Data.Labels[0].GetComponent <Text>(); //we know this has a Text component because we created it
            var message = m_popup.Data.Labels[1].GetComponent <Text>();

            switch (popupType)
            {
            case PopupType.Error:
                m_popup.Data.SetImagesSprites(ErrorSprite);                //set icon (we know we have one because we created this UIPopup with it)
                m_popup.Data.SetLabelsTexts(ErrorTitle, ErrorMessage);     //set the title and the message (we know they exist and their order because we created them)
                icon.color    = ErrorTextColor;                            //set the icon color (we use white icons, so we can set any tint color)
                title.color   = ErrorTextColor;                            //set title text color
                message.color = ErrorTextColor;                            //set message text color
                break;

            case PopupType.Info:
                m_popup.Data.SetImagesSprites(InfoSprite);               //set icon (we know we have one because we created this UIPopup with it)
                m_popup.Data.SetLabelsTexts(InfoTitle, InfoMessage);     //set the title and the message (we know they exist and their order because we created them)
                icon.color    = InfoTextColor;                           //set the icon color (we use white icons, so we can set any tint color)
                title.color   = InfoTextColor;                           //set title text color
                message.color = InfoTextColor;                           //set message text color
                break;

            case PopupType.Warning:
                m_popup.Data.SetImagesSprites(WarningSprite);                  //set icon (we know we have one because we created this UIPopup with it)
                m_popup.Data.SetLabelsTexts(WarningTitle, WarningMessage);     //set the title and the message (we know they exist and their order because we created them)
                icon.color    = WarningTextColor;                              //set the icon color (we use white icons, so we can set any tint color)
                title.color   = WarningTextColor;                              //set title text color
                message.color = WarningTextColor;                              //set message text color
                break;

            case PopupType.Whatever:
                m_popup.Data.SetImagesSprites(WhateverSprite);                   //set icon (we know we have one because we created this UIPopup with it)
                m_popup.Data.SetLabelsTexts(WhateverTitle, WhateverMessage);     //set the title and the message (we know they exist and their order because we created them)
                icon.color    = WhateverTextColor;                               //set the icon color (we use white icons, so we can set any tint color)
                title.color   = WhateverTextColor;                               //set title text color
                message.color = WhateverTextColor;                               //set message text color
                break;

            default: throw new ArgumentOutOfRangeException("popupType", popupType, null);
            }

            m_popup.Show(); //show the popup
        }
Beispiel #26
0
    // ================================== COMMON UI ======================================

    // -----------------------------------------------------------------------------------
    // UCE_PopupShow
    // -----------------------------------------------------------------------------------
    public void UCE_PopupShow(string message)
    {
        if (message == "")
        {
            return;
        }
        if (UCE_popup == null)
        {
            UCE_popup = FindObjectOfType <UIPopup>();
        }
        UCE_popup.Show(message);
    }
    public GameObject settingsPanel;                                //The panel for the options menu.
#endif

    #endregion _iMMOSETTINGS

    #endregion Variables

    #region Functions

    // Grabs our hidden components controls.

    private void Start()
    {
        network       = GameObject.Find("NetworkManager").GetComponent <NetworkManagerMMO>();
        popup         = GameObject.Find("Popup").GetComponent <UIPopup>();
        loginUI       = GameObject.Find("Login").GetComponent <UILogin>();
        mainMenuPanel = transform.GetChild(0).gameObject;

#if _iMMOSETTINGS
        settingsButton = transform.GetChild(0).transform.GetChild(0).transform.GetChild(1).transform.GetChild(0).gameObject.GetComponent <Button>();
        settingsPanel  = GameObject.Find("UCE_UI_Settings");
#endif
    }
        public void ChangeScene(string _nextSceneName)
        {
            if (UICanvas.GetUICanvas("FadeCanvas") == null)
            {
                var fadeCanvas = UICanvas.CreateUICanvas("FadeCanvas");
                DontDestroyOnLoad(fadeCanvas);
                fadeCanvas.GetComponent <Canvas>().sortingOrder = 20000;
            }
            UIPopup fade = UIPopup.GetPopup("Fade");

            fade.GetComponent <FadeOverlay>().Show(_nextSceneName);
        }
Beispiel #29
0
        public UIPopup CreatePopup(string name, float width = 100, float height = 80)
        {
            Transform popup = GameObject.Instantiate <Transform>(plugin.manager.configurablePopupPrefab);

            ConfigureTransform(popup, width, height);
            ParentToCanvas(popup);

            UIPopup uiPopup = popup.GetComponent <UIPopup>();

            uiPopup.label = name;
            return(uiPopup);
        }
Beispiel #30
0
    /// <summary>
    /// 팝업 제거.
    /// </summary>
    public void RemovePopup()
    {
        Destroy(currentPopup.gameObject);
        uIPopupTypes.Pop();
        uIPopups.Pop();
        currentPopup = null;

        if (0 < uIPopups.Count)
        {
            currentPopup = uIPopups.Peek();
        }
    }