/// <summary> /// Registers new monos as well as changes to previous monos and creates /// the interface necessary for said mono. /// </summary> public void RegisterNewOrChangedMono(UiMonoWithMethods monoData) { var target = monoData.Object; /// If new target set up the data structure for it. if (!this.monosPerObjectData.ContainsKey(target)) { this.monosPerObjectData[target] = new List <UiMonoGroupInformation>(); } var listOfMonoData = this.monosPerObjectData[target]; /// If we already have data with the same mono name, destroy it. if (listOfMonoData.Any(x => x.MonoName == monoData.MonoName)) { this.RemoveDestroyedMono(target, monoData.MonoName, false); } /// Creates the inteface as well as meta data. var createResult = this.CreateScriptUI(monoData.MonoName, monoData.Methods); ///All the data we need to visualise the UI var monoGroup = new UiMonoGroupInformation { MonoName = monoData.MonoName, WholeHeight = createResult.FinalHeight, Methods = createResult.Parent, MonoButtonLabel = createResult.ButtonLabel, Collapsed = false, CollapsedHeight = createResult.CollapsedHeight, GrandParent = createResult.GrandParent, Source = monoData.Source, }; /// Setting up the mono name label to be able to callapse and expand the method createResult.LabelButtonScritp.SetUp(monoGroup, this); /// Storing the resulting UI data listOfMonoData.Add(monoGroup); /// If the new UI ifromation is for current target - display the updated version if (this.currentTarget != null && this.currentTarget == target) { this.DisplayInterfaceForTarger(target); } }
public void SetUp(UiMonoGroupInformation monoGroup, GenerateUpdateAndDisplayTargetSpeceficUI manageButtons) { this.monoGroup = monoGroup; this.manageButtons = manageButtons; }