private void OnMouseMove(object sender, ScreenEventArgs args) { if (args.Buttons != MouseButton.None) { TopScreen?.MouseDrag(args); } TopScreen?.MouseMove(args); }
public override bool MouseDown(ScreenEventArgs args) { if (_difficulty > -1 && _competition > -1 && _tribe > -1 && !_done) { _done = true; } return(_done); }
public override bool MouseDown(ScreenEventArgs args) { if (_fadeStep >= 1.0F) { Destroy(); } return(true); }
public override bool MouseUp(ScreenEventArgs args) { if (_menu != null) { return(_menu.MouseUp(args)); } return(false); }
public override bool MouseDown(ScreenEventArgs args) { if (_done && _overlay != null) { return(_overlay.MouseDown(args)); } return(SkipIntro()); }
public override bool MouseDrag(ScreenEventArgs args) { if (_done && _overlay != null) { return(_overlay.MouseDrag(args)); } return(false); }
protected void OnClose(ScreenEventArgs args) { Assert.IsFalse(WasClosed, "Close was called twice."); WasClosed = true; if (ThrowOnClose) { throw new ScreenMockException(); } }
private async void Draw(object sender, ScreenEventArgs e) { await this.Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () => { if (DirectXFactory.Ready) { DrawPTT(); } }); }
public override bool MouseDown(ScreenEventArgs args) { if (_interfaceHelp) { _closing = true; return(true); } Destroy(); return(true); }
public override bool MouseDown(ScreenEventArgs args) { OnMouseDown?.Invoke(this, args); if (args.Handled) { return(true); } Destroy(); return(true); }
public override bool MouseDrag(ScreenEventArgs args) { if (_gameMenu == null) { return(false); } MouseArgsOffset(ref args, _menuX, _menuY); _update |= _gameMenu.MouseDrag(args); return(_update); }
private void MouseUp(object sender, ScreenEventArgs args) { args = Transform(args); if (Settings.AspectRatio == AspectRatio.ScaledFixed) { PointF scaleF = GetScaleF(); GetBorders(out int offsetX, out int offsetY, out _, out _); args = new ScreenEventArgs(args.X - (int)((float)offsetX / scaleF.X), args.Y - (int)((float)offsetY / scaleF.Y), args.Buttons); } _runtime.InvokeMouseUp(args); }
protected internal virtual void ScreenChange(object sender, ScreenEventArgs eventOccured) { if (eventOccured.Screen == this) { Show(); //Setting the Screen Visible } else { Hide(); //Setting the Screen invisible } }
private ScreenEventArgs AdjustMousePos(ScreenEventArgs args) { if (Settings.AspectRatio == AspectRatio.ScaledFixed) { PointF scaleF = GetScaleF(); GetBorders(out int offsetX, out int offsetY, out _, out _); args = new ScreenEventArgs(args.X - (int)((float)offsetX / scaleF.X), args.Y - (int)((float)offsetY / scaleF.Y), args.Buttons); } return(args); }
private void MouseMove(object sender, ScreenEventArgs args) { args = Transform(args); if (args.X == _mouseX && args.Y == _mouseY) { return; } _hasUpdate = true; _mouseX = args.X; _mouseY = args.Y; _runtime.InvokeMouseMove(args); }
public override bool MouseDrag(ScreenEventArgs args) { int index = MouseOverItem(args); if (index < 0 || index == _activeItem) { return(false); } ActiveItem = index; _change = true; return(true); }
public override bool MouseDown(ScreenEventArgs args) { if ((++_page * 7) > _wonders.Length) { Destroy(); } else { _update = true; } return(true); }
public override bool MouseDown(ScreenEventArgs args) { if (_menu != null) { return(_menu.MouseDown(args)); } if (_saving) { Destroy(); } return(false); }
public override bool MouseUp(ScreenEventArgs args) { if (!_mouseDown) { return(true); } if (new Rectangle(230 + ExtraLeft, 99, 88, 99).Contains(args.Location)) { MouseArgsOffset(ref args, 230 + ExtraLeft, 99); return(_cityProduction.MouseUp(args)); } return(false); }
private void MouseDown(object sender, ScreenEventArgs args) { if (_infoButtons.Count == 0) { return; } foreach (KeyValuePair <Player, Rectangle> infoButton in _infoButtons) { if (!infoButton.Value.Contains(args.X, args.Y)) { continue; } int y = 32; int fontHeight = Resources.GetFontHeight(0); Player player = infoButton.Key; this.FillRectangle(0, 25, 320, 172, BackgroundColour) .DrawText($"Subject: the {player.TribeNamePlural}", 0, 5, 16, (y + 1)) .DrawText($"Subject: the {player.TribeNamePlural}", 0, 15, 16, y) .DrawText("Leader:", 0, 9, 16, (y += fontHeight + 4)) .DrawText($"Emperor {player.LeaderName}", 0, 15, 62, y); foreach (string line in player.Civilization.Leader.Traits()) { this.DrawText(line, 0, 7, 24, (y += fontHeight)); } this.DrawText("Capital:", 0, 9, 16, (y += fontHeight + 4)) .DrawText(player.GetCapitalName(), 0, 15, 63, y) .DrawText("Government:", 0, 9, 16, (y += fontHeight)) .DrawText(player.Government.Name, 0, 15, 83, y) .DrawText("Treasury:", 0, 9, 16, (y += fontHeight)) .DrawText($"{player.Gold}$", 0, 15, 73, y) .DrawText("Military:", 0, 9, 16, (y += fontHeight)) .DrawText($"{Game.GetUnits().Count(x => player == x.Owner)} Units", 0, 15, 67, y) .DrawText("Foreign Affairs:", 0, 9, 16, (y += fontHeight + 4)) .DrawText("Technologies:", 0, 9, 16, (y += fontHeight + 4)); args.Handled = true; SetUpdate(); } if (args.Handled) { _infoButtons.Clear(); } }
public override bool MouseDown(ScreenEventArgs args) { _mouseDown = true; if (!_viewCity) { if (new Rectangle(231 + ExtraLeft, (Height - 10), 42, 10).Contains(args.Location)) { // Rename button CityName name = new CityName(_city.NameId, _city.Name); name.Accept += CityRename; Common.AddScreen(name); return(true); } if (new Rectangle(2, 1, _cityHeader.Width(), _cityHeader.Height()).Contains(args.Location)) { MouseArgsOffset(ref args, 2, 1); return(_cityHeader.MouseDown(args)); } if (new Rectangle(127 + ExtraLeft, 23, 82, 82).Contains(args.Location)) { MouseArgsOffset(ref args, 127 + ExtraLeft, 23); return(_cityMap.MouseDown(args)); } if (new Rectangle(95 + ExtraLeft, 106, 133, 92).Contains(args.Location)) { MouseArgsOffset(ref args, 95 + ExtraLeft, 106); return(_cityInfo.MouseDown(args)); } if (new Rectangle(211 + ExtraLeft, 1, 107 + ExtraRight, 97).Contains(args.Location)) { MouseArgsOffset(ref args, 211 + ExtraLeft, 1); if (_cityBuildings.MouseDown(args)) { return(true); } } if (new Rectangle(230 + ExtraLeft, 99, 88, 99).Contains(args.Location)) { MouseArgsOffset(ref args, 230 + ExtraLeft, 99); if (_cityProduction.MouseDown(args)) { return(true); } } } CloseScreen(); return(true); }
public override bool MouseUp(ScreenEventArgs args) { if (_activeItem < 0 && !KeepOpen) { return(false); } if (_activeItem < 0 && KeepOpen) { KeepOpen = false; return(false); } Items[_activeItem]?.Select(); return(true); }
protected void OnDeactivate(ScreenEventArgs args) { _deactivateInvocations++; Assert.AreEqual( _activateInvocations, _deactivateInvocations, "Deactivate was called twice." ); if (ThrowOnDeactivate) { throw new ScreenMockException(); } }
private int MouseOverItem(ScreenEventArgs args) { int fontHeight = Resources.GetFontHeight(0); int yy = 5; for (int i = 0; i < Items.Count; i++) { if (new Rectangle(3, yy, MaxItemWidth + 8, fontHeight).Contains(args.Location)) { return(i); } yy += fontHeight; } return(-1); }
public override bool MouseDown(ScreenEventArgs args) { if (args.Y < 7 || args.Y > 15) { return(false); } if (args.X < 34) { return(true); } if (args.X > 63 && args.X < 82) { return(true); } return(false); }
public override bool MouseUp(ScreenEventArgs args) { if (args.Y < 7 || args.Y > 15) { return(false); } if (args.X < 34) { return(Change()); } if (args.X > 63 && args.X < 82) { return(Buy()); } return(false); }
private bool InfoClick(ScreenEventArgs args) { for (int i = 0; i < _units.Length; i++) { int xx = 4 + ((i % 6) * 18); int yy = 0 + (((i - (i % 6)) / 6) * 16); if (new Rectangle(xx, yy, 16, 16).Contains(args.Location)) { _units[i].Busy = false; _update = true; break; } } return(true); }
public override bool MouseDown(ScreenEventArgs args) { _mouseDown = true; if (new Rectangle(231, 190, 42, 10).Contains(args.Location)) { // Rename button CityName name = new CityName(_city.Name); name.Accept += CityRename; Common.AddScreen(name); return(true); } if (new Rectangle(2, 1, 208, 21).Contains(args.Location)) { MouseArgsOffset(ref args, 2, 1); return(_cityHeader.MouseDown(args)); } if (new Rectangle(127, 23, 82, 82).Contains(args.Location)) { MouseArgsOffset(ref args, 127, 23); return(_cityMap.MouseDown(args)); } if (new Rectangle(95, 106, 133, 92).Contains(args.Location)) { MouseArgsOffset(ref args, 95, 106); return(_cityInfo.MouseDown(args)); } if (new Rectangle(211, 1, 107, 97).Contains(args.Location)) { MouseArgsOffset(ref args, 211, 1); if (_cityBuildings.MouseDown(args)) { return(true); } } if (new Rectangle(230, 99, 88, 99).Contains(args.Location)) { MouseArgsOffset(ref args, 230, 99); if (_cityProduction.MouseDown(args)) { return(true); } } CloseScreen(); return(true); }
public override bool MouseDown(ScreenEventArgs args) { if (args.X < 1 || args.X > 81 || args.Y < 1 || args.Y > 81) { return(false); } int tileX = (int)Math.Floor(((double)args.X - 1) / 16); int tileY = (int)Math.Floor(((double)args.Y - 1) / 16); _city.SetResourceTile(_city.CityRadius[tileX, tileY]); _update = true; if (MapUpdate != null) { MapUpdate(this, null); } return(true); }
public override bool MouseDown(ScreenEventArgs args) { if (!KeepOpen) { return(false); } int index = MouseOverItem(args); if (index == _activeItem) { return(false); } _activeItem = index; _update = true; return(true); }
/// <summary> /// Raises the show screen event. /// </summary> /// <param name="sender">Sender of event.</param> /// <param name="args">Screen event arguments.</param> public void OnShowScreen(object sender, ScreenEventArgs args) { this.ShowScreen((ScreenType)args.Screen, args.Object); }
/// <summary> /// Show screen e.Screen to player. If needed, there is an object index in e.IndexObject. /// </summary> /// <param name="sender">Sender.</param> /// <param name="e">Event arguments.</param> public void OnShowScreen(Object sender, ScreenEventArgs e) { ShowScreen ((ScreenTypes)e.Screen, e.Object); }
/// <summary> /// The current page the user has navigated to. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void onPageChange(object sender, ScreenEventArgs e) { WriteToConsole("onPageChange: " + e.Screen.ToString()); switch (e.Screen) { case Screen.Buy: // The deposit money screen break; case Screen.CreatePin: // The create PIN screen in enrollment break; case Screen.EnterPin: // The PIN screen in sign-in break; case Screen.EnterVerification: // The SMS verification screen in enrollment break; case Screen.FacePicture: // The face picture taking screen in enrollment break; case Screen.Index: // The main screen (either signed-out or signed-in) // Software action: Update machine inventory by calling PostInventory() break; case Screen.Receive: // The QR code screen to load bitcoin into their wallet break; case Screen.ScanBitcoinAddress: // The withdraw bitcoin screen that enables the webcam to scan for a bitcoin QR code break; case Screen.ScanBitcoinAddressAmount: // The withdraw bitcoin amount screen break; case Screen.ScanId: // The ID picture taking screen in enrollment break; case Screen.Sell: // The withdraw money screen break; case Screen.SignIn: // The phone number sign-in screen break; case Screen.SignInVerify: // The 2-factor authentication screen in sign-in break; case Screen.SignOut: // The user signs out break; case Screen.EnrollmentTerms: // The user is enrolling for the first time and is looking at the terms and conditions break; case Screen.Disabled: // The disabled screen break; case Screen.SendMoneyRecipient: // The recipient phone number screen in send money break; case Screen.SendMoneyDestination: // The location map selector in send money break; case Screen.SendMoneyAmount: // The estimator screen for how much to send in send money break; case Screen.SendMoneyAddCash: // The deposit screen in send money break; case Screen.ReceiveMoney: // The withdrawal selection screen in receive money break; } }
private void Core_ScreenRequested(object sender, ScreenEventArgs e) { // Shows the right screen depending on the event. switch (e.Screen) { case ScreenType.Main: NavigationManager.NavigateToGameHome(Model.Core.Cartridge.Filename, GameHomeViewModel.SectionValue_Overview); break; case ScreenType.Locations: case ScreenType.Items: NavigationManager.NavigateToGameHome(Model.Core.Cartridge.Filename, GameHomeViewModel.SectionValue_World); break; case ScreenType.Inventory: NavigationManager.NavigateToGameHome(Model.Core.Cartridge.Filename, GameHomeViewModel.SectionValue_Inventory); break; case ScreenType.Tasks: NavigationManager.NavigateToGameHome(Model.Core.Cartridge.Filename, GameHomeViewModel.SectionValue_Tasks); break; case ScreenType.Details: NavigationManager.NavigateToView(e.Object); break; default: throw new InvalidOperationException(String.Format("Unknown WherigoScreenKind cannot be processed: {0}", e.Screen.ToString())); } }