// Update is called once per frame void Update() { //Debug.Log (GameManager.Instance.getCurrentGameState ()); if (GameManager.Instance.getCurrentGameState() == TargetState) { Target.SetActive(true); } else { Target.SetActive(false); } if (!isLastPos) { if (ScrollablePanel.GetComponent <RectTransform> ().localPosition.y >= yMinValue && ScrollablePanel.GetComponent <RectTransform> ().localPosition.y <= yMaxValue) { Icons.SetActive(true); } else { Icons.SetActive(false); } } else if (isLastPos) { if (ScrollablePanel.GetComponent <RectTransform> ().localPosition.y < yMinValue) { Icons.SetActive(true); } else { Icons.SetActive(false); } } }
private void SetupConsoleTab() { Log.Verbose("Debugger", "Setup debugger console tab..."); float totalHPadding = tabContainerPadding.left + tabContainerPadding.right; ct_txtCommand = new AutocompleteTextField("CommandField", String.Empty); tabPageConsole.AttachControl(disposingManager.R(ct_txtCommand)); ct_txtCommand.Anchor = Anchor.Bottom | Anchor.Left | Anchor.Right; ct_txtCommand.Size = new Vector2(tabContainer.Width - (totalHPadding + 24), ct_txtCommand.Height); ct_txtCommand.Pivot = PivotPoint.BottomLeft; ct_txtCommand.RelativePosition = new Vector3(tabContainerPadding.left, tabContainer.Height - (ct_txtCommand.Height + tabContainerPadding.bottom)); float consoleLogHeight = tabContainer.Height - (ct_txtCommand.Height + tabContainerPadding.bottom + 5); ct_consoleLogScrollbar = new ScrollbarControl("ConsoleLogScrollbar"); tabPageConsole.AttachControl(disposingManager.R(ct_consoleLogScrollbar).Control); ct_consoleLogScrollbar.Anchor = Anchor.Top | Anchor.Bottom | Anchor.Right; ct_consoleLogScrollbar.Size = new Vector2(ct_consoleLogScrollbar.Width, consoleLogHeight); ct_consoleLogScrollbar.RelativePosition = new Vector3(tabContainer.Width - (ct_consoleLogScrollbar.Width + tabContainerPadding.left), tabContainerPadding.top); ct_consoleLog = new ScrollablePanel("ConsoleLog"); tabPageConsole.AttachControl(disposingManager.R(ct_consoleLog)); ct_consoleLog.Anchor = Anchor.All; ct_consoleLog.Size = new Vector2(tabContainer.Width - (totalHPadding + ct_consoleLogScrollbar.Width), consoleLogHeight); ct_consoleLog.Pivot = PivotPoint.TopLeft; ct_consoleLog.RelativePosition = new Vector3(tabContainerPadding.left, tabContainerPadding.top); ct_consoleLog.Color = new Color32(30, 30, 30, 150); ct_consoleLog.VerticalScrollbar = ct_consoleLogScrollbar.Control; Button test = new Button("test", "testbutton", Vector3.one, new Vector2(100, 800)); ct_consoleLog.AttachControl(test); }
private void DrawRecord(Rectangle bounds, SpriteBatch sb, DeathRowEntry entry) { bounds.X += 2; bounds.Width -= 2; var flag = TextItem.DrawShadow; TextItem.DrawShadow = false; var height = 850; ScrollablePanel.beginPanel(98302836, new Rectangle(bounds.X, bounds.Y, bounds.Width, height), recordScrollPosition); var num1 = bounds.Width - 16; var vector2_1 = new Vector2(5f, 5f); GuiData.spriteBatch.Draw(Logo, new Rectangle((int)vector2_1.X, (int)vector2_1.Y, 60, 60), Color.White); vector2_1.X += 70f; TextItem.doFontLabel(vector2_1, "DEATH ROW : EXECUTED OFFENDERS LISTING", GuiData.titlefont, themeColor, num1 - 80, 45f); vector2_1.Y += 22f; if (Button.doButton(98102855, (int)vector2_1.X, (int)vector2_1.Y, bounds.Width / 2, 25, "Return", Color.Black)) { SelectedIndex = -1; } vector2_1.X = 5f; vector2_1.Y += 55f; TextItem.doFontLabel(vector2_1, "RECORD " + entry.RecordNumber, GuiData.titlefont, Color.White, num1 - 4, 60f); vector2_1.Y += 70f; var seperatorHeight = 18; var margin = 12; var drawPos = DrawCompactLabel("Name:", entry.LName + ", " + entry.FName, vector2_1, margin, seperatorHeight, num1); var pos = DrawCompactLabel("Age:", entry.Age, drawPos, margin, seperatorHeight, num1); var num2 = 20; var num3 = 20; var zero = Vector2.Zero; TextItem.doFontLabel(pos, "Incident Report:", GuiData.smallfont, themeColor, num1, float.MaxValue); pos.Y += num2; TextItem.DrawShadow = false; var vector2_2 = TextItem.doMeasuredSmallLabel(pos, Utils.SmartTwimForWidth(entry.IncidentReport, num1, GuiData.smallfont), Color.White); pos.Y += Math.Max(vector2_2.Y, num2); pos.Y += num3; TextItem.doFontLabel(pos, "Final Statement:", GuiData.smallfont, themeColor, num1, float.MaxValue); pos.Y += num2; vector2_2 = TextItem.doMeasuredSmallLabel(pos, Utils.SmartTwimForWidth(entry.Statement, num1, GuiData.smallfont), Color.White); pos.Y += num3; recordScrollPosition = ScrollablePanel.endPanel(98302836, recordScrollPosition, bounds, height - bounds.Height, true); TextItem.DrawShadow = flag; }
public static void resetOS() { if (Settings.isSpecialTestBuild) { return; } TextBox.cursorPosition = 0; Settings.initShowsTutorial = Settings.osStartsWithTutorial; Settings.IsInAdventureMode = false; ScrollablePanel.ClearCache(); }
private void docatDisplay() { if (os.hasConnectionPermission(false)) { if (Button.doButton(299999, bounds.X + (bounds.Width - 41), bounds.Y + 12, 27, 29, "<-", new Color?())) { os.runCommand("ls"); } var rectangle = GuiData.tmpRect; rectangle.Width = bounds.Width; rectangle.X = bounds.X; rectangle.Y = bounds.Y + 1; rectangle.Height = bounds.Height - 2; rectangle.Height += bounds.Height; ScrollablePanel.beginPanel(484732, rectangle, catScroll); var text1 = ""; for (var index = 1; index < commandArgs.Length; ++index) { text1 = text1 + commandArgs[index] + " "; } x = 10; y = 5; try { TextItem.doFontLabel(new Vector2(x - 5, y - 1), text1, GuiData.font, Color.White, bounds.Width - 70, float.MaxValue); var data = os.displayCache; if (data.Length > 6000) { data = data.Substring(0, 6000) + "\n -- FILE TOO LONG TO DISPLAY -- "; } y += 70; var text2 = Utils.SuperSmartTwimForWidth(data, bounds.Width - 40, GuiData.tinyfont); GuiData.spriteBatch.DrawString(GuiData.tinyfont, text2, new Vector2(x, y), Color.White); } catch (Exception ex) { commandArgs = new string[3]; commandArgs[0] = "cat"; commandArgs[1] = "Error"; commandArgs[2] = "Error reading file"; command = "cat error error reading file"; } rectangle.Height -= bounds.Height; catScroll = ScrollablePanel.endPanel(484732, catScroll, rectangle, 1000f, false); } else { command = "connect"; } }
public static void resetOS() { if (Settings.isSpecialTestBuild) { return; } TextBox.cursorPosition = 0; Settings.initShowsTutorial = Settings.osStartsWithTutorial; Settings.IsInExtensionMode = false; ScrollablePanel.ClearCache(); PostProcessor.dangerModeEnabled = false; PostProcessor.dangerModePercentComplete = 0.0f; PostProcessor.EndingSequenceFlashOutActive = false; PostProcessor.EndingSequenceFlashOutPercentageComplete = 0.0f; }
public GOAllMenuPanel(GameObject obj) : base(obj) { BackButton = new ButtonBack(obj.GetChild(0)); AllTargetButton = new ToggleButton(obj.GetChild(1)); AutoAttackButton = new ToggleButton(obj.GetChild(2)); RunButton = new ButtonRun(obj.GetChild(3)); StatusContainer = new ContainerStatus(obj.GetChild(4)); CommandPanel = new PanelCommand(obj.GetChild(5)); TargetPanel = new PanelTarget(obj.GetChild(6)); AbilityPanel = new ScrollablePanel(obj.GetChild(7)); ItemPanel = new ScrollablePanel(obj.GetChild(8)); PartyPanel = new PanelParty(obj.GetChild(9)); AutoAttackHUD = new HUDAutoAttack(obj.GetChild(10)); }
private void DrawRecord(Rectangle bounds, SpriteBatch sb, DeathRowDatabaseDaemon.DeathRowEntry entry) { bounds.X += 2; bounds.Width -= 2; bool drawShadow = TextItem.DrawShadow; TextItem.DrawShadow = false; int height = 850; ScrollablePanel.beginPanel(98302836, new Rectangle(bounds.X, bounds.Y, bounds.Width, height), this.recordScrollPosition); int num1 = bounds.Width - 16; Vector2 vector2_1 = new Vector2(5f, 5f); GuiData.spriteBatch.Draw(DeathRowDatabaseDaemon.Logo, new Rectangle((int)vector2_1.X, (int)vector2_1.Y, 60, 60), Color.White); vector2_1.X += 70f; TextItem.doFontLabel(vector2_1, "DEATH ROW : EXECUTED OFFENDERS LISTING", GuiData.titlefont, new Color?(this.themeColor), (float)(num1 - 80), 45f, false); vector2_1.Y += 22f; if (Button.doButton(98102855, (int)vector2_1.X, (int)vector2_1.Y, bounds.Width / 2, 25, "Return", new Color?(Color.Black))) { this.SelectedIndex = -1; } vector2_1.X = 5f; vector2_1.Y += 55f; TextItem.doFontLabel(vector2_1, "RECORD " + entry.RecordNumber, GuiData.titlefont, new Color?(Color.White), (float)(num1 - 4), 60f, false); vector2_1.Y += 70f; int seperatorHeight = 18; int margin = 12; vector2_1 = this.DrawCompactLabel(LocaleTerms.Loc("Name") + ":", entry.LName + ", " + entry.FName, vector2_1, margin, seperatorHeight, num1); vector2_1 = this.DrawCompactLabel(LocaleTerms.Loc("Age") + ":", entry.Age, vector2_1, margin, seperatorHeight, num1); int num2 = 20; int num3 = 20; Vector2 vector2_2 = Vector2.Zero; TextItem.doFontLabel(vector2_1, LocaleTerms.Loc("Incident Report") + ":", GuiData.smallfont, new Color?(this.themeColor), (float)num1, float.MaxValue, false); vector2_1.Y += (float)num2; TextItem.DrawShadow = false; Vector2 vector2_3 = TextItem.doMeasuredSmallLabel(vector2_1, Utils.SmartTwimForWidth(entry.IncidentReport, num1, GuiData.smallfont), new Color?(Color.White)); vector2_1.Y += Math.Max(vector2_3.Y, (float)num2); vector2_1.Y += (float)num3; TextItem.doFontLabel(vector2_1, LocaleTerms.Loc("Final Statement") + ":", GuiData.smallfont, new Color?(this.themeColor), (float)num1, float.MaxValue, false); vector2_1.Y += (float)num2; vector2_2 = TextItem.doMeasuredSmallLabel(vector2_1, Utils.SmartTwimForWidth(entry.Statement, num1, GuiData.smallfont), new Color?(Color.White)); vector2_1.Y += (float)num3; this.recordScrollPosition = ScrollablePanel.endPanel(98302836, this.recordScrollPosition, bounds, (float)(height - bounds.Height), true); TextItem.DrawShadow = drawShadow; }
private void ShowMenuInternal() { implicitPause = true; GameScene.TogglePause(); Dialog.Pick("Game Menu".ToConsoleString(), new DialogOption[] { new DialogOption() { Id = "controls", DisplayText = "Kayboard Controls".ToConsoleString() }, new DialogOption() { Id = "options", DisplayText = "Game Options".ToConsoleString() }, new DialogOption() { Id = "help", DisplayText = "Help".ToConsoleString() }, new DialogOption() { Id = "about", DisplayText = "About".ToConsoleString() }, }).Then((menuItem) => { if (menuItem == null) { return; } if (menuItem.Id == "controls") { var editor = new KeyMapEditor(this.InputManager.KeyMap) { Y = 3 }; var scrollPanel = new ScrollablePanel(); scrollPanel.ScrollableContent.Add(editor); var dialog = new Dialog(scrollPanel); dialog.Show().Then(() => { GameScene.QueueAction(() => { InputManager.SetKeyMap(InputManager.KeyMap); }); GameScene.Start(); }); } }).Finally((p) => { }); }
private void Initialize() { Panel = new ScrollablePanel(this.Name); Panel.Anchor = Anchor.All; if (allowHorizontalScrolling) { AddHorizontalScrollbar(); } if (allowVerticalScrolling) { AddVerticalScrollbar(); } UpdatePanel(); }
private void DrawFullThreadView(SpriteBatch sb, MessageBoardThread thread, Rectangle dest) { var rectangle = dest; rectangle.Height = CurrentThreadHeight + 50; var flag = CurrentThreadHeight > dest.Height; if (flag) { ScrollablePanel.beginPanel(1931655001, rectangle, ThreadScrollPosition); rectangle.X = rectangle.Y = 0; } DrawThread(thread, GuiData.spriteBatch, rectangle, false); if (!flag) { return; } float maxScroll = Math.Max(dest.Height, CurrentThreadHeight - dest.Height); ThreadScrollPosition = ScrollablePanel.endPanel(1931655001, ThreadScrollPosition, dest, maxScroll, false); }
private void SetupLogTab() { Log.Verbose("Debugger", "Setup debugger log tab..."); float totalHPadding = tabContainerPadding.left + tabContainerPadding.right; float logPanelHeight = tabContainer.Height - tabContainerPadding.bottom; lt_panelScrollbar = new ScrollbarControl("LogPanelScrollbar"); tabPageLog.AttachControl(disposingManager.R(lt_panelScrollbar).Control); lt_panelScrollbar.Anchor = Anchor.Top | Anchor.Bottom | Anchor.Right; lt_panelScrollbar.Size = new Vector2(lt_panelScrollbar.Width, logPanelHeight); lt_panelScrollbar.RelativePosition = new Vector3(tabContainer.Width - (lt_panelScrollbar.Width + tabContainerPadding.left), tabContainerPadding.top); lt_panel = new ScrollablePanel("LogPanel"); tabPageLog.AttachControl(disposingManager.R(lt_panel)); lt_panel.Anchor = Anchor.All; lt_panel.Size = new Vector2(tabContainer.Width - (totalHPadding + ct_consoleLogScrollbar.Width), logPanelHeight); lt_panel.Pivot = PivotPoint.TopLeft; lt_panel.RelativePosition = new Vector3(tabContainerPadding.left, tabContainerPadding.top); lt_panel.Color = new Color32(30, 30, 30, 150); lt_panel.VerticalScrollbar = ct_consoleLogScrollbar.Control; }
private void RefreshControls() { ScrollablePanel.SuspendLayout(); foreach (Control c in ScrollablePanel.Controls) { c.Dispose(); } ScrollablePanel.Controls.Clear(); foreach (var input in Inputs) { var inputcontrol = new EditWidgetInputAxis(EditingProject, input) { Dock = DockStyle.Top }; ScrollablePanel.Controls.Add(inputcontrol); } ScrollablePanel.ResumeLayout(); ScrollablePanel.PerformLayout(); }
private void RenderResultsDisplayMainState(Rectangle dest, SpriteBatch sb, bool isProcessing) { Color color = new Color(5, 5, 5, 230); Rectangle rectangle1 = new Rectangle(dest.X + 22, dest.Y + 30, dest.Width - 44, 40); sb.Draw(Utils.white, rectangle1, color); rectangle1.X += 10; TextItem.doFontLabelToSize(rectangle1, isProcessing ? LocaleTerms.Loc("PROCESSING") : LocaleTerms.Loc("OUTPUT"), GuiData.font, Color.White, true, true); rectangle1.X -= 10; int width = 200; int height = 30; if (Button.doButton(381023909, rectangle1.X + rectangle1.Width - (width + 6), rectangle1.Y + (rectangle1.Height / 2 - height / 2), width, height, isProcessing ? LocaleTerms.Loc("Cancel") : LocaleTerms.Loc("Return to Menu"), new Color?(Color.White))) { this.State = MemoryForensicsExe.MemForensicsState.Main; this.timeInCurrentState = 0.0f; } rectangle1.Y += rectangle1.Height; rectangle1.Height = 1; sb.Draw(Utils.white, rectangle1, Color.White); if (isProcessing) { Rectangle destinationRectangle = new Rectangle(dest.X + 2, rectangle1.Y + rectangle1.Height + 2, dest.Width - 4, 20); sb.Draw(Utils.white, destinationRectangle, Color.Black); float num = this.timeInCurrentState / this.processingTimeThisBatch; destinationRectangle.Width = (int)((double)destinationRectangle.Width * (double)num); sb.Draw(Utils.white, destinationRectangle, Utils.makeColorAddative(Color.LightBlue)); } else { Rectangle rectangle2 = new Rectangle(rectangle1.X, rectangle1.Y + rectangle1.Height + 2, rectangle1.Width, 1); rectangle2.Height = dest.Y + dest.Height - (rectangle1.Y + rectangle1.Height + 4); sb.Draw(Utils.white, rectangle2, color); if (this.OutputData.Count <= 0) { TextItem.doFontLabelToSize(rectangle2, " - " + LocaleTerms.Loc("No Valid Matches Found") + " - ", GuiData.smallfont, Color.White, true, false); } else { Rectangle drawbounds = new Rectangle(0, 0, rectangle2.Width, rectangle2.Height); float num1 = 10f; for (int index = 0; index < this.OutputData.Count; ++index) { if (this.IsDisplayingImages) { if (this.OutputTextures.Count >= index) { num1 += (float)(Math.Min(drawbounds.Width - 16, this.OutputTextures[index].Height) + 30); } else { break; } } else { num1 += 26f + GuiData.smallfont.MeasureString(Utils.SuperSmartTwimForWidth(this.OutputData[index], drawbounds.Width - 16, GuiData.smallfont)).Y; } } drawbounds.Height = (int)num1; ScrollablePanel.beginPanel(3371001, drawbounds, this.PanelScroll); Vector2 pos = new Vector2((float)(drawbounds.X + 14), (float)drawbounds.Y); TextItem.doMeasuredFontLabel(pos, this.AnnouncementData, GuiData.tinyfont, new Color?(Color.White), float.MaxValue, float.MaxValue); pos.Y += 20f; Rectangle destinationRectangle1 = new Rectangle(drawbounds.X, (int)pos.Y, drawbounds.Width, 1); GuiData.spriteBatch.Draw(Utils.white, destinationRectangle1, Color.White); pos.Y += 20f; for (int index = 0; index < this.OutputData.Count; ++index) { if (this.IsDisplayingImages) { if (this.OutputTextures.Count >= index) { Rectangle dest1 = new Rectangle((int)pos.X + 8, (int)pos.Y, drawbounds.Width - 16, drawbounds.Width - 16); dest1.Height = Math.Min(dest1.Height, this.OutputTextures[index].Height); Rectangle rectangle3 = Utils.DrawSpriteAspectCorrect(dest1, GuiData.spriteBatch, this.OutputTextures[index], Color.White, false); float num2 = (float)(rectangle3.Y - dest1.Y + rectangle3.Height); pos.Y += num2 + 12f; } else { break; } } else { string text = Utils.SuperSmartTwimForWidth(this.OutputData[index], drawbounds.Width - 16, GuiData.smallfont); Vector2 vector2 = TextItem.doMeasuredFontLabel(pos, text, GuiData.smallfont, new Color?(Color.White * 0.9f), float.MaxValue, float.MaxValue); Rectangle destinationRectangle2 = new Rectangle(drawbounds.X + 6, (int)pos.Y + (int)(((double)vector2.Y - 3.0) / 2.0), 3, 3); GuiData.spriteBatch.Draw(Utils.white, destinationRectangle2, Color.Gray); pos.Y += vector2.Y + 6f; } destinationRectangle1 = new Rectangle(drawbounds.X, (int)pos.Y, rectangle2.Width, 1); GuiData.spriteBatch.Draw(Utils.white, destinationRectangle1, Color.Gray); pos.Y += 10f; } this.PanelScroll = ScrollablePanel.endPanel(3371001, this.PanelScroll, rectangle2, 2000f, false); float num3 = num1 - (float)rectangle2.Height; if ((double)this.PanelScroll.Y > (double)num3) { this.PanelScroll.Y = num3; } } } }
public void start() { if (gui != null) { gui.RemoveAllWidgets(); } gui = new Gui(SceneManager.instance().window); font = new Font("EightBitDragon-anqx.ttf"); gui.Font = font; //Создание главной панели MainPanel = new Panel(); Layout2d layout2D = new Layout2d("20%", "100%"); MainPanel.SizeLayout = layout2D; MainPanel.Renderer.BackgroundColor = Color.Black; MainPanel.Renderer.BorderColor = Color.White; MainPanel.Renderer.Borders = new Outline(5); gui.Add(MainPanel); font = new Font("EightBitDragon-anqx.ttf"); //Создание панели с кистями. BrushesPanel = new ScrollablePanel(); BrushesPanel.ScrollbarWidth = 8; BrushesPanel.Renderer.BackgroundColor = Color.Black; BrushesPanel.Renderer.BorderColor = Color.White; BrushesPanel.PositionLayout = new Layout2d("0%", "5%"); BrushesPanel.SizeLayout = new Layout2d("100%", "25%"); MainPanel.Add(BrushesPanel); //Кисти. RadioButtonGroup brushes = new RadioButtonGroup(); Dictionary <string, Color> tempColors = BrushManager.instance().getColors(); //получаем список цветов от менеджера кистей int positionOffset = 0; //определяет смещение для кнопки foreach (var colorKey in tempColors.Keys) { positionOffset += 15; RadioButton colorBrush_Btn = new RadioButton(colorKey); //создаем кнопку с именем colorBrush_Btn.Renderer.TextColor = Color.White; colorBrush_Btn.Renderer.TextColorHover = Color.Blue; colorBrush_Btn.PositionLayout = new Layout2d("0%", positionOffset + "%"); //производим смещение colorBrush_Btn.Toggled += (e, a) => { if (colorBrush_Btn.Checked) { BrushManager.instance().changeCurrentColor(colorKey); } }; //привязываем к кнопке метод изменяющий текущий цвет у менеджера кистей BrushesPanel.Add(colorBrush_Btn); //добавляем кнопку на панель } BrushesPanel.Add(brushes); //список слоев ListBox LayerList = new ListBox(); LayerList.Renderer.TextColor = Color.White; layers = new Dictionary <string, Image>(); Layer[] tempLayerList = SceneManager.instance().currentScene.getLayers(); foreach (var lay in tempLayerList) { //добавляем слои в словарь. При выборе значения в списке - значение будет передано словарю в качестве ключа и будет получение изображение, которое будет передано менеджеру кисти //таким образом рисование будет происходить на выбранном пользователем слое layers.Add(lay.name, lay.picture.image); LayerList.AddItem(lay.name, lay.name); } LayerList.ItemSelected += (e, a) => { BrushManager.instance().changeCurrentImage(layers[LayerList.GetSelectedItemId()]); }; LayerList.Renderer.BackgroundColor = Color.Transparent; LayerPanel = new Panel(); LayerPanel.Renderer.BackgroundColor = Color.Black; LayerPanel.Renderer.BorderColor = Color.White; LayerPanel.PositionLayout = new Layout2d("0%", "30%"); LayerPanel.SizeLayout = new Layout2d("100%", "30%"); LayerPanel.Renderer.Borders = new Outline(0, 5, 0, 0); LayerPanel.Add(LayerList); MainPanel.Add(LayerPanel); //Данные производительности performancePanel = new Panel(); performancePanel.Renderer.BackgroundColor = Color.Black; performancePanel.Renderer.BorderColor = Color.White; performancePanel.Renderer.Borders = new Outline(0, 5, 0, 5); performancePanel.PositionLayout = new Layout2d("0%", "50%"); performancePanel.SizeLayout = new Layout2d("100%", "10%"); frameDelay = new TextBox(); frameDelay.Renderer.BackgroundColor = Color.Transparent; frameDelay.Renderer.TextColor = Color.White; performancePanel.Add(frameDelay); MainPanel.Add(performancePanel); //Контроль симуляций (включение/выключение) objectsControlPanel = new ScrollablePanel(); objectsControlPanel.ScrollbarWidth = 8; GameObject[] Scene_objects = SceneManager.instance().GetGameObjects(); positionOffset = 0; foreach (var obj in Scene_objects) { CheckBox gameObjectSwitcher = new CheckBox(); gameObjectSwitcher.Checked = true; gameObjectSwitcher.Text = obj.name; gameObjectSwitcher.Toggled += (e, a) => { obj.toggleActive(); }; gameObjectSwitcher.PositionLayout = new Layout2d("0%", positionOffset + "%"); gameObjectSwitcher.Renderer.TextColor = Color.White; gameObjectSwitcher.Renderer.TextColorHover = Color.Green; gameObjectSwitcher.Renderer.Font = font; positionOffset += 13; objectsControlPanel.Add(gameObjectSwitcher); } objectsControlPanel.Renderer.BackgroundColor = Color.Black; objectsControlPanel.Renderer.BorderColor = Color.White; objectsControlPanel.Renderer.Borders = new Outline(0, 5, 0, 5); objectsControlPanel.PositionLayout = new Layout2d("0%", "60%"); objectsControlPanel.SizeLayout = new Layout2d("100%", "30%"); MainPanel.Add(objectsControlPanel); }
public FormSettings(Settings settings, SettingsValidator validator) { // // Required for Windows Form Designer support // InitializeComponent(); // Keep track of the validator. this.validator = validator; // This assumes all fonts on the form are the same size. Graphics g = CreateGraphics(); int charWidth = (int)g.MeasureString("H", Font).Width; // Keep a reference to the supplied Settings object. this.settings = settings; // Create a tab page for each settings group. for (int i = 0; i < settings.Count; i++) { Setting setting = settings[i]; int j = 0; while ((j < tabControl.TabPages.Count) && (setting.Group != tabControl.TabPages[j].Text)) j++; if (j >= tabControl.TabPages.Count) { TabPage newPage = new TabPage(); newPage.Text = setting.Group; tabControl.TabPages.Add(newPage); } } // Create a scrollable panel on each tab page. controlPanels = new ScrollablePanel[tabControl.TabPages.Count]; for (int i = 0; i < tabControl.TabPages.Count; i++) { controlPanels[i] = new ScrollablePanel(); controlPanels[i].Location = new Point(0, 0); controlPanels[i].Size = tabControl.TabPages[i].ClientSize; tabControl.TabPages[i].Controls.Add(controlPanels[i]); } // Create controls for each setting. controls = new Control[settings.Count]; settingButtonProperties = new SettingButtonProperties[settings.Count]; int[] controlOffset = new int[tabControl.TabPages.Count]; for (int i = 0; i < settings.Count; i++) { Setting setting = settings[i]; // Assemble the parameters for the setting. int j = 0; System.Collections.Hashtable parameters = new Hashtable(); if (setting.Params.Length % 2 != 0) throw new Exception("Params array does not have an even number of elements"); while (j < setting.Params.Length) { parameters[setting.Params[j]] = setting.Params[j + 1]; j += 2; } // Find the corresponding tab page and panel. j = 0; while ((j < tabControl.TabPages.Count) && (setting.Group != tabControl.TabPages[j].Text)) j++; if (j >= tabControl.TabPages.Count) throw new Exception("Tab page not found. Should be impossible."); ScrollablePanel controlPanel = controlPanels[j]; int maxControlWidth = controlPanel.ContentWidth - 2 * marginLeft; // Add the appropriate control. if (setting.Type == "boolean") { // The caption is part of the check box control. CheckBox checkBox = new CheckBox(); checkBox.Text = setting.Caption; checkBox.Width = maxControlWidth; checkBox.Checked = (bool)setting.Value; controls[i] = checkBox; } else { // Display a caption with the corresponding control underneath it. Label caption = new Label(); caption.Left = marginLeft; caption.Top = marginTop + controlOffset[j]; caption.Width = maxControlWidth; caption.Text = setting.Caption; controlOffset[j] += caption.Height; controlPanel.ContentControls.Add(caption); switch (setting.Type) { case "string": case "integer": case "long": case "double": { int maxLength = parameters.Contains("maxlength") ? (int)parameters["maxlength"] : 0; TextBox textBox = new TextBox(); if (maxLength > 0) { textBox.MaxLength = maxLength; textBox.ClientSize = new Size((maxLength + 1) * charWidth, textBox.ClientSize.Height); if (textBox.Width > maxControlWidth) textBox.Width = maxControlWidth; } else { textBox.Width = maxControlWidth; } textBox.Text = setting.Value.ToString(); textBox.GotFocus += new EventHandler(textBox_GotFocus); textBox.LostFocus += new EventHandler(textBox_LostFocus); controls[i] = textBox; break; } case "updown": { if (! parameters.Contains("min") || ! parameters.Contains("max")) throw new Exception("Missing 'min' and/or 'max' parameter(s)"); int maxLength = parameters.Contains("maxlength") ? (int)parameters["maxlength"] : 0; int min = (int)parameters["min"]; int max = (int)parameters["max"]; NumericUpDown upDown = new NumericUpDown(); upDown.Value = (int)setting.Value; upDown.Minimum = min; upDown.Maximum = max; if (maxLength > 0) { upDown.ClientSize = new Size((maxLength + 1) * charWidth + 30, upDown.ClientSize.Height); if (upDown.Width > maxControlWidth) upDown.Width = maxControlWidth; } else { upDown.Width = maxControlWidth; } controls[i] = upDown; break; } case "comportin": case "comportout": { Button button = new Button(); button.Text = ".."; button.Width = 20; button.Top = marginTop + controlOffset[j]; button.Left = controlPanel.ContentWidth - marginLeft - button.Width; button.Click += new EventHandler(SettingButtonClick); settingButtonProperties[i] = new SettingButtonProperties(button, setting.Value); controlPanel.ContentControls.Add(button); TextBox textBox = new TextBox(); textBox.ReadOnly = true; textBox.Width = button.Left - marginLeft - 2; textBox.Text = GetComPortDescription(setting.Value.ToString()); controls[i] = textBox; break; } case "combobox": { if (! parameters.Contains("items")) throw new Exception("Missing 'items' parameter"); object[] items = (object[])parameters["items"]; ComboBox combo = new ComboBox(); combo.Width = maxControlWidth; for (int k = 0; k < items.Length; k++) combo.Items.Add(items[k]); combo.SelectedItem = setting.Value; controls[i] = combo; break; } case "openfile": case "savefile": case "exefile": { object data = null; if (setting.Type != "exefile") { data = new FileDialogData(parameters.Contains("filter") ? (string)parameters["filter"] : "All Files (*.*)|*.*", parameters.Contains("filterindex") ? (int)parameters["filterindex"] : 1, parameters.Contains("initialdir") ? (string)parameters["initialdir"] : ""); } Button button = new Button(); button.Text = ".."; button.Width = 20; button.Top = marginTop + controlOffset[j]; button.Left = controlPanel.ContentWidth - marginLeft - button.Width; button.Click += new EventHandler(SettingButtonClick); settingButtonProperties[i] = new SettingButtonProperties(button, data); controlPanel.ContentControls.Add(button); TextBox textBox = new TextBox(); textBox.Width = button.Left - marginLeft - 2; textBox.Text = setting.Value.ToString(); textBox.GotFocus += new EventHandler(textBox_GotFocus); textBox.LostFocus += new EventHandler(textBox_LostFocus); controls[i] = textBox; break; } default: { throw new Exception("Unknown setting type: " + setting.Type); } } } controls[i].Left = marginLeft; controls[i].Top = marginTop + controlOffset[j]; controlOffset[j] += controls[i].Height + controlSpacing; controlPanel.ContentControls.Add(controls[i]); } // Set the heights of the control panel contents. for (int i = 0; i < controlPanels.Length; i++) controlPanels[i].ContentHeight = controlOffset[i]; }
public void Main(string argument) { try { argument = argument.ToLower(); Echo("Called with '" + argument + "'"); Echo("Scanning for groups"); List <IMyBlockGroup> blockGroups = new List <IMyBlockGroup>(); GridTerminalSystem.GetBlockGroups(blockGroups); Echo("Found " + blockGroups.Count + " groups"); for (int g = 0; g < blockGroups.Count; g++) { if (blockGroups[g].Name.Contains(groupTag)) { var blockGroup = blockGroups[g]; if (!panelSets.ContainsKey(blockGroup.Name)) { var blocks = new List <IMyTextPanel>(); blockGroup.GetBlocksOfType(blocks); if (blocks.Count > 0) { bool configured = false; List <ScrollablePanel> panels = new List <ScrollablePanel>(); for (int i = 0; i < blocks.Count; i++) { var block = blocks[i]; var panelData = new ScrollablePanel(blocks[i]); if (panelData.configured == true) { configured = true; } panels.Add(panelData); } if (configured) { panels.Sort(); panelSets.Add(blockGroup.Name, panels); } else { for (int i = 0; i < panels.Count; i++) { var panelData = panels[i]; if (panelData.index == 0) { panelData.block.WritePublicText(string.Join("", blockGroup.Name, " Auto id#", i + 1)); panelData.index = i + 1; } else { panelData.block.WritePublicText(string.Join("", blockGroup.Name, " id#", panelData.index)); } panelData.block.CustomName = panelData.block.GetPublicText(); panelData.block.ShowPublicTextOnScreen(); panelData.block.SetValueFloat("FontSize", 1f); panelData.write(); } } } } } } Echo("Going to update " + panelSets.Count + " groups"); for (int i = 0; i < panelSets.Count; i++) { } } catch (System.Exception ex) { Echo("I Crashed:\n"); Echo(ex.Message + "\n"); Echo(ex.StackTrace + "\n"); } }
private void HideMenuPanel(ScrollablePanel menuPanel) { menuPanel.Visible = false; }
private void ResizeMenuPanel(ScrollablePanel menuPanel, Size size) { menuPanel.Size = size; foreach (Control control in menuPanel.ContentControls) control.Width = menuPanel.ContentWidth - 4; }
private void ShowMenuPanel(ScrollablePanel menuPanel) { //menuPanel.BringToFront(); menuPanel.Visible = true; }
private Button AddMenuButton(ScrollablePanel menuPanel, string caption, EventHandler click, bool beginGroup) { int offset = menuPanel.ContentHeight; if (offset > 0) offset += beginGroup ? 4 : 2; else offset = 2; Button button = new Button(); button.Text = caption; button.Location = new Point(2, offset); button.Size = new Size(menuPanel.ContentWidth - 4, 30); button.Click += click; menuPanel.ContentControls.Add(button); menuPanel.ContentHeight = button.Bottom; return button; }
private Button AddMenuButton(ScrollablePanel menuPanel, string caption, EventHandler click) { return AddMenuButton(menuPanel, caption, click, false); }
public FormMain() { // Set the resize event handler. resizeEventHandler = new EventHandler(FormMain_Resize); Resize += resizeEventHandler; // // Required for Windows Form Designer support // InitializeComponent(); // Get the window handle. Capture = true; hwnd = OpenNETCF.Win32.Win32Window.GetCapture(); Capture = false; // Add a message filter. ApplicationEx.AddMessageFilter(this); // Load the configuration. executablePath = ApplicationEx.StartupPath; extensionPath = Path.Combine(executablePath, "Extensions"); string iniFileName = Path.Combine(executablePath, "GPSProxy.ini"); if (! File.Exists(iniFileName)) { try { File.Copy(Path.Combine(executablePath, "GPSProxy.ini.default"), iniFileName, false); } catch { } } if (! File.Exists(iniFileName)) using (File.Create(iniFileName)) { } configSource = new IniConfigSource(iniFileName); configSource.Alias.AddAlias("On", true); configSource.Alias.AddAlias("Off", false); configSource.Alias.AddAlias("True", true); configSource.Alias.AddAlias("False", false); if (configSource.Configs["Settings"] == null) configSource.AddConfig("Settings"); configSettings = configSource.Configs["Settings"]; settings["autoStart"].Value = configSettings.GetBoolean("Start Proxy Automatically on Launch", (bool)settings["autoStart"].Value); settings["runExternalApp"].Value = configSettings.GetBoolean("Run External App after Proxy Startup", (bool)settings["runExternalApp"].Value); settings["externalApp"].Value = configSettings.GetString("External Application", (string)settings["externalApp"].Value); settings["autoReconnect"].Value = configSettings.GetBoolean("Reconnect after Power-on", (bool)settings["autoReconnect"].Value); settings["reconnectDelay"].Value = configSettings.GetInt("Power-on Reconnect Delay", (int)settings["reconnectDelay"].Value); // Create the main and page menu panels. mainMenuPanel = new ScrollablePanel(); mainMenuPanel.Visible = false; Controls.Add(mainMenuPanel); mainMenuPanel.Size = pluginPanel.ClientSize; mainMenuPanel.BringToFront(); pageMenuPanel = new ScrollablePanel(); pageMenuPanel.Visible = false; Controls.Add(pageMenuPanel); pageMenuPanel.Size = pluginPanel.ClientSize; pageMenuPanel.BringToFront(); // Add the main menu buttons. AboutButton = AddMenuButton(mainMenuPanel, "About...", new EventHandler(AboutButton_Click)); SettingsButton = AddMenuButton(mainMenuPanel, "Settings...", new EventHandler(SettingsButton_Click), true); ExtensionsButton = AddMenuButton(mainMenuPanel, "Extensions...", new EventHandler(ExtensionsButton_Click)); VirtualComPortsButton = AddMenuButton(mainMenuPanel, "Virtual COM Ports...", new EventHandler(VirtualComPortsButton_Click)); ExitButton = AddMenuButton(mainMenuPanel, "Exit", new EventHandler(ExitButton_Click), true); // Load the extension DLLs. LoadExtensions(); // Activate extensions according to the configuration file. ActivateExtensions(); // NOTE: do not attempt to show an message boxes before this point, as this triggers // other form events that expect the activeExtensions array to have been created. // Load the virtual COM port drivers. virtualComPortRootKey = Registry.LocalMachine.CreateSubKey(@"Drivers\GPSProxyVirtualCOMPorts"); if (virtualComPortRootKey == null) { MessageBox.Show(@"Unable to open/create registry key: " + virtualComPortRootKey.Name, "Error", MessageBoxButtons.OK, MessageBoxIcon.Hand, MessageBoxDefaultButton.Button1); } else { LoadVirtualComPortDrivers(); } // Create and populate the extensions dialog. extensionsDialog = new FormExtensions(); extensionsDialog.ComboBoxProvider.SelectedIndexChanged += new EventHandler(ComboBoxProvider_SelectedIndexChanged); extensionsDialog.ListBoxExtensions.SelectedIndexChanged += new EventHandler(ListBoxExtensions_SelectedIndexChanged); extensionsDialog.ButtonConfigureProvider.Click += new EventHandler(ButtonConfigureProvider_Click); extensionsDialog.ButtonAddExtension.Click += new EventHandler(ButtonAddExtension_Click); extensionsDialog.ButtonRemoveExtension.Click += new EventHandler(ButtonRemoveExtension_Click); extensionsDialog.ButtonConfigureExtension.Click += new EventHandler(ButtonConfigureExtension_Click); RepopulateExtensionsDialog(); // Create and populate the virtual COM port dialog. virtualComPortsDialog = new FormVirtualComPorts(); virtualComPortsDialog.VirtualComPortListBox.SelectedIndexChanged += new EventHandler(VirtualComPortListBox_SelectedIndexChanged); virtualComPortsDialog.ButtonAdd.Click += new EventHandler(ButtonAddVirtualComPort_Click); virtualComPortsDialog.ButtonRemove.Click += new EventHandler(ButtonRemoveVirtualComPort_Click); RepopulateVirtualComPortsDialog(); }
private void InitializeComponent() { this.Text = "Untitled Checklist - Check List Manager"; //this.Size = new Size(640, 480); this.Size = new Size(350, 300); this.MinimumSize = new Size(this.Size.Width, 300); this.AllowDrop = true; this.DragDrop += Form1_DragDrop; this.DragOver += Form1_DragOver; this.KeyDown += Form1_KeyDown; this.KeyUp += Form1_KeyUp; this.StartPosition = FormStartPosition.CenterScreen; this.FormClosing += Form1_FormClosing; PanelBox = new ScrollablePanel(this); PanelBox.Location = new Point(6, 6); PanelBox.BorderStyle = BorderStyle.FixedSingle; PanelBox.Size = new Size(this.ClientSize.Width - (PanelBox.Location.X * 2), this.ClientSize.Height - (PanelBox.Location.Y * 2)); PanelBox.MinimumSize = PanelBox.ClientSize; PanelBox.AllowDrop = true; PanelBox.DragDrop += Form1_DragDrop; PanelBox.DragOver += Form1_DragOver; PanelBox.KeyDown += Form1_KeyDown; PanelBox.KeyUp += Form1_KeyUp; this.Controls.Add(PanelBox); MainMenu menu = new MainMenu(); FileItem = new MenuItem(); FileItem.Text = "File"; NewItem = new MenuItem(); NewItem.Text = "New"; NewItem.Click += NewItem_Click; NewItem.Shortcut = Shortcut.CtrlN; OpenItem = new MenuItem(); OpenItem.Text = "Open..."; OpenItem.Click += OpenItem_Click; OpenItem.Shortcut = Shortcut.CtrlO; SaveItem = new MenuItem(); SaveItem.Text = "Save"; SaveItem.Click += SaveItem_Click; SaveItem.Shortcut = Shortcut.CtrlS; SaveItem.Enabled = false; SaveAsItem = new MenuItem(); SaveAsItem.Text = "Save As..."; SaveAsItem.Click += SaveAsItem_Click; SaveAsItem.Shortcut = Shortcut.CtrlShiftS; ClearRecentFileListItem = new MenuItem(); ClearRecentFileListItem.Text = "Empty Recent Files"; ClearRecentFileListItem.Click += (sender, e) => { settings.ClearRecentFiles(); this.LoadRecentFiles(); }; ExitItem = new MenuItem(); ExitItem.Text = "Exit"; ExitItem.Click += ExitItem_Click; // ToolStripSeparator i = new ToolStripSeparator(); // //i.BarBreak = true; // i.Break = true; ToolsItem = new MenuItem(); ToolsItem.Text = "Tools"; LoadClipboardItem = new MenuItem(); LoadClipboardItem.Text = "Load from Clipboard"; LoadClipboardItem.Click += LoadClipboardItem_Click; OptionsItem = new MenuItem(); OptionsItem.Text = "Options"; AutoSaveItem = new MenuItem(); AutoSaveItem.Text = "Enable Auto Save"; AutoSaveItem.Checked = settings.EnableAutoSave; AutoSaveItem.Click += AutoSaveItem_Click; //AddCheckListHeaderItem = new MenuItem(); //AddCheckListHeaderItem.Text = "Add Check List Header To File"; //AddCheckListHeaderItem.Click += AddCheckListHeaderItem_Click; OptionsItem.MenuItems.Add(AutoSaveItem); ToolsItem.MenuItems.Add(OptionsItem); ToolsItem.MenuItems.Add("-"); ToolsItem.MenuItems.Add(LoadClipboardItem); //ToolsItem.MenuItems.Add(AddCheckListHeaderItem); this.LoadRecentFiles(); menu.MenuItems.Add(FileItem); menu.MenuItems.Add(ToolsItem); this.Menu = menu; }