public void ShowPlayer(BasePlayer player, object obj = null) { _player = player; obj = obj ?? Oxide.Core.Interface.Oxide.RootPluginManager.GetPlugins(); rootObject = new ObjectMemoryInfo(obj, int.MaxValue, "Plugins"); ShowObject(rootObject); }
public bool CheckParents() { ObjectMemoryInfo parent = _parent; while (parent != null) { if (parent._target == _target) { return(false); } parent = parent._parent; } return(true); }
public ObjectMemoryInfo(object targetObject, int layers, string variableName = "", ObjectMemoryInfo parent = null, bool autoExpand = false) { _autoExpand = autoExpand; _parent = parent; name = variableName; name = name.Replace("<", ""); name = name.Replace(">", ""); name = name.Replace("k__BackingField", ""); currentLayer = layers - 1; _target = targetObject; SetupObject(); if (autoExpand) { Expand(); } }
public MemoryObjectInfoUI(MethodInfo method, Vector2 pos, MemoryTableUIManager manager, ObjectMemoryInfo obj) { background = new UIPanel(this, pos, 1f - pos.x - 0.05f, (0.90f / objectsPerScreen)); AddElement(background); label = new UILabel(this, ObjectMemoryInfo.GetMethodText(method), alignment: TextAnchor.MiddleLeft); label.SetSize(1f, 1f); label.SetPosition(0.0f, 0f); label.SetParent(background); AddElement(label); expand = new UIButton(this, buttonColor: "0 0 1 1", fontSize: 10, textColor: "1 1 1 1"); expand.AddCallback((arg) => { if (method.ReturnType != null) { if (method.ReturnType.IsValueType || method.ReturnType == typeof(string)) { _plugin.PrintToChat(manager._player, method.Invoke(obj._target, null)?.ToString()); } else //When clicking on a function that returns a object to explore { var objectReturn = method.Invoke(obj._target, null); if (objectReturn != null) //Explore blue function { var rootObject = new ObjectMemoryInfo(objectReturn, int.MaxValue, objectReturn.GetType().Name, obj); manager.ShowObject(rootObject); } } } else { _plugin.PrintToChat($"Executed {ObjectMemoryInfo.GetMethodText(method)}"); } }); expand.SetSize(0.005f, 0.45f); expand.SetPosition(0.0f, 0.5f - expand.size.y / 2); expand.SetParent(background); AddElement(expand); label.SetPosition(label.position.x + expand.size.x + 0.005f, label.position.y); Show(manager._player); }
public MemoryObjectInfoUI(ObjectMemoryInfo obj, Vector2 pos, MemoryTableUIManager manager, bool parent = true) { memoryObject = obj; background = new UIPanel(this, pos, 1f - pos.x - 0.05f, (0.90f / objectsPerScreen)); AddElement(background); label = new UILabel(this, obj.GetVisualText(), alignment: TextAnchor.MiddleLeft); label.SetSize(1f, 1f); label.SetPosition(0.0f, 0f); label.SetParent(background); AddElement(label); if (!IsValueType(memoryObject._target)) { expand = new UIButton(this, buttonColor: parent ? "1 0 0 1" : "0 1 0 1", fontSize: 10, textColor: "1 1 1 1"); expand.AddCallback((arg) => { if (parent) { manager.Shrink(this); } else { manager.Expand(this); } }); expand.SetSize(0.005f, 0.45f); expand.SetPosition(0.0f, 0.5f - expand.size.y / 2); expand.SetParent(background); //expand.textComponent.Text = parent ? "-" : "+"; AddElement(expand); label.SetPosition(label.position.x + expand.size.x + 0.005f, label.position.y); } Show(manager._player); }
public void ShowObject(ObjectMemoryInfo obj, bool changePage = false) { HideCurrent(); if (!changePage) { currentIndex = 0; } int i = 0; currentObject = new MemoryObjectInfoUI(obj, new Vector2(0.25f, 0.95f), this); obj.Expand(); if (obj.children.Count == 0) { _plugin.Puts("No children!"); _plugin.Puts(IsValueType(obj._target).ToString()); return; } bool nextPageNeeded = false; Vector2 pos = new Vector2(0.25f, 0.90f); foreach (var item in obj.children) { //_plugin.Puts($"i: {i}, currentIndex: {currentIndex}"); if (i < currentIndex) { i++; continue; } if (i >= currentIndex + objectsPerScreen && (obj.children.Count != objectsPerScreen)) { nextPageNeeded = true; break; } shownObjects.Add(new MemoryObjectInfoUI(item, pos, this, false)); pos.y -= (0.90f / objectsPerScreen); i++; } foreach (var method in obj.methods) { if (i < currentIndex) { i++; continue; } if (i >= currentIndex + objectsPerScreen) { nextPageNeeded = true; break; } shownObjects.Add(new MemoryObjectInfoUI(method, pos, this, obj)); pos.y -= (0.90f / objectsPerScreen); i++; } nextPage.HideAll(); if (nextPageNeeded) { nextPage.Show(_player); } prevPage.HideAll(); if (currentIndex > 0) { prevPage.Show(_player); } }
public void ShowPlayer(BasePlayer player) { _player = player; rootObject = new ObjectMemoryInfo(Oxide.Core.Interface.Oxide.RootPluginManager.GetPlugins(), int.MaxValue, "Plugins"); ShowObject(rootObject); }