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();
} }
...@@ -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;
} }
...@@ -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;
} }
...@@ -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,则高度会自适应
...@@ -1233,7 +1269,7 @@ public sealed class Example : MonoBehaviour ...@@ -1233,7 +1269,7 @@ 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)
{ {
...@@ -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)
...@@ -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;
} }
...@@ -1724,8 +1761,8 @@ public sealed class Example : MonoBehaviour ...@@ -1724,8 +1761,8 @@ public sealed class Example : MonoBehaviour
} }
} }
private sealed class ExpressSplashAdListener : ISplashAdListener private sealed class ExpressSplashAdListener : ISplashAdListener
{ {
private Example example; private Example example;
public ExpressSplashAdListener(Example example) public ExpressSplashAdListener(Example example)
...@@ -1750,10 +1787,10 @@ private sealed class ExpressSplashAdListener : ISplashAdListener ...@@ -1750,10 +1787,10 @@ private sealed class ExpressSplashAdListener : ISplashAdListener
} }
#endif #endif
} }
} }
private sealed class ExpressSplashAdInteractionListener : ISplashAdInteractionListener private sealed class ExpressSplashAdInteractionListener : ISplashAdInteractionListener
{ {
private Example example; private Example example;
public ExpressSplashAdInteractionListener(Example example) public ExpressSplashAdInteractionListener(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,17 +14,31 @@ public class RealAwardsWinDialog : MonoBehaviour ...@@ -14,17 +14,31 @@ 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() private void OnDisable()
{
if (isReal)
{ {
EventCenter.RemoveListener(MyEventType.RefreshRealAwardsData, RefreshData); EventCenter.RemoveListener(MyEventType.RefreshRealAwardsData, RefreshData);
} }
}
/// <summary>
/// 设置页面布局, 无需传参
/// 实物奖励时用此方法
/// </summary>
public void SetUpSubviews()
{
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