Commit 0c645983 authored by wildfirecode's avatar wildfirecode

Merge branch 'feather-0208' into dev

parents 2e805f92 ac1eefc9
...@@ -18,8 +18,9 @@ ...@@ -18,8 +18,9 @@
background-repeat: no-repeat; background-repeat: no-repeat;
background-color: #000; background-color: #000;
background-size: 100%; background-size: 100%;
background-position:top; background-position:center;
background-image: url("https://yun.duiba.com.cn/db_games/activity/game/1565600901/resource/assets/startScene/startscenebg.jpg"); background-image: url("https://yun.duiba.com.cn/db_games/activity/game/02072/startscenebg.jpg");
/* background-image: url("https://yun.duiba.com.cn/db_games/activity/game/1565600901/resource/assets/startScene/startscenebg.jpg"); */
padding: 0; padding: 0;
border: 0; border: 0;
margin: 0; margin: 0;
......
...@@ -4,9 +4,9 @@ ...@@ -4,9 +4,9 @@
<e:Label id="FZY3JW" text=" " y="1048" textColor="0x244B00" fontFamily="FZY3JW" horizontalCenter="0" visible="false"/> <e:Label id="FZY3JW" text=" " y="1048" textColor="0x244B00" fontFamily="FZY3JW" horizontalCenter="0" visible="false"/>
<e:Label id="FZY4JW" text=" " y="1048" textColor="0x244B00" fontFamily="FZY4JW" horizontalCenter="0" visible="false"/> <e:Label id="FZY4JW" text=" " y="1048" textColor="0x244B00" fontFamily="FZY4JW" horizontalCenter="0" visible="false"/>
<e:Component id="bg" width="750" height="1624" verticalCenter="0" visible="false"/> <e:Component id="bg" width="750" height="1624" verticalCenter="0" visible="false"/>
<e:Component id="container2" x="0" width="750" height="1624" y="0"/> <e:Component id="container2" x="0" width="750" height="1624" y="0" visible="false"/>
<e:Component id="container1" x="0" width="750" height="1624"/> <e:Component id="container1" x="0" width="750" height="1624" visible="false"/>
<e:Group width="750" x="0" y="995"> <e:Group width="750" x="0" verticalCenter="494">
<e:Group y="30.94" x="140"> <e:Group y="30.94" x="140">
<e:Image source="loadingbg_png" y="0" x="0"/> <e:Image source="loadingbg_png" y="0" x="0"/>
<e:Group id="maskwrapper" x="14.56" y="7.14"> <e:Group id="maskwrapper" x="14.56" y="7.14">
...@@ -18,8 +18,8 @@ ...@@ -18,8 +18,8 @@
</e:Group> </e:Group>
<e:Image id="progressmask2" y="9.14" x="16" source="mask2_png" width="444" height="60" scaleX="1"/> <e:Image id="progressmask2" y="9.14" x="16" source="mask2_png" width="444" height="60" scaleX="1"/>
</e:Group> </e:Group>
<e:Label id="tips" text="正在加载中,请稍后" y="0" size="24" horizontalCenter="0" textColor="0x244b00"/> <e:Label id="tips" text="正在加载中,请稍后" y="0" size="26" horizontalCenter="0" textColor="0x3c2107" bold="true"/>
<e:Label id="percentTxt" text="63%" y="117" horizontalCenter="0" textColor="0x244b00"/> <e:Label id="percentTxt" text="63%" y="117" horizontalCenter="0" textColor="0x3c2107" bold="true"/>
</e:Group> </e:Group>
<e:Image source="头顶树丛_png" x="0" y="0"/> <e:Image source="头顶树丛_png" x="0" y="0" visible="false"/>
</e:Skin> </e:Skin>
\ No newline at end of file
...@@ -3142,9 +3142,9 @@ export default class MainScene extends Scene { ...@@ -3142,9 +3142,9 @@ export default class MainScene extends Scene {
}, 56 / 60 * 1000) }, 56 / 60 * 1000)
} }
//时间再调cd //时间再调cd
// setTimeout(() => { setTimeout(() => {
callback(); callback();
// }, 80) }, 400)
} }
/** /**
......
...@@ -27,7 +27,7 @@ export default class RedBagAni { ...@@ -27,7 +27,7 @@ export default class RedBagAni {
let iconCount:number=0; let iconCount:number=0;
export const createRedBagIcon = (parent)=>{ export const createRedBagIcon = (parent)=>{
// const icon = RES.getRes('mapredbagicom_png'); /// TODO 洒出的图片 // const icon = RES.getRes('mapredbagicom_png'); /// TODO 洒出的图片
const icon:egret.Texture=RES.getRes('chocolate'+(iconCount++%4)+"_png"); const icon:egret.Texture=RES.getRes('chocolate'+(iconCount++%4)+'_png');
const bmp = new egret.Bitmap(icon); const bmp = new egret.Bitmap(icon);
bmp.anchorOffsetX=icon.textureWidth/2//32; bmp.anchorOffsetX=icon.textureWidth/2//32;
bmp.anchorOffsetY=icon.textureHeight/2//33; bmp.anchorOffsetY=icon.textureHeight/2//33;
......
import { Pool } from "../Pool";
import { RecoverName } from "../enum/RecoverName";
//70是chocolateFour的尺寸,偷懒,固定了
var x1 = 70 / 4 - 70 / 2;
var x2 = 70 / 4 * 3 - 70 / 2;
var y1 = 70 / 4 - 70 / 2;
var y2 = 70 / 4 * 3 - 70 / 2;
var dis1 = 20;
var dis2 = 40;
const fourPositions: number[][] = [
[x1, y1],
[x2, y1],
[x1, y2],
[x2, y2]
]
const f1: number[][] = [
[x1 - dis1, y1 - dis1],
[x2 + dis1, y1 - dis1],
[x1 - dis1, y2 + dis1],
[x2 + dis1, y2 + dis1]
]
const f2: number[][] = [
[x1 - dis2, y1 - dis2],
[x2 + dis2, y1 - dis2],
[x1 - dis2, y2 + dis2],
[x2 + dis2, y2 + dis2]
]
/**
* 巧克力分裂动效
*/
export class ChocolateDivideAni extends egret.DisplayObjectContainer {
constructor() {
super()
for (var i = 0; i < 4; i++) {
var t: egret.Texture = RES.getRes("chocolate" + i + "_png");
var b = new egret.Bitmap(t);
b.anchorOffsetX = t.textureWidth / 2;
b.anchorOffsetY = t.textureHeight / 2;
b.scaleX = 32 / t.textureWidth;//32是缩小的尺寸
b.scaleY = 32 / t.textureHeight;
b.x = fourPositions[i][0];
b.y = fourPositions[i][1];
this.addChild(b);
this["chocolate" + i] = b;
}
}
play(p: number[]) {
this.x = p[0];
this.y = p[1];
//重置位置和透明度
for (var i = 0; i < 4; i++) {
let ii = i;
let chocolate: egret.Bitmap = this["chocolate" + i];
chocolate.x = fourPositions[i][0];
chocolate.y = fourPositions[i][1];
chocolate.scaleX = chocolate.scaleY = 32 / 70
chocolate.alpha = 1;
egret.Tween.get(chocolate)
.wait(100)
.to({ x: f1[ii][0], y: f1[ii][1], scaleX: 40 / 70, scaleY: 40 / 70 }, 300)
.wait(100)
.to({ x: f2[ii][0], y: f2[ii][1], alpha: 0 }, 300)
.call(() => {
if (ii == 3) {
//回收元素
if (this.parent) this.parent.removeChild(this);
Pool.recover(RecoverName.CHOCOLATEDIVIDE_ANI, this)
}
})
}
}
}
\ No newline at end of file
...@@ -66,7 +66,7 @@ export function MagicRotateAni(ele: Element, p: number[], con: egret.DisplayObje ...@@ -66,7 +66,7 @@ export function MagicRotateAni(ele: Element, p: number[], con: egret.DisplayObje
* @param rotation 弧度,逆时针 * @param rotation 弧度,逆时针
* @param point 定点,默认0,0 * @param point 定点,默认0,0
*/ */
function rotationAcodPoint(p: number[], rotation: number, point: number[] = [0, 0]) { export function rotationAcodPoint(p: number[], rotation: number, point: number[] = [0, 0]) {
//平移 //平移
var xp = p[0] - point[0]; var xp = p[0] - point[0];
var yp = p[1] - point[1]; var yp = p[1] - point[1];
......
...@@ -5,18 +5,27 @@ import { playSound, SoundType } from "../../soundCtrl"; ...@@ -5,18 +5,27 @@ import { playSound, SoundType } from "../../soundCtrl";
import { Element } from "../class/Element"; import { Element } from "../class/Element";
import { Tool } from "../Tool"; import { Tool } from "../Tool";
import { ElementType } from "../enum/ElementType"; import { ElementType } from "../enum/ElementType";
import { getRotByTwoVectors, rotationAcodPoint } from "../anis/MagicRotateAni";
let iconCount: number = 0;
/** /**
* 情人节版本 * 情人节版本
*/ */
export class FesRedShootAni extends egret.DisplayObjectContainer { export class FesRedShootAni extends egret.DisplayObjectContainer {
light: LightingAni;
imageAni: ImageAni; imageAni: ImageAni;
imageAniCon: egret.DisplayObjectContainer imageAniCon: egret.DisplayObjectContainer;
//头部
head: egret.Bitmap;
constructor() { constructor() {
super() super()
this.light = new LightingAni(); var ht: egret.Texture = RES.getRes("ele" + ElementType.FESTIVALELE_SMALL + "_png")
this.addChild(this.light); this.head = new egret.Bitmap(ht);
this.head.anchorOffsetX = ht.textureWidth / 2;
this.head.anchorOffsetY = ht.textureHeight / 2;
this.addChild(this.head);
this.head.scaleX = this.head.scaleY = 0.3;
var arr = [] var arr = []
for (var i = 1; i <= 10; i++) { for (var i = 1; i <= 10; i++) {
arr.push("fesEleSmallDis" + i + "_png"); arr.push("fesEleSmallDis" + i + "_png");
...@@ -28,31 +37,60 @@ export class FesRedShootAni extends egret.DisplayObjectContainer { ...@@ -28,31 +37,60 @@ export class FesRedShootAni extends egret.DisplayObjectContainer {
this.imageAni.visible = false this.imageAni.visible = false
} }
reset() { reset() {
this.light.visible = true; this.head.visible = true;
this.imageAni.visible = false; this.imageAni.visible = false;
this.light.scaleX = 0.2;
} }
play(startP: number[], ele: Element, callback: Function) { play(startP: number[], ele: Element, callback: Function) {
this.reset() this.reset()
//算角度 let head = this.head;
var r = Tool.getForwardRotation(startP, [ele.x, ele.y]) let self = this;
this.light.rotation = r * 180 / Math.PI; //动画帧出现的地方就是元素的位置
this.light.x = startP[0];
this.light.y = startP[1];
this.imageAniCon.x = ele.x; this.imageAniCon.x = ele.x;
this.imageAniCon.y = ele.y; this.imageAniCon.y = ele.y;
//247
var dis = Math.sqrt( //
(startP[0] - ele.x) * (startP[0] - ele.x) + var deltaX = startP[0] - ele.x;
(startP[1] - ele.y) * (startP[1] - ele.y) var deltaY = startP[1] - ele.y;
) var dis = Math.sqrt(deltaX * deltaX + deltaY * deltaY);
var scaleX = dis / 247; //算角度,弧度,x正方向为0,0到2pi,逆时针为正
egret.Tween.get(this.light) var vec0 = [1, 0]
.to({ scaleX: scaleX, }, 400) var vec1 = [deltaX, deltaY]
var rotation = getRotByTwoVectors(vec0, vec1);
if (deltaY > 0) rotation = Math.PI * 2 - rotation;
var tAll = 60;
var a = { t: 0 };
egret.Tween.get(a, {
onChange: function () {
//螺旋半径,时间t的函数,越来越大,0
var r = dis * a.t / tAll;
//螺旋角度,基础角度+补间角度,
var theta = a.t / tAll * Math.PI
var x = r * Math.cos(theta)
var y = r * Math.sin(theta)
//旋转一下
var xy = rotationAcodPoint([x, y], rotation);
head.x = xy[0] + startP[0];
head.y = xy[1] + startP[1];
//添加尾部粒子
let p = particlePool.shift();
if (!p) p = new Particle();
p.reset();
p.x = xy[0] + startP[0];
p.y = xy[1] + startP[1];
self.addChildAt(p, 0);
}
})
.to({ t: tAll }, 1200, /*egret.Ease.quadIn*/)
.call(() => { .call(() => {
//隐藏头部
head.visible = false;
ele.reset(ElementType.FESTIVALELE_SMALL); ele.reset(ElementType.FESTIVALELE_SMALL);
ele.scaleX = ele.scaleY = 0.1 ele.scaleX = ele.scaleY = 0.1;
ele.changeSource('chocolate' + (iconCount++ % 4) + '_png')
egret.Tween.get(ele) egret.Tween.get(ele)
.to({ scaleX: 1, scaleY: 1 }, 500, egret.Ease.backOut) .to({ scaleX: 1, scaleY: 1 }, 500, egret.Ease.backOut)
...@@ -66,14 +104,50 @@ export class FesRedShootAni extends egret.DisplayObjectContainer { ...@@ -66,14 +104,50 @@ export class FesRedShootAni extends egret.DisplayObjectContainer {
}; };
Pool.recover(RecoverName.FESREDSHOOT_ANI, this) Pool.recover(RecoverName.FESREDSHOOT_ANI, this)
}) })
setTimeout(() => {
this.light.visible = false;
}, 200)
}) })
} }
} }
const particlePool: Particle[] = [];
class Particle extends egret.Bitmap {
private life: number = 0;
private maxLife: number = 60;
public alphaSpeed = 0.02
public scaleSpeed = 0.02;
constructor() {
super();
this.texture = RES.getRes("redbombParticle_png");
this.anchorOffsetX = this.texture.textureWidth / 2;
this.anchorOffsetY = this.texture.textureHeight / 2;
this.addEventListener(egret.Event.ENTER_FRAME, this.enterFrame, this);
}
reset() {
this.life = 0;
this.alpha = 1;
// this.scaleX = this.scaleY = 2;
this.scaleX = this.scaleY = Math.random() * 1;
this.rotation = Math.random() * 360;
}
enterFrame() {
// if (!this.stage) return;
if (++this.life > this.maxLife) {
//回收
if (this.parent) {
this.parent.removeChild(this);
particlePool.push(this);
}
return;
}
this.alpha -= this.alphaSpeed;
if (this.alpha < 0) this.alpha = 0
// this.scaleX = this.scaleY -= this.scaleSpeed;
// if (this.scaleX < 0) this.scaleX = this.scaleY = 0;
}
}
/** /**
* 需要回调的 * 需要回调的
......
...@@ -58,6 +58,7 @@ export enum RecoverName { ...@@ -58,6 +58,7 @@ export enum RecoverName {
EGGBROKEN_ANI = "EggBrokenAni", EGGBROKEN_ANI = "EggBrokenAni",
HAIRBALLGREYDIS_ANI = "HairballGreyDisAni", HAIRBALLGREYDIS_ANI = "HairballGreyDisAni",
HAIRBALLBLACKDIS_ANI = "HairballBlackDisAni", HAIRBALLBLACKDIS_ANI = "HairballBlackDisAni",
CHOCOLATEDIVIDE_ANI = "ChocolateDivideAni",
//方形遮罩 //方形遮罩
RECT_MASK = "RectMask", RECT_MASK = "RectMask",
......
...@@ -21,6 +21,7 @@ import { FesRedShootAni2 } from "../anisCall/FesRedShootAni2"; ...@@ -21,6 +21,7 @@ import { FesRedShootAni2 } from "../anisCall/FesRedShootAni2";
import { loadSvga } from "../../loadSvga"; import { loadSvga } from "../../loadSvga";
import getResPath from "../../../libs/new_tc/getResPath"; import getResPath from "../../../libs/new_tc/getResPath";
import SceneCtrl from "../../../libs/new_wx/ctrls/sceneCtrl"; import SceneCtrl from "../../../libs/new_wx/ctrls/sceneCtrl";
import { ChocolateDivideAni } from "../anis/ChocolateDivideAni";
//孵鸡的数量 //孵鸡的数量
const chickenNum: number = 4; const chickenNum: number = 4;
...@@ -142,7 +143,7 @@ export class AiControl { ...@@ -142,7 +143,7 @@ export class AiControl {
} }
//变成对象 //变成对象
for (var i = 0; i < six.length; i++) six[i] = { index: six[i] }; for (var i = 0; i < six.length; i++) six[i] = { index: six[i] };
//暂时只有一个大红包, //暂时只有一个大红包,如出现多个,需改逻辑
let index = indexs[0]; let index = indexs[0];
var p = Tool.getPositionByIndex(index); var p = Tool.getPositionByIndex(index);
var vec0 = [1, 0]; var vec0 = [1, 0];
...@@ -162,7 +163,11 @@ export class AiControl { ...@@ -162,7 +163,11 @@ export class AiControl {
six.sort(function (a, b) { return b.rotation - a.rotation }); six.sort(function (a, b) { return b.rotation - a.rotation });
//还原为索引 //还原为索引
for (var i = 0; i < six.length; i++) six[i] = six[i].index; for (var i = 0; i < six.length; i++) six[i] = six[i].index;
//动画 //先去掉元素,再加分裂动画
thisObj.removeOperation(index);
//巧克力分裂效果,
thisObj.addChild(Pool.takeOut(RecoverName.CHOCOLATEDIVIDE_ANI) || new ChocolateDivideAni())["play"](p);
//光效动画
thisObj.redBombLightAni(index, () => { thisObj.redBombLightAni(index, () => {
let count = 0; let count = 0;
let countAll = six.length; let countAll = six.length;
...@@ -178,8 +183,8 @@ export class AiControl { ...@@ -178,8 +183,8 @@ export class AiControl {
thisObj.addChild(fesRedShootAni); thisObj.addChild(fesRedShootAni);
fesRedShootAni.play(p, ele, () => { fesRedShootAni.play(p, ele, () => {
if (++count == countAll) { if (++count == countAll) {
//去掉大红包 //去掉大红包,改成上面去掉了
thisObj.removeOperation(index); // thisObj.removeOperation(index);
//进行掉落 //进行掉落
thisObj.fall(() => { thisObj.fall(() => {
thisObj.fallCallback(); thisObj.fallCallback();
......
...@@ -6,7 +6,21 @@ import { loadSvga } from "../loadSvga"; ...@@ -6,7 +6,21 @@ import { loadSvga } from "../loadSvga";
import MapBottomPart from "../mapScene/MapBottomPart"; import MapBottomPart from "../mapScene/MapBottomPart";
import MapRpeatPart from "../mapScene/MapRpeatPart"; import MapRpeatPart from "../mapScene/MapRpeatPart";
import MapTopPart from "../mapScene/MapTopPart"; import MapTopPart from "../mapScene/MapTopPart";
import setGlow from "../setGlow";
const setGlow = (img: egret.DisplayObject, color: number,alpha:number) => {
// const color = 0x33CCFF; /// 光晕的颜色,十六进制,不包含透明度
// const alpha = 0.8; /// 光晕的颜色透明度,是对 color 参数的透明度设定。有效值为 0.0 到 1.0。例如,0.8 设置透明度值为 80%。
const blurX = 6; /// 水平模糊量。有效值为 0 到 255.0(浮点)
const blurY = 6; /// 垂直模糊量。有效值为 0 到 255.0(浮点)
const strength = 10; /// 压印的强度,值越大,压印的颜色越深,而且发光与背景之间的对比度也越强。有效值为 0 到 255。暂未实现
const quality: number = egret.BitmapFilterQuality.HIGH; /// 应用滤镜的次数,建议用 BitmapFilterQuality 类的常量来体现
const inner = false; /// 指定发光是否为内侧发光,暂未实现
const knockout = false; /// 指定对象是否具有挖空效果,暂未实现
const glowFilter: egret.GlowFilter = new egret.GlowFilter(color, alpha, blurX, blurY,
strength, quality, inner, knockout);
img.filters = [glowFilter];
}
const list = [ const list = [
'小提示:凑齐5个萌狮连消,可以开启大招哦!', '小提示:凑齐5个萌狮连消,可以开启大招哦!',
'小提示:连续爆炸,得分会成倍增加~', '小提示:连续爆炸,得分会成倍增加~',
...@@ -24,7 +38,7 @@ export default class StartScene extends Scene { ...@@ -24,7 +38,7 @@ export default class StartScene extends Scene {
async start(data?) { async start(data?) {
super.start(); super.start();
this.height=this.stage.stageHeight; this.height = this.stage.stageHeight;
if (data) if (data)
this.level = data.level; this.level = data.level;
this['container1'].x = 20; this['container1'].x = 20;
...@@ -35,6 +49,11 @@ export default class StartScene extends Scene { ...@@ -35,6 +49,11 @@ export default class StartScene extends Scene {
this['percentTxt'].text = `0%`; this['percentTxt'].text = `0%`;
const index = Math.floor(Math.random() * list.length); const index = Math.floor(Math.random() * list.length);
this['tips'].text = list[index]; this['tips'].text = list[index];
setGlow(this['tips'], 0xffffff, 1);
setGlow(this['percentTxt'], 0xffffff, 1);
console.log(data); console.log(data);
if (data && Array.isArray(data)) { if (data && Array.isArray(data)) {
this['container3'].addChild(data[0]); this['container3'].addChild(data[0]);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment