public async Task <bool> AddChangelog(GameRef game, int modId, string version, string changeMessage) { changeMessage = HttpUtility.HtmlEncode(changeMessage).Replace(@"\n", "\n"); var uri = "/Core/Libs/Common/Managers/Mods?SaveDocumentation"; var message = new HttpRequestMessage(HttpMethod.Post, uri); message.Headers.Add("Referer", $"https://www.nexusmods.com/{game.Name}/mods/edit/?step=docs&id={modId}"); var content = new MultipartFormDataContent(); content.Add(new StringContent(game.Id.ToString()), "game_id"); content.Add(new StringContent(string.Empty), "new_version[]"); content.Add(new StringContent(string.Empty), "new_change[]"); foreach (var change in changeMessage.Split('\n')) { content.Add(new StringContent(version), "new_version[]"); content.Add(new StringContent(change), "new_change[]"); } content.Add("save".ToContent(), "action"); content.Add(new StringContent(modId.ToString()), "id"); message.Content = content; var resp = await _httpClient.SendAsync(message); if (resp.IsSuccessStatusCode) { var strResponse = await resp.Content.ReadAsStringAsync(); var data = System.Text.Json.JsonSerializer.Deserialize <Dictionary <string, object> >(strResponse); return(data.ContainsKey("status") && data["status"].ToString() == true.ToString()); } return(false); }
private void menuItem_Selected(object sender, EventArgs e) { if (sender == startGame) { StateManager.PushState(GameRef.initPrice); } if (sender == loadGame) { StateManager.PushState(GameRef.GamePlayScreen); } if (sender == exitGame) { GameRef.Exit(); } if (sender == resumeGame) { GameRef.spaceShip.setGameState("playing"); StateManager.ChangeState(GameRef.GamePlayScreen); } if (sender == saveGame) { GameRef.board.SaveBoard(); StateManager.PushState(GameRef.GamePlayScreen); } }
public override void Update(GameTime gameTime) { menu.Update(gameTime); if (menu.MouseOver && Xin.CheckMouseReleased(MouseButton.Left)) { switch (menu.SelectedIndex) { case 0: IGamePlayState gamePlayState = (IGamePlayState)Game.Services.GetService( typeof(IGamePlayState)); gamePlayState.SetupNewGame(); manager.PushState((GameState)gamePlayState); break; case 1: break; case 2: manager.PushState(GameRef.OptionState); break; case 3: break; case 4: GameRef.Exit(); break; } } base.Update(gameTime); }
private void menuItem_Selected(object sender, EventArgs e) { if (sender == startGame) { StateManager.PushState(GameRef.AdminScreen, ""); } if (sender == loadGame) { StateManager.PushState(GameRef.GamePlayScreen, ""); } if (sender == exitGame) { GameRef.Exit(); } if (sender == resumeGame) { StateManager.ChangeState(GameRef.GamePlayScreen, "playingScreen"); } if (sender == saveGame) { StateManager.PushState(GameRef.GamePlayScreen, ""); } }
public void Items_Selected(object sender, EventArgs e) { Items.HasFocus = false; if (!textBox) { GameRef.ShowInventory(true); } }
private void UnlinkAll() { if (_enteredGame != null) { _enteredGame.WithNoReply().Leave(_id); _enteredGame = null; } }
public override void Update(GameTime gameTime) { if (InputHandler.KeyPressed(Keys.Space) || InputHandler.KeyPressed(Keys.Enter)) { GameRef.ContinueGame(isLeveled); } base.Update(gameTime); }
public GameBotActor(ClusterNodeContext clusterContext, GameRef game, long userId, string userName) { _logger = LogManager.GetLogger($"GameBotActor({userId}, {userName})"); _game = game; _userId = userId; _userName = userName; }
protected override void LoadContent() { base.LoadContent(); isload = true; objManager = new ObjectManager(base.menuFont); ContentManager Content = Game.Content; float scaleR = GameRef.scaleRatio(); backgroundImage = new PictureBox(Content.Load <Texture2D>(@"UI Content\wood background"), new Rectangle(GameRef.ScreenRectangle.Width, 0, GameRef.ScreenRectangle.Width, GameRef.ScreenRectangle.Height), scaleR); backgroundImage.Position = new Vector2(GameRef.ScreenRectangle.Width, 0); ThemeImage1 = new PictureBox(Content.Load <Texture2D>(@"UI Content\OMNIRAX2"), new Rectangle(GameRef.ScreenRectangle.Width / 2 - 250, GameRef.ScreenRectangle.Height / 2 - 350, 500, 300), 1, 2, scaleR); ThemeImage1.obj_Selected += new EventHandler(menuItem_Selected); arrowTexture = Content.Load <Texture2D>(@"UI Content\Pointer"); stainedGlass = new PictureBox(Content.Load <Texture2D>(@"UI Content\stained-glass-window"), new Rectangle(0, 0, 270, GameRef.ScreenRectangle.Height), 1); stainedGlass2 = new PictureBox(Content.Load <Texture2D>(@"UI Content\stained-glass-window"), new Rectangle(750, 0, 270, GameRef.ScreenRectangle.Height), 1); xnaFont = Content.Load <SpriteFont>(@"Fonts\HudFont"); objManager.Add(new PictureBox(Content.Load <Texture2D>(@"UI Content\BackRound"), GameRef.ScreenRectangle, scaleR)); objManager.Add(backgroundImage); startGame = new LinkLabel(4, Content.Load <Texture2D>(@"UI Content\StartButton"), new Vector2(ThemeImage1.Position.X + 30, ThemeImage1.Position.Y + ThemeImage1.DestinationRectangle.Width / 2 + 50)); startGame.Text = "New Game"; //startGame.Size = startGame.SpriteFont.MeasureString(startGame.Text); startGame.obj_Selected += new EventHandler(menuItem_Selected); startGame.obj_MouseOver += new EventHandler(obj_MouseOver); startGame.obj_Leave += new EventHandler(obj_Leave); loadGame = new LinkLabel(4, Content.Load <Texture2D>(@"UI Content\ContinueBtn"), new Vector2(startGame.Position.X, startGame.Position.Y + startGame.Height * 2)); loadGame.Text = "Continue"; //loadGame.Size = startGame.SpriteFont.MeasureString(startGame.Text); loadGame.obj_Selected += new EventHandler(menuItem_Selected); loadGame.obj_MouseOver += new EventHandler(obj_MouseOver); loadGame.obj_Leave += new EventHandler(obj_Leave); options = new LinkLabel(4, Content.Load <Texture2D>(@"UI Content\OptionsButton"), new Vector2(loadGame.Position.X, loadGame.Position.Y + startGame.Height * 2)); options.Text = "Options"; //options.Size = startGame.SpriteFont.MeasureString(startGame.Text); options.IsLocked = true; options.obj_Selected += new EventHandler(menuItem_Selected); options.obj_MouseOver += new EventHandler(obj_MouseOver); options.obj_Leave += new EventHandler(obj_Leave); exitGame = new LinkLabel(4, Content.Load <Texture2D>(@"UI Content\ExitBtn"), new Vector2(options.Position.X, options.Position.Y + options.Height * 2)); exitGame.Text = "Exit"; // exitGame.Size = startGame.SpriteFont.MeasureString(startGame.Text); exitGame.obj_Selected += new EventHandler(menuItem_Selected); exitGame.obj_MouseOver += new EventHandler(obj_MouseOver); exitGame.obj_Leave += new EventHandler(obj_Leave); XandYMouse = new Label("_", base.menuFont); XandYMouse.SpriteFont = startGame.SpriteFont; XandYMouse.Color = Color.Black; XandYMouse.Position = new Vector2(0, 0); objManager.Add(XandYMouse); }
private void exit_selected(object sender, EventArgs e) { PictureBox s = (PictureBox)sender; s.btnDwn = true; this.Hide(); GameRef.Exit(); s.btnDwn = false; }
private void Awake() { // Get the Realtime component on this game object _realtime = GetComponent <Realtime>(); localRef = GetComponent <GameRef>(); // Notify us when Realtime successfully connects to the room _realtime.didConnectToRoom += DidConnectToRoom; }
public void EndCombat(bool isLeveled) { if (Enemies[0].name == "King James") { GameRef.Win(); } else { GameRef.ShowGainedItems(sb.ToString(), isLeveled); } }
public void menu_Selected(object sender, EventArgs e) { if (sender == start) { GameRef.StartGame(); } if (sender == exit) { Game.Exit(); } }
public override void Update(GameTime gameTime) { base.Update(gameTime); populateLabels(new Vector2(10, 120)); gold.Text = "Gold: " + player.Money; ControlManager.Update(gameTime, playerIndexInControl); if (InputHandler.KeyPressed(Keys.Escape)) { GameRef.ContinueGame(false); } }
public override void Draw(GameTime gameTime) { GameRef.RenderHealth(GameRef.SpriteBatch, health); GameRef.RenderScore(GameRef.SpriteBatch, score); string title = "Press Enter to serve!"; Vector2 msgSize = Constants.G_FONTS_MEDIUM.MeasureString(title); GameRef.SpriteBatch.DrawString(Constants.G_FONTS_MEDIUM, title, new Vector2((Constants.VIRTUAL_WIDTH / 2) - (msgSize.X / 2), Constants.VIRTUAL_HEIGHT / 2), Color.White); base.Draw(gameTime); }
public async Task <bool> AddFile(GameRef game, int modId, UploadedFile upload, FileOptions options) { var uri = "/Core/Libs/Common/Managers/Mods?AddFile"; var message = new HttpRequestMessage(HttpMethod.Post, uri); message.Headers.Add("Referer", $"https://www.nexusmods.com/{game.Name}/mods/edit/?step=docs&id={modId}"); using (var content = new MultipartFormDataContent()) { content.Add(game.Id.ToContent(), "game_id"); content.Add(options.Name.ToContent(), "name"); content.Add(options.Version.ToContent(), "file-version"); content.Add(options.UpdateMainVersion ? 1.ToContent() : 0.ToContent(), "update-version"); content.Add(1.ToContent(), "category"); if (options.PreviousFileId.HasValue) { content.Add(1.ToContent(), "new-existing"); content.Add(options.PreviousFileId.Value.ToContent(), "old_file_id"); } content.Add(options.Description.ToContent(), "brief-overview"); content.Add(options.RemoveDownloadWithManager ? 1.ToContent() : 0.ToContent(), "remove_nmm_button"); content.Add(options.SetAsMainVortex != null ? options.SetAsMainVortex.Value ? 1.ToContent() : 0.ToContent() : options.UpdateMainVersion ? 1.ToContent() : 0.ToContent(), "set_as_main_nmm"); content.Add(upload.Id.ToContent(), "file_uuid"); content.Add(upload.FileSize.ToContent(), "file_size"); content.Add(modId.ToContent(), "mod_id"); content.Add(modId.ToContent(), "id"); content.Add("add".ToContent(), "action"); content.Add(upload.FileName.ToContent(), "uploaded_file"); content.Add(upload.OriginalFile.ToContent(), "original_file"); message.Content = content; var resp = await _httpClient.SendAsync(message); if (resp.IsSuccessStatusCode) { var strResponse = await resp.Content.ReadAsStringAsync(); var data = System.Text.Json.JsonSerializer.Deserialize <Dictionary <string, object> >(strResponse); var success = data.ContainsKey("status") && data["status"].ToString() == true.ToString(); if (success) { return(true); } else { _logger.LogWarning("Response received from Nexus Mods: " + data["message"].ToString()); } } return(false); } }
public override void Draw(GameTime gameTime) { GameRef.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend); if (Input_Handler.KeyReleased(Keys.Escape)) { GameRef.Exit(); } objManager.Draw(GameRef.spriteBatch); GameRef.spriteBatch.End(); base.Draw(gameTime); }
void LabelTen_Clear(object sender, EventArgs e) { player.ConsumablesList.RemoveAt(9); player.ConsumablesList.Insert(9, null); if (fromCombat) { GameRef.ContinueCombat(); } else { GameRef.ContinueGame(false); } }
void EquipNine_Clear(object sender, EventArgs e) { player.EquipList.RemoveAt(8); player.EquipList.Insert(8, null); if (fromCombat) { GameRef.ContinueCombat(); } else { GameRef.ContinueGame(false); } }
public override void Draw(GameTime gameTime) { base.Draw(gameTime); GameRef.RenderScore(GameRef.SpriteBatch, score); GameRef.RenderHealth(GameRef.SpriteBatch, health); if (paused) { string pausedMsg = "PAUSED"; Vector2 msgSize = Constants.G_FONTS_LARGE.MeasureString(pausedMsg); GameRef.SpriteBatch.DrawString(Constants.G_FONTS_LARGE, pausedMsg, new Vector2(Constants.VIRTUAL_WIDTH / 2 - msgSize.X / 2, Constants.VIRTUAL_HEIGHT / 2 - 16), Color.White); } }
private void menuItem_Selected(object sender, EventArgs e) { if (sender == startGame) { StateManager.PushState(GameRef.GamePlayScreen); } if (sender == loadGame) { StateManager.PushState(GameRef.GamePlayScreen); } if (sender == exitGame) { GameRef.Exit(); } }
public override void Update(GameTime gameTime) { if (InputHandler.KeyPressed(Keys.D1)) { StateManager.PushState(GameRef.levelSelect); } if (InputHandler.KeyPressed(Keys.Escape)) { Sounds.stop(); GameRef.Exit(); } base.Update(gameTime); }
private void menuItem_Selected(object sender, EventArgs e) { if (sender == _startGame) { StateManager.PushState(GameRef.CharacterGeneratorScreen); } if (sender == _loadGame) { StateManager.PushState(GameRef.GamePlayScreen); } if (sender == _exitGame) { GameRef.Exit(); } }
private void Run_Selected(object sender, EventArgs e) { Run.HasFocus = false; if (!textBox) { if (Player.Speed > Enemies[0].Speed && Player.Speed > Enemies[1].Speed) { GameRef.ContinueGame(false); } else { EnemyTurn(); } } }
async Task IUser.LeaveGame() { if (_enteredGame == null) { throw new InvalidOperationException(); } // Let's exit from the room ! await _enteredGame.Leave(_id); // Unbind an game actor from channel _channel.WithNoReply().UnbindActor(_enteredGame.CastToIActorRef()); _enteredGame = null; }
/// <summary> /// Updates the titlescreen /// </summary> /// <param name="gameTime">snapshot of the current time</param> public override void Update(GameTime gameTime) { if (!HasFocus) { return; } // exits the game when exitKey released if (Input.IsKeyReleased(Input.ExitKey)) { GameRef.Exit(); } ControlManager.Update(gameTime); base.Update(gameTime); }
public override void Update(GameTime gameTime) { if (player.ConsumablesList != null) { foreach (Item i in player.ConsumablesList) { if (i != null) { if (ControlManager[ControlManager.selectedControl].Text.Equals(i.Name)) { Desclabel.Text = i.Description; } } } } if (player.EquipList != null) { foreach (Item i in player.EquipList) { if (i != null) { if (ControlManager[ControlManager.selectedControl].Text.Equals(i.Name) || ControlManager[ControlManager.selectedControl].Text.Equals(i.Name + "[E]")) { Desclabel.Text = i.Description; } } } } if (InputHandler.KeyPressed(Keys.I) || InputHandler.KeyPressed(Keys.Escape)) { if (fromCombat) { GameRef.ContinueCombat(); } else { GameRef.ContinueGame(false); } } Vector2 position = new Vector2(0, 0); populateConLabels(position); populateEquipLabels(); ControlManager.Update(gameTime, playerIndexInControl); base.Update(gameTime); }
public override void Update(GameTime gameTime) { ControlManager.Update(gameTime, playerIndexInControl); if (InputHandler.KeyPressed(Keys.Escape) || InputHandler.KeyPressed(Keys.C)) { if (fromCombat) { GameRef.ContinueCombat(); } else { GameRef.ContinueGame(false); } } base.Update(gameTime); }
private void menuItem_Selected(object sender, EventArgs e) { if (sender == startGame) { Transition(ChangeType.Push, GameRef.CharacterGeneratorScreen); } if (sender == loadGame) { Transition(ChangeType.Push, GameRef.LoadGameScreen); } if (sender == exitGame) { GameRef.Exit(); } }
private void menuItem_Selected(object sender, EventArgs e) { if (sender == newGame) { Transition(ChangeType.Push, GameRef.NewGameScreen); } if (sender == continueGame) { //Transition(ChangeType.Push, GameRef.LoadGameScreen); if (sender == exitGame) { GameRef.Exit(); } } }