Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
D
db-game-template
Project
Project
Details
Activity
Releases
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
崔立强
db-game-template
Commits
ae3f1e22
Commit
ae3f1e22
authored
Oct 30, 2018
by
wildfirecode
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update
parent
32f692d5
Changes
8
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
23 additions
and
37 deletions
+23
-37
GFun.ts
egret/libs/tc/util/GFun.ts
+2
-0
isIPhoneX.ts
egret/libs/tc/utils/isIPhoneX.ts
+4
-2
MainBase.ts
egret/libs/tl/MainBase.ts
+1
-33
AssetAdapter.ts
egret/libs/tl/adapter/AssetAdapter.ts
+1
-0
ThemeAdapter.ts
egret/libs/tl/adapter/ThemeAdapter.ts
+2
-0
Main.ts
egret/src/Main.ts
+1
-1
package.json
package.json
+1
-1
tslint.json
tslint.json
+11
-0
No files found.
egret/libs/tc/util/GFun.ts
View file @
ae3f1e22
...
...
@@ -75,10 +75,12 @@ export const check_webp_feature = () => {
return
_support_webp_
===
'1'
;
}
const
img
=
new
Image
();
// tslint:disable-next-line:only-arrow-functions
img
.
onload
=
function
()
{
const
result
=
(
img
.
width
>
0
)
&&
(
img
.
height
>
0
);
localStorage
.
setItem
(
'_support_webp_'
,
result
?
'1'
:
'0'
)
};
// tslint:disable-next-line:only-arrow-functions
img
.
onerror
=
function
()
{
localStorage
.
setItem
(
'_support_webp_'
,
'0'
)
};
...
...
egret/libs/tc/utils/isIPhoneX.ts
View file @
ae3f1e22
export
default
function
isIPhoneX
()
{
const
isIPhoneX
=
()
=>
{
var
u
=
navigator
.
userAgent
;
var
isIOS
=
!!
u
.
match
(
/
\(
i
[^
;
]
+;
(
U;
)?
CPU.+Mac OS X/
);
//ios终端
return
isIOS
&&
screen
.
height
==
812
&&
screen
.
width
==
375
}
export
default
isIPhoneX
\ No newline at end of file
egret/libs/tl/MainBase.ts
View file @
ae3f1e22
...
...
@@ -3,11 +3,10 @@ import SceneCtrl from "../../src/ctrls/sceneCtrl";
import
Loading
from
"../../src/loading/Loading"
;
import
{
getResPath
}
from
"../../src/utils"
;
import
layers
from
"../../src/views/layers"
;
import
{
check_webp_feature
}
from
"../tc/util/GFun"
;
import
{
DataManager
}
from
"../tw/manager/DataManager"
;
import
{
NetManager
}
from
"../tw/manager/NetManager"
;
import
AssetAdapter
from
"./adapter/AssetAdapter"
;
import
ThemeAdapter
from
"./adapter/ThemeAdapter"
;
import
{
check_webp_feature
}
from
"../tc/util/GFun"
;
export
default
class
MainBase
extends
eui
.
UILayer
{
constructor
()
{
...
...
@@ -15,36 +14,6 @@ export default class MainBase extends eui.UILayer {
check_webp_feature
();
}
private
injectRES
()
{
if
(
RES
.
fileSystem
[
'getFileOld'
])
return
;
RES
.
fileSystem
[
'getFileOld'
]
=
RES
.
fileSystem
.
getFile
;
window
[
'RES'
].
fileSystem
.
getFile
=
function
(
filename
:
string
)
{
//生效情况
//RES.getResByUrl spritesheet类型
//不生效
//RES.getResAsync('net_png') spritesheet类型
// if (filename.indexOf('.json') != -1) {
// var arr = filename.split('.json')[0].split('/');
// var filename1 = arr[arr.length - 1] + '_png';
// var filename2 = filename.split('.json')[0] + '.png';
// if (!RES.fileSystem['fsData'][filename1])
// RES.fileSystem['fsData'][filename1] =
// { name: filename1, type: 'image', url: filename2, root: '', extra: '1' };
// }
var
result
=
RES
.
fileSystem
[
'getFileOld'
](
filename
);
if
(
result
&&
result
.
url
&&
check_webp_feature
())
{
//生效情况
//RES.getResByUrl jpg or png类型
//RES.getResAsync('monkey_png')
if
(
filename
.
indexOf
(
'png'
)
!=
-
1
||
filename
.
indexOf
(
'jpg'
)
!=
-
1
)
result
=
JSON
.
parse
(
JSON
.
stringify
(
result
));
// result.url = result.url.replace('.png', '.png?x-oss-process=image/format,webp');
result
.
url
=
result
.
url
.
replace
(
'.jpg'
,
'.jpg?x-oss-process=image/format,webp'
);
}
return
result
;
}
}
protected
createChildren
():
void
{
super
.
createChildren
();
egret
.
lifecycle
.
addLifecycleListener
((
context
)
=>
{
...
...
@@ -107,7 +76,6 @@ export default class MainBase extends eui.UILayer {
try
{
await
RES
.
loadConfig
(
"default.res.json"
,
getResPath
()
+
"resource/"
);
await
this
.
loadTheme
();
// this.injectRES();
}
catch
(
e
)
{
console
.
error
(
e
);
...
...
egret/libs/tl/adapter/AssetAdapter.ts
View file @
ae3f1e22
...
...
@@ -7,6 +7,7 @@ export default class AssetAdapter implements eui.IAssetAdapter {
* @param thisObject callBack的 this 引用
*/
public
getAsset
(
source
:
string
,
compFunc
:
Function
,
thisObject
:
any
):
void
{
// tslint:disable-next-line:only-arrow-functions
function
onGetRes
(
data
:
any
):
void
{
compFunc
.
call
(
thisObject
,
data
,
source
);
}
...
...
egret/libs/tl/adapter/ThemeAdapter.ts
View file @
ae3f1e22
...
...
@@ -9,9 +9,11 @@ export default class ThemeAdapter implements eui.IThemeAdapter {
*/
public
getTheme
(
url
:
string
,
onSuccess
:
Function
,
onError
:
Function
,
thisObject
:
any
):
void
{
// tslint:disable-next-line:only-arrow-functions
function
onResGet
(
e
:
string
):
void
{
onSuccess
.
call
(
thisObject
,
e
);
}
// tslint:disable-next-line:only-arrow-functions
function
onResError
(
e
:
RES
.
ResourceEvent
):
void
{
if
(
e
.
resItem
.
url
==
url
)
{
RES
.
removeEventListener
(
RES
.
ResourceEvent
.
ITEM_LOAD_ERROR
,
onResError
,
null
);
...
...
egret/src/Main.ts
View file @
ae3f1e22
...
...
@@ -36,7 +36,7 @@ class Main extends MainBase {
window
[
'Main'
]
=
Main
;
egret
.
runEgret
({
renderMode
:
"webgl"
,
audioType
:
0
,
calculateCanvasScaleFactor
:
function
(
context
:
any
)
{
renderMode
:
"webgl"
,
audioType
:
0
,
calculateCanvasScaleFactor
:
(
context
:
any
)
=>
{
var
backingStore
=
context
.
backingStorePixelRatio
||
context
.
webkitBackingStorePixelRatio
||
context
.
mozBackingStorePixelRatio
||
...
...
package.json
View file @
ae3f1e22
tslint.json
0 → 100644
View file @
ae3f1e22
{
"defaultSeverity"
:
"error"
,
"extends"
:
[
//
"tslint:recommended"
],
"jsRules"
:
{},
"rules"
:
{
"only-arrow-functions"
:
true
},
"rulesDirectory"
:
[]
}
\ No newline at end of file
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