public Layer(int LAYERINDEX, Timeline TIMELINE, Window WINDOW) : base(WINDOW, Vector2.Zero, new Vector2(15, 25)) { layerIndex = LAYERINDEX; timeline = TIMELINE; label = "Layer " + layerIndex; nameField = new Textfield(WINDOW, new Vector2(6, 55 + 27 * layerIndex), new Vector2(70, 25), label); }
public TestWindow(Vector2 POS, Vector2 DIM) : base(POS, DIM, "Test Window") { testBtn = new Button(click, this, new Vector2(10, 25), new Vector2(90, 25), "click me!"); testField = new Textfield(this, new Vector2(10, 55), new Vector2(220, 25), "click to edit text"); //testslider = new Slider(0, 100, 10, this, new Vector2(20, 120), new Vector2(250, 3), "test"); //testLabel = new Label(this, new Vector2(10, 140), new Vector2(90, 25), "Value: "+testslider.getValue()); }
public override void Update(Vector2 OFFSET) { base.Update(OFFSET); for (int i = 0; i < toolBtns.Count; i++) { toolBtns[i].Update(OFFSET); } int toolIndex = Array.IndexOf(tools, Globals.activeTool); if (toolIndex < 0) { return; } for (int i = 0; i < toolOptions[toolIndex].Count; i++) { if (toolOptions[toolIndex][i].GetType() == typeof(Textfield)) { Textfield textfield = (Textfield)toolOptions[toolIndex][i]; switch (textfield.tag) { case "BrushSize": textfield.Update(OFFSET, ref Globals.canvas.BrushSize); break; case "EraserSize": textfield.Update(OFFSET, ref Globals.canvas.EraserSize); break; } } else { toolOptions[toolIndex][i].Update(OFFSET); } } }
private void CreateUIHelpPage() { var page = new DisplayContainer(); Pages.Add(page); float y = 40; float x = Screen.Width * 0.3f; var helpTexture = Vrax.Game.AssetCache.Get <Texture>("uihelp.png"); if (helpTexture == null) { helpTexture = Vrax.Game.AssetCache.LoadTexture("uihelp.png"); } var img = new Image(helpTexture) { Parent = page, Position = new Point(Screen.Half.Width, y), Anchor = new Distance(0.5f, 0) }; y += img.Size.Y + 30; var tf = new Textfield(HelpFont, "Objective: Kill enemies to advance your Wave Level. Different enemies spawn on different waves. The higher the wave level, the harder and much worse your life will be.") { Parent = page, MaxWidth = 600, Position = new Point(Screen.Width * 0.2f, y) }; }
public void TextFieldTry() { Textfield tf = new Textfield(); var cr = new Common.Region(); cr.Add(tf.DisplayRectangle); tf.Draw(GetSDXContext.GetDrawer(), cr); }
public void AddTileset() { List<MenuComponent> options = new List<MenuComponent>(); Textfield path = new Textfield(new Rectangle(), "path", "addTileset"); options.Add(path); foreach (var textfield in options) textfield.Click += new EventHandler(this.OnClick); Interface.addComponent(new OptionPane("Enter the path below", options, "")); }
public void TextFieldTest() { Textfield tf = new Textfield(); tf.DisplayRectangle = new Rectangle(0, 0, 50, 50); Region rg = new Region(); rg.Add(tf.DisplayRectangle); tf.DrawBase(new MockIDraw(udraw), rg); }
private void CreateControlsPage() { var page = new DisplayContainer(); Pages.Add(page); float y = 40; float x = Screen.Width * 0.3f; var tf = new Textfield(HelpFont, "Controls") { Parent = page, Position = new Point(Screen.Half.Width, y), Anchor = new Distance(0.5f, 0), Scale = new Distance(1.5f, 1.5f), Align = TextAlign.Center }; y += tf.TextSize.Height + 20; tf = new Textfield(HelpFont, "Movement: WASD or Arrow keys") { Parent = page, Position = new Point(x, y) }; y += tf.TextSize.Height + 10; tf = new Textfield(HelpFont, "M: Turn off music") { Parent = page, Position = new Point(x, y) }; y += tf.TextSize.Height + 10; tf = new Textfield(HelpFont, "Prev Ship: Q") { Parent = page, Position = new Point(x, y) }; y += tf.TextSize.Height + 10; tf = new Textfield(HelpFont, "Next Ship: E") { Parent = page, Position = new Point(x, y) }; y += tf.TextSize.Height + 10; tf = new Textfield(HelpFont, "Fire: Spacebar or Left Mouse Button") { Parent = page, Position = new Point(x, y) }; y += tf.TextSize.Height + 10; }
private void CreateAboutPage() { var page = new DisplayContainer(); Pages.Add(page); var tf = new Textfield(HelpFont, "This game was made completely in 48 hours by Mark Troyer on Dec 1-3, 2017 for the Ludum Dare 40 Compo. I had fun making it and I hope you enjoy playing it!") { Parent = page, Position = Screen.Half, Anchor = Distance.Center, MaxWidth = (int)(Screen.Width * 0.8f) }; }
public NewWindow() : base(new Vector2(Globals.screenWidth / 2 - 125, Globals.screenHeight / 2 - 70), new Vector2(250, 140), "New") { popupWindow = true; ProjName = new Textfield(this, new Vector2(55, 30), new Vector2(183, 25), "MyProject"); canvasX = new Textfield(this, new Vector2(55, 60), new Vector2(57, 25), "") { numberField = true, defaultContent = "100" }; canvasY = new Textfield(this, new Vector2(180, 60), new Vector2(57, 25), "") { numberField = true, defaultContent = "100" }; cancelBtn = new Button(cancel, this, new Vector2(127, 105), new Vector2(60, 25), "Cancel"); OKBtn = new Button(OK, this, new Vector2(197, 105), new Vector2(40, 25), "OK"); }
public void OnClick(object sender, EventArgs e) { currentEditorMode = EditorMode.Default; if(sender is Button) { Button b = (Button)sender; if (b.command == "layer-") ChangeLayer(currentLayerID - 1); if (b.command == "layer+") ChangeLayer(currentLayerID + 1); if (b.command == "removelayer") RemoveLayer(); if (b.command == "addlayer") AddLayer(); if (b.command == "addLayerForeGround") AddLayer(true); if (b.command == "addLayerBackGround") AddLayer(false); if (b.command == "tileset-") ChangeTileset(currentTilesetID - 1); if (b.command == "tileset+") ChangeTileset(currentTilesetID + 1); if (b.command == "newTileset") AddTileset(); if (b.command == "addCollision") { currentEditorMode = EditorMode.ObjectAdd; currentObjectAddmode = ObjectAddMode.Collision; } if (b.command == "removeobjects") currentEditorMode = EditorMode.ObjectEdit; //if (b.command == "add") objectadd = true; if (b.command == "bfground") { if (b.text.StartsWith("B")) editorBackground = false; else editorBackground = true; ChangeLayer(0); } if (b.command == "refreshtileset") { TilesetView.Position = new Vector2(0, 0); TilesetView.Zoom = 1f; } if (b.command == "addentity") { currentEditorMode = EditorMode.EntityAdd; } } if (sender is Textfield) { Textfield t = (Textfield)sender; if (t.command == "addTileset") AddTileset(t.text); } }
public TextFieldDemoSlashTest(IPlatform plt) : base(plt) { Size = new Size(300, 300); TFc tc = new TFc() { Size = new Size(400, 200) }; Textfield tf = new Textfield() { Size = new Size(300, 50), layout = Textfield.LayoutStyle.OneLine, Location = new Point(30, 100) }; tc.components.Add(tf); components.Add(tc); }
private void OnPlayerDestroyed(Entity obj) { var display = Vrax.Game.Display; var screen = Vrax.Game.Screen; var gameOverText = new Textfield(DefaultFont, "GAME OVER") { Parent = display, Position = screen.Half, Anchor = Distance.Center, Color = Color.Alpha(0) }; Vrax.Game.Animator.AddSequence(new[] { gameOverText.ColorTo(Color.White, 800), new DelayTween(2500), new ActionTween(() => gameOverText.Parent = null), new ActionTween(ReturnToMenu) }); }
public PlaybackWindow(Vector2 POS, Vector2 DIM) : base(POS, DIM, "Playback") { playBtn = new Button(play, this, new Vector2(10, 25), new Vector2(40, 25), "play"); backBtn = new Button(back, this, new Vector2(55, 25), new Vector2(40, 25), "back"); fpsTxt = new Textfield(this, new Vector2(38, 55), new Vector2(57, 25), "1") { defaultContent = "0" }; startFrameTxt = new Textfield(this, new Vector2(200, 25), new Vector2(57, 25), "") { defaultContent = "0" }; endFrameTxt = new Textfield(this, new Vector2(200, 55), new Vector2(57, 25), "") { defaultContent = "0" }; startFrameTxt.numberField = true; endFrameTxt.numberField = true; fpsTxt.numberField = true; timer = new ETimer(1200); }
public void Awake() { namefield = new Textfield(); }
private void CreateUI() { UILayer = new DisplayContainer() { Parent = Display }; var title = new Textfield(DefaultFont, "Begin!") { Parent = UILayer, Position = new Point(Screen.Half.Width, -50), Anchor = Distance.Center }; Vrax.Game.Animator.AddSequence(new[] { title.MoveTo(new Point(Screen.Half.Width, Screen.Half.Height * 0.4f), 800, Ease.BounceOut), new DelayTween(1500), title.MoveRelative(new Distance(-Screen.Width, 0), 1500, Ease.CubicOut), new ActionTween(() => title.Parent = null) }); HealthFrame = MainAtlas.GetFrame("health.png"); HealthOffset = new Distance(DefaultFont.GetTextWidth("HP:") + 12, 9); TransformFrame = MainAtlas.GetFrame("transform.png"); TransformOffset = new Distance(DefaultFont.GetTextWidth("TX:") + 12, 35); MeterHolder = new Image(MainAtlas.GetFrame("meterholder.png")) { Parent = UILayer, FixedSize = new Size(171, 40), Position = new Point((Screen.Width - 171) * 0.5f, Screen.Height - 50) }; Meter = new Image(MainAtlas.GetFrame("meter.png")) { Parent = UILayer, Position = MeterHolder.Position + new Distance(5, 5), FixedSize = new Size(0, MeterHeight) }; KillCounterTextfield = new Textfield(DefaultFont, "0") { Parent = UILayer, Position = new Point(Screen.Half.Width, MeterHolder.Position.Y + 5), Color = Color.Black, Align = TextAlign.Center, Anchor = new Distance(0.5f, 0) }; Spawner.KillCountChanged += OnKillCountChanged; var counterHolder = new Image(MainAtlas.GetFrame("meterholder.png")) { Parent = UILayer, FixedSize = new Size(45, 40), Position = MeterHolder.Position - new Distance(55, 0) }; LevelCounterTextfield = new Textfield(DefaultFont, "0") { Parent = UILayer, Position = counterHolder.Position + new Distance(22, 5), Color = Color.Black, Align = TextAlign.Center, Anchor = new Distance(0.5f, 0) }; // Shield counter ShieldImage = new Image(MainAtlas.GetFrame("shieldicon.png")) { Parent = UILayer, Position = MeterHolder.Position + new Distance(MeterWidth + 40, 20), Anchor = Distance.Center, Color = Color.None }; ShieldCounter = new Textfield(DefaultFont, "0") { Parent = UILayer, Position = ShieldImage.Position, Anchor = Distance.Center, Scale = new Distance(0.5f, 0.5f), Color = Color.None }; }
public MenuState(EntityFactory factory) { Factory = factory; Display = new DisplayContainer() { Parent = Vrax.Game.Display }; var assetCache = Vrax.Game.AssetCache; var titleTexture = assetCache.Get <Texture>("Title.png"); TitleImage = new Image(titleTexture) { Parent = Display, Anchor = new Distance(0.5f, 0), Position = new Point(Screen.Half.Width, 30) }; AnimateTitle(); var font = assetCache.Get <Font>("DefaultFont.fnt"); var menuOptions = new List <(string label, Action callback)>() { ("Play", OnPlayPressed), ("Toggle Music", OnToggleMusic), ("Help", OnHelpPressed), }; var textColor = Color.FromRGB(0xbbbbbb); int y = 180; for (int i = 0; i < menuOptions.Count; i++) { var tf = new Textfield(font, menuOptions[i].label) { Parent = Display, Position = new Point(Screen.Half.Width - 90, y + (i * 60)), Color = textColor }; var button = new TextButton( new TextButton.State() { Scale = 1f, Color = textColor }, new TextButton.State() { Scale = 1f, Color = Color.White }, new TextButton.State() { Scale = 0.95f, Color = textColor }); button.ClickEvent += menuOptions[i].callback; tf.Attach(button); } new Textfield(font, "Ludum Dare 40 \"The more you have, the worse it is.\"") { Parent = Display, Scale = new Distance(0.5f, 0.5f), Position = Screen, Anchor = Distance.One, Align = TextAlign.Right }; }
private void _initGUI() { this._scrollView = new Scrollview(this, new Rect(10, 10, Screen.width - 20, Screen.height - 20), root, new Rect(0, 0, 4000, 4000)); this._controllList = new Scrollview(this, new Rect(0, 0, 100, Screen.height - 20), root, new Rect(0, 100, 100, 800)); this._controllList.textureBg = null; root.AddChild(this._controllList); root.AddChild(this._scrollView); //btn save Vector2 ptStart = new Vector2(10, 10); Button btnSave = new Button("保存", this, new Rect(ptStart.x, ptStart.y, 70, 32), this.root); btnSave.OnClick = new Button.ButtonDelegate(OnBtnSaveClick); root.AddChild(btnSave); //btn create Button btnCreate = new Button("新建", this, new Rect(ptStart.x + 100, ptStart.y, 70, 32), this.root); btnCreate.OnClick = new Button.ButtonDelegate(OnBtnCreateClick); root.AddChild(btnCreate); ptStart.y += 32 + 15; //ddl projects string[] directoryEntries = System.IO.Directory.GetFileSystemEntries("Assets/Editor/BTEditor/Projects"); foreach (string str in directoryEntries) { if (str.EndsWith(".json")) { this._lstProjects.Add(str); } } if (this._lstProjects.Count > 0) { Rect rcDDL = new Rect(ptStart.x, ptStart.y, 180, 20); DropdownList <string> ddlProj = new DropdownList <string>(this, rcDDL, root, this._lstProjects, 0); ddlProj.OnSelectChange = new DropdownList <string> .DropDownListDelegate(OnSelProjChange); root.AddChild(ddlProj); ptStart.y += 20 + 2; } //file name Rect rcLable = new Rect(ptStart.x, ptStart.y, 50, 20); root.AddChild(new Label("文件名:", this, rcLable, root)); Rect rcFileName = new Rect(ptStart.x + 50, ptStart.y, 130, 20); this._tfFileName = new Textfield("", this, rcFileName, root); root.AddChild(this._tfFileName); ptStart.y += 20 + 5; //agent category Rect rcAgent = new Rect(ptStart.x, ptStart.y, 50, 20); root.AddChild(new Label("Agent:", this, rcAgent, root)); Rect rcDDLAgent = new Rect(ptStart.x + 50, ptStart.y, 100, 20); this.DDLAgent = new DropdownList <string>(this, rcDDLAgent, root, this._lstAgents, 0); root.AddChild(this.DDLAgent); ptStart.y += 20 + 15; //load firest proj if (this._lstProjects.Count > 0) { string firstCfg = this._lstProjects[0]; this._loadProject(firstCfg); } //entry Button btnEntry = new Button("入口节点", this, new Rect(10, ptStart.y, 150, 22), this.root); btnEntry.OnClick = new Button.ButtonDelegate(OnBtnEntryClick); _controllList.AddChild(btnEntry); ptStart.y += 22 + 5; _controllList.AddChild(new Label("动作节点:", this, new Rect(ptStart.x, ptStart.y, 150, 22), this.root)); ptStart.y += 20; //task Button btnTask = new Button("任务节点", this, new Rect(10, ptStart.y, 150, 22), this.root); btnTask.OnClick = new Button.ButtonDelegate(OnBtnTaskClick); _controllList.AddChild(btnTask); ptStart.y += 22 + 5; _controllList.AddChild(new Label("组合节点:", this, new Rect(ptStart.x, ptStart.y, 150, 22), this.root)); ptStart.y += 20; //sequenct Button btnSequence = new Button("顺序节点", this, new Rect(10, ptStart.y, 150, 22), this.root); btnSequence.OnClick = new Button.ButtonDelegate(OnBtnSequenceClick); _controllList.AddChild(btnSequence); ptStart.y += 22 + 5; //randomsequence Button btnRandonSequence = new Button("随机序列", this, new Rect(10, ptStart.y, 150, 22), this.root); btnRandonSequence.OnClick = new Button.ButtonDelegate(OnBtnRandomSequenceClick); _controllList.AddChild(btnRandonSequence); ptStart.y += 22 + 5; //priority Button btnPriority = new Button("优先节点", this, new Rect(10, ptStart.y, 150, 22), this.root); btnPriority.OnClick = new Button.ButtonDelegate(OnBtnPriorityClick); _controllList.AddChild(btnPriority); ptStart.y += 22 + 5; //parallel Button btnParallel = new Button("并行节点", this, new Rect(10, ptStart.y, 150, 22), this.root); btnParallel.OnClick = new Button.ButtonDelegate(OnBtnParallelClick); _controllList.AddChild(btnParallel); ptStart.y += 22 + 5; //randomselector Button btnRandom = new Button("随机节点", this, new Rect(10, ptStart.y, 150, 22), this.root); btnRandom.OnClick = new Button.ButtonDelegate(OnBtnRandomClick); _controllList.AddChild(btnRandom); ptStart.y += 22 + 5; //weightselector Button btnWeight = new Button("权重节点", this, new Rect(10, ptStart.y, 150, 22), this.root); btnWeight.OnClick = new Button.ButtonDelegate(OnBtnWeightClick); _controllList.AddChild(btnWeight); ptStart.y += 22 + 5; //conditionselector Button btnCondition = new Button("条件节点", this, new Rect(10, ptStart.y, 150, 22), this.root); btnCondition.OnClick = new Button.ButtonDelegate(OnBtnConditionClick); _controllList.AddChild(btnCondition); ptStart.y += 22 + 5; //logic Button btnLogic = new Button("逻辑节点", this, new Rect(10, ptStart.y, 150, 22), this.root); btnLogic.OnClick = new Button.ButtonDelegate(OnBtnLogicClick); _controllList.AddChild(btnLogic); ptStart.y += 22 + 5; //subtree Button btnTree = new Button("子树节点", this, new Rect(10, ptStart.y, 150, 22), this.root); btnTree.OnClick = new Button.ButtonDelegate(OnBtnSubTreeClick); _controllList.AddChild(btnTree); ptStart.y += 22 + 5; _controllList.AddChild(new Label("装饰:", this, new Rect(ptStart.x, ptStart.y, 150, 22), this.root)); ptStart.y += 20; //loop Button btnLoop = new Button("循环节点", this, new Rect(10, ptStart.y, 150, 22), this.root); btnLoop.OnClick = new Button.ButtonDelegate(OnBtnLoopClick); _controllList.AddChild(btnLoop); ptStart.y += 22 + 5; //loopuntil Button btnLoopUtl = new Button("循环直到", this, new Rect(10, ptStart.y, 150, 22), this.root); btnLoopUtl.OnClick = new Button.ButtonDelegate(OnBtnLoopUntilClick); _controllList.AddChild(btnLoopUtl); ptStart.y += 22 + 5; //monitor Button btnMonitor = new Button("监控节点", this, new Rect(10, ptStart.y, 150, 22), this.root); btnMonitor.OnClick = new Button.ButtonDelegate(OnBtnMonitorClick); _controllList.AddChild(btnMonitor); ptStart.y += 22 + 5; //inverter Button btnInverter = new Button("取反节点", this, new Rect(10, ptStart.y, 150, 22), this.root); btnInverter.OnClick = new Button.ButtonDelegate(OnBtnInverterClick); _controllList.AddChild(btnInverter); ptStart.y += 22 + 5; //retfail Button btnFail = new Button("失败节点", this, new Rect(10, ptStart.y, 150, 22), this.root); btnFail.OnClick = new Button.ButtonDelegate(OnBtnFailClick); _controllList.AddChild(btnFail); ptStart.y += 22 + 5; //retsuccess Button btnSuccess = new Button("成功节点", this, new Rect(10, ptStart.y, 150, 22), this.root); btnSuccess.OnClick = new Button.ButtonDelegate(OnBtnSuccessClick); _controllList.AddChild(btnSuccess); ptStart.y += 22 + 5; //retrunning Button btnRetRunning = new Button("运行中节点", this, new Rect(10, ptStart.y, 150, 22), this.root); btnRetRunning.OnClick = new Button.ButtonDelegate(OnBtnRetrunningClick); _controllList.AddChild(btnRetRunning); ptStart.y += 22 + 5; //utlfail Button btnUtilFail = new Button("直到失败节点", this, new Rect(10, ptStart.y, 150, 22), this.root); btnUtilFail.OnClick = new Button.ButtonDelegate(OnBtnUtilFailClick); _controllList.AddChild(btnUtilFail); ptStart.y += 22 + 5; //utlsuccess Button btnUtilSuc = new Button("直到成功节点", this, new Rect(10, ptStart.y, 150, 22), this.root); btnUtilSuc.OnClick = new Button.ButtonDelegate(OnBtnUtilSucClick); _controllList.AddChild(btnUtilSuc); ptStart.y += 22 + 5; //persistwhile Button btnPersist = new Button("持续时间", this, new Rect(10, ptStart.y, 150, 22), this.root); btnPersist.OnClick = new Button.ButtonDelegate(OnBtnPersistWhileClick); _controllList.AddChild(btnPersist); ptStart.y += 22 + 5; //countlimit Button btnCountLimit = new Button("持续次数", this, new Rect(10, ptStart.y, 150, 22), this.root); btnCountLimit.OnClick = new Button.ButtonDelegate(OnBtnCountLimitClick); _controllList.AddChild(btnCountLimit); ptStart.y += 22 + 5; }
public void CreateAttributes(Tuple <XModule, XModuleAttribute, bool> modulePack, IHTMLElement node) { switch (node.tagName) { case "INPUT": string type = node.getAttribute("type", 0); switch (type) { case "text": case "password": var textfield = new Textfield(); textfield.SetupAttributes(modulePack, node); break; case "checkbox": var checkbox = new Checkbox(); checkbox.SetupAttributes(modulePack, node); break; case "hidden": var hidden = new HiddenInput(); hidden.SetupAttributes(modulePack, node); break; case "submit": case "reset": case "button": var newButton = new InternalObjects.Button(); newButton.SetupAttributes(modulePack, node); break; } break; case "select": var combobox = new Combobox(); combobox.SetupAttributes(modulePack, node); break; case "A": var newLink = new Link(); newLink.SetupAttributes(modulePack, node); break; case "table": var newTable = new Table(); newTable.SetupAttributes(modulePack, node); /*var subAttributeRow = mainModule.CreateModuleAttribute(); * newTable.SetupRowAttributes(subAttributeRow, node); * * var subAttributeCellforRow = subAttributeRow.CreateModuleAttribute(); * newTable.SetupCellAttributes(subAttributeCellforRow, node); * * var subAttributeCol = mainModule.CreateModuleAttribute(); * newTable.SetupColAttributes(subAttributeCol, node); * * var subAttributeCellforCol = subAttributeCol.CreateModuleAttribute(); * newTable.SetupCellAttributes(subAttributeCellforCol, node);*/ break; } }
public void LoadContent(ContentManager content) { _font = content.Load<SpriteFont>("LogFont"); _textField = new Textfield(_font, 125); }