示例#1
0
        public static void LoadWindow()
        {
            if (Instance != null)
            {
                Instance.Show();
                Instance.Focus();
                return;
            }

            ClearPrevoiusURL();

            if (!PreferencesItems.IsDockableWindowStyle)
            {
                Instance = GetWindow <APlusWindow>(true, TITLE, true);
                Instance.InitWebView(GUIClip.Unclip(new Rect(0, 0, Instance.position.x, Instance.position.y)));
            }
            else
            {
                Type[] desiredDockNextTo = new Type[] { typeof(SceneView) };
                Instance = EditorWindow.GetWindow <APlusWindow>(TITLE, desiredDockNextTo);
                Instance.SetMinMaxSizes();
                Instance.Show();
            }

            Instance.InDockableWindowStyle = PreferencesItems.IsDockableWindowStyle;
            Instance.Show();
            Instance.Focus();
        }
示例#2
0
        public void Destroy()
        {
            if (webview != null)
            {
                webview.OnDestory();
            }

            Instance = null;
        }
示例#3
0
 private void Rebinding()
 {
     if (Instance == null)
     {
         Instance = this;
         if (AssetNotification.webCommunicationService != null)
         {
             AssetNotification.webCommunicationService.Init(this.webview);
         }
     }
 }
        public void OnEnable()
        {
            // re-binding the webview Instance
            //
            if (Instance == null)
            {
                Instance = this;
                AssetNotification.webCommunicationService.Init(this.webview);
            }

            SetMinMaxSizes();
        }
示例#5
0
        public void InitWebView(Rect webviewRect)
        {
            if (webview == null)
            {
                this.webview           = ScriptableObject.CreateInstance <Webview>();
                this.webview.hideFlags = HideFlags.HideAndDontSave;
            }

            this.webview.InitWebView(Webview.GetView(this), webviewRect, false);
            AssetNotification.webCommunicationService.Init(this.webview);
            docked = GetDocked(this);
            SetMinMaxSizes();
            LoadEditor();
            SetFocus(true);
            Instance = this;
        }
示例#6
0
        public static void FindTerrains()
        {
            if (APlusWindow.Instance == null)
            {
                EditorUtility.DisplayDialog("Error", "Please start Assets Explorer first.", "Ok");
                return;
            }

            var gos = Resources.FindObjectsOfTypeAll <GameObject>().Where(IsTerrainObject).ToArray();

            var ids = new HashSet <string>();

            foreach (var go in gos)
            {
                var terrain = go.GetComponent <Terrain>();

                #pragma warning disable
                var splatPrototypes = terrain.terrainData.splatPrototypes;
                #pragma warning restore

                for (var i = 0; i < splatPrototypes.Length; i++)
                {
                    var tex = splatPrototypes[i].texture;
                    if (tex != null)
                    {
                        var path = AssetDatabase.GetAssetPath(tex);
                        ids.Add(AssetDatabase.AssetPathToGUID(path));
                    }
                }
            }

            if (ids.Count() > 0)
            {
                APlusWindow.LoadWindow();
                AssetNotification.webCommunicationService.SetCurrentURL(string.Format("res/{0}", "textures"), string.Format("Id:{0}", string.Join("|", ids.ToArray())));
            }
            else
            {
                EditorUtility.DisplayDialog("Not Results Found", "No terrain textures in current secne", "Ok");
            }
        }
 private void RefreshCache(string msg, object callback)
 {
     APlusWindow.RefreshCache();
 }
 private void TriggerBuild(string args, object callback)
 {
     APlusWindow.FindUnusedAssets();
 }