Esempio n. 1
0
        public static void      Last(string assetName)
        {
            if (NGLicensesManager.IsPro(assetName) == true)
            {
                return;
            }

            if (FreeLicenseOverlay.lastWindow == null || FreeLicenseOverlay.closedWindows.IndexOf(FreeLicenseOverlay.lastWindow.GetType().Name) != -1)
            {
                return;
            }

            if (Event.current.type == EventType.Repaint)
            {
                Utility.DropZone(FreeLicenseOverlay.r, FreeLicenseOverlay.ads);

                if (r.height > 100F)
                {
                    Rect r2 = FreeLicenseOverlay.r;

                    r2.yMin   = r2.yMax - 35F;
                    r2.height = 30F;
                    r2.xMin   = r2.xMax - 120F;
                    r2.x     -= 5F;
                    GUI.Button(r2, "Buy NG Tools Pro");
                    r2.x -= r2.width;
                    GUI.Button(r2, "Activate Invoice");
                }
            }
        }
Esempio n. 2
0
        protected virtual void  OnGUI()
        {
            if (this.once == false)
            {
                this.once = true;
                float maxHeight = Mathf.Min(40F + 20F + this.seats.Length * (35F + 10F), 150F);
                this.minSize = new Vector2(this.minSize.x, maxHeight);
            }

            EditorGUILayout.BeginHorizontal();
            {
                GUILayout.Label("Invoice: ", GeneralStyles.VerticalCenterLabel, GUILayoutOptionPool.ExpandWidthFalse, GUILayoutOptionPool.Height(40F));
                GUILayout.Label(invoice, GeneralStyles.MainTitle);
            }
            EditorGUILayout.EndHorizontal();

            EditorGUILayout.BeginHorizontal(GeneralStyles.Toolbar);
            {
                GUILayout.Label("Active Seat", GeneralStyles.AllCenterTitle);
            }
            EditorGUILayout.EndHorizontal();

            this.scrollPosition = EditorGUILayout.BeginScrollView(this.scrollPosition);
            {
                if (this.seats.Length == 0)
                {
                    GUILayout.Label("No active seat.", GeneralStyles.InnerBoxText);
                }
                else
                {
                    for (int i = 0; i < this.seats.Length; i += 2)
                    {
                        bool isRevoked = this.seatsRevoked.Contains(this.seats[i]);

                        EditorGUI.BeginDisabledGroup(isRevoked);
                        EditorGUILayout.BeginHorizontal();
                        {
                            GUILayout.Label(this.seats[i], GeneralStyles.AllCenterTitle, GUILayoutOptionPool.Width(160F), GUILayoutOptionPool.Height(35F));
                            GUILayout.Label(this.seats[i + 1], GeneralStyles.AllCenterTitle, GUILayoutOptionPool.Width(140F), GUILayoutOptionPool.Height(35F));

                            GUILayout.FlexibleSpace();

                            if (isRevoked == true)
                            {
                                GUILayout.Label("[Revoked]", GeneralStyles.AllCenterTitle, GUILayoutOptionPool.ExpandWidthFalse, GUILayoutOptionPool.Height(35F), GUILayoutOptionPool.Width(85F));
                            }
                            else if (this.seats[i] != "PUBLIC" && this.seats[i + 1] != "LICENSE" && GUILayout.Button("Revoke", GUILayoutOptionPool.ExpandWidthFalse, GUILayoutOptionPool.Height(35F), GUILayoutOptionPool.Width(60F)) == true && ((Event.current.modifiers & Constants.ByPassPromptModifier) != 0 || EditorUtility.DisplayDialog(Constants.PackageTitle, "Confirm revoking \"" + this.seats[i] + " " + this.seats[i + 1] + "\"?", "Yes", "No") == true))
                            {
                                NGLicensesManager.RevokeSeat(this.invoice, this.seats[i], this.seats[i + 1], this.OnRemoveSeat);
                            }
                        }
                        EditorGUILayout.EndHorizontal();
                        EditorGUI.EndDisabledGroup();

                        GUILayout.Space(10F);
                    }
                }
            }
            EditorGUILayout.EndScrollView();
        }
