public static void ShowText(string text, Vector3 position, float duration, bool isFollow = true)
    {
        GameObject go         = FBPoolManager.instance.getPoolObject(TEXT_POPUP, FBPoolManager.POOLTYPE.UI);
        BasePopup  baseScript = go.GetComponent <BasePopup>();

        baseScript.SetValues(null, isFollow, duration);
        baseScript.SetText(text);
        go.transform.position = position;
        go.SetActive(true);
        currentPopup = go;
        showedPopup  = true;
    }
    public static GameObject ShowTimer(string dialogName, float duration, GameObject parentObj, bool isFollow = true)
    {
        GameObject go         = FBPoolManager.instance.getPoolObject(dialogName, FBPoolManager.POOLTYPE.UI);
        BasePopup  baseScript = go.GetComponent <BasePopup>();

        baseScript.SetValues(parentObj, isFollow, duration);
        go.SetActive(true);
        // currentPopup = go;
        disableWhenMove = false; //we dont want timer disable when player move  out
        playerPos       = Player.instance.gameObject.transform.position;
        //  showedPopup = true;
        return(go);
    }
Example #3
0
    public void HideAllPopup()
    {
        int count = Enum.GetValues(typeof(BasePopup.TypeOfPopup)).Length;

        for (int i = 0; i < count; i++)
        {
            BasePopup.TypeOfPopup type   = (BasePopup.TypeOfPopup)i;
            BasePopup             _popup = GetPopup(type);
            if (_popup != null)
            {
                _popup.HidePopup();
            }
        }
    }
    public static GameObject ShowDialogBelongObject(string dialogName, float duration, Transform obj, string markerName, bool isFollow = true, bool _disableWhenMove = true)
    {
        GameObject go         = FBPoolManager.instance.getPoolObject(dialogName, FBPoolManager.POOLTYPE.UI);
        BasePopup  baseScript = go.GetComponent <BasePopup>();

        baseScript.SetValues(null, isFollow, duration);
        Transform parentMarker = obj.transform.findChildRecursively(markerName);

        go.transform.position = parentMarker.transform.position;
        go.SetActive(true);
        currentPopup    = go;
        disableWhenMove = _disableWhenMove;
        playerPos       = Player.instance.gameObject.transform.position;
        showedPopup     = true;
        return(go);
    }
    public static GameObject ShowDialog(string dialogName, float duration, bool isFollow = true, bool _disableWhenMove = true)
    {
        GameObject go         = FBPoolManager.instance.getPoolObject(dialogName, FBPoolManager.POOLTYPE.UI);
        BasePopup  baseScript = go.GetComponent <BasePopup>();

        baseScript.SetValues(null, isFollow, duration);
        Vector3 targetPos = Camera.main.transform.position + Camera.main.transform.forward * 5f;

        targetPos.y           = Player.instance.playerHeight + 0.1f;
        go.transform.position = targetPos;
        go.SetActive(true);
        currentPopup    = go;
        disableWhenMove = _disableWhenMove;
        playerPos       = Player.instance.gameObject.transform.position;
        showedPopup     = true;
        return(go);
    }
Example #6
0
    public void InitPopup(BasePopup.TypeOfPopup type)
    {
        UpdateContainer();
        BasePopup popupNeed = popupDictionaries[type.ToString()];

        if (popupNeed == null)
        {
            return;
        }
        GameObject obj   = Instantiate(popupNeed.gameObject, container);
        BasePopup  popup = obj.GetComponent <BasePopup>();

        if (popup != null)
        {
            popup.ShowPopup();
        }
    }
Example #7
0
    public void ShowPopup(BasePopup popup, bool isPending = false)
    {
        if (!isPending)
        {
            _pendingPopupsQueue.Enqueue(popup);

            if (_pendingPopupsQueue.Count > 1 && !isPending)
            {
                popup.transform.SetParent(_container, false);
                popup.gameObject.SetActive(false);
                return;
            }
        }

        SetBackdropEnabled(popup.RequiresBackdrop);
        popup.transform.SetParent(_container, false);
        popup.Show();
    }
    public static BasePopup ShowText(string text, float duration, bool isFollow = true)
    {
        GameObject go         = FBPoolManager.instance.getPoolObject(TEXT_POPUP, FBPoolManager.POOLTYPE.UI);
        BasePopup  baseScript = go.GetComponent <BasePopup>();

        baseScript.SetValues(null, isFollow, duration);
        baseScript.SetText(text);
        Vector3 targetPos = Camera.main.transform.position + Camera.main.transform.forward * 3f;

        targetPos.y           = Player.instance.playerHeight + 1f;
        go.transform.position = targetPos;
        go.SetActive(true);
        currentPopup = go;
        playerPos    = Player.instance.gameObject.transform.position;
        showedPopup  = true;

        return(baseScript);
    }
Example #9
0
    public bool ShowPopupWithData <T>(PopupType type, T slot = default, List <T> slots = null, string message = null, Action noCallBack = null, Action yesCallBack = null)
    {
        if (PopupList.ContainsKey(type.ToString()))
        {
            BasePopupSimple popup = PopupList[type.ToString()];
            if (popup != null)
            {
                BasePopup <T> _popup = popup as BasePopup <T>;
                _popup.SetupData(slot, slots, message, noCallBack, yesCallBack);
                _popup.transform.SetAsLastSibling();
                _popup.OnShow();
                return(true);
            }
            return(false);
        }
        bool check = InitPopup(type, slot, slots, message, noCallBack, yesCallBack);

        return(check);
    }
Example #10
0
    public void ShowDialogPopup(Action onAccept, Action onDecline, string message, string acceptText = "Accept",
                                string declineText = "Decline", Action beforeShow = null,
                                Action afterShow   = null)
    {
        DialogPopup popup =
            Instantiate(Resources.Load <DialogPopup>(Path.Combine(PopupsPath, typeof(DialogPopup).ToString())));

        _currentPopup     = popup;
        _backdrop.enabled = true;

        beforeShow += _eventSystemManager.TurnOff;
        afterShow  += _eventSystemManager.TurnOn;
        onAccept   += HideCurrentPopup;
        onDecline  += HideCurrentPopup;

        popup.transform.SetParent(_containter, false);
        popup.Initialize(onAccept, onDecline, message, acceptText, declineText);
        popup.Show(beforeShow, afterShow);
    }
Example #11
0
    public bool InitPopup(BasePopup.TypeOfPopup type)
    {
        UpdateContainer();
        BasePopup popupNeed = Resources.Load <BasePopup>("Popup/" + type.ToString());

        if (popupNeed == null)
        {
            return(false);
        }
        GameObject obj   = Instantiate(popupNeed.gameObject, container);
        BasePopup  popup = obj.GetComponent <BasePopup>();

        if (popup != null)
        {
            PopupList.Add(popup.type.ToString(), popup);
            popup.transform.SetAsLastSibling();
            popup.ShowPopup();
            return(true);
        }
        return(false);
    }
Example #12
0
    private bool InitPopup <T>(PopupType type, T slot, List <T> slots = null, string message = null, Action noCallBack = null, Action yesCallBack = null)
    {
        // UpdateContainer();
        BasePopupSimple popupPrefab = Resources.Load <BasePopupSimple>(string.Format(ResourcesConstant.POPUP_PATH, type.ToString()));

        if (popupPrefab == null)
        {
            return(false);
        }
        BasePopupSimple popup = GameMgr.Ins.InstantiateHelper(popupPrefab);

        PopupList.Add(popup.type.ToString(), popup);
        if (popup != null)
        {
            BasePopup <T> _popup = popup as BasePopup <T>;
            _popup.SetupData(slot, slots, message, noCallBack, yesCallBack);
            _popup.transform.SetAsLastSibling();
            _popup.OnShow();
            return(true);
        }
        return(false);
    }
Example #13
0
    protected override void GoalCompletedHandler(bool shouldShowPopup = true)
    {
        if (_gameManager.popupManager != null)
        {
            _minionManager.StopMinions();
            _towerManager.StopOrInitTowers();

            _lvlCanvas.renderMode = RenderMode.ScreenSpaceOverlay;

            BasePopup popup = null;
            if (_currentTutorial + 1 >= _objectiveList.Count)
            {
                _gameManager.tutorialManager.TutorialFinished(TutorialPhase.FirstTimeOnApp_INGAME_tuto_1_phase3);
                popup = _gameManager.popupManager.BuildPopup(_lvlCanvasManager.transform, "TUTORIAL COMPLETED!", "Continue to main map", "Continue");
                popup.AddFunction(BasePopup.FunctionTypes.ok, OnFinishLevelCallback);
                popup.transform.localScale *= 2;
                base.GoalCompletedHandler(false);
            }
            else
            {
                var phaseTxt = "PHASE " + (_currentTutorial + 1) + "/" + _objectiveList.Count;
                popup = _gameManager.popupManager.BuildPopup(_lvlCanvasManager.transform
                                                             , phaseTxt + " COMPLETED!"
                                                             , "Do you want to continue with the tutorial ?"
                                                             , "Continue"
                                                             , "Exit"
                                                             , PopupsID.AcceptOrDecline);

                popup.transform.localScale *= 2f;
                popup.AddFunction(BasePopup.FunctionTypes.ok, setNextTutorialIfPossible);
                popup.AddFunction(BasePopup.FunctionTypes.cancel, cancelTutorial);

                _currentTutorial++;
            }
        }
    }
 static void PlatformShowPopup(BasePopup popup) =>
 Platform.CreateRenderer(popup);
Example #15
0
 /// <summary>
 /// Displays a popup.
 /// </summary>
 /// <param name="navigation">
 /// The current <see cref="INavigation"/>.
 /// </param>
 /// <param name="popup">
 /// The <see cref="BasePopup"/> to display.
 /// </param>
 public static void ShowPopup(this INavigation navigation, BasePopup popup) =>
 PlatformShowPopup(popup);
 /// <summary>
 /// Displays a popup.
 /// </summary>
 /// <param name="element">
 /// The current <see cref="NavigableElement"/> that has a valid <see cref="INavigation"/>.
 /// </param>
 /// <param name="popup">
 /// The <see cref="BasePopup"/> to display.
 /// </param>
 public static void ShowPopup(this NavigableElement element, BasePopup popup) =>
 element.Navigation.ShowPopup(popup);
Example #17
0
 private void OnReturnLobby()
 {
     textPopup = PopupManager.ShowText("No internet!!! return to lobby", 3);
     textPopup.eventShowPopupCompleted += OnShowPopupCompletted;
 }
Example #18
0
 public void RemovePopup(BasePopup popup)
 {
     gameUIList.Remove(popup);
     Destroy(popup.gameObject);
 }
Example #19
0
 private void ShowNextPopup()
 {
     m_currentPopup = m_popupsQueue.Dequeue();
     m_currentPopup.Show();
 }
Example #20
0
 static void PlatformShowPopup(BasePopup popup) =>
 Platform.CreateRendererWithContext(popup, ToolkitPlatform.Context);
Example #21
0
 private void Start()
 {
     SummaryPopup = AddPopupToList(GameObject.FindObjectOfType <SummaryPopup>(), "SummaryPopup");
     HideAllPopup(0f);
 }
 static void PlatformShowPopup(BasePopup popup) =>
 throw new NotSupportedException($"The current platform '{Device.RuntimePlatform}' does not support Xamarin.CommunityToolkit.BasePopup");