Commit c4bc27cf authored by zhangzhe's avatar zhangzhe

实物奖励抽中弹窗修改,可给兑换奖励调用

parent 2e241c29
fileFormatVersion: 2
guid: b9b263a922fc04fb18572f38d7307beb
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: 66e2d68a3d594c442ba620e41fb79243
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
...@@ -54,11 +54,13 @@ public sealed class Example : MonoBehaviour ...@@ -54,11 +54,13 @@ public sealed class Example : MonoBehaviour
private ExpressAd mExpressInterstitialAd; private ExpressAd mExpressInterstitialAd;
private static void callbackmethod (bool success, string message) { private static void callbackmethod(bool success, string message)
Debug.Log("`````````````````初始化``````"+success+"-----"+message); {
Debug.Log("`````````````````初始化``````" + success + "-----" + message);
} }
void Start () { void Start()
{
#if UNITY_IOS #if UNITY_IOS
PangleConfiguration configuration = PangleConfiguration.CreateInstance(); PangleConfiguration configuration = PangleConfiguration.CreateInstance();
configuration.appID = "5000546"; configuration.appID = "5000546";
...@@ -69,7 +71,7 @@ public sealed class Example : MonoBehaviour ...@@ -69,7 +71,7 @@ public sealed class Example : MonoBehaviour
// 激励和全屏,开屏的横竖屏配置 // 激励和全屏,开屏的横竖屏配置
public int getScreenOrientationConfig () public int getScreenOrientationConfig()
{ {
this.screenOrientation = GameObject.Find("Canvas/screenOrientation").GetComponent<InputField>(); this.screenOrientation = GameObject.Find("Canvas/screenOrientation").GetComponent<InputField>();
int screenOrientation; int screenOrientation;
...@@ -96,6 +98,7 @@ public sealed class Example : MonoBehaviour ...@@ -96,6 +98,7 @@ public sealed class Example : MonoBehaviour
public void LoadSplashAd() public void LoadSplashAd()
{ {
#if UNITY_IOS #if UNITY_IOS
if (this.splashAd != null) if (this.splashAd != null)
{ {
this.splashAd.Dispose(); this.splashAd.Dispose();
...@@ -197,10 +200,12 @@ public sealed class Example : MonoBehaviour ...@@ -197,10 +200,12 @@ public sealed class Example : MonoBehaviour
int.TryParse(this.width.text, out width); int.TryParse(this.width.text, out width);
int.TryParse(this.height.text, out height); int.TryParse(this.height.text, out height);
if (width == 0) { if (width == 0)
{
width = UnityEngine.Screen.width; width = UnityEngine.Screen.width;
} }
if (height == 0) { if (height == 0)
{
height = width / 600 * 257; height = width / 600 * 257;
} }
...@@ -301,7 +306,9 @@ public sealed class Example : MonoBehaviour ...@@ -301,7 +306,9 @@ public sealed class Example : MonoBehaviour
Debug.LogError("请先加载广告"); Debug.LogError("请先加载广告");
this.information.text = "请先加载广告"; this.information.text = "请先加载广告";
return; return;
} else { }
else
{
this.rewardAd.ShowRewardVideoAd(); this.rewardAd.ShowRewardVideoAd();
} }
...@@ -325,7 +332,7 @@ public sealed class Example : MonoBehaviour ...@@ -325,7 +332,7 @@ public sealed class Example : MonoBehaviour
this.rewardAd = null; this.rewardAd = null;
} }
#endif #endif
string iosSlotID = "945113162"; string iosSlotID = "945113162";
string AndroidSlotID = "901121593"; string AndroidSlotID = "901121593";
...@@ -370,7 +377,9 @@ public sealed class Example : MonoBehaviour ...@@ -370,7 +377,9 @@ public sealed class Example : MonoBehaviour
Debug.LogError("请先加载广告"); Debug.LogError("请先加载广告");
this.information.text = "请先加载广告"; this.information.text = "请先加载广告";
return; return;
} else { }
else
{
this.expressRewardAd.ShowRewardVideoAd(); this.expressRewardAd.ShowRewardVideoAd();
} }
#else #else
...@@ -431,7 +440,9 @@ public sealed class Example : MonoBehaviour ...@@ -431,7 +440,9 @@ public sealed class Example : MonoBehaviour
Debug.LogError("请先加载广告"); Debug.LogError("请先加载广告");
this.information.text = "请先加载广告"; this.information.text = "请先加载广告";
return; return;
} else { }
else
{
this.fullScreenVideoAd.ShowFullScreenVideoAd(); this.fullScreenVideoAd.ShowFullScreenVideoAd();
} }
} }
...@@ -488,7 +499,9 @@ public sealed class Example : MonoBehaviour ...@@ -488,7 +499,9 @@ public sealed class Example : MonoBehaviour
Debug.LogError("请先加载广告"); Debug.LogError("请先加载广告");
this.information.text = "请先加载广告"; this.information.text = "请先加载广告";
return; return;
} else { }
else
{
this.expressFullScreenVideoAd.ShowFullScreenVideoAd(); this.expressFullScreenVideoAd.ShowFullScreenVideoAd();
} }
#else #else
...@@ -528,10 +541,12 @@ public sealed class Example : MonoBehaviour ...@@ -528,10 +541,12 @@ public sealed class Example : MonoBehaviour
int.TryParse(this.width.text, out width); int.TryParse(this.width.text, out width);
int.TryParse(this.height.text, out height); int.TryParse(this.height.text, out height);
if (width == 0) { if (width == 0)
{
width = UnityEngine.Screen.width; width = UnityEngine.Screen.width;
} }
if (height == 0) { if (height == 0)
{
height = width / 600 * 90; height = width / 600 * 90;
} }
...@@ -546,7 +561,7 @@ public sealed class Example : MonoBehaviour ...@@ -546,7 +561,7 @@ public sealed class Example : MonoBehaviour
adsRit = "901121246"; adsRit = "901121246";
#endif #endif
} }
var adSlot = new AdSlot.Builder() var adSlot = new AdSlot.Builder()
#if UNITY_IOS #if UNITY_IOS
...@@ -637,10 +652,12 @@ public sealed class Example : MonoBehaviour ...@@ -637,10 +652,12 @@ public sealed class Example : MonoBehaviour
int.TryParse(this.width.text, out width); int.TryParse(this.width.text, out width);
int.TryParse(this.height.text, out height); int.TryParse(this.height.text, out height);
if (width == 0) { if (width == 0)
{
width = UnityEngine.Screen.width; width = UnityEngine.Screen.width;
} }
if (height == 0) { if (height == 0)
{
height = width / 200 * 300; height = width / 200 * 300;
} }
...@@ -650,12 +667,12 @@ public sealed class Example : MonoBehaviour ...@@ -650,12 +667,12 @@ public sealed class Example : MonoBehaviour
if (adsRit.Length == 0) if (adsRit.Length == 0)
{ {
adsRit = "945870989"; adsRit = "945870989";
} }
#endif #endif
var adSlot = new AdSlot.Builder() var adSlot = new AdSlot.Builder()
.SetCodeId(adsRit) .SetCodeId(adsRit)
.SetExpressViewAcceptedSize(width, height) .SetExpressViewAcceptedSize(width, height)
////期望模板广告view的size,单位dp,//高度设置为0,则高度会自适应 ////期望模板广告view的size,单位dp,//高度设置为0,则高度会自适应
.SetSupportDeepLink(true) .SetSupportDeepLink(true)
.SetAdCount(1) .SetAdCount(1)
.SetImageAcceptedSize(1080, 1920) .SetImageAcceptedSize(1080, 1920)
...@@ -709,6 +726,24 @@ public sealed class Example : MonoBehaviour ...@@ -709,6 +726,24 @@ public sealed class Example : MonoBehaviour
public void LoadExpressFeedAd() public void LoadExpressFeedAd()
{ {
//this.width = GameObject.Find("Canvas/Width").GetComponent<InputField>();
//this.height = GameObject.Find("Canvas/Height").GetComponent<InputField>();
//int width;
//int height;
//int.TryParse(this.width.text, out width);
//int.TryParse(this.height.text, out height);
//if (width == 0)
//{
// width = 375;
//}
//if (height == 0)
//{
// height = 0;
//}
#if UNITY_IOS #if UNITY_IOS
if (this.mExpressFeedad != null) if (this.mExpressFeedad != null)
{ {
...@@ -725,6 +760,7 @@ public sealed class Example : MonoBehaviour ...@@ -725,6 +760,7 @@ public sealed class Example : MonoBehaviour
var adSlot = new AdSlot.Builder() var adSlot = new AdSlot.Builder()
#if UNITY_IOS #if UNITY_IOS
.SetCodeId("945870984") .SetCodeId("945870984")
.SetExpressViewAcceptedSize(Screen.width, 0)
#else #else
.SetCodeId("901121253") .SetCodeId("901121253")
////期望模板广告view的size,单位dp,//高度设置为0,则高度会自适应 ////期望模板广告view的size,单位dp,//高度设置为0,则高度会自适应
...@@ -788,7 +824,7 @@ public sealed class Example : MonoBehaviour ...@@ -788,7 +824,7 @@ public sealed class Example : MonoBehaviour
public void ShowNativeBannerAd() public void ShowNativeBannerAd()
{ {
#if UNITY_IOS #if UNITY_IOS
if (bannerAd == null) if (bannerAd == null)
{ {
Debug.LogError("请先加载广告"); Debug.LogError("请先加载广告");
this.information.text = "请先加载广告"; this.information.text = "请先加载广告";
...@@ -928,7 +964,7 @@ public sealed class Example : MonoBehaviour ...@@ -928,7 +964,7 @@ public sealed class Example : MonoBehaviour
this.rewardAd.Dispose(); this.rewardAd.Dispose();
this.rewardAd = null; this.rewardAd = null;
} }
if (this.fullScreenVideoAd != null) if (this.fullScreenVideoAd != null)
{ {
this.fullScreenVideoAd.Dispose(); this.fullScreenVideoAd.Dispose();
...@@ -1233,16 +1269,16 @@ public sealed class Example : MonoBehaviour ...@@ -1233,16 +1269,16 @@ public sealed class Example : MonoBehaviour
Debug.LogError("OnExpressAdLoad"); Debug.LogError("OnExpressAdLoad");
this.example.information.text = "OnExpressAdLoad"; this.example.information.text = "OnExpressAdLoad";
IEnumerator<ExpressAd> enumerator = ads.GetEnumerator(); IEnumerator<ExpressAd> enumerator = ads.GetEnumerator();
if(enumerator.MoveNext()) if (enumerator.MoveNext())
{ {
switch (type) switch (type)
{ {
case 0: case 0:
this.example.mExpressFeedad = enumerator.Current; this.example.mExpressFeedad = enumerator.Current;
this.example.mExpressFeedad.SetExpressInteractionListener(new ExpressAdInteractionListener(this.example, 0)); this.example.mExpressFeedad.SetExpressInteractionListener(new ExpressAdInteractionListener(this.example, 0));
this.example.mExpressFeedad.SetDownloadListener( this.example.mExpressFeedad.SetDownloadListener(
new AppDownloadListener(this.example)); new AppDownloadListener(this.example));
break; break;
case 1: case 1:
this.example.mExpressBannerAd = enumerator.Current; this.example.mExpressBannerAd = enumerator.Current;
break; break;
...@@ -1259,7 +1295,7 @@ public sealed class Example : MonoBehaviour ...@@ -1259,7 +1295,7 @@ public sealed class Example : MonoBehaviour
Debug.Log("OnExpressBannerAdLoad"); Debug.Log("OnExpressBannerAdLoad");
this.example.information.text = "OnExpressBannerAdLoad"; this.example.information.text = "OnExpressBannerAdLoad";
ad.SetExpressInteractionListener( ad.SetExpressInteractionListener(
new ExpressAdInteractionListener(this.example,1)); new ExpressAdInteractionListener(this.example, 1));
ad.SetDownloadListener( ad.SetDownloadListener(
new AppDownloadListener(this.example)); new AppDownloadListener(this.example));
this.example.iExpressBannerAd = ad; this.example.iExpressBannerAd = ad;
...@@ -1309,7 +1345,7 @@ public sealed class Example : MonoBehaviour ...@@ -1309,7 +1345,7 @@ public sealed class Example : MonoBehaviour
public void OnAdViewRenderSucc(ExpressAd ad, float width, float height) public void OnAdViewRenderSucc(ExpressAd ad, float width, float height)
{ {
Debug.LogError("express OnAdViewRenderSucc,type:"+type); Debug.LogError("express OnAdViewRenderSucc,type:" + type);
this.example.information.text = "OnAdViewRenderSucc:" + type; this.example.information.text = "OnAdViewRenderSucc:" + type;
} }
public void OnAdClose(ExpressAd ad) public void OnAdClose(ExpressAd ad)
...@@ -1351,7 +1387,7 @@ public sealed class Example : MonoBehaviour ...@@ -1351,7 +1387,7 @@ public sealed class Example : MonoBehaviour
Debug.LogError("express dislike OnSelected:" + var2); Debug.LogError("express dislike OnSelected:" + var2);
this.example.information.text = "ExpressAdDislikeCallback OnSelected:" + type; this.example.information.text = "ExpressAdDislikeCallback OnSelected:" + type;
#if UNITY_IOS #if UNITY_IOS
#else #else
//释放广告资源 //释放广告资源
switch (type) switch (type)
...@@ -1404,13 +1440,13 @@ public sealed class Example : MonoBehaviour ...@@ -1404,13 +1440,13 @@ public sealed class Example : MonoBehaviour
//释放广告资源 //释放广告资源
switch (type) switch (type)
{ {
case 0: case 0:
this.example.feedAd = null; this.example.feedAd = null;
break; break;
case 1: case 1:
this.example.bannerAd = null; this.example.bannerAd = null;
break; break;
} }
} }
...@@ -1435,13 +1471,14 @@ public sealed class Example : MonoBehaviour ...@@ -1435,13 +1471,14 @@ public sealed class Example : MonoBehaviour
this.example.information.text = "OnNativeAdError: " + message; this.example.information.text = "OnNativeAdError: " + message;
} }
public void OnNativeAdLoad(AndroidJavaObject list,NativeAd ad) public void OnNativeAdLoad(AndroidJavaObject list, NativeAd ad)
{ {
#if UNITY_IOS #if UNITY_IOS
if (ad.GetAdType() == AdSlotType.Banner) if (ad.GetAdType() == AdSlotType.Banner)
{ {
this.example.bannerAd = ad; this.example.bannerAd = ad;
} else if (ad.GetAdType() == AdSlotType.InteractionAd) }
else if (ad.GetAdType() == AdSlotType.InteractionAd)
{ {
this.example.intersititialAd = ad; this.example.intersititialAd = ad;
} }
...@@ -1472,7 +1509,7 @@ public sealed class Example : MonoBehaviour ...@@ -1472,7 +1509,7 @@ public sealed class Example : MonoBehaviour
//bannerAd.; //bannerAd.;
//bannerAd.SetDownloadListener( //bannerAd.SetDownloadListener(
//new AppDownloadListener(this.example)); //new AppDownloadListener(this.example));
} }
} }
...@@ -1667,8 +1704,8 @@ public sealed class Example : MonoBehaviour ...@@ -1667,8 +1704,8 @@ public sealed class Example : MonoBehaviour
splashAdManager.Call("destorySplashView", this.activity); splashAdManager.Call("destorySplashView", this.activity);
} }
#else #else
this.example.splashAd.Dispose(); this.example.splashAd.Dispose();
this.example.splashAd = null; this.example.splashAd = null;
#endif #endif
} }
...@@ -1724,78 +1761,78 @@ public sealed class Example : MonoBehaviour ...@@ -1724,78 +1761,78 @@ public sealed class Example : MonoBehaviour
} }
} }
private sealed class ExpressSplashAdListener : ISplashAdListener private sealed class ExpressSplashAdListener : ISplashAdListener
{
private Example example;
public ExpressSplashAdListener(Example example)
{ {
this.example = example; private Example example;
}
public void OnError(int code, string message) public ExpressSplashAdListener(Example example)
{ {
Debug.Log("expressSplash load Onerror:" + code + ":" + message); this.example = example;
this.example.information.text = "Onerror:" + code + ":" + message; }
}
public void OnSplashAdLoad(BUSplashAd ad) public void OnError(int code, string message)
{
#if UNITY_IOS
if (ad != null)
{ {
Debug.Log("expressSplash load Onsucc:"); Debug.Log("expressSplash load Onerror:" + code + ":" + message);
this.example.information.text = "OnLoad"; this.example.information.text = "Onerror:" + code + ":" + message;
this.example.expressSplashAd.SetSplashInteractionListener(new ExpressSplashAdInteractionListener(this.example));
} }
public void OnSplashAdLoad(BUSplashAd ad)
{
#if UNITY_IOS
if (ad != null)
{
Debug.Log("expressSplash load Onsucc:");
this.example.information.text = "OnLoad";
this.example.expressSplashAd.SetSplashInteractionListener(new ExpressSplashAdInteractionListener(this.example));
}
#endif #endif
}
} }
}
private sealed class ExpressSplashAdInteractionListener : ISplashAdInteractionListener private sealed class ExpressSplashAdInteractionListener : ISplashAdInteractionListener
{
private Example example;
public ExpressSplashAdInteractionListener(Example example)
{ {
this.example = example; private Example example;
}
public ExpressSplashAdInteractionListener(Example example)
{
this.example = example;
}
/// <summary> /// <summary>
/// Invoke when the Ad is clicked. /// Invoke when the Ad is clicked.
/// </summary> /// </summary>
public void OnAdClicked(int type) public void OnAdClicked(int type)
{ {
Debug.Log("expressSplash Ad OnAdClicked"); Debug.Log("expressSplash Ad OnAdClicked");
this.example.information.text = "OnAdClicked"; this.example.information.text = "OnAdClicked";
} }
/// <summary> /// <summary>
/// Invoke when the Ad is shown. /// Invoke when the Ad is shown.
/// </summary> /// </summary>
public void OnAdShow(int type) public void OnAdShow(int type)
{ {
Debug.Log("expressSplash Ad OnAdShow"); Debug.Log("expressSplash Ad OnAdShow");
this.example.information.text = "OnAdShow"; this.example.information.text = "OnAdShow";
} }
/// <summary> /// <summary>
/// Invoke when the Ad is skipped. /// Invoke when the Ad is skipped.
/// </summary> /// </summary>
public void OnAdSkip() public void OnAdSkip()
{ {
Debug.Log("expressSplash Ad OnAdSkip"); Debug.Log("expressSplash Ad OnAdSkip");
this.example.information.text = "OnAdSkip"; this.example.information.text = "OnAdSkip";
this.example.expressSplashAd.Dispose(); this.example.expressSplashAd.Dispose();
this.example.expressSplashAd = null; this.example.expressSplashAd = null;
} }
/// <summary> /// <summary>
/// Invoke when the Ad time over. /// Invoke when the Ad time over.
/// </summary> /// </summary>
public void OnAdTimeOver() public void OnAdTimeOver()
{ {
Debug.Log("expressSplash Ad OnAdTimeOver"); Debug.Log("expressSplash Ad OnAdTimeOver");
this.example.information.text = "OnAdTimeOver"; this.example.information.text = "OnAdTimeOver";
this.example.expressSplashAd.Dispose(); this.example.expressSplashAd.Dispose();
this.example.expressSplashAd = null; this.example.expressSplashAd = null;
...@@ -1814,7 +1851,7 @@ private sealed class ExpressSplashAdInteractionListener : ISplashAdInteractionLi ...@@ -1814,7 +1851,7 @@ private sealed class ExpressSplashAdInteractionListener : ISplashAdInteractionLi
private sealed class AppDownloadListener : IAppDownloadListener private sealed class AppDownloadListener : IAppDownloadListener
{ {
private Example example; private Example example;
......
...@@ -1078,10 +1078,14 @@ public class DialogControl : MonoBehaviour ...@@ -1078,10 +1078,14 @@ public class DialogControl : MonoBehaviour
/// <summary> /// <summary>
/// 显示抽中的实物奖励弹窗 /// 显示抽中的实物奖励弹窗
/// </summary> /// </summary>
public void ShowRealAwardsWinDialog() public RealAwardsWinDialog ShowRealAwardsWinDialog()
{ {
GameObject gameObject = transform.Find("RealAwardsWinDialog").gameObject; GameObject gameObject = transform.Find("RealAwardsWinDialog").gameObject;
gameObject.SetActive(true); gameObject.SetActive(true);
RealAwardsWinDialog script = gameObject.GetComponent<RealAwardsWinDialog>();
return script;
} }
/// <summary> /// <summary>
......
...@@ -102,6 +102,6 @@ public class RealAwardsCard : MonoBehaviour ...@@ -102,6 +102,6 @@ public class RealAwardsCard : MonoBehaviour
FindObjectOfType<DialogControl>().CloseRealAwards(); FindObjectOfType<DialogControl>().CloseRealAwards();
FindObjectOfType<DialogControl>().ShowRealAwardsWinDialog(); FindObjectOfType<DialogControl>().ShowRealAwardsWinDialog().SetUpSubviews();
} }
} }
...@@ -14,16 +14,30 @@ public class RealAwardsWinDialog : MonoBehaviour ...@@ -14,16 +14,30 @@ public class RealAwardsWinDialog : MonoBehaviour
public Text NameText; public Text NameText;
private void OnEnable() /// <summary>
{ /// 是否是实物奖励
EventCenter.AddListener(MyEventType.RefreshRealAwardsData, RefreshData); /// </summary>
private bool isReal;
RefreshData(); private void OnDisable()
{
if (isReal)
{
EventCenter.RemoveListener(MyEventType.RefreshRealAwardsData, RefreshData);
}
} }
private void OnDisable() /// <summary>
/// 设置页面布局, 无需传参
/// 实物奖励时用此方法
/// </summary>
public void SetUpSubviews()
{ {
EventCenter.RemoveListener(MyEventType.RefreshRealAwardsData, RefreshData); isReal = true;
EventCenter.AddListener(MyEventType.RefreshRealAwardsData, RefreshData);
RefreshData();
} }
/// <summary> /// <summary>
...@@ -39,6 +53,21 @@ public class RealAwardsWinDialog : MonoBehaviour ...@@ -39,6 +53,21 @@ public class RealAwardsWinDialog : MonoBehaviour
} }
} }
/// <summary>
/// 设置页面布局, 传入图片和名字
/// 兑换奖励时用此方法
/// </summary>
/// <param name="img">图片url</param>
/// <param name="name">名字</param>
public void SetUpSubviews(string img, string name)
{
isReal = false;
StartCoroutine(LoadAwardImage(img));
NameText.text = name;
}
/// <summary> /// <summary>
/// 加载图片 /// 加载图片
/// </summary> /// </summary>
......
...@@ -90,7 +90,7 @@ public class Splash : MonoBehaviour ...@@ -90,7 +90,7 @@ public class Splash : MonoBehaviour
{ {
Constant.Instance.shubiao = false; Constant.Instance.shubiao = false;
} }
//Constant.Instance.shubiao = true; Constant.Instance.shubiao = true;
novelInfo(); novelInfo();
}), new Action<string, string>((code, errMsg) => }), new Action<string, string>((code, errMsg) =>
{ {
......
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