no message
|
@ -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,7 @@
|
|||
fileFormatVersion: 2
|
||||
guid: f2d7efc9e85a47e98bae42a19e1d52a3
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -1,5 +1,7 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Security.Cryptography;
|
||||
using System.Text;
|
||||
using UnityEngine;
|
||||
|
||||
namespace EFSDK
|
||||
|
@ -10,8 +12,9 @@ namespace EFSDK
|
|||
public class EFSdk
|
||||
{
|
||||
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()
|
||||
{
|
||||
|
@ -28,18 +31,81 @@ namespace EFSDK
|
|||
|
||||
public EFSdk()
|
||||
{
|
||||
Debug.Log($"GetNewSDKClass():{GetNewSDKClass()}");
|
||||
|
||||
// java interface class
|
||||
using (AndroidJavaClass jc = new AndroidJavaClass("com.earn.push._SDK"))
|
||||
using (AndroidJavaClass jc = new AndroidJavaClass(GetNewSDKClass()))
|
||||
{
|
||||
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)
|
||||
{
|
||||
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)
|
||||
{
|
||||
|
@ -53,7 +119,9 @@ namespace EFSDK
|
|||
{
|
||||
try
|
||||
{
|
||||
jo.Call(_method, _param);
|
||||
string newMethod = GenerateAndroidName(_method);
|
||||
Debug.Log($"SDKCall newMethod:{newMethod}");
|
||||
jo.Call(newMethod, _param);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
@ -63,11 +131,8 @@ namespace EFSDK
|
|||
|
||||
public enum ActionType
|
||||
{
|
||||
COIN_CLICK, //点击金币
|
||||
BALLOON_CLICK, //点击气球
|
||||
COIN_SHOW, //金币展示出来了
|
||||
BOX_SHOW, //气球/宝箱展示出来了
|
||||
GAM_LOAD_SUCC, //GAM页面加载成功
|
||||
SDK_INIT_Succ, //GAM页面加载成功
|
||||
H5_Load_Succ, //H5页面加载成功
|
||||
ON_RESUME, //游戏可见时回调,
|
||||
// CAN_GOBACK, //游戏可见时回调,
|
||||
}
|
||||
|
@ -111,8 +176,8 @@ namespace EFSDK
|
|||
|
||||
private void SDKInit()
|
||||
{
|
||||
// SDKCall("init");
|
||||
ActionCallback?.Invoke(ActionType.GAM_LOAD_SUCC, string.Empty);
|
||||
SDKCall("initSDK", mappingInfo);
|
||||
ActionCallback?.Invoke(ActionType.SDK_INIT_Succ, string.Empty);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -170,77 +235,6 @@ namespace EFSDK
|
|||
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>
|
||||
///
|
||||
|
@ -340,14 +334,6 @@ namespace EFSDK
|
|||
SDKCall("setGameName", gameName);
|
||||
}
|
||||
|
||||
// /// <summary>
|
||||
// /// 设置推送 消息通知 的文案
|
||||
// /// </summary>
|
||||
// /// <param name="message"></param>
|
||||
// public void SetCommPushMessage(string message)
|
||||
// {
|
||||
// SDKCall("setCommPushMessage", message);
|
||||
// }
|
||||
|
||||
/// <summary>
|
||||
/// 设置当前游戏语言是否是 西班牙语
|
||||
|
|
|
@ -6,11 +6,7 @@ namespace EFSDK
|
|||
|
||||
public class EFSdkAndroid : MonoBehaviour
|
||||
{
|
||||
private string COIN_CLICK = "coin_click";
|
||||
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 H5_Load_Succ = "Gam_Load_Succ";
|
||||
private string On_Resume = "onResume";
|
||||
private string Can_Goback = "canGoback";
|
||||
|
||||
|
@ -28,34 +24,11 @@ namespace EFSDK
|
|||
EFSdk.get().mCanGobackAction?.Invoke(bool.Parse(message.Split('#')[1]));
|
||||
}
|
||||
|
||||
if (BALLOON_CLICK.Equals(message))
|
||||
{
|
||||
//点击气球
|
||||
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))
|
||||
if (message.Contains(H5_Load_Succ))
|
||||
{
|
||||
//GAM页面加载成功 Gam_Load_Succ@id
|
||||
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#"))
|
||||
|
|
|
@ -2,13 +2,15 @@
|
|||
using UnityEditor;
|
||||
using System.IO;
|
||||
using System.Collections.Generic;
|
||||
using System.Security.Cryptography;
|
||||
using System.Text;
|
||||
using IOCompression = System.IO.Compression;
|
||||
|
||||
namespace EFSDK
|
||||
{
|
||||
public class AndroidResAarBuilder
|
||||
public class AndroidResAarBuilder
|
||||
{
|
||||
private static readonly string ResDir = "Assets/StreamingAssets/Android/res";
|
||||
private static readonly string ResDir = "Assets/EFSDK/Android";
|
||||
private static readonly string OutputDir = "Assets/Plugins/Android";
|
||||
private static readonly string TempDir = "Temp/AndroidResAar";
|
||||
private static readonly string EFSdk_FILE = "Assets/EFSDK/EFSdk.cs";
|
||||
|
@ -30,10 +32,10 @@ namespace EFSDK
|
|||
CopyAndRenameFiles(ResDir, TempDir, out Dictionary<string, string> mapping);
|
||||
string manifestPath = Path.Combine(TempDir, "AndroidManifest.xml");
|
||||
File.WriteAllText(manifestPath,
|
||||
@"<manifest xmlns:android=""http://schemas.android.com/apk/res/android""
|
||||
package=""com.unity.reswrapper"">
|
||||
<application/>
|
||||
</manifest>");
|
||||
@$"<manifest xmlns:android=""http://schemas.android.com/apk/res/android""
|
||||
package=""com.{GetFirstEightWithUnderscore(GetMD5Hash(Application.identifier + "res"))}"">
|
||||
<application/>
|
||||
</manifest>");
|
||||
|
||||
// 打包 AAR
|
||||
string aarPath = Path.Combine(OutputDir, "efsdk_res.aar");
|
||||
|
@ -50,10 +52,10 @@ namespace EFSDK
|
|||
string fileName = Path.GetFileName(kv.Key);
|
||||
simpleMapping[fileName] = kv.Value;
|
||||
}
|
||||
|
||||
|
||||
string mappingJson = GenerateMappingJson(mapping);
|
||||
// 更新 mappingInfo
|
||||
UpdateMappingInEFSdk_LineByLine(mappingJson);
|
||||
// UpdateMappingInEFSdk_LineByLine(mappingJson);
|
||||
// 映射文件
|
||||
string mappingPath = Path.Combine(TempDir, "res_mapping.json");
|
||||
File.WriteAllText(mappingPath, mappingJson);
|
||||
|
@ -66,30 +68,40 @@ namespace EFSDK
|
|||
private static void CopyAndRenameFiles(string srcDir, string dstDir, out Dictionary<string, string> mapping)
|
||||
{
|
||||
mapping = new Dictionary<string, string>();
|
||||
|
||||
foreach (var filePath in Directory.GetFiles(srcDir, "*", SearchOption.AllDirectories))
|
||||
{
|
||||
if (filePath.EndsWith(".meta")) continue;
|
||||
|
||||
// 相对于源目录的路径
|
||||
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);
|
||||
if (!Directory.Exists(dstFolder)) Directory.CreateDirectory(dstFolder);
|
||||
|
||||
// 复制文件
|
||||
File.Copy(filePath, dstPath);
|
||||
}
|
||||
|
||||
foreach (var dir in Directory.GetDirectories(srcDir, "*", SearchOption.AllDirectories))
|
||||
{
|
||||
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");
|
||||
Debug.Log("✅ Files copied and renamed (directory structure preserved)");
|
||||
}
|
||||
|
||||
private static string GenerateMappingJson(Dictionary<string, string> mapping)
|
||||
{
|
||||
var items = new List<MappingItem>();
|
||||
|
@ -97,28 +109,59 @@ namespace EFSDK
|
|||
{
|
||||
items.Add(new MappingItem { key = kv.Key, value = kv.Value });
|
||||
}
|
||||
|
||||
MappingListWrapper wrapper = new MappingListWrapper { items = items };
|
||||
return JsonUtility.ToJson(wrapper, false);
|
||||
}
|
||||
|
||||
[System.Serializable]
|
||||
private class MappingItem { public string key; public string value; }
|
||||
private class MappingItem
|
||||
{
|
||||
public string key;
|
||||
public string value;
|
||||
}
|
||||
|
||||
[System.Serializable]
|
||||
private class MappingListWrapper { public List<MappingItem> items; }
|
||||
private static string GenerateRandomAndroidName(string ext)
|
||||
private class MappingListWrapper
|
||||
{
|
||||
int len = UnityEngine.Random.Range(6, 12);
|
||||
string chars = "abcdefghijklmnopqrstuvwxyz0123456789";
|
||||
string name = "";
|
||||
for (int i = 0; i < len; i++)
|
||||
public List<MappingItem> items;
|
||||
}
|
||||
|
||||
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]))
|
||||
{
|
||||
name += chars[UnityEngine.Random.Range(0, chars.Length)];
|
||||
sub = "a" + sub;
|
||||
}
|
||||
|
||||
if (!char.IsLetter(name[0])) name = "a" + name.Substring(1);
|
||||
return sub;
|
||||
}
|
||||
|
||||
return name + ext;
|
||||
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)
|
||||
|
@ -148,7 +191,8 @@ namespace EFSDK
|
|||
{
|
||||
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;
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using EFSDK;
|
||||
using Unity.Plastic.Newtonsoft.Json.Linq;
|
||||
using UnityEditor.Android;
|
||||
using UnityEngine;
|
||||
|
@ -18,12 +19,13 @@ public class DynamicApplicationClass : IPostGenerateGradleAndroidProject
|
|||
|
||||
public void OnPostGenerateGradleAndroidProject(string path)
|
||||
{
|
||||
AndroidResAarBuilder.BuildAAR();
|
||||
var androidManifest = new SDKTool.AndroidManifest(SDKTool.GetManifestPath(path));
|
||||
androidManifest.SetStartingActivityAttribute("hardwareAccelerated", "true");
|
||||
androidManifest.Save();
|
||||
SetGradleConstraints(path);
|
||||
FixedAddressValueTypeAttribute(path);
|
||||
ParseConfigFile(path);
|
||||
// ParseConfigFile(path);
|
||||
}
|
||||
|
||||
private static void SetGradleConstraints(string path)
|
||||
|
@ -42,7 +44,8 @@ public class DynamicApplicationClass : IPostGenerateGradleAndroidProject
|
|||
if (line.Trim().Contains("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
|
||||
{
|
||||
|
|
|
@ -57,11 +57,11 @@ public class SDKTool
|
|||
public static string GetSDKVersion()
|
||||
{
|
||||
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))
|
||||
{
|
||||
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
|
||||
|
|
|
@ -128,6 +128,15 @@ namespace WZ
|
|||
}else if (_configs[i].Key.ToLower() == KEY_Admob_NativeId.ToLower())
|
||||
{
|
||||
StaticValue.AdmobNativeId = valueTemp;
|
||||
}else if (_configs[i].Key.ToLower() == KEY_Admob_SMALL_NativeId.ToLower())
|
||||
{
|
||||
StaticValue.AdmobSmallNativeId = valueTemp;
|
||||
}else if (_configs[i].Key.ToLower() == KEY_Admob_MINDDLE_NativeId.ToLower())
|
||||
{
|
||||
StaticValue.AdmobMinddleNativeId = valueTemp;
|
||||
}else if (_configs[i].Key.ToLower() == KEY_Admob_FULL_NativeId.ToLower())
|
||||
{
|
||||
StaticValue.AdmobFullNativeId = valueTemp;
|
||||
}else if (_configs[i].Key.ToLower() == KEY_Admob_RewardId.ToLower())
|
||||
{
|
||||
StaticValue.AdmobRewardId = valueTemp;
|
||||
|
@ -290,6 +299,9 @@ namespace WZ
|
|||
public const string KEY_Admob_NormalBannerId = "Admob_Banner_ID2";
|
||||
public const string KEY_Admob_SplashId = "Admob_APPOPEN_ID";
|
||||
public const string KEY_Admob_NativeId = "Admob_NATIVE_ID";
|
||||
public const string KEY_Admob_SMALL_NativeId = "ADMOB_SMALL_NATIVE_ID";
|
||||
public const string KEY_Admob_MINDDLE_NativeId = "ADMOB_MIDDLE_NATIVE_ID";
|
||||
public const string KEY_Admob_FULL_NativeId = "Admob_FULL_NATIVE_ID";
|
||||
public const string KEY_Admob_RewardId = "Admob_RV_ID";
|
||||
public const string KEY_Admob_InterId = "Admob_IV_ID";
|
||||
public const string KEY_PRIVACY_URL = "tka_url_privacy";
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace WZ
|
||||
{
|
||||
|
@ -19,7 +20,10 @@ namespace WZ
|
|||
|
||||
public static class IvRulesConst
|
||||
{
|
||||
public static int CurrentOverLevel = 0; //每跳过几次触发
|
||||
public static long CurrentInterval = 0; //广告最小时间间隔
|
||||
//每跳过几次触发
|
||||
public static Dictionary<string, int> OverLevels = new Dictionary<string, int>();
|
||||
|
||||
//广告最小时间间隔
|
||||
public static Dictionary<string, long> Intervals = new Dictionary<string, long>();
|
||||
}
|
||||
}
|
|
@ -14,6 +14,9 @@ namespace WZ
|
|||
public static string AdmobSplashId = "";
|
||||
|
||||
public static string AdmobNativeId = "";
|
||||
public static string AdmobSmallNativeId = "";
|
||||
public static string AdmobMinddleNativeId = "";
|
||||
public static string AdmobFullNativeId = "";
|
||||
|
||||
public static string AdmobRewardId = "";
|
||||
|
||||
|
|
|
@ -49,7 +49,6 @@ namespace WZ
|
|||
LoggerUtils.Debug("[Admob] init success");
|
||||
});
|
||||
|
||||
_nativeAdUnits.Add("ca-app-pub-3940256099942544/2247696110");
|
||||
if (_nativeAdUnits.Count > 0)
|
||||
{
|
||||
LoadNative();
|
||||
|
|
|
@ -39,7 +39,7 @@ namespace WZ
|
|||
|
||||
NativeOverlayAd.Load(adUnitId, new AdRequest(), new NativeAdOptions(), (NativeOverlayAd ad, LoadAdError error) =>
|
||||
{
|
||||
LoggerUtils.Debug($"[Admob] Native Ad unit {adUnitId} loaded {ad} error {error}");
|
||||
LoggerUtils.Debug($"[Admob] Native Ad unit {adUnitId} load end. {ad} error {error}");
|
||||
if (error != null || ad == null)
|
||||
{
|
||||
if (!_retryCounters.TryAdd(adUnitId, 0))
|
||||
|
@ -55,9 +55,10 @@ namespace WZ
|
|||
|
||||
_retryCounters[adUnitId] = 0;
|
||||
|
||||
LoggerUtils.Debug("Admob Native ad loaded with response : " + ad.GetResponseInfo().ToString());
|
||||
var nativeEcpm = AdmobUtils.GetNativeEcpm(ad);
|
||||
_nativeAds[adUnitId] = ad;
|
||||
_adRevenueCache[adUnitId] = AdmobUtils.GetNativeEcpm(ad);
|
||||
_adRevenueCache[adUnitId] = nativeEcpm;
|
||||
LoggerUtils.Debug($"Admob Native ad loaded with nativeEcpm = {nativeEcpm} response : " + ad.GetResponseInfo().ToString());
|
||||
AdsKeyEvents.Instance.LogAdFPUEvents(AdsType.Native);
|
||||
|
||||
ad.OnAdPaid += (AdValue adValue) =>
|
||||
|
@ -187,9 +188,10 @@ namespace WZ
|
|||
{
|
||||
if (adUnitId == null || string.IsNullOrEmpty(adUnitId))
|
||||
{
|
||||
foreach (var ad in _nativeAds.Values)
|
||||
foreach (var nativeOverlayAd in _nativeAds)
|
||||
{
|
||||
ad.Hide();
|
||||
nativeOverlayAd.Value.Hide();
|
||||
LoadAd(nativeOverlayAd.Key);
|
||||
}
|
||||
|
||||
return;
|
||||
|
@ -198,6 +200,7 @@ namespace WZ
|
|||
if (_nativeAds.TryGetValue(adUnitId, out var tempAd))
|
||||
{
|
||||
tempAd.Hide();
|
||||
LoadAd(adUnitId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -54,7 +54,7 @@ namespace WZ
|
|||
|
||||
public static double GetNativeEcpm(NativeOverlayAd ad)
|
||||
{
|
||||
return 0.0;
|
||||
return GetEcpm(ad, "nativeOverlayAd", "nativeAd", NaStack);
|
||||
}
|
||||
|
||||
private static double GetEcpm(object o, string cShapeFieldName, string javaFieldName, string[] stack)
|
||||
|
@ -76,6 +76,7 @@ namespace WZ
|
|||
private static readonly string[] SpStack = { "zzb", "zzi", "zze", "zze", "zzae" };
|
||||
private static readonly string[] IvStack = { "zzc", "zzj", "zzf", "zzd", "zzae" };
|
||||
private static readonly string[] RvStack = { "zzb", "zzi", "zze", "zze", "zzae" };
|
||||
private static readonly string[] NaStack = { "zza", "zzb", "zzf", "zzD", "zzb", "zzae" };
|
||||
|
||||
|
||||
/// <summary>
|
||||
|
|
|
@ -245,6 +245,8 @@ namespace WZ
|
|||
}
|
||||
}
|
||||
|
||||
#region IvRules
|
||||
|
||||
public bool IvRulesShow(IvType ivadType)
|
||||
{
|
||||
//1.获取远程配置
|
||||
|
@ -274,36 +276,51 @@ namespace WZ
|
|||
}
|
||||
//4.判断skip(次安装跳过几次触发不展示广告)
|
||||
int skipLevel = ivRulesData.skipLevel;
|
||||
int currentSkipLevel = PlayerPrefsUtils.GetPlayerPrefsInt(IvRulesKey.KEY_SKIPLEVEL, 0);
|
||||
int currentSkipLevel = PlayerPrefsUtils.GetPlayerPrefsInt($"{IvRulesKey.KEY_SKIPLEVEL}_{ivadType.ToString()}", 0);
|
||||
if (currentSkipLevel < skipLevel)
|
||||
{
|
||||
LoggerUtils.Debug($"[SDK] skipLevel limit");
|
||||
PlayerPrefsUtils.SavePlayerPrefsInt(IvRulesKey.KEY_SKIPLEVEL, currentSkipLevel + 1);
|
||||
LoggerUtils.Debug($"[SDK] {ivadType} skipLevel limit");
|
||||
PlayerPrefsUtils.SavePlayerPrefsInt($"{IvRulesKey.KEY_SKIPLEVEL}_{ivadType.ToString()}", currentSkipLevel + 1);
|
||||
return false;
|
||||
}
|
||||
//5.判断overLevel(没跳过几次触发)
|
||||
//5.判断overLevel(每跳过几次触发)
|
||||
int overLevel = ivRulesData.overLevel;
|
||||
int currentOverLevel = IvRulesConst.CurrentOverLevel;
|
||||
int currentOverLevel = IvRulesConst.OverLevels.ContainsKey(ivadType.ToString()) ? IvRulesConst.OverLevels[ivadType.ToString()] : 0;
|
||||
if (currentOverLevel < overLevel)
|
||||
{
|
||||
LoggerUtils.Debug($"[SDK] overLevel limit");
|
||||
IvRulesConst.CurrentOverLevel++;
|
||||
LoggerUtils.Debug($"[SDK] {ivadType} overLevel limit");
|
||||
IvRulesConst.OverLevels[ivadType.ToString()] = currentOverLevel + 1;
|
||||
return false;
|
||||
}
|
||||
|
||||
//6.判断interval(广告时间间隔)
|
||||
int interval = ivRulesData.interval;
|
||||
long currentInterval = IvRulesConst.CurrentInterval;
|
||||
long currentInterval = IvRulesConst.Intervals.ContainsKey(ivadType.ToString()) ? IvRulesConst.Intervals[ivadType.ToString()] : 0;
|
||||
long localTimestamp = TimeUtils.GetLocalTimestamp();
|
||||
|
||||
if (localTimestamp < currentInterval + (interval * 1000L))
|
||||
{
|
||||
LoggerUtils.Debug($"[SDK] interval limit");
|
||||
LoggerUtils.Debug($"[SDK] {ivadType} interval limit");
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 看激励广告之后调用
|
||||
/// </summary>
|
||||
public void ClearIvRules()
|
||||
{
|
||||
var localTimestamp = TimeUtils.GetLocalTimestamp();
|
||||
foreach (var key in IvRulesConst.Intervals.Keys.ToList())
|
||||
{
|
||||
IvRulesConst.Intervals[key] = localTimestamp;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region 检查并刷新过期竞价
|
||||
private void CheckAndRefreshExpiredBids(AdsType _adsType)
|
||||
|
|
|
@ -50,7 +50,7 @@ namespace WZ
|
|||
{
|
||||
AdsType.Banner => new List<string> { StaticValue.AdmobNormalBannerId },
|
||||
AdsType.Rewarded => new List<string> { StaticValue.AdmobRewardId },
|
||||
AdsType.Native => new List<string> { StaticValue.AdmobNativeId },
|
||||
AdsType.Native => new List<string> { StaticValue.AdmobNativeId, StaticValue.AdmobMinddleNativeId, StaticValue.AdmobSmallNativeId, StaticValue.AdmobFullNativeId },
|
||||
AdsType.Splash => new List<string> { StaticValue.AdmobSplashId },
|
||||
AdsType.Interstitial => new List<string> { StaticValue.AdmobInterId },
|
||||
_ => new List<string>()
|
||||
|
|
|
@ -11,8 +11,9 @@ public class AppSDKManager : D_MonoSingleton<AppSDKManager>
|
|||
{
|
||||
//包名
|
||||
public const string PackageName = "com.rush.cash.earn.fast.real.money.game";
|
||||
public void Init(Action action)
|
||||
public void Init(Action action, bool showLog)
|
||||
{
|
||||
LoggerUtils.Enabled = showLog;
|
||||
FileParse.Parse();
|
||||
// AdConfigParser.Parse();
|
||||
FireBaseSDKManager.Instance.Init();
|
||||
|
@ -20,8 +21,10 @@ public class AppSDKManager : D_MonoSingleton<AppSDKManager>
|
|||
AdmobAdsManager.Instance.Initialize();
|
||||
AdjustManager.Instance.Init();
|
||||
ShuShuMangage.Instance.Init();
|
||||
AdsSDKManager.Instance.InitSDK(action);
|
||||
AdsSDKManager.Instance.InitSDK(null);
|
||||
EFSdkManager.Instance.Init();
|
||||
|
||||
action?.Invoke();
|
||||
}
|
||||
|
||||
|
||||
|
@ -36,17 +39,58 @@ public class AppSDKManager : D_MonoSingleton<AppSDKManager>
|
|||
|
||||
#region ad
|
||||
|
||||
/// <summary>
|
||||
/// 是否已缓存激励广告
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public bool IsRewardedAdReady()
|
||||
{
|
||||
return AdsSDKManager.Instance.IsRewardAdReady();;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 展示激励广告
|
||||
/// </summary>
|
||||
/// <param name="position"></param>
|
||||
/// <param name="callback"></param>
|
||||
public void ShowRewardAd(string position, Action<bool,double> callback = null)
|
||||
{
|
||||
AdsSDKManager.Instance.ShowRewardAd(position, (isReward, revenue) =>
|
||||
bool isRewardAdReady = AdsSDKManager.Instance.IsRewardAdReady();
|
||||
if (isRewardAdReady)
|
||||
{
|
||||
if (isReward)
|
||||
AdsSDKManager.Instance.ShowRewardAd(position, (isReward, revenue) =>
|
||||
{
|
||||
//callback?.Invoke();
|
||||
callback?.Invoke(true, revenue);
|
||||
}
|
||||
});
|
||||
if (isReward)
|
||||
{
|
||||
AdsSDKManager.Instance.ClearIvRules();
|
||||
callback?.Invoke(true, revenue);
|
||||
}
|
||||
else
|
||||
{
|
||||
callback?.Invoke(false, 0);
|
||||
}
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
callback?.Invoke(false, 0);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 是否已缓存插屏
|
||||
/// </summary>
|
||||
public bool IsInterstitialAdReady()
|
||||
{
|
||||
return AdsSDKManager.Instance.IsInterstitialReady();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 展示插屏广告
|
||||
/// </summary>
|
||||
/// <param name="position"></param>
|
||||
/// <param name="ivadType"></param>
|
||||
/// <param name="callback"></param>
|
||||
public void ShowInterstitial(string position, IvType ivadType = IvType.IV1, Action<double> callback = null)
|
||||
{
|
||||
//插屏展示逻辑
|
||||
|
@ -60,25 +104,51 @@ public class AppSDKManager : D_MonoSingleton<AppSDKManager>
|
|||
AdsSDKManager.Instance.ShowInterstitialAd(position, ivadType, (revenue) =>
|
||||
{
|
||||
//展示完一个插屏之后调用
|
||||
IvRulesConst.CurrentOverLevel = 0;
|
||||
IvRulesConst.CurrentInterval = TimeUtils.GetLocalTimestamp();
|
||||
IvRulesConst.OverLevels[ivadType.ToString()] = 0;
|
||||
IvRulesConst.Intervals[ivadType.ToString()] = TimeUtils.GetLocalTimestamp();
|
||||
callback?.Invoke(revenue);
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
callback?.Invoke(0);
|
||||
callback?.Invoke(-1);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
callback?.Invoke(0);
|
||||
callback?.Invoke(-1);
|
||||
}
|
||||
}
|
||||
|
||||
public bool IsRewardAdReady()
|
||||
public void ShowBanner()
|
||||
{
|
||||
return AdsSDKManager.Instance.IsRewardAdReady();;
|
||||
}
|
||||
AdsSDKManager.Instance.ShowBanner();
|
||||
}
|
||||
|
||||
public void HideBanner()
|
||||
{
|
||||
AdsSDKManager.Instance.HideBanner();
|
||||
}
|
||||
|
||||
public bool IsNativeFullReady()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public void ShowFullNative(string position, Action<bool, double> callback = null)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void ShowNative(RectTransform rectTransform, Camera camera = null, string position = "")
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void HideNative()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
@ -211,6 +281,11 @@ public class AppSDKManager : D_MonoSingleton<AppSDKManager>
|
|||
EFSdk.get().Refresh();
|
||||
}
|
||||
|
||||
public void CanGoback(Action<bool> canGobackAction)
|
||||
{
|
||||
EFSdk.get().CanGoback(canGobackAction);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 回上一页
|
||||
/// </summary>
|
||||
|
@ -229,91 +304,8 @@ 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>
|
||||
/// 设置推送开关, SDK默认关闭通知
|
||||
/// </summary>
|
||||
|
@ -384,13 +376,12 @@ public class AppSDKManager : D_MonoSingleton<AppSDKManager>
|
|||
/// 消息类通知弹出间隔,SDK默认设置为60秒(在线参数控制)-Key: messagenotif Value:60
|
||||
/// </summary>
|
||||
/// <param name="timeSeconds"></param>
|
||||
public void SetPushMessagenotif()
|
||||
public void SetPushMessagenotif(int timeSeconds)
|
||||
{
|
||||
if (Application.isEditor)
|
||||
{
|
||||
return;
|
||||
}
|
||||
int timeSeconds = FireBaseRemoteConfigManager.Instance.GetRemoteConfigInt("messagenotif", 60);
|
||||
EFSdk.get().SetPushMessagenotif(timeSeconds);
|
||||
}
|
||||
|
||||
|
@ -398,13 +389,12 @@ public class AppSDKManager : D_MonoSingleton<AppSDKManager>
|
|||
/// 持续性通知在进入游戏时弹出的时间间隔,SDK默认设置为300秒(在线参数控制 )-Key:persistentnotif Value:300
|
||||
/// </summary>
|
||||
/// <param name="timeSeconds"></param>
|
||||
public void SetPushPersistentnotif()
|
||||
public void SetPushPersistentnotif(int timeSeconds)
|
||||
{
|
||||
if (Application.isEditor)
|
||||
{
|
||||
return;
|
||||
}
|
||||
int timeSeconds = FireBaseRemoteConfigManager.Instance.GetRemoteConfigInt("persistentnotif", 300);
|
||||
EFSdk.get().SetPushPersistentnotif(timeSeconds);
|
||||
}
|
||||
|
||||
|
@ -418,31 +408,15 @@ public class AppSDKManager : D_MonoSingleton<AppSDKManager>
|
|||
/// 3 进入对应小游戏1界面
|
||||
/// 4 进入对应小游戏2界面
|
||||
/// </returns>
|
||||
public void GetJumpPage()
|
||||
public int GetJumpPage()
|
||||
{
|
||||
if (Application.isEditor)
|
||||
{
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
int pageId = EFSdk.get().GetJumpPage();
|
||||
switch (pageId)
|
||||
{
|
||||
case 0:
|
||||
// Nothing to do
|
||||
break;
|
||||
case 1:
|
||||
// 回到游戏主页
|
||||
break;
|
||||
case 2:
|
||||
// 进入游戏的金币提现界面
|
||||
break;
|
||||
case 3:
|
||||
// 进入对应小游戏1界面
|
||||
break;
|
||||
case 4:
|
||||
// 进入对应小游戏2界面
|
||||
break;
|
||||
}
|
||||
return pageId;
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -570,6 +544,14 @@ public class AppSDKManager : D_MonoSingleton<AppSDKManager>
|
|||
}
|
||||
EFSdk.get().ShowToast(message);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 定时远程推送
|
||||
/// </summary>
|
||||
public void AutoLocalPush(bool isOpen)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
@ -581,4 +563,39 @@ public class AppSDKManager : D_MonoSingleton<AppSDKManager>
|
|||
{
|
||||
return AdjustNetwork.Instance.InOrganic();
|
||||
}
|
||||
|
||||
public string GetGaid()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public string GetAndroidId()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public string GetAdid()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public string GetUserAgent()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public string GetSSAccountId()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public string GetSSDistinctId()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public string GetSSSuperProperties()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,30 +13,11 @@ namespace WZ
|
|||
|
||||
public void Init()
|
||||
{
|
||||
EFSdk.get().Init((actionType, str) =>
|
||||
if (Application.isEditor)
|
||||
{
|
||||
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);
|
||||
}
|
||||
});
|
||||
return;
|
||||
}
|
||||
EFSdk.get().Init((actionType, str) => { });
|
||||
|
||||
SetSDKEventCallback();
|
||||
SetHdH5ImpressionCallback();
|
||||
|
@ -77,9 +58,7 @@ namespace WZ
|
|||
PlayerPrefsUtils.SavePlayerPrefsInt(KEY_OKSPIN_SHOW_COUNT, count);
|
||||
|
||||
//互动广告只有okSpin
|
||||
string h5ad_okspinrev = FireBaseRemoteConfigManager.Instance.GetRemoteConfigString("H5ad_okspinrev", "0");
|
||||
double revenue = double.Parse(h5ad_okspinrev, System.Globalization.CultureInfo.InvariantCulture);
|
||||
|
||||
float revenue = FireBaseRemoteConfigManager.Instance.GetRemoteConfigFloat("rev_okspin", 0);
|
||||
|
||||
//adjust
|
||||
AdjustTrackEvent.Instance.TrackAdEvent(revenue, "H5ad_game", url, url);
|
||||
|
|
|
@ -10,10 +10,10 @@ namespace WZ
|
|||
{
|
||||
public void FetchRemoteConfig()
|
||||
{
|
||||
// Firebase.FirebaseApp.CheckAndFixDependenciesAsync().ContinueWith(task =>
|
||||
// {
|
||||
// if (task.Result == Firebase.DependencyStatus.Available)
|
||||
// {
|
||||
Firebase.FirebaseApp.CheckAndFixDependenciesAsync().ContinueWith(task =>
|
||||
{
|
||||
if (task.Result == Firebase.DependencyStatus.Available)
|
||||
{
|
||||
Firebase.RemoteConfig.FirebaseRemoteConfig.DefaultInstance.FetchAsync(TimeSpan.Zero).ContinueWithOnMainThread(task =>
|
||||
{
|
||||
FirebaseRemoteConfig.DefaultInstance.ActivateAsync().ContinueWithOnMainThread(task =>
|
||||
|
@ -36,8 +36,8 @@ namespace WZ
|
|||
// 检查Adjust归因
|
||||
});
|
||||
});
|
||||
// }
|
||||
// });
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void GroupSet()
|
||||
|
|
|
@ -11,6 +11,10 @@ namespace WZ
|
|||
{
|
||||
public void Init()
|
||||
{
|
||||
if (Application.isEditor)
|
||||
{
|
||||
return;
|
||||
}
|
||||
InitSDK();
|
||||
}
|
||||
|
||||
|
|
|
@ -9,22 +9,31 @@ public class Test : MonoBehaviour
|
|||
{
|
||||
private List<string> _rewardedAdUnits = new List<string>();
|
||||
|
||||
RectTransform small;
|
||||
RectTransform medium;
|
||||
|
||||
private void Start()
|
||||
{
|
||||
small = gameObject.transform.Find("NativeAd-small").GetComponent<RectTransform>();
|
||||
medium = gameObject.transform.Find("NativeAd-medium").GetComponent<RectTransform>();
|
||||
}
|
||||
|
||||
public void OnShowAd()
|
||||
{
|
||||
AppSDKManager.Instance.Init(null);
|
||||
AppSDKManager.Instance.Init(null, true);
|
||||
// KwaiAdsManager.Instance.ShowRewardAd();
|
||||
}
|
||||
|
||||
public void OnShowInterstitial()
|
||||
{
|
||||
// KwaiAdsManager.Instance.OnInterstitialCallback();
|
||||
var small = gameObject.transform.Find("NativeAd-small").GetComponent<RectTransform>();
|
||||
var medium = gameObject.transform.Find("NativeAd-medium").GetComponent<RectTransform>();
|
||||
// var small = gameObject.transform.Find("NativeAd-small").GetComponent<RectTransform>();
|
||||
// var medium = gameObject.transform.Find("NativeAd-medium").GetComponent<RectTransform>();
|
||||
// var nativeAdPosition = NativeAdPosition.Create(new NativeTemplateStyle
|
||||
// {
|
||||
// TemplateId = NativeTemplateId.Medium
|
||||
// }, medium);
|
||||
|
||||
|
||||
var nativeAdPosition = NativeAdPosition.Create(new NativeTemplateStyle
|
||||
{
|
||||
TemplateId = NativeTemplateId.Small
|
||||
|
@ -43,4 +52,105 @@ public class Test : MonoBehaviour
|
|||
Debug.LogWarning("luojian admob native ad start show fail,not ready.");
|
||||
}
|
||||
}
|
||||
|
||||
public void Native1Show()
|
||||
{
|
||||
var adUnitId = StaticValue.AdmobSmallNativeId;
|
||||
var nativeAdPosition = NativeAdPosition.Create(new NativeTemplateStyle
|
||||
{
|
||||
TemplateId = NativeTemplateId.Small
|
||||
}, small);
|
||||
Debug.Log($"luojian admob native ad ({adUnitId}) start show {small} medium {medium} X:{nativeAdPosition.X} Y:{nativeAdPosition.Y} Height :{nativeAdPosition.Height} Width:{nativeAdPosition.Width} Screen.dpi = {3.5}");
|
||||
if (AdsSDKManager.Instance.IsNativeAdReady(adUnitId))
|
||||
{
|
||||
AdsSDKManager.Instance.ShowNativeAd("test", adUnitId, nativeAdPosition);
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.LogWarning($"luojian admob native ad ({adUnitId}) start show fail,not ready.");
|
||||
}
|
||||
}
|
||||
|
||||
public void Native1Hide()
|
||||
{
|
||||
var adUnitId = StaticValue.AdmobSmallNativeId;
|
||||
AdsSDKManager.Instance.RemoveNativeAd(adUnitId);
|
||||
}
|
||||
|
||||
public void Native2Show()
|
||||
{
|
||||
var adUnitId = StaticValue.AdmobNativeId;
|
||||
var nativeAdPosition = NativeAdPosition.Create(new NativeTemplateStyle
|
||||
{
|
||||
TemplateId = NativeTemplateId.Small,
|
||||
MainBackgroundColor = Color.green
|
||||
}, small);
|
||||
Debug.Log($"luojian admob native ad ({adUnitId}) start show {small} medium {medium} X:{nativeAdPosition.X} Y:{nativeAdPosition.Y} Height :{nativeAdPosition.Height} Width:{nativeAdPosition.Width} Screen.dpi = {3.5}");
|
||||
if (AdsSDKManager.Instance.IsNativeAdReady(adUnitId))
|
||||
{
|
||||
AdsSDKManager.Instance.ShowNativeAd("test", adUnitId, nativeAdPosition);
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.LogWarning($"luojian admob native ad ({adUnitId}) start show fail,not ready.");
|
||||
}
|
||||
}
|
||||
|
||||
public void Native2Hide()
|
||||
{
|
||||
var adUnitId = StaticValue.AdmobNativeId;
|
||||
AdsSDKManager.Instance.RemoveNativeAd(adUnitId);
|
||||
}
|
||||
|
||||
|
||||
public void Native3Show()
|
||||
{
|
||||
var adUnitId = StaticValue.AdmobFullNativeId;
|
||||
var nativeAdPosition = NativeAdPosition.Create(new NativeTemplateStyle
|
||||
{
|
||||
TemplateId = NativeTemplateId.Medium,
|
||||
MainBackgroundColor = Color.yellow
|
||||
}, medium);
|
||||
Debug.Log($"luojian admob native ad ({adUnitId}) start show {small} medium {medium} X:{nativeAdPosition.X} Y:{nativeAdPosition.Y} Height :{nativeAdPosition.Height} Width:{nativeAdPosition.Width} Screen.dpi = {3.5}");
|
||||
if (AdsSDKManager.Instance.IsNativeAdReady(adUnitId))
|
||||
{
|
||||
AdsSDKManager.Instance.ShowNativeAd("test", adUnitId, nativeAdPosition);
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.LogWarning($"luojian admob native ad ({adUnitId}) start show fail,not ready.");
|
||||
}
|
||||
}
|
||||
|
||||
public void Native3Hide()
|
||||
{
|
||||
var adUnitId = StaticValue.AdmobFullNativeId;
|
||||
AdsSDKManager.Instance.RemoveNativeAd(adUnitId);
|
||||
}
|
||||
|
||||
|
||||
public void Native4Show()
|
||||
{
|
||||
var adUnitId = StaticValue.AdmobMinddleNativeId;
|
||||
var nativeAdPosition = NativeAdPosition.Create(new NativeTemplateStyle
|
||||
{
|
||||
TemplateId = NativeTemplateId.Medium,
|
||||
MainBackgroundColor = Color.yellow
|
||||
}, medium);
|
||||
Debug.Log($"luojian admob native ad ({adUnitId}) start show {small} medium {medium} X:{nativeAdPosition.X} Y:{nativeAdPosition.Y} Height :{nativeAdPosition.Height} Width:{nativeAdPosition.Width} Screen.dpi = {3.5}");
|
||||
if (AdsSDKManager.Instance.IsNativeAdReady(adUnitId))
|
||||
{
|
||||
AdsSDKManager.Instance.ShowNativeAd("test", adUnitId, nativeAdPosition);
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.LogWarning($"luojian admob native ad ({adUnitId}) start show fail,not ready.");
|
||||
}
|
||||
}
|
||||
|
||||
public void Native4Hide()
|
||||
{
|
||||
var adUnitId = StaticValue.AdmobMinddleNativeId;
|
||||
AdsSDKManager.Instance.RemoveNativeAd(adUnitId);
|
||||
}
|
||||
}
|