示例#1
0
    public void SetPopup(PopupType popupType)
    {
        _actualType = popupType;
        bool isConfirmation = false;
        bool hasExitButton  = false;

        _titleText.StringReference.TableEntryReference       = _actualType.ToString() + "_Popup_Title";
        _descriptionText.StringReference.TableEntryReference = _actualType.ToString() + "_Popup_Description";
        string tableEntryReferenceConfirm = PopupButtonType.Confirm + "_" + _actualType;
        string tableEntryReferenceCancel  = PopupButtonType.Cancel + "_" + _actualType;

        switch (_actualType)
        {
        case PopupType.NewGame:
        case PopupType.BackToMenu:
            isConfirmation = true;

            _popupButton1.SetButton(tableEntryReferenceConfirm, true);
            _popupButton2.SetButton(tableEntryReferenceCancel, false);
            hasExitButton = true;
            break;

        case PopupType.Quit:
            isConfirmation = true;
            _popupButton1.SetButton(tableEntryReferenceConfirm, true);
            _popupButton2.SetButton(tableEntryReferenceCancel, false);
            hasExitButton = false;
            break;

        default:
            isConfirmation = false;
            hasExitButton  = false;
            break;
        }

        if (isConfirmation)         // needs two button : Is a decision
        {
            _popupButton1.gameObject.SetActive(true);
            _popupButton2.gameObject.SetActive(true);

            _popupButton2.Clicked += CancelButtonClicked;
            _popupButton1.Clicked += ConfirmButtonClicked;
        }
        else         // needs only one button : Is an information
        {
            _popupButton1.gameObject.SetActive(true);
            _popupButton2.gameObject.SetActive(false);

            _popupButton1.Clicked += ConfirmButtonClicked;
        }

        _buttonClose.gameObject.SetActive(hasExitButton);

        if (hasExitButton)         // can exit : Has to take the decision or aknowledge the information
        {
            _inputReader.MenuCloseEvent += ClosePopupButtonClicked;
        }
    }
    public void SetPopup(PopupType popupType)
    {
        actualType = popupType;
        bool isConfirmation = false;
        bool hasExitButton  = false;

        _titleText.StringReference.TableEntryReference       = actualType.ToString() + "_Popup_Title";
        _descriptionText.StringReference.TableEntryReference = actualType.ToString() + "_Popup_Description";

        switch (actualType)
        {
        case PopupType.NewGame:
            isConfirmation = true;
            _popupButton1.SetButton(PopupButtonType.Confirm, actualType);
            _popupButton2.SetButton(PopupButtonType.Cancel, actualType);
            hasExitButton = true;
            break;

        case PopupType.Quit:
            isConfirmation = true;
            _popupButton1.SetButton(PopupButtonType.Confirm, actualType);
            _popupButton2.SetButton(PopupButtonType.Cancel, actualType);
            hasExitButton = false;
            break;

        default:
            isConfirmation = false;
            hasExitButton  = false;
            break;
        }

        if (isConfirmation)        // needs two button : Is a decision
        {
            _popupButton1.gameObject.SetActive(true);
            _popupButton2.gameObject.SetActive(true);
            _popupButton1.SelectButton();
        }
        else         // needs only one button : Is an information
        {
            _popupButton1.gameObject.SetActive(true);
            _popupButton2.gameObject.SetActive(false);
            _popupButton1.SelectButton();
        }

        _buttonClose.gameObject.SetActive(hasExitButton);
        if (hasExitButton)         // can exit : Has to take the decision or aknowledge the information
        {
            _inputReader.closePopupEvent += _closePopupEvent.RaiseEvent;
        }
    }
示例#3
0
文件: AppView.cs 项目: Liahim78/Saper
        public void OpenPopup(PopupType popupType, object state = null)
        {
            if (OpenedPopup != null)
            {
                Destroy(OpenedForm);
            }
            var prefab = (GameObject)Resources.Load(@"Popups/" + popupType.ToString(), typeof(GameObject));

            if (prefab == null)
            {
                Debug.LogError("Prefab" + popupType.ToString() + "is null");
                return;
            }
            OpenedPopup = Instantiate(prefab, Popups.transform);
        }
    public void OpenPopup(PopupType popupType, BasePopupData data /*,bool isSingleOnScreen = false*/)
    {
        _canvas = GameObject.FindGameObjectWithTag("MainCanvas").GetComponent <Canvas>();
        PopupData popupData = _popupDataList.popupDataList.Find(x => x.popupType == popupType);

        if (popupData == null)
        {
            Debug.LogError("PopupManager:OpenPopup The popup " + popupType.ToString() + "you are trying to open doesn`t exist.");
            return;
        }

        // if (isSingleOnScreen)
        //{
        //   CloseAllMenus();
        //}
        //ifatuTODO - check if this is needed or corect
        //Destroy(_currentMenu);
        //_currentMenu = null;
        _currentPopup = Instantiate(popupData.popupPrefab, transform.position, Quaternion.identity);
        _currentPopup.Init(data);
        _currentPopup.transform.SetParent(_canvas.transform, false);

        //   _currentMenu.transform.position = new Vector3(0, 0, 0);
        // _currentMenu.transform.localScale = new Vector3(1, 1, 1);
        _popupStack.Add(_currentPopup);
    }
