public void Init(AssetTool tool, string fullPath, string packageName = "") { if (fullPath.Length == 0) { Debug.Log("Cleaning up: " + name + " from editor modification\n"); Destroy(gameObject); } else if (!initialized) { _assetTool = tool; fullFilePath = fullPath; fileAndExt = System.IO.Path.GetFileName(fullPath); fileName = System.IO.Path.GetFileNameWithoutExtension(fullPath); displayName.text = fileName; myNamespace = packageName; if (fullFilePath.Contains(".seq")) { myType = LibraryElementType.Sequence; myIcon.sprite = LibraryManager.Inst.seqIcon; visual.color = LibraryManager.Inst.seqColor; TooltipDescriptor.AddDescriptor(gameObject, fileName + " - Sequence", "Plays on all selected pads\nOr when the green haptic trigger touches a pad"); TooltipDescriptor.AddDescriptor(openLocationButton.gameObject, "Edit File", "View Source of " + fileName + "\nWe recommend a text editor"); } else if (fullFilePath.Contains(".pat")) { myType = LibraryElementType.Pattern; myIcon.sprite = LibraryManager.Inst.patIcon; visual.color = LibraryManager.Inst.patColor; TooltipDescriptor.AddDescriptor(gameObject, fileName + " - Pattern", "Plays pattern which is composed of sequences on specified areas"); TooltipDescriptor.AddDescriptor(openLocationButton.gameObject, "Edit File", "View Source of " + fileName + "\nWe recommend a text editor"); } else if (fullFilePath.Contains(".exp")) { myType = LibraryElementType.Experience; myIcon.sprite = LibraryManager.Inst.expIcon; visual.color = LibraryManager.Inst.expColor; TooltipDescriptor.AddDescriptor(gameObject, fileName + " - Experience", "Plays experience which is composed of multiple Patterns."); TooltipDescriptor.AddDescriptor(openLocationButton.gameObject, "Edit File", "View Source of " + fileName + "\nWe recommend a text editor"); } //Temporary disabling of the copy-me feature. copyButton.transform.parent.parent.gameObject.SetActive(false); //casey removed: because the asset tool does it now // if (!ValidateFile()) //{ // MarkElementBroken(); // } lastModified = FileModifiedHelper.GetLastModified(fullFilePath); initialized = true; } }
private bool FileHasBeenModified() { DateTime dt = FileModifiedHelper.GetLastModified(fullFilePath); //Debug.Log(dt.ToString() + "\n"); return(dt != lastModified); }
public void Init(AssetTool tool, string fullPath, string packageName = "") { if (fullPath.Length == 0) { Debug.Log("Cleaning up: " + name + " from editor modification\n"); Destroy(gameObject); } else if (!initialized) { FindRequiredElements(); _assetTool = tool; fullFilePath = fullPath; fileAndExt = Path.GetFileName(fullPath); fileName = Path.GetFileNameWithoutExtension(fullPath); displayName.text = fileName; myNamespace = packageName; name = Path.GetFileName(fullPath) + " [LibEle]"; playButton.transform.localScale = Vector3.one; processButton.transform.parent.parent.gameObject.SetActive(false); if (fullFilePath.Contains(".seq")) { myType = LibraryElementType.Sequence; myIcon.sprite = LibraryManager.Inst.seqIcon; visual.color = LibraryManager.Inst.seqColor; TooltipDescriptor.AddDescriptor(gameObject, fileName + " - Sequence", "Plays on all selected pads\nOr when the green haptic trigger touches a pad"); TooltipDescriptor.AddDescriptor(openLocationButton.gameObject, "<color=#FF4500>Edit File</color>", "View Source of [" + fileName + "]\nWe recommend a text editor", new Color32(135, 206, 255, 225)); TooltipDescriptor.AddDescriptor(copyButton.gameObject, "<color=#FF4500>Copy and Edit File</color>", "Creates a duplicate of - [" + fileName + "]\nThen open and edit the new file.", new Color32(135, 206, 255, 225)); } else if (fullFilePath.Contains(".pat")) { myType = LibraryElementType.Pattern; myIcon.sprite = LibraryManager.Inst.patIcon; visual.color = LibraryManager.Inst.patColor; TooltipDescriptor.AddDescriptor(gameObject, fileName + " - Pattern", "Plays pattern which is composed of sequences on specified areas"); TooltipDescriptor.AddDescriptor(openLocationButton.gameObject, "<color=#FF4500>Edit File</color>", "View Source of [" + fileName + "]\nWe recommend a text editor", new Color32(135, 206, 255, 225)); TooltipDescriptor.AddDescriptor(copyButton.gameObject, "<color=#FF4500>Copy and Edit File</color>", "Creates a duplicate of - [" + fileName + "]\nThen open and edit the new file.", new Color32(135, 206, 255, 225)); } else if (fullFilePath.Contains(".exp")) { myType = LibraryElementType.Experience; myIcon.sprite = LibraryManager.Inst.expIcon; visual.color = LibraryManager.Inst.expColor; TooltipDescriptor.AddDescriptor(gameObject, fileName + " - Experience", "Plays experience which is composed of multiple Patterns."); TooltipDescriptor.AddDescriptor(openLocationButton.gameObject, "<color=#FF4500>Edit File</color>", "View Source of [" + fileName + "]\nWe recommend a text editor", new Color32(135, 206, 255, 225)); TooltipDescriptor.AddDescriptor(copyButton.gameObject, "<color=#FF4500>Copy and Edit File</color>", "Creates a duplicate of [" + fileName + "]\nThen open and edit the new file.", new Color32(135, 206, 255, 225)); } else { processButton.transform.parent.parent.gameObject.SetActive(true); } copyIcon.sprite = LibraryManager.Inst.copyIcon; //Temporary disabling of the copy-me feature. //copyButton.transform.parent.parent.gameObject.SetActive(false); //casey removed: because the asset tool does it now // if (!ValidateFile()) //{ // MarkElementBroken(); // } lastModified = FileModifiedHelper.GetLastModified(fullFilePath); initialized = true; } }
public void Init(string fullPath, string packageName = "") { if (fullPath.Length == 0) { Debug.Log("Cleaning up: " + name + " from editor modification\n"); Destroy(gameObject); } else if (!initialized) { fullFilePath = fullPath; fileAndExt = LibraryManager.CleanPathToFile(fullFilePath); string[] fileParts = fileAndExt.Split('.'); fileName = fileParts[0]; displayName.text = fileParts[0]; myNamespace = packageName; if (fullFilePath.Contains(".seq")) { myType = LibraryElementType.Sequence; myIcon.sprite = LibraryManager.Inst.seqIcon; visual.color = LibraryManager.Inst.seqColor; TooltipDescriptor.AddDescriptor(gameObject, fileParts[0] + " - Sequence", "Plays on all selected pads\nOr when the green haptic trigger touches a pad"); TooltipDescriptor.AddDescriptor(openLocationButton.gameObject, "Edit File", "View Source of " + fileParts[0] + "\nWe recommend a text editor"); } else if (fullFilePath.Contains(".pat")) { myType = LibraryElementType.Pattern; myIcon.sprite = LibraryManager.Inst.patIcon; visual.color = LibraryManager.Inst.patColor; TooltipDescriptor.AddDescriptor(gameObject, fileParts[0] + " - Pattern", "Plays pattern which is composed of sequences on specified areas"); TooltipDescriptor.AddDescriptor(openLocationButton.gameObject, "Edit File", "View Source of " + fileParts[0] + "\nWe recommend a text editor"); } else if (fullFilePath.Contains(".exp")) { myType = LibraryElementType.Experience; myIcon.sprite = LibraryManager.Inst.expIcon; visual.color = LibraryManager.Inst.expColor; TooltipDescriptor.AddDescriptor(gameObject, fileParts[0] + " - Experience", "Plays experience which is composed of multiple Patterns."); TooltipDescriptor.AddDescriptor(openLocationButton.gameObject, "Edit File", "View Source of " + fileParts[0] + "\nWe recommend a text editor"); } else { myType = LibraryElementType.Folder; myIcon.sprite = LibraryManager.Inst.folderIcon; visual.color = LibraryManager.Inst.folderColor; copyButton.transform.parent.parent.gameObject.SetActive(false); TooltipDescriptor.AddDescriptor(gameObject, fileParts[0], "Haptic Package: A collection of sequences, patterns and experiences\nDefined by its config.json"); TooltipDescriptor.AddDescriptor(openLocationButton.gameObject, "Open Explorer", "View directories of " + fileParts[0]); } //Temporary disabling of the copy-me feature. copyButton.transform.parent.parent.gameObject.SetActive(false); if (!ValidateFile()) { MarkElementBroken(); } lastModified = FileModifiedHelper.GetLastModified(fullFilePath); initialized = true; } }