private void GameCanvas_Draw(CanvasControl sender, CanvasDrawEventArgs args) { args.DrawingSession.DrawImage(shipTexture, shipWidth, shipHeight); for (int i = 0; i < Projectiles.Count; ++i) { args.DrawingSession.DrawImage(projText, Projectiles[i].X, Projectiles[i].Y); } for (int i = 0; i < Enemies.Count; ++i) { args.DrawingSession.DrawImage(enemyText, Enemies[i].X, Enemies[i].Y); } if (RoundEnded) { args.DrawingSession.DrawImage(scoreScene, (int)(width / 2 - 150), (int)(height / 2 - 200)); args.DrawingSession.DrawText(score.ToString(), (int)(width / 2 - 12), (int)(height / 2 - 12), Colors.Yellow); Righty.IsEnabled = false; Lefty.IsEnabled = false; } else { args.DrawingSession.DrawImage(timerBG, 25, 25); args.DrawingSession.DrawText(countdown.ToString(), 42, 35, Colors.Black); } GameCanvas.Invalidate(); }
// Token: 0x0600018F RID: 399 RVA: 0x000044AE File Offset: 0x000026AE public void reloadImage() { if (mGraphics.zoomLevel == 1) { this.imgFont = GameCanvas.loadImage(this.pathImage); } }
// Token: 0x06000893 RID: 2195 RVA: 0x0007D1F0 File Offset: 0x0007B3F0 public override void switchToMe() { GameCanvas.connect(); GameScr.cmy = 0; GameScr.cmx = 0; this.initCommand(); ServerListScreen.isWait = false; GameCanvas.loginScr = null; string text = Rms.loadRMSString("ResVersion"); if (((text == null || !(text != string.Empty)) ? -1 : int.Parse(text)) > 0) { ServerListScreen.loadScreen = true; GameCanvas.loadBG(0); } ServerListScreen.bigOk = true; this.cmd[2 + this.nCmdPlay].caption = mResources.server + ": " + ServerListScreen.nameServer[ServerListScreen.ipSelect]; this.center = new Command(string.Empty, this, this.cmd[ServerListScreen.selected].idAction, null); this.cmd[1 + this.nCmdPlay].caption = mResources.change_account; if (this.cmd.Length == 4 + this.nCmdPlay) { this.cmd[3 + this.nCmdPlay].caption = mResources.option; } base.switchToMe(); }
private void DareBtn_Click(object sender, EventArgs e) { int index = r.Next(4); switch (index) { case 0: lbl_Game.Text = "How dare you listen!"; break; case 1: lbl_Game.Text = "This is a dark path you are on!"; break; case 2: lbl_Game.Text = "I knew you wouldn't listen!"; break; case 3: lbl_Game.Text = "Have some food!!!!!!!!!! :)"; FoodMngr.AddRandomFood(20); GameCanvas.Invalidate(); break; default: break; } }
private void DareBtn_Click(object sender, EventArgs e) { GameTimer.Enabled = false; MessageBox.Show("Have some food :)"); FoodMngr.AddRandomFood(20); GameCanvas.Invalidate(); }
protected virtual void Start() { canAttack = false; canMove = false; view = GetComponent <PhotonView>(); canvas = GameObject.FindGameObjectWithTag("MenuCanvas").GetComponent <GameCanvas>(); lifelinkParticle = Instantiate(particleLL, transform, true); lifelinkParticle.transform.localPosition = new Vector3(0, -0.2f, 0); if (view.isMine) { pool = GameObject.FindGameObjectWithTag("PrefabPool").GetComponent <PrefabPool>(); cam.SetActive(true); canvasPlayer.gameObject.SetActive(true); menu = Instantiate(escMenuPrefab).GetComponent <EscMenu>(); menu.gameObject.transform.SetParent(canvasPlayer.transform, false); menu.gameObject.SetActive(false); menu.p = this; string val = "0/" + maxUltCharges.ToString(); canvas.GetComponent <PhotonView>().RPC("RPC_SetStats", PhotonTargets.All, 3, val, teamOn, playerNum); try { grabHitbox.gameObject.SetActive(true); grabHitbox.teamOn = teamOn; } catch { //must be Bunt. } } }
public override void Initialize() { menuCanvas = new MenuCanvas(this.playState, this.physicsState); menuCanvas.TransitionSource = this; AddCanvas(menuCanvas); base.Initialize(); }
// Token: 0x060008A2 RID: 2210 RVA: 0x0007DDE4 File Offset: 0x0007BFE4 public override void paint(mGraphics g) { if (SplashScr.imgLogo != null && SplashScr.splashScrStat < 30) { g.setColor(16777215); g.fillRect(0, 0, GameCanvas.w, GameCanvas.h); g.drawImage(SplashScr.imgLogo, GameCanvas.w / 2, GameCanvas.h / 2, 3); } if (SplashScr.nData != -1) { g.setColor(0); g.fillRect(0, 0, GameCanvas.w, GameCanvas.h); g.drawImage(LoginScr.imgTitle, GameCanvas.w / 2, GameCanvas.h / 2 - 24, StaticObj.BOTTOM_HCENTER); GameCanvas.paintShukiren(GameCanvas.hw, GameCanvas.h / 2 + 24, g); mFont.tahoma_7b_white.drawString(g, mResources.downloading_data + SplashScr.nData * 100 / SplashScr.maxData + "%", GameCanvas.w / 2, GameCanvas.h / 2, 2); } else if (SplashScr.splashScrStat >= 30) { g.setColor(0); g.fillRect(0, 0, GameCanvas.w, GameCanvas.h); GameCanvas.paintShukiren(GameCanvas.hw, GameCanvas.hh, g); if (ServerListScreen.cmdDeleteRMS != null) { mFont.tahoma_7_white.drawString(g, mResources.xoadulieu, GameCanvas.w - 2, GameCanvas.h - 15, 1, mFont.tahoma_7_grey); } } }
public MouseCapture(GameCanvas playGrid) { _clickedCoordinates = new Dictionary <double, double>(); _playGrid = playGrid; _playGrid.MouseUp += gridClicked; }
// Token: 0x0600076E RID: 1902 RVA: 0x00063458 File Offset: 0x00061658 public override void paint(mGraphics g) { g.setClip(0, 0, GameCanvas.w, GameCanvas.h); if (LoginScr.isContinueToLogin) { return; } int num = GameCanvas.h - this.h - 38; int w = GameCanvas.w - this.padLeft * 2; GameCanvas.paintz.paintPopUp(this.padLeft, num, w, this.h, g); int num2 = num + (this.h - this.info.Length * mFont.tahoma_8b.getHeight()) / 2 - 2; if (this.isWait) { num2 += 8; GameCanvas.paintShukiren(GameCanvas.hw, num2 - 12, g); } int i = 0; int num3 = num2; while (i < this.info.Length) { mFont.tahoma_7b_dark.drawString(g, this.info[i], GameCanvas.hw, num3, 2); i++; num3 += mFont.tahoma_8b.getHeight(); } base.paint(g); }
// Token: 0x0600071D RID: 1821 RVA: 0x000068DA File Offset: 0x00004ADA public void actRegister() { GameCanvas.endDlg(); this.isRes = true; this.tfPass.isFocus = false; this.tfUser.isFocus = true; }
private void DareBtn_Click(object sender, EventArgs e) { int index = r.Next(4); switch (index) { case 0: MessageBox.Show("How dare you listen"); break; case 1: MessageBox.Show("This is a dark path you are on"); break; case 2: MessageBox.Show("I knew you wouldn't listen"); break; case 3: MessageBox.Show("Have some food :)"); FoodMngr.AddRandomFood(20); GameCanvas.Invalidate(); break; default: break; } }
private void CheckIfGameHasStarted() { bool touchedScreen = (MobileInputs.Instance.IsTap); bool gameHasNotStarted = (!_hasGameStarted); if (touchedScreen && gameHasNotStarted) { Camera.main.fieldOfView = 122.2f; _hasGameStarted = true; _playerController.StartRunning(); _glacierSpawner.IsScrolling = true; _cameraController.IsMoving = true; GameCanvas.SetTrigger("Show"); MenuAnim.SetTrigger("Hide"); } if (_hasGameStarted && !IsDead) { //Bump up the score _score += (Time.deltaTime * _modifierScore); if (_lastScore != (int)_score) { _lastScore = (int)_score; ScoreText.text = _score.ToString("0"); } } }
public Cartesian(GameCanvas canvas, PictureBox drawingEvents) : base(canvas) { mouseHighlight = new MouseHighlight(canvas, this); drawingEvents.MouseMove += new MouseEventHandler(mouseHighlight.drawingCanvas_MouseMove); drawingEvents.MouseUp += new MouseEventHandler(mouseHighlight.drawingCanvas_MouseUp); }
private void HowDareYouButtonClick(object sender, EventArgs e) { int index = r.Next(4); switch (index) { case 0: howDareYouLabel.Text = "How dare you listen!"; break; case 1: howDareYouLabel.Text = "This is a dark path you are on!"; break; case 2: howDareYouLabel.Text = "I knew you wouldn't listen!"; break; case 3: howDareYouLabel.Text = "Have some food!!!!!!!!!! :)"; foodManager.AddRandomFood(20); GameCanvas.Invalidate(); break; default: break; } }
private void OnFinished() { if (onCompleted != null) { onCompleted.Invoke(); } holdKeyMinigame.currentHoldTime = 0.0f; if (isPlayer1) { GameCanvas.SetPlayer1Fish(GameCanvas.GetPlayer1Fish() + 1); } else { GameCanvas.SetPlayer2Fish(GameCanvas.GetPlayer2Fish() + 1); } //photonView.RPC("FinishedCall", RpcTarget.AllViaServer); //if (isPlayer1) //{ // photonView.RPC("FinishedCall", RpcTarget.AllViaServer); //} //else //{ //} //myGameObject.SetActive(false); }
private void Update() { if (photonView.IsMine) { if (state == 0) { int logs = isPlayer1 ? GameCanvas.GetPlayer1Logs() : GameCanvas.GetPlayer2Logs(); if (Input.GetKeyDown(keyCode) && (logs >= buildCosts[state])) { //cehck for income and start dam spamKeyBold.SetActive(true); spamKeyMinigame.currentValue = 0.5f; if (isPlayer1) { GameCanvas.SetPlayer1Logs(logs - buildCosts[state]); } else { GameCanvas.SetPlayer2Logs(logs - buildCosts[state]); } AudioSFXReferences.PlayPurchase(); state++; buildCostText.text = buildCosts[state].ToString(); photonView.RPC("EnableSpamKey", RpcTarget.Others, true, buildCosts[state], true); } } } }
// Token: 0x06000368 RID: 872 RVA: 0x0001B17C File Offset: 0x0001937C public static void loadbg() { for (int i = 0; i < Paint.goc.Length; i++) { Paint.goc[i] = GameCanvas.loadImage("/mainImage/myTexture2dgoc" + (i + 1) + ".png"); } }
public void DrawLayerOne(GameCanvas canvas, List<GameUnit> units, Player player) { if (Active) { foreach (GameUnit unit in units) { if (!unit.Exists) continue; //Attack indicator if (unit.AttackCoolDown != 0) { int range = unit.AttackRange + unit.Size / 2; canvas.DrawSprite(InfectTexture, new Color(70, 20, 20, (int)(unit.AttackCoolDown * 2.5)), new Rectangle((int)unit.Position.X - range, (int)unit.Position.Y - range, range * 2, range * 2), new Rectangle(0, 0, InfectTexture.Width, InfectTexture.Height)); } } if (player != null) { //Infection range canvas.DrawSprite(InfectTexture, new Color(30, 0, 0, 30), player.Position, new Vector2(1, 1), 0f); } } }
/// <summary> /// Renders the game on the specified graphics instance /// </summary> /// <param name="graphicsInstance">Graphics instance to draw on</param> public void RenderGame(Graphics graphicsInstance) { if (graphicsInstance == null) { throw new ArgumentNullException(); } GameCanvas.Clear(); for (var row = 0; row < Game.Map.Cells.GetLength(0); row++) { for (var column = 0; column < Game.Map.Cells.GetLength(1); column++) { var image = CellAppearance.GetCellImage(Game.Map.Cells[row, column]); GameCanvas.Draw(image, new Coordinate { Row = row, Column = column }); } } if (SelectedCell.HasValue) { GameCanvas.MarkCell(SelectedCell.Value); } GameCanvas.Render(graphicsInstance); }
// Token: 0x06000171 RID: 369 RVA: 0x0000D3B0 File Offset: 0x0000B5B0 private void getKey(Message message) { try { sbyte b = message.reader().readSByte(); Session_ME2.key = new sbyte[(int)b]; for (int i = 0; i < (int)b; i++) { Session_ME2.key[i] = message.reader().readSByte(); } for (int j = 0; j < Session_ME2.key.Length - 1; j++) { sbyte[] key = Session_ME2.key; int num = j + 1; key[num] = (sbyte)((int)key[num] ^ (int)Session_ME2.key[j]); } Session_ME2.getKeyComplete = true; GameMidlet.IP2 = message.reader().readUTF(); GameMidlet.PORT2 = message.reader().readInt(); GameMidlet.isConnect2 = ((int)message.reader().readByte() != 0); if (Session_ME2.isMainSession && GameMidlet.isConnect2) { GameCanvas.connect2(); } } catch (Exception) { } }
public GeneratorWindow(GameCanvas parent, Editor editor, Vector2d pos) : base(parent, null) { Title = $"Line Generator"; SetSize(450, 500); DisableResizing(); /*_typecontainer = new CollapsibleList(this) * { * Dock = Dock.Left, * AutoSizeToContents = false, * Width = 100, * Margin = new Margin(0, 0, 5, 0) * };*/ MakeModal(true); if (!initialised) { gen_Circle = new CircleGenerator("Circle Generator", 10.0, pos, 50, false); gen_10pc = new TenPCGenerator("10PC Generator", new Vector2d(1.0, 1.0), 0.0); CurrentGenerator = GeneratorType.TenPC; } Setup(); initialised = true; }
public ExportWindow(GameCanvas parent, Editor editor, MainWindow window) : base(parent, editor) { _game = window; Title = "Export Video"; _descriptionlabel = new RichLabel(this) { AutoSizeToContents = true }; if (!SafeFrameBuffer.CanRecord) { _descriptionlabel.AddText( "Video export is not supported on this machine.\n\nSorry.", Skin.Colors.Text.Foreground); } else { _descriptionlabel.AddText(howto, Skin.Colors.Text.Foreground); } _descriptionlabel.Dock = Dock.Top; _error = new Label(this) { Dock = Dock.Top, TextColor = Color.Red, IsHidden = true, Margin = new Margin(0, 0, 0, 10) }; AutoSizeToContents = true; MinimumSize = new Size(400, 300); MakeModal(true); Setup(); }
// Token: 0x060004F1 RID: 1265 RVA: 0x0003B08C File Offset: 0x0003928C public void getDataB() { BachTuoc.data = null; BachTuoc.data = new EffectData(); string patch = string.Concat(new object[] { "/x", mGraphics.zoomLevel, "/effectdata/", 108, "/data" }); try { BachTuoc.data.readData2(patch); BachTuoc.data.img = GameCanvas.loadImage("/effectdata/" + 108 + "/img.png"); } catch (Exception ex) { Service.gI().requestModTemplate(this.templateId); } this.w = BachTuoc.data.width; this.h = BachTuoc.data.height; }
public PreferencesWindow(GameCanvas parent, Editor editor) : base(parent, editor) { Title = "Preferences"; SetSize(450, 425); MinimumSize = Size; ControlBase bottom = new ControlBase(this) { Dock = Dock.Bottom, AutoSizeToContents = true, }; Button defaults = new Button(bottom) { Dock = Dock.Right, Margin = new Margin(0, 2, 0, 0), Text = "Restore Defaults" }; defaults.Clicked += (o, e) => RestoreDefaults(); _prefcontainer = new CollapsibleList(this) { Dock = Dock.Left, AutoSizeToContents = false, Width = 100, Margin = new Margin(0, 0, 5, 0) }; MakeModal(true); Setup(); }
void Start() { _instance = this; nextSceneLoad = SceneManager.GetActiveScene().buildIndex + 1; currentLevel = SceneManager.GetActiveScene().buildIndex; levelText.text = currentLevel.ToString(); }
// Token: 0x060000DF RID: 223 RVA: 0x0000AD3C File Offset: 0x00008F3C public void paint(mGraphics g) { g.setClip(0, 0, GameCanvas.w, GameCanvas.h); bool flag = this.isFocused(); if (this.inputType == TField.INPUT_TYPE_PASSWORD) { this.paintedText = this.passwordText; } else { this.paintedText = this.text; } this.paintInputTf(g, flag, this.x, this.y - 1, this.width, this.height + 5, TField.TEXT_GAP_X + this.offsetX + this.x + 1, this.y + (this.height - mFont.tahoma_8b.getHeight()) / 2 + 2, this.paintedText, this.name); g.setClip(this.x + 3, this.y + 1, this.width - 4, this.height - 2); g.setColor(0); if (flag && this.isPaintMouse && this.isPaintCarret) { if (this.keyInActiveState == 0 && (this.showCaretCounter > 0 || this.counter / TField.CARET_SHOWING_TIME % 4 == 0)) { g.setColor(7999781); g.fillRect(TField.TEXT_GAP_X + 1 + this.offsetX + this.x + mFont.tahoma_8b.getWidth(this.paintedText.Substring(0, this.caretPos) + "a") - TField.CARET_WIDTH - mFont.tahoma_8b.getWidth("a"), this.y + (this.height - TField.CARET_HEIGHT) / 2 + 5, TField.CARET_WIDTH, TField.CARET_HEIGHT); } GameCanvas.resetTrans(g); if (this.text != null && this.text.Length > 0 && GameCanvas.isTouch) { g.drawImage(GameCanvas.imgClear, this.x + this.width - 13, this.y + this.height / 2 + 3, mGraphics.VCENTER | mGraphics.HCENTER); } } }
// Token: 0x060006E9 RID: 1769 RVA: 0x0005C54C File Offset: 0x0005A74C public static void paint(mGraphics g) { if (!InfoDlg.isShow) { return; } if (InfoDlg.isLock && InfoDlg.delay > 4990) { return; } if (GameScr.isPaintAlert) { return; } int num = 10; GameCanvas.paintz.paintPopUp(GameCanvas.hw - 75, num, 150, 55, g); if (InfoDlg.isLock) { GameCanvas.paintShukiren(GameCanvas.hw - mFont.tahoma_8b.getWidth(InfoDlg.title) / 2 - 10, num + 28, g); mFont.tahoma_8b.drawString(g, InfoDlg.title, GameCanvas.hw + 5, num + 21, 2); } else if (InfoDlg.subtitke != null) { mFont.tahoma_8b.drawString(g, InfoDlg.title, GameCanvas.hw, num + 13, 2); mFont.tahoma_7_green2.drawString(g, InfoDlg.subtitke, GameCanvas.hw, num + 30, 2); } else { mFont.tahoma_8b.drawString(g, InfoDlg.title, GameCanvas.hw, num + 21, 2); } }
private void DareBtn_Click(object sender, EventArgs e) { int index = r.Next(4); switch (index) { case 0: MessageBox.Show("How dare you listen"); break; case 1: MessageBox.Show("This is a dark path you are on"); //TODO Bob : Maybe make the canvas go dark? //apply a background to the grid (I suggest a bool for state( if bright or dark) //when they hit this make the background black, the grid lines white, //if the hit this again then make it back to light (change the message in the message box accordingly break; case 2: MessageBox.Show("I knew you wouldn't listen"); break; case 3: MessageBox.Show("Have some food :)"); FoodMngr.AddRandomFood(20); GameCanvas.Invalidate(); break; default: break; } }
//применение результата торговли к игровым объектам public static void TradeApply(Player playerFrom, Player playerFor, GameCanvas GC, int moneyFromFirstPlayer, int moneyFromSecondPlayer) { //доавление денег, которые игроки зотят передать друг другу AddMoneyToList(playerFrom, playerFor, moneyFromFirstPlayer); AddMoneyToList(playerFor, playerFrom, moneyFromSecondPlayer); if (GC != null) { //очистка канвы торговли GC.ClearTradeMenu(); } if (playerFrom.IdPlayer < playerFor.IdPlayer) { foreach (ThingForTrade thingForTrade in things[playerFrom.IdPlayer, playerFor.IdPlayer]) { if (thingForTrade.PathforTrade != null) { thingForTrade.PathforTrade.IdPlayer = thingForTrade.ForWhichPlayer.IdPlayer; } else { thingForTrade.ForWhichPlayer.Money += thingForTrade.Price; thingForTrade.FromWhichPlayer.Money -= thingForTrade.Price; } } } else if (playerFrom.IdPlayer > playerFor.IdPlayer) { foreach (ThingForTrade thingForTrade in things[playerFor.IdPlayer, playerFrom.IdPlayer]) { if (thingForTrade.PathforTrade != null) { thingForTrade.PathforTrade.IdPlayer = thingForTrade.ForWhichPlayer.IdPlayer; } else { thingForTrade.ForWhichPlayer.Money += thingForTrade.Price; thingForTrade.FromWhichPlayer.Money -= thingForTrade.Price; } } } //если игрок закладывает else { //для каждой улице в списке foreach (ThingForTrade thingForTrade in things[playerFor.IdPlayer, playerFrom.IdPlayer]) { if (thingForTrade.PathforTrade != null) { BlockStreetPath(thingForTrade.PathforTrade, playerFor); } } } TradeClear(playerFor, playerFrom); }
// Token: 0x06000766 RID: 1894 RVA: 0x00063018 File Offset: 0x00061218 public override void updateKey() { if (GameCanvas.keyPressed[(!Main.isPC) ? 2 : 21]) { this.focus--; if (this.focus < 0) { this.focus = 1; } } else if (GameCanvas.keyPressed[(!Main.isPC) ? 8 : 22]) { this.focus++; if (this.focus > 1) { this.focus = 1; } } if (GameCanvas.keyPressed[(!Main.isPC) ? 2 : 21] || GameCanvas.keyPressed[(!Main.isPC) ? 8 : 22]) { GameCanvas.clearKeyPressed(); if (this.focus == 1) { this.tfSerial.isFocus = false; this.tfCode.isFocus = true; if (!GameCanvas.isTouch) { this.right = this.tfCode.cmdClear; } } else if (this.focus == 0) { this.tfSerial.isFocus = true; this.tfCode.isFocus = false; if (!GameCanvas.isTouch) { this.right = this.tfSerial.cmdClear; } } else { this.tfSerial.isFocus = false; this.tfCode.isFocus = false; } } if (GameCanvas.isPointerJustRelease) { if (GameCanvas.isPointerHoldIn(this.tfSerial.x, this.tfSerial.y, this.tfSerial.width, this.tfSerial.height)) { this.focus = 0; } else if (GameCanvas.isPointerHoldIn(this.tfCode.x, this.tfCode.y, this.tfCode.width, this.tfCode.height)) { this.focus = 1; } } base.updateKey(); GameCanvas.clearKeyPressed(); }
// Token: 0x0600042C RID: 1068 RVA: 0x00023718 File Offset: 0x00021918 public static void paint(mGraphics g, string str, int x, int y, int w, int h, mFont f) { if (TextInfo.wStr != f.getWidth(str) || !TextInfo.laststring.Equals(str)) { TextInfo.laststring = str; TextInfo.dx = 0; TextInfo.wStr = f.getWidth(str); TextInfo.isBack = false; TextInfo.tx = 0; } g.setClip(x, y, w, h); if (TextInfo.wStr > w) { f.drawString(g, str, x - TextInfo.dx, y, 0); } else { f.drawString(g, str, x + w / 2, y, 2); } GameCanvas.resetTrans(g); if (TextInfo.wStr > w) { if (!TextInfo.isBack) { TextInfo.tx++; if (TextInfo.tx > 50) { TextInfo.dx++; if (TextInfo.dx >= TextInfo.wStr) { TextInfo.tx = 0; TextInfo.dx = -w + 30; TextInfo.isBack = true; } } } else { if (TextInfo.dx < 0) { int num = w + TextInfo.dx >> 1; TextInfo.dx += num; } if (TextInfo.dx > 0) { TextInfo.dx = 0; } if (TextInfo.dx == 0) { TextInfo.tx++; if (TextInfo.tx == 50) { TextInfo.tx = 0; TextInfo.isBack = false; } } } } }
public CardTop() { view = new GameCanvas(gameWorld); view.Show(); Circle c = new Circle(); gameWorld.Add(c); Zone testZone = new Zone(); testZone.Name = "Bob"; testZone.Position = new System.Drawing.PointF(200, 100); Card testCard = new Card(); testCard.Name = "Ace of Spades"; testZone.Add(testCard); gameWorld.Add(testZone); }
public Dnd() { view = new GameCanvas(gameWorld); view.Show(); //TODO why is the picturebox needed. mainGrid = new Cartesian(view, view.pictureBox); mainGrid.EnableHighlight = true; gameWorld.Add(mainGrid); //TODO have controls in mainGrid to control whether axes are drawn or not. gameWorld.Add(new CartesianAxes(view)); for (int i = 1; i < 10; i++) { Circle c = new Circle(new PointF(rnd.Next(400), rnd.Next(400)), rnd.Next(390) + 10); //if (i > 1) c.Visible = false; gameWorld.Add(c); } }
public void DrawLayerTwo(GameCanvas canvas, List<GameUnit> units, Player player) { if (Active) { foreach (GameUnit unit in units) { if (!unit.Exists) continue; //Infected bar indicator if (unit.InfectionVitality != unit.max_infection_vitality) { canvas.DrawSprite(HealthBarTexture, new Color(0, 50, 100, 200), new Rectangle((int)unit.Position.X - HealthBarTexture.Width / 2, (int)unit.Position.Y - 50, (int)(0.5*(unit.max_infection_vitality - unit.InfectionVitality)), 8), new Rectangle(0, 0, HealthBarTexture.Width, (int)(HealthBarTexture.Height * 0.8))); } if (unit.Type != UnitType.BOSS) { //Health bar canvas.DrawSprite(HealthBarTexture, new Color(0, 50, 0, 100), new Rectangle((int)unit.Position.X - HealthBarTexture.Width / 2, (int)unit.Position.Y - 30, (int)(0.5 * unit.Health), 8), new Rectangle(0, 0, HealthBarTexture.Width, (int)(HealthBarTexture.Height * 0.8))); } } if (player != null) { //Player health canvas.DrawSprite(HealthBarTexture, new Color(0, 50, 0, 200), new Rectangle((int)player.Position.X - HealthBarTexture.Width / 2, (int)player.Position.Y - 30, (int)(0.5 * player.Health), 8), new Rectangle(0, 0, HealthBarTexture.Width, (int)(HealthBarTexture.Height * 0.8))); canvas.DrawSprite(HealthBarTexture, new Color(200, 50, 50, 250), new Rectangle((int)(player.Position.X - canvas.Width/2 + 10), (int)(player.Position.Y - canvas.Height / 2 + 10), (int)(player.Health * 5), 30), new Rectangle(0, 0, HealthBarTexture.Width, HealthBarTexture.Height)); canvas.DrawSprite(HealthBarTexture, new Color(50, 50, 200, 250), new Rectangle((int)(player.Position.X + 10), (int)(player.Position.Y - canvas.Height / 2 + 10), (int)(player.InfectionPoints / 2), 30), new Rectangle(0, 0, HealthBarTexture.Width, HealthBarTexture.Height)); } } }
//TODO pass in a camera object instead of the canvas, or make a camera interface public CartesianAxes(GameCanvas canvas) : base(canvas) { }
public void Draw(GameCanvas canvas) { canvas.DrawOverlay(BackgroundTexture, Color.White, Vector2.Zero); Map.Draw(canvas); }
public Grid(GameCanvas canvas) { Canvas = canvas; EnableHighlight = false; }
public Game(GameCanvas canvas) { this.canvas = canvas; }
public void Draw(GameCanvas canvas) { for(int i = 0; i < tiles.GetLength(0); i++) { for (int j = 0; j < tiles.GetLength(1); j++) { //canvas.DrawText(i + "," + j, Color.White, new Vector2(j * TILE_SIZE, i * TILE_SIZE)); if (Pathfinder.pointLocMap != null) { Vector2 next = Pathfinder.pointLocMap[i, j]; canvas.DrawText((int)next.Y + "," + (int)next.X, Color.White, new Vector2(j * TILE_SIZE, i * TILE_SIZE)); } if (tiles[i, j] == 1) { canvas.DrawSprite(WallTexture, Color.White, new Rectangle(j*TILE_SIZE, i*TILE_SIZE, TILE_SIZE, TILE_SIZE), new Rectangle(0, 0, WallTexture.Width, WallTexture.Height)); } } } }
public MouseHighlight(GameCanvas canvas, Cartesian grid) { this.grid = grid; this.canvas = canvas; }