// ===================================================================
        // BUILDER
        // -------------------------------------------------------------------
        /// Creates a port editor window at the given screen position.
        ///
        /// @param screenPosition The screen position where the editor
        ///                       should be displayed.
        ///
        public static new EditorWindow Create(iCS_EditorObject port, Vector2 screenPosition)
        {
            if (port == null)
            {
                return(null);
            }
            var self = PackagePortEditor.CreateInstance <PackagePortEditor>();

            self.vsObject = port;
            Texture2D iCanScriptLogo = null;

            TextureCache.GetTexture(iCS_EditorStrings.TitleLogoIcon, out iCanScriptLogo);
            self.titleContent = new GUIContent("Package Port Editor", iCanScriptLogo);
            self.ShowUtility();
            return(self);
        }
Пример #2
0
        // ===================================================================
        // BUILDER
        // -------------------------------------------------------------------
        /// Creates a port editor window at the given screen position.
        ///
        /// @param screenPosition The screen position where the editor
        ///                       should be displayed.
        ///
        public static EditorWindow Create(iCS_EditorObject port, Vector2 screenPosition)
        {
            if (port == null)
            {
                return(null);
            }
            // Create the specific port editors.
            var parent = port.ParentNode;

            if (parent.IsEventHandler)
            {
                return(EventHandlerPortEditor.Create(port, screenPosition));
            }
            if (parent.IsFunctionDefinition)
            {
                return(FunctionDefinitionPortEditor.Create(port, screenPosition));
            }
            if (parent.IsPackage)
            {
                return(PackagePortEditor.Create(port, screenPosition));
            }
            if (parent.IsKindOfFunction)
            {
                return(FunctionCallPortEditor.Create(port, screenPosition));
            }
            // Create a generic port editor.
            var self = PortEditor.CreateInstance <PortEditor>();

            self.vsObject = port;
            Texture2D iCanScriptLogo = null;

            TextureCache.GetTexture(iCS_EditorStrings.TitleLogoIcon, out iCanScriptLogo);
            self.titleContent = new GUIContent("Port Editor", iCanScriptLogo);
            self.ShowUtility();
            return(self);
        }