Пример #1
0
    public bool Active(string name, bool active = true)
    {
        Window wnd = Find(name);

        if (wnd == null)
        {
            return(false);
        }

        if (wnd.Wnd == null) // 用到时才加载
        {
            Debug.LogFormat("Start {0} loading...", wnd.Bundle);
            AssetManager.Instance.LoadUI(wnd.Bundle, (GameObject prefab) =>
            {
                if (wnd.Wnd == null)
                {
                    LayerSet = wnd.GetLayer();
                    wnd.Wnd  = Util.Instantiate(prefab, WndParent);
                    wnd.Wnd.SetActive(false);
                    wnd.Start();
                    wnd.Active(active);
                }
            });

            return(true);
        }
        else if (!wnd.Done) // TODO: 临时这样写
        {
            wnd.Start();
        }

        wnd.Active(active);
        return(true);
    }
Пример #2
0
        public static void Initialize(this Window platformWindow)
        {
            var baseLayout = (ELayout?)platformWindow.GetType().GetProperty("BaseLayout")?.GetValue(platformWindow);

            if (baseLayout == null)
            {
                var conformant = new Conformant(platformWindow);
                conformant.Show();

                var layout = new ApplicationLayout(conformant);
                layout.Show();

                baseLayout = layout;
                conformant.SetContent(baseLayout);
            }
            platformWindow.SetBaseLayout(baseLayout);
            var modalStack = new ModalStack(baseLayout)
            {
                AlignmentX = -1,
                AlignmentY = -1,
                WeightX    = 1,
                WeightY    = 1,
            };

            modalStack.Show();
            baseLayout.SetContent(modalStack);
            platformWindow.SetModalStack(modalStack);

            platformWindow.Active();
            platformWindow.Show();
            platformWindow.AvailableRotations = DisplayRotation.Degree_0 | DisplayRotation.Degree_90 | DisplayRotation.Degree_180 | DisplayRotation.Degree_270;

            platformWindow.RotationChanged += (sender, e) =>
            {
                // TODO : should update later
            };

            platformWindow.BackButtonPressed += (s, e) => OnBackButtonPressed(platformWindow);
        }