Esempio n. 3
0
        public static void      First(EditorWindow window, string assetName, string ads)
        {
            if (NGLicensesManager.IsPro(assetName) == true)
            {
                return;
            }

            FreeLicenseOverlay.lastWindow = window;

            if (FreeLicenseOverlay.ClosedWindows.IndexOf(window.GetType().Name) != -1)
            {
                return;
            }

            string extra;

            if (FreeLicenseOverlay.extraAds.TryGetValue(window.GetType(), out extra) == true)
            {
                ads += extra;
            }

            FreeLicenseOverlay.ads = ads;

            FreeLicenseOverlay.r   = window.position;
            FreeLicenseOverlay.r.x = 0F;
            FreeLicenseOverlay.r.y = 0F;

            if (FreeLicenseOverlay.r.height > 100F)
            {
                Rect r2 = FreeLicenseOverlay.r;

                r2.yMin   = r2.yMax - 35F;
                r2.height = 30F;
                r2.xMin   = r2.xMax - 120F;
                r2.x     -= 5F;

                if (GUI.Button(r2, "Buy NG Tools Pro") == true)
                {
                    Help.BrowseURL("https://www.assetstore.unity3d.com/en/#!/content/34109");
                }

                r2.x -= r2.width;

                if (GUI.Button(r2, "Activate Invoice") == true)
                {
                    Utility.ShowPreferencesWindowAt(Constants.PackageTitle);
                    Preferences.tab = Preferences.Tab.Licenses;
                }
            }

            if (Event.current.type == EventType.MouseDown)
            {
                FreeLicenseOverlay.closedWindows += window.GetType().Name;
                EditorPrefs.SetString(FreeLicenseOverlay.KeyPrefs, FreeLicenseOverlay.closedWindows);
                Event.current.Use();
            }
        }
Esempio n. 4
0
 private bool    CheckMaxSyncFoldersSlaves(int count)
 {
     return(NGLicensesManager.Check(count < NGSyncFoldersWindow.MaxSyncFoldersSlaves, NGAssemblyInfo.Name + " Pro", "Free version does not allow more than " + NGSyncFoldersWindow.MaxSyncFoldersSlaves + " slaves.\n\n"));
 }
Esempio n. 5
0
 private bool    CheckMaxStreams(int count)
 {
     return(NGLicensesManager.Check(count < MainModule.MaxStreams, NGTools.NGConsole.NGAssemblyInfo.Name + " Pro", "Free version does not allow more than " + MainModule.MaxStreams + " streams.\n\nI'm sorry if you feel this feature is a gift from above, but consider above to be selfish sometimes. :p"));
 }
Esempio n. 6
0
 internal bool   CheckMaxHubComponents(int count)
 {
     return(NGLicensesManager.Check(count < NGHubWindow.MaxHubComponents, NGAssemblyInfo.Name + " Pro", "Free version does not allow more than " + NGHubWindow.MaxHubComponents + " components.\n\nToo bad dude... But if you like this feature, you know what to do. ;}\n\nNote that if you have too many components, NG Hub will extend to the other side."));
 }
Esempio n. 7
0
 private static bool     CheckLowestRowGoToLineAllowed(int count)
 {
     return(NGLicensesManager.Check(count < RowUtility.LowestRowGoToLineAllowed, NGTools.NGConsole.NGAssemblyInfo.Name + " Pro", "Free version does not allow to go to line on frame lower than " + RowUtility.LowestRowGoToLineAllowed + ".\n\nYou just asked for a kill feature... No? You disagree? I am truly sorry, but this is madness! XD"));
 }
