private void SetupMatchSettingsModule()
        {
            tnMatchSettingsModule module = GameModulesManager.GetModuleMain <tnMatchSettingsModule>();

            if (module == null)
            {
                return;
            }

            module.Clear();

            // Game mode.

            {
                module.SetGameModeId(gameMode.Value);
            }

            // Stadium.

            {
                int stadiumKey = -1;
                GetRandomStadiumKey(gameMode.Value, out stadiumKey);

                module.SetStadiumId(stadiumKey);
            }

            // Ball.

            {
                int ballKey = -1;
                GetRandomBallKey(out ballKey);

                module.SetBallId(ballKey);
            }

            // Ai level.

            {
                module.SetAILevelIndex(tnGameData.aiLevelCountMain - 1);
            }

            // Options.

            {
                tnGameModeData gameModeData = tnGameData.GetGameModeDataMain(gameMode.Value);
                if (gameModeData != null)
                {
                    tnGameModeConfig gameModeConfig = tnGameData.GetConfigDataMain(gameModeData.optionsConfigId);
                    if (gameModeConfig != null)
                    {
                        module.SetMatchDurationOption(gameModeConfig.matchDurationOption);
                        module.SetRefereeOption(gameModeConfig.refereeOption);
                    }
                }
            }
        }
    private void SetGameModeId(tnMatchSettingsModule i_Module)
    {
        if (i_Module == null)
        {
            return;
        }

        if (m_GameModeSelector == null || m_GameModeSelector.currentItem == null)
        {
            return;
        }

        int gameModeId = m_GameModeSelector.currentItem.id;

        i_Module.SetGameModeId(gameModeId);

        LogManager.Log(this, LogContexts.FSM, "Game Mode : " + m_GameModeSelector.currentItem.label + " " + "[" + m_GameModeSelector.currentItem.id + "]");
    }
        public override void OnEnter()
        {
            tnMatchSettingsModule module = GameModulesManager.GetModuleMain <tnMatchSettingsModule>();

            if (module == null)
            {
                module = GameModulesManager.AddModuleMain <tnMatchSettingsModule>();
            }

            module.Clear();

            module.SetGameModeId(gameModeId.Value);
            module.SetStadiumId(stadiumId.Value);
            module.SetBallId(ballId.Value);
            module.SetMatchDurationOption(matchDurationOption.Value);
            module.SetRefereeOption(refereeOption.Value);
            module.SetGoldenGoalOption(goldenGoalOption.Value);

            Finish();
        }
    private void Internal_FillMatchSettingsModule()
    {
        tnMatchSettingsModule module = GameModulesManager.GetModuleMain <tnMatchSettingsModule>();

        if (module == null)
        {
            return;
        }

        string gameModeId            = GetGameModeId(m_GameMode);
        string ballId                = GetBallId(m_Ball);
        string stadiumId             = GetStadiumId(m_Stadium);
        string matchDurationOptionId = GetMatchDurationOptionId(m_MatchDuration);
        string goldenGoalOptionId    = GetGoldenGoalOptionId(m_GoldenGoal);
        string refereeOptionId       = GetRefereeOptionId(m_Referee);

        module.SetGameModeId(gameModeId);
        module.SetBallId(ballId);
        module.SetStadiumId(stadiumId);
        module.SetMatchDurationOption(matchDurationOptionId);
        module.SetGoldenGoalOption(goldenGoalOptionId);
        module.SetRefereeOption(refereeOptionId);
    }