Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Sign in / Register
Toggle navigation
W
wdlc_mjb_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
王雪伟
wdlc_mjb_unity
Commits
c4bc27cf
Commit
c4bc27cf
authored
Jun 21, 2021
by
zhangzhe
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
实物奖励抽中弹窗修改,可给兑换奖励调用
parent
2e241c29
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
179 additions
and
93 deletions
+179
-93
AdSDK.meta
Assets/AdSDK.meta
+8
-0
AD.meta
Assets/AdSDK/AD.meta
+8
-0
Example.cs
Assets/Base/AdSDK/AD/CSJ/Example/Example.cs
+121
-84
DialogControl.cs
Assets/Game/Main/Scripts/View/DialogControl.cs
+5
-1
RealAwardsCard.cs
Assets/Game/Main/Scripts/dialog/RealAwards/RealAwardsCard.cs
+1
-1
RealAwardsWinDialog.cs
...ame/Main/Scripts/dialog/RealAwards/RealAwardsWinDialog.cs
+35
-6
Splash.cs
Assets/Scripts/Splash/Splash.cs
+1
-1
No files found.
Assets/AdSDK.meta
0 → 100644
View file @
c4bc27cf
fileFormatVersion: 2
guid: b9b263a922fc04fb18572f38d7307beb
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
Assets/AdSDK/AD.meta
0 → 100644
View file @
c4bc27cf
fileFormatVersion: 2
guid: 66e2d68a3d594c442ba620e41fb79243
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
Assets/Base/AdSDK/AD/CSJ/Example/Example.cs
View file @
c4bc27cf
...
...
@@ -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
();
}
...
...
@@ -325,7 +332,7 @@ public sealed class Example : MonoBehaviour
this
.
rewardAd
=
null
;
}
#endif
string
iosSlotID
=
"945113162"
;
string
AndroidSlotID
=
"901121593"
;
...
...
@@ -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
;
}
...
...
@@ -546,7 +561,7 @@ public sealed class Example : MonoBehaviour
adsRit
=
"901121246"
;
#endif
}
var
adSlot
=
new
AdSlot
.
Builder
()
#if UNITY_IOS
...
...
@@ -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
;
}
...
...
@@ -650,12 +667,12 @@ public sealed class Example : MonoBehaviour
if
(
adsRit
.
Length
==
0
)
{
adsRit
=
"945870989"
;
}
}
#endif
var
adSlot
=
new
AdSlot
.
Builder
()
.
SetCodeId
(
adsRit
)
.
SetExpressViewAcceptedSize
(
width
,
height
)
////期望模板广告view的size,单位dp,//高度设置为0,则高度会自适应
////期望模板广告view的size,单位dp,//高度设置为0,则高度会自适应
.
SetSupportDeepLink
(
true
)
.
SetAdCount
(
1
)
.
SetImageAcceptedSize
(
1080
,
1920
)
...
...
@@ -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,则高度会自适应
...
...
@@ -788,7 +824,7 @@ public sealed class Example : MonoBehaviour
public
void
ShowNativeBannerAd
()
{
#if UNITY_IOS
if
(
bannerAd
==
null
)
if
(
bannerAd
==
null
)
{
Debug
.
LogError
(
"请先加载广告"
);
this
.
information
.
text
=
"请先加载广告"
;
...
...
@@ -928,7 +964,7 @@ public sealed class Example : MonoBehaviour
this
.
rewardAd
.
Dispose
();
this
.
rewardAd
=
null
;
}
if
(
this
.
fullScreenVideoAd
!=
null
)
{
this
.
fullScreenVideoAd
.
Dispose
();
...
...
@@ -1233,16 +1269,16 @@ 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
)
{
case
0
:
this
.
example
.
mExpressFeedad
=
enumerator
.
Current
;
this
.
example
.
mExpressFeedad
.
SetExpressInteractionListener
(
new
ExpressAdInteractionListener
(
this
.
example
,
0
));
this
.
example
.
mExpressFeedad
.
SetDownloadListener
(
new
AppDownloadListener
(
this
.
example
));
break
;
this
.
example
.
mExpressFeedad
=
enumerator
.
Current
;
this
.
example
.
mExpressFeedad
.
SetExpressInteractionListener
(
new
ExpressAdInteractionListener
(
this
.
example
,
0
));
this
.
example
.
mExpressFeedad
.
SetDownloadListener
(
new
AppDownloadListener
(
this
.
example
));
break
;
case
1
:
this
.
example
.
mExpressBannerAd
=
enumerator
.
Current
;
break
;
...
...
@@ -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
)
...
...
@@ -1351,7 +1387,7 @@ public sealed class Example : MonoBehaviour
Debug
.
LogError
(
"express dislike OnSelected:"
+
var2
);
this
.
example
.
information
.
text
=
"ExpressAdDislikeCallback OnSelected:"
+
type
;
#if UNITY_IOS
#else
//释放广告资源
switch
(
type
)
...
...
@@ -1404,13 +1440,13 @@ public sealed class Example : MonoBehaviour
//释放广告资源
switch
(
type
)
{
case
0
:
this
.
example
.
feedAd
=
null
;
break
;
case
1
:
this
.
example
.
bannerAd
=
null
;
case
0
:
this
.
example
.
feedAd
=
null
;
break
;
case
1
:
this
.
example
.
bannerAd
=
null
;
break
;
}
}
...
...
@@ -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
;
}
...
...
@@ -1472,7 +1509,7 @@ public sealed class Example : MonoBehaviour
//bannerAd.;
//bannerAd.SetDownloadListener(
//new AppDownloadListener(this.example));
//new AppDownloadListener(this.example));
}
}
...
...
@@ -1667,8 +1704,8 @@ public sealed class Example : MonoBehaviour
splashAdManager
.
Call
(
"destorySplashView"
,
this
.
activity
);
}
#else
this
.
example
.
splashAd
.
Dispose
();
this
.
example
.
splashAd
=
null
;
this
.
example
.
splashAd
.
Dispose
();
this
.
example
.
splashAd
=
null
;
#endif
}
...
...
@@ -1724,78 +1761,78 @@ public sealed class Example : MonoBehaviour
}
}
private
sealed
class
ExpressSplashAdListener
:
ISplashAdListener
{
private
Example
example
;
public
ExpressSplashAdListener
(
Example
example
)
private
sealed
class
ExpressSplashAdListener
:
ISplashAdListener
{
this
.
example
=
example
;
}
private
Example
example
;
public
void
OnError
(
int
code
,
string
message
)
{
Debug
.
Log
(
"expressSplash load Onerror:"
+
code
+
":"
+
message
);
this
.
example
.
information
.
text
=
"Onerror:"
+
code
+
":"
+
message
;
}
public
ExpressSplashAdListener
(
Example
example
)
{
this
.
example
=
example
;
}
public
void
OnSplashAdLoad
(
BUSplashAd
ad
)
{
#if UNITY_IOS
if
(
ad
!=
null
)
public
void
OnError
(
int
code
,
string
message
)
{
Debug
.
Log
(
"expressSplash load Onsucc:"
);
this
.
example
.
information
.
text
=
"OnLoad"
;
this
.
example
.
expressSplashAd
.
SetSplashInteractionListener
(
new
ExpressSplashAdInteractionListener
(
this
.
example
));
Debug
.
Log
(
"expressSplash load Onerror:"
+
code
+
":"
+
message
);
this
.
example
.
information
.
text
=
"Onerror:"
+
code
+
":"
+
message
;
}
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
}
}
}
private
sealed
class
ExpressSplashAdInteractionListener
:
ISplashAdInteractionListener
{
private
Example
example
;
public
ExpressSplashAdInteractionListener
(
Example
example
)
private
sealed
class
ExpressSplashAdInteractionListener
:
ISplashAdInteractionListener
{
this
.
example
=
example
;
}
private
Example
example
;
public
ExpressSplashAdInteractionListener
(
Example
example
)
{
this
.
example
=
example
;
}
/// <summary>
/// Invoke when the Ad is clicked.
/// </summary>
public
void
OnAdClicked
(
int
type
)
{
Debug
.
Log
(
"expressSplash Ad OnAdClicked"
);
this
.
example
.
information
.
text
=
"OnAdClicked"
;
}
{
Debug
.
Log
(
"expressSplash Ad OnAdClicked"
);
this
.
example
.
information
.
text
=
"OnAdClicked"
;
}
/// <summary>
/// Invoke when the Ad is shown.
/// </summary>
public
void
OnAdShow
(
int
type
)
{
Debug
.
Log
(
"expressSplash Ad OnAdShow"
);
this
.
example
.
information
.
text
=
"OnAdShow"
;
}
{
Debug
.
Log
(
"expressSplash Ad OnAdShow"
);
this
.
example
.
information
.
text
=
"OnAdShow"
;
}
/// <summary>
/// Invoke when the Ad is skipped.
/// </summary>
public
void
OnAdSkip
()
{
Debug
.
Log
(
"expressSplash Ad OnAdSkip"
);
this
.
example
.
information
.
text
=
"OnAdSkip"
;
this
.
example
.
expressSplashAd
.
Dispose
();
this
.
example
.
expressSplashAd
=
null
;
}
{
Debug
.
Log
(
"expressSplash Ad OnAdSkip"
);
this
.
example
.
information
.
text
=
"OnAdSkip"
;
this
.
example
.
expressSplashAd
.
Dispose
();
this
.
example
.
expressSplashAd
=
null
;
}
/// <summary>
/// Invoke when the Ad time over.
/// </summary>
public
void
OnAdTimeOver
()
{
Debug
.
Log
(
"expressSplash Ad OnAdTimeOver"
);
{
Debug
.
Log
(
"expressSplash Ad OnAdTimeOver"
);
this
.
example
.
information
.
text
=
"OnAdTimeOver"
;
this
.
example
.
expressSplashAd
.
Dispose
();
this
.
example
.
expressSplashAd
=
null
;
...
...
@@ -1814,7 +1851,7 @@ private sealed class ExpressSplashAdInteractionListener : ISplashAdInteractionLi
private
sealed
class
AppDownloadListener
:
IAppDownloadListener
private
sealed
class
AppDownloadListener
:
IAppDownloadListener
{
private
Example
example
;
...
...
Assets/Game/Main/Scripts/View/DialogControl.cs
View file @
c4bc27cf
...
...
@@ -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>
...
...
Assets/Game/Main/Scripts/dialog/RealAwards/RealAwardsCard.cs
View file @
c4bc27cf
...
...
@@ -102,6 +102,6 @@ public class RealAwardsCard : MonoBehaviour
FindObjectOfType
<
DialogControl
>().
CloseRealAwards
();
FindObjectOfType
<
DialogControl
>().
ShowRealAwardsWinDialog
();
FindObjectOfType
<
DialogControl
>().
ShowRealAwardsWinDialog
()
.
SetUpSubviews
()
;
}
}
Assets/Game/Main/Scripts/dialog/RealAwards/RealAwardsWinDialog.cs
View file @
c4bc27cf
...
...
@@ -14,16 +14,30 @@ public class RealAwardsWinDialog : MonoBehaviour
public
Text
NameText
;
private
void
OnEnable
()
{
EventCenter
.
AddListener
(
MyEventType
.
RefreshRealAwardsData
,
RefreshData
);
/// <summary>
/// 是否是实物奖励
/// </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>
...
...
@@ -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>
...
...
Assets/Scripts/Splash/Splash.cs
View file @
c4bc27cf
...
...
@@ -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
)
=>
{
...
...
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