private void IsoDrawRouter(INetworkController router, DrawingContext drawingContext) { Size size = new Size(this.vh.IsoLenght(), (double)this.vh.IsoLenght() * ServerDrawInfo.RouterHeightsPropotion); Point p = this.vh.DrawPosition(new Point(router.X, router.Y)); p = new Point(p.X - size.Width + 1, p.Y - size.Height + 1); Rect position = new Rect(p, size); if (router.IsEnable) { ServerDrawInfo sDITemp = this.sdi[router.Owner.Type] as ServerDrawInfo; ImageBrush routerImage = sDITemp.Router; drawingContext.DrawRectangle(routerImage, null, position); this.LifeTextDrawTransform(router.Life.ToString(), drawingContext, Brushes.Black, p); } else { ImageBrush routerImage = (this.sdi[PlayerType.Nobody] as ServerDrawInfo).Router; drawingContext.DrawRectangle(routerImage, null, position); IInactiveNetworkController iNCTemp = router as IInactiveNetworkController; this.LifeTextDrawTransform($"{iNCTemp.CapturePoint}/{iNCTemp.CaptureLimit}", drawingContext, router.Owner != null ? (this.sdi[router.Owner.Type] as ServerDrawInfo).SolidColor : Brushes.Black, p); } DrawedNetworkControllers.Add(router, position); }
/// <summary> /// New instance of game area /// </summary> /// <param name="gamemodel">gets gamelogic</param> public void SetupLogic(IGameModel gamemodel) { this.gm = gamemodel; DrawedNetworkControllers = new Dictionary <INetworkController, Rect>(); this.vh = (App.Current.Resources["Locator"] as ViewModelLocator).Ingame.VH; ServerDrawInfo easyCpu = new ServerDrawInfo(PlayerType.EasyCpu, Colors.Firebrick); ServerDrawInfo hardCpu = new ServerDrawInfo(PlayerType.HardCpu, Colors.ForestGreen); ServerDrawInfo localHumanPlayer = new ServerDrawInfo(PlayerType.LocalHumanPlayer, Colors.MediumTurquoise); ServerDrawInfo nobody = new ServerDrawInfo(PlayerType.Nobody, Colors.Gray); this.sdi = new Dictionary <PlayerType, ServerDrawInfo> { { PlayerType.EasyCpu, easyCpu }, { PlayerType.HardCpu, hardCpu }, { PlayerType.LocalHumanPlayer, localHumanPlayer }, { PlayerType.Nobody, nobody } }; }
private void IsoDrawNetworkControl(INetworkController networkControlObject, DrawingContext drawingContext) { // double arány = ServerDrawInfo.HeightsPropotion[(networkControlObject as IServerNetworkController).Level]; IServerNetworkController sNCTemp = networkControlObject as IServerNetworkController; Size size = new Size(this.vh.IsoLenght(), (double)this.vh.IsoLenght() * ServerDrawInfo.HeightsPropotion[sNCTemp.Level]); // ServerDrawInfo.PicSizes[(networkControlObject as IServerNetworkController).Level]; Point p = this.vh.DrawPosition(new Point(networkControlObject.X, networkControlObject.Y)); p = new Point(p.X - size.Width + 1, p.Y - size.Height + 1); Rect position = new Rect(p, size); if (networkControlObject.IsEnable) { ServerDrawInfo sDITemp = this.sdi[networkControlObject.Owner.Type] as ServerDrawInfo; ImageBrush serverImage = sDITemp.ServerImages[sNCTemp.Level]; drawingContext.DrawRectangle(serverImage, null, position); this.LifeTextDrawTransform(networkControlObject.Life.ToString(), drawingContext, Brushes.Black, p); } else { ImageBrush serverImage = (this.sdi[PlayerType.Nobody] as ServerDrawInfo).ServerImages[sNCTemp.Level]; drawingContext.DrawRectangle(serverImage, null, position); IInactiveNetworkController iNCTemp = networkControlObject as IInactiveNetworkController; this.LifeTextDrawTransform( $"{iNCTemp.CapturePoint}/{iNCTemp.CaptureLimit}\n", drawingContext, networkControlObject.Owner != null ? (this.sdi[networkControlObject.Owner.Type] as ServerDrawInfo).SolidColor : Brushes.Black, p); } DrawedNetworkControllers.Add(networkControlObject, position); // Original Drawtext // drawingContext.DrawText( // formattedText, // VectorHandler.VH.IsoPosition(new Point(networkControlObject.X, networkControlObject.Y - 50))); }