Ejemplo n.º 1
1
 public WebBrowser()
 {
     this.hostView = null;
     this.parentWin = null;
     this.internalWebView = null;
     this.dockedGetterMethod = null;
 }
Ejemplo n.º 2
1
 public bool AttachView(EditorWindow parent, ScriptableObject webView, bool initialize = false)
 {
     this.parentWin = parent;
     this.internalWebView = webView;
     if (this.internalWebView != null)
     {
         this.hostView = Tools.GetReflectionField<object>(parent, "m_Parent");
         this.dockedGetterMethod = this.parentWin.GetType().GetProperty("docked", Tools.FullBinding).GetGetMethod(true);
         if (this.hostView != null && dockedGetterMethod != null)
         {
             if (initialize)
             {
                 Rect initViewRect = new Rect(0, 20, this.parentWin.position.width, this.parentWin.position.height - ((this.IsDocked()) ? 20 : 40));
                 this.InitWebView(this.hostView, (int)initViewRect.x, (int)initViewRect.y, (int)initViewRect.width, (int)initViewRect.height, false);
                 this.SetHideFlags(HideFlags.HideAndDontSave);
                 this.AllowRightClickMenu(true);
             }
         }
         else
         {
             throw new Exception("Failed to get parent window or docked property");
         }
     }
     return (this.internalWebView != null);
 }
Ejemplo n.º 3
0
 public EmptyEditor(string name, EditorWindow window)
 {
     this.name = name;
     this.window = window;
     this.toolbarIndex = 0;
     this.requiresDatabase = false;
 }
Ejemplo n.º 4
0
        public VSESwatchCategoryPanel (EditorWindow _window) {

            base.parentWindow = _window;
            groupSearchWindow = new EditorSearchGroup(175);
            groupSearchWindow.OnItemSelected += OnTileGroupSelected;

        }
Ejemplo n.º 5
0
    public static bool DrawIconButton(string buttonLabel, Texture2D buttonIcon, EditorWindow edWindow = null, EditorStyles buttonStyle = null)
    {
        bool clicked = false;
        Rect buttonRect = EditorGUILayout.BeginVertical("box");

        if (GUI.Button(buttonRect, new GUIContent("", "Tooltip"), GetFoldoutButton())){
            //toggleDropDown = (toggleDropDown ? false : true);
        }

        GUILayout.Space(5f);
        EditorGUILayout.BeginHorizontal();
        if(clicked){
            GUILayout.Label("[     ]", GetLargeLabelIcon());
            //GUILayout.Label("[  V  ]", largeLabelIcon);
        }
        else
        {
            GUILayout.Label("  []  ", GetLargeLabelIcon());
        }
        GUILayout.Label(buttonLabel, GetLargeLabel());
        EditorGUILayout.EndHorizontal();
        GUILayout.Space(8f);
        EditorGUILayout.EndVertical();
        return clicked;
    }
Ejemplo n.º 6
0
        public GDEDrawHelper(EditorWindow window, float topBuf=2f, float leftBuf=2f, float bottomBuf = 2f, float rightBuf=2f, float lineHeight=20f)
        {
            if (mainHeaderStyle.IsNullOrEmpty())
            {
                mainHeaderStyle = new GUIStyle(GUI.skin.label);
                mainHeaderStyle.fontSize = 20;
                mainHeaderStyle.fontStyle = FontStyle.Bold;
            }

            if (subHeaderStyle.IsNullOrEmpty())
            {
                subHeaderStyle = new GUIStyle(GUI.skin.label);
                subHeaderStyle.fontSize = mainHeaderStyle.fontSize - 4;
                subHeaderStyle.fontStyle = FontStyle.Bold;
            }

            TopBuffer = topBuf;
            LeftBuffer = leftBuf;
            BottomBuffer = bottomBuf;
            RightBuffer = rightBuf;
            LineHeight = lineHeight;

            windowHandle = window;
            SizeCache = new Dictionary<string, Vector2>();

            ResetToTop();
        }
Ejemplo n.º 7
0
 public ASHistoryWindow(EditorWindow parent)
 {
     float[] relativeSizes = new float[] { 30f, 70f };
     int[] minSizes = new int[] { 60, 100 };
     this.m_HorSplit = new SplitterState(relativeSizes, minSizes, null);
     this.m_ScrollPos = Vector2.zero;
     this.m_RowHeight = 0x10;
     this.m_HistoryControlID = -1;
     this.m_ChangesetSelectionIndex = -1;
     this.m_AssetSelectionIndex = -1;
     this.m_ChangeLogSelectionRev = -1;
     this.m_Rev1ForCustomDiff = -1;
     this.m_ChangeLogSelectionGUID = string.Empty;
     this.m_ChangeLogSelectionAssetName = string.Empty;
     this.m_SelectedPath = string.Empty;
     this.m_SelectedGUID = string.Empty;
     this.m_DropDownMenuItems = new GUIContent[] { EditorGUIUtility.TextContent("Show History"), emptyGUIContent, EditorGUIUtility.TextContent("Compare to Local"), EditorGUIUtility.TextContent("Compare Binary to Local"), emptyGUIContent, EditorGUIUtility.TextContent("Compare to Another Revision"), EditorGUIUtility.TextContent("Compare Binary to Another Revision"), emptyGUIContent, EditorGUIUtility.TextContent("Download This File") };
     this.m_DropDownChangesetMenuItems = new GUIContent[] { EditorGUIUtility.TextContent("Revert Entire Project to This Changeset") };
     this.m_FileViewWin = new ASHistoryFileView();
     this.m_ParentWindow = parent;
     ASEditorBackend.SettingsIfNeeded();
     if (Selection.objects.Length != 0)
     {
         this.m_FileViewWin.SelType = ASHistoryFileView.SelectionType.Items;
     }
 }
Ejemplo n.º 8
0
    public static void OnEnable()
    {
        //Reset variables chunk. This is for new files being added, generated, etc.
        AssetDatabase.Refresh();
        cmTileSets = new Texture[0];
        cmSprites = new Sprite[0];
        layers.Clear();

        SceneView.onSceneGUIDelegate += OnSceneGUI; //Sets delegate for adding the OnSceneGUI event

        cmTileSets = Resources.LoadAll<Texture>("Tilesets"); //Load all tilesets as texture
        cmSprites = Resources.LoadAll<Sprite>("Tilesets"); //Load all tileset sub objects as tiles
        texVisible = Resources.Load("Editor/CM Tools/TileMaster/Visible") as Texture2D; //Load visible icon
        texHidden = Resources.Load("Editor/CM Tools/TileMaster/Hidden") as Texture2D; //Load hidden icon

        LoadTileset(0);//processes loaded tiles into proper tilesets

        cmSelectedColor = new Texture2D(1,1); //makes highlight color for selecting tiles
        cmSelectedColor.alphaIsTransparency = true;
        cmSelectedColor.filterMode = FilterMode.Point;
        cmSelectedColor.SetPixel(0,0, new Color(.5f,.5f,1f,.5f));
        cmSelectedColor.Apply();

        window = EditorWindow.GetWindow(typeof(TileMaster));//Initialize window
        window.minSize = new Vector2(325,400);
    }
Ejemplo n.º 9
0
 private void gridDiffs_CellClick(object sender, DataGridViewCellEventArgs e)
 {
     try
       {
     if (e.ColumnIndex == colCompare.DisplayIndex && e.RowIndex >= 0)
     {
       var diff = (InstallItemDiff)gridDiffs.Rows[e.RowIndex].DataBoundItem;
       if (diff.DiffType == DiffType.Different)
       {
     var diffWin = new ADiff.DiffWindow();
     diffWin.LeftText = diff.LeftScript.OuterXml;
     diffWin.RightText = diff.RightScript.OuterXml;
     ElementHost.EnableModelessKeyboardInterop(diffWin);
     diffWin.Show();
       }
       else
       {
     using (var dialog = new EditorWindow())
     {
       dialog.AllowRun = false;
       dialog.AmlGetter = o => Utils.FormatXml(diff.LeftScript ?? diff.RightScript);
       dialog.DisplayMember = "Name";
       dialog.DataSource = new List<InstallItemDiff>() { diff };
       dialog.SetConnection(_wizard.Connection, _wizard.ConnectionInfo.First().ConnectionName);
       dialog.ShowDialog(this);
     }
       }
     }
       }
       catch (Exception ex)
       {
     Utils.HandleError(ex);
       }
 }
