Exemplo n.º 1
0
    //public void ShowFormFromID(UIConsts.FORM_ID id)
    //{
    //	if (IsOpened(id))
    //	{
    //		return;
    //	}
    //       // turn on clicks catcher
    //       _uiCreator.ClicksCatcher.SetActive(true);
    //       _uiCreator.ClicksCatcher.transform.SetAsLastSibling();
    //       //
    //	GameObject windowObj = _uiCreator.GetFormFromID(id);
    //       windowObj.SetActive(true);
    //       windowObj.SendMessage("Show");
    //       windowObj.transform.SetAsLastSibling();
    //       BaseUIController window = windowObj.GetComponent<BaseUIController>();
    //       WindowsQueue.Add(window);
    //	GameManager.Instance.EventManager.CallOnShowWindowEvent();
    //}

    public void ShowFormFromID(UIConsts.FORM_ID id, EventData e)
    {
        if (id != UIConsts.FORM_ID.TUTOR_WINDOW && IsOpened(id))
        {
            // only tutorial can be opened many times
            return;
        }
        if (!_uiCreator.WindowExists(id))
        {
            _uiCreator.CreateWindow(GetFormDataByID(id));
        }

        GameObject windowObj = _uiCreator.GetFormFromID(id);

        if (windowObj == null)
        {
            return;
        }

        BaseUIController window = windowObj.GetComponent <BaseUIController>();

        if (window.OpenForm(e) == true)
        {
            // turn on clicks catcher
            _uiCreator.ShowClicksCatcher(GetFormDataByID(id).FaderType);
            //
            windowObj.SetActive(true);
            windowObj.SendMessage("Show");
            windowObj.transform.SetAsLastSibling();
            WindowsQueue.Add(window);
            GameManager.Instance.EventManager.CallOnShowWindowEvent();
        }
    }