예제 #1
0
        /// <summary>
        /// Get Config from the CEngineConfig file through key
        /// </summary>
        public static string GetConfig(string key, bool showLog = true)
        {
            EnsureConfigTab();

            var conf = ConfigsTable.FindByPrimaryKey(key);

            if (conf == null)
            {
                if (showLog)
                {
                    Logger.LogError("Cannot get CosmosConfig: {0}", key);
                }
                return(null);
            }
            return(conf["Value"] as string);
        }
예제 #2
0
        public static void SetConfig(string key, string value)
        {
            EnsureConfigTab();
            if (!Application.isEditor)
            {
                Logger.LogError("Set Config is Editor only");
                return;
            }

            var item    = ConfigsTable.FindByPrimaryKey(key);
            var writer  = new TabFileWriter(ConfigsTable);
            var row     = writer.GetRow(item.RowNumber);
            var rowInfo = KEngineInfo.Wrap(row);

            rowInfo.Value = value;

            writer.Save(ConfigFilePath);
        }
예제 #3
0
 /// <summary>
 /// Check whetehr exist a config key
 /// </summary>
 /// <param name="key"></param>
 /// <returns></returns>
 public static bool HasConfig(string key)
 {
     return(ConfigsTable.HasPrimaryKey(key));
 }