示例#1
0
        public static void SetupFromJsonConfig(string json)
        {
            Begin();
            Clean();

            var obj = (Dictionary <string, object>)JsonReader.Deserialize(json);

            foreach (var _val in (object[])obj["components"])
            {
                var val = (KGComponent)Enum.Parse(typeof(KGComponent), (string)_val);
                KGBuildAPI.EnableComponent(val, true);
            }
            foreach (var _val in (object[])obj["native_deps"])
            {
                var val = (KGComponent)Enum.Parse(typeof(KGComponent), (string)_val);
                KGBuildAPI.InstallNativeLibrary(val, true);
            }

            var rawConfig = (Dictionary <string, object>)obj["config"];
            var config    = KGBuildAPI.configuration;

            config.appId      = (string)rawConfig["app_id"];
            config.appSecret  = (string)rawConfig["app_secret"];
            config.appVersion = (string)rawConfig["app_version"];
            config.market     = (string)rawConfig["market"];
            config.debugLevel = (KGConfiguration.KGDebugLevel)Enum.Parse(typeof(KGConfiguration.KGDebugLevel), (string)rawConfig["debug_level"]);
            config.serverType = (string)rawConfig["server_type"];

            Apply();
        }
示例#2
0
        /// <summary>
        /// 모든 컴포넌트를 삭제하고,
        /// 설정을 초기값으로 되돌립니다.
        /// </summary>
        public static void Clean()
        {
            if (File.Exists(KGPackage.sharedDataPath))
            {
                File.Delete(KGPackage.sharedDataPath);
            }

            foreach (var _val in Enum.GetValues(typeof(KGComponent)))
            {
                var val = (KGComponent)_val;

                KGBuildAPI.EnableComponent(val, false);
                KGBuildAPI.InstallNativeLibrary(val, false);
            }

            RefreshAssetDatabase();
        }