Ejemplo n.º 10
0
 protected void DeregisterSelectedPane(bool clearActualView)
 {
     if (this.m_ActualView != null)
     {
         if (this.GetPaneMethod("Update") != null)
         {
             EditorApplication.update = (EditorApplication.CallbackFunction) Delegate.Remove(EditorApplication.update, new EditorApplication.CallbackFunction(this.SendUpdate));
         }
         if (this.GetPaneMethod("ModifierKeysChanged") != null)
         {
             EditorApplication.modifierKeysChanged = (EditorApplication.CallbackFunction) Delegate.Remove(EditorApplication.modifierKeysChanged, new EditorApplication.CallbackFunction(this.SendModKeysChanged));
         }
         if (this.m_ActualView.m_FadeoutTime != 0f)
         {
             EditorApplication.update = (EditorApplication.CallbackFunction) Delegate.Remove(EditorApplication.update, new EditorApplication.CallbackFunction(this.m_ActualView.CheckForWindowRepaint));
         }
         if (clearActualView)
         {
             EditorWindow actualView = this.m_ActualView;
             this.m_ActualView = null;
             this.Invoke("OnLostFocus", actualView);
             this.Invoke("OnBecameInvisible", actualView);
         }
     }
 }
Ejemplo n.º 11
0
        public static void  ShowWindow () 
        {
            _window = EditorWindow.GetWindow(typeof(MapTool));

            _window.maxSize = new Vector2(600f, 400f);
            _window.minSize = _window.maxSize;
        }
Ejemplo n.º 12
0
        static void Draw()
        {
            if(hierarchyWindow == null)
            {
            hierarchyWindow = GetHierarchyWindow();
            if(hierarchyWindow == null) return;
            }

            // spriteの描画
            var sprite = view.CurrentSprite;
            if(sprite == null) return;

            Texture texture = sprite.texture;
            Rect textureRect = sprite.textureRect;
            Rect r = new Rect
            (
             textureRect.x / texture.width,
             textureRect.y / texture.height,
             textureRect.width / texture.width,
             textureRect.height / texture.height
             );
            Rect position = new Rect
            (
             hierarchyWindow.position.width - offsetX,
             hierarchyWindow.position.height - textureRect.height - offsetY,
             -textureRect.width,
             textureRect.height
            );
            GUI.DrawTextureWithTexCoords(position, texture, r);
        }
Ejemplo n.º 13
0
    private void GrabSingleView(EditorWindow view, FileInfo targetFile, OutputFormat format)
    {
        var width = Mathf.FloorToInt(view.position.width);
        var height = Mathf.FloorToInt(view.position.height);

        Texture2D screenShot = new Texture2D(width, height);

        this.HideOnGrabbing();

        var colorArray = InternalEditorUtility.ReadScreenPixel(view.position.position, width, height);

        screenShot.SetPixels(colorArray);

        byte[] encodedBytes = null;
        if (format == OutputFormat.jpg)
        {
            encodedBytes = screenShot.EncodeToJPG();
        }
        else
        {
            encodedBytes = screenShot.EncodeToPNG();
        }

        File.WriteAllBytes(targetFile.FullName, encodedBytes);

        this.ShowAfterHiding();
    }
Ejemplo n.º 14
0
 static GUIContent getContent(EditorWindow editor)
 {
     const BindingFlags bFlags = BindingFlags.Instance | BindingFlags.NonPublic;
     PropertyInfo p = typeof(EditorWindow).GetProperty("cachedTitleContent", bFlags);
     if (p == null) return null;
     return p.GetValue(editor, null) as GUIContent;
 }
		public static Rect GetCenterRect(EditorWindow editorWindow, float width, float height) {
			
			var size = editorWindow.position;
			
			return new Rect(size.width * 0.5f - width * 0.5f, size.height * 0.5f - height * 0.5f, width, height);
			
		}
Ejemplo n.º 16
0
        public VSEGroupInspector (EditorWindow _window) {

            base.parentWindow = _window;
            styleSearchWindow = new EditorSearchGroup(150);
            styleSearchWindow.OnItemSelected += OnStyleSelected;

        }
Ejemplo n.º 17
0
        public static void SetWindowValues(EditorWindow editor, Texture icon, string title)
        {

            GUIContent guiContent;
            if (m_windowContentDict == null) 
                m_windowContentDict = new Dictionary<EditorWindow, GUIContent>();
            
            if (m_windowContentDict.ContainsKey(editor))
            {
                guiContent = m_windowContentDict[editor];
                if (guiContent != null)
                {
                    if (guiContent.image != icon) guiContent.image = icon;
                    if (title != null && guiContent.text != title) guiContent.text = title;
                    return;
                }
                m_windowContentDict.Remove(editor);
            }

            guiContent = getContent(editor);
            if (guiContent != null)
            {
                if (guiContent.image != icon) guiContent.image = icon;
                if (title != null && guiContent.text != title) guiContent.text = title;
                m_windowContentDict.Add(editor, guiContent);
            }
        }
Ejemplo n.º 18
0
        public ObjectEditor(EditorWindow window)
        {
            this.window = window;
            window.ModeSwitch += ModeSwitched;

            CreateNewObject();
        }
		//--------------------------------------
		//  Properties
		//--------------------------------------
		
		// PUBLIC
		
		// PUBLIC STATIC
		
		// PRIVATE
		
		// PRIVATE STATIC
	
		
		//--------------------------------------
		//  Methods
		//--------------------------------------
		
		// PUBLIC
		
		// PUBLIC STATIC
		/// <summary>
		/// Sets the editor window tab icon.
		/// </summary>
		/// <param name='cachedTitleContent'>
		/// Cached title content.
		/// </param>
		/// <param name='tabIcon_texture2D'>
		/// Tab icon_texture2 d.
		/// </param>
		public static void SetEditorWindowTabIcon (EditorWindow editorWindow, Texture2D tabIcon_texture2D)
		{
	 		
			//TODO, MOVE THIS TO A PROPERTY SO WE DON'T CALL 'GETPROPERTY' MORE THAN NEEDED (JUST ONCE?)
			PropertyInfo cachedTitleContent;
			
			
			
			
	        //if (cachedTitleContent == null) {
	
	            cachedTitleContent = typeof(EditorWindow).GetProperty("cachedTitleContent", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.GetField);
	
	        //}
	
	        if (cachedTitleContent != null) {
	
	            GUIContent titleContent = cachedTitleContent.GetValue(editorWindow, null) as GUIContent;
	
	            if (titleContent != null) {
	
	                titleContent.image = tabIcon_texture2D;
	                //titleContent.text = "Super Cool3"; // <= here goes the title of your window
	
	            }
	
	        }
			
		}
Ejemplo n.º 20
0
 public MemoryTreeList(EditorWindow editorWindow, MemoryTreeList detailview)
 {
     this.m_EditorWindow = editorWindow;
     this.m_DetailView = detailview;
     this.m_ControlID = GUIUtility.GetPermanentControlID();
     this.SetupSplitter();
 }
