Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
X
xiaoxiaole
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
wildfirecode13
xiaoxiaole
Commits
88df60fa
Commit
88df60fa
authored
Sep 03, 2019
by
wjf
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
l
parent
d7b02efb
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
170 additions
and
73 deletions
+170
-73
guideBg.png
egret/resource/assets/mainScene/guideBg.png
+0
-0
MainScene.ts
egret/src/mainScene/MainScene.ts
+28
-11
GuideCon.ts
egret/src/mapScene/GuideCon.ts
+3
-0
GuideMsg.ts
egret/src/something/uis/GuideMsg.ts
+29
-62
GuideMsg1.ts
egret/src/something/uis/GuideMsg1.ts
+110
-0
No files found.
egret/resource/assets/mainScene/guideBg.png
View replaced file @
d7b02efb
View file @
88df60fa
44.8 KB
|
W:
|
H:
36.2 KB
|
W:
|
H:
2-up
Swipe
Onion skin
egret/src/mainScene/MainScene.ts
View file @
88df60fa
...
...
@@ -42,11 +42,13 @@ import { PropNumShow } from '../something/uis/PropNumShow';
import
{
ScoreProgress
}
from
'../something/uis/ScoreProgress'
;
import
{
StepNumber
}
from
'../something/uis/StepNumber'
;
import
{
getBgOn
,
getSoundOn
,
playSound
,
SoundType
,
stopBg
,
toggleSound
}
from
'../soundCtrl'
;
import
{
playGameBg
,
toggleGameBg
}
from
'../soundCtrl2'
;
import
{
playGameBg
,
toggleGameBg
}
from
'../soundCtrl2'
;
import
{
createData
}
from
'../startScene/StartScene'
;
import
{
DataManager
}
from
'./../../libs/tw/manager/DataManager'
;
import
{
NetManager
}
from
'./../../libs/tw/manager/NetManager'
;
import
{
Buried
}
from
'./../../libs/tw/util/Buried'
;
import
{
GuideMsg
}
from
'../something/uis/GuideMsg'
;
import
{
readCache
,
getCacheKey
}
from
'../mapScene/GuideCon'
;
const
aniClass
=
{
"BoomAni"
:
BoomAni
,
...
...
@@ -257,16 +259,31 @@ export default class MainScene extends Scene {
//引导提示
// if (this.chapter <= 5) {
// Loading2.instace.show()
// let g = new GuideMsg();
// g.init(3, () => {
// Loading2.instace.hide()
// this.addChild(g);
// // this.enableMouseEvt(true);
// })
// } else {
// }
var
guideImageNum
:
number
;
if
(
this
.
chapter
<=
5
)
{
guideImageNum
=
this
.
chapter
;
}
else
if
(
this
.
chapter
==
11
)
{
guideImageNum
=
8
;
}
else
if
(
this
.
chapter
==
20
)
{
guideImageNum
=
6
;
}
else
if
(
this
.
chapter
==
24
)
{
guideImageNum
=
7
;
}
if
(
guideImageNum
&&
!
readCache
(
getCacheKey
()
+
guideImageNum
))
{
Loading2
.
instace
.
show
()
let
g
=
new
GuideMsg
();
g
.
init
(
guideImageNum
,
()
=>
{
Loading2
.
instace
.
hide
()
this
.
addChild
(
g
);
},
()
=>
{
Loading2
.
instace
.
hide
()
})
}
//开启事件,具体不应该放在这里,到时看
// this.enableMouseEvt(true);
//测试代码
...
...
egret/src/mapScene/GuideCon.ts
View file @
88df60fa
...
...
@@ -4,6 +4,9 @@ import { ShowWord } from "../something/uis/ShowWord";
let
cacheKey
=
"happyClear"
+
window
[
"CFG"
].
consumerId
;
export
const
getCacheKey
=
()
=>
{
return
cacheKey
}
/**
* 读取缓存
*/
...
...
egret/src/something/uis/GuideMsg.ts
View file @
88df60fa
import
getResPath
from
"../../../libs/new_tc/getResPath"
;
import
{
writeCache
,
getCacheKey
}
from
"../../mapScene/GuideCon"
;
const
rrr
=
"//yun.duiba.com.cn/db_games/activity/game/guideImage/guide"
;
const
moiveClip
=
{};
const
resPath
=
getResPath
()
const
parser
=
new
window
[
"SVGA"
].
Parser
();
/**
* 引导
*/
...
...
@@ -10,11 +10,9 @@ export class GuideMsg extends egret.DisplayObjectContainer {
bg
:
egret
.
Bitmap
;
knowBtn
:
egret
.
Bitmap
;
closeBtn
:
egret
.
Bitmap
;
msgTxt
:
egret
.
Bitmap
;
moiveClip
;
guideImageNum
:
number
;
/**
* closeCommonBtn_png
* @param num 1到5的引导
*/
constructor
()
{
super
()
...
...
@@ -26,85 +24,54 @@ export class GuideMsg extends egret.DisplayObjectContainer {
this
.
addChild
(
shape
);
//背景图
this
.
bg
=
new
egret
.
Bitmap
(
RES
.
getRes
(
"guideBg_png"
));
this
.
bg
.
x
=
(
750
-
639
)
/
2
;
this
.
bg
.
x
=
(
750
-
580
)
/
2
;
this
.
bg
.
y
=
300
;
this
.
addChild
(
this
.
bg
);
//关闭按钮
this
.
closeBtn
=
new
egret
.
Bitmap
(
RES
.
getRes
(
"closeCommonBtn_png"
));
this
.
closeBtn
.
x
=
6
15
;
this
.
closeBtn
.
y
=
300
;
this
.
closeBtn
.
x
=
6
00
;
this
.
closeBtn
.
y
=
285
;
this
.
closeBtn
.
touchEnabled
=
true
;
this
.
addChild
(
this
.
closeBtn
);
this
.
closeBtn
.
addEventListener
(
egret
.
TouchEvent
.
TOUCH_TAP
,
function
()
{
if
(
this
.
parent
)
this
.
parent
.
removeChild
(
this
)
writeCache
(
getCacheKey
()
+
this
.
guideImageNum
);
},
this
)
//知道了
this
.
knowBtn
=
new
egret
.
Bitmap
(
RES
.
getRes
(
"guideKnowBtn_png"
));
this
.
knowBtn
.
x
=
(
750
-
266
)
/
2
;
this
.
knowBtn
.
y
=
80
0
;
this
.
knowBtn
.
y
=
75
0
;
this
.
knowBtn
.
touchEnabled
=
true
;
this
.
addChild
(
this
.
knowBtn
);
this
.
knowBtn
.
addEventListener
(
egret
.
TouchEvent
.
TOUCH_TAP
,
function
()
{
if
(
this
.
parent
)
this
.
parent
.
removeChild
(
this
)
writeCache
(
getCacheKey
()
+
this
.
guideImageNum
);
},
this
)
}
/**
*
* @param
n
um
* @param
guideImageN
um
* @param callback 里面是移除转圈,加进场景
*/
init
(
num
:
number
,
callback
:
Function
)
{
//移除原先的svga
if
(
this
.
moiveClip
)
this
.
removeChild
(
this
.
moiveClip
);
//svga
if
(
moiveClip
[
"guide"
+
num
])
{
this
.
moiveClip
=
moiveClip
[
"guide"
+
num
];
this
.
addChild
(
moiveClip
[
"guide"
+
num
]);
callback
();
}
else
{
parser
.
load
(
resPath
+
'resource/assets/svgas/'
+
'guide'
+
num
+
'.svga'
,
(
videoItem
)
=>
{
var
mv
=
new
window
[
"SVGA"
].
EgretMovieClip
(
videoItem
);
mv
.
lockStep
=
true
;
mv
.
x
=
3
;
mv
.
y
=
-
263
;
this
.
moiveClip
=
mv
;
this
.
addChild
(
mv
);
moiveClip
[
"guide"
+
num
]
=
mv
;
callback
();
},
function
(
error
)
{
// alert(error.message);
})
}
this
.
initTxt
(
num
)
}
//调位置
private
initTxt
(
num
:
number
)
{
if
(
!
this
.
msgTxt
)
{
this
.
msgTxt
=
new
egret
.
Bitmap
();
this
.
addChild
(
this
.
msgTxt
);
init
(
guideImageNum
:
number
,
callback
:
Function
,
onerror
:
Function
)
{
this
.
guideImageNum
=
guideImageNum
;
let
imgTag
=
new
Image
();
imgTag
.
setAttribute
(
'crossOrigin'
,
'anonymous'
);
imgTag
.
onload
=
()
=>
{
var
bitmapData
=
new
egret
.
BitmapData
(
imgTag
);
var
texture
=
new
egret
.
Texture
();
texture
.
bitmapData
=
bitmapData
;
var
bitmap
=
new
egret
.
Bitmap
(
texture
);
bitmap
.
x
=
(
750
-
481
)
/
2
;
bitmap
.
y
=
380
;
this
.
addChild
(
bitmap
);
callback
()
}
let
y
:
number
;
switch
(
num
)
{
case
1
:
y
=
705
;
break
;
case
2
:
y
=
685
;
break
;
case
3
:
y
=
685
;
break
;
case
4
:
y
=
685
;
break
;
case
5
:
y
=
705
;
break
;
imgTag
.
src
=
rrr
+
guideImageNum
+
".png"
;
imgTag
.
onerror
=
()
=>
{
onerror
();
}
var
texture
:
egret
.
Texture
=
RES
.
getRes
(
"guideTxt"
+
num
+
"_png"
);
this
.
msgTxt
.
texture
=
texture
;
this
.
msgTxt
.
x
=
(
750
-
texture
.
textureWidth
)
/
2
;
this
.
msgTxt
.
y
=
y
;
}
}
\ No newline at end of file
egret/src/something/uis/GuideMsg1.ts
0 → 100644
View file @
88df60fa
import
getResPath
from
"../../../libs/new_tc/getResPath"
;
const
moiveClip
=
{};
const
resPath
=
getResPath
()
const
parser
=
new
window
[
"SVGA"
].
Parser
();
/**
* 引导
*/
export
class
GuideMsg
extends
egret
.
DisplayObjectContainer
{
bg
:
egret
.
Bitmap
;
knowBtn
:
egret
.
Bitmap
;
closeBtn
:
egret
.
Bitmap
;
msgTxt
:
egret
.
Bitmap
;
moiveClip
;
/**
* closeCommonBtn_png
* @param num 1到5的引导
*/
constructor
()
{
super
()
var
shape
:
egret
.
Shape
=
new
egret
.
Shape
();
shape
.
graphics
.
beginFill
(
0x000000
,
0.7
);
shape
.
graphics
.
drawRect
(
0
,
0
,
750
,
1624
);
shape
.
graphics
.
endFill
();
shape
.
touchEnabled
=
true
;
this
.
addChild
(
shape
);
//背景图
this
.
bg
=
new
egret
.
Bitmap
(
RES
.
getRes
(
"guideBg_png"
));
this
.
bg
.
x
=
(
750
-
639
)
/
2
;
this
.
bg
.
y
=
300
;
this
.
addChild
(
this
.
bg
);
//关闭按钮
this
.
closeBtn
=
new
egret
.
Bitmap
(
RES
.
getRes
(
"closeCommonBtn_png"
));
this
.
closeBtn
.
x
=
615
;
this
.
closeBtn
.
y
=
300
;
this
.
closeBtn
.
touchEnabled
=
true
;
this
.
addChild
(
this
.
closeBtn
);
this
.
closeBtn
.
addEventListener
(
egret
.
TouchEvent
.
TOUCH_TAP
,
function
()
{
if
(
this
.
parent
)
this
.
parent
.
removeChild
(
this
)
},
this
)
//知道了
this
.
knowBtn
=
new
egret
.
Bitmap
(
RES
.
getRes
(
"guideKnowBtn_png"
));
this
.
knowBtn
.
x
=
(
750
-
266
)
/
2
;
this
.
knowBtn
.
y
=
800
;
this
.
knowBtn
.
touchEnabled
=
true
;
this
.
addChild
(
this
.
knowBtn
);
this
.
knowBtn
.
addEventListener
(
egret
.
TouchEvent
.
TOUCH_TAP
,
function
()
{
if
(
this
.
parent
)
this
.
parent
.
removeChild
(
this
)
},
this
)
}
/**
*
* @param num
* @param callback 里面是移除转圈,加进场景
*/
init
(
num
:
number
,
callback
:
Function
)
{
//移除原先的svga
if
(
this
.
moiveClip
)
this
.
removeChild
(
this
.
moiveClip
);
//svga
if
(
moiveClip
[
"guide"
+
num
])
{
this
.
moiveClip
=
moiveClip
[
"guide"
+
num
];
this
.
addChild
(
moiveClip
[
"guide"
+
num
]);
callback
();
}
else
{
parser
.
load
(
resPath
+
'resource/assets/svgas/'
+
'guide'
+
num
+
'.svga'
,
(
videoItem
)
=>
{
var
mv
=
new
window
[
"SVGA"
].
EgretMovieClip
(
videoItem
);
mv
.
lockStep
=
true
;
mv
.
x
=
3
;
mv
.
y
=
-
263
;
this
.
moiveClip
=
mv
;
this
.
addChild
(
mv
);
moiveClip
[
"guide"
+
num
]
=
mv
;
callback
();
},
function
(
error
)
{
// alert(error.message);
})
}
this
.
initTxt
(
num
)
}
//调位置
private
initTxt
(
num
:
number
)
{
if
(
!
this
.
msgTxt
)
{
this
.
msgTxt
=
new
egret
.
Bitmap
();
this
.
addChild
(
this
.
msgTxt
);
}
let
y
:
number
;
switch
(
num
)
{
case
1
:
y
=
705
;
break
;
case
2
:
y
=
685
;
break
;
case
3
:
y
=
685
;
break
;
case
4
:
y
=
685
;
break
;
case
5
:
y
=
705
;
break
;
}
var
texture
:
egret
.
Texture
=
RES
.
getRes
(
"guideTxt"
+
num
+
"_png"
);
this
.
msgTxt
.
texture
=
texture
;
this
.
msgTxt
.
x
=
(
750
-
texture
.
textureWidth
)
/
2
;
this
.
msgTxt
.
y
=
y
;
}
}
\ 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