Esempio n. 8
0
        protected virtual void  OnGUI()
        {
            FreeLicenseOverlay.First(this, NGAssemblyInfo.Name + " Pro", NGRenamerWindow.FreeAdContent);

            float halfWidth = this.position.width * .5F - 25F;

            this.errorPopup.OnGUILayout();

            for (int i = 0; i < this.filters.Count; i++)
            {
                EditorGUI.BeginDisabledGroup(NGLicensesManager.Check(i < NGRenamerWindow.MaxRenamerFilters, NGAssemblyInfo.Name + " Pro") == false);
                this.filters[i].OnHeaderGUI();
                if (this.filters[i].open == true)
                {
                    try
                    {
                        this.filters[i].OnGUI();
                    }
                    catch (Exception ex)
                    {
                        this.errorPopup.exception = ex;
                    }
                }
                EditorGUI.EndDisabledGroup();
            }

            if (this.objects.Count > 0 || this.paths.Count > 0 || Selection.activeObject != null)
            {
                using (BgColorContentRestorer.Get(GeneralStyles.HighlightActionButton))
                {
                    if (GUILayout.Button("Replace All") == true)
                    {
                        this.ReplaceAll();
                    }
                }

                if (this.objects.Count > 0)
                {
                    EditorGUILayout.BeginHorizontal(GeneralStyles.Toolbar);
                    {
                        GUILayout.Label("Assets (" + this.objects.Count + ")", GeneralStyles.Title1);
                    }
                    EditorGUILayout.EndHorizontal();

                    this.assetsScrollPosition = EditorGUILayout.BeginScrollView(this.assetsScrollPosition, GUILayoutOptionPool.ExpandHeightTrue);
                    {
                        for (int i = 0; i < this.objects.Count; i++)
                        {
                            NGRenamerWindow.drawingIndex = i;

                            EditorGUILayout.BeginHorizontal();
                            {
                                Texture2D icon = Utility.GetIcon(this.objects[i].GetInstanceID());

                                Rect r = GUILayoutUtility.GetRect(16F, 16F);
                                GUI.DrawTexture(r, icon);
                                r.width += halfWidth - 32F;
                                if (GUI.Button(r, "", GUI.skin.label) == true)
                                {
                                    NGEditorGUILayout.PingObject(this.objects[i]);
                                    return;
                                }

                                this.DrawElement(Path.GetFileName(this.objects[i].name), halfWidth - 32F, (s) => this.RenameAsset(this.objects[i], s));

                                if (GUILayout.Button("X", GeneralStyles.ToolbarCloseButton) == true)
                                {
                                    this.objects.RemoveAt(i);
                                    return;
                                }
                            }
                            EditorGUILayout.EndHorizontal();
                        }
                    }
                    EditorGUILayout.EndScrollView();

                    GUILayout.Space(5F);
                }

                for (int i = 0; i < this.paths.Count; i++)
                {
                    EditorGUILayout.BeginHorizontal(GeneralStyles.Toolbar);
                    {
                        Rect r = GUILayoutUtility.GetRect(0F, 24F, GUILayoutOptionPool.ExpandWidthTrue);
                        GUI.Label(r, "Path " + this.paths[i].path + " (" + (this.paths[i].directories.Length + this.paths[i].files.Length) + ")", GeneralStyles.Title1);

                        Utility.content.text    = "↻";
                        Utility.content.tooltip = "Refresh folder's content";
                        if (GUILayout.Button(Utility.content, GeneralStyles.ToolbarAltButton, GUILayoutOptionPool.Width(20F)) == true)
                        {
                            try
                            {
                                this.paths[i].Update();
                            }
                            catch (Exception ex)
                            {
                                this.errorPopup.exception = ex;
                            }
                            return;
                        }
                        Utility.content.tooltip = string.Empty;

                        if (GUILayout.Button("X", GeneralStyles.ToolbarCloseButton, GUILayoutOptionPool.Width(20F)) == true)
                        {
                            this.paths.RemoveAt(i);
                            return;
                        }
                    }
                    EditorGUILayout.EndHorizontal();

                    try
                    {
                        this.paths[i].scrollPosition = EditorGUILayout.BeginScrollView(this.paths[i].scrollPosition, GUILayoutOptionPool.ExpandHeightTrue);
                        {
                            for (int j = 0; j < this.paths[i].directories.Length; j++)
                            {
                                NGRenamerWindow.drawingIndex = j;

                                this.DrawElement(Path.GetFileName(this.paths[i].directories[j]), halfWidth, (s) => {
                                    try
                                    {
                                        // To ensure different letter case will work.
                                        string tmp = Path.Combine(this.paths[i].path, Path.GetRandomFileName());
                                        Directory.Move(this.paths[i].absolutePathDirectories[j], tmp);
                                        Directory.Move(tmp, Path.Combine(this.paths[i].path, s));
                                        this.paths[i].directories[j] = s;
                                    }
                                    catch (Exception ex)
                                    {
                                        Debug.LogException(ex);
                                    }
                                });
                            }

                            for (int j = 0; j < this.paths[i].files.Length; j++)
                            {
                                NGRenamerWindow.drawingIndex = j;

                                this.DrawElement(Path.GetFileName(this.paths[i].files[j]), halfWidth, (s) => {
                                    try
                                    {
                                        File.Move(this.paths[i].absolutePathFiles[j], Path.Combine(this.paths[i].path, s));
                                        this.paths[i].files[j] = s;
                                    }
                                    catch (Exception ex)
                                    {
                                        Debug.LogException(ex);
                                    }
                                });
                            }
                        }
                        EditorGUILayout.EndScrollView();
                    }
                    catch (Exception ex)
                    {
                        this.paths.RemoveAt(i);
                        Debug.LogException(ex);
                    }

                    GUILayout.Space(5F);
                }

                if (Selection.objects.Length > 0)
                {
                    EditorGUILayout.BeginHorizontal(GeneralStyles.Toolbar);
                    {
                        GUILayout.Label("Selection", GeneralStyles.Title1);
                    }
                    EditorGUILayout.EndHorizontal();

                    this.selectionScrollPosition = EditorGUILayout.BeginScrollView(this.selectionScrollPosition, GUILayoutOptionPool.ExpandHeightTrue);
                    {
                        for (int i = 0; i < Selection.objects.Length; i++)
                        {
                            NGRenamerWindow.drawingIndex = i;

                            this.DrawElement(Selection.objects[i].name, halfWidth, (s) => this.RenameAsset(Selection.objects[i], s));
                        }
                    }
                    EditorGUILayout.EndScrollView();
                }

                using (BgColorContentRestorer.Get(GeneralStyles.HighlightActionButton))
                {
                    if (GUILayout.Button("Replace All") == true)
                    {
                        this.ReplaceAll();
                    }
                }

                GUILayout.FlexibleSpace();
            }
            else
            {
                Rect r = GUILayoutUtility.GetRect(this.position.width, 16F, GUILayoutOptionPool.ExpandHeightTrue);

                r.x      += 2F;
                r.y      += 2F;
                r.width  -= 4F;
                r.height -= 4F;

                if (Event.current.type == EventType.Repaint)
                {
                    Utility.DrawUnfillRect(r, Color.grey);
                }

                GUI.Label(r, "Select assets from Hierarchy or Project\n\nDrop any files or folders from\n" + (Application.platform == RuntimePlatform.WindowsEditor ? "Explorer, " : (Application.platform == RuntimePlatform.OSXEditor ? "Finder, " : "")) + "Hierarchy or Project", GeneralStyles.CenterText);
            }

            if (Event.current.type == EventType.DragUpdated)
            {
                if (DragAndDrop.objectReferences.Length > 0 || DragAndDrop.paths.Length > 0)
                {
                    DragAndDrop.visualMode = DragAndDropVisualMode.Move;
                }
                else
                {
                    DragAndDrop.visualMode = DragAndDropVisualMode.Rejected;
                }
            }
            else if (Event.current.type == EventType.DragPerform)
            {
                DragAndDrop.AcceptDrag();

                try
                {
                    if (DragAndDrop.objectReferences.Length > 0)
                    {
                        for (int i = 0; i < DragAndDrop.objectReferences.Length; i++)
                        {
                            Object obj = DragAndDrop.objectReferences[i];

                            if (typeof(Behaviour).IsAssignableFrom(obj.GetType()) == true)
                            {
                                obj = (obj as Behaviour).gameObject;
                            }

                            if (this.objects.Contains(obj) == false)
                            {
                                this.objects.Add(obj);
                            }
                        }
                    }
                    else if (DragAndDrop.paths.Length > 0)
                    {
                        for (int i = 0; i < DragAndDrop.paths.Length; i++)
                        {
                            string path = DragAndDrop.paths[i];
                            if (Directory.Exists(path) == false)
                            {
                                path = new DirectoryInfo(path).Parent.FullName;
                            }

                            if (string.IsNullOrEmpty(path) == false && this.paths.Exists((p) => p.path == path) == false)
                            {
                                this.paths.Add(new PathFiles(path));
                            }
                        }
                    }
                }
                catch (Exception ex)
                {
                    this.errorPopup.exception = ex;
                }

                Event.current.Use();
            }
            else if (Event.current.type == EventType.Repaint && DragAndDrop.visualMode == DragAndDropVisualMode.Move)
            {
                Utility.DropZone(new Rect(0F, 0F, this.position.width, this.position.height), "Drop folder or asset to rename");
            }

            FreeLicenseOverlay.Last(NGAssemblyInfo.Name + " Pro");
        }