Ejemplo n.º 21
0
 public AddCurvesPopupHierarchyGUI(TreeView treeView, AnimationWindowState state, EditorWindow owner) : base(treeView, true)
 {
     this.plusButtonStyle = new GUIStyle("OL Plus");
     this.plusButtonBackgroundStyle = new GUIStyle("Tag MenuItem");
     this.owner = owner;
     this.state = state;
 }
 private static void RemoveFailedToLoadWindowDockedWithInspector(EditorWindow[] allWindows)
 {
     EditorWindow inspectorWindow = null;
     foreach (EditorWindow editorWin in allWindows)
     {
         if (editorWin.GetType().ToString() == "UnityEditor.InspectorWindow")
         {
             inspectorWindow = editorWin;
             break;
         }
     }
   
     if (inspectorWindow != null)
     {
         foreach (EditorWindow editorWin in allWindows)
         {
             if (editorWin.GetType().ToString() == "UnityEditor.FallbackEditorWindow") //cleans up old unused windows to deal with Unity layout bug
             {
                 if (editorWin.position == inspectorWindow.position) //if docked
                 {
                     editorWin.Close();
                      break;
                 }
             }
         }
     }
 }
 private void Draw(EditorWindow caller, float listElementWidth)
 {
   Rect rect = new Rect(0.0f, 0.0f, listElementWidth, 16f);
   this.DrawHeader(ref rect, SceneRenderModeWindow.Styles.sShadedHeader);
   for (int index = 0; index < SceneRenderModeWindow.sRenderModeCount; ++index)
   {
     DrawCameraMode drawCameraMode = (DrawCameraMode) index;
     switch (drawCameraMode)
     {
       case DrawCameraMode.ShadowCascades:
         this.DrawSeparator(ref rect);
         this.DrawHeader(ref rect, SceneRenderModeWindow.Styles.sMiscellaneous);
         break;
       case DrawCameraMode.DeferredDiffuse:
         this.DrawSeparator(ref rect);
         this.DrawHeader(ref rect, SceneRenderModeWindow.Styles.sDeferredHeader);
         break;
       case DrawCameraMode.Charting:
         this.DrawSeparator(ref rect);
         this.DrawHeader(ref rect, SceneRenderModeWindow.Styles.sGlobalIlluminationHeader);
         break;
     }
     EditorGUI.BeginDisabledGroup(this.IsModeDisabled(drawCameraMode));
     this.DoOneMode(caller, ref rect, drawCameraMode);
     EditorGUI.EndDisabledGroup();
   }
   bool disabled = this.m_SceneView.renderMode < DrawCameraMode.Charting || this.IsModeDisabled(this.m_SceneView.renderMode);
   this.DoResolutionToggle(rect, disabled);
 }
Ejemplo n.º 24
0
    public static void Init(Gesture template)
    {
        if(window != null)
        {
            window.ShowNotification(new GUIContent("Please close this " + Template.Name +" template editor\nbefore editing template " + template.Name+"."));
            window.Repaint();
            return;
        }

        Template = template;
        window = ScriptableObject.CreateInstance<TemplateEditor>();
        window.position = new Rect(Screen.width/2,Screen.height/2, 800, 600);
        window.minSize = new Vector2(400,300);
        window.wantsMouseMove = true;
        window.title = Template.Name + " - HyperGlyph Gesture Template Editor";
        window.ShowUtility();

        Template.openforedit = true;

        InputPoints = new List<Vector2>();

        if(Template.Points == null)
            TemplatePoints = new List<Vector2>();
        else
            TemplatePoints = Template.Points;

        setColors();
    }
Ejemplo n.º 25
0
 private void gridDiffs_CellClick(object sender, DataGridViewCellEventArgs e)
 {
   try
   {
     if (e.ColumnIndex == colCompare.DisplayIndex && e.RowIndex >= 0)
     {
       var diff = (InstallItemDiff)gridDiffs.Rows[e.RowIndex].DataBoundItem;
       if (diff.DiffType == DiffType.Different)
       {
         Settings.Current.PerformDiff("Left"
           , s => ToAml(s, diff.LeftScript)
           , "Right"
           , s => ToAml(s, diff.RightScript));
       }
       else
       {
         using (var dialog = new EditorWindow())
         {
           dialog.AllowRun = false;
           dialog.Script = Utils.FormatXml(diff.LeftScript ?? diff.RightScript);
           dialog.SetConnection(_wizard.Connection, _wizard.ConnectionInfo.First().ConnectionName);
           dialog.ShowDialog(this);
         }
       }
     }
   }
   catch (Exception ex)
   {
     Utils.HandleError(ex);
   }
 }
    /// <summary> Called when the nfo[] edit fields should be rendered </summary>
    public override void NfoField(plyDataObject data, EditorWindow ed)
    {
        // Let designer pick a reward type
        EditorGUI.BeginChangeCheck();
        selectedOption = EditorGUILayout.Popup("Reward Type", selectedOption, Options);
        if (EditorGUI.EndChangeCheck())
        {
            data.nfo[0] = selectedOption.ToString();
            data.nfo[1] = "";

            if (selectedOption == 1)
            {
                // set a default item to be selected
                selectedItem = 0;
                data.nfo[1] = ItemNames[0];
            }
        }

        // Let designer pick an item as reward
        if (selectedOption == 1)
        {
            EditorGUI.BeginChangeCheck();
            selectedItem = EditorGUILayout.Popup(" ", selectedItem, ItemNames);
            if (EditorGUI.EndChangeCheck()) data.nfo[1] = ItemNames[selectedItem];
        }
    }
Ejemplo n.º 27
0
 protected override void AddDefaultItemsToMenu(GenericMenu menu, EditorWindow view)
 {
     if (menu.GetItemCount() != 0)
     {
         menu.AddSeparator(string.Empty);
     }
     if (base.parent.window.showMode == ShowMode.MainWindow)
     {
         menu.AddItem(EditorGUIUtility.TextContent("Maximize"), !(base.parent is SplitView), new GenericMenu.MenuFunction2(this.Maximize), view);
     }
     else
     {
         menu.AddDisabledItem(EditorGUIUtility.TextContent("Maximize"));
     }
     menu.AddItem(EditorGUIUtility.TextContent("Close Tab"), false, new GenericMenu.MenuFunction2(this.Close), view);
     menu.AddSeparator(string.Empty);
     System.Type[] paneTypes = base.GetPaneTypes();
     GUIContent content = EditorGUIUtility.TextContent("Add Tab");
     foreach (System.Type type in paneTypes)
     {
         if (type != null)
         {
             GUIContent content2;
             content2 = new GUIContent(EditorWindow.GetLocalizedTitleContentFromType(type)) {
                 text = content.text + "/" + content2.text
             };
             menu.AddItem(content2, false, new GenericMenu.MenuFunction2(this.AddTabToHere), type);
         }
     }
 }
 public static void ShowWindow()
 {
     GUIContent newWindowContent = new GUIContent("PlatformGenerator", (Texture)AssetDatabase.LoadAssetAtPath("Assets/Art/PlatformTiles/tile5.png", typeof(Texture)), "Tool to generate new platforms with width and height");
     _window = EditorWindow.GetWindow(typeof(PlatformGenerateEditor));
     _platformGenerator = new PlatformGenerator();
     _window.titleContent = newWindowContent;
 }
Ejemplo n.º 29
0
    public EditorSearchWindow (KeyCode _toggleKey,KeyCode _increasekey,KeyCode _decreasekey,EditorWindow _window) {

        base.toggleKey = _toggleKey;
        increaseKey = _increasekey;
        decreaseKey = _decreasekey;
        parentWindow = _window;

    }
Ejemplo n.º 30
0
 public ASHistoryWindow(EditorWindow parent)
 {
   this.m_ParentWindow = parent;
   ASEditorBackend.SettingsIfNeeded();
   if (Selection.objects.Length == 0)
     return;
   this.m_FileViewWin.SelType = ASHistoryFileView.SelectionType.Items;
 }
