Exemplo n.º 1
0
        internal void EditEntry(DevLogEntry entry)
        {
            isNewEntry           = false;
            windowScrollPos      = Vector2.zero;
            status               = entry.status;
            detailScrollPosition = Vector2.zero;
            shortText            = entry.shortDescription;
            detailText           = entry.longDescription;
            assets               = entry.assets;
            isSocial             = entry.isSocial;
            gitCommit            = entry.commitHash;

            MetaDataItems items = EntryPanelSettings.GetSuggestedMetaDataItems();

            for (int i = 0; i < items.Count; i++)
            {
                if (devLogWindow.currentEntry.metaData.Contains(items.GetItem(i).name))
                {
                    items.GetItem(i).IsSelected = true;
                }
            }

            List <string> mediaFilePaths = new List <string>();

            for (int i = 0; i < ScreenCaptures.Count; i++)
            {
                DevLogScreenCapture capture = ScreenCaptures.captures[i];
                if (devLogWindow.currentEntry.captures.Contains(capture))
                {
                    ScreenCaptures.captures[i].IsSelected = true;
                }
            }
        }
Exemplo n.º 2
0
        private static void DevHelpersGUI()
        {
            Skin.StartSection("Helpers (Dev Only)", false);

            EditorGUILayout.BeginHorizontal();
            if (GUILayout.Button("Reset Twitter Access"))
            {
                if (EditorUtility.DisplayDialog("Reset Twitter OAuth Tokens?",
                                                "Do you also want to clear the Twitter access tokens?",
                                                "Yes", "Do Not Clear Them"))
                {
                    TwitterSettings.ClearAccessTokens();
                }
            }

            if (GUILayout.Button("Reset Meta Data"))
            {
                EntryPanelSettings.ResetMetaData();
            }

            if (GUILayout.Button("Reset All EditorPrefs"))
            {
                if (EditorUtility.DisplayDialog("Reset Everything",
                                                "Are you sure you want to reset everything? " +
                                                "No data will be deleted, but all settings will be reset. " +
                                                "This should only be used if you know what you are doing.\n\n " +
                                                "Note, the DevLogger window will be closed, you should reopen it from the `Tools/Wizards Code` menu.",
                                                "Yes, Reset",
                                                "No, do not reset"))
                {
                    Settings.Reset();
                    EntryPanelSettings.Reset();
                    GitSettings.Reset();
                    TwitterSettings.Reset();
                    DiscordSettings.Reset();
                    window.Close();
                }
            }

            if (GUILayout.Button("Dump Window Names"))
            {
                EditorWindow[] allWindows = Resources.FindObjectsOfTypeAll <EditorWindow>();
                foreach (EditorWindow window in allWindows)
                {
                    Debug.Log("Window name: " + window);
                }
            }
            EditorGUILayout.EndHorizontal();
        }
Exemplo n.º 3
0
        /// <summary>
        /// Get a string containing all the selected hashtags for this tweet.
        /// </summary>
        /// <returns>Space separated list of hashtags</returns>
        public string GetSelectedMetaData(bool includeHashtags = true)
        {
            StringBuilder sb    = new StringBuilder();
            MetaDataItems items = EntryPanelSettings.GetSuggestedMetaDataItems();

            for (int i = 0; i < items.Count; i++)
            {
                if (items.GetItem(i).IsSelected&& (includeHashtags || !items.GetItem(i).name.StartsWith("#")))
                {
                    sb.Append(" ");
                    sb.Append(items.GetItem(i).name);
                }
            }
            return(sb.ToString());
        }
Exemplo n.º 4
0
        public void UpdateDevLogEntry()
        {
            devLogWindow.currentEntry.status = status;

            devLogWindow.currentEntry.shortDescription = shortText;
            devLogWindow.currentEntry.assets           = assets;
            devLogWindow.currentEntry.isSocial         = isSocial;

            devLogWindow.currentEntry.commitHash = gitCommit;

            MetaDataItems items = EntryPanelSettings.GetSuggestedMetaDataItems();

            for (int i = 0; i < items.Count; i++)
            {
                if (!items.GetItem(i).IsSelected)
                {
                    devLogWindow.currentEntry.metaData.Remove(items.GetItem(i).name);
                }
                else if (items.GetItem(i).IsSelected&& !devLogWindow.currentEntry.metaData.Contains(items.GetItem(i).name))
                {
                    devLogWindow.currentEntry.metaData.Add(items.GetItem(i).name);
                }
            }

            List <string> mediaFilePaths = new List <string>();

            for (int i = 0; i < ScreenCaptures.Count; i++)
            {
                DevLogScreenCapture capture = ScreenCaptures.captures[i];
                if (!ScreenCaptures.captures[i].IsSelected)
                {
                    devLogWindow.currentEntry.captures.Remove(capture);
                }
                else if (ScreenCaptures.captures[i].IsSelected && !devLogWindow.currentEntry.captures.Contains(capture))
                {
                    devLogWindow.currentEntry.captures.Add(capture);
                    ScreenCaptures.captures[i].IsSelected = false;
                }
            }
            devLogWindow.currentEntry.longDescription = detailText;

            EditorUtility.SetDirty(entries);
            AssetDatabase.SaveAssets();
        }
