Exemplo n.º 1
0
    public tnGameModeConfigDescriptor GetConfig(string i_Key)
    {
        tnGameModeConfigDescriptor config = null;

        m_Configs.TryGetValue(i_Key, out config);
        return(config);
    }
Exemplo n.º 2
0
    // CTOR

    public tnGameModeConfig(tnGameModeConfigDescriptor i_Descriptor)
    {
        if (i_Descriptor != null)
        {
            m_MatchDurationOption = StringUtils.GetHashCode(i_Descriptor.matchDurationOption);
            m_RefereeOption       = StringUtils.GetHashCode(i_Descriptor.refereeOption);
            m_GoldenGoalOption    = StringUtils.GetHashCode(i_Descriptor.goldenGoalOption);
        }
    }
    // LOGIC

    public void Initialize(string i_DatabasePath)
    {
        tnGameModeConfigsDatabase database = Resources.Load <tnGameModeConfigsDatabase>(i_DatabasePath);

        if (database != null)
        {
            foreach (string key in database.keys)
            {
                tnGameModeConfigDescriptor descriptor = database.GetConfig(key);
                if (descriptor != null)
                {
                    int hash = StringUtils.GetHashCode(key);
                    tnGameModeConfig data = new tnGameModeConfig(descriptor);
                    m_Data.Add(hash, data);
                }
            }
        }
        else
        {
            LogManager.LogWarning(this, "Database not loaded.");
        }
    }