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
private ExpressAd mExpressInterstitialAd;
private static void callbackmethod (bool success, string message) {
Debug.Log("`````````````````初始化``````"+success+"-----"+message);
private static void callbackmethod(bool success, string message)
{
Debug.Log("`````````````````初始化``````" + success + "-----" + message);
}
void Start () {
void Start()
{
#if UNITY_IOS
PangleConfiguration configuration = PangleConfiguration.CreateInstance();
configuration.appID = "5000546";
......@@ -69,7 +71,7 @@ public sealed class Example : MonoBehaviour
// 激励和全屏,开屏的横竖屏配置
public int getScreenOrientationConfig ()
public int getScreenOrientationConfig()
{
this.screenOrientation = GameObject.Find("Canvas/screenOrientation").GetComponent<InputField>();
int screenOrientation;
......@@ -96,6 +98,7 @@ public sealed class Example : MonoBehaviour
public void LoadSplashAd()
{
#if UNITY_IOS
if (this.splashAd != null)
{
this.splashAd.Dispose();
......@@ -197,10 +200,12 @@ public sealed class Example : MonoBehaviour
int.TryParse(this.width.text, out width);
int.TryParse(this.height.text, out height);
if (width == 0) {
if (width == 0)
{
width = UnityEngine.Screen.width;
}
if (height == 0) {
if (height == 0)
{
height = width / 600 * 257;
}
......@@ -301,7 +306,9 @@ public sealed class Example : MonoBehaviour
Debug.LogError("请先加载广告");
this.information.text = "请先加载广告";
return;
} else {
}
else
{
this.rewardAd.ShowRewardVideoAd();
}
......@@ -370,7 +377,9 @@ public sealed class Example : MonoBehaviour
Debug.LogError("请先加载广告");
this.information.text = "请先加载广告";
return;
} else {
}
else
{
this.expressRewardAd.ShowRewardVideoAd();
}
#else
......@@ -431,7 +440,9 @@ public sealed class Example : MonoBehaviour
Debug.LogError("请先加载广告");
this.information.text = "请先加载广告";
return;
} else {
}
else
{
this.fullScreenVideoAd.ShowFullScreenVideoAd();
}
}
......@@ -488,7 +499,9 @@ public sealed class Example : MonoBehaviour
Debug.LogError("请先加载广告");
this.information.text = "请先加载广告";
return;
} else {
}
else
{
this.expressFullScreenVideoAd.ShowFullScreenVideoAd();
}
#else
......@@ -528,10 +541,12 @@ public sealed class Example : MonoBehaviour
int.TryParse(this.width.text, out width);
int.TryParse(this.height.text, out height);
if (width == 0) {
if (width == 0)
{
width = UnityEngine.Screen.width;
}
if (height == 0) {
if (height == 0)
{
height = width / 600 * 90;
}
......@@ -637,10 +652,12 @@ public sealed class Example : MonoBehaviour
int.TryParse(this.width.text, out width);
int.TryParse(this.height.text, out height);
if (width == 0) {
if (width == 0)
{
width = UnityEngine.Screen.width;
}
if (height == 0) {
if (height == 0)
{
height = width / 200 * 300;
}
......@@ -709,6 +726,24 @@ public sealed class Example : MonoBehaviour
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 (this.mExpressFeedad != null)
{
......@@ -725,6 +760,7 @@ public sealed class Example : MonoBehaviour
var adSlot = new AdSlot.Builder()
#if UNITY_IOS
.SetCodeId("945870984")
.SetExpressViewAcceptedSize(Screen.width, 0)
#else
.SetCodeId("901121253")
////期望模板广告view的size,单位dp,//高度设置为0,则高度会自适应
......@@ -1233,7 +1269,7 @@ public sealed class Example : MonoBehaviour
Debug.LogError("OnExpressAdLoad");
this.example.information.text = "OnExpressAdLoad";
IEnumerator<ExpressAd> enumerator = ads.GetEnumerator();
if(enumerator.MoveNext())
if (enumerator.MoveNext())
{
switch (type)
{
......@@ -1259,7 +1295,7 @@ public sealed class Example : MonoBehaviour
Debug.Log("OnExpressBannerAdLoad");
this.example.information.text = "OnExpressBannerAdLoad";
ad.SetExpressInteractionListener(
new ExpressAdInteractionListener(this.example,1));
new ExpressAdInteractionListener(this.example, 1));
ad.SetDownloadListener(
new AppDownloadListener(this.example));
this.example.iExpressBannerAd = ad;
......@@ -1309,7 +1345,7 @@ public sealed class Example : MonoBehaviour
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;
}
public void OnAdClose(ExpressAd ad)
......@@ -1435,13 +1471,14 @@ public sealed class Example : MonoBehaviour
this.example.information.text = "OnNativeAdError: " + message;
}
public void OnNativeAdLoad(AndroidJavaObject list,NativeAd ad)
public void OnNativeAdLoad(AndroidJavaObject list, NativeAd ad)
{
#if UNITY_IOS
if (ad.GetAdType() == AdSlotType.Banner)
{
this.example.bannerAd = ad;
} else if (ad.GetAdType() == AdSlotType.InteractionAd)
}
else if (ad.GetAdType() == AdSlotType.InteractionAd)
{
this.example.intersititialAd = ad;
}
......@@ -1724,8 +1761,8 @@ public sealed class Example : MonoBehaviour
}
}
private sealed class ExpressSplashAdListener : ISplashAdListener
{
private sealed class ExpressSplashAdListener : ISplashAdListener
{
private Example example;
public ExpressSplashAdListener(Example example)
......@@ -1750,10 +1787,10 @@ private sealed class ExpressSplashAdListener : ISplashAdListener
}
#endif
}
}
}
private sealed class ExpressSplashAdInteractionListener : ISplashAdInteractionListener
{
private sealed class ExpressSplashAdInteractionListener : ISplashAdInteractionListener
{
private Example example;
public ExpressSplashAdInteractionListener(Example example)
......
......@@ -1078,10 +1078,14 @@ public class DialogControl : MonoBehaviour
/// <summary>
/// 显示抽中的实物奖励弹窗
/// </summary>
public void ShowRealAwardsWinDialog()
public RealAwardsWinDialog ShowRealAwardsWinDialog()
{
GameObject gameObject = transform.Find("RealAwardsWinDialog").gameObject;
gameObject.SetActive(true);
RealAwardsWinDialog script = gameObject.GetComponent<RealAwardsWinDialog>();
return script;
}
/// <summary>
......
......@@ -102,6 +102,6 @@ public class RealAwardsCard : MonoBehaviour
FindObjectOfType<DialogControl>().CloseRealAwards();
FindObjectOfType<DialogControl>().ShowRealAwardsWinDialog();
FindObjectOfType<DialogControl>().ShowRealAwardsWinDialog().SetUpSubviews();
}
}
......@@ -14,17 +14,31 @@ public class RealAwardsWinDialog : MonoBehaviour
public Text NameText;
private void OnEnable()
{
EventCenter.AddListener(MyEventType.RefreshRealAwardsData, RefreshData);
RefreshData();
}
/// <summary>
/// 是否是实物奖励
/// </summary>
private bool isReal;
private void OnDisable()
{
if (isReal)
{
EventCenter.RemoveListener(MyEventType.RefreshRealAwardsData, RefreshData);
}
}
/// <summary>
/// 设置页面布局, 无需传参
/// 实物奖励时用此方法
/// </summary>
public void SetUpSubviews()
{
isReal = true;
EventCenter.AddListener(MyEventType.RefreshRealAwardsData, RefreshData);
RefreshData();
}
/// <summary>
/// 刷新数据
......@@ -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>
......
......@@ -90,7 +90,7 @@ public class Splash : MonoBehaviour
{
Constant.Instance.shubiao = false;
}
//Constant.Instance.shubiao = true;
Constant.Instance.shubiao = true;
novelInfo();
}), 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