Merge branch 'dev_20230919' into sdk_2
This commit is contained in:
commit
8cef52f549
@ -197,5 +197,11 @@ namespace BFEditor.Build
|
|||||||
{
|
{
|
||||||
BuildProjectWindow.ShowWindow();
|
BuildProjectWindow.ShowWindow();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[MenuItem("打包工具/Android转换为AAB工程", priority = 401)]
|
||||||
|
static void ConvertAndroidStudioToAAB()
|
||||||
|
{
|
||||||
|
BuildAndroidUtils.ConvertToAAB();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -13,6 +13,8 @@ namespace BFEditor.Build
|
|||||||
|
|
||||||
public class BuildProjectWindow : EditorWindow
|
public class BuildProjectWindow : EditorWindow
|
||||||
{
|
{
|
||||||
|
private static int versionCode = 13;
|
||||||
|
private static string versionName = "1.2.0";
|
||||||
BFPlatformOptions platform = BFPlatformOptions.AndroidDev;
|
BFPlatformOptions platform = BFPlatformOptions.AndroidDev;
|
||||||
const string ANDROID_DEV_PACKAGE_NAME = "com.juzu.b6.dev.android";
|
const string ANDROID_DEV_PACKAGE_NAME = "com.juzu.b6.dev.android";
|
||||||
const string ANDROID_RELEASE_PACKAGE_NAME = "com.juzu.b6.release.android";
|
const string ANDROID_RELEASE_PACKAGE_NAME = "com.juzu.b6.release.android";
|
||||||
@ -34,7 +36,7 @@ namespace BFEditor.Build
|
|||||||
platform = (BFPlatformOptions)EditorGUILayout.EnumPopup("", platform);
|
platform = (BFPlatformOptions)EditorGUILayout.EnumPopup("", platform);
|
||||||
EditorGUILayout.Space();
|
EditorGUILayout.Space();
|
||||||
|
|
||||||
EditorGUILayout.LabelField("版本: 0.1.0");
|
EditorGUILayout.LabelField("版本: " + versionName);
|
||||||
EditorGUILayout.Space();
|
EditorGUILayout.Space();
|
||||||
|
|
||||||
string packageName;
|
string packageName;
|
||||||
@ -70,7 +72,8 @@ namespace BFEditor.Build
|
|||||||
if (GUILayout.Button("一键打包"))
|
if (GUILayout.Button("一键打包"))
|
||||||
{
|
{
|
||||||
var buildInfo = new BuildInfo();
|
var buildInfo = new BuildInfo();
|
||||||
buildInfo.version = "0.1.0";
|
buildInfo.version = versionName;
|
||||||
|
buildInfo.version_code = versionCode;
|
||||||
buildInfo.mode = mode;
|
buildInfo.mode = mode;
|
||||||
buildInfo.bundleName = packageName;
|
buildInfo.bundleName = packageName;
|
||||||
buildInfo.skipVersion = skipVersion;
|
buildInfo.skipVersion = skipVersion;
|
||||||
|
|||||||
@ -3,6 +3,7 @@ using UnityEditor;
|
|||||||
using System.IO;
|
using System.IO;
|
||||||
using UnityEditor.Build.Reporting;
|
using UnityEditor.Build.Reporting;
|
||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
|
using System.Collections.Generic;
|
||||||
using System;
|
using System;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
|
|
||||||
@ -29,8 +30,14 @@ namespace BFEditor.Build
|
|||||||
static string GoogleCommonProjectPath = Application.dataPath + "/../BFVersions/android/google_common";
|
static string GoogleCommonProjectPath = Application.dataPath + "/../BFVersions/android/google_common";
|
||||||
static string GPAsProjectPath = Application.dataPath + "/../BFVersions/android/ub-gp"; // gp删档测试渠道
|
static string GPAsProjectPath = Application.dataPath + "/../BFVersions/android/ub-gp"; // gp删档测试渠道
|
||||||
static string GPOfficialAsProjectPath = Application.dataPath + "/../BFVersions/android/ub-google"; // gp正式渠道
|
static string GPOfficialAsProjectPath = Application.dataPath + "/../BFVersions/android/ub-google"; // gp正式渠道
|
||||||
|
static string PublishAsProjectPath = Application.dataPath + "/../BFVersions/android/publish_release";
|
||||||
static string SignShellPath = Application.dataPath + "/../BFFiles/androidkey";
|
static string SignShellPath = Application.dataPath + "/../BFFiles/androidkey";
|
||||||
static string GpAlginShellPath = Application.dataPath + "/../BFFiles/androidkey";
|
static string GpAlginShellPath = Application.dataPath + "/../BFFiles/androidkey";
|
||||||
|
static HashSet<string> AABInPackageFileHashSet = new HashSet<string>()
|
||||||
|
{
|
||||||
|
"bin",
|
||||||
|
"UnityServicesProjectConfiguration.json"
|
||||||
|
};
|
||||||
|
|
||||||
static BuildAndroidUtils()
|
static BuildAndroidUtils()
|
||||||
{
|
{
|
||||||
@ -282,6 +289,7 @@ namespace BFEditor.Build
|
|||||||
else if(buildInfo.IsGPChannel())
|
else if(buildInfo.IsGPChannel())
|
||||||
{
|
{
|
||||||
MergeProject(buildInfo, GoogleAsProjectPath);
|
MergeProject(buildInfo, GoogleAsProjectPath);
|
||||||
|
FixGradleVersion(buildInfo.version_code, buildInfo.version);
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@ -391,13 +399,19 @@ namespace BFEditor.Build
|
|||||||
static void FixGradleVersion(int versionCode, string versionName)
|
static void FixGradleVersion(int versionCode, string versionName)
|
||||||
{
|
{
|
||||||
Debug.Log("[bfinfo]修正build.gradle: VersionCode " + versionCode + " VersionName " + versionName);
|
Debug.Log("[bfinfo]修正build.gradle: VersionCode " + versionCode + " VersionName " + versionName);
|
||||||
var gradleFilePath = Path.Combine(GradleExcuteProjectPath, "build.gradle");
|
var gradleFilePath = Path.Combine(PublishAsProjectPath, "launcher", "build.gradle");
|
||||||
var text = File.ReadAllText(gradleFilePath);
|
var text = File.ReadAllText(gradleFilePath);
|
||||||
var regex = new Regex("versionCode 1");
|
var regex = new Regex("versionCode 1");
|
||||||
text = regex.Replace(text, string.Format("versionCode {0}", versionCode));
|
text = regex.Replace(text, string.Format("versionCode {0}", versionCode));
|
||||||
regex = new Regex("versionName '0.1'");
|
var regex2 = new Regex("versionName '0.1.0'");
|
||||||
text = regex.Replace(text, string.Format("versionName '{0}'", versionName));
|
text = regex2.Replace(text, string.Format("versionName '{0}'", versionName));
|
||||||
File.WriteAllText(gradleFilePath, text);
|
File.WriteAllText(gradleFilePath, text);
|
||||||
|
|
||||||
|
var gradleFilePath2 = Path.Combine(PublishAsProjectPath, "unityLibrary", "build.gradle");
|
||||||
|
var text2 = File.ReadAllText(gradleFilePath2);
|
||||||
|
text2 = regex.Replace(text2, string.Format("versionCode {0}", versionCode));
|
||||||
|
text2 = regex2.Replace(text, string.Format("versionName '{0}'", versionName));
|
||||||
|
File.WriteAllText(gradleFilePath2, text2);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -543,5 +557,83 @@ namespace BFEditor.Build
|
|||||||
tmp.Abort();
|
tmp.Abort();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void ConvertToAAB()
|
||||||
|
{
|
||||||
|
var installTimePackDirPath = Path.Combine(PublishAsProjectPath, "../", "dz_google_abb", "install_time_pack");
|
||||||
|
var targetDirPath = Path.Combine(PublishAsProjectPath, "install_time_pack");
|
||||||
|
if (Directory.Exists(targetDirPath))
|
||||||
|
{
|
||||||
|
Directory.Delete(targetDirPath, true);
|
||||||
|
Directory.CreateDirectory(targetDirPath);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Directory.CreateDirectory(targetDirPath);
|
||||||
|
}
|
||||||
|
|
||||||
|
BFEditorUtils.CopyDir(installTimePackDirPath, targetDirPath);
|
||||||
|
|
||||||
|
var abDirPath = Path.Combine(PublishAsProjectPath, "unityLibrary/src/main/assets");
|
||||||
|
var destFolderName = Path.Combine(PublishAsProjectPath, "install_time_pack/src/main/assets");
|
||||||
|
var dirInfo = new DirectoryInfo(abDirPath);
|
||||||
|
var floders = dirInfo.GetDirectories();
|
||||||
|
for (var i = 0; i < floders.Length; i++)
|
||||||
|
{
|
||||||
|
if (AABInPackageFileHashSet.Contains(floders[i].Name))
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
var newDir = Path.Combine(destFolderName, floders[i].Name);
|
||||||
|
if (!Directory.Exists(newDir))
|
||||||
|
{
|
||||||
|
Directory.CreateDirectory(newDir);
|
||||||
|
}
|
||||||
|
BFEditorUtils.CopyDir(floders[i].FullName, newDir);
|
||||||
|
Directory.Delete(floders[i].FullName, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
var files = dirInfo.GetFiles();
|
||||||
|
for (var i = 0; i < files.Length; i++)
|
||||||
|
{
|
||||||
|
var file = files[i];
|
||||||
|
if (AABInPackageFileHashSet.Contains(file.Name))
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
var destFile = Path.Combine(destFolderName, file.Name);
|
||||||
|
if (File.Exists(destFile))
|
||||||
|
{
|
||||||
|
File.Delete(destFile);
|
||||||
|
}
|
||||||
|
File.Move(file.FullName, destFile);
|
||||||
|
}
|
||||||
|
|
||||||
|
var settingsGradleFilePath = Path.Combine(PublishAsProjectPath, "settings.gradle");
|
||||||
|
var text = File.ReadAllText(settingsGradleFilePath);
|
||||||
|
var appendText = "include ':install_time_pack'";
|
||||||
|
if (!text.EndsWith(appendText))
|
||||||
|
{
|
||||||
|
text = text + "\n" + appendText;
|
||||||
|
}
|
||||||
|
File.WriteAllText(settingsGradleFilePath, text);
|
||||||
|
|
||||||
|
var buildGradlePath = Path.Combine(PublishAsProjectPath, "launcher/build.gradle");
|
||||||
|
var buildGradleText = File.ReadAllText(buildGradlePath);
|
||||||
|
var regex1 = new Regex("implementation 'com.google.android.play:core:1.10.0'");
|
||||||
|
if (!regex1.IsMatch(buildGradleText))
|
||||||
|
{
|
||||||
|
var regex12 = new Regex("dependencies {");
|
||||||
|
buildGradleText = regex12.Replace(buildGradleText, "dependencies {\n implementation 'com.google.android.play:core:1.10.0'");
|
||||||
|
}
|
||||||
|
var regex2 = new Regex("assetPacks = [\":install_time_pack\"]");
|
||||||
|
if (!regex2.IsMatch(buildGradleText))
|
||||||
|
{
|
||||||
|
var regex22 = new Regex("android {");
|
||||||
|
buildGradleText = regex22.Replace(buildGradleText, "android {\n assetPacks = [\":install_time_pack\"]");
|
||||||
|
}
|
||||||
|
File.WriteAllText(buildGradlePath, buildGradleText);
|
||||||
|
Debug.Log("Android转换为AAB工程完成");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -111,8 +111,8 @@ public partial class AdManager
|
|||||||
string networkPlacement = adInfo.NetworkPlacement; // The placement ID from the network that showed the ad
|
string networkPlacement = adInfo.NetworkPlacement; // The placement ID from the network that showed the ad
|
||||||
string adFormat = adInfo.AdFormat;
|
string adFormat = adInfo.AdFormat;
|
||||||
|
|
||||||
var dict = new Dictionary<string, string>();
|
var dict = new Dictionary<string, System.Object>();
|
||||||
dict.Add("revenue", revenue.ToString());
|
dict.Add("revenue", revenue);
|
||||||
dict.Add("country_code", countryCode);
|
dict.Add("country_code", countryCode);
|
||||||
dict.Add("network_name", networkName);
|
dict.Add("network_name", networkName);
|
||||||
dict.Add("ad_unit_Id", adUnitId);
|
dict.Add("ad_unit_Id", adUnitId);
|
||||||
|
|||||||
@ -286,8 +286,8 @@ namespace BF
|
|||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var dict = new Dictionary<string, string>();
|
var dict = new Dictionary<string, System.Object>();
|
||||||
dict.Add("revenue", revenue.ToString());
|
dict.Add("revenue", revenue);
|
||||||
dict.Add("auction_id", impressionData.auctionId);
|
dict.Add("auction_id", impressionData.auctionId);
|
||||||
dict.Add("country_code", impressionData.country);
|
dict.Add("country_code", impressionData.country);
|
||||||
dict.Add("network_name", impressionData.adNetwork);
|
dict.Add("network_name", impressionData.adNetwork);
|
||||||
@ -301,7 +301,7 @@ namespace BF
|
|||||||
}
|
}
|
||||||
if (!ReferenceEquals(impressionData.lifetimeRevenue, null))
|
if (!ReferenceEquals(impressionData.lifetimeRevenue, null))
|
||||||
{
|
{
|
||||||
dict.Add("lifetime_revenue", impressionData.lifetimeRevenue.ToString());
|
dict.Add("lifetime_revenue", impressionData.lifetimeRevenue);
|
||||||
}
|
}
|
||||||
if (!string.IsNullOrEmpty(impressionData.encryptedCPM))
|
if (!string.IsNullOrEmpty(impressionData.encryptedCPM))
|
||||||
{
|
{
|
||||||
|
|||||||
@ -140,6 +140,7 @@
|
|||||||
#ifdef _HIDE_Y
|
#ifdef _HIDE_Y
|
||||||
fixed3 worldPos = mul(unity_ObjectToWorld , v.vertex).xyz;
|
fixed3 worldPos = mul(unity_ObjectToWorld , v.vertex).xyz;
|
||||||
o.worldPosY = worldPos.y;
|
o.worldPosY = worldPos.y;
|
||||||
|
#endif
|
||||||
return o;
|
return o;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user