Example #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="instanceId"></param>
        /// <param name="scriptPath"></param>
        /// <param name="resourceFile"></param>
        public override void Action(int instanceId, string scriptPath, string resourceFile)
        {
            Object obj = SharpFactory.createScriptFromTemplate(scriptPath, resourceFile);

            EditorIcons.injectIcon(obj, scriptIcon);
            ProjectWindowUtil.ShowCreatedAsset(obj);
        }
Example #2
0
    public override bool Initialize()
    {
        #region Levels list
        // List<TreeFolder> levelFolders = null;
        // FileList fileList;
        // TreeViewState levelTreeViewState = new TreeViewState();
        // List<LevelItem> levelItems = WorldLoader.getAllLevelFileInfo();
        // fileList = new FileList (levelItem, levelItems, levelFolders, levelTreeViewState);
        // fileList.onSelectedItemChanged += x => {
        //     // if (x.Count == 1 && x[0] != levelItem)
        //     //     SelectLevel (x[0], true);
        // };


        splitterH = new GUIHelper.LayoutSplitter(OrientationLine.Horizontal, OrientationLine.Vertical, new float[2] {
            200, 300
        });
        splitterH.drawCursor = x => GUI.Box(x, "", Styles.separator);
        #endregion

        #region Icons
        slotIcon = EditorIcons.GetIcon("SlotIcon");
        #endregion
        return(true);
    }
    public static void ShowWindow()
    {
        EditorIcons window = (EditorIcons)GetWindow(typeof(EditorIcons));

        window.Show();
        window.minSize = new Vector2(300, 300);
        Init();
    }
    public override bool Initialize()
    {
        #region Levels list

//        splitterH = new GUIHelper.LayoutSplitter (OrientationLine.Horizontal, OrientationLine.Vertical, new float[2] { 200, 300 });
//        splitterH.drawCursor = x => GUI.Box (x, "", Styles.separator);
        #endregion

        #region Icons
        slotIcon = EditorIcons.GetIcon("SlotIcon");
        #endregion
        return(true);
    }
    void Init()
    {
        instance = this;

        // Styles.Initialize();

        titleContent.text = "OhMyFramework Panel";
        BPLogo            = EditorIcons.GetIcon("BPLogo");

        LoadEditors();

        ShowFirstEditor();

        selectionColor = Color.Lerp(Color.red, Color.white, 0.7f);
        bgColor        = Color.Lerp(GUI.backgroundColor, Color.black, 0.3f);
        //EditorCoroutine.start(DownloadHelpLibraryRoutine());
    }
        private void OnGUI()
        {
            m_ScrollPosition = EditorGUILayout.BeginScrollView(m_ScrollPosition);
            {
                using (new EditorGUILayout.HorizontalScope())
                {
                    foreach (KeyValuePair <string, EEditorIcon[]> icons in m_CategorizedIcons)
                    {
                        using (new EditorGUILayout.VerticalScope())
                        {
                            EditorGUILayout.LabelField(icons.Key, EditorStyles.boldLabel, GUILayout.Width(HEADER_WIDTH));
                            EditorGUILayout.Space();

                            foreach (EEditorIcon icon in icons.Value)
                            {
                                using (new EditorGUILayout.HorizontalScope())
                                {
                                    Rect    rect        = EditorGUILayout.GetControlRect(false, ICON_SIZE, GUILayout.Width(ICON_SIZE));
                                    Texture iconTexture = EditorIcons.FindIcon(icon);
                                    if (iconTexture != null)
                                    {
                                        EditorGUI.DrawTextureTransparent(rect, iconTexture, ScaleMode.ScaleToFit);
                                        GUILayout.Label(icon.ToString(), GUILayout.Height(ICON_SIZE));
                                    }
                                    else
                                    {
                                        GUILayout.Label(icon.ToString(), EditorStyles.label.FontColor(Color.red), GUILayout.Height(ICON_SIZE));
                                    }
                                }
                            }
                        }
                    }
                }
            }
            EditorGUILayout.EndScrollView();
        }
    void OnGUI()
    {
        Styles.Update();

        if (!style_IsInitialized)
        {
            InitializeStyles();
        }

        if (BPLogo == null)
        {
            BPLogo = EditorIcons.GetIcon("BPLogo");
        }
//        GUI.DrawTexture(EditorGUILayout.GetControlRect(GUILayout.Width(BPLogo.width), GUILayout.Height(BPLogo.height)), BPLogo);
        EditorGUILayout.Space();

        if (editorRender == null || current_editor == null)
        {
            editorRender   = null;
            current_editor = null;
        }

        defalutColor = GUI.backgroundColor;
        using (new GUIHelper.Horizontal(GUILayout.ExpandWidth(true), GUILayout.ExpandHeight(true)))
        {
            using (new GUIHelper.Vertical(Styles.berryArea, GUILayout.Width(256), GUILayout.ExpandHeight(true)))
            {
                tabsScroll = EditorGUILayout.BeginScrollView(tabsScroll);
                DrawTabs();
                EditorGUILayout.EndScrollView();
                EditorGUILayout.EndVertical();

                Rect editorRect = EditorGUILayout.BeginVertical(Styles.berryArea, GUILayout.ExpandWidth(true), GUILayout.ExpandHeight(true));
                editorScroll = EditorGUILayout.BeginScrollView(editorScroll);
                if (current_editor != null && editorRender != null)
                {
                    if (editorAttribute != null)
                    {
                        DrawTitle(editorAttribute.Title);
                    }
                    if (EditorApplication.isCompiling)
                    {
                        GUILayout.Label("Compiling...", Styles.centeredMiniLabel, GUILayout.ExpandHeight(true), GUILayout.ExpandWidth(true));
                    }
                    else
                    {
                        if (Event.current.type == EventType.Repaint)
                        {
                            currectEditorRect = editorRect;
                        }
                        editorRender.Invoke();
                    }
                }
                else
                {
                    GUILayout.Label("Nothing selected", Styles.centeredMiniLabel, GUILayout.ExpandHeight(true), GUILayout.ExpandWidth(true));
                }

                EditorGUILayout.EndScrollView();
            }
        }

        GUILayout.Label(string.Format("Simple Rules Tools Panel\n@Copyright 2015 - {0} by Droidman",
                                      DateTime.Now.Year), Styles.centeredMiniLabel, GUILayout.ExpandWidth(true));
    }
        internal static void Initialize()
        {
            try
            {
                richLabel          = new GUIStyle(EditorStyles.label);
                richLabel.richText = true;


                whiteLabel = new GUIStyle(EditorStyles.whiteLabel);
                whiteLabel.normal.textColor = Color.white;

                whiteBoldLabel = new GUIStyle(EditorStyles.whiteBoldLabel);
                whiteBoldLabel.normal.textColor = Color.white;

                multilineLabel          = new GUIStyle(EditorStyles.label);
                multilineLabel.clipping = TextClipping.Clip;

                centeredLabel           = new GUIStyle(EditorStyles.label);
                centeredLabel.alignment = TextAnchor.MiddleCenter;

                centeredMiniLabel = new GUIStyle(EditorStyles.centeredGreyMiniLabel);
                centeredMiniLabel.normal.textColor = EditorStyles.label.normal.textColor;

                miniLabel           = new GUIStyle(centeredMiniLabel);
                miniLabel.alignment = richLabel.alignment;

                centeredMiniLabelWhite = new GUIStyle(centeredMiniLabel);
                centeredMiniLabelWhite.normal.textColor = Color.white;

                centeredMiniLabelBlack = new GUIStyle(centeredMiniLabel);
                centeredMiniLabelBlack.normal.textColor = Color.black;

                textAreaLineBreaked          = new GUIStyle(EditorStyles.textArea);
                textAreaLineBreaked.clipping = TextClipping.Clip;

                monospaceLabel      = new GUIStyle(textAreaLineBreaked);
                monospaceLabel.font = Resources.Load <Font>("Fonts/CourierNew");
                //monospaceLabel.wordWrap = true;
                monospaceLabel.fontSize = 11;

                largeTitle = new GUIStyle(EditorStyles.label);
                largeTitle.normal.textColor = EditorStyles.label.normal.textColor;
                largeTitle.fontStyle        = FontStyle.Bold;
                largeTitle.fontSize         = 21;

                title = new GUIStyle(EditorStyles.label);
                title.normal.textColor = EditorStyles.label.normal.textColor;
                title.fontStyle        = FontStyle.Bold;
                title.fontSize         = 18;

                berryArea = new GUIStyle(EditorStyles.textArea);
                berryArea.normal.background = EditorIcons.GetIcon("BerryArea");
                berryArea.border            = new RectOffset(4, 4, 5, 3);
                berryArea.margin            = new RectOffset(2, 2, 2, 2);
                berryArea.padding           = new RectOffset(2, 2, 2, 2);

                area = new GUIStyle(EditorStyles.textArea);
                area.normal.background = EditorIcons.GetIcon("Area");
                area.border            = new RectOffset(4, 4, 5, 3);
                area.margin            = new RectOffset(2, 2, 2, 2);
                area.padding           = new RectOffset(4, 4, 4, 4);

                levelArea = new GUIStyle(area);
                levelArea.normal.background = EditorIcons.GetIcon("LevelArea");
                levelArea.border            = new RectOffset(4, 4, 5, 3);
                levelArea.margin            = new RectOffset(2, 2, 2, 2);
                levelArea.padding           = new RectOffset(4, 4, 4, 4);

                separator = new GUIStyle(area);
                separator.normal.background = EditorIcons.GetIcon("Separator");
                separator.border            = new RectOffset(1, 1, 1, 1);
                separator.margin            = new RectOffset(0, 0, 0, 0);
                separator.padding           = new RectOffset(0, 0, 0, 0);

                highlightStrongBlue = "<color=#" + (EditorGUIUtility.isProSkin ? "8888ff" : "4444ff") + "ff>{0}</color>";
                highlightBlue       = "<color=#" + (EditorGUIUtility.isProSkin ? "5555bb" : "222266") + "ff>{0}</color>";

                highlightStrongRed = "<color=#" + (EditorGUIUtility.isProSkin ? "ff8888" : "ff4444") + "ff>{0}</color>";
                highlightRed       = "<color=#" + (EditorGUIUtility.isProSkin ? "bb5555" : "662222") + "ff>{0}</color>";

                highlightStrongGreen = "<color=#" + (EditorGUIUtility.isProSkin ? "88ff88" : "44ff44") + "ff>{0}</color>";
                highlightGreen       = "<color=#" + (EditorGUIUtility.isProSkin ? "55bb55" : "226622") + "ff>{0}</color>";
            }
            catch (Exception)
            {
                return;
            }

            initialized = true;
        }