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
29e6f2ee
Commit
29e6f2ee
authored
Apr 10, 2020
by
zjz1994
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改猩猩状态暂存
parent
56df5beb
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
176 additions
and
10 deletions
+176
-10
xingxing.svga
egret/resource/assets/svgas/xingxing.svga
+0
-0
MainScene.ts
egret/src/mainScene/MainScene.ts
+52
-3
getChapter.ts
egret/src/something/chapters/getChapter.ts
+1
-0
Element.ts
egret/src/something/class/Element.ts
+122
-6
PongoLockState.ts
egret/src/something/states/PongoLockState.ts
+1
-1
No files found.
egret/resource/assets/svgas/xingxing.svga
0 → 100644
View file @
29e6f2ee
File added
egret/src/mainScene/MainScene.ts
View file @
29e6f2ee
...
...
@@ -166,6 +166,8 @@ let cannofire1mvdata:any = null;
let
cannolightmvdata
:
any
=
null
;
let
cannoparticlemvdata
:
any
=
null
;
let
pongomvdata
:
any
=
null
;
//红包炸弹弹框名字
const
redBombPanelName
=
"RedBombAlert"
;
...
...
@@ -1089,7 +1091,9 @@ export default class MainScene extends Scene {
}
else
{
if
(
!
svgaParser
)
svgaParser
=
new
window
[
"SVGA"
].
Parser
();
svgaParser
.
load
(
resPath
+
'resource/assets/svgas/canno1.svga'
,(
videoItem
)
=>
{
cannomvdata
=
videoItem
;
if
(
!
cannomvdata
){
cannomvdata
=
videoItem
;
}
canno
.
createCanno
(
cannomvdata
);
})
}
...
...
@@ -1116,6 +1120,19 @@ export default class MainScene extends Scene {
this
.
elementContainer
.
addChild
(
pongo
);
pongo
.
setPongoPart
(
inpart
);
this
.
lattices
[
i
].
element
=
pongo
;
if
(
inpart
==
"tl"
){
if
(
pongomvdata
){
pongo
.
createPongo
(
pongomvdata
);
}
else
{
if
(
!
svgaParser
)
svgaParser
=
new
window
[
"SVGA"
].
Parser
();
svgaParser
.
load
(
resPath
+
'resource/assets/svgas/xingxing.svga'
,(
videoItem
)
=>
{
if
(
!
pongomvdata
){
pongomvdata
=
videoItem
;
}
pongo
.
createPongo
(
pongomvdata
);
})
}
}
break
;
default
:
//其他标识按空元素记
...
...
@@ -4110,7 +4127,7 @@ export default class MainScene extends Scene {
lockPongoArr
.
push
(
ilockpongo
);
//解锁猩猩被锁状态
lat
.
element
.
removePongoLockStat
(
);
this
.
changePongoStat
(
lat
.
element
);
}
// }
}
...
...
@@ -4119,6 +4136,35 @@ export default class MainScene extends Scene {
//本次全地图解锁的猩猩部分处理
this
.
solvePongoEle
(
lockPongoArr
);
}
//消除动画中的猩猩解锁状态
changePongoStat
(
ele
:
Element
){
var
pongopart
=
ele
.
inPongoPart
;
var
eleidx
=
ele
.
index
;
var
tlidx
:
number
;
switch
(
pongopart
){
case
"tl"
:
tlidx
=
eleidx
;
break
;
case
"tr"
:
tlidx
=
eleidx
-
1
;
break
;
case
"bl"
:
tlidx
=
eleidx
-
Tool
.
colNum
;
break
;
case
"br"
:
tlidx
=
eleidx
-
Tool
.
colNum
-
1
;
break
;
default
:
console
.
error
(
"未定义猩猩解锁"
);
break
;
}
if
(
this
.
lattices
[
tlidx
]
&&
this
.
lattices
[
tlidx
].
element
){
var
tlele
:
Element
=
this
.
lattices
[
tlidx
].
element
;
tlele
.
changePongoStat
(
pongopart
);
}
ele
.
removePongoLockStat
();
}
//横纵特效穿过解救猩猩
checkPongoHVEle
(
row
:
number
,
col
:
number
,
dir
:
string
){
var
lockPongoArr
:
Array
<
{
idx
:
number
,
part
:
string
}
>
=
new
Array
();
...
...
@@ -4171,7 +4217,7 @@ export default class MainScene extends Scene {
part
:
lat
.
element
.
inPongoPart
}
lockPongoArr
.
push
(
ilockpongo
);
lat
.
element
.
removePongoLockStat
(
);
this
.
changePongoStat
(
lat
.
element
);
}
}
return
3
;
...
...
@@ -4546,6 +4592,9 @@ export default class MainScene extends Scene {
//先赋值指向
let
ele
=
this
.
lattices
[
index
].
element
;
//猩猩新增,去除ticker
ele
.
addDisable
();
//添加进emptys
this
.
emptys
.
push
(
index
)
//从容器移除
...
...
egret/src/something/chapters/getChapter.ts
View file @
29e6f2ee
...
...
@@ -71,6 +71,7 @@ chapters.forEach((chapter,index) => {
*/
export
function
getChapterData
(
index
:
number
):
ChapterData
{
//没有数据就返回第一关数据
return
chapters
[
576
];
return
chapters
[
index
]
||
chapters
[
1
];
}
...
...
egret/src/something/class/Element.ts
View file @
29e6f2ee
...
...
@@ -31,6 +31,7 @@ import { State } from "./State";
import
wait
from
"../../../libs/new_tc/wait"
;
import
{
Fish
}
from
"./Fish"
;
import
MainScene
from
"../../mainScene/MainScene"
;
import
MovieClip
from
"../../movieclip/MovieClip"
;
/**
* 考虑到底继承白鹭的啥Component还是Container
* 坐标原点需要坐落在格子的中心点
...
...
@@ -39,6 +40,13 @@ import MainScene from "../../mainScene/MainScene";
//加载器
let
svgaParser
;
//猩猩新增草idx
enum
grassPongo
{
tl
=
"7,9"
,
tr
=
"4,6"
,
bl
=
"2"
,
br
=
"3"
}
export
class
Element
extends
eui
.
Component
{
private
_fishState
=
0
;
private
_isNeb
:
boolean
;
//是否
...
...
@@ -218,6 +226,18 @@ export class Element extends eui.Component {
}
//猩猩的哪个部分
inPongoPart
:
string
;
pongoMoveClip
:
any
;
/**
* 猩猩草的位置
* 2--左脚
* 3--右脚
* 4,6--右手
* 7,9--左手
*/
noseeimgs
:
Array
<
number
>
=
[];
// 剩余显示部分
lessPart
:
Array
<
string
>
=
[];
//暂给猩猩两种状态,normal正常,readyelm准备消除
/**
* 设置为猩猩的一部分
...
...
@@ -227,12 +247,7 @@ export class Element extends eui.Component {
this
.
inPongoPart
=
part
;
// console.log("我是猩猩的"+part);
if
(
part
==
"tl"
){
var
source
=
"ele40_png"
;
var
texture
:
egret
.
Texture
=
RES
.
getRes
(
source
);
if
(
!
texture
)
{
return
console
.
error
(
"未找到纹理"
,
source
,
this
.
type
);
}
this
.
showImage
.
texture
=
texture
this
.
showImage
.
x
=
-
texture
.
textureWidth
/
4
;
this
.
showImage
.
y
=
-
texture
.
textureHeight
/
4
;
}
this
.
showImage
.
alpha
=
0.5
;
var
state
=
StateType
.
PongoLockState
;
...
...
@@ -253,6 +268,107 @@ export class Element extends eui.Component {
//视图添加
this
.
addChild
(
this
.
states
[
state
]);
}
createPongo
(
videoItem
:
any
){
if
(
this
.
pongoMoveClip
){
if
(
this
.
pongoMoveClip
.
parent
){
this
.
pongoMoveClip
.
parent
.
removeChild
(
this
.
pongoMoveClip
);
}
this
.
initPongoMoveClip
();
}
else
{
this
.
pongoMoveClip
=
new
window
[
"SVGA"
].
EgretMovieClip
(
videoItem
);
this
.
initPongoMoveClip
();
}
}
initPongoMoveClip
(){
console
.
log
(
"创建了一个猩猩"
);
var
boxwidth
=
80
;
var
boxheight
=
80
;
var
mvwidth
=
161
;
var
mvheight
=
161
;
this
.
pongoMoveClip
.
x
=
(
boxwidth
-
mvwidth
)
/
2
;
this
.
pongoMoveClip
.
y
=
(
boxheight
-
mvheight
)
/
2
;
this
.
addChild
(
this
.
pongoMoveClip
);
this
.
pongoMoveClip
.
gotoAndPlay
(
1
);
this
.
noseeimgs
=
new
Array
();
this
.
lessPart
=
[
"tl"
,
"tr"
,
"bl"
,
"br"
];
this
.
pongoMoveClip
.
addEventListener
(
egret
.
Event
.
ENTER_FRAME
,
this
.
pongoFrameAni
,
this
);
egret
.
ticker
.
$startTick
(
this
.
update
,
this
);
}
//猩猩当前应处于的播放状态
//控制猩猩的播放
pongoFrameAni
(){
var
curframe
=
this
.
pongoMoveClip
.
currentFrame
;
//检测当前
}
changePongoStat
(
part
:
string
,
lock
:
string
=
"free"
){
var
partIarr
:
Array
<
number
>
=
[];
switch
(
part
){
case
"tl"
:
partIarr
=
grassPongo
.
tl
.
split
(
","
).
map
(
Number
);
break
;
case
"tr"
:
partIarr
=
grassPongo
.
tr
.
split
(
","
).
map
(
Number
);
break
;
case
"bl"
:
partIarr
=
grassPongo
.
bl
.
split
(
","
).
map
(
Number
);
break
;
case
"br"
:
partIarr
=
grassPongo
.
br
.
split
(
","
).
map
(
Number
);
break
;
default
:
console
.
error
(
"未定义猩猩解锁"
);
break
;
}
if
(
lock
==
"free"
){
for
(
var
i
=
0
;
i
<
partIarr
.
length
;
i
++
){
var
ipart
=
partIarr
[
i
];
var
ipartidx
=
this
.
noseeimgs
.
indexOf
(
ipart
);
if
(
ipartidx
==-
1
){
this
.
noseeimgs
.
push
(
ipart
);
}
}
var
inpart
=
this
.
lessPart
.
indexOf
(
part
);
if
(
inpart
!=-
1
){
this
.
lessPart
.
splice
(
inpart
,
1
);
}
}
else
{
for
(
var
i
=
0
;
i
<
partIarr
.
length
;
i
++
){
var
ipart
=
partIarr
[
i
];
var
ipartidx
=
this
.
noseeimgs
.
indexOf
(
ipart
);
if
(
ipartidx
!=-
1
){
this
.
noseeimgs
.
splice
(
ipartidx
,
1
);
}
}
var
inpart
=
this
.
lessPart
.
indexOf
(
part
);
if
(
inpart
==-
1
){
this
.
lessPart
.
push
(
part
);
}
}
console
.
log
(
"剩余显示"
,
this
.
lessPart
);
}
update
(
t
:
number
){
if
(
this
.
pongoMoveClip
&&
this
.
pongoMoveClip
.
numChildren
>
10
){
for
(
let
i
=
0
;
i
<
this
.
noseeimgs
.
length
;
i
++
){
var
noseeidx
=
this
.
noseeimgs
[
i
];
let
noseeimg
=
this
.
pongoMoveClip
.
getChildAt
(
noseeidx
)
as
egret
.
Bitmap
;
noseeimg
.
visible
=
false
;
}
}
return
true
;
}
addDisable
(){
if
(
this
.
inPongoPart
&&
this
.
inPongoPart
==
"tl"
){
console
.
log
(
"猩猩消除ticker"
);
if
(
this
.
pongoMoveClip
&&
this
.
pongoMoveClip
.
parent
){
this
.
pongoMoveClip
.
parent
.
removeChild
(
this
.
pongoMoveClip
);
}
egret
.
ticker
.
$stopTick
(
this
.
update
,
this
);
}
}
removePongoLockStat
(){
var
state
=
StateType
.
PongoLockState
;
this
.
states
[
state
].
recover
();
...
...
egret/src/something/states/PongoLockState.ts
View file @
29e6f2ee
...
...
@@ -19,7 +19,7 @@ export class PongoLockState extends State{
this
.
once
(
egret
.
Event
.
ADDED
,
this
.
initShow
,
this
);
}
initShow
(){
this
.
alpha
=
1
;
this
.
alpha
=
0
;
var
texture
:
egret
.
Texture
=
RES
.
getRes
(
"lockVine_png"
);
this
.
showImage
.
texture
=
texture
;
this
.
showImage
.
x
=
-
texture
.
textureWidth
/
2
;
...
...
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