Esempio n. 9
0
        protected virtual void  OnGUI()
        {
            GUILayout.Label(Constants.PackageTitle, GeneralStyles.MainTitle);

            GUILayout.Label("Version " + Constants.Version);

            GUILayout.FlexibleSpace();

            Rect r = GUILayoutUtility.GetRect(this.position.width, 150F);

            r.width  = r.width * .5F - 5F;
            r.height = r.height * .33F - 5F;
            r.x     += 3.33F;
            r.y     += 5F;

            if (GUI.Button(r, Preferences.DiscordContent, GeneralStyles.BigButton) == true)
            {
                Application.OpenURL(Constants.DiscordURL);
            }

            r.y += r.height + 5F;

            if (GUI.Button(r, Preferences.TwitterContent, GeneralStyles.BigButton) == true)
            {
                Application.OpenURL(Constants.TwitterURL);
            }

            r.y += r.height + 5F;

            if (GUI.Button(r, Preferences.UnityForumContent, GeneralStyles.BigButton) == true)
            {
                Application.OpenURL(Constants.SupportForumUnityThread);
            }

            r.x += r.width + 3.33F;

            if (GUI.Button(r, LC.G("Preferences_Contact"), GeneralStyles.BigButton) == true)
            {
                ContactFormWizard.Open(ContactFormWizard.Subject.Contact);
            }

            r.y -= r.height + 5F;

            if (GUI.Button(r, "Bit Bucket", GeneralStyles.BigButton) == true)
            {
                Application.OpenURL(Constants.TicketURL);
            }

            r.y -= r.height + 5F;

            if (GUI.Button(r, "Documentation", GeneralStyles.BigButton) == true)
            {
                Application.OpenURL(Constants.WikiBaseURL);
            }

            r.height = 20F;
            r.y     -= r.height + 5F;

            r.xMin -= 50F;
            if (GUI.Button(r, "Help with a review!") == true)
            {
                List <HQ.ToolAssemblyInfo> licensedTools = new List <HQ.ToolAssemblyInfo>();

                foreach (HQ.ToolAssemblyInfo tool in HQ.EachTool)
                {
                    if (NGLicensesManager.IsLicenseValid(tool.name) == true)
                    {
                        licensedTools.Add(tool);
                    }
                }

                if (licensedTools.Count == 0)
                {
                    if (NGLicensesManager.IsPro() == true)
                    {
                        Application.OpenURL(Constants.AssetStoreNGToolsProURL);
                    }
                    else
                    {
                        Application.OpenURL(Constants.AssetStoreNGToolsFreeURL);
                    }
                }
                else
                {
                    licensedTools.Insert(0, new HQ.ToolAssemblyInfo()
                    {
                        name = "NG Tools Free", assetStoreBuyLink = Constants.AssetStoreNGToolsFreeURL
                    });
                    PopupWindow.Show(r, new PreviewVersionsBackupPopup(licensedTools));
                }
            }

            r.y -= r.height + 5F;

            r.xMin = 220F;
            if (GUI.Button(r, "Change Log") == true)
            {
                Application.OpenURL(Constants.ChangeLogURL);
            }
        }
