コード例 #1
0
 public void InitializeEntries(Dropdown dropdown)
 {
     dropdown.options.Clear();
     dropdown.options.Add(new Dropdown.OptionData("None"));
     dropdown.options.Add(new Dropdown.OptionData("FXAA"));
     dropdown.options.Add(new Dropdown.OptionData("TAA"));
     dropdown.options.Add(new Dropdown.OptionData("SMAA"));
     dropdown.SetValueWithoutNotify((int)GameOption.Get <HDRPCameraOption>().antiAliasing);
 }
コード例 #2
0
    private void Update()
    {
        int shift = Input.GetKey(KeyCode.LeftShift) || Input.GetKey(KeyCode.RightShift) ? -1 : 1;

        if (Input.GetKeyDown(KeyCode.F1))
        {
            var camOption = GameOption.Get <HDRPCameraOption>();
            int val       = (int)camOption.antiAliasing + 1 * shift;
            if (val > 3)
            {
                val = 0;
            }
            if (val < 0)
            {
                val = 3;
            }
            camOption.antiAliasing = (HDAdditionalCameraData.AntialiasingMode)val;
            GameOptions.Apply();
            Refresh();
        }

        if (Input.GetKeyDown(KeyCode.F2))
        {
            var grpOption = GameOption.Get <SpaceshipOptions>();
            int val       = grpOption.screenPercentage + 10 * shift;
            if (val > 100)
            {
                val = 50;
            }
            if (val < 50)
            {
                val = 100;
            }
            grpOption.screenPercentage = val;
            GameOptions.Apply();
            Refresh();
        }

        if (Input.GetKeyDown(KeyCode.F3))
        {
            var grpOption = GameOption.Get <SpaceshipOptions>();
            int val       = (int)grpOption.upsamplingMethod + 1 * shift;
            if (val > 4)
            {
                val = 0;
            }
            if (val < 0)
            {
                val = 4;
            }

            grpOption.upsamplingMethod = (SpaceshipOptions.UpsamplingMethod)val;
            GameOptions.Apply();
            Refresh();
        }
    }
コード例 #3
0
        public string GetResponseSentence(GameOption playerMove, GameOption computerMove, TurnWinner winner,
                                          PlayerTurnResult playerTurnResult)
        {
            if (!playerTurnResult.NextMoveReady)
            {
                throw new ValidationException("Next move must be ready.");
            }

            return("Ready for your next move.");
        }
コード例 #4
0
        void UpdateOptions(int value)
        {
            var option = GameOption.Get <HDRPCameraOption>();

            option.antiAliasing = (HDAdditionalCameraData.AntialiasingMode)value;

            if (ApplyImmediately)
            {
                option.Apply();
            }
        }
コード例 #5
0
        public void TestGameOptionsIfEnemyCanBeAddedToList()
        {
            GameOption GameOption = new GameOption();
            Enemy      enemy      = new Enemy("Slime", 5, 1);

            GameOption.Enemies.Clear();
            GameOption.addEnemy(enemy);
            Enemy enemy1 = GameOption.Enemies[0];

            Assert.AreEqual(enemy1, enemy);
        }
コード例 #6
0
    // Awake Start Update

    private void Awake()
    {
        this.objectOptionManager = GameObject.FindWithTag("OptionManager");
        this.scriptGameOption    = this.objectOptionManager.GetComponent <GameOption>();

        this.sliderBGMVolume = this.objectSliderBGMVolume.GetComponent <Slider>();
        this.sliderSEVolume  = this.objectSliderSEVolume.GetComponent <Slider>();

        this.textBGMVolume = this.objectTextBGMVolume.GetComponent <Text>();
        this.textSEVolume  = this.objectTextSEVolume.GetComponent <Text>();
    }
