예제 #1
0
        public static void CreateVubbiScript()
        {
            string          path    = GetCurrentPath();
            MakeFileRequest request = new MakeFileRequest(path);

            VisualBlockFileNameWindow.Create(request, "Enter a name for the script", new string[] { "Text: " },
                                             new string[] { "MyScript" }, GUIUtility.GUIToScreenPoint(new Vector2(Screen.width / 2f, Screen.height / 2f)));//Event.current.mousePosition
        }
예제 #2
0
        public void ModalClosed(ModalWindow window)
        {
            VisualBlockFileNameWindow rename = window as VisualBlockFileNameWindow;

            if (rename == null || window.Result != WindowResult.Ok)
            {
                return;
            }

            string filename = rename.Texts[0];

            VubbiFileHandler.CreateNewAssetWithName(usePath, filename);
        }
예제 #3
0
        public static VisualBlockFileNameWindow Create(IModal owner, string title, string[] labels, string[] texts, Vector2 position)
        {
            VisualBlockFileNameWindow rename = VisualBlockFileNameWindow.CreateInstance <VisualBlockFileNameWindow>();

            rename.owner        = owner;
            rename.titleContent = new GUIContent(title);
            rename.labels       = labels;
            rename.texts        = texts;

            float halfWidth = WIDTH / 2;

            float x = position.x - halfWidth;
            float y = position.y;

            float height = HEIGHT + (labels.Length * FIELD_HEIGHT);

            Rect rect = new Rect(x, y, 0, 0);

            rename.position = rect;
            rename.ShowAsDropDown(rect, new Vector2(WIDTH, height));

            return(rename);
        }