Esempio n. 10
0
        private string  PrepareTheEmail()
        {
            StringBuilder body = Utility.GetBuffer();

            body.AppendLine("Name: " + this.contactName);
            body.AppendLine("E-mail: " + this.contactEMail);
            body.AppendLine("Subject: " + Utility.NicifyVariableName(Enum.GetName(typeof(Subject), this.subject)));
            body.AppendLine("Specific tools: " + this.specificTools);
            body.AppendLine("Package: " + Constants.PackageTitle);
            body.AppendLine("NG Tools Version: " + Constants.Version);
            body.AppendLine("Unity Version: " + Utility.UnityVersion);

            if (string.IsNullOrEmpty(this.complementaryInformation) == false)
            {
                body.AppendLine();
                body.AppendLine(this.complementaryInformation);
            }

            if (this.packageInformation == true)
            {
                body.AppendLine();
                body.AppendLine("Packages:");

                foreach (HQ.ToolAssemblyInfo tool in HQ.EachTool)
                {
                    body.AppendLine("[" + tool.version + "] " + (NGLicensesManager.IsPro(tool.name + " Pro") == true ? "[PRO] " : string.Empty) + tool.name);
                }

                body.AppendLine();
                body.AppendLine("Invoices:");
                foreach (License l in NGLicensesManager.EachInvoices())
                {
                    if (l.active == true)
                    {
                        body.AppendLine(l.assetName + " (" + l.invoice + ")");
                    }
                }
            }

            if (this.unityInformation == true)
            {
                body.AppendLine();
                body.AppendLine("Active Build Target: " + EditorUserBuildSettings.activeBuildTarget);
                body.AppendLine("Platform: " + Application.platform);
                body.AppendLine("Run In Background: " + Application.runInBackground);
                body.AppendLine("System Language: " + Application.systemLanguage);
                body.AppendLine("Application Version: " + Application.version);
            }

            if (this.osInformation == true)
            {
                body.AppendLine();
                body.AppendLine("Operating System: " + SystemInfo.operatingSystem);
            }

            if (this.hardwareInformation == true)
            {
                body.AppendLine();
                body.AppendLine("Processor Count: " + SystemInfo.processorCount);
                body.AppendLine("Processor Type: " + SystemInfo.processorType);
                body.AppendLine("Device Model: " + SystemInfo.deviceModel);
                body.AppendLine("Device Name: " + SystemInfo.deviceName);
                body.AppendLine("Device Type: " + SystemInfo.deviceType);
                body.AppendLine("Graphics Device Name: " + SystemInfo.graphicsDeviceName);
                body.AppendLine("Graphics Device Vendor: " + SystemInfo.graphicsDeviceVendor);
                body.AppendLine("Graphics Device VendorID: " + SystemInfo.graphicsDeviceVendorID);
                body.AppendLine("Graphics Device Version: " + SystemInfo.graphicsDeviceVersion);
                body.AppendLine("Graphics Memory Size: " + SystemInfo.graphicsMemorySize);
                body.AppendLine("Graphics Multi Threaded: " + SystemInfo.graphicsMultiThreaded);
                body.AppendLine("Graphics Shader Level: " + SystemInfo.graphicsShaderLevel);
                body.AppendLine("System Memory Size: " + SystemInfo.systemMemorySize);
            }

            body.Length -= Environment.NewLine.Length;

            return(Utility.ReturnBuffer(body));
            //Application.OpenURL("mailto:" + Constants.SupportEmail + "?subject=[" + Constants.PackageTitle + "]%20" + Utility.NicifyVariableName(Enum.GetName(typeof(Subject), this.subject)) + "%20from%20" + this.contactName + "&body=" + Uri.EscapeUriString(Utility.ReturnBuffer(body)));
        }
