Пример #1
0
        public void OnEnable()
        {
            EditorApplication.update += Update;

            //Correct paths if necessary

            var projectPath = Application.dataPath;

            if (projectPath.EndsWith("/Assets"))
            {
                projectPath = projectPath.Remove(projectPath.Length - ("Assets".Length));
            }

            if (!File.Exists(projectPath + EditorAssets + "/Google2uAssets"))
            {
                var foundPath = string.Empty;
                if (Google2uGUIUtil.FindPathContaining("Google2uAssets", ref foundPath))
                {
                    foundPath = foundPath.Replace(projectPath, "");

                    if (foundPath.StartsWith("/"))
                    {
                        foundPath = foundPath.Remove(0, 1);
                    }

                    EditorAssets = foundPath;
                    Debug.Log("Located editor assets folder to '" + EditorAssets + "'");
                }
                else
                {
                    Debug.LogWarning("Could not locate editor assets folder\nGoogle2u");
                    return;
                }
            }

            GUISkin google2USkin;

            if (EditorGUIUtility.isProSkin)
            {
                google2USkin =
                    AssetDatabase.LoadAssetAtPath(EditorAssets + "/DarkSkin/Google2uDark.guiskin", typeof(GUISkin)) as
                    GUISkin;
            }
            else
            {
                google2USkin =
                    AssetDatabase.LoadAssetAtPath(EditorAssets + "/LightSkin/Google2uLight.guiskin", typeof(GUISkin))
                    as GUISkin;
            }


            HelpBoxHeader = google2USkin.FindStyle("HelpHeaderStyle");
            HelpBoxText   = google2USkin.FindStyle("HelpTextStyle");
        }