/// <summary> /// This can be used to display the inspector within another window /// </summary> /// <param name="entity"></param> public static void DisplayDatablobs(Entity entity) { if (_dataBlobs.Length < 1 || _entityID != entity.Guid) { Refresh(entity); } string[] stArray = new string[_dataBlobs.Length]; for (int i = 0; i < _dataBlobs.Length; i++) { var db = _dataBlobs[i]; stArray[i] = db.GetType().ToString(); } BorderListOptions.Begin("DataBlobs:", stArray, ref _selectedDB, 300f); var p0 = ImGui.GetCursorPos(); if (_selectedDB >= _dataBlobs.Length) { _selectedDB = -1; } if (_selectedDB >= 0) { DBDisplay(_dataBlobs[_selectedDB]); } var p1 = ImGui.GetCursorPos(); var size = new Vector2(ImGui.GetContentRegionAvail().X, p1.Y - p0.Y); BorderListOptions.End(size); }
static void DisplayComponents(ComponentInstancesDB instancesDB) { var componentsByDesign = instancesDB.ComponentsByDesign; StaticRefLib.Game.GlobalManager.TryGetEntityByGuid(instancesDB.OwningEntity.FactionOwner, out var faction); FactionInfoDB factionInfoDB = faction.GetDataBlob <FactionInfoDB>(); string[] designNames = new string[componentsByDesign.Count]; string[][] componentNames = new string[componentsByDesign.Count][]; ComponentDesign[] designs = new ComponentDesign[componentsByDesign.Count]; ComponentAbilityState[][][] states = new ComponentAbilityState[componentsByDesign.Count][][]; int i = 0; foreach (var kvp in componentsByDesign) { var design = factionInfoDB.ComponentDesigns[kvp.Key]; designNames[i] = design.Name; designs[i] = design; i++; int j = 0; componentNames[i] = new string[kvp.Value.Count]; foreach (var component in kvp.Value) { componentNames[i][j] = component.Name; var allstates = component.GetAllStates(); states[i][j] = new ComponentAbilityState[allstates.Count]; int k = 0; foreach (var state in allstates) { states[i][j][k] = state.Value; //state.Value.Name; } //states[i][j] = component.GetAbilityState<>() j++; } } //string[] componentInstances = . BorderListOptions.Begin("Components", designNames, ref _selectedDesign, 200); BorderListOptions.Begin("Instances", componentNames[_selectedDesign], ref _selectedComponent, 150); foreach (var state in states[_selectedDesign][_selectedComponent]) { ImGui.Text(state.Name); } BorderListOptions.End(new Vector2(200, 200)); BorderListOptions.End(new Vector2(250, 500)); }