Пример #1
0
        private void MakeBrushWindow()
        {
            UIWindowSettings settings = MakeWindow("Tree Brush", "TreeBrush", false, new Vector2(500.0f, 300.0f));
            GameObject       windowGO = settings.gameObject;

            // Actually add the window component, which makes it renderable
            tbWindow = windowGO.AddComponent <TreeBrushWindow>();

            // When our tab is clicked, it'll open up the new window
            tbBuilderButton.windowContentGO = tbWindow;
        }
Пример #2
0
        private static UIWindowSettings MakeWindow(string windowName, string windowTag, bool pinnable, Vector2 size)
        {
            // Create the tb window GameObject
            GameObject windowGO = Instantiate(rectTfmPrefab);

            windowGO.name = windowName;

            // Size the tb window
            RectTransform tbRect = windowGO.GetComponent <RectTransform>();

            tbRect.SetInsetAndSizeFromParentEdge(RectTransform.Edge.Bottom, size.y / 2.0f, size.y);
            tbRect.SetInsetAndSizeFromParentEdge(RectTransform.Edge.Left, size.x / 2.0f, size.x);

            // Add various settings to the window
            UIWindowSettings settings = windowGO.AddComponent <UIWindowSettings>();

            settings.pinnable        = pinnable;
            settings.uniqueTagString = windowTag;
            settings.title           = windowName;

            return(settings);
        }