Ejemplo n.º 31
0
        public AddPackageByNameDropdown(ResourceLoader resourceLoader, PackageFiltering packageFiltering, UpmClient upmClient, PackageDatabase packageDatabase, PageManager packageManager, EditorWindow anchorWindow)
        {
            ResolveDependencies(resourceLoader, packageFiltering, upmClient, packageDatabase, packageManager);

            styleSheets.Add(m_ResourceLoader.inputDropdownStyleSheet);

            var root = m_ResourceLoader.GetTemplate("AddPackageByNameDropdown.uxml");

            Add(root);
            cache = new VisualElementCache(root);

            Init(anchorWindow);
        }
Ejemplo n.º 32
0
        public override void OnInspectorGUI()
        {
            serializedObject.Update();

            FairyGUI.UIPanel panel = target as FairyGUI.UIPanel;
#if (UNITY_5 || UNITY_5_3_OR_NEWER)
            DrawPropertiesExcluding(serializedObject, propertyToExclude);
#endif
            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.PrefixLabel("Package Name");
            if (GUILayout.Button(packageName.stringValue, "ObjectField"))
            {
                EditorWindow.GetWindow <PackagesWindow>(true, "Select a UI Component").SetSelection(packageName.stringValue, componentName.stringValue);
            }

            if (GUILayout.Button("Clear", GUILayout.Width(50)))
            {
                bool isPrefab = PrefabUtility.GetPrefabType(panel) == PrefabType.Prefab;
                panel.SendMessage("OnUpdateSource", new object[] { null, null, null, !isPrefab });

#if UNITY_5_3_OR_NEWER
                EditorSceneManager.MarkSceneDirty(EditorSceneManager.GetActiveScene());
#elif UNITY_5
                EditorApplication.MarkSceneDirty();
#else
                EditorUtility.SetDirty(panel);
#endif
            }
            EditorGUILayout.EndHorizontal();

            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.PrefixLabel("Component Name");
            if (GUILayout.Button(componentName.stringValue, "ObjectField"))
            {
                EditorWindow.GetWindow <PackagesWindow>(true, "Select a UI Component").SetSelection(packageName.stringValue, componentName.stringValue);
            }
            EditorGUILayout.EndHorizontal();

            EditorGUILayout.PropertyField(renderMode);
            if ((RenderMode)renderMode.enumValueIndex != RenderMode.ScreenSpaceOverlay)
            {
                EditorGUILayout.PropertyField(renderCamera);
            }
            int oldSortingOrder = panel.sortingOrder;
            EditorGUILayout.PropertyField(sortingOrder);
            EditorGUILayout.PropertyField(fairyBatching);
            EditorGUILayout.PropertyField(hitTestMode);
            EditorGUILayout.PropertyField(touchDisabled);
            EditorGUILayout.PropertyField(setNativeChildrenOrder);
            EditorGUILayout.LabelField("UI Transform", (GUIStyle)"OL Title");
            EditorGUI.BeginChangeCheck();
            EditorGUILayout.PropertyField(position);
            EditorGUILayout.PropertyField(rotation);
            EditorGUILayout.PropertyField(scale);
            EditorGUILayout.Space();

            FairyGUI.FitScreen oldFitScreen = (FairyGUI.FitScreen)fitScreen.enumValueIndex;
            EditorGUILayout.PropertyField(fitScreen);

            if (serializedObject.ApplyModifiedProperties())
            {
                if (PrefabUtility.GetPrefabType(panel) != PrefabType.Prefab)
                {
                    panel.ApplyModifiedProperties(sortingOrder.intValue != oldSortingOrder, (FairyGUI.FitScreen)fitScreen.enumValueIndex != oldFitScreen);
                }
            }
        }
 /// <summary>
 /// Initializes the window to show in the editor
 /// </summary>
 public static void InitializeWindow()
 {
     Editor = EditorWindow.GetWindow <ProjectSetupEditor>("Project Setup");
     Editor.Show();
 }
Ejemplo n.º 34
0
 static public void curve2Code()
 {
     EditorWindow.GetWindow <ECLCurve2Code> (false, "Curve->Code", true);
 }
Ejemplo n.º 35
0
 public static void Open()
 {
     EditorWindow.GetWindow(typeof(ObjectNotesWindow), false, Title);
 }
Ejemplo n.º 36
0
 static public void showSpritePacker()
 {
     EditorWindow.GetWindow <ECLSpritePacker> (false, "Sprite Packer", true);
 }
Ejemplo n.º 37
0
 static public void showProjectView()
 {
     EditorWindow.GetWindow <ECLProjectManager> (false, "CoolapeProject", true);
 }
Ejemplo n.º 38
0
 static void ShowEditor()
 {
     NodeEditor editor = EditorWindow.GetWindow <NodeEditor>();
 }
Ejemplo n.º 39
0
 internal CredentialsUiImpl(EditorWindow parentWindow)
 {
     mParentWindow = parentWindow;
 }
Ejemplo n.º 40
0
        static void InitSFXHelper()
        {
            var window = EditorWindow.GetWindow <BibaSFXEnumHelperWindow> ();

            window.Show();
        }
Ejemplo n.º 41
0
    /// <summary>
    /// Draw the custom wizard.
    /// </summary>

    void OnGUI()
    {
        // Load the saved preferences
        if (!mLoaded)
        {
            mLoaded = true; Load();
        }

        EditorGUIUtility.fieldWidth = 0f;
        EditorGUIUtility.labelWidth = 80f;

        GameObject go = NGUIEditorTools.SelectedRoot();

        if (go == null)
        {
            GUILayout.Label("You must create a UI first.");

            if (GUILayout.Button("Open the New UI Wizard"))
            {
                EditorWindow.GetWindow <UICreateNewUIWizard>(false, "New UI", true);
            }
        }
        else
        {
            GUILayout.Space(4f);

            GUILayout.BeginHorizontal();
            ComponentSelector.Draw <UIAtlas>(NGUISettings.atlas, OnSelectAtlas, GUILayout.Width(140f));
            GUILayout.Label("Texture atlas used by widgets", GUILayout.MinWidth(10000f));
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            ComponentSelector.Draw <UIFont>(NGUISettings.font, OnSelectFont, GUILayout.Width(140f));
            GUILayout.Label("Font used by labels", GUILayout.MinWidth(10000f));
            GUILayout.EndHorizontal();

            GUILayout.Space(-2f);
            NGUIEditorTools.DrawSeparator();

            GUILayout.BeginHorizontal();
            WidgetType wt = (WidgetType)EditorGUILayout.EnumPopup("Template", mType, GUILayout.Width(200f));
            GUILayout.Space(20f);
            GUILayout.Label("Select a widget template to use");
            GUILayout.EndHorizontal();

            if (mType != wt)
            {
                mType = wt; Save();
            }

            switch (mType)
            {
            case WidgetType.Label:                  CreateLabel(go); break;

            case WidgetType.Sprite:                 CreateSprite(go, mSprite); break;

            case WidgetType.Texture:                CreateSimpleTexture(go); break;

            case WidgetType.Button:                 CreateButton(go); break;

            case WidgetType.ImageButton:    CreateImageButton(go); break;

            case WidgetType.Checkbox:               CreateCheckbox(go); break;

            case WidgetType.ProgressBar:    CreateSlider(go, false); break;

            case WidgetType.Slider:                 CreateSlider(go, true); break;

            case WidgetType.Input:                  CreateInput(go); break;

            case WidgetType.PopupList:              CreatePopup(go, true); break;

            case WidgetType.PopupMenu:              CreatePopup(go, false); break;

            case WidgetType.ScrollBar:              CreateScrollBar(go); break;
            }
        }
    }
Ejemplo n.º 42
0
    public static void GetJoystickTool()
    {
        JoystickTool w = (JoystickTool)EditorWindow.GetWindow <JoystickTool>();

        w.Show();
    }
Ejemplo n.º 43
0
        static void InitBGMHelper()
        {
            var window = EditorWindow.GetWindow <BibaBGMEnumHelperWindow> ();

            window.Show();
        }
