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(); }
private static void WaitAndApply() { while (KGSharedData.instance == null) { System.Threading.Thread.Sleep(1000); } KGBuildAPI.Apply(); }
static KGAutoApply() { EditorApplication.playmodeStateChanged += () => { }; // Apply When Editor load EditorApplication.delayCall += () => { KGBuildAPI.Apply(); }; }
public static bool Config_SDK() { KGBuildAPI.Begin(); var asm = typeof(UnityEditor.Editor).Assembly; var inspector = asm.GetType("UnityEditor.InspectorWindow"); var window = EditorWindow.GetWindow <KGConfigWindow>(inspector); window.Show(); return(true); }
public void Update() { if (changeFlushed == false && DateTime.Now - lastChanged >= TimeSpan.FromSeconds(1)) { try { KGBuildAPI.Apply(); } catch (Exception e) { UnityEngine.Debug.LogError("KakaoGameSDK::ApplyChange Error\r\n\r\n" + e.ToString()); } changeFlushed = true; } }
/// <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(); }
private void ConfigurationGUI() { showConfiguration = EditorGUILayout.Foldout(showConfiguration, "Configuration"); if (showConfiguration) { EditorGUI.indentLevel++; try { var vdIdent = new Regex("^[a-zA-Z0-9_]+$"); var vdVersion = new Regex("^[0-9\\.]+$"); var config = KGSharedData.instance.configuration; var style = new GUIStyle(); style.richText = true; var btnSkin = new GUIStyle(GUI.skin.button); btnSkin.richText = true; //DrawRegion("App"); using (KGGUIHelper.DisableForSealed()) { //var tfStyle = new GUIStyle(GUI.skin.textField); //tfStyle.fontSize = 14; //tfStyle.fixedHeight = 14; // App ID config.appId = EditorGUILayout.TextField("App Id", config.appId); if (string.IsNullOrEmpty(config.appId) || config.appId.Contains(" ")) { EditorGUILayout.LabelField("<color=\"yellow\">Missing Value</color>", style); } if (config.appId != "" && !vdIdent.IsMatch(config.appId)) { EditorGUILayout.LabelField("<color=\"red\">Invalid Value</color>", style); } // App Secret config.appSecret = EditorGUILayout.TextField("App Secret", config.appSecret); if (string.IsNullOrEmpty(config.appSecret) || config.appSecret.Contains(" ")) { EditorGUILayout.LabelField("<color=\"yellow\">Missing Value</color>", style); } if (config.appSecret != "" && !vdIdent.IsMatch(config.appSecret)) { EditorGUILayout.LabelField("<color=\"red\">Invalid Value</color>", style); } } // App Version if (!KGPackage.isGameShopPaymentPackage) { if (KGPackage.isPublishingGame) { PlayerSettings.bundleVersion = EditorGUILayout.TextField("App Version", PlayerSettings.bundleVersion); if (string.IsNullOrEmpty(PlayerSettings.bundleVersion) || PlayerSettings.bundleVersion.Contains(" ")) { EditorGUILayout.LabelField("<color=\"red\">Missing Value</color>", style); } config.appVersion = KGBuildAPI.RefineVersion(PlayerSettings.bundleVersion); GUILayout.BeginHorizontal(); GUILayout.FlexibleSpace(); EditorGUILayout.LabelField(" * PlayerSettings.bundleVersion"); GUILayout.EndHorizontal(); } else { PlayerSettings.bundleVersion = "0.0.0"; config.appVersion = "0.0.0"; } } else { PlayerSettings.bundleVersion = "0.6.0"; config.appVersion = "0.6.0"; } EditorGUILayout.Space(); // Market if (!KGPackage.isGameShopPaymentPackage) { if (KGPackage.isPublishingGame) { EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField("Market (Android)"); config.isCustomMarket = EditorGUILayout.Toggle("Use custom market", config.isCustomMarket); EditorGUILayout.EndHorizontal(); if (config.isCustomMarket == true) { config.market = EditorGUILayout.TextField("", config.market); } else { var googlePlayContent = new GUIContent("googlePlay", KGResources.googlePlay); var oneStoreContent = new GUIContent("oneStore", KGResources.oneStore); var kakaogameShopContent = new GUIContent("kakaogameShop", KGResources.kakaogameShop); if (config.market == "googlePlay") { googlePlayContent.text = "<b>" + googlePlayContent.text + " [√]</b>"; googlePlayContent.image = KGResources.googlePlayActive; } else if (config.market == "oneStore") { oneStoreContent.text = "<b>" + oneStoreContent.text + " [√]</b>"; oneStoreContent.image = KGResources.oneStoreActive; } else if (config.market == "kakaogameShop") { kakaogameShopContent.text = "<b>" + kakaogameShopContent.text + " [√]</b>"; kakaogameShopContent.image = KGResources.kakaogameShopActive; } GUILayout.BeginHorizontal(); GUILayout.FlexibleSpace(); if (GUILayout.Button(googlePlayContent, btnSkin, GUILayout.Width(140), GUILayout.Height(44))) { config.market = "googlePlay"; } if (GUILayout.Button(oneStoreContent, btnSkin, GUILayout.Width(140), GUILayout.Height(44))) { config.market = "oneStore"; } if (GUILayout.Button(kakaogameShopContent, btnSkin, GUILayout.Width(140), GUILayout.Height(44))) { config.market = "kakaogameShop"; } GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); GUILayout.FlexibleSpace(); EditorGUILayout.LabelField("* iOS market is only appStore."); GUILayout.EndHorizontal(); } } else { config.market = "googlePlay"; } } else { config.market = "googlePlay"; } // Server Type if (!KGPackage.isGameShopPaymentPackage) { if (KGPackage.isPublishingGame) { var qaContent = new GUIContent("QA", KGResources.qa); var realContent = new GUIContent("Real", KGResources.real); if (config.serverType == "qa") { qaContent.text = "<b>" + qaContent.text + " [√]</b>"; qaContent.image = KGResources.qaActive; } else { realContent.text = "<b>" + realContent.text + " [√]</b>"; realContent.image = KGResources.realActive; } EditorGUILayout.LabelField("Server Type"); GUILayout.BeginHorizontal(); GUILayout.FlexibleSpace(); if (GUILayout.Button(qaContent, btnSkin, GUILayout.Width(140), GUILayout.Height(44))) { config.serverType = "qa"; } if (GUILayout.Button(realContent, btnSkin, GUILayout.Width(140), GUILayout.Height(44))) { config.serverType = "real"; } GUILayout.EndHorizontal(); EditorGUILayout.Space(); } else { config.serverType = "real"; } } else { config.serverType = "alpha"; serverType = (ServerType)EditorGUILayout.EnumPopup("Server Type", serverType); if (serverType == ServerType.ALPHA) { config.serverType = "alpha"; } else if (serverType == ServerType.REAL) { config.serverType = "real"; } } // Debug Level config.debugLevel = (KGConfiguration.KGDebugLevel)EditorGUILayout.EnumPopup("Debug Level", config.debugLevel); EditorGUILayout.Space(); // Check DrawConfigurationUI(); EditorGUILayout.Space(); } catch (Exception e) { UnityEngine.Debug.LogException(e); } EditorGUI.indentLevel--; } }
public static void OnPostprocessBuild(BuildTarget buildTarget, string buildPath) { if (!KGIosSupport.IsIOSSupport(buildPath)) { return; } UnityEngine.Debug.Log("---KakaogameSDK::OnIosPostbuild---"); UnityEngine.Debug.Log(buildTarget + " / " + buildPath); KGIosSupport.Begin(buildPath); // Delete Android Plugin KGIosSupport.RemoveAndroidPlugin(); // Add LinkerFlags #region LINKER_FLAGS UnityEngine.Debug.Log("Add LinkerFlags"); KGIosSupport.AddLinkerFlag("-all_load"); KGIosSupport.AddLinkerFlag("-lz"); KGIosSupport.AddLinkerFlag("-lxml2"); #endregion // Add Frameworks #region FRAMEWORK_DEPS UnityEngine.Debug.Log("Add Frameworks"); AddKakaoFrameworks(buildPath); #endregion // URL SCHEME #region URL_SCHEMES KGIosSupport.AddQueryScheme("com.kakaogames.sdk"); KGIosSupport.AddURLScheme("KakaoGameSDK", "kakaogame" + KGSharedData.Configuration.appId); #endregion #region ADD_OR_MERGE_PLIST // DISABLE BITCODE KGIosSupport.AddBuildProperty("ENABLE_BITCODE", "NO"); UnityEngine.Debug.Log("Add KakaoGame Configurations"); KGIosSupport.AddConfig("UIViewControllerBasedStatusBarAppearance", false); //KGIosSupport.AddConfig("NSCameraUsageDescription", "고객센터 파일 첨부 용도로 사용합니다."); //KGIosSupport.AddConfig("NSPhotoLibraryUsageDescription", "고객센터 파일 첨부 용도로 사용합니다."); KGSharedData.Configuration.appVersion = PlayerSettings.bundleVersion; KGIosSupport.AddConfig("KakaoGameConfiguration", new Dictionary <string, object>() { { "AppId", KGSharedData.Configuration.appId }, { "AppSecret", KGSharedData.Configuration.appSecret }, { "AppVersion", KGSharedData.Configuration.appVersion }, { "DebugLevel", KGSharedData.Configuration.debugLevel.ToString().ToLower() }, { "ServerType", KGSharedData.Configuration.serverType.ToLower() } }); KGIosSupport.MergeConfig("UIRequiredDeviceCapabilities", new List <object>() { "gamekit" }); if (KGSharedData.instance.sdkDevelopConfiguration.useIOSTestAppAutoSetting == true) { KGIosSupport.AddConfig("ITSAppUsesNonExemptEncryption", false); } KGIosSupport.AddConfig("CFBundleAllowMixedLocalizations", true); #endregion var enabledComponents = new List <Component.KGComponentBase>(); ///if (KGSharedData.UseForKakao2) enabledComponents.Add(KGBuildAPI.GetComponent(KGBuildAPI.KGComponent.Kakao)); if (KGSharedData.UseGoogle) { enabledComponents.Add(KGBuildAPI.GetComponent(KGBuildAPI.KGComponent.Google)); } if (KGSharedData.UseFacebook) { enabledComponents.Add(KGBuildAPI.GetComponent(KGBuildAPI.KGComponent.Facebook)); } // Add capabilities #if UNITY_2017_1_OR_NEWER UnityEngine.Debug.Log("Add Capabailities"); KGIosSupport.AddPushNotificationCapability(buildPath); KGIosSupport.AddKeychainSharingCapability(buildPath); KGIosSupport.AddMarketingIcon(buildPath); #else AddCapabilities(buildPath); #endif UnityEngine.Debug.Log("PostbuildProcess for enabled components...."); foreach (var c in enabledComponents) { UnityEngine.Debug.Log("EnabledComponent : " + c.GetType().Name); c.OnIOSPostprocess(); } KGIosSupport.Apply(); }