private void ParseToolTipsData() { string ToolTipID = ""; string SmallToolTipText = ""; string DetailedToolTipText = ""; string SmallDescriptionImage = ""; string LargeDescriptionImage = ""; string HelpLinkURL = ""; if (xmlDataHandler != null && xmlDataHandler.GetXMLDoc() != null) { foreach (XmlElement node in xmlDataHandler.GetXMLDoc().SelectNodes("ToolTipsData/ToolTipData")) { ToolTipData temp = new ToolTipData(); ToolTipID = node.GetAttribute("ToolTipID"); SmallToolTipText = node.SelectSingleNode("SmallToolTipText").InnerText; if (!string.IsNullOrEmpty(SmallToolTipText)) { temp.AddElement(ToolTipElementID.SmallToolTipText, SmallToolTipText); DetailedToolTipText = node.SelectSingleNode("DetailedToolTipText").InnerText; if (!string.IsNullOrEmpty(DetailedToolTipText)) { temp.AddElement(ToolTipElementID.DetailedToolTipText, DetailedToolTipText); } SmallDescriptionImage = node.SelectSingleNode("SmallDescriptionImage").InnerText; if (!string.IsNullOrEmpty(SmallDescriptionImage)) { temp.AddElement(ToolTipElementID.SmallDescriptionImage, SmallDescriptionImage); } LargeDescriptionImage = node.SelectSingleNode("LargeDescriptionImage").InnerText; if (!string.IsNullOrEmpty(LargeDescriptionImage)) { temp.AddElement(ToolTipElementID.LargeDescriptionImage, LargeDescriptionImage); } HelpLinkURL = node.SelectSingleNode("HelpLinkURL").InnerText; if (!string.IsNullOrEmpty(HelpLinkURL)) { temp.AddElement(ToolTipElementID.HelpLinkURL, HelpLinkURL); } toolTipIDToDataDict.Add(ToolTipID, temp); } } foreach (KeyValuePair <string, ToolTipData> entry in toolTipIDToDataDict) { Debug.Log("<color=purple>UIElementsDataManager::ParseToolTipsData:Found ToolTip: " + entry.Key + " \n" + entry.Value.GetElement(ToolTipElementID.SmallToolTipText) + " \n" + entry.Value.GetElement(ToolTipElementID.DetailedToolTipText) + " \n" + entry.Value.GetElement(ToolTipElementID.SmallDescriptionImage) + " \n" + entry.Value.GetElement(ToolTipElementID.LargeDescriptionImage) + " \n" + entry.Value.GetElement(ToolTipElementID.HelpLinkURL) + "</color>"); } } }
// Use this for initialization void Start() { toolTipData = new ToolTipData(); if (smallToolTipText != null && smallToolTipText.Length > 0) { // populate the tool tip data object manually // TODO: This should be editable in the inspector toolTipData.AddElement(ToolTipElementID.SmallToolTipText, smallToolTipText); if (detailedToolTipText != null && detailedToolTipText.Length > 0) { toolTipData.AddElement(ToolTipElementID.DetailedToolTipText, detailedToolTipText); } if (smallToolTipDescriptionImage != null && smallToolTipDescriptionImage.Length > 0) { toolTipData.AddElement(ToolTipElementID.SmallDescriptionImage, smallToolTipDescriptionImage); } } if (toolTipController == null) { Debug.LogError("BtnWithData::toolTipController was null, it should never be NULL"); } }
private void InitializeToolTipData() { // Create a new Tool Tip Data // In the actual code this will be passed smallTextData = new ToolTipData("This yqgpj is a small tooltip only"); detailedTextData = new ToolTipData("This yqgpj is the small tooltip with detailed text", "This is the large multiline Tool tip Text\n The quick brown fox jumped over the lazy dog"); smallImageData = new ToolTipData("This yqgpj is the small tooltip text", "This is the large multiline Tool tip Text\n The quick brown fox jumped over the lazy dog", "smallImageTestRect64"); smallTextWithImageData = new ToolTipData("This yqgpj is a small tooltip with image only"); smallTextWithImageData.AddElement(ToolTipElementID.SmallDescriptionImage, "smallImageTestRect"); }