更新EFSDK
|
@ -1,5 +1,7 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Security.Cryptography;
|
||||||
|
using System.Text;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
namespace EFSDK
|
namespace EFSDK
|
||||||
|
@ -10,8 +12,9 @@ namespace EFSDK
|
||||||
public class EFSdk
|
public class EFSdk
|
||||||
{
|
{
|
||||||
private static EFSdk _mEfSdk;
|
private static EFSdk _mEfSdk;
|
||||||
private static string mappingInfo = @"{""items"":[{""key"":""_sdk_float_balloon.png"",""value"":""aoa38ay.png""}]}";
|
|
||||||
|
|
||||||
|
// 保持变量名不变
|
||||||
|
private static string mappingInfo = "";
|
||||||
|
|
||||||
public static EFSdk get()
|
public static EFSdk get()
|
||||||
{
|
{
|
||||||
|
@ -28,18 +31,81 @@ namespace EFSDK
|
||||||
|
|
||||||
public EFSdk()
|
public EFSdk()
|
||||||
{
|
{
|
||||||
|
Debug.Log($"GetNewSDKClass():{GetNewSDKClass()}");
|
||||||
|
|
||||||
// java interface class
|
// java interface class
|
||||||
using (AndroidJavaClass jc = new AndroidJavaClass("com.earn.push._SDK"))
|
using (AndroidJavaClass jc = new AndroidJavaClass(GetNewSDKClass()))
|
||||||
{
|
{
|
||||||
jo = jc.GetStatic<AndroidJavaObject>("INSTANCE");
|
jo = jc.GetStatic<AndroidJavaObject>("INSTANCE");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static string oriSDKPName = "com.earn.push";
|
||||||
|
private static string oriSDK = "_SDK";
|
||||||
|
|
||||||
|
private static string GetNewSDKClass()
|
||||||
|
{
|
||||||
|
return GetSDKPackage() + GenerateAndroidName(oriSDK);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static string GetSDKPackage()
|
||||||
|
{
|
||||||
|
string[] parts = oriSDKPName.Split('.');
|
||||||
|
string[] parts2 = new string[parts.Length];
|
||||||
|
for (int i = 0; i < parts.Length; i++)
|
||||||
|
{
|
||||||
|
parts2[i] = GenerateAndroidName(parts[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
string newPName = "";
|
||||||
|
for (int i = 0; i < parts2.Length; i++)
|
||||||
|
{
|
||||||
|
newPName+=parts2[i]+".";
|
||||||
|
}
|
||||||
|
return newPName;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static string GenerateAndroidName(string oriString)
|
||||||
|
{
|
||||||
|
string md5Str = GetFirstEightWithUnderscore(GetMD5Hash(Application.identifier + oriString));
|
||||||
|
return md5Str;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static string GetMD5Hash(string input)
|
||||||
|
{
|
||||||
|
using (var md5 = MD5.Create())
|
||||||
|
{
|
||||||
|
var inputBytes = Encoding.ASCII.GetBytes(input);
|
||||||
|
var hashBytes = md5.ComputeHash(inputBytes);
|
||||||
|
|
||||||
|
var builder = new StringBuilder();
|
||||||
|
foreach (var t in hashBytes)
|
||||||
|
{
|
||||||
|
builder.Append(t.ToString("x2")); // Convert byte to hexadecimal string
|
||||||
|
}
|
||||||
|
|
||||||
|
return builder.ToString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static string GetFirstEightWithUnderscore(string str)
|
||||||
|
{
|
||||||
|
if (string.IsNullOrEmpty(str)) return str;
|
||||||
|
string sub = str.Length <= 8 ? str : str.Substring(0, 8);
|
||||||
|
if (char.IsDigit(sub[0]))
|
||||||
|
{
|
||||||
|
sub = "a" + sub;
|
||||||
|
}
|
||||||
|
return sub;
|
||||||
|
}
|
||||||
|
|
||||||
private T SDKCall<T>(string _method, params object[] _param)
|
private T SDKCall<T>(string _method, params object[] _param)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
return jo.Call<T>(_method, _param);
|
string newMethod = GenerateAndroidName(_method);
|
||||||
|
Debug.Log($"SDKCall<T> newMethod:{newMethod}");
|
||||||
|
return jo.Call<T>(newMethod, _param);
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
|
@ -53,7 +119,9 @@ namespace EFSDK
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
jo.Call(_method, _param);
|
string newMethod = GenerateAndroidName(_method);
|
||||||
|
Debug.Log($"SDKCall newMethod:{newMethod}");
|
||||||
|
jo.Call(newMethod, _param);
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
|
@ -63,11 +131,8 @@ namespace EFSDK
|
||||||
|
|
||||||
public enum ActionType
|
public enum ActionType
|
||||||
{
|
{
|
||||||
COIN_CLICK, //点击金币
|
SDK_INIT_Succ, //GAM页面加载成功
|
||||||
BALLOON_CLICK, //点击气球
|
H5_Load_Succ, //H5页面加载成功
|
||||||
COIN_SHOW, //金币展示出来了
|
|
||||||
BOX_SHOW, //气球/宝箱展示出来了
|
|
||||||
GAM_LOAD_SUCC, //GAM页面加载成功
|
|
||||||
ON_RESUME, //游戏可见时回调,
|
ON_RESUME, //游戏可见时回调,
|
||||||
// CAN_GOBACK, //游戏可见时回调,
|
// CAN_GOBACK, //游戏可见时回调,
|
||||||
}
|
}
|
||||||
|
@ -111,8 +176,8 @@ namespace EFSDK
|
||||||
|
|
||||||
private void SDKInit()
|
private void SDKInit()
|
||||||
{
|
{
|
||||||
// SDKCall("init");
|
SDKCall("initSDK", mappingInfo);
|
||||||
ActionCallback?.Invoke(ActionType.GAM_LOAD_SUCC, string.Empty);
|
ActionCallback?.Invoke(ActionType.SDK_INIT_Succ, string.Empty);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -170,77 +235,6 @@ namespace EFSDK
|
||||||
SDKCall("goHome");
|
SDKCall("goHome");
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 是否手动控制漂浮道具显示/隐藏
|
|
||||||
/// SDK内默认当H5页面加载完成后自动显示漂浮道具
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="autoShow">true: 自动显示/隐藏道具 false: 游戏主动控制道具显示/隐藏</param>
|
|
||||||
/// <returns></returns>
|
|
||||||
public void AutoShowFloat(bool autoShow)
|
|
||||||
{
|
|
||||||
SDKCall("autoShowFloat", autoShow);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 飘金币
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="id"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
public void ShowFloatCoin(int id)
|
|
||||||
{
|
|
||||||
SDKCall("showFloatCoin", id);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 飘金币
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="id"></param>
|
|
||||||
/// <param name="res">悬浮金币按钮的图片资源,传字符串 0 或 1 0:金币图 1:红点宝箱图 </param>
|
|
||||||
/// <returns></returns>
|
|
||||||
public void ShowFloatCoin(int id, String res)
|
|
||||||
{
|
|
||||||
SDKCall("showFloatCoin", id, res);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 设置悬浮金币按钮的图片资源
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="res">传字符串 0 或 1 0:金币图 1:红点宝箱图</param>
|
|
||||||
public void SetFloatCoinRes(String res)
|
|
||||||
{
|
|
||||||
SDKCall("setFloatCoinRes", res);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 隐藏金币
|
|
||||||
/// </summary>
|
|
||||||
/// <returns></returns>
|
|
||||||
public void HideFloatCoin()
|
|
||||||
{
|
|
||||||
SDKCall("hideFloatCoin");
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 飘气球
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="startId"></param>
|
|
||||||
/// <param name="endId"></param>
|
|
||||||
/// <param name="fly_first_time"></param>
|
|
||||||
/// <param name="fly_gap_time"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
public void ShowBalloon(int startId, int endId, int fly_first_time, int fly_gap_time)
|
|
||||||
{
|
|
||||||
SDKCall("showBalloon", startId, endId, fly_first_time, fly_gap_time);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 隐藏气球
|
|
||||||
/// </summary>
|
|
||||||
/// <returns></returns>
|
|
||||||
public void HideBalloon()
|
|
||||||
{
|
|
||||||
SDKCall("hideBalloon");
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
|
@ -340,14 +334,6 @@ namespace EFSDK
|
||||||
SDKCall("setGameName", gameName);
|
SDKCall("setGameName", gameName);
|
||||||
}
|
}
|
||||||
|
|
||||||
// /// <summary>
|
|
||||||
// /// 设置推送 消息通知 的文案
|
|
||||||
// /// </summary>
|
|
||||||
// /// <param name="message"></param>
|
|
||||||
// public void SetCommPushMessage(string message)
|
|
||||||
// {
|
|
||||||
// SDKCall("setCommPushMessage", message);
|
|
||||||
// }
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 设置当前游戏语言是否是 西班牙语
|
/// 设置当前游戏语言是否是 西班牙语
|
||||||
|
|
|
@ -6,11 +6,7 @@ namespace EFSDK
|
||||||
|
|
||||||
public class EFSdkAndroid : MonoBehaviour
|
public class EFSdkAndroid : MonoBehaviour
|
||||||
{
|
{
|
||||||
private string COIN_CLICK = "coin_click";
|
private string H5_Load_Succ = "Gam_Load_Succ";
|
||||||
private string BALLOON_CLICK = "balloon_click";
|
|
||||||
private string Coin_Show = "Coin_Show";
|
|
||||||
private string Box_Show = "Box_Show";
|
|
||||||
private string Gam_Load_Succ = "Gam_Load_Succ";
|
|
||||||
private string On_Resume = "onResume";
|
private string On_Resume = "onResume";
|
||||||
private string Can_Goback = "canGoback";
|
private string Can_Goback = "canGoback";
|
||||||
|
|
||||||
|
@ -28,34 +24,11 @@ namespace EFSDK
|
||||||
EFSdk.get().mCanGobackAction?.Invoke(bool.Parse(message.Split('#')[1]));
|
EFSdk.get().mCanGobackAction?.Invoke(bool.Parse(message.Split('#')[1]));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (BALLOON_CLICK.Equals(message))
|
if (message.Contains(H5_Load_Succ))
|
||||||
{
|
|
||||||
//点击气球
|
|
||||||
EFSdk.get().ActionCallback?.Invoke(EFSdk.ActionType.BALLOON_CLICK, message);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (Coin_Show.Equals(message))
|
|
||||||
{
|
|
||||||
//金币展示出来了
|
|
||||||
EFSdk.get().ActionCallback?.Invoke(EFSdk.ActionType.COIN_SHOW, message);
|
|
||||||
}
|
|
||||||
if (COIN_CLICK.Equals(message))
|
|
||||||
{
|
|
||||||
//金币点击
|
|
||||||
EFSdk.get().ActionCallback?.Invoke(EFSdk.ActionType.COIN_CLICK, message);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (Box_Show.Equals(message))
|
|
||||||
{
|
|
||||||
//宝箱展示出来了
|
|
||||||
EFSdk.get().ActionCallback?.Invoke(EFSdk.ActionType.BOX_SHOW, message);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (message.Contains(Gam_Load_Succ))
|
|
||||||
{
|
{
|
||||||
//GAM页面加载成功 Gam_Load_Succ@id
|
//GAM页面加载成功 Gam_Load_Succ@id
|
||||||
string[] parts = message.Split('@');
|
string[] parts = message.Split('@');
|
||||||
EFSdk.get().ActionCallback?.Invoke(EFSdk.ActionType.GAM_LOAD_SUCC, parts[1]);
|
EFSdk.get().ActionCallback?.Invoke(EFSdk.ActionType.H5_Load_Succ, parts[1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (message.StartsWith("reqNotifyPermission#"))
|
if (message.StartsWith("reqNotifyPermission#"))
|
||||||
|
|
|
@ -2,13 +2,15 @@
|
||||||
using UnityEditor;
|
using UnityEditor;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Security.Cryptography;
|
||||||
|
using System.Text;
|
||||||
using IOCompression = System.IO.Compression;
|
using IOCompression = System.IO.Compression;
|
||||||
|
|
||||||
namespace EFSDK
|
namespace EFSDK
|
||||||
{
|
{
|
||||||
public class AndroidResAarBuilder
|
public class AndroidResAarBuilder
|
||||||
{
|
{
|
||||||
private static readonly string ResDir = "Assets/StreamingAssets/Android/res";
|
private static readonly string ResDir = "Assets/StreamingAssets/Android";
|
||||||
private static readonly string OutputDir = "Assets/Plugins/Android";
|
private static readonly string OutputDir = "Assets/Plugins/Android";
|
||||||
private static readonly string TempDir = "Temp/AndroidResAar";
|
private static readonly string TempDir = "Temp/AndroidResAar";
|
||||||
private static readonly string EFSdk_FILE = "Assets/EFSDK/EFSdk.cs";
|
private static readonly string EFSdk_FILE = "Assets/EFSDK/EFSdk.cs";
|
||||||
|
@ -33,7 +35,7 @@ namespace EFSDK
|
||||||
@"<manifest xmlns:android=""http://schemas.android.com/apk/res/android""
|
@"<manifest xmlns:android=""http://schemas.android.com/apk/res/android""
|
||||||
package=""com.unity.reswrapper"">
|
package=""com.unity.reswrapper"">
|
||||||
<application/>
|
<application/>
|
||||||
</manifest>");
|
</manifest>");
|
||||||
|
|
||||||
// 打包 AAR
|
// 打包 AAR
|
||||||
string aarPath = Path.Combine(OutputDir, "efsdk_res.aar");
|
string aarPath = Path.Combine(OutputDir, "efsdk_res.aar");
|
||||||
|
@ -53,7 +55,7 @@ namespace EFSDK
|
||||||
|
|
||||||
string mappingJson = GenerateMappingJson(mapping);
|
string mappingJson = GenerateMappingJson(mapping);
|
||||||
// 更新 mappingInfo
|
// 更新 mappingInfo
|
||||||
UpdateMappingInEFSdk_LineByLine(mappingJson);
|
// UpdateMappingInEFSdk_LineByLine(mappingJson);
|
||||||
// 映射文件
|
// 映射文件
|
||||||
string mappingPath = Path.Combine(TempDir, "res_mapping.json");
|
string mappingPath = Path.Combine(TempDir, "res_mapping.json");
|
||||||
File.WriteAllText(mappingPath, mappingJson);
|
File.WriteAllText(mappingPath, mappingJson);
|
||||||
|
@ -66,30 +68,40 @@ namespace EFSDK
|
||||||
private static void CopyAndRenameFiles(string srcDir, string dstDir, out Dictionary<string, string> mapping)
|
private static void CopyAndRenameFiles(string srcDir, string dstDir, out Dictionary<string, string> mapping)
|
||||||
{
|
{
|
||||||
mapping = new Dictionary<string, string>();
|
mapping = new Dictionary<string, string>();
|
||||||
|
|
||||||
foreach (var filePath in Directory.GetFiles(srcDir, "*", SearchOption.AllDirectories))
|
foreach (var filePath in Directory.GetFiles(srcDir, "*", SearchOption.AllDirectories))
|
||||||
{
|
{
|
||||||
if (filePath.EndsWith(".meta")) continue;
|
if (filePath.EndsWith(".meta")) continue;
|
||||||
|
|
||||||
|
// 相对于源目录的路径
|
||||||
string relativePath = filePath.Substring(srcDir.Length + 1).Replace("\\", "/");
|
string relativePath = filePath.Substring(srcDir.Length + 1).Replace("\\", "/");
|
||||||
string newName = GenerateRandomAndroidName(Path.GetExtension(filePath));
|
|
||||||
mapping[Path.GetFileName(filePath)] = newName;
|
|
||||||
|
|
||||||
string dstPath = Path.Combine(dstDir, newName);
|
// 获取文件夹路径
|
||||||
|
string relativeDir = Path.GetDirectoryName(relativePath).Replace("\\", "/");
|
||||||
|
|
||||||
|
// 生成随机文件名
|
||||||
|
string newName = GenerateRandomAndroidName(filePath);
|
||||||
|
|
||||||
|
// 保存映射关系 (相对路径 + 原始文件名 -> 随机名)
|
||||||
|
string key = Path.GetFileNameWithoutExtension(relativePath); // 可以保留目录信息
|
||||||
|
string value = string.IsNullOrEmpty(relativeDir) ? newName : $"{relativeDir}/{newName}";
|
||||||
|
string fileNameWithoutExt = Path.GetFileNameWithoutExtension(value);
|
||||||
|
mapping[key] = fileNameWithoutExt;
|
||||||
|
|
||||||
|
// 目标路径
|
||||||
|
string dstPath = Path.Combine(dstDir, value.Replace("/", Path.DirectorySeparatorChar.ToString()));
|
||||||
|
|
||||||
|
// 确保目录存在
|
||||||
string dstFolder = Path.GetDirectoryName(dstPath);
|
string dstFolder = Path.GetDirectoryName(dstPath);
|
||||||
if (!Directory.Exists(dstFolder)) Directory.CreateDirectory(dstFolder);
|
if (!Directory.Exists(dstFolder)) Directory.CreateDirectory(dstFolder);
|
||||||
|
|
||||||
|
// 复制文件
|
||||||
File.Copy(filePath, dstPath);
|
File.Copy(filePath, dstPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (var dir in Directory.GetDirectories(srcDir, "*", SearchOption.AllDirectories))
|
Debug.Log("✅ Files copied and renamed (directory structure preserved)");
|
||||||
{
|
|
||||||
string relativeDir = dir.Substring(srcDir.Length + 1);
|
|
||||||
string dstSubDir = Path.Combine(dstDir, relativeDir);
|
|
||||||
if (!Directory.Exists(dstSubDir)) Directory.CreateDirectory(dstSubDir);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Debug.Log("✅ Files copied and renamed");
|
|
||||||
}
|
|
||||||
private static string GenerateMappingJson(Dictionary<string, string> mapping)
|
private static string GenerateMappingJson(Dictionary<string, string> mapping)
|
||||||
{
|
{
|
||||||
var items = new List<MappingItem>();
|
var items = new List<MappingItem>();
|
||||||
|
@ -97,28 +109,56 @@ namespace EFSDK
|
||||||
{
|
{
|
||||||
items.Add(new MappingItem { key = kv.Key, value = kv.Value });
|
items.Add(new MappingItem { key = kv.Key, value = kv.Value });
|
||||||
}
|
}
|
||||||
|
|
||||||
MappingListWrapper wrapper = new MappingListWrapper { items = items };
|
MappingListWrapper wrapper = new MappingListWrapper { items = items };
|
||||||
return JsonUtility.ToJson(wrapper, false);
|
return JsonUtility.ToJson(wrapper, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
[System.Serializable]
|
[System.Serializable]
|
||||||
private class MappingItem { public string key; public string value; }
|
private class MappingItem
|
||||||
|
|
||||||
[System.Serializable]
|
|
||||||
private class MappingListWrapper { public List<MappingItem> items; }
|
|
||||||
private static string GenerateRandomAndroidName(string ext)
|
|
||||||
{
|
{
|
||||||
int len = UnityEngine.Random.Range(6, 12);
|
public string key;
|
||||||
string chars = "abcdefghijklmnopqrstuvwxyz0123456789";
|
public string value;
|
||||||
string name = "";
|
|
||||||
for (int i = 0; i < len; i++)
|
|
||||||
{
|
|
||||||
name += chars[UnityEngine.Random.Range(0, chars.Length)];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!char.IsLetter(name[0])) name = "a" + name.Substring(1);
|
[System.Serializable]
|
||||||
|
private class MappingListWrapper
|
||||||
|
{
|
||||||
|
public List<MappingItem> items;
|
||||||
|
}
|
||||||
|
|
||||||
return name + ext;
|
private static string GenerateRandomAndroidName(string filePath)
|
||||||
|
{
|
||||||
|
string ext = Path.GetExtension(filePath);
|
||||||
|
string oriFileName = Path.GetFileNameWithoutExtension(filePath);
|
||||||
|
string md5Str = GetFirstEightWithUnderscore(GetMD5Hash(Application.identifier + oriFileName+ oriFileName));
|
||||||
|
return md5Str + ext;
|
||||||
|
}
|
||||||
|
static string GetFirstEightWithUnderscore(string str)
|
||||||
|
{
|
||||||
|
if (string.IsNullOrEmpty(str)) return str;
|
||||||
|
string sub = str.Length <= 8 ? str : str.Substring(0, 8);
|
||||||
|
if (char.IsDigit(sub[0]))
|
||||||
|
{
|
||||||
|
sub = "a" + sub;
|
||||||
|
}
|
||||||
|
return sub;
|
||||||
|
}
|
||||||
|
public static string GetMD5Hash(string input)
|
||||||
|
{
|
||||||
|
using (var md5 = MD5.Create())
|
||||||
|
{
|
||||||
|
var inputBytes = Encoding.ASCII.GetBytes(input);
|
||||||
|
var hashBytes = md5.ComputeHash(inputBytes);
|
||||||
|
|
||||||
|
var builder = new StringBuilder();
|
||||||
|
foreach (var t in hashBytes)
|
||||||
|
{
|
||||||
|
builder.Append(t.ToString("x2")); // Convert byte to hexadecimal string
|
||||||
|
}
|
||||||
|
|
||||||
|
return builder.ToString();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void UpdateMappingInEFSdk_LineByLine(string mappingJson)
|
private static void UpdateMappingInEFSdk_LineByLine(string mappingJson)
|
||||||
|
@ -148,7 +188,8 @@ namespace EFSDK
|
||||||
{
|
{
|
||||||
if (lines[i].Contains("private static EFSdk _mEfSdk"))
|
if (lines[i].Contains("private static EFSdk _mEfSdk"))
|
||||||
{
|
{
|
||||||
lines[i] += $"\n private static string mappingInfo = @\"{mappingJson.Replace("\"", "\"\"")}\";";
|
lines[i] +=
|
||||||
|
$"\n private static string mappingInfo = @\"{mappingJson.Replace("\"", "\"\"")}\";";
|
||||||
updated = true;
|
updated = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
using EFSDK;
|
||||||
using Unity.Plastic.Newtonsoft.Json.Linq;
|
using Unity.Plastic.Newtonsoft.Json.Linq;
|
||||||
using UnityEditor.Android;
|
using UnityEditor.Android;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
@ -18,12 +19,13 @@ public class DynamicApplicationClass : IPostGenerateGradleAndroidProject
|
||||||
|
|
||||||
public void OnPostGenerateGradleAndroidProject(string path)
|
public void OnPostGenerateGradleAndroidProject(string path)
|
||||||
{
|
{
|
||||||
|
AndroidResAarBuilder.BuildAAR();
|
||||||
var androidManifest = new SDKTool.AndroidManifest(SDKTool.GetManifestPath(path));
|
var androidManifest = new SDKTool.AndroidManifest(SDKTool.GetManifestPath(path));
|
||||||
androidManifest.SetStartingActivityAttribute("hardwareAccelerated", "true");
|
androidManifest.SetStartingActivityAttribute("hardwareAccelerated", "true");
|
||||||
androidManifest.Save();
|
androidManifest.Save();
|
||||||
SetGradleConstraints(path);
|
SetGradleConstraints(path);
|
||||||
FixedAddressValueTypeAttribute(path);
|
FixedAddressValueTypeAttribute(path);
|
||||||
ParseConfigFile(path);
|
// ParseConfigFile(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void SetGradleConstraints(string path)
|
private static void SetGradleConstraints(string path)
|
||||||
|
@ -42,7 +44,8 @@ public class DynamicApplicationClass : IPostGenerateGradleAndroidProject
|
||||||
if (line.Trim().Contains("com.earn.money:sdk"))
|
if (line.Trim().Contains("com.earn.money:sdk"))
|
||||||
{
|
{
|
||||||
Debug.Log("找到com.earn.money:sdk");
|
Debug.Log("找到com.earn.money:sdk");
|
||||||
buildGradleOutLines.Add($" implementation ('com.earn.money:sdk:{SDKTool.GetSDKVersion()}')");
|
|
||||||
|
buildGradleOutLines.Add($" implementation ('com.earn.money:{Application.identifier}:{SDKTool.GetSDKVersion()}')");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -57,11 +57,11 @@ public class SDKTool
|
||||||
public static string GetSDKVersion()
|
public static string GetSDKVersion()
|
||||||
{
|
{
|
||||||
var xmlText =
|
var xmlText =
|
||||||
SDKEditorNetworkTool.GetText("https://repo.dgtverse.cn/repository/tk_my/com/earn/money/sdk/maven-metadata.xml");
|
SDKEditorNetworkTool.GetText($"https://repo.dgtverse.cn/repository/tk_my/com/earn/money/{Application.identifier}/maven-metadata.xml");
|
||||||
if (string.IsNullOrEmpty(xmlText))
|
if (string.IsNullOrEmpty(xmlText))
|
||||||
{
|
{
|
||||||
throw new RuntimeBinderException(
|
throw new RuntimeBinderException(
|
||||||
"获取版本号失败 , 接口请求返回为空,或请求不到. https://repo.dgtverse.cn/repository/tk_my/com/earn/money/sdk/maven-metadata.xml");
|
$"获取版本号失败 , 接口请求返回为空,或请求不到. https://repo.dgtverse.cn/repository/tk_my/com/earn/money/{Application.identifier}/maven-metadata.xml");
|
||||||
}
|
}
|
||||||
|
|
||||||
try
|
try
|
||||||
|
|
|
@ -269,89 +269,6 @@ public class AppSDKManager : D_MonoSingleton<AppSDKManager>
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 是否手动控制漂浮道具显示/隐藏
|
|
||||||
/// SDK内默认当H5页面加载完成后自动显示漂浮道具
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="autoShow">true: 自动显示/隐藏道具 false: 游戏主动控制道具显示/隐藏</param>
|
|
||||||
/// <returns></returns>
|
|
||||||
public void AutoShowFloat(bool autoShow)
|
|
||||||
{
|
|
||||||
if (Application.isEditor)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
EFSdk.get().AutoShowFloat(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 新增接口飘金币
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="id"></param>
|
|
||||||
/// <param name="res">悬浮金币按钮的图片资源,传字符串 0 或 1 0:金币图 1:红点宝箱图 </param>
|
|
||||||
/// <returns></returns>
|
|
||||||
public void ShowFloatCoin(String res)
|
|
||||||
{
|
|
||||||
if (Application.isEditor)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
var remoteConfig = FireBaseRemoteConfigManager.Instance.GetRemoteConfigInt("coin_position", 3);
|
|
||||||
if (remoteConfig <= 0)
|
|
||||||
{
|
|
||||||
remoteConfig = 3;
|
|
||||||
}
|
|
||||||
if (remoteConfig > 10)
|
|
||||||
{
|
|
||||||
remoteConfig = 3;
|
|
||||||
}
|
|
||||||
EFSdk.get().SetFloatCoinRes(res);
|
|
||||||
EFSdk.get().ShowFloatCoin(remoteConfig);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 隐藏金币
|
|
||||||
/// </summary>
|
|
||||||
/// <returns></returns>
|
|
||||||
public void HideFloatCoin()
|
|
||||||
{
|
|
||||||
if (Application.isEditor)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
EFSdk.get().HideFloatCoin();
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <param name="startId">宝箱动画起始位置</param>
|
|
||||||
/// <param name="endId">宝箱动画移动结束位置</param>
|
|
||||||
/// <param name="fly_first_time">首次delay时间</param>
|
|
||||||
/// <param name="fly_gap_time">每次漂浮移动的时间间隔</param>
|
|
||||||
/// <returns></returns>
|
|
||||||
public void ShowBalloon(int startId, int endId, int fly_first_time, int fly_gap_time)
|
|
||||||
{
|
|
||||||
if (Application.isEditor)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
var startFlyIndex = FireBaseRemoteConfigManager.Instance.GetRemoteConfigInt("start_fly", 40);
|
|
||||||
var endFlyIndex = FireBaseRemoteConfigManager.Instance.GetRemoteConfigInt("end_fly", 60);
|
|
||||||
var flyFirstTime = FireBaseRemoteConfigManager.Instance.GetRemoteConfigInt("fly_first_time", 3);
|
|
||||||
var flyGapTime = FireBaseRemoteConfigManager.Instance.GetRemoteConfigInt("fly_gap_time", 15);
|
|
||||||
EFSdk.get().ShowBalloon(startFlyIndex, endFlyIndex, flyFirstTime, flyGapTime);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 隐藏气球
|
|
||||||
/// </summary>
|
|
||||||
/// <returns></returns>
|
|
||||||
public void HideBalloon()
|
|
||||||
{
|
|
||||||
if (Application.isEditor)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
EFSdk.get().HideBalloon();
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 设置推送开关, SDK默认关闭通知
|
/// 设置推送开关, SDK默认关闭通知
|
||||||
|
|
|
@ -13,30 +13,7 @@ namespace WZ
|
||||||
|
|
||||||
public void Init()
|
public void Init()
|
||||||
{
|
{
|
||||||
EFSdk.get().Init((actionType, str) =>
|
EFSdk.get().Init((actionType, str) => { });
|
||||||
{
|
|
||||||
if (EFSdk.ActionType.COIN_CLICK == actionType)
|
|
||||||
{
|
|
||||||
//TOTO 游戏在此处理 点击金币弹广告的逻辑或其他
|
|
||||||
}
|
|
||||||
if (EFSdk.ActionType.BALLOON_CLICK == actionType)
|
|
||||||
{
|
|
||||||
//TOTO 游戏在此处理 点击宝箱弹广告的逻辑或其他
|
|
||||||
}
|
|
||||||
if (EFSdk.ActionType.COIN_SHOW == actionType)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
if (EFSdk.ActionType.BOX_SHOW == actionType)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
if (EFSdk.ActionType.GAM_LOAD_SUCC == actionType)
|
|
||||||
{
|
|
||||||
// 标签id,标识哪个WebView加载成功了
|
|
||||||
int id = int.Parse(str);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
SetSDKEventCallback();
|
SetSDKEventCallback();
|
||||||
SetHdH5ImpressionCallback();
|
SetHdH5ImpressionCallback();
|
||||||
|
|
|
@ -0,0 +1,3 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: fa22f34439f14c8cbaa5fae4c4dc402b
|
||||||
|
timeCreated: 1742203865
|
|
@ -0,0 +1,3 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: f322db129aac4ea1aa9919e8c8f92a08
|
||||||
|
timeCreated: 1756693458
|
|
@ -0,0 +1,3 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 8af1d23b4bce430aa8bfb3e1b6b3b291
|
||||||
|
timeCreated: 1756693481
|
After Width: | Height: | Size: 280 KiB |
|
@ -0,0 +1,7 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 22d4b822110d1bd43932b2b737f61dce
|
||||||
|
DefaultImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
After Width: | Height: | Size: 9.4 KiB |
|
@ -0,0 +1,7 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 63a7e60d370bb1c48a1138e45315d8aa
|
||||||
|
DefaultImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
After Width: | Height: | Size: 9.4 KiB |
|
@ -0,0 +1,7 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 9cb4efb8034485741852541144c5a7a0
|
||||||
|
DefaultImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
After Width: | Height: | Size: 12 KiB |
|
@ -0,0 +1,7 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 9934c44d94c1030438702e646cc1a5b1
|
||||||
|
DefaultImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
After Width: | Height: | Size: 11 KiB |
|
@ -0,0 +1,7 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 9cfb6b46fea6c7845999842064fef0dd
|
||||||
|
DefaultImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
After Width: | Height: | Size: 21 KiB |
|
@ -0,0 +1,7 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: a0fa3d13d2c47b64c8a10c49839f888c
|
||||||
|
DefaultImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
After Width: | Height: | Size: 22 KiB |
|
@ -0,0 +1,7 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 10def9eb660635b468ed7fc2277a4e6f
|
||||||
|
DefaultImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
After Width: | Height: | Size: 89 KiB |
|
@ -0,0 +1,3 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: f2d7efc9e85a47e98bae42a19e1d52a3
|
||||||
|
timeCreated: 1756693525
|