コード例 #7
0
 public long StartNewGame(string ticket, StartGameModel startGameModel)
 {
     lock (mutex)
     {
         var ctx = GetContext(ticket);
         if (ctx != null && chessboard == null && (IsComputerGame() || userTickets.Count == 2))
         {
             ChessEngineOption engineOpt = null;
             if (IsComputerGame())
             {
                 engineOpt = GetOptions().ChessEngines.SingleOrDefault((opt) => opt.Name == startGameModel.ChessEngineName);
                 if (engineOpt == null)
                 {
                     throw new ArgumentException($"Invalid chess engine '{startGameModel.ChessEngineName}'.");
                 }
                 if (startGameModel.Level < 1 || startGameModel.Level > 9)
                 {
                     throw new ArgumentException($"Invalid level ${startGameModel.Level}.");
                 }
             }
             var    users       = userTickets.Values.OrderBy(ctx => ctx.Created).ToList();
             string whitePlayer = users[0].Name;
             string blackPlayer = !computerGame ? users[1].Name : engineOpt.Name;
             if (startGameModel.MyColor == "W" && ctx.Name != whitePlayer ||
                 startGameModel.MyColor == "B" && ctx.Name != blackPlayer)
             {
                 (whitePlayer, blackPlayer) = (blackPlayer, whitePlayer);
             }
             GameOption gameOption = startGameModel.GameOption switch
             {
                 "fastchess" => GameOption.FastChess,
                 "chess15" => GameOption.Chess15,
                 "chess30" => GameOption.Chess30,
                 "chess60" => GameOption.Chess60,
                 _ => GameOption.FastChess
             };
             if (IsComputerGame() && gameOption == GameOption.FastChess)
             {
                 gameOption = GameOption.Chess15;
             }
             chessboard             = new Chessboard(whitePlayer, blackPlayer, gameOption);
             ctx.StartGameConfirmed = true;
             if (IsComputerGame())
             {
                 StartChessEngine(engineOpt);
                 chessengine.Level      = startGameModel.Level;
                 chessboard.GameStarted = true;
                 PlayChessEngineNewGame(ctx, chessboard);
             }
             stateChanged = DateTime.UtcNow;
         }
         return(GetStateChanged());
     }
 }
コード例 #8
0
        public void TestGameOptionsIfUpgradeCanBeAddedToList()
        {
            GameOption GameOption = new GameOption();
            Upgrade    upg        = new Upgrade("random", "ClickDamage", 30);

            GameOption.Upgrades.Clear();
            GameOption.addUpgrade(upg);
            Upgrade upg1 = GameOption.Upgrades[0];

            Assert.AreEqual(upg1, upg);
        }
コード例 #9
0
        public static THHGame initGameWithoutPlayers(string name, GameOption option)
        {
            TaskExceptionHandler.register();
            THHGame game = new THHGame(option != null ? option : GameOption.Default, CardHelper.getCardDefines())
            {
                answers  = new GameObject(nameof(AnswerManager)).AddComponent <AnswerManager>(),
                triggers = new GameObject("TriggerManager").AddComponent <TriggerManager>(),
                logger   = new ULogger()
            };

            (game.triggers as TriggerManager).logger = game.logger;
            return(game);
        }
コード例 #10
0
        public Task <TurnWinner> JudgeTurnAsync(GameOption playerMove, GameOption computerMove)
        {
            if (playerMove == computerMove)
            {
                return(Task.FromResult(TurnWinner.Tie));
            }

            var playerWon = (playerMove == GameOption.Rock && computerMove == GameOption.Scissor) ||
                            (playerMove == GameOption.Paper && computerMove == GameOption.Rock) ||
                            (playerMove == GameOption.Scissor && computerMove == GameOption.Paper);

            return(Task.FromResult(playerWon ? TurnWinner.Human : TurnWinner.Computer));
        }
コード例 #11
0
        public void GetResponseSentence_Winner_Computer(
            GameOption playerMove, GameOption computerMove)
        {
            var target = new ResponseResultSentenceProvider();

            var result = target.GetResponseSentence(
                playerMove, computerMove, TurnWinner.Computer,
                new PlayerTurnResult {
                NextMoveReady = true, CurrentStreak = 1
            });

            Assert.AreEqual($"{playerMove} lost to {computerMove}.", result);
        }
コード例 #12
0
        public void GetResponseSentence_Tie(
            GameOption playerMove, GameOption computerMove)
        {
            var target = new ResponseResultSentenceProvider();

            var result = target.GetResponseSentence(
                playerMove, computerMove, TurnWinner.Tie,
                new PlayerTurnResult {
                NextMoveReady = true
            });

            Assert.AreEqual("Tie!", result);
        }
コード例 #13
0
        private static string ConvertGameOption(GameOption g)
        {
            var o = g switch
            {
                GameOption.FastChess => "fastchess",
                GameOption.Chess15 => "chess15",
                GameOption.Chess30 => "chess30",
                GameOption.Chess60 => "chess60",
                _ => throw new ArgumentException("Invalid game option")
            };

            return(o);
        }
コード例 #14
0
    private void Awake()
    {
        this.scriptGameDirector = this.GetComponent <GameDirector>();
        this.scriptScore        = this.GetComponent <Score>();

        this.objectOptionManager = GameObject.FindWithTag("OptionManager");
        this.scriptGameOption    = this.objectOptionManager.GetComponent <GameOption>();

        this.objectSEManager = GameObject.FindWithTag("SEManager");
        this.scriptSEManager = this.objectSEManager.GetComponent <SEManager>();

        this.scriptGameButton = this.objectCanvasButton.GetComponent <GameButton>();
    }