Exemplo n.º 5
0
        private void MetaDataGUI()
        {
            EditorGUILayout.BeginHorizontal();

            EditorGUILayout.BeginVertical();
            MetaDataItems items = EntryPanelSettings.GetSuggestedMetaDataItems();

            for (int i = 0; i < items.Count; i++)
            {
                MetaDataItem item = items.GetItem(i);
                item.IsSelected = EditorGUILayout.ToggleLeft(item.name, item.IsSelected);
            }

            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.LabelField(EntryPanelSettings.guiNewMetaDataLabel);
            newMetaDataItem = EditorGUILayout.TextField(newMetaDataItem);
            if (GUILayout.Button("Add"))
            {
                EntryPanelSettings.AddSuggestedMetaDataItem(new MetaDataItem(newMetaDataItem, true));
                newMetaDataItem = "";
            }
            EditorGUILayout.EndHorizontal();
            EditorGUILayout.EndVertical();

            EditorGUILayout.BeginVertical();
            isSocial  = EditorGUILayout.Toggle(EntryPanelSettings.guiSocialLabel, isSocial);
            gitCommit = EditorGUILayout.TextField(EntryPanelSettings.guiGitCommitLabel, gitCommit);
            EditorGUILayout.EndVertical();
            EditorGUILayout.EndHorizontal();

            /*
             #if DOUBTECH_ASSET_MANAGER
             * EditorGUILayout.BeginHorizontal();
             * if (GUILayout.Button("Add Credits from Asset Manager"))
             * {
             *  detailText += new DoubTech.AssetManager.Api.Credits.CreditGenerator().GenerateCredits();
             * }
             * EditorGUILayout.EndHorizontal();
             #endif
             */
        }
Exemplo n.º 6
0
        /// <summary>
        /// Append a devlog entry.
        /// </summary>
        /// <param name="withTweet">If true record that the entry was tweeted at the current time.</param>
        /// <param name="withDiscord">If true record that the entry was posted to discord at the current time.</param>
        /// <returns></returns>
        public DevLogEntry AppendDevlog(bool withTweet = false, bool withDiscord = false)
        {
            DevLogEntry entry = ScriptableObject.CreateInstance <DevLogEntry>();

            entry.name = DateTime.Now.ToShortDateString() + " " + DateTime.Now.ToShortTimeString();

            entry.status = status;

            entry.shortDescription = shortText;
            StringBuilder text = new StringBuilder(entry.shortDescription);

            entry.isSocial = isSocial;

            if (!string.IsNullOrEmpty(gitCommit))
            {
                entry.commitHash = gitCommit;

                text.Append("\n\nGit Commit: " + gitCommit);
                gitCommit = "";
            }

            MetaDataItems items = EntryPanelSettings.GetSuggestedMetaDataItems();

            for (int i = 0; i < items.Count; i++)
            {
                if (items.GetItem(i).IsSelected)
                {
                    entry.metaData.Add(items.GetItem(i).name);
                }
            }

            if (withTweet)
            {
                entry.tweeted           = true;
                entry.lastTweetFileTime = DateTime.Now.ToFileTimeUtc();
                text.Append("\n\n[This DevLog entry was last Tweeted at " + entry.lastTweetPrettyTime + ".]");
            }

            if (withDiscord)
            {
                entry.discordPost             = true;
                entry.lastDiscordPostFileTime = DateTime.Now.ToFileTimeUtc();
                text.Append("\n\n[This DevLog entry was last posted to Discord at " + entry.lastTweetPrettyTime + ".]");
            }

            List <string> mediaFilePaths = new List <string>();

            for (int i = 0; i < ScreenCaptures.Count; i++)
            {
                if (ScreenCaptures.captures[i].IsSelected)
                {
                    DevLogScreenCapture capture = ScreenCaptures.captures[i];
                    entry.captures.Add(capture);
                    ScreenCaptures.captures[i].IsSelected = false;
                }
            }
            entry.longDescription = detailText;

            entries.AddEntry(entry);
            AssetDatabase.AddObjectToAsset(entry, entries);
            EditorUtility.SetDirty(entries);
            AssetDatabase.SaveAssets();

            shortText  = "";
            detailText = "";

            return(entry);
        }