public static void Initialize() { if (!usingOverview) { //Setup config path with app name projectConfigFilePath = projectConfigFilePath.Replace("{NAME}", Application.productName); if (EditorPrefs.HasKey(setupDoneKey)) { if (EditorPrefs.GetBool(setupDoneKey)) //If the setup was done the Convention Keeper runs, if not it assumes its not to. { RunConventionCheck(); } else if (CheckIfConfigFileExists()) { EditorPrefs.SetBool(setupDoneKey, true); RunConventionCheck(); } } else { ConventionKeeperPopup.FirstTimeDialog(500, 150); } } }
public static void OpenOverview() { usingOverview = true; RefreshOverview(); ConventionKeeperPopup.OverviewDialog(); }
/// <summary> /// Setup for the First Time Stup dialog. /// </summary> public static void FirstTimeDialog(int width, int height) { ConventionKeeperPopup window = ScriptableObject.CreateInstance <ConventionKeeperPopup>(); width = (width == 0) ? Mathf.RoundToInt(Screen.currentResolution.width * 0.5f) : width; height = (height == 0) ? Mathf.RoundToInt(Screen.currentResolution.height * 0.5f) : height; window.position = new Rect(Screen.currentResolution.width / 2 - width / 2, Screen.currentResolution.height / 2 - height / 2, width, height); window.title = "Hello!"; window.message = "We need to setup Convention Keeper to support your project convention needs!\n" + "\n" + "What do you want to do?"; window.drawFunction = new Action(window.DrawFirstTimeDialog); window.ShowPopup(); }
/// <summary> /// Setup for the N input buttons dialog. /// </summary> public static void Dialog(string title, string message, List <ButtonData> buttonList, int width = 0, int height = 0, Color customBGColor = new Color()) { ConventionKeeperPopup window = ScriptableObject.CreateInstance <ConventionKeeperPopup>(); width = (width == 0) ? Mathf.RoundToInt(Screen.currentResolution.width * 0.5f) : width; height = (height == 0) ? Mathf.RoundToInt(Screen.currentResolution.height * 0.5f) : height; window.position = new Rect(Screen.currentResolution.width / 2 - width / 2, Screen.currentResolution.height / 2 - height / 2, width, height); window.title = title; window.message = message; window.buttonList = buttonList; window.drawFunction = new Action(window.DrawDialog); window.backgroundColor = customBGColor; window.ShowPopup(); }
/// <summary> /// Setup for the Overview Window. /// </summary> public static void OverviewDialog() { int width = Mathf.RoundToInt(Screen.currentResolution.width * 0.5f); int height = 500; ConventionKeeperPopup window = ScriptableObject.CreateInstance <ConventionKeeperPopup>(); window.titleContent.text = ConventionKeeper.toolName + " " + ConventionKeeper.toolVersion; width = (width == 0) ? Mathf.RoundToInt(Screen.currentResolution.width * 0.5f) : width; height = (height == 0) ? Mathf.RoundToInt(Screen.currentResolution.height * 0.5f) : height; window.position = new Rect(Screen.currentResolution.width / 2 - width / 2, Screen.currentResolution.height / 2 - height / 2, width, height); window.title = "Overview"; window.message = "We need to setup Convention Keeper to support your project needs!"; window.drawFunction = new Action(window.DrawOverviewDialog); window.Show(); }
/// <summary> /// Setup for the 2 input buttons and 1 input field dialog. /// </summary> public static void DialogWithInputField(string title, string message, string inputInitialText, ButtonData ok, ButtonData cancel, int width = 0, int height = 0) { ConventionKeeperPopup window = ScriptableObject.CreateInstance <ConventionKeeperPopup>(); width = (width == 0) ? Mathf.RoundToInt(Screen.currentResolution.width * 0.5f) : width; height = (height == 0) ? Mathf.RoundToInt(Screen.currentResolution.height * 0.5f) : height; window.position = new Rect(Screen.currentResolution.width / 2 - width / 2, Screen.currentResolution.height / 2 - height / 2, width, height); window.title = title; window.message = message; window.buttonList = new List <ButtonData>(); window.buttonList.Add(ok); window.buttonList.Add(cancel); window.inputFieldFirstText = inputInitialText; window.inputFieldText = inputInitialText; window.drawFunction = new Action(window.DrawDialogWithInputField); window.ShowPopup(); }
/// <summary> /// Opens a special dialog with 2 input buttons and 1 text input field to change a file property. /// </summary> /// <param name="message">Dialog Mmessage.</param> /// <param name="ok">First button label.</param> /// <param name="okCallback">First button callback.</param> /// <param name="cancel">Second button label.</param> /// <param name="cancelCallback">Second button callback.</param> /// <param name="file">File to be altered.</param> public static void DialogInputField(string message, string ok, Action <string> okCallback, string cancel, Action cancelCallback, FileData file) { ConventionKeeperPopup.DialogWithInputField(toolName + " " + toolVersion, message, file.fullName, new ButtonData(ok, okCallback), new ButtonData(cancel, cancelCallback)); }
/// <summary> /// Shows a N input button dialog. /// </summary> /// <param name="message">Dialog message.</param> /// <param name="buttonList">List of ButtonData to add to the dialog</param> public static void Dialog(string message, List <ButtonData> buttonList, int width = -1, int height = -1, Color customBGColor = new Color()) { ConventionKeeperPopup.Dialog(toolName + " " + toolVersion, message, buttonList, width, height, customBGColor); }