Esempio n. 11
0
 private bool    CheckMaxAssetsPerSelection(int count)
 {
     return(NGLicensesManager.Check(count <= NGFavWindow.MaxAssetPerSelection, NGAssemblyInfo.Name + " Pro", "Free version does not allow more than " + NGFavWindow.MaxAssetPerSelection + " assets per selection.\n\nHey, don't abuse of this! X)"));
 }
Esempio n. 12
0
 private bool    CheckMaxSelections(int count)
 {
     return(NGLicensesManager.Check(count < NGFavWindow.MaxSelectionPerFavorite, NGAssemblyInfo.Name + " Pro", "Free version does not allow more than " + NGFavWindow.MaxSelectionPerFavorite + " slots.\n\nMaybe you should buy it, might be useful one day. :)"));
 }
Esempio n. 13
0
 private bool    CheckMaxFavorites(int count)
 {
     return(NGLicensesManager.Check(count < NGFavWindow.MaxFavorites, NGAssemblyInfo.Name + " Pro", "Free version does not allow more than " + NGFavWindow.MaxFavorites + " favorites.\n\nI have to be honest, it is sufficient for me. ;)"));
 }
Esempio n. 14
0
        protected override void OnGUIConnected()
        {
            if (this.Hierarchy.Client.batchMode == Client.BatchMode.On &&
                this.selectedWindow == 1)
            {
                this.DrawBatch();
                return;
            }

            if (this.isLock == false)
            {
                ClientGameObject[] selection = this.Hierarchy.GetSelectedGameObjects();

                if (selection.Length > 0)
                {
                    if (this.target != selection[0])
                    {
                        this.target = selection[0];
                        this.target.RequestComponents(this.Hierarchy.Client);
                        this.Hierarchy.WatchGameObject(this, this.target);
                    }
                }
                else
                {
                    if (this.target != null)
                    {
                        this.target = null;
                        this.Hierarchy.WatchGameObject(this, null);
                    }
                }
            }

            if (NGLicensesManager.IsPro(NGTools.NGRemoteScene.NGAssemblyInfo.Name + " Pro") == false)
            {
                EditorGUILayout.HelpBox("NG Remote Inspector is read-only. You can only toggle the GameObject's active state below.", MessageType.Info);
            }

            if (this.target == null)
            {
                return;
            }

            this.DrawHeader();

            if (this.target.components == null)
            {
                EditorGUILayout.LabelField(LC.G("NGInspector_ComponentNotLoadedYet"));
                return;
            }

            this.bodyRect.y      = GUILayoutUtility.GetLastRect().yMax + NGRemoteInspectorWindow.ComponentSpacing;
            this.bodyRect.width  = this.position.width;
            this.bodyRect.height = this.position.height - this.bodyRect.y;
            this.viewRect.height = NGRemoteInspectorWindow.AddComponentButtonHeight;

            for (int i = 0; i < this.target.components.Count; i++)
            {
                try
                {
                    this.viewRect.height += this.target.components[i].GetHeight(this) + NGRemoteInspectorWindow.ComponentSpacing;
                }
                catch
                {
                    this.viewRect.height += 16F + NGRemoteInspectorWindow.ComponentSpacing;
                }
            }

            this.PopulateMaterials(this.renderingMaterials);

            for (int i = 0; i < this.renderingMaterials.Count; i++)
            {
                this.viewRect.height += ClientMaterial.GetHeight(this.Hierarchy, this.renderingMaterials[i]);
            }

            this.scrollPosition = GUI.BeginScrollView(this.bodyRect, this.scrollPosition, this.viewRect);
            {
                this.r   = this.bodyRect;
                this.r.y = 0F;

                if (this.viewRect.height >= this.bodyRect.height)
                {
                    this.r.width -= 15F;
                }

                for (int i = 0; i < this.target.components.Count; i++)
                {
                    try
                    {
                        float height = this.target.components[i].GetHeight(this);

                        this.r.height = height;
                        if (this.r.y + height <= this.scrollPosition.y)
                        {
                            continue;
                        }

                        this.target.components[i].OnGUI(this.r, this);
                    }
                    catch (Exception ex)
                    {
                        if (Event.current.type == EventType.Repaint)
                        {
                            EditorGUI.DrawRect(this.r, Color.red * .5F);
                        }

                        this.errorPopup.exception     = ex;
                        this.errorPopup.customMessage = "Component " + this.target.components[i].name + " (" + i + ") failed to render.";
                    }
                    finally
                    {
                        this.r.y += this.r.height + NGRemoteInspectorWindow.ComponentSpacing;
                    }

                    if (this.r.y - this.scrollPosition.y > this.bodyRect.height)
                    {
                        break;
                    }
                }

                if (this.renderingMaterials.Count > 0 && this.r.y - this.scrollPosition.y < this.bodyRect.height)
                {
                    this.DrawMaterials(this.renderingMaterials);
                }

                this.r.height = 1F;
                this.r.y     += 1F;
                EditorGUI.DrawRect(this.r, Color.black);

                this.r.y     += 14F;
                this.r.height = 24F;

                this.r.x    += this.r.width * .5F - NGRemoteInspectorWindow.AddComponentButtonWidth * .5F;
                this.r.width = NGRemoteInspectorWindow.AddComponentButtonWidth;

                if (GUI.Button(this.r, "Add Component") == true)
                {
                    PopupWindow.Show(this.r, new ComponentsBrowserWindow(this.Hierarchy, this.target.instanceID));
                }
            }
            GUI.EndScrollView();

            int hash = 0;

            for (int i = 0; i < this.renderingMaterials.Count; i++)
            {
                hash += this.renderingMaterials[i];
            }

            if (hash != this.lastMaterialsHash)
            {
                this.lastMaterialsHash = hash;
                this.Hierarchy.WatchMaterials(this, this.renderingMaterials.ToArray());
            }
        }
