Beispiel #1
0
 private static void Init()
 {
     AssetsManager.Instance.LoadAssetAsync <GameObject>(FilePathTools.getUIPath("GuideManager"), (go) =>
     {
         GameObject.Instantiate(go);
     });
 }
Beispiel #2
0
    private void StartOpenWindow(UISettings.UIWindowID id, bool needTransform = true, System.Action onComplate = null, params object[] data)
    {
        isOpening = true;
        UIWindowBase window;

        allWindows.TryGetValue(id, out window);
        if (window != null)
        {
            if (!window.canOpen)
            {
                isOpening = false;
                return;
            }
            UIWindowData windowdata = window.windowData;

            if (windowdata.type == UISettings.UIWindowType.Fixed)
            {
                //window.transform.SetSiblingIndex(FixedRoot.childCount);
                SetSiblingIndex(window, FixedRoot);
            }
            else if (windowdata.type == UISettings.UIWindowType.PopUp)
            {
                curPopUpWindow = window;
                popupCollider.SetActive(true);
                popupCollider.transform.SetAsLastSibling();
                SetSiblingIndex(window, PopUpRoot);
                //popupCollider.transform.SetSiblingIndex(PopUpRoot.childCount);
                // window.transform.SetSiblingIndex(PopUpRoot.childCount);

                if (window.windowData.colliderType == UISettings.UIWindowColliderType.Transparent)
                {
                    popupCollider.GetComponent <Image>().color = new Color(0.8f, 0.8f, 0.8f, 0f);
                }
                else
                {
                    popupCollider.GetComponent <Image>().color = new Color(0, 0, 0, 0f);
                    popupCollider.GetComponent <FadeIn>().to   = 0.4f;
                }

                //popupCollider.GetComponent<Image>().color = new Color(0.8f,0.8f,0.8f,0.5f);
            }
            else if (windowdata.type == UISettings.UIWindowType.Normal)
            {
                SetSiblingIndex(window, NormalRoot);
                //window.transform.SetSiblingIndex(NormalRoot.childCount);
                showNavigationWindow(window);
            }
            else if (windowdata.type == UISettings.UIWindowType.Cover)
            {
                SetSiblingIndex(window, coverRoot);
                //window.transform.SetSiblingIndex(coverRoot.childCount);
            }


            if (!showingWindows.ContainsKey(id))
            {
                showingWindows.Add(id, window);
            }
            isOpening = false;
            StartCoroutine(window.ShowWindow(() =>
            {
                if (onComplate != null)
                {
                    onComplate();
                }
            }, needTransform, data));
        }
        else
        {
            string path = FilePathTools.getUIPath(UISettings.getWindowName(id));
            AssetBundleLoadManager.Instance.LoadAsset <GameObject>(path, (go) =>
            {
                StartCoroutine(ConfigureWindow(go, id, needTransform, onComplate, data));
            });
        }
    }