public IGame CreateGame(string gameDir, GameOptions options) { MyTraceContext.ThreadTraceContext = new MyTraceContext("Server"); Trace.TraceInformation("Initializing area"); var initSw = Stopwatch.StartNew(); IGame game; switch (options.Mode) { case GameMode.Fortress: game = new Fortress.FortressGame(gameDir, options); break; case GameMode.Adventure: game = new Fortress.DungeonGame(gameDir, options); break; default: throw new Exception(); } initSw.Stop(); Trace.TraceInformation("Initializing area took {0} ms", initSw.ElapsedMilliseconds); return game; }
public static GameOptions instance; //instance of this singleton #endregion Fields #region Methods public void Awake() { DontDestroyOnLoad (gameObject); if (instance == null) instance = this; //singleton }
void MediumButton() { GameObject temp_Thing = GameObject.Find("GameOptions"); gameOptions = temp_Thing.GetComponent<GameOptions>(); gameOptions.difficulty = "medium"; Application.LoadLevel("ultimate_paintdrop_chucknorris"); }
public GameOptions findOptions(int x, int y, int move) { GameOptions options = new GameOptions(); fo(x,y,TileCosts.Basic,0,options); options.finalize(); return options; }
public Minesweeper(IMinefieldFactory minefield_factory, GameOptions game_options) { _game_id = game_options.player_id; DomainEvents.raise(new MinesweeperGameStarted(_game_id)); _minefield = minefield_factory.create_a_mindfield_with_these_options(game_options, _game_id); }
// Use this for initialization void Start() { // Get the player player = GameObject.FindGameObjectWithTag ("Player").GetComponent<Player> (); worldMap = GameObject.FindGameObjectWithTag ("GameController").GetComponent<WorldMap> (); options = GameObject.FindGameObjectWithTag ("GameController").GetComponent<GameOptions> (); speed = worldMap.mapTileSize; }
// Use this for initialization void Start () { m_View = GetComponent<CoherentUIView>(); m_GameOptions = new GameOptions { Backend = "Unity3D", Width = 1024, Height = 768, NetPort = 17777, }; }
// Use this for initialization void Start () { m_View = GetComponent<CoherentUIView>(); m_View.Listener.ReadyForBindings += HandleReadyForBindings; m_GameOptions = new GameOptions { Backend = "Unity3D", Width = 1024, Height = 768, NetPort = 17777, }; }
public Task StartAsync(EmbeddedServerOptions options) { if (options.ServerMode == EmbeddedServerMode.None) throw new Exception(); m_serverMode = options.ServerMode; m_gameOptions = options.NewGameOptions; if (!System.IO.Directory.Exists(options.SaveGamePath)) System.IO.Directory.CreateDirectory(options.SaveGamePath); Guid save = Guid.Empty; m_saveManager = new SaveManager(options.SaveGamePath); if (options.CleanSaveDir) m_saveManager.DeleteAll(); else save = m_saveManager.GetLatestSaveFile(); CreateEmbeddedServer(options.SaveGamePath, save); var tcs = new TaskCompletionSource<object>(); var serverStartWaitHandle = new AutoResetEvent(false); ThreadPool.RegisterWaitForSingleObject(serverStartWaitHandle, (o, timeout) => { serverStartWaitHandle.Dispose(); if (timeout) { m_serverThread.Abort(); tcs.SetException(new Exception("Timeout waiting for server")); } else { tcs.SetResult(null); } }, null, TimeSpan.FromSeconds(60), true); m_serverThread = new Thread(ServerMain); m_serverThread.Start(serverStartWaitHandle); return tcs.Task; }
public IMinefield create_a_mindfield_with_these_options(GameOptions game_options, Guid game_id) { var grid = _grid_factory.create_grid_with_size_of(game_options.game_difficulty.minefield_size, game_id); var mine_planter = _mine_planter_factory.create_for(game_options.game_difficulty); mine_planter.plant_mines_on(grid); var minefield = new Minefield(grid, _mine_clearer); // TODO: Move this to inside the constructor? // DomainEvent.raise(new MinefieldCreatedFor(_game_id, minefield)); return minefield; }
// Use this for initialization void Awake () { Time.timeScale = 0; timeLimit = timelim; timeLimit *= 60; gameEnd = true; timer = GameObject.Find ("Time").GetComponent<UnityEngine.UI.Text> (); options = GameObject.Find ("GameOptions"); info = options.GetComponent<GameOptions> (); InstantiatePlayers (1); StartCoroutine(StartDelay ()); //var go = Instantiate(yes.GetComponent<GameOptions> ().p1, transform.position, transform.rotation); //How to add players //cam.targets.Add(yes.GetComponent<GameOptions> ().p1.GetComponent<Player>()); }
public static Texture getToolModeTexture(GameOptions.toolModes toolMode) { if (toolModeTextures == null) { toolModeTextures = new Hashtable(); Texture texture = Resources.Load(ResourcePaths.toolModePlace) as Texture; toolModeTextures.Add(GameOptions.toolModes.placeBlock, texture); texture = Resources.Load(ResourcePaths.toolModeRemove) as Texture; toolModeTextures.Add(GameOptions.toolModes.removeBlock, texture); texture = Resources.Load(ResourcePaths.toolModeRepair) as Texture; toolModeTextures.Add(GameOptions.toolModes.repairBlock, texture); texture = Resources.Load(ResourcePaths.toolModeScan) as Texture; toolModeTextures.Add(GameOptions.toolModes.scanBlock, texture); } return (Texture)toolModeTextures[toolMode]; }
protected GameEngine(string gameDir, GameOptions options) { CommonInit(); m_gameDir = gameDir; this.GameMode = options.Mode; this.World = new World(options.Mode, options.TickMethod); m_players = new List<Player>(); m_playerIDCounter = 2; m_config = new GameConfig { RequirePlayer = true, MaxMoveTime = TimeSpan.Zero, MinTickTime = TimeSpan.FromMilliseconds(50), IronPythonEnabled = ServerConfig.IronPythonEnabled, }; this.LastSaveID = Guid.Empty; this.LastLoadID = Guid.Empty; }
public void CalculateWinner() { /// <summary> /// Declare Dictionary for comparing of selection /// </summary> Dictionary <PlayerOption, PlayerOption> winners = new Dictionary <PlayerOption, PlayerOption> { { PlayerOption.Rock, PlayerOption.Scissors }, { PlayerOption.Scissors, PlayerOption.Paper }, { PlayerOption.Paper, PlayerOption.Rock } }; //Instantiate GameOptions GameOptions gameOptions = new GameOptions(); //if true the game will play computer vs computer //if false the game will play player vs computer gameOptions.computerOnly = false; if (gameOptions.computerOnly) { PlayerOption firstComputerChoice = GetComputerSelection(); Console.WriteLine($"The computer choosed: {firstComputerChoice}"); PlayerOption secondComputerChoice = GetComputerSelection(); Console.WriteLine($"The computer choosed: {secondComputerChoice}"); //tie game if (firstComputerChoice == secondComputerChoice) { gameOptions.FirstComputerWins++; gameOptions.SecondComputerWins++; Console.WriteLine($"The game is a tie."); Assert.IsTrue(firstComputerChoice == secondComputerChoice); } else { //if the result equals the computers roll then the player wins //otherwise the computer wins. var result = winners[firstComputerChoice]; if (result == secondComputerChoice) { gameOptions.FirstComputerWins++; Console.WriteLine($"Computer1 wins {firstComputerChoice} beats {secondComputerChoice}."); Assert.IsTrue(result == secondComputerChoice); } else { gameOptions.SecondComputerWins++; Console.WriteLine($"Computer2 wins {secondComputerChoice} beats {firstComputerChoice}."); Assert.IsTrue(result == secondComputerChoice); } } } else { PlayerOption computerOption = EnumHelper.Of <PlayerOption>(); PlayerOption playerOption = EnumHelper.Of <PlayerOption>(); //tie game if (playerOption == computerOption) { gameOptions.PlayerWins++; gameOptions.ComputerWins++; Console.WriteLine($"The game is a tie."); Assert.IsTrue(playerOption == computerOption); } else { //if the result equals the computers roll then the player wins //otherwise the computer wins. var result = winners[playerOption]; if (result == computerOption) { gameOptions.PlayerWins++; Console.WriteLine($"Congratulations you won. {playerOption} beats {computerOption}."); Assert.IsTrue(result == computerOption); } else { gameOptions.ComputerWins++; Console.WriteLine($"Computer Wins. {computerOption} beats {playerOption}."); Assert.IsTrue(result != computerOption); } } } }
private void cancelButton_Click(object sender, RoutedEventArgs e) { _gameOptions = null; this.Close(); }
private void SetGameOptions(ObjectId gameId, GameOptions gameOptions) => GameProvider.SetGameOptions(gameId, gameOptions);
public void OnSpectatorRegistered(RegistrationResults result, Versioning clientVersion, int spectatorId, bool gameStarted, GameOptions options) { UpdateCallCount(System.Reflection.MethodBase.GetCurrentMethod().Name); }
/// <summary> /// Saves game options /// </summary> /// <param name="options"></param> public static void SaveGameOptions(GameOptions options) { SaveFile("gameOptions.txt", options); }
public PlayerStatsController(ScreenManager screen, CharacterModel characterModel, GameOptions gameOptions) : base(screen) { this.PlayerStats = new PlayerStats(gameOptions.Lifes, characterModel.playerIndex); this.characterModel = characterModel; this.gameOptions = gameOptions; }
private void setMouseButton(GameOptions.toolModes toolMode) { Debug.Log("setMouseButton for " + toolMode); if (gmm.lastMouseButton < 0 || gmm.lastMouseButton > 1) { Debug.Log("Error. ran setMouseButton but left and right mouse weren't clicking?"); } else { GameOptions.mouseTool[gmm.lastMouseButton] = toolMode; } }
public TestGame(GameInput gameInput, IServiceProvider serviceProvider, GameOptions options) : base(serviceProvider, options) { _gameInput = gameInput; }
//saves the game options to a file. private void saveOptions() { BinaryFormatter bf = new BinaryFormatter(); FileStream file = File.Open(Application.dataPath + "/gameOptions.wort", FileMode.OpenOrCreate); GameOptions options = new GameOptions(Port, VSync, wWidth, wHeight, isFullscreen, Volume); bf.Serialize(file, options); file.Close(); }
public HelpView(GameOptions options) { _options = options; }
// Use this for initialization void Start() { complete = false; GameObject options_temp = GameObject.Find("GameOptions"); gameOptions = options_temp.GetComponent<GameOptions>(); combos = GetComponent<combo_master>(); GameObject gui_temp = GameObject.Find("gui_object"); t_gui = gui_temp.GetComponent<tutorial_gui>(); color = "none"; input_lock = true; //LOAD TEXTURES /*red_tex = Resources.Load("red") as Texture; blue_tex = Resources.Load("blue") as Texture; white_tex = Resources.Load("white") as Texture; yellow_tex = Resources.Load("yellow") as Texture;*/ //DEAL WITH ANIMATIONS bino = GameObject.Find("tutorial_bino"); bino.animation.Stop(); bino.animation.Play("running"); bino.animation["running"].speed = 1.6f; bino.animation["powerup"].layer = 1; bino.animation.wrapMode = WrapMode.Once; bino.animation["running"].wrapMode = WrapMode.Loop; }
//saves the game options to a file. private void saveOptions() { BinaryFormatter bf = new BinaryFormatter(); FileStream file = File.Open(Application.dataPath + "/gameOptions.wort", FileMode.OpenOrCreate); GameOptions options = new GameOptions(SMAAQuality, SSAOQuality, postProcessingQuality, reflectionQuality, reflectionUpdateFrequency, shadowQuality, vSync, Fullscreen, waterQuality, frameTarget, cameraSensitivity, cameraXInvert, cameraYInvert, grassQuality); bf.Serialize(file, options); file.Close(); }
public List<Tile> getTilesInMovement(int x, int y,TileCosts costs,int distance) { List<Tile> tiles = new List<Tile>(); GameOptions options = new GameOptions(); tiles = gtim (x,y,costs,distance,options,tiles); return tiles; }
public InitializationData(int playerId, GameOptions gameOptions, GameState gameState) { PlayerId = playerId; GameOptions = gameOptions; GameState = gameState; }
public GameServerStatus(GameOptions gameOptions, int connectedPlayersNumber, string serverStatusTitle) { GameOptions = gameOptions; ConnectedPlayersNumber = connectedPlayersNumber; ServerStatusTitle = serverStatusTitle; }
// Setup public void SetupObjectReferences() { move = gameObject.GetComponent<TileMovement>(); attack = gameObject.GetComponent<TileAttack>(); worldMap = GameObject.FindGameObjectWithTag ("GameController").GetComponent<WorldMap> (); worldSound = GameObject.FindGameObjectWithTag ("GameController").GetComponent<WorldSound> (); ui = GameObject.FindGameObjectWithTag ("UIMain").GetComponent<UIMain> (); actorManager = GameObject.FindGameObjectWithTag ("GameController").GetComponent<ActorManager> (); player = GameObject.FindGameObjectWithTag ("Player").GetComponent<Player> (); options = GameObject.FindGameObjectWithTag ("GameController").GetComponent<GameOptions> (); animationPosition = new Vector2(tileX*worldMap.mapTileSize,tileY*worldMap.mapTileSize); }
/// <summary> /// Send new game message (asynchronous) /// </summary> /// <param name="gameOptions">Game options</param> /// <returns>Send result task</returns> internal Task <SendResult> SendNewGameMessageAsync(GameOptions gameOptions) => SendMessageAsync(messageBuilder.BuildNewGameMessage(gameOptions));
// Use this for initialization void Start() { movementInputTimer = Time.fixedTime; options = GameObject.FindGameObjectWithTag ("GameController").GetComponent<GameOptions> (); worldMap = GameObject.FindGameObjectWithTag ("GameController").GetComponent<WorldMap> (); worldSound = GameObject.FindGameObjectWithTag ("GameController").GetComponent<WorldSound> (); move = gameObject.GetComponent<TileMovement>(); attack = gameObject.GetComponent<TileAttack>(); camera = GameObject.FindGameObjectWithTag ("MainCamera").GetComponent<Camera> (); actorManager = GameObject.FindGameObjectWithTag ("GameController").GetComponent<ActorManager> (); player = GameObject.FindGameObjectWithTag ("Player").GetComponent<Player> (); ui = GameObject.FindGameObjectWithTag ("UIMain").GetComponent<UIMain> (); }
/// <summary> /// Save when quitting game /// </summary> private void OnApplicationQuit() { GameOptions.SaveOptions(); }
//method called by wrapper getTilesInMovement private List<Tile> gtim(int x,int y,TileCosts costs, int distance, GameOptions explored,List<Tile> tiles) { if (distance < 0) return new List<Tile>(); if (!onMap(x,y)) return new List<Tile>(); if (tiles.Contains(map[x,y])){ if (explored.get(x,y) < distance){ explored.set (x,y,distance); } else return new List<Tile>();//there was a more efficient route } else{ tiles.Add (map[x,y]); explored.set(x,y,distance); } if (onMap(x+1,y))gtim (x+1,y,costs,distance - (int)costs.costs[map[x+1,y].type],explored,tiles); if (onMap(x-1,y))gtim (x-1,y,costs,distance - (int)costs.costs[map[x-1,y].type],explored,tiles); if (onMap(x,y+1))gtim (x,y+1,costs,distance - (int)costs.costs[map[x,y+1].type],explored,tiles); if (onMap(x,y-1))gtim (x,y-1,costs,distance - (int)costs.costs[map[x,y-1].type],explored,tiles); return tiles; }
// Use this for initialization private void Start() { // Initialise variables GameOptions.LoadOptions(); challengeGenerator = GetComponent <ChallengeGenerator>(); challengeGenerator.GenerateChallenges(); audioManager = GetComponent <AudioManager>(); menu = FindObjectOfType <Menu>(); dictData = new DictData(dict); dictData.Setup(); letterList = new DictData(challengesFile); letterList.CleanLetterCombos(); letters = new char[3]; scores = new Scores(); answers = new List <string>(); word = new Word(); input.onEndEdit.AddListener(CheckInput); gameState = GameState.Pregame; IncreasePoints = new IntEvent(); IncreaseTime = new IntEvent(); bannedWords = bannedWordsAsset.ToString().Split('\n').ToList(); for (int i = 0; i < bannedWords.Count(); ++i) { bannedWords[i] = bannedWords[i].TrimEnd('\r'); } // Check if this is the first time the game has been played bool playedBefore = false; for (int mode = 1; mode < 3; ++mode) { // For each game mode for (int diff = 1; diff < 4; ++diff) { // For each difficulty if (scores.GetBestScore((GameMode)mode, (Difficulty)diff) > 0) { // If high score > 0 then played before playedBefore = true; break; } } if (playedBefore) { break; } } // Finished initialising variables // If not played before then start with the tutorial if (!playedBefore) { FindObjectOfType <LogoOpening>().SetNotPlayedBefore(); GameInfo.SetGameMode(GameMode.Welcome); } #if UNITY_IOS || UNITY_ANDROID // Initialise ads on mobile Ads.AdFinished.AddListener(AdCompleted); Ads.AdSkipped.AddListener(AdCompleted); Ads.AdFailed.AddListener(GoToMenu); #endif }
public void GenerateField(PlayingFieldController playingField, GameOptions gameOptions) { throw new System.NotImplementedException(); }
public GameOptions findOptions(int x, int y, int move) { GameOptions options = new GameOptions(); return findOptionsPartTwo(x,y,move,options); }
public void OnOptionsChanged(GameOptions options) { UpdateCallCount(System.Reflection.MethodBase.GetCurrentMethod().Name); }
public IMinesweeper create_game_with(GameOptions game_options) { return new Minesweeper(_minefield_factory, game_options); }
public void OnPlayerRegistered(RegistrationResults result, Versioning clientVersion, int playerId, bool gameStarted, bool isServerMaster, GameOptions options) { UpdateCallCount(System.Reflection.MethodBase.GetCurrentMethod().Name); }
/// <summary> /// Calculates the winner /// </summary> /// <param name="playerOption"></param> /// <param name="computerOption"></param> /// <param name="gameOptions"></param> /// <returns></returns> public GameOptions CalculateWinner(PlayerOption playerOption, PlayerOption computerOption, GameOptions gameOptions) { /// <summary> /// Declare Dictionary for comparing of selection /// rock beats scissors /// scissors beats paper /// paper beats rock /// </summary> Dictionary <PlayerOption, PlayerOption> winners = new Dictionary <PlayerOption, PlayerOption> { { PlayerOption.Rock, PlayerOption.Scissors }, { PlayerOption.Scissors, PlayerOption.Paper }, { PlayerOption.Paper, PlayerOption.Rock } }; //if true the game will play computer vs computer //if false the game will play player vs computer if (gameOptions.computerOnly) { //tie game if (playerOption == computerOption) { Console.WriteLine($"The game is a tie."); gameOptions.FirstComputerWins++; gameOptions.SecondComputerWins++; } else { //if the result equals the computers roll then the player wins //otherwise the computer wins. var result = winners[playerOption]; if (result == computerOption) { Console.WriteLine($"Computer1 wins {playerOption} beats {computerOption}."); gameOptions.FirstComputerWins++; } else { Console.WriteLine($"Computer2 wins {computerOption} beats {playerOption}."); gameOptions.SecondComputerWins++; } } } else { //tie game if (playerOption == computerOption) { Console.WriteLine($"The game is a tie."); gameOptions.PlayerWins++; gameOptions.ComputerWins++; } else { //if the result equals the computers roll then the player wins //otherwise the computer wins. var result = winners[playerOption]; if (result == computerOption) { Console.WriteLine($"Congratulations you won. {playerOption} beats {computerOption}."); gameOptions.PlayerWins++; } else { Console.WriteLine($"Computer Wins. {computerOption} beats {playerOption}."); gameOptions.ComputerWins++; } } } return(gameOptions); }
// Use this for initialization void Start() { //beth_style.fontSize = 32; //beth_style.font = gap = Screen.width / 25.0f; ratio = Screen.width / (5.0f * redpad.width); icon_dim = redpad.width * ratio; Debug.Log(redpad.width); GameObject options_temp = GameObject.Find("GameOptions"); gameOptions = options_temp.GetComponent<GameOptions>(); GameObject bino_temp = GameObject.Find("tutorial_bino"); t_script = bino_temp.GetComponent<tutorial_script>(); combos = bino_temp.GetComponent<combo_master>(); cur_combo = "blue"; tutorial_cooldown = 10f; }
public void StartJoiningGame(GameOptions gameFilter, Guid accountToken) { throw new NotImplementedException(); }
public DoomMenu(DoomApplication app) { this.app = app; this.options = app.Options; this.thisIsShareware = new PressAnyKey(this, DoomInfo.Strings.SWSTRING, null); this.saveFailed = new PressAnyKey(this, DoomInfo.Strings.SAVEDEAD, null); this.nightmareConfirm = new YesNoConfirm(this, DoomInfo.Strings.NIGHTMARE, () => app.NewGame(GameSkill.Nightmare, this.selectedEpisode, 1)); this.endGameConfirm = new YesNoConfirm(this, DoomInfo.Strings.ENDGAME, () => app.EndGame()); this.quitConfirm = new QuitConfirm(this, app); this.skillMenu = new SelectableMenu( this, "M_NEWG", 96, 14, "M_SKILL", 54, 38, 2, new SimpleMenuItem("M_JKILL", 16, 58, 48, 63, () => app.NewGame(GameSkill.Baby, this.selectedEpisode, 1), null), new SimpleMenuItem("M_ROUGH", 16, 74, 48, 79, () => app.NewGame(GameSkill.Easy, this.selectedEpisode, 1), null), new SimpleMenuItem("M_HURT", 16, 90, 48, 95, () => app.NewGame(GameSkill.Medium, this.selectedEpisode, 1), null), new SimpleMenuItem("M_ULTRA", 16, 106, 48, 111, () => app.NewGame(GameSkill.Hard, this.selectedEpisode, 1), null), new SimpleMenuItem("M_NMARE", 16, 122, 48, 127, null, this.nightmareConfirm) ); if (DoomApplication.Instance.IWad == "doom" || DoomApplication.Instance.IWad == "freedoom") { this.episodeMenu = new SelectableMenu( this, "M_EPISOD", 54, 38, 0, new SimpleMenuItem("M_EPI1", 16, 58, 48, 63, () => this.selectedEpisode = 1, this.skillMenu), new SimpleMenuItem("M_EPI2", 16, 74, 48, 79, () => this.selectedEpisode = 2, this.skillMenu), new SimpleMenuItem("M_EPI3", 16, 90, 48, 95, () => this.selectedEpisode = 3, this.skillMenu), new SimpleMenuItem("M_EPI4", 16, 106, 48, 111, () => this.selectedEpisode = 4, this.skillMenu) ); } else { if (DoomApplication.Instance.IWad == "doom1") { this.episodeMenu = new SelectableMenu( this, "M_EPISOD", 54, 38, 0, new SimpleMenuItem("M_EPI1", 16, 58, 48, 63, () => this.selectedEpisode = 1, this.skillMenu), new SimpleMenuItem("M_EPI2", 16, 74, 48, 79, null, this.thisIsShareware), new SimpleMenuItem("M_EPI3", 16, 90, 48, 95, null, this.thisIsShareware) ); } else { this.episodeMenu = new SelectableMenu( this, "M_EPISOD", 54, 38, 0, new SimpleMenuItem("M_EPI1", 16, 58, 48, 63, () => this.selectedEpisode = 1, this.skillMenu), new SimpleMenuItem("M_EPI2", 16, 74, 48, 79, () => this.selectedEpisode = 2, this.skillMenu), new SimpleMenuItem("M_EPI3", 16, 90, 48, 95, () => this.selectedEpisode = 3, this.skillMenu) ); } } var sound = this.options.Sound; var music = this.options.Music; this.volume = new SelectableMenu( this, "M_SVOL", 60, 38, 0, new SliderMenuItem("M_SFXVOL", 48, 59, 80, 64, sound.MaxVolume + 1, () => sound.Volume, vol => sound.Volume = vol), new SliderMenuItem("M_MUSVOL", 48, 91, 80, 96, music.MaxVolume + 1, () => music.Volume, vol => music.Volume = vol) ); var renderer = this.options.Renderer; var userInput = this.options.UserInput; this.optionMenu = new SelectableMenu( this, "M_OPTTTL", 108, 15, 0, new SimpleMenuItem("M_ENDGAM", 28, 32, 60, 37, null, this.endGameConfirm, () => app.State == ApplicationState.Game), new ToggleMenuItem( "M_MESSG", 28, 48, 60, 53, "M_MSGON", "M_MSGOFF", 180, () => renderer.DisplayMessage ? 0 : 1, value => renderer.DisplayMessage = value == 0 ), new SliderMenuItem( "M_SCRNSZ", 28, 80 - 16, 60, 85 - 16, renderer.MaxWindowSize + 1, () => renderer.WindowSize, size => renderer.WindowSize = size ), new SliderMenuItem( "M_MSENS", 28, 112 - 16, 60, 117 - 16, userInput.MaxMouseSensitivity + 1, () => userInput.MouseSensitivity, ms => userInput.MouseSensitivity = ms ), new SimpleMenuItem("M_SVOL", 28, 144 - 16, 60, 149 - 16, null, this.volume) ); this.load = new LoadMenu( this, "M_LOADG", 72, 28, 0, new TextBoxMenuItem(48, 49, 72, 61), new TextBoxMenuItem(48, 65, 72, 77), new TextBoxMenuItem(48, 81, 72, 93), new TextBoxMenuItem(48, 97, 72, 109), new TextBoxMenuItem(48, 113, 72, 125), new TextBoxMenuItem(48, 129, 72, 141) ); this.save = new SaveMenu( this, "M_SAVEG", 72, 28, 0, new TextBoxMenuItem(48, 49, 72, 61), new TextBoxMenuItem(48, 65, 72, 77), new TextBoxMenuItem(48, 81, 72, 93), new TextBoxMenuItem(48, 97, 72, 109), new TextBoxMenuItem(48, 113, 72, 125), new TextBoxMenuItem(48, 129, 72, 141) ); this.help = new HelpScreen(this); if (DoomApplication.Instance.IWad == "doom2" || DoomApplication.Instance.IWad == "freedoom2" || DoomApplication.Instance.IWad == "plutonia" || DoomApplication.Instance.IWad == "tnt") { this.main = new SelectableMenu( this, "M_DOOM", 94, 2, 0, new SimpleMenuItem("M_NGAME", 65, 67, 97, 72, null, this.skillMenu), new SimpleMenuItem("M_OPTION", 65, 83, 97, 88, null, this.optionMenu), new SimpleMenuItem("M_LOADG", 65, 99, 97, 104, null, this.load), new SimpleMenuItem( "M_SAVEG", 65, 115, 97, 120, null, this.save, () => !(app.State == ApplicationState.Game && app.Game.State != GameState.Level) ), new SimpleMenuItem("M_QUITG", 65, 131, 97, 136, null, this.quitConfirm) ); } else { this.main = new SelectableMenu( this, "M_DOOM", 94, 2, 0, new SimpleMenuItem("M_NGAME", 65, 59, 97, 64, null, this.episodeMenu), new SimpleMenuItem("M_OPTION", 65, 75, 97, 80, null, this.optionMenu), new SimpleMenuItem("M_LOADG", 65, 91, 97, 96, null, this.load), new SimpleMenuItem( "M_SAVEG", 65, 107, 97, 112, null, this.save, () => !(app.State == ApplicationState.Game && app.Game.State != GameState.Level) ), new SimpleMenuItem("M_RDTHIS", 65, 123, 97, 128, null, this.help), new SimpleMenuItem("M_QUITG", 65, 139, 97, 144, null, this.quitConfirm) ); } this.current = this.main; this.active = false; this.tics = 0; this.selectedEpisode = 1; this.saveSlots = new SaveSlots(); }
public void ChangeOptions(GameOptions options) { _host.ChangeOptions(Callback, options); }
public Options() { _gameOptions = GameOptions.Create(); DataContext = _gameOptions; InitializeComponent(); }
/// <summary> /// Return the full player with the given id, with Hotbars, SkillTabs, Inventories, etc. /// </summary> /// <returns>Player</returns> public Player FindPlayerById(long characterId, GameSession session) { dynamic data = QueryFactory.Query(TableName).Where("character_id", characterId) .Join("levels", "levels.id", "characters.levels_id") .Join("accounts", "accounts.id", "characters.account_id") .Join("game_options", "game_options.id", "characters.game_options_id") .Join("wallets", "wallets.id", "characters.wallet_id") .Join("auth_data", "auth_data.account_id", "characters.account_id") .LeftJoin("homes", "homes.account_id", "accounts.id") .Select( "characters.{*}", "levels.{level, exp, rest_exp, prestige_level, prestige_exp, mastery_exp}", "accounts.{username, password_hash, creation_time, last_log_time, character_slots, meret, game_meret, event_meret, meso_token, bank_inventory_id, mushking_royale_id, vip_expiration, meso_market_daily_listings, meso_market_monthly_purchases}", "game_options.{keybinds, active_hotbar_id}", "wallets.{meso, valor_token, treva, rue, havi_fruit}", "homes.id as home_id", "auth_data.{token_a, token_b, online_character_id}") .FirstOrDefault(); List <Hotbar> hotbars = DatabaseManager.Hotbars.FindAllByGameOptionsId(data.game_options_id); List <Macro> macros = DatabaseManager.Macros.FindAllByCharacterId(data.character_id); List <SkillTab> skillTabs = DatabaseManager.SkillTabs.FindAllByCharacterId(data.character_id, data.job); IInventory inventory = DatabaseManager.Inventories.FindById(data.inventory_id); BankInventory bankInventory = DatabaseManager.BankInventories.FindById(data.bank_inventory_id); MushkingRoyaleStats royaleStats = DatabaseManager.MushkingRoyaleStats.FindById(data.mushking_royale_id); List <Medal> medals = DatabaseManager.MushkingRoyaleMedals.FindAllByAccountId(data.account_id); Dictionary <int, Trophy> trophies = DatabaseManager.Trophies.FindAllByCharacterId(data.character_id); List <ClubMember> clubMemberships = DatabaseManager.ClubMembers.FindAllClubIdsByCharacterId(data.character_id); foreach (KeyValuePair <int, Trophy> trophy in DatabaseManager.Trophies.FindAllByAccountId(data.account_id)) { trophies.Add(trophy.Key, trophy.Value); } Dictionary <int, QuestStatus> questList = DatabaseManager.Quests.FindAllByCharacterId(data.character_id); AuthData authData = new(data.token_a, data.token_b, data.account_id, data.online_character_id ?? 0); return(new() { Session = session, CharacterId = data.character_id, AccountId = data.account_id, Account = new(data.account_id, data, bankInventory, royaleStats, medals, authData, session), CreationTime = data.creation_time, Birthday = data.birthday, Name = data.name, Gender = (Gender)data.gender, Awakened = data.awakened, ChannelId = data.channel_id, InstanceId = data.instance_id, IsMigrating = data.is_migrating, Job = (Job)data.job, Levels = new(data.level, data.exp, data.rest_exp, data.prestige_level, data.prestige_exp, JsonConvert.DeserializeObject <List <MasteryExp> >(data.mastery_exp), session, data.levels_id), MapId = data.map_id, TitleId = data.title_id, InsigniaId = data.insignia_id, Titles = JsonConvert.DeserializeObject <List <int> >(data.titles), PrestigeRewardsClaimed = JsonConvert.DeserializeObject <List <int> >(data.prestige_rewards_claimed), PrestigeMissions = JsonConvert.DeserializeObject <List <PrestigeMission> >(data.prestige_missions), GearScore = data.gear_score, MaxSkillTabs = data.max_skill_tabs, ActiveSkillTabId = data.active_skill_tab_id, GameOptions = new GameOptions(JsonConvert.DeserializeObject <Dictionary <int, KeyBind> >(data.keybinds), hotbars, data.active_hotbar_id, data.game_options_id), Macros = macros, Wallet = new Wallet(data.meso, data.valor_token, data.treva, data.rue, data.havi_fruit, session, data.wallet_id), Inventory = inventory, ChatSticker = JsonConvert.DeserializeObject <List <ChatSticker> >(data.chat_sticker), SavedCoord = JsonConvert.DeserializeObject <CoordF>(data.coord), Emotes = JsonConvert.DeserializeObject <List <int> >(data.emotes), FavoriteStickers = JsonConvert.DeserializeObject <List <int> >(data.favorite_stickers), GuildApplications = JsonConvert.DeserializeObject <List <GuildApplication> >(data.guild_applications), GuildId = data.guild_id ?? 0, ClubMembers = clubMemberships, IsDeleted = data.is_deleted, Motto = data.motto, ProfileUrl = data.profile_url, ReturnCoord = JsonConvert.DeserializeObject <CoordF>(data.return_coord), ReturnMapId = data.return_map_id, SkinColor = JsonConvert.DeserializeObject <SkinColor>(data.skin_color), StatPointDistribution = JsonConvert.DeserializeObject <StatDistribution>(data.statpoint_distribution), Stats = JsonConvert.DeserializeObject <Stats>(data.stats), TrophyCount = JsonConvert.DeserializeObject <int[]>(data.trophy_count), UnlockedMaps = JsonConvert.DeserializeObject <List <int> >(data.unlocked_maps), UnlockedTaxis = JsonConvert.DeserializeObject <List <int> >(data.unlocked_taxis), VisitingHomeId = data.visiting_home_id, SkillTabs = skillTabs, TrophyData = trophies, QuestData = questList, GatheringCount = JsonConvert.DeserializeObject <List <GatheringCount> >(data.gathering_count), ActivePet = DatabaseManager.Items.FindByUid(data.active_pet_item_uid) }); }
//[SerializeField] private GameObject gamePersistent = default; void Start() { gops = FindObjectOfType <GameOptions>(); }
public async Task AddSongAsync([Remainder] string paramString = null) { if (IsAdmin()) { var eventId = paramString.ParseArgs("赛事"); var songId = paramString.ParseArgs("歌曲"); if (string.IsNullOrEmpty(eventId) || string.IsNullOrEmpty(songId)) { await ReplyAsync(embed : ("用法: `添加歌曲 -赛事 \"[赛事ID]\" -歌曲 [链接/key]`\n" + "赛事ID可以通过`赛事列表`命令查找\n" + "可选参数: `-难度 [Easy/Normal/Hard/Expert/ExpertPlus]`, `-谱型 [例如: onesaber]`, `-[修改项]` (例如: 不死模式为 `-nofail`)").ErrorEmbed()); return; } //Parse the difficulty input, either as an int or a string BeatmapDifficulty difficulty = BeatmapDifficulty.ExpertPlus; string difficultyArg = paramString.ParseArgs("难度"); if (difficultyArg != null) { //If the enum conversion doesn't succeed, try it as an int if (!Enum.TryParse(difficultyArg, true, out difficulty)) { await ReplyAsync(embed : "请检查难度参数".ErrorEmbed()); return; } } string characteristic = paramString.ParseArgs("谱型"); characteristic = characteristic ?? "Standard"; GameOptions gameOptions = GameOptions.None; PlayerOptions playerOptions = PlayerOptions.None; //Load up the GameOptions and PlayerOptions foreach (GameOptions o in Enum.GetValues(typeof(GameOptions))) { if (paramString.ParseArgs(o.ToString()) == "true") { gameOptions = (gameOptions | o); } } foreach (PlayerOptions o in Enum.GetValues(typeof(PlayerOptions))) { if (paramString.ParseArgs(o.ToString()) == "true") { playerOptions = (playerOptions | o); } } //Sanitize input if (songId.StartsWith("https://beatsaver.com/") || songId.StartsWith("https://bsaber.com/")) { //Strip off the trailing slash if there is one if (songId.EndsWith("/")) { songId = songId.Substring(0, songId.Length - 1); } //Strip off the beginning of the url to leave the id songId = songId.Substring(songId.LastIndexOf("/") + 1); } if (songId.Contains("&")) { songId = songId.Substring(0, songId.IndexOf("&")); } var server = ServerService.GetServer(); if (server == null) { await ReplyAsync(embed : "服务器不在线,所以不能添加歌曲".ErrorEmbed()); } else { //Get the hash for the song var hash = BeatSaverDownloader.GetHashFromID(songId); var knownPairs = await HostScraper.ScrapeHosts(server.State.KnownHosts, $"{server.CoreServer.Address}:{server.CoreServer.Port}", 0); var targetPair = knownPairs.FirstOrDefault(x => x.Value.Events.Any(y => y.EventId.ToString() == eventId)); var targetEvent = targetPair.Value.Events.FirstOrDefault(x => x.EventId.ToString() == eventId); var songPool = targetEvent.QualifierMaps.ToList(); if (OstHelper.IsOst(hash)) { if (!SongExists(songPool, hash, characteristic, (int)difficulty, (int)gameOptions, (int)playerOptions)) { GameplayParameters parameters = new GameplayParameters { Beatmap = new Beatmap { Name = OstHelper.GetOstSongNameFromLevelId(hash), LevelId = hash, Characteristic = new Characteristic { SerializedName = characteristic }, Difficulty = difficulty }, GameplayModifiers = new GameplayModifiers { Options = gameOptions }, PlayerSettings = new PlayerSpecificSettings { Options = playerOptions } }; songPool.Add(parameters); targetEvent.QualifierMaps = songPool.ToArray(); var response = await server.SendUpdateQualifierEvent(targetPair.Key, targetEvent); if (response.Type == Response.ResponseType.Success) { await ReplyAsync(embed : ($"已添加: {parameters.Beatmap.Name} ({difficulty}) ({characteristic})" + $"{(gameOptions != GameOptions.None ? $" 附加游戏参数: ({gameOptions})" : "")}" + $"{(playerOptions != PlayerOptions.None ? $" 附加玩家参数: ({playerOptions})" : "!")}").SuccessEmbed()); } else if (response.Type == Response.ResponseType.Fail) { await ReplyAsync(embed : response.Message.ErrorEmbed()); } } else { await ReplyAsync(embed : "歌曲已存在于数据库".ErrorEmbed()); } } else { var songInfo = await BeatSaverDownloader.GetSongInfo(songId); string songName = songInfo.Name; if (!songInfo.HasDifficulty(characteristic, difficulty)) { BeatmapDifficulty nextBestDifficulty = songInfo.GetClosestDifficultyPreferLower(characteristic, difficulty); if (SongExists(songPool, hash, characteristic, (int)nextBestDifficulty, (int)gameOptions, (int)playerOptions)) { await ReplyAsync(embed : $"{songName} 不存在 {difficulty} 难度, 而且 {nextBestDifficulty} 已存在于赛事".ErrorEmbed()); } else { GameplayParameters parameters = new GameplayParameters { Beatmap = new Beatmap { Name = songName, LevelId = $"custom_level_{hash.ToUpper()}", Characteristic = new Characteristic { SerializedName = characteristic }, Difficulty = nextBestDifficulty }, GameplayModifiers = new GameplayModifiers { Options = gameOptions }, PlayerSettings = new PlayerSpecificSettings { Options = playerOptions } }; songPool.Add(parameters); targetEvent.QualifierMaps = songPool.ToArray(); var response = await server.SendUpdateQualifierEvent(targetPair.Key, targetEvent); if (response.Type == Response.ResponseType.Success) { await ReplyAsync(embed : ($"{songName} 不存在 {difficulty} 难度, 使用 {nextBestDifficulty} 难度代替。\n" + $"已添加至歌曲列表" + $"{(gameOptions != GameOptions.None ? $" 附加游戏参数: ({gameOptions})" : "")}" + $"{(playerOptions != PlayerOptions.None ? $" 附加玩家参数: ({playerOptions})" : "!")}").SuccessEmbed()); } else if (response.Type == Response.ResponseType.Fail) { await ReplyAsync(embed : response.Message.ErrorEmbed()); } } } else { GameplayParameters parameters = new GameplayParameters { Beatmap = new Beatmap { Name = songName, LevelId = $"custom_level_{hash.ToUpper()}", Characteristic = new Characteristic { SerializedName = characteristic }, Difficulty = difficulty }, GameplayModifiers = new GameplayModifiers { Options = gameOptions }, PlayerSettings = new PlayerSpecificSettings { Options = playerOptions } }; songPool.Add(parameters); targetEvent.QualifierMaps = songPool.ToArray(); var response = await server.SendUpdateQualifierEvent(targetPair.Key, targetEvent); if (response.Type == Response.ResponseType.Success) { await ReplyAsync(embed : ($"{songName} ({difficulty}) ({characteristic}) 已下载并添加至歌曲列表" + $"{(gameOptions != GameOptions.None ? $" 附加游戏参数: ({gameOptions})" : "")}" + $"{(playerOptions != PlayerOptions.None ? $" 附加玩家参数: ({playerOptions})" : "!")}").SuccessEmbed()); } else if (response.Type == Response.ResponseType.Fail) { await ReplyAsync(embed : response.Message.ErrorEmbed()); } } } } } else { await ReplyAsync(embed : "你没有足够的权限使用该命令".ErrorEmbed()); } }
private void RefreshOptionsUI() { m_toggle_SwapLeftRightClick.isOn = GameOptions.GetSwapRightLeftClick(); m_dropdown_qualitySettings.value = GameOptions.GetQualitySetting(); }
public void OnPlayerRegistered(RegistrationResults result, Versioning serverVersion, int playerId, bool gameStarted, bool isServerMaster, GameOptions options) { ExceptionFreeAction(() => Callback.OnPlayerRegistered(result, serverVersion, playerId, gameStarted, isServerMaster, options)); }
public void ApplyOptions(GameOptions options) { m_View.View.TriggerEvent("gameConsole:Trace", options); }
void Awake() { _instance = this; }
void OnEnable() { quiet = true; GetComponentInChildren <Toggle>().isOn = GameOptions.LoadBool(prefName); quiet = false; }
private GameOptions findOptionsPartTwo(int x, int y, int move, GameOptions options) { //highlights all tiles that the unit can move to. if (options.get (x,y) != null && options.get (x,y) > move){ return options; } else { options.set(x,y,move); } Tile tile = map[x,y]; tile.highlight (new Color(.09f,.180f,.220f)); //highlight blue highlighted.AddFirst(tile); if (x-1 >= 0 && move - map[x-1,y].moveCost >= 0) //check that the next space is in the map and that it does not exceed movement cost. {findOptionsPartTwo (x-1,y,move - map[x-1,y].moveCost, options);} if (x+1 < WIDTH && move - map[x+1,y].moveCost >= 0) {findOptionsPartTwo (x+1,y,move - map[x+1,y].moveCost, options);} if (y-1 >= 0 && move - map[x,y-1].moveCost >= 0) {findOptionsPartTwo (x,y-1,move - map[x,y-1].moveCost, options);} if (y+1 < HEIGHT && move - map[x,y+1].moveCost >= 0) {findOptionsPartTwo (x,y+1,move - map[x,y+1].moveCost, options);} return options; }
static void Main(string[] args) { Log.Default.Initialize(ConfigurationManager.AppSettings["logpath"], "server.log"); Version version = Assembly.GetEntryAssembly().GetName().Version; string company = ((AssemblyCompanyAttribute)Attribute.GetCustomAttribute(Assembly.GetExecutingAssembly(), typeof(AssemblyCompanyAttribute), false)).Company; string product = ((AssemblyProductAttribute)Attribute.GetCustomAttribute(Assembly.GetExecutingAssembly(), typeof(AssemblyProductAttribute), false)).Product; Log.Default.WriteLine(LogLevels.Info, "{0} {1}.{2} by {3}", product, version.Major, version.Minor, company); // IFactory factory = new Factory(); // IBanManager banManager = factory.CreateBanManager(); // IPlayerManager playerManager = factory.CreatePlayerManager(6); ISpectatorManager spectatorManager = factory.CreateSpectatorManager(10); // IHost wcfHost = new Server.WCFHost.WCFHost( playerManager, spectatorManager, banManager, factory) { Port = ConfigurationManager.AppSettings["port"] }; // IHost builtInHost = new BuiltInHostBase( playerManager, spectatorManager, banManager, factory); IHost socketHost = new TCPHostBase(playerManager, spectatorManager, banManager, factory) { Port = 5656 }; // List <DummyBuiltInClient> clients = new List <DummyBuiltInClient> { //new DummyBuiltInClient("BuiltIn-Joel" + Guid.NewGuid().ToString().Substring(0, 5), () => builtInHost), //new DummyBuiltInClient("BuiltIn-Celine" + Guid.NewGuid().ToString().Substring(0, 5), () => builtInHost) }; // IActionQueue actionQueue = factory.CreateActionQueue(); // IPieceProvider pieceProvider = factory.CreatePieceProvider(); // IServer server = new Server.Server(playerManager, spectatorManager, pieceProvider, actionQueue); server.AddHost(wcfHost); server.AddHost(builtInHost); server.AddHost(socketHost); // try { server.StartServer(); } catch (Exception ex) { Log.Default.WriteLine(LogLevels.Error, "Cannot start server. Exception: {0}", ex); return; } DisplayHelp(); bool stopped = false; while (!stopped) { if (Console.KeyAvailable) { ConsoleKeyInfo cki = Console.ReadKey(true); switch (cki.Key) { default: DisplayHelp(); break; case ConsoleKey.X: server.StopServer(); stopped = true; break; case ConsoleKey.S: server.StartGame(); break; case ConsoleKey.T: server.StopGame(); break; case ConsoleKey.P: server.PauseGame(); break; case ConsoleKey.R: server.ResumeGame(); break; case ConsoleKey.Add: clients.Add(new DummyBuiltInClient("BuiltIn-" + Guid.NewGuid().ToString().Substring(0, 5), () => builtInHost)); break; case ConsoleKey.Subtract: { DummyBuiltInClient client = clients.LastOrDefault(); if (client != null) { client.DisconnectFromServer(); clients.Remove(client); } break; } case ConsoleKey.L: { DummyBuiltInClient client = clients.LastOrDefault(); client?.Lose(); break; } case ConsoleKey.D: Console.WriteLine("Players:"); foreach (IPlayer p in playerManager.Players) { Console.WriteLine("{0}) {1} [{2}] {3} {4} {5:HH:mm:ss.fff} {6:HH:mm:ss.fff}", p.Id, p.Name, p.Team, p.State, p.PieceIndex, p.LastActionFromClient, p.LastActionToClient); } Console.WriteLine("Spectators:"); foreach (ISpectator s in spectatorManager.Spectators) { Console.WriteLine("{0}) {1} {2:HH:mm:ss.fff} {3:HH:mm:ss.fff}", s.Id, s.Name, s.LastActionFromClient, s.LastActionToClient); } break; case ConsoleKey.W: foreach (WinEntry e in server.WinList) { Console.WriteLine("{0}[{1}]: {2} pts", e.PlayerName, e.Team, e.Score); } break; case ConsoleKey.Q: server.ResetWinList(); break; case ConsoleKey.O: { GameOptions options = server.Options; foreach (PieceOccurancy occurancy in options.PieceOccurancies) { Console.WriteLine("{0}:{1}", occurancy.Value, occurancy.Occurancy); } foreach (SpecialOccurancy occurancy in options.SpecialOccurancies) { Console.WriteLine("{0}:{1}", occurancy.Value, occurancy.Occurancy); } } break; case ConsoleKey.I: { foreach (KeyValuePair <string, GameStatisticsByPlayer> byPlayer in server.GameStatistics) { GameStatisticsByPlayer stats = byPlayer.Value; string playerName = byPlayer.Key; Console.WriteLine("{0}) {1} : 1:{2} 2:{3} 3:{4} 4:{5}", byPlayer.Key, playerName, stats.SingleCount, stats.DoubleCount, stats.TripleCount, stats.TetrisCount); foreach (KeyValuePair <Specials, Dictionary <string, int> > bySpecial in stats.SpecialsUsed) { Console.WriteLine("Special {0}", bySpecial.Key); foreach (KeyValuePair <string, int> kv in bySpecial.Value) { string otherName = kv.Key; Console.WriteLine("\t{0}:{1}", otherName, kv.Value); } } } break; } } } else { System.Threading.Thread.Sleep(100); Parallel.ForEach( clients, client => client.Test()); } } }
public override void OnGameStarted(GameOptions options) { _specialsUsed = options.SpecialOccurancies.Where(x => x.Occurancy > 0).ToDictionary(x => x.Value, x => false); }
public async Task RemoveSongAsync([Remainder] string paramString = null) { if (IsAdmin()) { var server = ServerService.GetServer(); if (server == null) { await ReplyAsync(embed : "服务器不在线,所以不能获取赛事信息".ErrorEmbed()); } else { var eventId = paramString.ParseArgs("赛事"); var songId = paramString.ParseArgs("歌曲"); if (string.IsNullOrEmpty(eventId)) { await ReplyAsync(embed : ("用法: `删除歌曲 -赛事 \"[赛事ID]\" -歌曲 [链接/key]`\n" + "赛事ID可以通过`赛事列表`命令查找\n" + "注意: 你可能需要在命令种包含难度或者修改项信息来确保你删除的是正确的歌曲").ErrorEmbed()); return; } var knownPairs = await HostScraper.ScrapeHosts(server.State.KnownHosts, $"{server.CoreServer.Address}:{server.CoreServer.Port}", 0); var targetPair = knownPairs.FirstOrDefault(x => x.Value.Events.Any(y => y.EventId.ToString() == eventId)); var targetEvent = targetPair.Value.Events.FirstOrDefault(x => x.EventId.ToString() == eventId); var songPool = targetEvent.QualifierMaps.ToList(); //Parse the difficulty input, either as an int or a string BeatmapDifficulty difficulty = BeatmapDifficulty.ExpertPlus; string difficultyArg = paramString.ParseArgs("难度"); if (difficultyArg != null) { //If the enum conversion doesn't succeed, try it as an int if (!Enum.TryParse(difficultyArg, true, out difficulty)) { await ReplyAsync(embed : ("请检查难度参数\n" + "用法: `删除歌曲 [歌曲ID] [难度]`").ErrorEmbed()); return; } } string characteristic = paramString.ParseArgs("谱型"); characteristic = characteristic ?? "Standard"; GameOptions gameOptions = GameOptions.None; PlayerOptions playerOptions = PlayerOptions.None; //Load up the GameOptions and PlayerOptions foreach (GameOptions o in Enum.GetValues(typeof(GameOptions))) { if (paramString.ParseArgs(o.ToString()) == "true") { gameOptions = (gameOptions | o); } } foreach (PlayerOptions o in Enum.GetValues(typeof(PlayerOptions))) { if (paramString.ParseArgs(o.ToString()) == "true") { playerOptions = (playerOptions | o); } } //Sanitize input if (songId.StartsWith("https://beatsaver.com/") || songId.StartsWith("https://bsaber.com/")) { //Strip off the trailing slash if there is one if (songId.EndsWith("/")) { songId = songId.Substring(0, songId.Length - 1); } //Strip off the beginning of the url to leave the id songId = songId.Substring(songId.LastIndexOf("/") + 1); } if (songId.Contains("&")) { songId = songId.Substring(0, songId.IndexOf("&")); } //Get the hash for the song var hash = BeatSaverDownloader.GetHashFromID(songId); var song = FindSong(songPool, $"custom_level_{hash.ToUpper()}", characteristic, (int)difficulty, (int)gameOptions, (int)playerOptions); if (song != null) { targetEvent.QualifierMaps = RemoveSong(songPool, $"custom_level_{hash.ToUpper()}", characteristic, (int)difficulty, (int)gameOptions, (int)playerOptions).ToArray(); var response = await server.SendUpdateQualifierEvent(targetPair.Key, targetEvent); if (response.Type == Response.ResponseType.Success) { await ReplyAsync(embed : ($"已从歌曲列表中删除 {song.Beatmap.Name} ({difficulty}) ({characteristic}) " + $"{(gameOptions != GameOptions.None ? $" 附加游戏参数: ({gameOptions})" : "")}" + $"{(playerOptions != PlayerOptions.None ? $" 附加玩家参数: ({playerOptions})" : "!")}").SuccessEmbed()); } else if (response.Type == Response.ResponseType.Fail) { await ReplyAsync(embed : response.Message.ErrorEmbed()); } } else { await ReplyAsync(embed : $"指定歌曲没有相对应 难度/谱型/游戏选项/玩家选项 ({difficulty} {characteristic} {gameOptions} {playerOptions})".ErrorEmbed()); } } } }
public Game(GameOptions options) { Options = options; Day = 0; }
public ShopHandler(GameDataService gameDataService, IOptions <GameOptions> gameOptions, ILogger <ShopHandler> logger) { _gameDataService = gameDataService; _logger = logger; _gameOptions = gameOptions.Value; }
// Use this for initialization void Start() { simul_timer = 0.05f; combo_timer = 7; combo_count = 0; Debug.Log("Num of gameoptions: " + GameObject.FindGameObjectsWithTag("GameOptions").Length); GameObject temp_Thing = GameObject.Find("GameOptions"); if(temp_Thing != null) { the_options = temp_Thing.GetComponent<GameOptions>(); red_combo = the_options.red_combo; blue_combo = the_options.blue_combo; yellow_combo = the_options.yellow_combo; Debug.Log("~~~Created combo master, combo length: " + red_combo.Count + " vs. " + the_options.red_combo.Count); } else { red_combo.Add("blue"); red_combo.Add("combo"); red_combo.Add("blue"); red_combo.Add("combo"); red_combo.Add("blue"); red_combo.Add("combo"); blue_combo.Add("yellow"); blue_combo.Add("yellow"); blue_combo.Add("yellow"); blue_combo.Add("yellow"); blue_combo.Add("yellow"); blue_combo.Add("yellow"); yellow_combo.Add("combo"); yellow_combo.Add("combo"); yellow_combo.Add("combo"); yellow_combo.Add("combo"); } }