コード例 #15
0
        public static string ToText(this GameOption gameOption)
        {
            switch (gameOption)
            {
            case GameOption.Default: return("Default");

            case GameOption.On: return("On");

            case GameOption.Off: return("Off");

            default: return(null);
            }
        }
コード例 #16
0
ファイル: GameSession.cs プロジェクト: umebayashi/Game
        public static GameSession CreateSession(GameOption gameOption, Player[] players)
        {
            var newUID = Guid.NewGuid();
            var session = new GameSession { UID = newUID, GameOption = gameOption, Players = players, ActivePlayer = players[0] };

            foreach (var player in players)
            {
                player.PieceMoved += session.Player_PieceMoved;
            }

            session.InitializeBoardCellStatusList();

            return session;
        }
コード例 #17
0
        public void Play()
        {
            //create a new gameObject to tell the game scene how it should play
            GameObject info = new GameObject();

            DontDestroyOnLoad(info);

            info.name = "GameSize";
            GameOption option = info.AddComponent <GameOption>();

            option.SetOption(boards[boardPos]);

            SceneManager.LoadScene("Game");
        }
コード例 #18
0
 public static bool AddNewGameOption(GameOption gameOption)
 {
     if (!Options.OptionsByCategory.ContainsKey(gameOption.Category))
     {
         Options.OptionsByCategory.Add(gameOption.Category, new List <GameOption>());
     }
     if (!Options.OptionsByID.ContainsKey(gameOption.ID))
     {
         Options.OptionsByCategory[gameOption.Category].Add(gameOption);
         Options.OptionsByID.Add(gameOption.ID, gameOption);
         return(true);
     }
     return(false);
 }
コード例 #19
0
ファイル: GameOption.cs プロジェクト: Ferrir/Jokenpo
        /// <summary>
        /// Get DescriptionAttribute item emnun
        /// </summary>
        /// <param name="gameOption"></param>
        /// <returns></returns>
        public static String GetDescription(this GameOption gameOption)
        {
            Type type = gameOption.GetType();

            MemberInfo[] memberInfo = type.GetMember(gameOption.ToString());
            if (memberInfo != null && memberInfo.Length > 0)
            {
                object[] attrs = memberInfo[0].GetCustomAttributes(typeof(DescriptionAttribute), false);
                if (attrs != null && attrs.Length > 0)
                {
                    return(((DescriptionAttribute)attrs[0]).Description);
                }
            }            //if
            return(gameOption.ToString());
        }
コード例 #20
0
        public async Task <IActionResult> OnGetAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            GameOption = await _context.GameOptions.FirstOrDefaultAsync(m => m.GameOptionId == id);

            if (GameOption == null)
            {
                return(NotFound());
            }
            return(Page());
        }
コード例 #21
0
        public string GetResponseSentence(GameOption playerMove, GameOption computerMove, TurnWinner winner,
            PlayerTurnResult playerTurnResult)
        {
            var winSentence = winner switch
            {
                TurnWinner.Human => $"{playerMove} beat {computerMove}.",
                TurnWinner.Computer => $"{playerMove} lost to {computerMove}.",
                TurnWinner.Tie => $"Tie!",
                _ => throw new ValidationException(
                    $"Input {winner} not recognized.")
            };

            return winSentence;
        }
    }
コード例 #22
0
 /// <summary>
 /// Play the Game.
 /// </summary>
 /// <param name="option">The Option used to Play the Game.</param>
 public void PlayGame(GameOption option)
 {
     if (option == GameOption.P)
     {
         var card = Deck.DrawCard();
         Console.WriteLine($"{card.CardValue} of {card.CardSuit}");
     }
     else if (option == GameOption.S)
     {
         Deck.ShuffleCardDeck();
     }
     else if (option == GameOption.R)
     {
         RestartGame();
     }
 }
コード例 #23
0
    void Refresh()
    {
        var camOption = GameOption.Get <HDRPCameraOption>();
        var grpOption = GameOption.Get <SpaceshipOptions>();

        aaMethod.text   = camOption.antiAliasing.ToString();
        percentage.text = $"{grpOption.screenPercentage}% {(grpOption.screenPercentage == 100? "(Native)":"")}";
        if (grpOption.screenPercentage == 100)
        {
            upsampling.text = $"Disabled ({grpOption.upsamplingMethod})";
        }
        else
        {
            upsampling.text = grpOption.upsamplingMethod.ToString();
        }
    }