Esempio n. 15
0
 private bool    CheckMaxCLICommandExecutions(int count)
 {
     return(NGLicensesManager.Check(count < RemoteModule.MaxCLICommandExecutions, NGTools.NGGameConsole.NGAssemblyInfo.Name + " Pro"));
 }
Esempio n. 16
0
        /// <summary>
        /// For the curious who might want to know why I send these stats.
        /// I need some info about Unity Editor usage, especially because Unity does not provide them.
        /// In order to keep supporting old versions or platforms.
        /// </summary>
        /// <param name="sendStats"></param>
        internal static void    SendStats(bool sendStats = true)
        {
            string path     = Path.Combine(Application.persistentDataPath, Path.Combine(Constants.InternalPackageTitle, "sendStats." + Utility.UnityVersion + "." + Constants.Version + ".txt"));
            bool   sentOnce = false;
            string today    = DateTime.Now.ToString("yyyyMMdd");

            if (File.Exists(path) == true)
            {
                string lastTime = File.ReadAllText(path);

                if (lastTime == today)
                {
                    sentOnce = true;
                }
            }

            if (sentOnce == false)
            {
                try
                {
                    Directory.CreateDirectory(Path.GetDirectoryName(path));
                    File.WriteAllText(path, today);
                }
                catch
                {
                    string rawSentOnceCount = HQ.GetStatsComplementary("SSSOC");
                    int    errorCount;

                    if (string.IsNullOrEmpty(rawSentOnceCount) == false && int.TryParse(rawSentOnceCount, out errorCount) == true)
                    {
                        HQ.SetStatsComplementary("SSSOC", (errorCount + 1).ToString());
                    }
                    else
                    {
                        HQ.SetStatsComplementary("SSSOC", "1");
                    }
                }
            }

            if (sentOnce == false || sendStats == false)
            {
                StringBuilder buffer = Utility.GetBuffer(HQ.ServerEndPoint + "unityeditor.php?u=");

                buffer.Append(Utility.UnityVersion);
                buffer.Append("&o=");
                buffer.Append(SystemInfo.operatingSystem);
                buffer.Append("&p=");
                buffer.Append(Constants.Version);
                buffer.Append("&n=");
                buffer.Append(SystemInfo.deviceName);
                buffer.Append("&un=");
                buffer.Append(Environment.UserName);
                buffer.Append("&ut=");
                buffer.Append(Metrics.GetUsedTools());
                Metrics.ResetUsedTools();

                buffer.Append("&m=");
                buffer.Append(HQ.GetMACAddressHash());

                foreach (License license in NGLicensesManager.EachInvoices())
                {
                    if (license.active == true && license.status != Status.Banned)
                    {
                        buffer.Append("&in[]=");
                        buffer.Append(license.invoice);
                    }
                }

                foreach (HQ.ToolAssemblyInfo tool in HQ.EachTool)
                {
                    buffer.Append("&to[]=");
                    buffer.Append(tool.name);
                    buffer.Append(":");
                    buffer.Append(tool.version);
                }

                string complementary = NGEditorPrefs.GetString(HQ.ComplementaryKeyPref);
                if (string.IsNullOrEmpty(complementary) == false)
                {
                    buffer.Append("&com=" + complementary);
                }

                if (sendStats == false)
                {
                    buffer.Append("&s");
                }

                Utility.RequestURL(Utility.ReturnBuffer(buffer), (s, r) =>
                {
                    if (s == Utility.RequestStatus.Completed)
                    {
                        NGEditorPrefs.DeleteKey(HQ.ComplementaryKeyPref);
                    }
                    else
                    {
                        string rawErrorCount = HQ.GetStatsComplementary("SSEC");
                        int errorCount;

                        if (string.IsNullOrEmpty(rawErrorCount) == false && int.TryParse(rawErrorCount, out errorCount) == true)
                        {
                            HQ.SetStatsComplementary("SSEC", (errorCount + 1).ToString());
                        }
                        else
                        {
                            HQ.SetStatsComplementary("SSEC", "1");
                        }
                    }
                });
            }
        }
