示例#1
0
        private Rect    DrawStreamTabs(Rect r)
        {
            ConsoleSettings settings = HQ.Settings.Get <ConsoleSettings>();
            float           maxWidth = r.width;

            r.height = Constants.SingleLineHeight;

            // Switch stream
            if (settings.inputsManager.Check("Navigation", ConsoleConstants.SwitchNextStreamCommand) == true)
            {
                this.currentVars.workingStream += 1;
                if (this.currentVars.workingStream >= this.streams.Count)
                {
                    this.currentVars.workingStream = 0;
                }

                Event.current.Use();
            }
            if (settings.inputsManager.Check("Navigation", ConsoleConstants.SwitchPreviousStreamCommand) == true)
            {
                this.currentVars.workingStream -= 1;
                if (this.currentVars.workingStream < 0)
                {
                    this.currentVars.workingStream = this.streams.Count - 1;
                }

                Event.current.Use();
            }

            for (int i = 0; i < this.streams.Count; i++)
            {
                r = this.streams[i].OnTabGUI(r, i);
            }

            r.width = 16F;

            if (GUI.Button(r, "+", HQ.Settings.Get <GeneralSettings>().MenuButtonStyle) == true)
            {
                RemoteModuleSettings remoteSettings = HQ.Settings.Get <RemoteModuleSettings>();
                StreamLog            stream         = new StreamLog();
                stream.Init(this.console, this);
                stream.rowsDrawer.SetRowGetter(this);
                stream.FilterAltered += this.console.SaveModules;
                stream.OptionAltered += this.console.SaveModules;

                foreach (ILogFilter filter in remoteSettings.GenerateFilters())
                {
                    stream.groupFilters.filters.Add(filter);
                }

                this.streams.Add(stream);

                if (this.StreamAdded != null)
                {
                    this.StreamAdded(stream);
                }

                this.console.CheckNewLogConsume -= stream.ConsumeLog;
                this.console.PropagateNewLog    -= stream.AddLog;
                this.console.SaveModules();

                if (this.streams.Count == 1)
                {
                    this.currentVars.workingStream = 0;
                }
            }
            r.x += r.width;

            if (this.streams.Count > 2)
            {
                r.y    += r.height + 2F;
                r.x     = 0F;
                r.width = maxWidth;
            }
            else
            {
                r.width = maxWidth - r.x;
            }

            return(r);
        }