Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
L
llewan-laya-sdk
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
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
llewan
llewan-laya-sdk
Commits
95e38ed0
Commit
95e38ed0
authored
Nov 27, 2018
by
liuxinjun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
-
添加多视频广告id以及分享视频切换计数bug
parent
4b08db29
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
381 additions
and
3 deletions
+381
-3
ad_sdk.js
assets/llewan-laya-sdk/ad_sdk.js
+329
-0
ad_sdk.js.meta
assets/llewan-laya-sdk/ad_sdk.js.meta
+10
-0
sdk.js
assets/llewan-laya-sdk/sdk.js
+40
-1
sdk_conf.js
assets/llewan-laya-sdk/sdk_conf.js
+2
-2
No files found.
assets/llewan-laya-sdk/ad_sdk.js
0 → 100644
View file @
95e38ed0
/**
1.安装apidoc,参考链接:
http://apidocjs.com
2.按照格式弄好后,执行命令
apidoc -i ./apiTest/assets/Sdk -o api/
在小程序后台添加合法域名:
https://game.llewan.com:1899
https://login.llewan.com:1799
https://log.llewan.com:1999
https://res.llewan.com:2099
https://glog.aldwx.com
*/
var
md5
=
require
(
"md5"
);
var
mta
=
require
(
"mta"
);
var
sdk_conf
=
require
(
"sdk_conf"
);
var
sdk
=
require
(
"sdk"
);
var
adSdk
=
{
BannerAd
:
null
,
VideoAd
:
null
,
videoAd1
:
null
,
videoAd2
:
null
,
videoAd3
:
null
,
//.即将废弃,请不要操作此变量。
userid
:
0
,
initFlag
:
0
,
//视频成功回调
videoSuccess
:
null
,
//视频失败回调
videoFail
:
null
,
//视频成功回调
videoSuccess1
:
null
,
//视频失败回调
videoFail1
:
null
,
//视频成功回调
videoSuccess2
:
null
,
//视频失败回调
videoFail2
:
null
,
//视频成功回调
videoSuccess3
:
null
,
//视频失败回调
videoFail3
:
null
,
/**
* @apiGroup C
* @apiName createBannerAd
* @api {微信登录} 创建banner广告组件 createBannerAd(广告)
* @apiParam {String} adUnitId 广告单元id
* @apiParam {String} style banner 广告组件的样式
*
* @apiSuccessExample {json} 示例:
* //.参考文档:https://developers.weixin.qq.com/minigame/dev/document/ad/wx.createBannerAd.html
* //var bannerAd = sdk.createBannerAd({
* // style:{
* // left: 0,
* // top: 0,
* // width: 100,
* // height: 200
* // }
* //});
*
* //.极简版(默认底部Banner)
* var bannerAd = sdk.createBannerAd({});
* bannerAd.show()
*
*/
createBannerAd
(
obj
){
return
sdk
.
createBannerAd
(
obj
);
},
/**
* @apiGroup C
* @apiName createRewardedVideoAd
* @api {微信登录} 创建banner广告组件 createRewardedVideoAd(广告)
* @apiParam {String} adUnitId 广告单元id
*
* @apiSuccessExample {json} 示例:
* //.参考文档:https://developers.weixin.qq.com/minigame/dev/document/ad/wx.createRewardedVideoAd.html
* sdk.videoSuccess = function(){
* //视频成功处理逻辑
* this.successFunction();
* };
* sdk.videoFail = function(){
* //视频失败处理逻辑
* this.failFunction();`
* };
* var videoAd = sdk.createRewardedVideoAd();
* videoAd.load().then(() => videoAd.show());
*
*/
createRewardedVideoAd
(){
return
sdk
.
createRewardedVideoAd
();
},
/**
*
* @param {*} obj
* @param {*} bannerAdUnitId
* 多个banner广告id调用如下:
* sdk.createBannerAd({},bannerAdUnitId).destroy();
* sdk.BannerAd =null;
* var bannerAd =sdk.createBannerAd({},bannerAdUnitId2);
* bannerAd.show();
*
*/
createBannerAdByAdId
(
obj
,
bannerAdUnitId
){
var
self
=
this
;
if
(
true
)
{
if
(
this
.
BannerAd
){
return
this
.
BannerAd
;
}
else
{
if
(
!
obj
.
style
){
obj
.
style
=
{};
var
phone
=
wx
.
getSystemInfoSync
();
this
.
w
=
phone
.
screenWidth
/
2
;
this
.
h
=
phone
.
screenHeight
;
obj
.
style
.
left
=
0
;
obj
.
style
.
top
=
0
;
obj
.
style
.
width
=
300
;
}
this
.
BannerAd
=
wx
.
createBannerAd
({
adUnitId
:
bannerAdUnitId
,
style
:
obj
.
style
,
})
this
.
BannerAd
.
onResize
(
function
(
res
){
console
.
log
(
"sdk BannerAd广告缩放事件:"
,
res
)
self
.
BannerAd
.
style
.
left
=
self
.
w
-
self
.
BannerAd
.
style
.
realWidth
/
2
+
0.1
;
self
.
BannerAd
.
style
.
top
=
self
.
h
-
self
.
BannerAd
.
style
.
realHeight
+
0.1
;
});
this
.
BannerAd
.
onLoad
(
function
(
res
){
console
.
log
(
"sdk BannerAd广告加载事件:"
,
res
)
});
this
.
BannerAd
.
onError
(
function
(
res
){
console
.
log
(
"sdk BannerAd广告错误事件:"
,
res
)
});
return
this
.
BannerAd
;
}
}
},
/**
*
* @param {*} videoAdUnitId1
*
*
*adSdk.videoSuccess1 = function(){
* //视频成功处理逻辑
* this.successFunction();
* };
* adSdk.videoFail1 = function(){
* //视频失败处理逻辑
* this.failFunction();`
* };
* 特别注意:下面这个videoAd为全局变量
* var videoAd1 = adSdk.createRewardedVideoAd(videoAdUnitId1);
* videoAd1.load().then(() => videoAd1.show());
*
*/
createRewardedVideoAd1
(
videoAdUnitId1
){
let
self
=
this
;
if
(
true
)
{
if
(
this
.
VideoAd1
){
return
this
.
VideoAd1
;
}
else
{
this
.
VideoAd1
=
wx
.
createRewardedVideoAd
({
adUnitId
:
videoAdUnitId1
})
this
.
VideoAd1
.
onLoad
(
function
(
res
){
console
.
log
(
"sdk VideoAd广告加载事件:"
,
res
)
});
var
closeFun1
=
function
(
res
){
// 用户点击了【关闭广告】按钮
// 小于 2.1.0 的基础库版本,res 是一个 undefined
if
(
res
&&
res
.
isEnded
||
res
===
undefined
)
{
console
.
log
(
"sdk 看视频成功"
);
self
.
videoSuccess1
();
}
else
{
console
.
error
(
"sdk 看视频失败"
);
self
.
videoFail1
();
}
};
this
.
VideoAd1
.
onClose
(
closeFun1
);
this
.
VideoAd1
.
onError
(
function
(
res
){
//console.log("sdk VideoAd广告错误事件:", res)
wx
.
showToast
({
title
:
'暂未开通,请谅解!'
,
icon
:
'none'
});
});
return
this
.
VideoAd1
;
}
}
},
/**
*
* @param {*} videoAdUnitId2
*
*
*adSdk.videoSuccess2 = function(){
* //视频成功处理逻辑
* this.successFunction();
* };
* adSdk.videoFail2 = function(){
* //视频失败处理逻辑
* this.failFunction();`
* };
* 特别注意:下面这个videoAd为全局变量
* var videoAd2 = adSdk.createRewardedVideoAd(videoAdUnitId2);
* videoAd2.load().then(() => videoAd2.show());
*
*/
createRewardedVideoAd2
(
videoAdUnitId2
){
let
self
=
this
;
if
(
true
)
{
if
(
this
.
VideoAd2
){
return
this
.
VideoAd2
;
}
else
{
this
.
VideoAd2
=
wx
.
createRewardedVideoAd
({
adUnitId
:
videoAdUnitId2
})
this
.
VideoAd2
.
onLoad
(
function
(
res
){
console
.
log
(
"sdk VideoAd广告加载事件:"
,
res
)
});
var
closeFun2
=
function
(
res
){
// 用户点击了【关闭广告】按钮
// 小于 2.1.0 的基础库版本,res 是一个 undefined
if
(
res
&&
res
.
isEnded
||
res
===
undefined
)
{
console
.
log
(
"sdk 看视频成功"
);
self
.
videoSuccess2
();
}
else
{
console
.
error
(
"sdk 看视频失败"
);
self
.
videoFail2
();
}
};
this
.
VideoAd2
.
onClose
(
closeFun2
);
this
.
VideoAd2
.
onError
(
function
(
res
){
//console.log("sdk VideoAd广告错误事件:", res)
wx
.
showToast
({
title
:
'暂未开通,请谅解!'
,
icon
:
'none'
});
});
return
this
.
VideoAd2
;
}
}
},
/**
*
* @param {*} videoAdUnitId3
*
*
*adSdk.videoSuccess3 = function(){
* //视频成功处理逻辑
* this.successFunction();
* };
* adSdk.videoFail3 = function(){
* //视频失败处理逻辑
* this.failFunction();`
* };
* var videoAd3 = adSdk.createRewardedVideoAd(videoAdUnitId3);
* videoAd3.load().then(() => videoAd3.show());
*
*/
createRewardedVideoAd3
(
videoAdUnitId3
){
let
self
=
this
;
if
(
true
)
{
if
(
this
.
VideoAd3
){
return
this
.
VideoAd3
;
}
else
{
this
.
VideoAd3
=
wx
.
createRewardedVideoAd
({
adUnitId
:
videoAdUnitId3
})
this
.
VideoAd3
.
onLoad
(
function
(
res
){
console
.
log
(
"sdk VideoAd广告加载事件:"
,
res
)
});
var
closeFun3
=
function
(
res
){
// 用户点击了【关闭广告】按钮
// 小于 2.1.0 的基础库版本,res 是一个 undefined
if
(
res
&&
res
.
isEnded
||
res
===
undefined
)
{
console
.
log
(
"sdk 看视频成功"
);
self
.
videoSuccess3
();
}
else
{
console
.
error
(
"sdk 看视频失败"
);
self
.
videoFail3
();
}
};
this
.
VideoAd3
.
onClose
(
closeFun3
);
this
.
VideoAd3
.
onError
(
function
(
res
){
//console.log("sdk VideoAd广告错误事件:", res)
wx
.
showToast
({
title
:
'暂未开通,请谅解!'
,
icon
:
'none'
});
});
return
this
.
VideoAd3
;
}
}
}
};
window
.
adSdk
=
adSdk
;
assets/llewan-laya-sdk/ad_sdk.js.meta
0 → 100644
View file @
95e38ed0
{
"ver": "1.0.5",
"uuid": "76a9ae71-a532-45e8-8a6e-d959fc353c11",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}
\ No newline at end of file
assets/llewan-laya-sdk/sdk.js
View file @
95e38ed0
...
@@ -1497,6 +1497,45 @@ var sdk = {
...
@@ -1497,6 +1497,45 @@ var sdk = {
}
}
}
}
},
},
createRewardedVideoAdByAdId
(
videoAdUnitId
)
{
let
self
=
this
;
if
(
true
)
{
if
(
this
.
VideoAd
)
{
return
this
.
VideoAd
;
}
else
{
this
.
VideoAd
=
wx
.
createRewardedVideoAd
({
adUnitId
:
videoAdUnitId
})
this
.
VideoAd
.
onLoad
(
function
(
res
)
{
console
.
log
(
"sdk VideoAd广告加载事件:"
,
res
)
});
var
closeFun
=
function
(
res
)
{
// 用户点击了【关闭广告】按钮
// 小于 2.1.0 的基础库版本,res 是一个 undefined
if
(
res
&&
res
.
isEnded
||
res
===
undefined
)
{
console
.
log
(
"sdk 看视频成功"
);
self
.
videoSuccess
();
}
else
{
console
.
error
(
"sdk 看视频失败"
);
self
.
videoFail
();
}
};
this
.
VideoAd
.
onClose
(
closeFun
);
this
.
VideoAd
.
onError
(
function
(
res
)
{
//console.log("sdk VideoAd广告错误事件:", res)
wx
.
showToast
({
title
:
'暂未开通,请谅解!'
,
icon
:
'none'
});
});
return
this
.
VideoAd
;
}
}
},
/**
/**
* @apiGroup C
* @apiGroup C
* @apiName Screenshot
* @apiName Screenshot
...
@@ -2319,7 +2358,7 @@ var sdk = {
...
@@ -2319,7 +2358,7 @@ var sdk = {
if
(
nextCacheVal
>
=
data
[
nextKey
].
count
)
{
if
(
nextCacheVal
>
data
[
nextKey
].
count
)
{
//当前缓存中的记录当前key的次数已经超过配置次数
//当前缓存中的记录当前key的次数已经超过配置次数
if
(
data
[
nextKey
].
next
==
'start'
)
{
if
(
data
[
nextKey
].
next
==
'start'
)
{
...
...
assets/llewan-laya-sdk/sdk_conf.js
View file @
95e38ed0
...
@@ -2,9 +2,9 @@ var sdk_conf = {
...
@@ -2,9 +2,9 @@ var sdk_conf = {
//.开发调试环境:prod 或 test,env_apis配合使用,主要是将接口切换正式环境和测试环境,上线务必修改为:prod
//.开发调试环境:prod 或 test,env_apis配合使用,主要是将接口切换正式环境和测试环境,上线务必修改为:prod
env
:
'prod'
,
env
:
'prod'
,
//.游戏唯一标识:由游戏技术修改
//.游戏唯一标识:由游戏技术修改
game
:
'
jinjibazuqi
u-weixin'
,
game
:
'
woyaoyangtiaogo
u-weixin'
,
//.当前游戏版本:由游戏技术修改
//.当前游戏版本:由游戏技术修改
version
:
'1.0.
0
'
,
version
:
'1.0.
4
'
,
//以下广告ID获取已经废弃,改成从服务端配置config4中获取
//以下广告ID获取已经废弃,改成从服务端配置config4中获取
//.banner广告单元id
//.banner广告单元id
...
...
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