コード例 #24
0
ファイル: GameUI.cs プロジェクト: GotoK/H401
    // Use this for initialization
    void Start()
    {
        levelControllerObject   = Instantiate(Resources.Load<GameObject>(levelControllerPath));
        ojityanObject           = Instantiate(Resources.Load<GameObject>(ojityanPath));
        gameInfoCanvasObject    = Instantiate(Resources.Load<GameObject>(gameInfoCanvasPath));
        gamePauseObject         = Instantiate(Resources.Load<GameObject>(gamePausePath));

        levelControllerObject.transform.SetParent(transform);
        ojityanObject.transform.SetParent(transform);
        gameInfoCanvasObject.transform.SetParent(transform);
        gamePauseObject.transform.SetParent(transform);

        _levelController = levelControllerObject.GetComponent<LevelController>();
        _gameInfoCanvas = gameInfoCanvasObject.GetComponent<GameInfoCanvas>();
        _gamePause = gamePauseObject.GetComponent<GameOption>();
        _ojityanAnimator = ojityanObject.GetComponent<Animator>();
    }
コード例 #25
0
        public async Task <IActionResult> OnPostAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            GameOption = await _context.GameOptions.FindAsync(id);

            if (GameOption != null)
            {
                _context.GameOptions.Remove(GameOption);
                await _context.SaveChangesAsync();
            }

            return(RedirectToPage("./Index"));
        }
コード例 #26
0
    private void Awake()
    {
        this.objectOptionManager = GameObject.FindWithTag("OptionManager");
        this.scriptGameOption    = this.objectOptionManager.GetComponent <GameOption>();

        this.textTotalScore = this.objectTotalScore.GetComponent <Text>();
        this.textRank       = this.objectTextRank.GetComponent <Text>();
        this.textNextRank   = this.objectTextNextRank.GetComponent <Text>();
        this.textTips       = this.objectTextTips.GetComponent <Text>();
        this.textTipsTitle  = this.objectTextTipsTitle.GetComponent <Text>();

        this.scriptTips = this.GetComponent <Tips>();

        for (int i = 0; i < this.phaseScores.Length; i++)
        {
            this.phaseScores[i] = 0;
        }
    }
コード例 #27
0
    private void Awake()
    {
        this.scriptGameDirector = this.objectGameDirector.GetComponent <GameDirector>();
        this.scriptScore        = this.objectGameDirector.GetComponent <Score>();
        this.scriptVaryPanel    = this.objectGameDirector.GetComponent <VaryPanel>();

        this.objectOptionManager = GameObject.FindWithTag("OptionManager");
        this.scriptGameOption    = this.objectOptionManager.GetComponent <GameOption>();

        this.objectBGMManager = GameObject.FindWithTag("BGMManager");
        this.scriptBGMManager = this.objectBGMManager.GetComponent <BGMManager>();

        this.objectSEManager = GameObject.FindWithTag("SEManager");
        this.scriptSEManager = this.objectSEManager.GetComponent <SEManager>();

        this.imageButtonDrop    = this.buttonDrop.GetComponent <Image>();
        this.imageButtonReplace = this.buttonReplace.GetComponent <Image>();
    }
コード例 #28
0
ファイル: LoginSystem.cs プロジェクト: nnoldman/FFF
    void OnAccountReturn(object pb)
    {
        Cmd.RetAccountOperation ret = ParseCmd <Cmd.RetAccountOperation>(pb);
        preOperation_   = ret;
        this.accountID_ = ret.accountid;
        this.lateServerIDs.Clear();
        this.lateServerIDs.AddRange(ret.late_serverids);
        foreach (var id in this.lateServerIDs)
        {
            if (id != 0)
            {
                currentServer = GameOption.GetServer(id);
                break;
            }
        }

        Debug.Log("RetAccountOperation:" + ret.accountid.ToString());
        UIs.Instance.Show <LoginSelectServer>();
    }
コード例 #29
0
ファイル: ChessGame.cs プロジェクト: AbnerSquared/Orikivo
        public ChessGame()
        {
            Id      = "chess";
            Details = new GameDetails
            {
                Name            = "Chess",
                Icon            = "♟️",
                Summary         = "A classic game of immense strategy.",
                RequiredPlayers = 2,
                PlayerLimit     = 2
            };

            Options = new List <GameOption>
            {
                GameOption.Create(ChessConfig.RotateBoard, "Rotate board on each turn", true),
                GameOption.Create(ChessConfig.StartingPlayer, "Starting player", ChessStartMode.Random),
                GameOption.Create(ChessConfig.AllowEnPassant, "Allow 'En Passant'", false),
                GameOption.Create(ChessConfig.PieceFormat, "Piece Format", ChessIconFormat.Text)
            };
        }