Ejemplo n.º 44
0
 public static void ShowUpdaterWindow()
 {
     EditorWindow.GetWindow(typeof(tk2dUpdateWindow), true, "2D Toolkit Updater");
 }
Ejemplo n.º 45
0
 public static void ShowWindow()
 {
     EditorWindow.GetWindow(typeof(Multistart));
 }
Ejemplo n.º 46
0
        private void OnGUI()
        {
            GUILayout.BeginVertical(CustomStyles.thinBox, GUILayout.ExpandWidth(true), GUILayout.ExpandHeight(true));

            GUILayout.Label(GetTitle(), CustomStyles.managerHeader);
            if (!string.IsNullOrEmpty(GetTitle()))
            {
                EditorGUILayout.Separator();
                GUILayout.Space(10f);
            }

            if (references == null)
            {
                GetReferences();
            }
            if (references == null)
            {
                AdventureCreator.MissingReferencesGUI();
                GUILayout.EndHorizontal();
                return;
            }

            ShowPage();

            GUILayout.Space(15f);
            GUILayout.BeginHorizontal();
            if (pageNumber < 1)
            {
                if (pageNumber < 0)
                {
                    pageNumber = 0;
                }
                GUI.enabled = false;
            }
            if (pageNumber < numPages)
            {
                if (GUILayout.Button("Previous", EditorStyles.miniButtonLeft))
                {
                    pageNumber--;
                }
            }
            else
            {
                if (GUILayout.Button("Restart", EditorStyles.miniButtonLeft))
                {
                    pageNumber = 0;
                    gameName   = string.Empty;
                }
            }
            GUI.enabled = true;
            if (pageNumber < numPages - 1)
            {
                if (pageNumber == 1 && string.IsNullOrEmpty(gameName))
                {
                    GUI.enabled = false;
                }
                if (GUILayout.Button("Next", EditorStyles.miniButtonRight))
                {
                    pageNumber++;
                    if (pageNumber == numPages - 1)
                    {
                        Process();
                        return;
                    }
                }
                GUI.enabled = true;
            }
            else
            {
                if (pageNumber == numPages)
                {
                    if (GUILayout.Button("Close", EditorStyles.miniButtonRight))
                    {
                        NewGameWizardWindow window = (NewGameWizardWindow)EditorWindow.GetWindow(typeof(NewGameWizardWindow));
                        pageNumber = 0;
                        window.Close();
                        return;
                    }
                }
                else
                {
                    if (GUILayout.Button("Finish", EditorStyles.miniButtonRight))
                    {
                        pageNumber++;
                        Finish();
                        return;
                    }
                }
            }
            GUILayout.EndHorizontal();

            GUI.Label(pageRect, "Page " + (pageNumber + 1) + " of " + (numPages + 1));

            GUILayout.FlexibleSpace();
            CustomGUILayout.EndVertical();
        }
Ejemplo n.º 47
0
 private void Awake()
 {
     window         = GetWindow(typeof(SpriteToXML));
     window.minSize = new Vector2(460, 680);
 }
