Commit 4ea2e21d authored by 王雪伟's avatar 王雪伟

修改HttpTool 请求未实现的情况

parent 3df60f0d
using LitJson; using LitJson;
using System;
using System.Collections; using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using UnityEngine; using UnityEngine;
using UnityEngine.Android; using UnityEngine.Android;
using UnityEngine.SceneManagement; using UnityEngine.SceneManagement;
using ZXHC;
public class InitProject : MonoBehaviour public class InitProject : MonoBehaviour
{ {
...@@ -33,7 +35,12 @@ public class InitProject : MonoBehaviour ...@@ -33,7 +35,12 @@ public class InitProject : MonoBehaviour
#endif #endif
if (IsOk()) if (IsOk())
{ {
OaidUtil.GetOaid(new Action<string>((oaid) => {
ZXHCUtils.SetDeviceOaid(oaid);
EventUtils.OnEvent("app_active");
}));
Gettd(); Gettd();
} }
else else
{ {
......
...@@ -6,10 +6,6 @@ using System; ...@@ -6,10 +6,6 @@ using System;
using System.Text; using System.Text;
using System.Linq; using System.Linq;
using LitJson; using LitJson;
using System.Net.Http;
using System.Net;
using System.Net.Http.Headers;
using System.Threading.Tasks;
using ZXHC; using ZXHC;
public class HttpTool : MonoBehaviour public class HttpTool : MonoBehaviour
...@@ -45,7 +41,13 @@ public class HttpTool : MonoBehaviour ...@@ -45,7 +41,13 @@ public class HttpTool : MonoBehaviour
{ {
if (_instacne == null) if (_instacne == null)
{ {
Debug.unityLogger.LogError(HttpLogTag, "HTTP Awake error"); _instacne = FindObjectOfType(typeof(HttpTool)) as HttpTool;
}
if (_instacne == null)
{
GameObject obj = new GameObject();
_instacne = obj.AddComponent<HttpTool>();
obj.name = "HTTP";
} }
return _instacne; return _instacne;
} }
...@@ -53,6 +55,10 @@ public class HttpTool : MonoBehaviour ...@@ -53,6 +55,10 @@ public class HttpTool : MonoBehaviour
void Awake() void Awake()
{ {
if (FindObjectsOfType(typeof(HttpTool)).Length > 1)
{
Destroy(transform.gameObject);
}
Debug.unityLogger.logEnabled = IsShowLog; Debug.unityLogger.logEnabled = IsShowLog;
if (IS_TEST) if (IS_TEST)
{ {
...@@ -66,10 +72,9 @@ public class HttpTool : MonoBehaviour ...@@ -66,10 +72,9 @@ public class HttpTool : MonoBehaviour
BaseAdUrl = PRODUCT_BASE_AD_URL; BaseAdUrl = PRODUCT_BASE_AD_URL;
BaseEventUrl = PRODUCT_BASE_EVENT_URL; BaseEventUrl = PRODUCT_BASE_EVENT_URL;
} }
HttpTool._instacne = gameObject.GetComponent<HttpTool>(); HttpTool._instacne = gameObject.GetComponent<HttpTool>();
DontDestroyOnLoad(gameObject); DontDestroyOnLoad(gameObject);
//unityhttp header 的内容 //unityhttp header 的内容
requestHeader.Add("Content-Type", "application/json"); requestHeader.Add("Content-Type", "application/json");
} }
......
...@@ -5,6 +5,7 @@ using Umeng; ...@@ -5,6 +5,7 @@ using Umeng;
using UnityEngine; using UnityEngine;
using UnityEngine.Android; using UnityEngine.Android;
using UnityEngine.SceneManagement; using UnityEngine.SceneManagement;
using ZXHC;
public class Splash : MonoBehaviour public class Splash : MonoBehaviour
{ {
...@@ -18,6 +19,10 @@ public class Splash : MonoBehaviour ...@@ -18,6 +19,10 @@ public class Splash : MonoBehaviour
{ {
//EventUtils.OnEvent("app_start", "广告SDK"); //EventUtils.OnEvent("app_start", "广告SDK");
Debug.unityLogger.Log("初始化权限"); Debug.unityLogger.Log("初始化权限");
OaidUtil.GetOaid(new Action<string>((oaid) => {
//ZXHCUtils.SetDeviceOaid(oaid);
EventUtils.OnEvent("app_active");
}));
} }
/// <summary> /// <summary>
......
...@@ -473,6 +473,16 @@ PrefabInstance: ...@@ -473,6 +473,16 @@ PrefabInstance:
propertyPath: m_Name propertyPath: m_Name
value: HTTP value: HTTP
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 2853166085728200632, guid: 1053be02c113a7a45adf322c929b0cb6,
type: 3}
propertyPath: m_IsActive
value: 1
objectReference: {fileID: 0}
- target: {fileID: 2853166085728200634, guid: 1053be02c113a7a45adf322c929b0cb6,
type: 3}
propertyPath: IS_TGYZ
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2853166085728200635, guid: 1053be02c113a7a45adf322c929b0cb6, - target: {fileID: 2853166085728200635, guid: 1053be02c113a7a45adf322c929b0cb6,
type: 3} type: 3}
propertyPath: m_RootOrder propertyPath: m_RootOrder
......
...@@ -8,13 +8,13 @@ EditorBuildSettings: ...@@ -8,13 +8,13 @@ EditorBuildSettings:
- enabled: 0 - enabled: 0
path: Assets/AdSDK/AD/CSJ/Example/Example.unity path: Assets/AdSDK/AD/CSJ/Example/Example.unity
guid: 1e4f8457b1266154e80399e42b932ceb guid: 1e4f8457b1266154e80399e42b932ceb
- enabled: 0 - enabled: 1
path: Assets/AdSDK/InitProject/InitScene.unity path: Assets/AdSDK/InitProject/InitScene.unity
guid: b0fdeff412c9a1f4e82faa8ef0aeb063 guid: b0fdeff412c9a1f4e82faa8ef0aeb063
- enabled: 0 - enabled: 0
path: Assets/AdSDK/AD/GDT/UnionDemo/UnionExample.unity path: Assets/AdSDK/AD/GDT/UnionDemo/UnionExample.unity
guid: 6c963ae210fa3c3438c2f6770ee81fc9 guid: 6c963ae210fa3c3438c2f6770ee81fc9
- enabled: 0 - enabled: 1
path: Assets/AdSDK/SplashDemo/Splash.unity path: Assets/AdSDK/SplashDemo/Splash.unity
guid: 37af8cf3fb373478ab04e3ee2f3b700a guid: 37af8cf3fb373478ab04e3ee2f3b700a
- enabled: 1 - enabled: 1
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment