public Game(Informer informer, bool doesLocalGoFirst, UIHooks uiHooks) { this.uiHooks = uiHooks; this.informer = informer; localPlayerNum = doesLocalGoFirst ? 0 : 1; oppPlayerNum = doesLocalGoFirst ? 1 : 0; this.board = new BoardState( informer.GetLocalHero(), informer.GetOppHero(), informer.GetLocalDeckSize(), informer.GetOppDeckSize(), doesLocalGoFirst ? GameRules.FIRST_PLAYER_RAMP : GameRules.SECOND_PLAYER_RAMP, doesLocalGoFirst ? GameRules.SECOND_PLAYER_RAMP : GameRules.FIRST_PLAYER_RAMP, doesLocalGoFirst); for (int i = 0; i < GameRules.FIRST_PLAYER_STARTING_DRAW; ++i) { Draw(0); } for (int i = 0; i < GameRules.SECOND_PLAYER_STARTING_DRAW; ++i) { Draw(1); } StartTurn(); }
public override void Open(MenuState state) { this.state = new GameMenuState(state); uiHooks = new UIHooks(); uiHooks.onLocalDrawCard += OnLocalDrawCard; uiHooks.onOppDrawCard += OnOppDrawCard; game = Game.StartLocalGame("deck1", "deck2", uiHooks); }
public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture) { var mode = TextFormattingMode.Ideal; if (values != null) { foreach (var v in values) { // only the TextBlock is useful var tb = v as TextBlock; if (tb != null) { var dpi = UIHooks.GetWindowDpi(tb); if (dpi <= 96 && tb.FontSize <= UIHooks.FontSizeThreshold) { mode = TextFormattingMode.Display; } //Debug.WriteLine("DPI={0}, using {1} mode for text {2}", dpi, mode, tb.Text); break; } } } return(mode); }
static public Game StartLocalGame(string localDeckName, string oppDeckName, UIHooks uiHooks) { return(new Game(new LocalInformer(localDeckName, oppDeckName), true, uiHooks)); }
protected override void OnStartup(StartupEventArgs e) { UIHooks.EnableHighDpiSupport(); Debug.WriteLine("Per-monitor DPI Awareness=" + UIHooks.IsPerMonitorAware); base.OnStartup(e); }
public App() { UIHooks.EnableHighDpiSupport(); }
/// <summary> /// Initializes a new instance of the <see cref="AnimatedScrollViewer"/> class. /// </summary> public AnimatedScrollViewer() { UIHooks.AddMouseHWheelHandler(this, HandleHorizWheel); }
private ChromeHitTest HandleHcHitTest(IntPtr lParam) { ChromeHitTest res = ChromeHitTest.Border; if (_manager.ContentWindow.ResizeMode == ResizeMode.CanResizeWithGrip || _manager.ContentWindow.ResizeMode == ResizeMode.CanResize) { var pt = (Point)lParam.ToPoint(); pt = PointFromScreen(pt); //Debug.WriteLine("NC pt = " + pt); int diagSize = (int)(2 * PadSize * UIHooks.GetWindowDpiScale(_manager.ContentWindow)); switch (Side) { case BorderSide.Left: if (pt.Y <= diagSize) { res = ChromeHitTest.TopLeft; } else if (pt.Y >= Height - diagSize) { res = ChromeHitTest.BottomLeft; } else { res = ChromeHitTest.Left; } break; case BorderSide.Top: if (pt.X <= diagSize) { res = ChromeHitTest.TopLeft; } else if (pt.X >= Width - diagSize) { res = ChromeHitTest.TopRight; } else { res = ChromeHitTest.Top; } break; case BorderSide.Right: if (pt.Y <= diagSize) { res = ChromeHitTest.TopRight; } else if (pt.Y >= Height - diagSize) { res = ChromeHitTest.BottomRight; } else { res = ChromeHitTest.Right; } break; case BorderSide.Bottom: if (pt.X <= diagSize) { res = ChromeHitTest.BottomLeft; } else if (pt.X >= Width - diagSize) { res = ChromeHitTest.BottomRight; } else { res = ChromeHitTest.Bottom; } break; } //Debug.WriteLine("Side {0}({1},{2}) at {3}, res = {4}", Side, Width, Height, pt, res); } return(_lastHitTest = res); }