public void PositionTooltip(TooltipDescriptor desc) { Vector3 pos = Input.mousePosition; //Check the 4 directions. //if(pos.x + rectTooltip.a Vector2 direction = new Vector2(1, -1); if (pos.x + rectTooltip.sizeDelta.x < Screen.width) { direction.x = 1; } else { direction.x = -1; } if (pos.y - rectTooltip.sizeDelta.y < 0) { direction.y = 1; } else { direction.y = -1; } //Debug.Log(direction + " " + pos + "\t\t Anchored: " + rectTooltip.anchoredPosition + "\n\tSize Delta: " + rectTooltip.sizeDelta + "\n"); rectTooltip.anchoredPosition = new Vector2(Input.mousePosition.x + direction.x * (15 + rectTooltip.sizeDelta.x / 2), Input.mousePosition.y + direction.y * (15 + rectTooltip.sizeDelta.y / 2)); //TooltipRT.anchoredPosition }
public void Init(AssetTool.PackageInfo package, AssetTool tool) { if (!initialized) { FindRequiredElements(); _assetTool = tool; name = package.@namespace + " [LibEle]"; fullFilePath = package.path; myType = LibraryElementType.Folder; fileAndExt = Path.GetFileName(package.path); myIcon.sprite = LibraryManager.Inst.folderIcon; playButton.transform.localScale = Vector3.one; processIcon.sprite = LibraryManager.Inst.processIcon; visual.color = LibraryManager.Inst.folderColor; copyButton.transform.parent.parent.gameObject.SetActive(false); processButton.transform.parent.parent.gameObject.SetActive(true); displayName.text = Path.GetFileName(package.path); myNamespace = package.@namespace; fileName = package.path; TooltipDescriptor.AddDescriptor(gameObject, package.@namespace, "Haptic Package: A collection of sequences, patterns and experiences\nDefined by its config.json"); TooltipDescriptor.AddDescriptor(openLocationButton.gameObject, "<color=#FF4500>Open Folder</color>", "View directories of " + fileName, new Color32(135, 206, 255, 225)); TooltipDescriptor.AddDescriptor(processButton.gameObject, "<color=#FF4500>Convert Package to HDF</color>", "<b>Used for Unreal Engine Assets</b>\nConverts all elements within the package [" + package.@namespace + "] to standalone HDFs", new Color32(135, 206, 255, 225)); myPackage = package; initialized = true; } }
public static TooltipDescriptor AddDescriptor(GameObject go, string name, string description, Color color) { TooltipDescriptor desc = AddDescriptor(go, name, description); desc.backgroundColor = color; return(desc); }
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; } }
public static TooltipDescriptor AddDescriptor(GameObject go, string name, string description) { TooltipDescriptor desc = go.AddComponent <TooltipDescriptor>(); desc.TooltipName = name; desc.DetailedTooltip = description; return(desc); }
public void ShowTooltip(TooltipDescriptor descriptor) { if (!stack.Contains(descriptor)) { stack.Add(descriptor); StackCount = stack.Count; } //Debug.Log("HIT from : " + descriptor.name + " \n"); TooltipNameDisplay.text = descriptor.TooltipName; TooltipDescriptionDisplay.text = descriptor.DetailedTooltip; TooltipBackground.color = descriptor.BackgroundColor; PositionTooltip(descriptor); ShowTooltip(); }
public void Init(AssetTool.PackageInfo package, AssetTool tool) { if (!initialized) { _assetTool = tool; name = package.path; fullFilePath = package.path; myType = LibraryElementType.Folder; fileAndExt = Path.GetFileName(package.path); myIcon.sprite = LibraryManager.Inst.folderIcon; visual.color = LibraryManager.Inst.folderColor; copyButton.transform.parent.parent.gameObject.SetActive(false); displayName.text = Path.GetFileName(package.path); myNamespace = package.@namespace; fileName = package.path; TooltipDescriptor.AddDescriptor(gameObject, fileName, "Haptic Package: A collection of sequences, patterns and experiences\nDefined by its config.json"); TooltipDescriptor.AddDescriptor(openLocationButton.gameObject, "Open Explorer", "View directories of " + fileName); initialized = true; } }
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; } }