Ejemplo n.º 48
0
        //Vector2 _instrumentScroll = Vector2.zero;

        public override void OnInspectorGUI()
        {
            //base.OnInspectorGUI ();
            MusicalDialog d = target as MusicalDialog;
            GUIStyle      gs;

            EditorGUI.BeginChangeCheck();
            Undo.RecordObject(d, "Change Musical Editor");

            EditorGUILayout.Space();

            EditorGUILayout.BeginHorizontal();
            gs = new GUIStyle();
            //gs.alignment = TextAnchor.MiddleCenter;
            gs.fontStyle = FontStyle.Bold;
            gs.fontSize  = 14;
            EditorGUILayout.LabelField("Dialog:", gs);

            EditorGUI.indentLevel = 0;

            gs           = new GUIStyle();
            gs.fontSize  = 9;
            gs.fontStyle = FontStyle.Italic;
            gs.alignment = TextAnchor.MiddleRight;
            EditorGUILayout.LabelField("Use spaces and _ (underscores) to separate into syllables.", gs);

            EditorGUILayout.EndHorizontal();

            bool isDialogDirty = false;

            EditorGUILayout.BeginHorizontal();
            GUI.enabled = d.dialogMode != MusicalDialog.DialogMode.Sentence;
            if (GUILayout.Button("SENTENCE"))
            {
                d.dialogMode = MusicalDialog.DialogMode.Sentence; isDialogDirty = true;
            }
            GUI.enabled = d.dialogMode != MusicalDialog.DialogMode.TextFile;
            if (GUILayout.Button("TEXT FILE"))
            {
                d.dialogMode = MusicalDialog.DialogMode.TextFile; isDialogDirty = true;
            }
            GUI.enabled = true;
            EditorGUILayout.EndHorizontal();

            EditorGUILayout.Space();

            if (d.dialogMode == MusicalDialog.DialogMode.Sentence)
            {
                gs          = new GUIStyle(GUI.skin.textArea);
                gs.fontSize = 14;
                gs.padding  = new RectOffset(10, 10, 10, 10);
                d.dialog    = EditorGUILayout.TextArea(d.dialog, gs, GUILayout.ExpandHeight(false));
                if (d.usableSyllables == 0 || _lastText != d.dialog)
                {
                    isDialogDirty     = true;
                    _lastText         = d.dialog;
                    d.gameObject.name = "Dialog (" + d.dialog.Substring(0, Mathf.Min(d.dialog.Length, 6)) + "...)";
                }
            }
            else if (d.dialogMode == MusicalDialog.DialogMode.TextFile)
            {
                if (!string.IsNullOrEmpty(d._editor_textFile_path) && d.textFile == null)
                {
                    // restore last used text file
                    d.textFile = AssetDatabase.LoadAssetAtPath(d._editor_textFile_path, typeof(Object));
                }
                Object lastTextFile = d.textFile;
                d.textFile = EditorGUILayout.ObjectField("Text File", d.textFile, typeof(Object), false);
                d._editor_textFile_path = AssetDatabase.GetAssetPath(d.textFile);
                if (d.textFile != null && !string.IsNullOrEmpty(d._editor_textFile_path) && System.IO.Path.GetExtension(d._editor_textFile_path) != ".txt")
                {
                    EditorGUILayout.HelpBox("Only .txt files work with the musical dialog", MessageType.Error);
                    //d.textFile = null;
                    d._editor_textFile_path = null;
                }
                if (d.textFile != null && !string.IsNullOrEmpty(d._editor_textFile_path) && !d._editor_textFile_path.Contains("Resources"))
                {
                    EditorGUILayout.HelpBox("The text file must be inside the RESOURCES folder", MessageType.Error);
                    d._editor_textFile_path = null;
                    isDialogDirty           = true;
                }
                if (d.textFile == null || d.textFile != null && (lastTextFile != d.textFile) || d._storedDialogs.Count == 0)
                {
                    isDialogDirty = true;
                }

                /*
                 * gs = GUI.skin.textArea;
                 * gs.fontSize = 7;
                 * gs.padding = new RectOffset(10,10,10,10);
                 * string s = "";
                 * for(int i = 0; i < Mathf.Min(d._storedDialogs.Count, 2); i++) {
                 *      s += (i > 0 ? "\n\n" : "") + d._storedDialogs[i];
                 * }
                 * s += "\n ... ";
                 * EditorGUILayout.LabelField(s, gs);
                 */

                if (d.textFile == null)
                {
                    EditorGUILayout.HelpBox("Load a text file", MessageType.Warning);
                }
                else if (d._editor_textFile_path != null)
                {
                    EditorGUILayout.HelpBox("Text file loaded, with " + d._storedDialogs.Count + " separate dialogs :) \nPreview: '" + (d._storedDialogs.Count > 0 ? d._storedDialogs[0].Substring(0, Mathf.Min(30, d._storedDialogs[0].Length)).Trim('\n') : "") + "...'", MessageType.Info);
                }
            }

            EditorGUILayout.BeginHorizontal();

            if (GUILayout.Button("Reload Dialog", GUILayout.MaxWidth(120)) || isDialogDirty)
            {
                d.ParseDialog();
            }

            gs           = new GUIStyle();
            gs.fontSize  = 12;
            gs.fontStyle = FontStyle.Bold;
            gs.alignment = TextAnchor.MiddleRight;
            EditorGUILayout.LabelField((d.dialogMode == MusicalDialog.DialogMode.TextFile ? "Dialogs: " + d._storedDialogs.Count + "  " : "") + "Syllables: " + d.usableSyllables + "  ", gs);

            EditorGUILayout.EndHorizontal();

            if (d.usableSyllables == 0)
            {
                EditorGUILayout.HelpBox("No syllables could be loaded", MessageType.Error);
            }

            EditorGUI.indentLevel = 0;

            EditorGUILayout.Space();

            gs = new GUIStyle();
            //gs.alignment = TextAnchor.MiddleCenter;
            gs.fontStyle = FontStyle.Bold;
            gs.fontSize  = 14;
            EditorGUILayout.LabelField("Instruments:", gs);

            EditorGUI.indentLevel = 0;

            EditorGUILayout.BeginHorizontal();
            GUI.enabled = d.instrumentMode != MusicalDialog.InstrumentMode.Single;
            if (GUILayout.Button("SINGLE"))
            {
                d.instrumentMode = MusicalDialog.InstrumentMode.Single;
            }
            GUI.enabled = d.instrumentMode != MusicalDialog.InstrumentMode.Ordered;
            if (GUILayout.Button("IN ORDER"))
            {
                d.instrumentMode = MusicalDialog.InstrumentMode.Ordered;
            }
            GUI.enabled = d.instrumentMode != MusicalDialog.InstrumentMode.Random;
            if (GUILayout.Button("RANDOM"))
            {
                d.instrumentMode = MusicalDialog.InstrumentMode.Random;
            }
            GUI.enabled = d.instrumentMode != MusicalDialog.InstrumentMode.Custom;
            if (GUILayout.Button("CUSTOM"))
            {
                d.instrumentMode = MusicalDialog.InstrumentMode.Custom;
            }

            /*if (d.dialogMode == MusicalDialog.DialogMode.Sentence) {
             *      GUI.enabled = d.instrumentMode != MusicalDialog.InstrumentMode.Custom;
             *      if (GUILayout.Button("CUSTOM")) d.instrumentMode = MusicalDialog.InstrumentMode.Custom;
             * } else {
             *      if (d.instrumentMode == MusicalDialog.InstrumentMode.Custom)
             *              d.instrumentMode = MusicalDialog.InstrumentMode.Single;
             * }*/
            GUI.enabled = true;
            EditorGUILayout.EndHorizontal();

            if (d.instrumentMode == MusicalDialog.InstrumentMode.Single)
            {
                EditorGUILayout.HelpBox("SINGLE Mode: All syllables will play the same sound.", MessageType.Info);
                d.baseClip = (AudioClip)EditorGUILayout.ObjectField("Default clip", d.baseClip, typeof(AudioClip), false);
            }
            if (d.instrumentMode == MusicalDialog.InstrumentMode.Ordered)
            {
                EditorGUILayout.HelpBox("RANDOM Mode: All syllables will play sounds from this list in order.", MessageType.Info);

                EditorUtils.DrawArray(serializedObject, "orderedClips");
            }
            if (d.instrumentMode == MusicalDialog.InstrumentMode.Custom)
            {
                EditorGUILayout.HelpBox("CUSTOM Mode: Each syllable will play their own sound. If a syllable's clip is empty, the default clip wil be played.", MessageType.Info);

                if (GUILayout.Button("OPEN CUSTOM EDITOR"))
                {
                    EditorWindow.GetWindow(typeof(MusicalDialogCustomWindow));
                }

                /*
                 * d.baseClip = (AudioClip)EditorGUILayout.ObjectField("Default clip", d.baseClip, typeof(AudioClip), false);
                 *
                 * //GUILayout.BeginArea(GUILayoutUtility.GetRect(GUIContent.none, GUIStyle.none, GUILayout.Height(EditorGUIUtility.singleLineHeight) * d.usableSyllables));
                 * //_instrumentScroll = EditorGUILayout.BeginScrollView(_instrumentScroll, new GUILayoutOption[]{GUILayout.MinHeight(EditorGUIUtility.singleLineHeight), GUILayout.MaxHeight(EditorGUIUtility.singleLineHeight * 10)});
                 * bool usingRandomClips = false;
                 * _instrumentScroll = EditorGUILayout.BeginScrollView(_instrumentScroll, GUILayout.MaxHeight(EditorGUIUtility.singleLineHeight * Mathf.Min(d.usableSyllables+1,10)));
                 * int i = 0;
                 * foreach(List<string> syllables in d._storedSyllables) {
                 *      foreach(string syllable in syllables) {
                 *
                 *              var s = d.syllables[i];
                 *
                 *              GUILayout.BeginHorizontal();
                 *
                 *              EditorGUILayout.LabelField(syllable.Trim('\n').Trim('_').Trim(' '), GUILayout.Width(60));
                 *
                 *              GUI.enabled = !s.useRandomClip;
                 *              //s.clip = (AudioClip)EditorGUI.ObjectField(GUILayoutUtility.GetRect(GUIContent.none, GUIStyle.none, new GUILayoutOption[]{GUILayout.Height(EditorGUIUtility.singleLineHeight), GUILayout.Width(100)}), s.clip, typeof(AudioClip));
                 *              s.clip = (AudioClip)EditorGUILayout.ObjectField(s.clip, typeof(AudioClip), false);
                 *              GUI.enabled = true;
                 *              s.useRandomClip = EditorGUILayout.ToggleLeft("R",s.useRandomClip, GUILayout.Width(30));
                 *              if (s.useRandomClip) usingRandomClips = true;
                 *
                 *              s.activateTrigger = (Trigger)EditorGUILayout.ObjectField(s.activateTrigger, typeof(Trigger), true);
                 *              GUILayout.EndHorizontal();
                 *
                 *              i++;
                 *      }
                 * }
                 * EditorGUILayout.EndScrollView();
                 *      //GUILayout.EndArea();
                 * EditorGUILayout.Space();
                 * if (usingRandomClips && d.randomClips.Length == 0) EditorGUILayout.HelpBox("Some syllables play random clips but you didn't add any!", MessageType.Error);
                 * DrawArray(serializedObject, "randomClips");
                 */
            }
            if (d.instrumentMode == MusicalDialog.InstrumentMode.Random)
            {
                EditorGUILayout.HelpBox("RANDOM Mode: All syllables will play random sounds from this list.", MessageType.Info);

                EditorUtils.DrawArray(serializedObject, "randomClips");
            }
            EditorGUI.indentLevel = 0;

            EditorGUILayout.Space();

            gs = new GUIStyle();
            //gs.alignment = TextAnchor.MiddleCenter;
            gs.fontStyle = FontStyle.Bold;
            gs.fontSize  = 14;
            EditorGUILayout.LabelField("Melody:", gs);

            EditorGUI.indentLevel = 0;

            d.useMidi   = EditorGUILayout.ToggleLeft("Use MIDI melody", d.useMidi);
            GUI.enabled = d.useMidi;
            if (!string.IsNullOrEmpty(d._editor_midiFile_path) && d.midiFile == null)
            {
                // restore last used midi file
                d.midiFile = AssetDatabase.LoadAssetAtPath(d._editor_midiFile_path, typeof(Object));
            }
            Object lastMidiFile = d.midiFile;

            d.midiFile = EditorGUILayout.ObjectField("MIDI File", d.midiFile, typeof(Object), false);
            d._editor_midiFile_path = AssetDatabase.GetAssetPath(d.midiFile);
            if (d.midiFile != null && !string.IsNullOrEmpty(d._editor_midiFile_path) && System.IO.Path.GetExtension(d._editor_midiFile_path) != ".mid")
            {
                EditorGUILayout.HelpBox("Only .mid files work with the musical dialog", MessageType.Error);
                //d.midiFile = null;
                d._editor_midiFile_path = null;
            }

            EditorGUILayout.BeginHorizontal();
            if (d.midiFile != null && (d.midiEvents.Count == 0 || lastMidiFile != d.midiFile) || GUILayout.Button("Reload Notes", GUILayout.MaxWidth(120)))
            {
                d.ParseMidiFile();
            }

            gs           = new GUIStyle();
            gs.fontSize  = 12;
            gs.fontStyle = FontStyle.Bold;
            gs.alignment = TextAnchor.MiddleRight;
            int chords = 0;

            foreach (MusicalDialogMidiEvent e in d.midiEvents)
            {
                if (e.notes.Count > 1)
                {
                    chords++;
                }
            }
            EditorGUILayout.LabelField("Notes: " + d.midiEvents.Count + " Chords: " + chords, gs);

            EditorGUILayout.EndHorizontal();



            if (d.useMidi)
            {
                if (d.midiEvents.Count > 0 && d.usableSyllables > d.midiEvents.Count)
                {
                    EditorGUILayout.HelpBox("There are more syllables than notes so the song will loop around", MessageType.Warning);
                }
                if (d.midiEvents.Count > 0 && d.usableSyllables < d.midiEvents.Count)
                {
                    EditorGUILayout.HelpBox("There aren't as many syllables as notes so the song won't play completely", MessageType.Info);
                }
                if (d.midiEvents.Count == 0 && d.usableSyllables > 0)
                {
                    EditorGUILayout.HelpBox("No notes found!", MessageType.Error);
                }
            }

            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.LabelField("Pitch change (semitones +/-)");
            d.pitchSemitones = EditorGUILayout.IntField(d.pitchSemitones);
            EditorGUILayout.EndHorizontal();

            //d.baseNote = (NotePitch)EditorGUILayout.EnumPopup("Base Note", d.baseNote);


            GUI.enabled = true;

            EditorGUILayout.Space();

            gs = new GUIStyle();
            //gs.alignment = TextAnchor.MiddleCenter;
            gs.fontStyle = FontStyle.Bold;
            gs.fontSize  = 14;
            EditorGUILayout.LabelField("Settings:", gs);

            EditorGUI.indentLevel = 0;

            EditorUtils.DrawArray(serializedObject, "styles");

            EditorGUILayout.Space();

            d.volume = EditorGUILayout.Slider("Volume", d.volume, 0, 1);
            d.audioEffects_enabled = EditorGUILayout.ToggleLeft("Copy audio effects from an Audio Source", d.audioEffects_enabled);
            if (d.audioEffects_enabled)
            {
                EditorGUI.indentLevel++;
                EditorGUILayout.BeginHorizontal();
                EditorGUILayout.LabelField("Audio effects source:", GUILayout.MinWidth(120));
                d.audioEffects_source = (AudioSource)EditorGUILayout.ObjectField(d.audioEffects_source, typeof(AudioSource), true);
                EditorGUILayout.EndHorizontal();

                // check if there's other stuff that'd be problematic
                if (d.audioEffects_source != null)
                {
                    d.audioEffects_source.playOnAwake = false;
                    GameObject go         = d.audioEffects_source.gameObject;
                    string[]   validTypes = new string[] {
                        "UnityEngine.Transform",
                        "UnityEngine.AudioSource",
                        "UnityEngine.AudioEchoFilter",
                        "UnityEngine.AudioChorusFilter",
                        "UnityEngine.AudioReverbFilter",
                        "UnityEngine.AudioLowPassFilter",
                        "UnityEngine.AudioHighPassFilter",
                        "UnityEngine.AudioDistortionFilter"
                    };
                    foreach (Component co in go.GetComponents <Component>())
                    {
                        if (!validTypes.Contains(co.GetType().ToString()))
                        {
                            EditorGUILayout.HelpBox("The audio effects source object has an invalid component, remove it to avoid trouble!: " + co.GetType().ToString(), MessageType.Error);
                        }
                    }
                }

                EditorGUI.indentLevel--;
            }

            d.autoTalk            = EditorGUILayout.ToggleLeft("Talk automatically", d.autoTalk);
            EditorGUI.indentLevel = 1;
            if (d.autoTalk)
            {
                EditorGUILayout.BeginHorizontal();
                EditorGUILayout.LabelField("Autotalk pause (milliseconds)");
                d.autoTalk_delay = EditorGUILayout.FloatField(d.autoTalk_delay);
                EditorGUILayout.EndHorizontal();

                EditorGUILayout.BeginHorizontal();
                EditorGUILayout.LabelField("End-of-paragraph pause (milliseconds)");
                d.autoTalk_endofparagraph_delay = EditorGUILayout.FloatField(d.autoTalk_endofparagraph_delay);
                EditorGUILayout.EndHorizontal();
            }
            EditorGUI.indentLevel = 0;


            EditorGUILayout.Space();

            gs = new GUIStyle();
            //gs.alignment = TextAnchor.MiddleCenter;
            gs.fontStyle = FontStyle.Bold;
            gs.fontSize  = 14;
            EditorGUILayout.LabelField("When the dialog ends:", gs);

            d.onEnd_action = (MusicalDialog.ActionOnEnd)EditorGUILayout.EnumPopup("Do", d.onEnd_action);

            if (d.onEnd_action == MusicalDialog.ActionOnEnd.OpenAnotherDialog)
            {
                d.onEnd_dialog = (MusicalDialog)EditorGUILayout.ObjectField("Dialog", d.onEnd_dialog, typeof(MusicalDialog), true);
            }
            if (d.onEnd_action == MusicalDialog.ActionOnEnd.TriggerSomething)
            {
                d.onEnd_trigger = (Trigger)EditorGUILayout.ObjectField("Trigger", d.onEnd_trigger, typeof(Trigger), true);
            }


            EditorGUILayout.Space();

            GUI.enabled = Application.isPlaying;
            GUI.color   = Color.green;
            if (GUILayout.Button("PLAY [Shift+P]" + (!Application.isPlaying ? " (Run the game to test)" : ""), GUILayout.Height(30)))
            {
                d.Play();
            }
            GUI.color   = Color.white;
            GUI.enabled = true;

            /*
             * f.sightRadius = EditorGUILayout.FloatField("Sight distance", f.sightRadius);
             * if (f.sightRadius < 0.1f)
             *      f.sightRadius = 0.1f;
             * f.stopAtDistance = EditorGUILayout.FloatField("Stop at", f.stopAtDistance);
             * if (f.stopAtDistance < 0)
             *      f.stopAtDistance = 0;
             *
             * f.speed = EditorGUILayout.FloatField("Speed", f.speed);
             *
             * f.animationOnSeen = EditorTools.AnimationPopup("Animation On Seen", f.GetComponentInChildren<Animation>(), f.animationOnSeen);
             * f.animationOnUnseen = EditorTools.AnimationPopup("Animation On Unseen", f.GetComponentInChildren<Animation>(), f.animationOnUnseen);
             */

            if (EditorGUI.EndChangeCheck())
            {
                EditorUtility.SetDirty(d);
            }
        }
