public override void ConstructUI(GameObject parent, GameObject subGroup) { base.ConstructUI(parent, subGroup); GetDefaultLabel(false); m_richValueType = SignatureHighlighter.ParseFullSyntax(FallbackType, false); m_labelLayout = m_baseLabel.gameObject.GetComponent <LayoutElement>(); m_readonlyInput = UIFactory.CreateLabel(m_mainContent, "ReadonlyLabel", "", TextAnchor.MiddleLeft); m_readonlyInput.horizontalOverflow = HorizontalWrapMode.Overflow; var testFitter = m_readonlyInput.gameObject.AddComponent <ContentSizeFitter>(); testFitter.verticalFit = ContentSizeFitter.FitMode.MinSize; UIFactory.SetLayoutElement(m_readonlyInput.gameObject, minHeight: 25, preferredHeight: 25, flexibleHeight: 0); }
public ReflectionInspector(object target) : base(target) { if (this is StaticInspector) { m_targetType = target as Type; } else { m_targetType = ReflectionUtility.GetActualType(target); } m_targetTypeShortName = SignatureHighlighter.ParseFullSyntax(m_targetType, false); ConstructUI(); CacheMembers(m_targetType); FilterMembers(); }
public override void RefreshUIForValue() { if (!Owner.HasEvaluated) { GetDefaultLabel(); m_baseLabel.text = DefaultLabel; return; } m_baseLabel.text = SignatureHighlighter.ParseFullSyntax(FallbackType, false); m_valueInput.text = Value.ToString(); var type = Value.GetType(); if (type == typeof(float) || type == typeof(double) || type == typeof(decimal)) { m_valueInput.characterValidation = InputField.CharacterValidation.Decimal; } else { m_valueInput.characterValidation = InputField.CharacterValidation.Integer; } if (Owner.CanWrite) { if (!m_applyBtn.gameObject.activeSelf) { m_applyBtn.gameObject.SetActive(true); } } if (!m_valueInput.gameObject.activeSelf) { m_valueInput.gameObject.SetActive(true); } }
internal void AddGenericArgRow(int i, GameObject parent) { var arg = GenericArgs[i]; string constrainTxt = ""; if (this.GenericConstraints[i].Length > 0) { foreach (var constraint in this.GenericConstraints[i]) { if (constrainTxt != "") { constrainTxt += ", "; } constrainTxt += $"{SignatureHighlighter.ParseFullSyntax(constraint, false)}"; } } else { constrainTxt = $"Any"; } var rowObj = UIFactory.CreateHorizontalGroup(parent, "ArgRowObj", false, true, true, true, 4, default, new Color(1, 1, 1, 0));
internal void RefreshComponentList() { var go = GameObjectInspector.ActiveInstance.TargetGO; s_allComps = go.GetComponents <Component>().ToArray(); var components = s_allComps; s_compListPageHandler.ListCount = components.Length; //int startIndex = m_sceneListPageHandler.StartIndex; int newCount = 0; foreach (var itemIndex in s_compListPageHandler) { newCount++; // normalized index starting from 0 var i = itemIndex - s_compListPageHandler.StartIndex; if (itemIndex >= components.Length) { if (i > s_lastCompCount || i >= s_compListTexts.Count) { break; } GameObject label = s_compListTexts[i].transform.parent.parent.gameObject; if (label.activeSelf) { label.SetActive(false); } } else { Component comp = components[itemIndex]; if (!comp) { continue; } if (i >= s_compShortlist.Count) { s_compShortlist.Add(comp); AddCompListButton(); } else { s_compShortlist[i] = comp; } var text = s_compListTexts[i]; text.text = SignatureHighlighter.ParseFullSyntax(ReflectionUtility.GetActualType(comp), true); var toggle = s_compToggles[i]; if (comp.TryCast <Behaviour>() is Behaviour behaviour) { if (!toggle.gameObject.activeSelf) { toggle.gameObject.SetActive(true); } toggle.isOn = behaviour.enabled; } else { if (toggle.gameObject.activeSelf) { toggle.gameObject.SetActive(false); } } var label = text.transform.parent.parent.gameObject; if (!label.activeSelf) { label.SetActive(true); } } } s_lastCompCount = newCount; }
private string GetRichTextName() { return(m_richTextName = SignatureHighlighter.ParseFullSyntax(MemInfo.DeclaringType, false, MemInfo)); }
// Updating result list content private void RefreshResultList() { if (m_resultListPageHandler == null || m_results == null) { return; } m_resultListPageHandler.ListCount = m_results.Length; int newCount = 0; foreach (var itemIndex in m_resultListPageHandler) { newCount++; // normalized index starting from 0 var i = itemIndex - m_resultListPageHandler.StartIndex; if (itemIndex >= m_results.Length) { if (i > m_lastCount || i >= m_resultListTexts.Count) { break; } GameObject label = m_resultListTexts[i].transform.parent.parent.gameObject; if (label.activeSelf) { label.SetActive(false); } } else { var obj = m_results[itemIndex]; var unityObj = obj as UnityEngine.Object; if (obj == null || (unityObj != null && !unityObj)) { continue; } if (i >= m_resultShortList.Count) { m_resultShortList.Add(obj); AddResultButton(); } else { m_resultShortList[i] = obj; } var text = m_resultListTexts[i]; if (m_context != SearchContext.StaticClass) { var name = SignatureHighlighter.ParseFullSyntax(ReflectionUtility.GetType(obj), true); if (unityObj && m_context != SearchContext.Singleton) { if (unityObj && !string.IsNullOrEmpty(unityObj.name)) { name += $": {unityObj.name}"; } else { name += ": <i><color=grey>untitled</color></i>"; } } text.text = name; } else { var type = obj as Type; text.text = SignatureHighlighter.ParseFullSyntax(type, true); } var label = text.transform.parent.parent.gameObject; if (!label.activeSelf) { label.SetActive(true); } } } m_lastCount = newCount; }