// CTOR

    public tnGameModeData(tnGameModeDataDescriptor i_Descriptor)
    {
        m_FieldsExcludersTags = new List <int>();

        if (i_Descriptor != null)
        {
            m_Name         = i_Descriptor.gameModeName;
            m_Descriptrion = i_Descriptor.description;

            m_CharacterPrefabPath = i_Descriptor.characterPrefabPath;
            m_MatchController     = i_Descriptor.multiplayerController;

            m_TeamsRange                = new IntRange(i_Descriptor.teamsRange.min, i_Descriptor.teamsRange.max);
            m_PlayersPerTeamRange       = new IntRange(i_Descriptor.playersPerTeamRange.min, i_Descriptor.playersPerTeamRange.max);
            m_OnlinePlayersPerTeamRange = new IntRange(i_Descriptor.onlinePlayersPerTeamRange.min, i_Descriptor.playersPerTeamRange.max);

            int optionsConfigId = StringUtils.GetHashCode(i_Descriptor.optionsConfigId);
            m_OptionsConfigId = optionsConfigId;

            int camerasSetId = StringUtils.GetHashCode(i_Descriptor.camerasSetId);
            m_CamerasSetId = camerasSetId;

            for (int tagIndex = 0; tagIndex < i_Descriptor.fieldsExcludersTagsCount; ++tagIndex)
            {
                string tag = i_Descriptor.GetFieldExcluderTag(tagIndex);
                if (tag != "" && tag != "NULL")
                {
                    int hash = StringUtils.GetHashCode(tag);
                    m_FieldsExcludersTags.Add(hash);
                }
            }

            m_Hidden = i_Descriptor.hidden;
        }
    }
Exemplo n.º 2
0
    private void CreateMatchController()
    {
        tnMatchSettingsModule matchSettingsModule = GameModulesManager.GetModuleMain <tnMatchSettingsModule>();

        if (matchSettingsModule == null)
        {
            return;
        }

        int gameModeId = matchSettingsModule.gameModeId;
        tnMatchController matchControllerInstance = tnGameModeFactory.CreateMatchController(gameModeId);

        if (matchControllerInstance != null)
        {
            matchControllerInstance.gameObject.name = "MultiplayerMatchController";
            matchControllerInstance.SetSeed(m_SharedSeed);

            matchControllerInstance.SetCamera(m_GameCameraGO);
        }

        m_MatchController = matchControllerInstance;

        if (m_TrueSyncManager != null)
        {
            m_TrueSyncManager.RegisterTrueSyncObject(m_MatchController.gameObject);
        }
    }
    // MonoBehaviour's INTERFACE

    void OnEnable()
    {
        tnMatchController matchController = FindObjectOfType <tnMatchController>();

        if (matchController == null)
        {
            return;
        }

        ShowResults(matchController);
    }
    // tnMatchResultsController's INTERFACE

    protected override void ShowResults(tnMatchController i_Controller)
    {
        base.ShowResults(i_Controller);

        if (i_Controller == null)
        {
            return;
        }

        tnSubbuteoMatchController matchController = (tnSubbuteoMatchController)i_Controller;

        InternalSetResults(matchController);
    }
    // tnMatchStatsController's INTERFACE

    protected override void ShowStats(tnMatchController i_Controller)
    {
        base.ShowStats(i_Controller);

        if (i_Controller == null)
        {
            return;
        }

        tnBaseMatchController matchController = (tnBaseMatchController)i_Controller;

        InternalSetStats(matchController);
    }
    void Awake()
    {
        m_MatchController = FindObjectOfType <tnMatchController>();

        if (m_MatchController == null)
        {
            Debug.LogWarning("[tnCameraZoom] Missing MatchController.");
        }

        m_GameCamera = FindObjectOfType <tnGameCamera>();

        if (m_GameCamera == null)
        {
            Debug.LogWarning("[tnCameraZoom] Missing GameCamera.");
        }
    }
    public static tnMatchController CreateMatchController(int i_Id)
    {
        tnMatchController controllerInstance = null;

        tnGameModeData gameModeData = tnGameData.GetGameModeDataMain(i_Id);

        if (gameModeData != null)
        {
            tnMatchController controllerPrefab = gameModeData.matchController;
            if (controllerPrefab != null)
            {
                controllerInstance = GameObject.Instantiate <tnMatchController>(controllerPrefab);
            }
        }

        return(controllerInstance);
    }
 protected virtual void ShowResults(tnMatchController i_Controller)
 {
 }
    private void OnGUI()
    {
        if (!m_OnGui)
        {
            return;
        }

        GUILayout.Label("Photon ping: " + PhotonNetwork.GetPing());

        if (m_OnlineConfig != null)
        {
            GUILayout.Label("ONLINE");
            string label = "Synced - Rollback: " + m_OnlineConfig.syncWindow + " - " + m_OnlineConfig.rollbackWindow + " (1 / 2) - (3 / 4)";
            GUILayout.Label(label);
            label = "Show stats: " + ((m_OnlineConfig.showStats) ? "ON" : "OFF") + " (X)";
            GUILayout.Label(label);
        }

        if (m_OfflineConfig != null)
        {
            GUILayout.Label("OFFLINE");
            string label = "Synced - Rollback: " + m_OfflineConfig.syncWindow + " - " + m_OfflineConfig.rollbackWindow + " (5 / 6) - (7 / 8)";
            GUILayout.Label(label);
            label = "Show stats: " + ((m_OfflineConfig.showStats) ? "ON" : "OFF") + " (C)";
            GUILayout.Label(label);
        }

        if (m_CharacterControllerComponent != null || m_KickComponent != null)
        {
            GUILayout.Label("CHARACTER");

            if (m_CharacterControllerComponent != null)
            {
                GUILayout.Label("Dash tick delay: " + m_CharacterControllerComponent.dashTickDelay + " (O/P)");
            }

            if (m_KickComponent != null)
            {
                GUILayout.Label("Kick tick delay: " + m_KickComponent.kickTickDelay + " (K/L)");
            }
        }

        if (m_AIDatabase != null)
        {
            GUILayout.Label("AI");

            tnAILevelDescriptor first  = m_AIDatabase.GetAILevelDescriptor(0);
            tnAILevelDescriptor second = m_AIDatabase.GetAILevelDescriptor(1);
            tnAILevelDescriptor third  = m_AIDatabase.GetAILevelDescriptor(2);

            if (first != null)
            {
                string label = first.label + ": " + first.inputDelay + " (U / I)";
                GUILayout.Label(label);
            }

            if (second != null)
            {
                string label = second.label + ": " + second.inputDelay + " (H / J)";
                GUILayout.Label(label);
            }

            if (third != null)
            {
                string label = third.label + ": " + third.inputDelay + " (N / M)";
                GUILayout.Label(label);
            }
        }

        if (m_StandardMatchController != null || m_SubbuteoMatchController != null)
        {
            GUILayout.Label("OFFLINE PLAYER DELAY");

            tnMatchController matchController = (m_StandardMatchController != null) ? m_StandardMatchController : m_SubbuteoMatchController;

            string label = "Delay: " + matchController.offlinePlayerInputDelay + " (V / B)";
            GUILayout.Label(label);
        }
    }