Example #1
0
        public BrowseLogExportSourcesPopup(List <ILogExportSource> usedOutputs, Action <ILogExportSource> onCreate)
        {
            this.onCreate = onCreate;

            float maxWidth = 0F;

            foreach (Type type in Utility.EachNGTAssignableFrom(typeof(ILogExportSource)))
            {
                if (usedOutputs.Exists(s => s.GetType() == type) == false)
                {
                    ILogExportSource exportOutput = Activator.CreateInstance(type) as ILogExportSource;
                    Utility.content.text = exportOutput.GetName();
                    float w = GUI.skin.button.CalcSize(Utility.content).x;

                    if (maxWidth < w)
                    {
                        maxWidth = w;
                    }

                    this.availableOutputs.Add(exportOutput);
                }
            }

            if (this.availableOutputs.Count == 0)
            {
                this.size = new Vector2(200F, 100F);
            }
            else
            {
                this.size = new Vector2(maxWidth, availableOutputs.Count * (Constants.SingleLineHeight + BrowseLogExportSourcesPopup.Spacing) - BrowseLogExportSourcesPopup.Spacing);
            }
        }
Example #2
0
 private void    OnCreate(ILogExportSource exportOutput)
 {
     this.usedOutputs.Add(exportOutput);
     this.UpdatePreview();
     this.window.Repaint();
 }