Ejemplo n.º 49
0
 static void Execute()
 {
     EditorWindow.GetWindowWithRect <XResModelImportEditorWnd>(new Rect(0, 0, 900, 500), true, @"XRes Import Editor");
 }
Ejemplo n.º 50
0
    /// <summary>
    /// Draw the inspector widget.
    /// </summary>

    protected override bool ShouldDrawProperties()
    {
        float alpha = EditorGUILayout.Slider("Alpha", mPanel.alpha, 0f, 1f);

        if (alpha != mPanel.alpha)
        {
            NGUIEditorTools.RegisterUndo("Panel Alpha", mPanel);
            mPanel.alpha = alpha;
        }

        GUILayout.BeginHorizontal();
        {
            EditorGUILayout.PrefixLabel("Depth");

            int depth = mPanel.depth;
            if (GUILayout.Button("Back", GUILayout.Width(60f)))
            {
                --depth;
            }
            depth = EditorGUILayout.IntField(depth, GUILayout.MinWidth(20f));
            if (GUILayout.Button("Forward", GUILayout.Width(68f)))
            {
                ++depth;
            }

            if (mPanel.depth != depth)
            {
                NGUIEditorTools.RegisterUndo("Panel Depth", mPanel);
                mPanel.depth = depth;

                if (UIPanelTool.instance != null)
                {
                    UIPanelTool.instance.Repaint();
                }
            }
        }
        GUILayout.EndHorizontal();

        int matchingDepths = 0;

        for (int i = 0; i < UIPanel.list.size; ++i)
        {
            UIPanel p = UIPanel.list[i];
            if (p != null && mPanel.depth == p.depth)
            {
                ++matchingDepths;
            }
        }

        if (matchingDepths > 1)
        {
            EditorGUILayout.HelpBox(matchingDepths + " panels are sharing the depth value of " + mPanel.depth, MessageType.Warning);
        }

        UIDrawCall.Clipping clipping = (UIDrawCall.Clipping)EditorGUILayout.EnumPopup("Clipping", mPanel.clipping);

        if (mPanel.clipping != clipping)
        {
            mPanel.clipping = clipping;
            EditorUtility.SetDirty(mPanel);
        }

        if (mPanel.clipping != UIDrawCall.Clipping.None)
        {
            Vector4 range = mPanel.baseClipRegion;

            GUILayout.BeginHorizontal();
            GUILayout.Space(80f);
            Vector2 pos = EditorGUILayout.Vector2Field("Center", new Vector2(range.x, range.y));
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            GUILayout.Space(80f);
            Vector2 size = EditorGUILayout.Vector2Field("Size", new Vector2(range.z, range.w));
            GUILayout.EndHorizontal();

            if (size.x < 0f)
            {
                size.x = 0f;
            }
            if (size.y < 0f)
            {
                size.y = 0f;
            }

            range.x = pos.x;
            range.y = pos.y;
            range.z = size.x;
            range.w = size.y;

            if (mPanel.baseClipRegion != range)
            {
                NGUIEditorTools.RegisterUndo("Clipping Change", mPanel);
                mPanel.baseClipRegion = range;
                EditorUtility.SetDirty(mPanel);
            }

            if (mPanel.clipping == UIDrawCall.Clipping.SoftClip)
            {
                GUILayout.BeginHorizontal();
                GUILayout.Space(80f);
                Vector2 soft = EditorGUILayout.Vector2Field("Softness", mPanel.clipSoftness);
                GUILayout.EndHorizontal();

                if (soft.x < 1f)
                {
                    soft.x = 1f;
                }
                if (soft.y < 1f)
                {
                    soft.y = 1f;
                }

                if (mPanel.clipSoftness != soft)
                {
                    NGUIEditorTools.RegisterUndo("Clipping Change", mPanel);
                    mPanel.clipSoftness = soft;
                    EditorUtility.SetDirty(mPanel);
                }
            }
        }

        if (clipping != UIDrawCall.Clipping.None && !NGUIEditorTools.IsUniform(mPanel.transform.lossyScale))
        {
            EditorGUILayout.HelpBox("Clipped panels must have a uniform scale, or clipping won't work properly!", MessageType.Error);

            if (GUILayout.Button("Auto-fix"))
            {
                NGUIEditorTools.FixUniform(mPanel.gameObject);
            }
        }

        if (NGUIEditorTools.DrawHeader("Advanced Options"))
        {
            NGUIEditorTools.BeginContents();

            GUILayout.BeginHorizontal();
            UIPanel.RenderQueue rq = (UIPanel.RenderQueue)EditorGUILayout.EnumPopup("Render Q", mPanel.renderQueue);

            if (mPanel.renderQueue != rq)
            {
                mPanel.renderQueue = rq;
                UIPanel.RebuildAllDrawCalls(true);
                EditorUtility.SetDirty(mPanel);
                if (UIDrawCallViewer.instance != null)
                {
                    UIDrawCallViewer.instance.Repaint();
                }
            }

            if (rq != UIPanel.RenderQueue.Automatic)
            {
                int sq = EditorGUILayout.IntField(mPanel.startingRenderQueue, GUILayout.Width(40f));

                if (mPanel.startingRenderQueue != sq)
                {
                    mPanel.startingRenderQueue = sq;
                    UIPanel.RebuildAllDrawCalls(true);
                    EditorUtility.SetDirty(mPanel);
                    if (UIDrawCallViewer.instance != null)
                    {
                        UIDrawCallViewer.instance.Repaint();
                    }
                }
            }
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            bool norms = EditorGUILayout.Toggle("Normals", mPanel.generateNormals, GUILayout.Width(100f));
            GUILayout.Label("Needed for lit shaders", GUILayout.MinWidth(20f));
            GUILayout.EndHorizontal();

            if (mPanel.generateNormals != norms)
            {
                mPanel.generateNormals = norms;
                UIPanel.RebuildAllDrawCalls(true);
                EditorUtility.SetDirty(mPanel);
            }

            GUILayout.BeginHorizontal();
            bool cull = EditorGUILayout.Toggle("Cull", mPanel.cullWhileDragging, GUILayout.Width(100f));
            GUILayout.Label("Cull widgets while dragging them", GUILayout.MinWidth(20f));
            GUILayout.EndHorizontal();

            if (mPanel.cullWhileDragging != cull)
            {
                mPanel.cullWhileDragging = cull;
                UIPanel.RebuildAllDrawCalls(true);
                EditorUtility.SetDirty(mPanel);
            }

            GUILayout.BeginHorizontal();
            bool alw = EditorGUILayout.Toggle("Visible", mPanel.alwaysOnScreen, GUILayout.Width(100f));
            GUILayout.Label("Check if widgets never go off-screen", GUILayout.MinWidth(20f));
            GUILayout.EndHorizontal();

            if (mPanel.alwaysOnScreen != alw)
            {
                mPanel.alwaysOnScreen = alw;
                UIPanel.RebuildAllDrawCalls(true);
                EditorUtility.SetDirty(mPanel);
            }

            GUILayout.BeginHorizontal();
            bool stat = EditorGUILayout.Toggle("Static", mPanel.widgetsAreStatic, GUILayout.Width(100f));
            GUILayout.Label("Check if widgets won't move", GUILayout.MinWidth(20f));
            GUILayout.EndHorizontal();

            if (mPanel.widgetsAreStatic != stat)
            {
                mPanel.widgetsAreStatic = stat;
                UIPanel.RebuildAllDrawCalls(true);
                EditorUtility.SetDirty(mPanel);
            }

            if (stat)
            {
                EditorGUILayout.HelpBox("Only mark the panel as 'static' if you know FOR CERTAIN that the widgets underneath will not move, rotate, or scale. Doing this improves performance, but moving widgets around will have no effect.", MessageType.Warning);
            }

            GUILayout.BeginHorizontal();
            bool tool = EditorGUILayout.Toggle("Panel Tool", mPanel.showInPanelTool, GUILayout.Width(100f));
            GUILayout.Label("Show in panel tool");
            GUILayout.EndHorizontal();

            if (mPanel.showInPanelTool != tool)
            {
                mPanel.showInPanelTool = !mPanel.showInPanelTool;
                EditorUtility.SetDirty(mPanel);
                EditorWindow.FocusWindowIfItsOpen <UIPanelTool>();
            }
            NGUIEditorTools.EndContents();
        }
        return(true);
    }
Ejemplo n.º 51
0
 public static void ShowWindow()
 {
     EditorWindow.GetWindow(typeof(UIEditorWindow));
 }