Esempio n. 17
0
 private bool    CheckMaxFilters(int count)
 {
     return(NGLicensesManager.Check(count < GroupFilters.MaxFilters, NGTools.NGConsole.NGAssemblyInfo.Name + " Pro", "Free version does not allow more than " + GroupFilters.MaxFilters + " filters.\n\nClick no more, I can see you want more! :D"));
 }
Esempio n. 18
0
 private bool    CheckMaxAssetReplacements(int count)
 {
     return(NGLicensesManager.Check(count < NGAssetFinderWindow.MaxAssetReplacements, NGAssemblyInfo.Name + " Pro", "Free version does not allow more than " + NGAssetFinderWindow.MaxAssetReplacements + " replacements at once.\n\nUse this feature with moderation. Like beer, with moderation. ;D"));
 }
Esempio n. 19
0
 private bool    CheckMaxBuildSceneProfiles(int count)
 {
     return(NGLicensesManager.Check(count < NGScenesWindow.MaxBuildScenesProfiles, NGAssemblyInfo.Name + " Pro", "Free version does not allow more than " + NGScenesWindow.MaxBuildScenesProfiles + " profiles.\n\n"));
 }
Esempio n. 20
0
 private bool    CheckMaxColorMarkers(int count)
 {
     return(NGLicensesManager.Check(count < ColorMarkersWizard.MaxColorMarkers, NGTools.NGConsole.NGAssemblyInfo.Name + " Pro", "Free version does not allow more than " + ColorMarkersWizard.MaxColorMarkers + " color markers.\n\nMarkers are truly awesome to pinpoint words or specific logs in a glance. :]"));
 }