Exemple #1
0
    //void OnDisable() {
    //	var tilemap = self.GetComponent<Tilemap>();
    //	if( tilemap ) {
    //		tilemap.color = ColorUtils.Alpha( tilemap.color, 1.0f );
    //	}
    //}

    public override void OnInspectorGUI()
    {
        base.OnInspectorGUI();

        var tilemap = self.GetComponent <Tilemap>();

        if (tilemap)
        {
            EditorGUILayout.LabelField("Tilemap", EditorStyles.boldLabel);
            EditorGUI.BeginChangeCheck();
            var a = EditorGUILayout.Slider("Alpha", tilemap.color.a, 0.00f, 1.00f);
            if (EditorGUI.EndChangeCheck())
            {
                tilemap.color = ColorUtils.RGBA(tilemap.color, a);
            }
        }

#if ENABLE_TILEMAP
        var window = EditorWindowUtils.Find(UnityTypes.UnityEditor_Tilemaps_GridPaintPaletteWindow);
        if (window == null)
        {
            return;
        }
        var clipboardView = window.GetProperty <object>("clipboardView");
        var _tileBase     = clipboardView.GetProperty <TileBase>("activeTile");
        if (_tileBase != m_tileBase)
        {
            m_tileBase       = _tileBase;
            m_tileBaseEditor = Editor.CreateEditor(m_tileBase);
        }
        if (m_tileBaseEditor != null)
        {
            ScopeVertical.Begin(EditorStyles.helpBox);
            ScopeHorizontal.Begin();
            EditorGUILayout.LabelField("Active Tile", EditorStyles.boldLabel);
            GUILayout.FlexibleSpace();
            if (GUILayout.Button("Delete"))
            {
                UnityObject.DestroyImmediate(_tileBase, true);
            }
            ScopeHorizontal.End();
            m_tileBaseEditor.OnInspectorGUI();
            ScopeVertical.End();
        }
#endif
    }
        /////////////////////////////////////////
        internal static void ShowWindowButton(Type editorWindowType, string text, Texture2D image)
        {
            if (editorWindowType == null)
            {
                return;
            }
            var _window = EditorWindowUtils.Find(editorWindowType);

            if (_window != null)
            {
                return;
            }

            if (ShowSideButton(text, image))
            {
                var window = EditorWindowUtils.ShowWindow(editorWindowType);
                window.titleContent = new GUIContent(text, window.titleContent.image);
            }
        }
Exemple #3
0
        public bool UIDraw(Rect rect, P.Params currentParams)
        {
            if (!HEditorGUI.IconButton(rect.W(16), EditorIcon.settings))
            {
                return(false);
            }

            if (PB.i.enableOldStyleProjectSettings)
            {
                Selection.activeObject = AssetDatabase.LoadAssetAtPath <UnityObject>(AssetDatabase.GUIDToAssetPath("00000000000000004000000000000000"));
                EditorWindowUtils.Find(UnityTypes.UnityEditor_InspectorWindow)?.Focus();
            }
            else
            {
                //UnityEditorMenu.Edit_Project_Settings();
                UnityEditorSettingsWindow.Show(SettingsScope.Project, "Project/Player");
            }

            return(false);
        }
        /////////////////////////////////////////
        static void OnSelectionChanged()
        {
#if ENABLE_TILEMAP
            s_tileOn = false;
#endif
            if (!E.i.tools)
            {
                return;
            }


            if (Selection.activeGameObject == null)
            {
                return;
            }
#if ENABLE_TILEMAP
            if (Selection.activeGameObject.GetComponent <Tilemap>())
            {
                s_tileOn = true;
            }
            if (Selection.activeGameObject.GetComponent <Grid>())
            {
                s_tileOn = true;
            }
            if (Selection.activeGameObject.GetComponent <TilemapPallet>())
            {
                var comp   = Selection.activeGameObject.GetComponent <TilemapPallet>();
                var window = EditorWindowUtils.Find(UnityTypes.UnityEditor_Tilemaps_GridPaintPaletteWindow);

                var t     = UnityTypes.UnityEditor_Tilemaps_GridPalettes;
                var aa    = t.GetProperty <List <GameObject> >("palettes");
                var index = aa.FindIndex(x => x.name == comp.palletSettings.name);
                if (0 <= index)
                {
                    window.MethodInvoke("SelectPalette", new object[] { index, comp.gameObject });
                }
            }
#endif
        }
Exemple #5
0
        void OnEnable()
        {
            singleton.asmdefGraphWindow = this;
            m_disableShadeMode          = true;
            SetTitle("Asmdef Graph", EditorIcon.icons_processed_unityengine_ui_graphicraycaster_icon_asset);

            // view�̍쐬
            graphView = new AsmdefGraphView()
            {
                style = { flexGrow = 1 }
            };
            //graphView.transform
            rootVisualElement.Add(graphView);

            if (EditorWindowUtils.Find(typeof(CsFilesWindow)) == null)
            {
                GetWindow <CsFilesWindow>();
            }
            if (EditorWindowUtils.Find(typeof(AsmdefFilesWindow)) == null)
            {
                GetWindow <AsmdefFilesWindow>();
            }
        }