public override void onAdd() { this.createMenuBar(); ObjectCreator oc = new ObjectCreator("GuiPanel"); oc["internalName"] = "DocumentContainer"; GuiPanel panel = oc.Create(); this.setContent(panel); int xOffset = 20; int yOffset = 20; for (int i = 0; i < 10; i++) { ObjectCreator oc1 = new ObjectCreator("GuiWindowCtrl"); oc["extent"] = "200 100"; oc["position"] = xOffset + ' ' + yOffset; GuiWindowCtrl window = oc1.Create(); panel.add(window); xOffset += 30; yOffset += 30; } }
protected override void OnInitialize(object enterInformation) { _panel = new GuiPanel(Game); var frame = Game.GuiSystem.CreateGuiHierarchyFromXml <Frame>("GuiSkin\\InputBoxes.xml"); _panel.AddElement(frame); }
public LogInForm() { InitializeComponent(); // Add logic for when the user interacts with the verify screen sms_gui.btn_Verify.MouseUp += (sender, e) => { (var success, var challenge) = Broker.Instance.ChallengeResponse(currChallenge.challenge.id, sms_gui.txt_SMS_Code.Text); if (success) { if (challenge.challenge.status == "validated") { challengeID = challenge.challenge.id; GuiPanel.Controls.Remove(sms_gui.smsVerifyPanel); ErrorLabel.Text = "Success! You can now sign in!!!"; GuiPanel.Refresh(); } else { ErrorLabel.Text = "Error: Invalid pin: " + challenge.challenge.remaining_retries + " retries left"; GuiPanel.Refresh(); } } else { ErrorLabel.Text = "Error: Invalid pin: " + challenge.challenge.remaining_retries + " retries left"; GuiPanel.Refresh(); } }; }
/// <summary> /// Metoda načte všechny tabulky typu <see cref="GuiGrid"/> z dodaného <see cref="GuiPanel"/> a vloží je do dodaného vizuálního objektu <see cref="GGrid"/>. /// Současně je ukládá do <see cref="_DataTableList"/>. /// </summary> /// <param name="guiPanel"></param> /// <param name="gGrid"></param> /// <returns></returns> private bool _LoadDataToGrid(GuiPanel guiPanel, GGrid gGrid) { if (guiPanel == null || guiPanel.Grids.Count == 0) { return(false); } if (gGrid.SynchronizedTime == null) { gGrid.SynchronizedTime = this.SynchronizedTime; } gGrid.Name = guiPanel.FullName + "\\" + _GRID_MAIN_NAME; // Fullname gridu slouží jako ID do konfigurace pro data o layoutu sloupců v gridu this._GGridList.Add(gGrid); // Toto je seznam GRIDŮ. A v této metodě se pracuje jen s jedním gridem. foreach (GuiGrid guiGrid in guiPanel.Grids) { MainDataTable mainDataTable = this._LoadDataToMainTable(gGrid, guiGrid); if (mainDataTable == null) { continue; } } return(true); }
/// <summary> /// Metoda načte všechny tabulky typu <see cref="GuiGrid"/> z dodaného <see cref="GuiPanel"/> a vloží je jako nové Taby do dodaného vizuálního objektu <see cref="TabContainer"/>. /// Současně je ukládá do <see cref="_DataTableList"/>. /// </summary> /// <param name="guiPanel"></param> /// <param name="tabs"></param> /// <returns></returns> private bool _LoadDataToTabs(GuiPanel guiPanel, TabContainer tabs) { if (guiPanel == null || guiPanel.Grids.Count == 0) { return(false); } foreach (GuiGrid guiGrid in guiPanel.Grids) { GGrid gGrid = new GGrid(); gGrid.SynchronizedTime = this.SynchronizedTime; gGrid.Name = guiGrid.FullName; // Fullname gridu slouží jako ID do konfigurace pro data o layoutu sloupců v gridu MainDataTable mainDataTable = this._LoadDataToMainTable(gGrid, guiGrid); if (mainDataTable == null) { continue; } tabs.AddTabItem(gGrid, guiGrid.Title, guiGrid.ToolTip); this._GGridList.Add(gGrid); // Toto je seznam GRIDŮ. A v této metodě se pracuje více gridy - jedna smyčka = jeden grid } return(true); }
protected override void OnInitialize(object enterInformation) { base.OnInitialize(enterInformation); _panel = new GuiPanel(Game); _connectToServerFrame = Game.GuiSystem.CreateGuiHierarchyFromXml <GuiElement>("Content/GuiLayouts/NetworkGame_Layout.xml"); _connectToServerFrame.FindGuiElementById <Button>("ConnectButton").Click += OnConnect; _connectToServerFrame.FindGuiElementById <Button>("BackButton").Click += OnBack; _panel.AddElement(_connectToServerFrame); _waitDialog = Game.GuiSystem.CreateGuiHierarchyFromXml <Frame>("Content/GuiLayouts/WaitDialog.xml"); _waitDialog.IsActive = false; _waitDialog.Title = string.Empty; _waitDialog.FindGuiElementById <TextBlock>("MessageText").Text = "Connecting to Server..."; _panel.AddElement(_waitDialog); _errorDialog = Game.GuiSystem.CreateGuiHierarchyFromXml <Frame>("Content/GuiLayouts/ConfirmationDialog.xml"); _errorDialog.IsActive = false; _errorDialog.Title = string.Empty; _errorDialog.Color = Color.Red; _errorDialog.FindGuiElementById <Button>("ConfirmButton").Click += () => { _errorDialog.IsActive = false; _connectToServerFrame.IsActive = true; }; _panel.AddElement(_errorDialog); _gameCreationSession = new RemoteGameCreationSession(Game); }
private void Initialize() { buttonCreate = new GuiButton() { Size = new Vector2(130, 10), Location = new Vector2(0, 10), Text = "New Game" }; buttonCreate.OnClick += new EventHandler <EventArgs>(button_OnClick); AddControl(buttonCreate); GuiPanel panel = new GuiPanel() { Size = new Vector2(110, 10), Location = new Vector2(20, 30) }; label = new GuiLabel() { Size = new Vector2(0, 0), Location = new Vector2(0, 0), Center = true, Text = "", Color = new Vector4(0.7f, 0.7f, 0.7f, 1) }; panel.AddControl(label); AddControl(panel); buttonGenerator = new GuiButton() { Size = new Vector2(10, 10), Location = new Vector2(0, 30), Text = "=" }; buttonGenerator.OnClick += new EventHandler <EventArgs>(buttonGenerator_OnClick); AddControl(buttonGenerator); DataBind(); }
static void OnDrawRootGizmo(GuiPanel panel, GizmoType gizmoType) { if (panel.enabled && panel.ClipType == GuiPanelClipType.Range) { Gizmos.color = (gizmoType & GizmoType.InSelectionHierarchy) != 0 ? Color.red : new Color (0.5f, 0f, 0f); Gizmos.DrawWireCube (panel.transform.position, new Vector3 (panel.ClipWidth, panel.ClipHeight, 0f)); } }
private void Login_Click(object sender, EventArgs e) { (var success, var challenge) = Broker.Instance.SignIn(Username.Text, Password.Text, deviceToken, challengeID); if (challenge == null) { ErrorLabel.Text = "Error: Robinhood appears to have changed their login API, or there is an error with ours"; GuiPanel.Refresh(); } else if (!success && challenge.challenge.status == "issued") { currChallenge = challenge; GuiPanel.Controls.Add(sms_gui.smsVerifyPanel); GuiPanel.Refresh(); } else { Password.Text = ""; if (!Broker.Instance.IsSignedIn()) { ErrorLabel.Text = "Error: Invalid username or password"; GuiPanel.Refresh(); } } }
protected override void OnInitialize(object enterInformation) { base.OnInitialize(enterInformation); _currentLevelIndex = 0; _levelNames = GetLocalLevelNames().ToArray(); _panel = new GuiPanel(Game); var frame = Game.GuiSystem.CreateGuiHierarchyFromXml <GuiElement>("Content/GuiLayouts/LocalGameConfig_Layout.xml"); _panel.AddElement(frame); _playerCountTextBlock = frame.FindGuiElementById <TextBlock>("PlayerCountText"); _comCountTextBlock = frame.FindGuiElementById <TextBlock>("ComCountText"); _levelNameTextBlock = frame.FindGuiElementById <TextBlock>("CurrentLevelText"); _currentTimeTextBlock = frame.FindGuiElementById <TextBlock>("CurrentTimeText"); _playerCountTextBlock.Text = _playerCount.ToString(CultureInfo.InvariantCulture); _comCountTextBlock.Text = _comPlayerCount.ToString(CultureInfo.InvariantCulture); _levelNameTextBlock.Text = _levelNames[_currentLevelIndex]; _currentTimeTextBlock.Text = string.Format("{0:00}:{1:00}", _matchTimeSeconds / 60, _matchTimeSeconds % 60); frame.FindGuiElementById <Button>("DecreasePlayerCountButton").Click += () => OnChangePlayerCount(false); frame.FindGuiElementById <Button>("IncreasePlayerCountButton").Click += () => OnChangePlayerCount(true); frame.FindGuiElementById <Button>("DecreaseComCountButton").Click += () => OnChangeComCount(false); frame.FindGuiElementById <Button>("IncreaseComCountButton").Click += () => OnChangeComCount(true); frame.FindGuiElementById <Button>("PreviousLevelButton").Click += () => OnChangeLevel(false); frame.FindGuiElementById <Button>("NextLevelButton").Click += () => OnChangeLevel(true); frame.FindGuiElementById <Button>("DecreaseTimeButton").Click += () => OnChangeTime(false); frame.FindGuiElementById <Button>("IncreaseTimeButton").Click += () => OnChangeTime(true); frame.FindGuiElementById <Button>("StartGameButton").Click += StartLocalGame; frame.FindGuiElementById <Button>("BackButton").Click += () => { _stateChangeInformation = StateChangeInformation.StateChange(typeof(MainMenuState), typeof(BlendTransition)); }; }
protected virtual void OnDisable() { if (GuiSystem.IsInstanceCreated()) { GuiSystem.Instance.RemoveEventReceiver(this); } _visualPanel = null; }
static void OnDrawRootGizmo(GuiPanel panel, GizmoType gizmoType) { if (panel.enabled && panel.ClipType == GuiPanelClipType.Range) { Gizmos.color = (gizmoType & GizmoType.InSelectionHierarchy) != 0 ? Color.red : new Color(0.5f, 0f, 0f); Gizmos.DrawWireCube(panel.transform.position, new Vector3(panel.ClipWidth, panel.ClipHeight, 0f)); } }
/// <summary> /// Force reset cached parent panel reference. /// </summary> public void ResetPanel() { SetDirty(GuiDirtyType.Panel); if ((System.Object)_visualPanel != null) { _visualPanel.RemoveOnChangeListener(this); _visualPanel = null; } }
/// <summary> /// Force reset cached parent panel reference. /// </summary> public void ResetPanel() { SetDirty(GuiDirtyType.Panel); if (_visualPanel) { _visualPanel.OnChanged -= OnPanelChanged; } _visualPanel = null; }
internal override void OnLoad() { // init code here.. guiFuel = CreateAndBindGuiSlot(furnace.Fuel, 0, 5); guiInput = CreateAndBindGuiSlot(furnace.Input, 0, 7); guiProduct = CreateAndBindGuiSlot(furnace.Product, 2, 6); furnace.Progress += new EventHandler(furnace_Progress); furnace.Changed += new EventHandler(furnace_Changed); base.OnLoad(); }
private void Initialize() { for (int i = 0; i < 4; i++) { int x = i % 2; int y = i / 2; guiCraftingSlots[i] = CreateAndBindGuiSlot(craftingTable.Grid[y * 3 + x], x, 6 - y); } guiProduct = CreateAndBindGuiSlot(craftingTable.Product, 3, 5); }
void OnPanelChanged(GuiPanel panel) { if (_visualPanel != panel) { ResetPanel(); } else { UpdateVisuals(GuiDirtyType.None); } }
private void Initialize() { for (int i = 0; i < 9; i++) { int x = i % 3; int y = i / 3; guiCraftingSlots[i] = CreateAndBindGuiSlot(craftingTable.Grid[y * 3 + x], x, 7 - y); } guiProduct = CreateAndBindGuiSlot(craftingTable.Product, 4, 6); }
/// <summary> /// Reset or update content dependent on panel value. /// </summary> /// <param name="panel">Panel.</param> public void ValidatePanel(GuiPanel panel) { if (_visualPanel != panel) { ResetPanel(); } else { UpdateVisuals(GuiDirtyType.None); } }
public List <GuiElement> addPanel(string name, Rectangle rectangle, GuiElement parent, Layer layer, GuiColor panelColor = null, float FadeIn = 0, float FadeOut = 0, GuiText text = null, string imgName = null, Blur blur = Blur.none) { if (string.IsNullOrEmpty(name)) { name = "panel"; } purgeDuplicates(name); List <GuiElement> panel = GuiPanel.GetNewGuiPanel(plugin, name, rectangle, parent, layer, panelColor, FadeIn, FadeOut, text, imgName, blur); AddRange(panel); return(panel); }
protected override void OnInitialize(object enterInformation) { _root = new GuiPanel(Game); var root = Game.GuiSystem.CreateGuiHierarchyFromXml <GuiElement>("GuiSkin/StartStateLayout.xml"); _root.AddElement(root); SetButtonTransitionTo(root, "StackPanelWithFrameButton", typeof(StackPanelWithFrame)); SetButtonTransitionTo(root, "GridTestButton", typeof(GridTest)); SetButtonTransitionTo(root, "TextBoxTestButton", typeof(InputGuiTestState)); SetButtonTransitionTo(root, "ScrollViewerTestButton", typeof(ScrollViewerState)); }
private void setView(GuiPanel view) { foreach (var planetView in new GuiPanel[] { this.siteView, this.emptyPlanetView }) { if (planetView.Equals(view)) { this.ShowElement(planetView); } else { this.HideElement(planetView); } } }
public override void Draw(GameTime time) { if (IsLoaded) { foreach (DrawableGameComponent component in Components) { component.Draw(time); } GuiPanel.Draw(time); base.Draw(time); } }
protected override void OnInitialize(object enterInformation) { base.OnInitialize(enterInformation); _panel = new GuiPanel(Game); var frame = Game.GuiSystem.CreateGuiHierarchyFromXml <Frame>("Content/GuiLayouts/Credits_Layout.xml"); frame.FindGuiElementById <Button>("BackButton").Click += () => { _stateChangeInformation = StateChangeInformation.StateChange(typeof(MainMenuState), typeof(BlendTransition)); }; _panel.AddElement(frame); }
void slot_OnClick(object sender, EventArgs e) { bool pickingUp = stackInHand.IsEmpty; bool leftMouse = Input.Instance.CurrentInput.MouseState.IsPressed(0); bool rightMouse = !leftMouse; // setup variables GuiPanel guiSelectedSlot = (GuiPanel)sender; GuiStackControl guiSelectedStack = (GuiStackControl)guiSelectedSlot.Controls[0]; Slot selectedSlot = (Slot)guiSelectedSlot.Tag; // return if there is nothing to pick up if (pickingUp && selectedSlot.IsEmpty) { return; } if (pickingUp) { if (!OnPickUp(guiSelectedSlot, guiSelectedStack, selectedSlot)) { int transferCount = leftMouse ? selectedSlot.Content.Count : selectedSlot.Content.Count / 2; selectedSlot.Content.TransferEntities(stackInHand, transferCount); BindControl(guiStackInHand); BindControl(guiSelectedStack); OnAfterPickUp(guiSelectedSlot, guiSelectedStack, selectedSlot); } } else { if (!OnBeforeTransfer(guiSelectedSlot, guiSelectedStack, selectedSlot)) { int transferCount = leftMouse ? stackInHand.Count : 1; int beforeCount = stackInHand.Count; stackInHand.TransferEntities(selectedSlot.Content, transferCount); bool stackInHandUnchanged = beforeCount == stackInHand.Count; if (stackInHandUnchanged && leftMouse) { stackInHand.Swap(selectedSlot.Content); } BindControl(guiStackInHand); BindControl(guiSelectedStack); OnAfterTransfer(guiSelectedSlot, guiSelectedStack, selectedSlot); } } }
private bool IsMouseFocused(GuiComponent button, GuiPanel panel) { //This is a fix that occurs on continious move from a button to another on reveresed index //TODO : Fix it on GuiDANCE library for (int index = 0; index < panel.Components.Count; index++) { GuiComponent component = panel.Components[index]; if (component.Focus == true) { if (component.Name != button.Name) { return(false); } } } //End of fix return(true); }
public Screen(long inID, ScreenType inType, MainGame game) : base(game) { ID = inID; ScreenManager.Instance.RegisterScreen(this); Components = new List <DrawableGameComponent>(); ScreenType = inType; GuiPanel = new GuiPanel(game); GuiPanel.X = 0; GuiPanel.Y = 0; GuiPanel.Width = ScreenManager.Instance.Game.GraphicsDevice.Viewport.Width; GuiPanel.Height = ScreenManager.Instance.Game.GraphicsDevice.Viewport.Height; // resize panel if the window size has changed game.Window.ClientSizeChanged += Window_ClientSizeChanged; MainGame = game; IsLoaded = true; }
public void OpenGuiPanel(GuiPanel panel) { currentPanel.SetActive (false); switch (panel) { case GuiPanel.None: currentPanel = null; break; case GuiPanel.Main: currentPanel = MainPanel; break; case GuiPanel.Credit: currentPanel = CreditPanel; break; case GuiPanel.Options: currentPanel = OptionsPanel; break; } if (currentPanel != null) currentPanel.SetActive(true); }
private void SetupGui() { _menuPanel = new GuiPanel(new Rect(20, 240, 200, 190), Color.red); _menuText = new GuiText(new Rect(75, 240, 180, 20), Color.red, MenuTextName); _authorText = new GuiText(new Rect(100, 257, 180, 20), Color.white, AuthorTextName); _wallHackButton = new GuiButton(new Rect(30, 280, 180, 20), WallHackButtonName); _aimHackButton = new GuiButton(new Rect(30, 310, 180, 20), AimHackButtonName); _speedHackButton = new GuiButton(new Rect(30, 340, 180, 20), SpeedHackButtonName); _flyHackButton = new GuiButton(new Rect(30, 370, 180, 20), FlyHackButtonName); _recoilHackButton = new GuiButton(new Rect(30, 400, 180, 20), RecoilHackButtonName); _statusText = new GuiText(new Rect(5, 5, 640, 20), Color.white, "Info"); _wallHackButton.OnButtonClicked += OnWallHackButtonClicked; _aimHackButton.OnButtonClicked += OnAimHackButtonClicked; _speedHackButton.OnButtonClicked += OnSpeedHackButtonClicked; _flyHackButton.OnButtonClicked += OnFlyHackButtonClicked; _recoilHackButton.OnButtonClicked += OnRecoilHackButtonClicked; }
protected GuiPanel CreateAndBindGuiSlot(Slot slot, int x, int y) { GuiPanel panel = new GuiPanel() { Location = new SlimDX.Vector2(x * slotSize, y * slotSize), Size = new SlimDX.Vector2(slotSize, slotSize), Text = "", Tag = slot }; panel.OnClick += new EventHandler <EventArgs>(slot_OnClick); AddControl(panel); // add moveable control... GuiStackControl guiStack = new GuiStackControl(); guiStack.Size = new SlimDX.Vector2(GuiScaling.ItemSize, GuiScaling.ItemSize); guiStack.Tag = slot.Content; panel.AddControl(guiStack); guiStack.CenterInParent(); BindControl(guiStack); return(panel); }
protected override void OnStart() { Panel = GetComponent<GuiPanel>(); InjectMethod(); }
protected virtual bool OnPickUp(GuiPanel guiSlot, GuiStackControl guiStack, Slot slot) { return(false); }
private void BindControl(GuiPanel guiCraftingProduct) { BindControl((GuiStackControl)guiCraftingProduct.Controls[0]); }