Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Sign in / Register
Toggle navigation
Z
ZxAd_Unity
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
王雪伟
ZxAd_Unity
Commits
3df60f0d
Commit
3df60f0d
authored
Apr 30, 2021
by
王雪伟
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
解决平台切换报错
parent
71924495
Show whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
255 additions
and
78 deletions
+255
-78
AdManager.cs
Assets/AdSDK/AD/AD_Manager/AdManager.cs
+12
-2
CSJRewardUtil.cs
Assets/AdSDK/AD/CSJ/CSJRewardUtil.cs
+1
-1
FSRewardUtils.cs
Assets/AdSDK/AD/Funshion/FSRewardUtils.cs
+8
-7
YLBRewardAdUtil.cs
Assets/AdSDK/AD/YLB/YlbDemo/YLBRewardAdUtil.cs
+1
-1
Example.cs
Assets/AdSDK/AD/ZXHC/ZXHCDemo/Example.cs
+3
-1
ZXHCSplashUtil.cs
Assets/AdSDK/AD/ZXHC/ZXHCDemo/ZXHCSplashUtil.cs
+2
-15
InitProject.cs
Assets/AdSDK/InitProject/Scripts/InitProject.cs
+2
-1
EncryptHelper.cs
Assets/AdSDK/NetWork/HTTP/EncryptHelper.cs
+27
-0
HttpTool.cs
Assets/AdSDK/NetWork/HTTP/HttpTool.cs
+38
-50
IOS.meta
Assets/AdSDK/NetWork/IOS.meta
+8
-0
UserInfoManager.cs
Assets/AdSDK/NetWork/IOS/UserInfoManager.cs
+142
-0
UserInfoManager.cs.meta
Assets/AdSDK/NetWork/IOS/UserInfoManager.cs.meta
+11
-0
No files found.
Assets/AdSDK/AD/AD_Manager/AdManager.cs
View file @
3df60f0d
...
...
@@ -103,10 +103,11 @@ public class AdManager
#endif
break
;
case
ZXADConfig
.
PLANTFORM_AD_FS
:
#if UNITY_ANDROID
AndroidJavaClass
jc3
=
new
AndroidJavaClass
(
"com.ym.admodule.fs.FunShionManager"
);
jc3
.
CallStatic
(
"init"
);
#endif
break
;
default
:
Debug
.
unityLogger
.
Log
(
ZXADConfig
.
ADManagerTAG
,
"不支持初始化"
+
id
.
adPlatform
+
"的广告"
);
break
;
...
...
@@ -131,6 +132,7 @@ public class AdManager
if
(!
IsInitAd
)
{
listener
.
onError
(
"没有初始化"
);
listener
.
onLastError
();
return
;
}
Dictionary
<
string
,
object
>
paras
=
new
Dictionary
<
string
,
object
>();
...
...
@@ -235,14 +237,18 @@ public class AdManager
//广点通开屏广告
GDTSplshAdUtils
.
Instance
.
LoadSplshAd
(
entity
,
listener
,
callback
);
break
;
#if UNITY_ANDROID
case
ZXADConfig
.
PLANTFORM_AD_ZXHC
:
//掌心汇川开屏广告
ZXHCSplashUtil
.
Instance
.
LoadSplshAd
(
entity
,
listener
,
callback
);
break
;
#endif
#if UNITY_ANDROID
//风行开屏广告
case
ZXADConfig
.
PLANTFORM_AD_FS
:
FSSplashUtil
.
Instance
.
loadSplashAd
(
entity
,
listener
,
callback
);
break
;
#endif
default
:
Debug
.
unityLogger
.
Log
(
ZXADConfig
.
ADManagerTAG
,
"不支持加载"
+
entity
.
adPlatform
+
"的Splash广告"
);
callback
(
false
);
...
...
@@ -1126,10 +1132,12 @@ public class AdManager
//优良宝激励视频广告加载
YLBRewardAdUtil
.
Instance
.
LoadCacheRewardAd
(
entity
,
callback
);
break
;
#if UNITY_ANDROID
//风行激励视频广告
case
ZXADConfig
.
PLANTFORM_AD_FS
:
FSRewardUtils
.
Instance
.
LoadCacheRewardAd
(
entity
,
callback
);
break
;
#endif
default
:
Debug
.
unityLogger
.
Log
(
ZXADConfig
.
ADManagerTAG
,
"不支持加载"
+
entity
.
adPlatform
+
"的激励视频广告"
);
callback
(
null
);
...
...
@@ -1236,10 +1244,12 @@ public class AdManager
//优良宝激励视频广告播放
YLBRewardAdUtil
.
Instance
.
playCacheRewardAd
(
entity
,
listener
,
callback
);
break
;
#if UNITY_ANDROID
//风行激励视频广告
case
ZXADConfig
.
PLANTFORM_AD_FS
:
FSRewardUtils
.
Instance
.
playCacheRewardAd
(
entity
,
listener
,
callback
);
break
;
#endif
default
:
Debug
.
unityLogger
.
Log
(
ZXADConfig
.
ADManagerTAG
,
"不支持Show"
+
entity
.
adPlatform
+
"的激励视频广告"
);
callback
(
false
);
...
...
Assets/AdSDK/AD/CSJ/CSJRewardUtil.cs
View file @
3df60f0d
...
...
@@ -145,7 +145,7 @@ public class CSJRewardUtil
#if UNITY_IOS
EventUtils
.
onEventPullSuccess
(
entity
);
this
.
csjAD
.
SetRewardVideoAdForIOS
(
entity
.
codeGroup
+
entity
.
slotName
,
ad
);
callback
(
true
);
callback
(
entity
);
#endif
}
...
...
Assets/AdSDK/AD/Funshion/FSRewardUtils.cs
View file @
3df60f0d
...
...
@@ -2,7 +2,7 @@
using
System.Collections
;
using
System.Collections.Generic
;
using
UnityEngine
;
#if UNITY_ANDROID
public
class
FSRewardUtils
{
private
FSRewardUtils
()
{
}
...
...
@@ -27,7 +27,7 @@ public class FSRewardUtils
rewardVideoAd
.
SetLoadListener
(
new
RewardVideoAdLoadListener
(
this
,
entity
,
rewardVideoAd
,
callback
));
rewardVideoAd
.
LoadAd
(
entity
.
codeId
,
entity
.
codeGroup
);
#elif UNITY_IOS
callback
(
false
);
callback
(
null
);
#endif
}
...
...
@@ -39,23 +39,23 @@ public class FSRewardUtils
/// <param name="callback"></param>
public
void
playCacheRewardAd
(
AdEntity
entity
,
ZXADRewardVideoListener
listener
,
Action
<
bool
>
callback
)
{
#if UNITY_ANDROID
FSManager
rewardVideoAd
=
GetRewardVideoAd
(
entity
.
codeGroup
+
entity
.
slotName
);
if
(
rewardVideoAd
!=
null
)
{
Debug
.
unityLogger
.
Log
(
ZXADConfig
.
ADManagerTAG
,
entity
.
codeGroup
+
"YLB Not NUll"
);
#if UNITY_ANDROID
rewardVideoAd
.
SetPlayListener
(
new
RewardVideoAdListener
(
entity
,
callback
,
listener
));
rewardVideoAd
.
ShowAD
(
entity
.
codeId
,
entity
.
codeGroup
);
#elif UNITY_IOS
callback
(
false
);
#endif
}
else
{
Debug
.
unityLogger
.
Log
(
ZXADConfig
.
ADManagerTAG
,
entity
.
codeGroup
+
"YLB NUll"
);
callback
(
false
);
}
#elif UNITY_IOS
callback
(
false
);
#endif
}
private
sealed
class
RewardVideoAdLoadListener
:
IFSRewardVideoAdLoadListener
...
...
@@ -198,3 +198,4 @@ public class FSRewardUtils
}
}
#
endif
\ No newline at end of file
Assets/AdSDK/AD/YLB/YlbDemo/YLBRewardAdUtil.cs
View file @
3df60f0d
...
...
@@ -35,7 +35,7 @@ public class YLBRewardAdUtil
rewardVideoAd
.
SetLoadListener
(
new
RewardVideoAdLoadListener
(
this
,
entity
,
rewardVideoAd
,
callback
));
rewardVideoAd
.
LoadAd
(
entity
.
codeId
,
entity
.
codeGroup
);
#elif UNITY_IOS
callback
(
false
);
callback
(
null
);
#endif
}
...
...
Assets/AdSDK/AD/ZXHC/ZXHCDemo/Example.cs
View file @
3df60f0d
...
...
@@ -21,11 +21,13 @@ namespace ZXHC
public
void
OnClickSplash
()
{
#if UNITY_ANDROID
AdEntity
entity
=
new
AdEntity
();
entity
.
codeId
=
"1100028"
;
ZXHCSplashUtil
.
Instance
.
LoadSplshAd
(
entity
,
new
SplshAdListener
(),
new
Action
<
bool
>((
cb
)
=>
{
Debug
.
unityLogger
.
Log
(
"开屏jiazai"
+
cb
);
}));
#endif
}
public
void
OnClickFeed
()
...
...
Assets/AdSDK/AD/ZXHC/ZXHCDemo/ZXHCSplashUtil.cs
View file @
3df60f0d
...
...
@@ -3,6 +3,7 @@ using System.Collections;
using
System.Collections.Generic
;
using
UnityEngine
;
using
ZXHC
;
#if UNITY_ANDROID
public
class
ZXHCSplashUtil
{
private
ZXHCSplashUtil
()
{
}
...
...
@@ -17,16 +18,7 @@ public class ZXHCSplashUtil
private
ZXHCSplashAd
hcSplshad
;
#if UNITY_ANDROID
private
static
AndroidJavaObject
container
;
#elif UNITY_IOS
#endif
#if UNITY_IOS
#endif
/// <summary>
/// ZXHC 开屏广告
/// </summary>
...
...
@@ -76,13 +68,9 @@ public class ZXHCSplashUtil
{
callback
(
true
);
//EventUtils.onEventPullSuccess(entity);
#if UNITY_ANDROID
// Android 要求开屏 container 必须是 c# 的 AndroidJavaObject 类型,必须是 Java(Android)上的 ViewGroup 类型
container
=
ZXHCUtils
.
NewAdContainer
();
ZXHCUtils
.
ShowView
(
container
,
false
);
#elif UNITY_IOS
#endif
this
.
hcAdUtils
.
hcSplshad
.
Show
(
container
);
}
...
...
@@ -99,6 +87,5 @@ public class ZXHCSplashUtil
callback
(
false
);
}
}
}
#
endif
\ No newline at end of file
Assets/AdSDK/InitProject/Scripts/InitProject.cs
View file @
3df60f0d
...
...
@@ -75,7 +75,8 @@ public class InitProject : MonoBehaviour
SceneManager
.
LoadSceneAsync
(
1
);
}));
#else
callback
(
"不支持"
);
//加载游戏场景
SceneManager
.
LoadSceneAsync
(
1
);
#endif
}
...
...
Assets/AdSDK/NetWork/HTTP/EncryptHelper.cs
View file @
3df60f0d
...
...
@@ -245,6 +245,8 @@ namespace EncryptHelper
return
Encoding
.
UTF8
.
GetString
(
original
);
}
public
static
string
ADCSD
(
string
v
,
string
v2
)
{
string
value
;
...
...
@@ -445,6 +447,31 @@ namespace EncryptHelper
return
temp
;
}
/// <summary>
/// MD5加密
/// </summary>
/// <param name="value">需要加密字符串</param>
/// <returns>返回32位大写字符</returns>
public
static
string
MD5Encrypt
(
string
value
)
{
//将输入字符串转换成字节数组 ANSI代码页编码
var
buffer
=
Encoding
.
Default
.
GetBytes
(
value
);
//接着,创建Md5对象进行散列计算
var
data
=
MD5
.
Create
().
ComputeHash
(
buffer
);
//创建一个新的Stringbuilder收集字节
var
sb
=
new
StringBuilder
();
//遍历每个字节的散列数据
foreach
(
var
t
in
data
)
{
//转换大写十六进制字符串
// X2 大写
// x2 小写
sb
.
Append
(
t
.
ToString
(
"x2"
));
}
//返回十六进制字符串
return
sb
.
ToString
();
}
}
...
...
Assets/AdSDK/NetWork/HTTP/HttpTool.cs
View file @
3df60f0d
...
...
@@ -310,53 +310,43 @@ public class HttpTool : MonoBehaviour
#if UNITY_IOS
//paragrams.Add("pkg", "com.ym.animalspa");
//paragrams.Add("appLs", appLs);
//paragrams.Add("ts", UserInfoManager.getInstance().GetTimeStamp());
//paragrams.Add("platform", "ios");
//paragrams.Add("source", "AppStore");
//paragrams.Add("module", "behavior");
//paragrams.Add("ua", "Safari");
//paragrams.Add("ntt", "4G");
////paragrams.Add("device", "d0ff4c9b53d1688fc81ce8d730b2989a");
//if (UserInfoManager.getInstance().udid.Length > 0)
//{
// paragrams.Add("device", UserInfoManager.getInstance().udid);
//}
//if (UserInfoManager.getInstance().build.Length > 0)
//{
// paragrams.Add("vc", UserInfoManager.getInstance().build);
//}
//if (UserInfoManager.getInstance().version.Length > 0)
//{
// paragrams.Add("vn", UserInfoManager.getInstance().version);
//}
//if (UserInfoManager.getInstance().idfa.Length > 0)
//{
// paragrams.Add("idfa", UserInfoManager.getInstance().idfa);
//}
//if (UserInfoManager.getInstance().token.Length > 0)
//{
// paragrams.Add("token", UserInfoManager.getInstance().token);
//}
//if (UserInfoManager.getInstance().uid > 0)
//{
// paragrams.Add("uid", UserInfoManager.getInstance().uid + "");
//}
//if (IS_TGYZ)
//{
// paragrams["zygt"] = "hzwz";
// paragrams["tgtk"] = "1";
//}
//string signString = signParamsWithDict(paragrams);
//paragrams.Add("sign", signString);
paragrams
[
"pkg"
]
=
Application
.
identifier
;
paragrams
[
"appLs"
]
=
appLs
;
paragrams
[
"ts"
]
=
UserInfoManager
.
Instance
().
GetTimeStamp
();
paragrams
[
"platform"
]
=
"ios"
;
paragrams
[
"source"
]
=
"AppStore"
;
paragrams
[
"module"
]
=
"behavior"
;
paragrams
[
"ntt"
]
=
"4G"
;
if
(
UserInfoManager
.
Instance
().
udid
.
Length
>
0
)
{
paragrams
[
"device"
]
=
UserInfoManager
.
Instance
().
udid
;
}
if
(
UserInfoManager
.
Instance
().
build
.
Length
>
0
)
{
paragrams
[
"vc"
]
=
UserInfoManager
.
Instance
().
build
;
}
if
(
UserInfoManager
.
Instance
().
version
.
Length
>
0
)
{
paragrams
[
"vn"
]
=
UserInfoManager
.
Instance
().
version
;
}
if
(
UserInfoManager
.
Instance
().
idfa
.
Length
>
0
)
{
paragrams
[
"idfa"
]
=
UserInfoManager
.
Instance
().
idfa
;
}
if
(
PrefenceUtils
.
GetInstance
().
getToken
().
Length
>
0
)
{
paragrams
[
"token"
]
=
PrefenceUtils
.
GetInstance
().
getToken
();
}
if
(
IS_TGYZ
)
{
paragrams
[
"zygt"
]
=
"hzwz"
;
paragrams
[
"tgtk"
]
=
"1"
;
paragrams
[
"uid"
]
=
"1"
;
}
else
{
paragrams
[
"uid"
]
=
PrefenceUtils
.
GetInstance
().
getUid
();
}
#elif UNITY_ANDROID
if
(
IS_TGYZ
)
...
...
@@ -404,12 +394,10 @@ public class HttpTool : MonoBehaviour
paragrams
[
"platform"
]
=
"android"
;
paragrams
[
"source"
]
=
PrefenceUtils
.
GetInstance
().
getSource
();
paragrams
[
"ua"
]
=
PrefenceUtils
.
GetInstance
().
getUA
();
#endif
string
signString
=
signParamsWithDict
(
paragrams
);
paragrams
[
"sign"
]
=
signString
;
#endif
foreach
(
KeyValuePair
<
string
,
object
>
item
in
paragrams
)
{
...
...
Assets/AdSDK/NetWork/IOS.meta
0 → 100644
View file @
3df60f0d
fileFormatVersion: 2
guid: cf594f8632f819c40a71457766b36898
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
Assets/AdSDK/NetWork/IOS/UserInfoManager.cs
0 → 100644
View file @
3df60f0d
using
LitJson
;
using
System.Collections
;
using
System.Collections.Generic
;
using
UnityEngine
;
using
System
;
using
System.Text
;
using
System.IO
;
// 用户单例
public
class
UserInfoManager
:
MonoBehaviour
{
private
static
UserInfoManager
instance
;
public
static
UserInfoManager
Instance
()
{
if
(
instance
==
null
)
{
GameObject
obj
=
new
GameObject
();
// 设置对象名字为脚本名
obj
.
name
=
typeof
(
UserInfoManager
).
ToString
();
// 让这个单例模式对象 切换场景不移除
DontDestroyOnLoad
(
obj
);
instance
=
obj
.
AddComponent
<
UserInfoManager
>();
}
return
instance
;
}
// 钻石
public
int
avaDiamond
=
0
;
// 金币
public
int
avaCoin
=
0
;
// UDID
public
string
udid
=
"udid"
;
// IDFA
public
string
idfa
=
""
;
public
string
token
=
""
;
public
string
uid
=
""
;
public
string
build
=
"1"
;
public
string
version
=
"1.0.0"
;
public
int
shubiao
;
// 0 shen 1 tou
public
bool
isBind
=
false
;
// 是否绑定wx
// public void touristLogin(Action<string> success, Action<string> fail)
// {
// NetworkTool.Instance().Post(HttpManager.URL_TOURIST_LOGIN, null, new Action<string, LoginResult>((res, model) => {
// this.token = model.token;
// this.uid = model.uid + "";
// success(res);
// AppInfo();
// }), new Action<string>((error) => {
// fail(error);
// AppInfo();
// }));
// }
// public void AppInfo()
// {
// NetworkTool.Instance().GET(HttpManager.URL_INFO, null, new Action<string, AppInfoResult>((res, model) => {
// shubiao = model.sdgowi["shubiao"];
//#if UNITY_ANDROID
// shubiao = 1;
//#endif
// IsBindWx();
// }), new Action<string>((error) => {
// IsBindWx();
// }));
// }
// public void IsBindWx()
// {
// NetworkTool.Instance().GET(HttpManager.URL_IS_BIND_WX, null, new Action<string, AppInfoBind>((res, model) => {
// isBind = model.isBind;
// Messenger.Broadcast("RefreshWXBind");
// }), new Action<string>((error) => {
// Messenger.Broadcast("RefreshWXBind");
// }));
// }
// 随机code
public
string
CreateRandomCode
()
{
string
str
=
"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"
;
char
[]
chars
=
str
.
ToCharArray
();
StringBuilder
strRan
=
new
StringBuilder
();
System
.
Random
ran
=
new
System
.
Random
();
for
(
int
i
=
0
;
i
<
16
;
i
++)
{
strRan
.
Append
(
chars
[
ran
.
Next
(
0
,
62
)]);
}
return
strRan
.
ToString
();
}
// 时间戳毫秒
public
string
GetTimeStamp
()
{
TimeSpan
ts
=
DateTime
.
Now
-
new
DateTime
(
1970
,
1
,
1
,
0
,
0
,
0
,
0
);
string
time
=
Convert
.
ToInt64
(
ts
.
TotalSeconds
-
8
*
3600
).
ToString
()
+
"000"
;
return
time
;
}
// 时间戳秒
public
string
TimeSecond
()
{
TimeSpan
ts
=
DateTime
.
Now
-
new
DateTime
(
1970
,
1
,
1
,
0
,
0
,
0
,
0
);
string
time
=
Convert
.
ToInt64
(
ts
.
TotalSeconds
-
8
*
3600
).
ToString
();
return
time
;
}
}
Assets/AdSDK/NetWork/IOS/UserInfoManager.cs.meta
0 → 100644
View file @
3df60f0d
fileFormatVersion: 2
guid: 6194b988913647a4ea9eae145329158c
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment