/// <summary> /// 把SDK信息写入配置文件 /// </summary> private void SetSDKInfo(JObject sdkParams, SDKType sdkType) { if (sdkParams == null) { return; } int gameId = sdkParams.Value <int>("GameId"); string appKey = sdkParams.Value <string>("AppKey"); string payKey = sdkParams.Value <string>("PayKey"); int appID = sdkParams.Value <int>("AppId"); int cchID = sdkParams.Value <int>("CchId"); int mdID = sdkParams.Value <int>("MdId"); string AppleAppleID = sdkParams.Value <string>("AppleAppleID"); // 保存到包内配置 SDKParams pakageSDKParams = AssetDatabase.LoadAssetAtPath <SDKParams>("Assets/Resources/SDKParams.asset"); pakageSDKParams.SDKType = sdkType; pakageSDKParams.GameId = gameId; pakageSDKParams.AppKey = appKey; pakageSDKParams.PayKey = payKey; pakageSDKParams.AppId = appID; pakageSDKParams.CchId = cchID; pakageSDKParams.MdId = mdID; pakageSDKParams.AppleAppId = AppleAppleID; EditorUtility.SetDirty(pakageSDKParams); AssetDatabase.SaveAssets(); AssetDatabase.Refresh(); }
/// <summary> /// 把SDK文件放入iOS文件夹 /// </summary> private void SetSDKFolder(SDKType sdkType) { // 其他SDK设置为不导入 SetAndroidPluginImport(pluginSavePath, false); // 复制要打包的SDK文件 CopyFolder(pluginSavePath + $"IOS{sdkType.ToString()}", pluginIOSPath); // 包内SDK导入 SetAndroidPluginImport(pluginIOSPath, true); }
/// <summary> /// 把SDK文件放入Android文件夹 /// </summary> private void SetSDKFolder(SDKType sdkType) { // 其他SDK设置为不导入 SetAndroidPluginImport(pluginSavePath, false); if (sdkType == SDKType.None) { return; } // 复制要打包的SDK文件 CopyFolder(pluginSavePath + $"Android{sdkType.ToString()}", pluginAndroidPath); // 包内SDK导入 SetAndroidPluginImport(pluginAndroidPath, true); }
/// <summary> /// 清理传入的平台之外的其他平台的SDK /// </summary> /// <param name="sdkType"></param> public void ClearOtherSDK(SDKType sdkType) { string rootPath = Path.Combine(Application.dataPath, SetDirectory); foreach (SDKType t in Enum.GetValues(typeof(SDKType))) { if (t != sdkType) { string dicPath = t.ToString(); if (Directory.Exists(Path.Combine(rootPath, dicPath))) { DeleteDir(dicPath); } } } }
public void CopySourceByType(SDKType sdkType) { Debug.Log(m_path); string setPath = Path.Combine(m_path, sdkType.ToString()); string sdkPath = Path.Combine(setPath, sdkDirectory); string picPath = Path.Combine(setPath, pictureDirectory); string copePath = Path.Combine(setPath, copeDirecotry); string destPath = Path.Combine(Application.dataPath, SetDirectory); string replacePath = Application.dataPath.Replace("Assets", "ReplaceXCode"); if (!Directory.Exists(sdkPath)) { Debug.LogWarning("sdk目录不存在"); return; } //ClearOtherSDK(sdkType); try { if (Directory.Exists(destPath)) { DeleteDirByPath(destPath); Debug.Log("testdelete"); } else { Debug.Log("testcreate"); Directory.CreateDirectory(destPath); AssetDatabase.Refresh(); } CopyFolderTo(sdkPath, destPath, "sdk资源"); CopyFolderTo(copePath, replacePath, ""); InsteadPiacture(picPath); AssetDatabase.Refresh(); } catch (Exception e) { Debug.LogError(e.Message); return; } }
/// <summary> /// 额外初始化,SDKName == null时初始化全体 /// </summary> public static void ExtraInit(SDKType type, string sdkName = null, string tag = null) { if (sdkName != null) { switch (type) { case SDKType.AD: GetADService(sdkName).ExtraInit(tag); break; case SDKType.Log: GetLogService(sdkName).ExtraInit(tag); break; case SDKType.Login: GetLoginService(sdkName).ExtraInit(tag); break; case SDKType.Other: GetOtherService(sdkName).ExtraInit(tag); break; case SDKType.Pay: GetPayService(sdkName).ExtraInit(tag); break; } } else { switch (type) { case SDKType.AD: AllExtraInit(s_ADServiceList, tag); break; case SDKType.Log: AllExtraInit(s_logServiceList, tag); break; case SDKType.Login: AllExtraInit(s_loginServiceList, tag); break; case SDKType.Other: AllExtraInit(s_otherServiceList, tag); break; case SDKType.Pay: AllExtraInit(s_payServiceList, tag); break; } } }
//安装sdk public void SetupSDK(SDKType sdkType) { string backupPath = ModuleConst.GetSDKBackupPath(sdkType); string setupPath = ModuleConst.GetSDKPath(sdkType); string pluginPathBeforeSetup = Path.Combine(setupPath, PathConfig.PluginsFolderName); if (Directory.Exists(setupPath)) { Debug.logger.LogError("SDK Setup Error", "You has setup the " + sdkType.ToString() + " SDK"); return; } PathEx.MakeDirectoryExist(setupPath); DirectoryEx.DirectoryCopy(backupPath, setupPath, true); //安装Plugin if (Directory.Exists(pluginPathBeforeSetup)) { Directory.Move(pluginPathBeforeSetup, PathConfig.pluginPath); } }
private void ShowSDKSetup(MODULE_SYMBOL symbol) { if (!ModuleConst.NeedSDKDict.ContainsKey(symbol) || isImportDict[symbol] == false) { return; } SDKType sdkType = ModuleConst.NeedSDKDict[symbol]; bool hasSetup = sdkManager.HasSetuped(sdkType); if (hasSetup) { GUILayout.Label("SDK:" + sdkType.ToString() + " has setuped", GUIHelper.MakeHeader(30), GUILayout.Width(200)); } else { if (!ModuleControl.isDevelopMode) { if (GUILayout.Button("Need Setup", GUILayout.Width(100))) { if (EditorUtility.DisplayDialog("Setup SDK", "Do you want to setup " + sdkType.ToString() + " ?" , "OK", "NO")) { sdkManager.SetupSDK(sdkType); } } } else { GUILayout.Label("SDK:" + sdkType.ToString() + " no setuped", GUIHelper.MakeHeader(30), GUILayout.Width(200)); } } }
//是否已经安装SDK public bool HasSetuped(SDKType sdkType) { string setupPath = ModuleConst.GetSDKPath(sdkType); return(Directory.Exists(setupPath)); }
/** * Adds a parameter to the calling convention. This should be called in normal ascending order. * * @param type Data type to convert to/from. * @param pass How the data is passed in C++. * @param decflags Flags on decoding from the plugin to C++. * @param encflags Flags on encoding from C++ to the plugin. */ public static void PrepSDKCall_AddParameter(SDKType type, SDKPassMethod pass, int decflags = 0, int encflags = 0) { throw new NotImplementedException(); }
/** * Sets the return information of an SDK call. Do not call this if there is no return data. * This must be called if there is a return value (i.e. it is not necessarily safe to ignore * the data). * * @param type Data type to convert to/from. * @param pass How the data is passed in C++. * @param decflags Flags on decoding from the plugin to C++. * @param encflags Flags on encoding from C++ to the plugin. */ public static void PrepSDKCall_SetReturnInfo(SDKType type, SDKPassMethod pass, int decflags = 0, int encflags = 0) { throw new NotImplementedException(); }
/// <summary> /// 把SDK信息写入配置文件 /// </summary> private void SetSDKInfo(SDKType sdkType, JObject sdkParams) { if (sdkParams == null) { return; } int gameId = sdkParams.Value <int>("GameId"); string appKey = sdkParams.Value <string>("AppKey"); string payKey = sdkParams.Value <string>("PayKey"); int appID = sdkParams.Value <int>("AppId"); int cchID = sdkParams.Value <int>("CchId"); int mdID = sdkParams.Value <int>("MdId"); string AppleAppleID = sdkParams.Value <string>("AppleAppleID"); // 保存到包内配置 SDKParams pakageSDKParams = AssetDatabase.LoadAssetAtPath <SDKParams>("Assets/Resources/SDKParams.asset"); pakageSDKParams.SDKType = sdkType; pakageSDKParams.GameId = gameId; pakageSDKParams.AppKey = appKey; pakageSDKParams.PayKey = payKey; pakageSDKParams.AppId = appID; pakageSDKParams.CchId = cchID; pakageSDKParams.MdId = mdID; pakageSDKParams.AppleAppId = AppleAppleID; EditorUtility.SetDirty(pakageSDKParams); AssetDatabase.SaveAssets(); AssetDatabase.Refresh(); // SDK信息写入Android配置文件 string filePath = ""; string debugParamName = ""; string debugValue = ""; switch (sdkType) { case SDKType.None: return; case SDKType.Native: filePath = $"{pluginAndroidPath}/assets/sjoys_app.ini"; debugParamName = "debug"; debugValue = option.ReleaseLevel == ReleaseLevel.Alpha ? "1" : "0"; break; case SDKType.NativeChukai: filePath = $"{pluginAndroidPath}/assets/sdk_config.ini"; debugParamName = "loggerSwitch"; debugValue = option.ReleaseLevel == ReleaseLevel.Alpha ? "1" : "0"; break; case SDKType.Oversea: filePath = $"{pluginAndroidPath}/assets/rsdk/rastar_na_config.ini"; debugParamName = "Debug_Switch"; debugValue = option.ReleaseLevel == ReleaseLevel.Alpha ? "true" : "false"; break; case SDKType.CeliaOversea: AssetDatabase.Refresh(); return; } File.AppendAllText(filePath, $"\r\n\r\napp_id={appID}\r\n\r\ncch_id={cchID}\r\n\r\nmd_id={mdID}\r\n\r\napp_key={appKey}\r\n\r\n{debugParamName}={debugValue}"); AssetDatabase.SaveAssets(); AssetDatabase.Refresh(); }
public static string GetSDKPath(SDKType sdkType) { return(Path.Combine(PathConfig.SDKPath, SDKFolderName[sdkType])); }
private void OnGUI() { int i = 0; if (GUILayout.Button("创建渠道对应的文件夹", GUILayout.Height(30f))) { CreateAllPlatformDirectory(); System.Diagnostics.Process.Start(m_path); } EditorGUILayout.BeginVertical(GUI.skin.box); EditorGUILayout.LabelField("选择平台"); EditorGUI.indentLevel++; foreach (SDKType toggleLabel in Enum.GetValues(typeof(SDKType))) { string packageName = "无平台"; switch (toggleLabel) { case SDKType.ddlhzb: packageName = "刀刀烈火正版(ddlhzb)"; break; case SDKType.hlcsyy: packageName = "火龙传说越狱(hlcsyy)"; break; case SDKType.hlcszb: packageName = "火龙传说正版(hlcszb)"; break; case SDKType.npcqyy: packageName = "涅槃传奇越狱(npcqyy)"; break; } toggleArray[i] = EditorGUILayout.ToggleLeft(packageName, toggleArray[i]); if (toggleArray[i]) { m_selectType = toggleLabel; SetOtherFalse(i); } i++; } EditorGUI.indentLevel--; EditorGUILayout.EndVertical(); if (GUILayout.Button("导入sdk", GUILayout.Height(30f))) { CopySourceByType(m_selectType); } string info = ""; _statement.TryGetValue(m_selectType.ToString(), out info); EditorGUILayout.HelpBox(info, MessageType.Info); }