コード例 #30
0
    void initialize()
    {
        initializeFields();

        GameOption = GameObject.Find("Game option").GetComponent <GameOption>();

        Transform t = GameObject.Find("Rules").transform;

        for (int i = 0; i < t.childCount; i++)
        {
            rule.Add(t.GetChild(i).gameObject.GetComponent <Rule>());
        }

        t = GameObject.Find("Pieces").transform;
        for (int i = 0; i < t.childCount; i++)
        {
            piece.Add(t.GetChild(i).gameObject.GetComponent <Piece>());
        }

        foreach (var p in piece)
        {
            float a = p.transform.localPosition.x, b = p.transform.localPosition.z;
            float a1 = Game.Board.x_component.x, a2 = Game.Board.y_component.x;
            float b1 = Game.Board.x_component.y, b2 = Game.Board.y_component.y;

            float new_x = (a * b2 - a2 * b) / (a1 * b2 - a2 * b1), new_y = (a1 * b - a * b1) / (a1 * b2 - a2 * b1);

            p.position         = Game.Board.Map((int)(new_x + 0.5f), (int)(new_y + 0.5f));
            p.position.piece   = p;
            p.movingController = p.gameObject.GetComponent <MovingContoller>();
        }

        SuperPosition startSp = new SuperPosition();

        foreach (var p in piece)
        {
            startSp.state.Add(p.position, p);
        }
        superPosition.Add(startSp);
    }
コード例 #31
0
        public static THHGame initGameWithoutPlayers(string name, GameOption option)
        {
            TaskExceptionHandler.register();
            ULogger logger = new ULogger(name)
            {
                blackList = new List <string>()
                {
                    "Load"
                }
            };
            THHGame game = new THHGame(option != null ? option : GameOption.Default, CardHelper.getCardDefines(logger))
            {
                answers  = new GameObject(nameof(AnswerManager)).AddComponent <AnswerManager>(),
                triggers = new GameObject(nameof(TriggerManager)).AddComponent <TriggerManager>(),
                time     = new GameObject(nameof(TimeManager)).AddComponent <TimeManager>(),
                logger   = logger
            };

            game.answers.game = game;
            (game.triggers as TriggerManager).logger = game.logger;
            return(game);
        }
コード例 #32
0
        public TriviaGame()
        {
            Id      = "trivia";
            Details = new GameDetails
            {
                Name            = "Trivia",
                Icon            = "📰",
                Summary         = "Answer questions against the clock!",
                PlayerLimit     = 16,
                RequiredPlayers = 1,
                CanSpectate     = true
            };

            Options = new List <GameOption>
            {
                GameOption.Create("topics", "Topics", TriviaTopic.Any, "Determines the topics to filter for (only when **Use OpenTDB** is disabled)."),
                GameOption.Create("difficulty", "Difficulty", TriviaDifficulty.Any, "Determines the difficulty range to filter each question for."),
                GameOption.Create("questioncount", "Question Count", 5, "Represents the total amount of questions to play in this session."),
                GameOption.Create("questionduration", "Question Duration", 15d, "Determines how long a player has to answer each question."),
                GameOption.Create(TriviaConfig.UseOpenTDB, "Use OpenTDB", true, "This toggles the usage of the OpenTDB API, which allows for a wider range of unique questions. Disable if you wish to only answer custom-made questions.")
            };
        }
コード例 #33
0
ファイル: LevelController.cs プロジェクト: GotoK/H401
    // Use this for initialization
    void Start()
    {
        appController = transform.root.gameObject.GetComponent<AppliController>();
        GameScene gameScene = appController.GetCurrentScene().GetComponent<GameScene>();
        gameController = gameScene.gameController;
        nextLevel = -1;

        audioSource = GetComponent<AudioSource>();

        levelState = _eLevelState.STAND;

        levelTableScript = gameScene.levelTables;

        levelChangePrefab = Resources.Load<GameObject>(levelChangePath);
        animationPrefab = Resources.Load<GameObject>(animationPath);

        gOption = gameScene.gameUI.gamePause;
         //       gameScene.gameUI.gameInfoCanvas.GetComponentInChildren<fieldImage>().gameObject.GetComponent<Button>().onClick.AddListener(TouchChange);
    }