Skip to content

Commit 05267f2

Browse files
committed
同步内网更新1.8.17版本
1 parent f36a0ab commit 05267f2

103 files changed

Lines changed: 14548 additions & 2532 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

core/src/laya/display/Stage.as

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -468,12 +468,14 @@ package laya.display {
468468
mat.d = _formatData(mat.d);
469469
mat.tx = _formatData(mat.tx);
470470
mat.ty = _formatData(mat.ty);
471-
canvasStyle.transformOrigin = canvasStyle.webkitTransformOrigin = canvasStyle.msTransformOrigin = canvasStyle.mozTransformOrigin = canvasStyle.oTransformOrigin = "0px 0px 0px";
472-
canvasStyle.transform = canvasStyle.webkitTransform = canvasStyle.msTransform = canvasStyle.mozTransform = canvasStyle.oTransform = "matrix(" + mat.toString() + ")";
473-
canvasStyle.width = canvasWidth;
474-
canvasStyle.height = canvasHeight;
475-
//修正用户自行设置的偏移
476-
mat.translate(parseInt(canvasStyle.left) || 0, parseInt(canvasStyle.top) || 0);
471+
if (!Browser.onTBMiniGame) {
472+
canvasStyle.transformOrigin = canvasStyle.webkitTransformOrigin = canvasStyle.msTransformOrigin = canvasStyle.mozTransformOrigin = canvasStyle.oTransformOrigin = "0px 0px 0px";
473+
canvasStyle.transform = canvasStyle.webkitTransform = canvasStyle.msTransform = canvasStyle.mozTransform = canvasStyle.oTransform = "matrix(" + mat.toString() + ")";
474+
canvasStyle.width = canvasWidth;
475+
canvasStyle.height = canvasHeight;
476+
//修正用户自行设置的偏移
477+
mat.translate(parseInt(canvasStyle.left) || 0, parseInt(canvasStyle.top) || 0);
478+
}
477479
visible = true;
478480
_repaint = 1;
479481
event(Event.RESIZE);

core/src/laya/net/URL.as

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ package laya.net {
1111
private var _url:String;
1212
/**@private */
1313
private var _path:String;
14+
15+
public static _basePath:String;
1416

1517
/**创建一个新的 <code>URL</code> 实例。*/
1618
public function URL(url:String) {

core/src/laya/renders/Render.as

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,11 @@ package laya.renders {
4444

4545
public function Render(width:Number, height:Number) {
4646
var style:* = _mainCanvas.source.style;
47-
style.position = 'absolute';
48-
style.top = style.left = "0px";
49-
style.background = "#000000";
47+
if (!Browser.onTBMiniGame) {
48+
style.position = 'absolute';
49+
style.top = style.left = "0px";
50+
style.background = "#000000";
51+
}
5052

5153
_mainCanvas.source.id = "layaCanvas";
5254
var isWebGl:Boolean = Render.isWebGL;

core/src/laya/utils/Browser.as

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -138,27 +138,27 @@ package laya.utils {
138138
onEdge = /*[STATIC SAFE]*/ u.indexOf('Edge') > -1;
139139
onMiniGame = /*[STATIC SAFE]*/ u.indexOf('MiniGame') > -1;
140140
onBDMiniGame = /*[STATIC SAFE]*/ u.indexOf('SwanGame') > -1;
141-
onHWMiniGame = /*[STATIC SAFE]*/ Browser.window.hasOwnProperty("hbs");
141+
onHWMiniGame = /*[STATIC SAFE]*/ Browser.window.hasOwnProperty && Browser.window.hasOwnProperty("hbs");
142142

143143
if(u.indexOf('OPPO') > -1 && u.indexOf('MiniGame') > -1)
144144
{
145145
onQGMiniGame = true;//OPPO环境判断
146146
onMiniGame = false;
147147
}
148148

149-
if (Browser.window.hasOwnProperty("bl") && u.indexOf('MiniGame') >-1)
149+
if (Browser.window.hasOwnProperty && Browser.window.hasOwnProperty("bl") && u.indexOf('MiniGame') >-1)
150150
{
151151
onBLMiniGame=true;//BILI环境判断
152152
onMiniGame=false;
153153
}
154154

155-
if (Browser.window.hasOwnProperty("qq") && u.indexOf('MiniGame') >-1)
155+
if (Browser.window.hasOwnProperty && Browser.window.hasOwnProperty("qq") && u.indexOf('MiniGame') >-1)
156156
{
157157
onQQMiniGame=true;//QQ环境判断
158158
onMiniGame=false;
159159
}
160160

161-
if (Browser.window.hasOwnProperty("tt") && u.indexOf('MiniGame') > -1)
161+
if (Browser.window.hasOwnProperty && Browser.window.hasOwnProperty("tt") && u.indexOf('MiniGame') > -1)
162162
{
163163
onTTMiniGame = true;
164164
onMiniGame = false;
@@ -175,7 +175,7 @@ package laya.utils {
175175
onAlipayMiniGame = true;//阿里小游戏环境判断
176176
onMiniGame = false;
177177
}
178-
if ((u.indexOf('TB') > -1 || u.indexOf('Taobao') > -1 || u.indexOf('TM/') >-1) && Browser.window.hasOwnProperty('my'))
178+
if ((u.indexOf('TB') > -1 || u.indexOf('Taobao') > -1 || u.indexOf('TM/') >-1))
179179
{
180180
onTBMiniGame = true;
181181
}

plugins/tb/src/laya/tb/mini/MiniSound.as

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,8 +134,8 @@ package laya.tb.mini
134134
if(tempFilePath == "")
135135
{
136136
if (MiniFileMgr.isLocalNativeFile(sourceUrl)) {
137-
var tempStr:string = URL.rootPath != "" ? URL.rootPath : URL._basePath;
138-
var tempUrl:string = sourceUrl;
137+
var tempStr:String = URL.rootPath != "" ? URL.rootPath : URL._basePath;
138+
var tempUrl:String = sourceUrl;
139139
if(tempStr != "" && (sourceUrl.indexOf("http://") != -1 || sourceUrl.indexOf("https://") != -1))
140140
fileNativeUrl = sourceUrl.split(tempStr)[1];//去掉http头
141141
if(!fileNativeUrl)
Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
package laya.tbgame.mini
2+
{
3+
import laya.events.EventDispatcher;
4+
5+
/**@private **/
6+
public class MiniAccelerator extends EventDispatcher
7+
{
8+
9+
public function MiniAccelerator()
10+
{
11+
12+
}
13+
/**@private **/
14+
public static function __init__():void
15+
{
16+
try
17+
{
18+
var Acc:*;
19+
Acc = __JS__("laya.device.motion.Accelerator");
20+
if (!Acc) return;
21+
Acc["prototype"]["on"] = MiniAccelerator["prototype"]["on"];
22+
Acc["prototype"]["off"] = MiniAccelerator["prototype"]["off"];
23+
}catch (e:*)
24+
{
25+
26+
}
27+
}
28+
/**@private **/
29+
private static var _isListening:Boolean = false;
30+
/**@private **/
31+
private static var _callBack:Function;
32+
/**@private **/
33+
public static function startListen(callBack:Function):void
34+
{
35+
_callBack = callBack;
36+
if (_isListening) return;
37+
_isListening = true;
38+
try
39+
{
40+
TBMiniGameAdapter.window.my.onAccelerometerChange(MiniAccelerator.onAccelerometerChange);
41+
}catch(e:*){}
42+
43+
}
44+
45+
/**@private **/
46+
public static function stopListen():void
47+
{
48+
_isListening = false;
49+
try
50+
{
51+
TBMiniGameAdapter.window.my.stopAccelerometer({});
52+
}catch(e:*){}
53+
54+
}
55+
/**@private **/
56+
private static function onAccelerometerChange(res:Object):void
57+
{
58+
var e:Object;
59+
e = { };
60+
e.acceleration = res;
61+
e.accelerationIncludingGravity = res;
62+
e.rotationRate = { };
63+
if (_callBack != null)
64+
{
65+
_callBack(e);
66+
}
67+
}
68+
69+
/**
70+
* 侦听加速器运动。
71+
* @param observer 回调函数接受4个参数,见类说明。
72+
*/
73+
override public function on(type:String, caller:*, listener:Function, args:Array = null):EventDispatcher
74+
{
75+
super.on(type, caller, listener, args);
76+
startListen(this["onDeviceOrientationChange"]);
77+
return this;
78+
}
79+
80+
/**
81+
* 取消侦听加速器。
82+
* @param handle 侦听加速器所用处理器。
83+
*/
84+
override public function off(type:String, caller:*, listener:Function, onceOnly:Boolean = false):EventDispatcher
85+
{
86+
if (!hasListener(type))
87+
stopListen();
88+
89+
return super.off(type, caller, listener, onceOnly);
90+
}
91+
}
92+
93+
}

0 commit comments

Comments
 (0)