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
a4f3577a
Commit
a4f3577a
authored
May 26, 2021
by
王雪伟
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改
parent
c1818644
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
52 additions
and
16 deletions
+52
-16
AdHttpUtil.cs
Assets/AdSDK/AD/ADNet/AdHttpUtil.cs
+0
-9
AdDemo.unity
Assets/AdSDK/AD/Demo/AdDemo.unity
+1
-1
AppConfig.cs
Assets/UnityTool/AppConfig.cs
+2
-0
UnityPhoneUtils.cs
Assets/UnityTool/UnityPhoneUtils.cs
+49
-6
No files found.
Assets/AdSDK/AD/ADNet/AdHttpUtil.cs
View file @
a4f3577a
...
...
@@ -12,13 +12,10 @@ public class AdHttpUtil : MonoBehaviour
private
static
AdHttpUtil
_instacne
=
null
;
private
string
TEST_BASE_GAEM_URL
=
"http://feedapitest.zhangxinhulian.com/"
;
//测试游戏域名
private
string
TEST_BASE_AD_URL
=
"https://bstest.zhangxinhulian.com/"
;
//测试广告域名
private
string
PRODUCT_BASE_GAEM_URL
=
"https://feedapi.zhangxinhulian.com/"
;
//正式游戏域名
private
string
PRODUCT_BASE_AD_URL
=
"https://bs.zhangxinhulian.com/"
;
//正式广告域名
private
string
BaseGameUrl
;
private
string
BaseAdUrl
;
private
int
timeOut
=
10
;
//超时时间
...
...
@@ -64,12 +61,6 @@ public class AdHttpUtil : MonoBehaviour
StartCoroutine
(
GetRequest
(
BaseAdUrl
,
methodName
,
getParas
,
success
,
failed
));
}
public
void
_Get
<
T
>(
string
methodName
,
Dictionary
<
string
,
object
>
getParas
,
Action
<
T
>
success
,
Action
<
string
,
string
>
failed
)
{
StartCoroutine
(
GetRequest
(
BaseGameUrl
,
methodName
,
getParas
,
success
,
failed
));
}
private
IEnumerator
GetRequest
<
T
>(
string
BaseURL
,
string
methodName
,
Dictionary
<
string
,
object
>
getParas
,
Action
<
T
>
success
,
Action
<
string
,
string
>
failed
)
{
string
url
=
BaseURL
+
methodName
+
"?"
+
HttpUtil
.
addParams
(
getParas
);
...
...
Assets/AdSDK/AD/Demo/AdDemo.unity
View file @
a4f3577a
...
...
@@ -2732,7 +2732,7 @@ MonoBehaviour:
m_PersistentCalls
:
m_Calls
:
[]
m_FontData
:
m_Font
:
{
fileID
:
10102
,
guid
:
0000000000000000e000000000000000
,
type
:
3
}
m_Font
:
{
fileID
:
10102
,
guid
:
0000000000000000e000000000000000
,
type
:
0
}
m_FontSize
:
40
m_FontStyle
:
0
m_BestFit
:
0
...
...
Assets/UnityTool/AppConfig.cs
View file @
a4f3577a
...
...
@@ -25,6 +25,8 @@ public class AppConfig
public
void
InitProgect
(
bool
isTest
,
bool
IsShowLog
,
string
appls
)
{
Constant
.
Instance
.
IsTestNet
=
isTest
;
//log日志
Debug
.
unityLogger
.
logEnabled
=
IsShowLog
;
CallingNativeMethods
.
Instance
.
InitWxLogin
();
Constant
.
Instance
.
ZXAD_VC
=
ZXADConfig
.
ZXAD_VC
+
""
;
Constant
.
Instance
.
ZXAD_VN
=
ZXADConfig
.
ZXAD_VN
;
...
...
Assets/UnityTool/UnityPhoneUtils.cs
View file @
a4f3577a
using
System.Collections
;
using
System.Collections.Generic
;
using
System.Runtime.InteropServices
;
using
AOT
;
using
UnityEngine
;
public
class
UnityPhoneUtils
...
...
@@ -27,6 +29,9 @@ public class UnityPhoneUtils
return
activity
;
}
private
string
device_iOS
=
""
;
private
string
idfa_iOS
=
""
;
private
AndroidJavaObject
phoneUtil
;
private
AndroidJavaObject
GetPhoneUtil
()
{
...
...
@@ -164,6 +169,10 @@ public class UnityPhoneUtils
return
carrier
;
}
/// <summary>
/// 张哲注意了 实时改
/// </summary>
/// <returns></returns>
public
string
GetVC
()
{
string
vc
=
""
;
...
...
@@ -173,7 +182,8 @@ public class UnityPhoneUtils
#elif UNITY_ANDROID
vc
=
GetPhoneUtil
().
Call
<
int
>(
"getAppVersionCode"
,
GetActivity
())+
""
;
#elif UNITY_IOS
vc
=
""
;
vc
=
"1"
;
#endif
Debug
.
unityLogger
.
Log
(
"GetVC "
+
vc
);
return
vc
;
...
...
@@ -213,6 +223,35 @@ public class UnityPhoneUtils
return
aid
;
}
#if UNITY_IOS
/// <summary>
/// 声明交互方法
/// </summary>
/// <param name="resultString"></param>
[
UnmanagedFunctionPointer
(
CallingConvention
.
Cdecl
)]
public
delegate
void
ResultHandlerIDFA
(
string
resultString
);
[
UnmanagedFunctionPointer
(
CallingConvention
.
Cdecl
)]
public
delegate
void
ResultHandlerDevice
(
string
resultString
);
/// <summary>
/// 接受交互值 在iOS代码中调用 resultHandlerIDFA("传值");
/// </summary>
/// <param name="resultStr"></param>
[
MonoPInvokeCallback
(
typeof
(
ResultHandlerIDFA
))]
static
void
resultHandlerIDFA
(
string
resultStr
)
{
Instance
.
idfa_iOS
=
resultStr
;
}
[
MonoPInvokeCallback
(
typeof
(
ResultHandlerDevice
))]
static
void
resultHandlerDevice
(
string
resultStr
)
{
Instance
.
device_iOS
=
resultStr
;
}
#endif
public
string
GetDevice
()
{
string
device
=
PlayerPrefs
.
GetString
(
"user_device"
,
""
);
...
...
@@ -224,7 +263,10 @@ public class UnityPhoneUtils
device
=
GetPhoneUtil
().
Call
<
string
>(
"getAndroidID"
,
GetActivity
());
#elif UNITY_IOS
device
=
device_iOS
;
#endif
PlayerPrefs
.
SetString
(
"user_device"
,
device
);
}
Debug
.
unityLogger
.
Log
(
"GetDevice "
+
device
);
...
...
@@ -273,15 +315,16 @@ public class UnityPhoneUtils
/// <returns></returns>
public
string
GetIDFA
()
{
string
idfa
=
""
;
string
idfa
Str
=
""
;
#if UNITY_EDITOR
Debug
.
unityLogger
.
Log
(
"GetIDFA"
);
#elif UNITY_ANDROID
idfa
=
""
;
idfa
Str
=
""
;
#elif UNITY_IOS
idfa
=
""
;
idfa
Str
=
idfa_iOS
;
#endif
Debug
.
unityLogger
.
Log
(
"GetIDFA "
+
idfa
);
return
idfa
;
Debug
.
unityLogger
.
Log
(
"GetIDFA "
+
idfaStr
);
return
idfaStr
;
}
}
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