示例#5
0
    protected void SetupTitle(PopupType type, string titleStr)
    {
        // Setup text.
        if (string.IsNullOrEmpty(titleStr))
        {
            title.text = type.ToString();
        }
        else
        {
            title.text = titleStr;
        }

        // Setup color.
        switch (type)
        {
        case PopupType.Info:
            title.color = infoColor;
            break;

        case PopupType.Warning:
            title.color = warningColor;
            break;

        case PopupType.Error:
            title.color = errorColor;
            break;
        }
    }
示例#6
0
    public bool ShowPopupWithNoData(PopupType type, string _message = null, Action noCallBack = null, Action yesCallBack = null)
    {
        if (PopupList.ContainsKey(type.ToString()))
        {
            BasePopupSimple popup = PopupList[type.ToString()];
            if (popup != null)
            {
                popup.SetupData(_message, noCallBack, yesCallBack);
                popup.transform.SetAsLastSibling();
                popup.OnShow();
                return(true);
            }
            return(false);
        }
        bool check = InitPopup(type, _message, noCallBack, yesCallBack);

        return(check);
    }
示例#7
0
    // ------------------------------------------------------------------------------------ //
    public static PopupBase createPopup(GameObject popupGameObject, 
	                                     PopupType popupType)
    {
        if (popupType == PopupType.LevelCompleted) {
            return popupGameObject.AddComponent<PopupLevelCompleted>();
        }

        SLog.logError("PopupFactory createPopup(): unknown type == " + popupType.ToString());
        return null;
    }
示例#8
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);
    }
示例#9
0
        public static Text ShowPopup(string text, Vector2 position, PopupType popupType = PopupType.None)
        {
            var popup = Ref.CreateOrGetPopup();

            popup.transform.position = position;
            popup.text = text;
            var setting = Ref.settingLibrary[popupType.ToString()];

            Ref.StartCoroutine(Ref.AnimatePopup(popup, setting));
            return(popup);
        }
示例#10
0
    // PopupParent 하위로 팝업 생성
    public static BasePopup CreatePopup(PopupType popupType)
    {
        GameObject prefab = Resources.Load <GameObject>("Prefabs/Popup/" + popupType.ToString());

        if (canvasTr == null)
        {
            GameObject canvasObj = GameObject.Find("PopupParent");
            canvasTr = canvasObj.transform;
        }
        GameObject popupObj = Instantiate(prefab, canvasTr);

        return(popupObj.GetComponent <BasePopup>());
    }
示例#11
0
    // ------------------------------------------------------------------------------------ //
    public virtual void initialize(PopupType type, int popupNumber, PopupParamsBase popupParams)
    {
        _type = type;
        _name = "Popup" + type.ToString();
        _popupNumber = popupNumber;

        popupCanvasGO = Instantiate (ResourcesBase.load(getCanvasPrefabPath()) as GameObject) as GameObject;
        popupCanvasGO.name = _name;
        popupCanvasGO.transform.localScale = Vector3.zero;

        Canvas popupCanvas = popupCanvasGO.GetComponent<Canvas>();
        popupCanvas.planeDistance = POPUP_FIRST_POSITION - popupNumber * POPUP_NEXT_POSITION;
        popupCanvas.sortingOrder = (popupNumber + 10);
        popupCanvas.worldCamera = SceneBase.getCurrentSceneClass().getUIManager().getUICamera().getCamera();
    }
示例#12
0
文件: Popup.cs 项目: WattGuy/NextStep
    public Popup(PopupType pt)
    {
        this.pt = pt;
        string s2 = pt.ToString().ToLower();
        string s  = Char.ToUpper(s2[0]).ToString();

        for (int i = 1; i < s2.Length; i++)
        {
            s += s2[i];
        }

        foreach (Transform t in GameObject.FindGameObjectWithTag("PopupCanvas").transform)
        {
            if (t.name == s)
            {
                go = t.gameObject;
            }
        }
    }
 public void SendInPopupForUser(PopupType popupType, string message, string connectionId)
 {
     _context.Clients.Client(connectionId).showPopup(popupType.ToString(), message);
 }
示例#14
0
    // ------------------------------------------------------------------------------------ //
    public void showPopup(PopupType type, PopupParamsBase popupParams)
    {
        int popupNumber = popups.Count;
        PopupBase popup = PopupFactory.createPopup(gameObject, type);

        if (popup == null) {
            SLog.logError("PopupManager showPopup: type == " + type.ToString() + ", PopupBase popup == null");
            return;
        }

        popup.initialize(type, popupNumber, popupParams);
        popups.Add(popup);
    }
    public void ShowPopup(PopupType type)
    {
        LinkedListNode<string> node = popupsList.Find(type.ToString());
        if (node != null)
        {
            popupsList.Remove(node);
            popupsList.AddLast(node);

            this.SetupNextPopup(type.ToString(), false);
        }
        else
        {
            this.SetupNextPopup(type.ToString(), true);
        }

        Workspace.Instance.SendMessage("DisableInput");
    }
 public void SendInPopupForAll(PopupType popupType, string message)
 {
     _context.Clients.All.showPopup(popupType.ToString(), message);
 }
 public void SetButton(PopupButtonType _type, PopupType popupType)
 {
     _currentType = _type;
     _buttonText.StringReference.TableEntryReference = _currentType.ToString() + "_" + popupType.ToString();
 }
示例#18
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);
    }