Commit 1cc4a105 authored by XieChuanJin's avatar XieChuanJin

网络请求、灰尘特效

parent 898ae6fc
This source diff could not be displayed because it is too large. You can view the blob instead.
/**
* @note 极验 - 第三方插件
* @author 张晨辰
* @email zcc@duiba.com.cn
* @create 2017-04-19 12:01:45
* @update 2017-06-28 10:06:00
* @des https://www.163yun.com/help/documents/294963579379175424
* @dependencies <script type="text/javascript" src="//c.dun.163yun.com/js/c.js"></script>
* 2.0 <script src="//cstaticdun.126.net/load.min.js"></script>
*/
let captchaIns: any;
export function initNECaptcha(options: any) {
if (!options.captchaId) {
return false;
}
window["$"]('body').append('<div class="captcha"><div id="check_wrapper" class="neCaptcha-dialog"></div></div>');
var opts = {
element: '#check_wrapper', // 可以是验证码容器id,也可以是HTMLElement
captchaId: options.captchaId, // 这里填入申请到的验证码id
width: options.width || 270, // 验证码组件显示宽度
mode: options.mode || 'embed',
onVerify: function (err: any, data: any) {
if (!err) {
window["$"](".captcha").unbind("click");
window["$"]('.captcha').remove();
// data.validate = base64.encode(data.validate);
options.callback && options.callback(data);
}
}
}
window["initNECaptcha"] && window["initNECaptcha"](opts, function (instance:any) {
captchaIns = instance
window["$"](".captcha").click(function (e:any) {
if (e.target.className == "captcha") {
if (captchaIns) captchaIns.refresh()
}
});
}, function (err: any) {
console.log(err, 55655665)
//初始化失败,点击黑色区域重新初始
window["$"](".captcha").click(function (e:any) {
window["$"](".captcha").unbind("click");
window["$"]('.captcha').remove();
initNECaptcha(options)
});
});
window["loading"] && window["loading"].close();
window["$"]('.captcha').show();
};
import { MUtils } from "./MUtils";
import MTimer from "./MTimer";
import { MUtils } from "../Global/MUtils";
import MTimer from "../Global/MTimer";
class MTweenObject {
public static readonly frameRate = 60;
......
import { MUtils } from "./MUtils";
import { MUtils } from "../Global/MUtils";
import { MTween } from "./MTween";
export abstract class PoolGroup<T extends PoolElement>{
......
import { MConst } from "./MConst";
import { MConst } from "../Global/MConst";
export default class UILayer extends engine.Container {
constructor() {
......
import MoveObjcet from "./MoveObject";
import Collider, { CircleCollider, ColliderGroup } from "./Collider";
import { MConfigs } from "./MConfigs";
import { getBallScore, getProp } from "./GUtils";
import { PoolElement } from "./Pool";
import { MConst } from "./MConst";
import Collider, { CircleCollider, ColliderGroup } from "../Phycics/Collider";
import { MConfigs } from "../Global/MConfigs";
import { getBallScore, getProp } from "../Global/GUtils";
import { PoolElement } from "../Component/Pool";
import { MConst } from "../Global/MConst";
import Drop from "./Drop";
import Bullet from "./Bullet";
import { MUtils } from "./MUtils";
import SoundMgr from "./SoundMgr";
import { MUtils } from "../Global/MUtils";
import SoundMgr from "../Mgr/SoundMgr";
import Game from "./Game";
import BoomEffect from "./BoomEffect";
import ballPool from "./Pools/BallPool";
import dropPool from "./Pools/DropPool";
import { EffectMgr } from "./EffectMgr";
import { DataMgr } from "./Mgr/DataMgr";
import SpriteFontLabel, { SpriteFont } from "./Component/SpriteFont";
import ballPool from "../Pools/BallPool";
import dropPool from "../Pools/DropPool";
import { EffectMgr } from "../Mgr/EffectMgr";
import { DataMgr } from "../Mgr/DataMgr";
import SpriteFontLabel, { SpriteFont } from "../Component/SpriteFont";
import GuideMgr from "../Mgr/GuideMgr";
import MTimer from "../Global/MTimer";
let tempPower: number = null;
let tempIndexOffset: number = null;
......@@ -67,24 +69,17 @@ export default class Ball extends MoveObjcet implements PoolElement {
}
private onScoreIsZero() {
//TODO
/* if (GuideMgr.instance.guideFlag == true) {
if (GuideMgr.instance.guideFlag == true) {
this.drop();
} else {
//TODO
} */
if (this.sizeIndex > 0) {
this.split();
} else {
this.drop();
if (this.sizeIndex > 0) {
this.split();
} else {
this.drop();
}
}
EffectMgr.playBoomEffect(this.position, this.scaleRatio);
/* const clip = EffectMgr.createAnimation("boom");
clip.scaleX = clip.scaleY = this.scaleRatio;
clip.x = this.x - 300 * this.scaleRatio;
clip.y = this.y - 300 * this.scaleRatio;
clip.play(); */
SoundMgr.instance.playEffect("boom_mp3");
ballPool.recycle(this.poolKey, this);
}
......@@ -194,9 +189,9 @@ export default class Ball extends MoveObjcet implements PoolElement {
//播放灰尘动画
const clip = EffectMgr.createAnimation("duang");
clip.x = this.x - 148 * this.scaleRatio;
clip.y = this.y + 62 * this.scaleRatio;
clip.scaleX = clip.scaleY = 1.76 * this.scaleRatio;
clip.x = this.x - 140 * this.scaleRatio;
clip.y = this.y - 50 * this.scaleRatio;
clip.scaleX = clip.scaleY = this.scaleRatio;
clip.play();
//判断是否会震动地面
if (this.sizeIndex >= MConfigs.size.length - 2) {
......@@ -325,12 +320,11 @@ export default class Ball extends MoveObjcet implements PoolElement {
drop.physics.velocity.x = dir * x;
drop.physics.velocity.y = -(x * 5 * MUtils.random(0.9, 1.1));
//TODO
/* if (GuideMgr.instance.guideFlag && i == 1) {
MTimer.setFrameTimer(20, () => {
GuideMgr.instance.runGuide(1, drop.x, drop.y, true);
});
} */
if (GuideMgr.instance.guideFlag && i == 1) {
MTimer.setFrameTimer(20, () => {
GuideMgr.instance.runGuide(1, drop.x, drop.y, true);
});
}
}
}
}
\ No newline at end of file
import { MConst } from "./MConst";
import { MUtils } from "./MUtils";
import { MTween } from "./MTween";
import { TextureMgr } from "./Mgr/TextureMgr";
import { PoolElement, Pool, PoolGroup } from "./Pool";
import { MConst } from "../Global/MConst";
import { MUtils } from "../Global/MUtils";
import { MTween } from "../Component/MTween";
import { TextureMgr } from "../Mgr/TextureMgr";
import { PoolElement, Pool, PoolGroup } from "../Component/Pool";
const BoomEffectDuration = 400;
const DefaultRingWidth = 672;
......
import { PoolElement } from "./Pool";
import { PoolElement } from "../Component/Pool";
import MoveObjcet from "./MoveObject";
import { MConst } from "./MConst";
import { MConst } from "../Global/MConst";
import GameObject from "./GameObject";
import Collider, { CircleCollider, ColliderGroup, PointCollider } from "./Collider";
import Collider, { CircleCollider, ColliderGroup, PointCollider } from "../Phycics/Collider";
import Game from "./Game";
import { DataMgr } from "./Mgr/DataMgr";
import bulletPool from "./Pools/BulletPool";
import MTimer from "./MTimer";
import { DataMgr } from "../Mgr/DataMgr";
import bulletPool from "../Pools/BulletPool";
import MTimer from "../Global/MTimer";
const bulletSpeedValue = 20;
/**顾名思义 */
......
import GameObject from "./GameObject";
import Collider, { RectCollider, ColliderGroup } from "./Collider";
import { MConst } from "./MConst";
import Collider, { RectCollider, ColliderGroup } from "../Phycics/Collider";
import { MConst } from "../Global/MConst";
import Bullet, { BulletGroup } from "./Bullet";
import { MTween } from "./MTween";
import SoundMgr from "./SoundMgr";
import MTimer from "./MTimer";
import { MTween } from "../Component/MTween";
import SoundMgr from "../Mgr/SoundMgr";
import MTimer from "../Global/MTimer";
import Game from "./Game";
import { DataMgr } from "./Mgr/DataMgr";
import bulletPool from "./Pools/BulletPool";
import { DataMgr } from "../Mgr/DataMgr";
import bulletPool from "../Pools/BulletPool";
......
import MoveObjcet from "./MoveObject";
import { MConfigs } from "./MConfigs";
import Collider, { ColliderGroup, PointCollider } from "./Collider";
import { MTween } from "./MTween";
import SoundMgr from "./SoundMgr";
import { MConfigs } from "../Global/MConfigs";
import Collider, { ColliderGroup, PointCollider } from "../Phycics/Collider";
import { MTween } from "../Component/MTween";
import SoundMgr from "../Mgr/SoundMgr";
import Game from "./Game";
import { PoolElement } from "./Pool";
import dropPool from "./Pools/DropPool";
import { DataMgr } from "./Mgr/DataMgr";
import DropBlinkMgr from "./Mgr/DropBlinkMgr";
import { PoolElement } from "../Component/Pool";
import dropPool from "../Pools/DropPool";
import { DataMgr } from "../Mgr/DataMgr";
import DropBlinkMgr from "../Mgr/DropBlinkMgr";
const dropImgNames = [
"f7221f86-f376-40ce-b0e8-f7ea573ec780",
......
import Car from "./Car";
import { MConst } from "./MConst";
import { MConst } from "../Global/MConst";
import PlayerController from "./PlayerController";
import Ball from "./Ball";
import Physics from "./Physics";
import Physics from "../Phycics/Physics";
import GameObject from "./GameObject";
import { RectCollider, ColliderGroup } from "./Collider";
import { MConfigs } from "./MConfigs";
import { MTween } from "./MTween";
import { RectCollider, ColliderGroup } from "../Phycics/Collider";
import { MConfigs } from "../Global/MConfigs";
import { MTween } from "../Component/MTween";
import Drop from "./Drop";
import { MUtils } from "./MUtils";
import { arrayRemove, getBallScore } from "./GUtils";
import MTimer from "./MTimer";
import PhycicsSystem from "./PhycicsSystem";
import { MUtils } from "../Global/MUtils";
import { arrayRemove, getBallScore } from "../Global/GUtils";
import MTimer from "../Global/MTimer";
import PhycicsSystem from "../Phycics/PhycicsSystem";
import Bullet from "./Bullet";
import ballPool from "./Pools/BallPool";
import { EffectMgr } from "./EffectMgr";
import FrameAnimation from "./Component/FrameAnimation";
import { DuangAltaData, NumFontData, BoomAnimationData } from "./JsonData";
import SpriteFontLabel, { SpriteFont } from "./Component/SpriteFont";
import ballPool from "../Pools/BallPool";
import { EffectMgr } from "../Mgr/EffectMgr";
import FrameAnimation from "../Component/FrameAnimation";
import { DuangAltaData, NumFontData, BoomAnimationData } from "../Global/JsonData";
import SpriteFontLabel, { SpriteFont } from "../Component/SpriteFont";
import GuideMgr from "../Mgr/GuideMgr";
type LayerName = "Bullet" | "Ball" | "Drop" | "Effect";
......@@ -164,9 +165,8 @@ export default class Game {
//开始倒计时
this.timing = true;
this._BulletScore = 140;
this._PowerScore = 2000;
// this._BulletScore = 140;
// this._PowerScore = 2000;
}
public addGameObject(gameObject: GameObject, layer: LayerName) {
......@@ -226,9 +226,9 @@ export default class Game {
private createBall() {
let size = MUtils.randomInt(0, MConfigs.size.length);
/* if (GameMgr.instance.guideFlag == true) {
if (GuideMgr.instance.guideFlag == true) {
size = 3;
} */
}
let color = MUtils.randomInt(size, MConst.MaxColorIndex);
let ball = ballPool.spwan(size);
this.addGameObject(ball, "Ball");
......
import GameComponent from "./GameComponent";
import Collider from "./Collider";
import Collider from "../Phycics/Collider";
import Game from "./Game";
export default class GameObject extends engine.Container {
......
import { MConfigs } from "../Global/MConfigs";
import { MConst } from "../Global/MConst";
export default class GuideMask extends engine.Container {
constructor(index: number, x1: number, y1: number) {
super();
const config = MConfigs.guide[index];
let mask = new engine.Sprite(RES.getRes("3cc0aa86-0581-4caa-b662-266e58fd39b7"));
x1 = Math.floor(x1);
y1 = Math.floor(y1);
const x = x1 - 320 / 2;
const y = y1 - 290 / 2;
mask.x = x;
mask.y = y;
this.addChild(mask);
const w = mask.width, h = mask.height;
const sw = MConst.DesignResolution.width, sh = MConst.DesignResolution.height;
let top = new engine.Shape();
top.beginFill(0x01103a, 0.8);
top.drawRect(0, 0, sw, y);
top.endFill();
this.addChild(top);
let bottom = new engine.Shape();
bottom.beginFill(0x01103a, 0.8);
bottom.drawRect(x, y + h, w, sh - h - y);
bottom.endFill();
this.addChild(bottom);
let left = new engine.Shape();
left.beginFill(0x01103a, 0.8);
left.drawRect(0, y, x, sh - y);
left.endFill();
this.addChild(left);
let right = new engine.Shape();
right.beginFill(0x01103a, 0.8);
right.drawRect(x + w, y, sw - x - w, sh - y);
right.endFill();
this.addChild(right);
let offsetToMask = config.text.offsetToMask;
let label = new engine.Label();
label.text = config.text.str;
label.size = 24;
label.fillColor = "rgba(255,255,255,1)";
label.x = offsetToMask.x + mask.x;
label.y = offsetToMask.y + mask.y;
this.addChild(label);
if (index == 0) {
let left = new engine.Sprite(RES.getRes("93992a62-e3c4-46d5-99f4-f7ba35fe4f4f"));
left.x = x1 + 200;
left.y = y1 - left.height / 2;
this.addChild(left);
let right = new engine.Sprite(RES.getRes("93992a62-e3c4-46d5-99f4-f7ba35fe4f4f"));
right.x = x1 - 200;
right.scaleX = -1;
right.y = y1 - right.height / 2;
this.addChild(right);
}
if (label.x < 0) {
label.x = 0;
} else if (label.x + label.width > 750) {
label.x = 750 - label.width;
}
this.addEventListener(engine.MouseEvent.MOUSE_DOWN, () => {
this.onClick && this.onClick();
}, this);
}
onClick: () => void;
}
\ No newline at end of file
import GameObject from "./GameObject";
import Physics from "./Physics";
import Physics from "../Phycics/Physics";
import Game from "./Game";
......
import { MConst } from "./MConst";
import { MConfigs } from "./MConfigs";
import { MConst } from "../Global/MConst";
import { MConfigs } from "../Global/MConfigs";
export default class PlayerController extends engine.Container {
public onTouchMove: (deltaX: number) => void = null;
......
import { TextureMgr } from "./Mgr/TextureMgr";
import { MUtils } from "./MUtils";
import MTimer from "./MTimer";
import { Pool, PoolGroup, PoolElement } from "./Pool";
import { TextureMgr } from "../Mgr/TextureMgr";
import { MUtils } from "../Global/MUtils";
import MTimer from "../Global/MTimer";
import { Pool, PoolGroup, PoolElement } from "../Component/Pool";
const InitSpeedValue: number = 0.08;
......
......@@ -127,68 +127,88 @@ export const NumFontData = {
export const DuangAltaData = {
"mc": {
"duang": {
"frameRate": 24,
"events": [],
"frameRate": 60,
"events": [
],
"frames": [
{
"res": "3950AA49",
"x": 64,
"y": 46
"res": "3EABE380",
"x": 114,
"y": 116
},
{
"res": "86D16089",
"x": 27,
"y": 29
"res": "D2951B4",
"x": 104,
"y": 107
},
{
"res": "DB5323C3",
"x": 94,
"y": 97
},
{
"res": "D708FEB1",
"x": 84,
"y": 87
},
{
"res": "F89427A9",
"x": 74,
"y": 78
},
{
"res": "C986141",
"x": 65,
"y": 68
},
{
"res": "4B78217C",
"x": 13,
"y": 21
"res": "567BF25C",
"x": 55,
"y": 58
},
{
"res": "1B30AC5E",
"x": 9,
"y": 19
"res": "21928374",
"x": 45,
"y": 48
},
{
"res": "4C28F4CC",
"x": 177,
"y": 47
"res": "412C16BB",
"x": 35,
"y": 39
},
{
"res": "3D32B0AA",
"x": 25,
"y": 29
},
{
"res": "3AC6F4E4",
"x": 16,
"y": 20
},
{
"res": "AB94C69F",
"x": 5,
"y": 8
}
]
}
},
"res": {
"4B78217C": {
"x": 3,
"y": 60,
"w": 171,
"h": 46
},
"86D16089": {
"x": 3,
"y": 112,
"w": 144,
"h": 36
},
"4C28F4CC": {
"x": 189,
"y": 3,
"w": 14,
"h": 24
},
"3950AA49": {
"x": 3,
"y": 154,
"w": 80,
"h": 16
},
"1B30AC5E": {
"x": 3,
"y": 3,
"w": 180,
"h": 51
}
"21928374": { "x": 594, "y": 1, "w": 237, "h": 168 },
"412C16BB": { "x": 326, "y": 1, "w": 266, "h": 185 },
"D708FEB1": { "x": 450, "y": 340, "w": 122, "h": 97 },
"3D32B0AA": { "x": 1, "y": 223, "w": 294, "h": 203 },
"F89427A9": { "x": 297, "y": 340, "w": 151, "h": 114 },
"DB5323C3": { "x": 1, "y": 428, "w": 93, "h": 79 },
"3AC6F4E4": { "x": 1, "y": 1, "w": 323, "h": 220 },
"C986141": { "x": 833, "y": 1, "w": 179, "h": 132 },
"D2951B4": { "x": 96, "y": 428, "w": 64, "h": 61 },
"AB94C69F": { "x": 594, "y": 171, "w": 5, "h": 5 },
"567BF25C": { "x": 326, "y": 188, "w": 208, "h": 150 },
"3EABE380": { "x": 536, "y": 188, "w": 36, "h": 44 }
}
}
......
import UILayer from "../Component/UILayer";
import MTimer from "./MTimer";
export default class Loading extends UILayer {
private static _instance: Loading;
private waitImg: engine.Sprite;
private iconGroup: engine.Sprite = null;
static get instace(): Loading {
return Loading._instance || (Loading._instance = new Loading());
}
constructor() {
super();
let iconGroup = new engine.Sprite(RES.getRes("b15bd553-b54b-4cc9-85de-bc967eb4d485"));
this.addChild(iconGroup);
let waitImg = new engine.Sprite(RES.getRes("2c0f91d4-eed0-4df3-ac1f-7013d564927d"));
waitImg.horizonCenter = 0;
waitImg.verticalCenter = 0;
iconGroup.addChild(waitImg);
this.waitImg = waitImg;
this.iconGroup = iconGroup;
this.mouseEnabled = true;
MTimer.onFrame("Loading", this.onEnterFrame, this);
}
show() {
this.iconGroup.visible = true;
}
hide() {
this.iconGroup.visible = false;
}
onEnterFrame() {
if (this.visible) {
this.waitImg.rotation += 5;
}
}
}
......@@ -185,8 +185,8 @@ export namespace MConfigs {
text: {
str: "左右移动炮车进行射击和躲避",
offsetToMask: {
x: 41,
y: 240
x: 8,
y: 290
}
}
},
......@@ -195,8 +195,8 @@ export namespace MConfigs {
text: {
str: "拾取金币可获得更多的炮弹输出和得分加成",
offsetToMask: {
x: 41,
y: 394
x: -65,
y: 290
}
}
},
......
import MEvent from "./MEvent";
import MEvent from "../Component/MEvent";
export default class MTimer {
public static init() {
......@@ -95,4 +95,5 @@ function onVisibilityChange() {
function onUpdate() {
updateDeltaTime();
_onFrame.call(MTimer.deltaTime);
timerTickEvent.call();
}
\ No newline at end of file
import { NetUtils } from "./NetUtils";
import { ToastPanel } from "./ShootPlanet";
import { ToastPanel } from "../ShootPlanet";
const projectId = NetUtils.getProjectId();
export default class Net {
......
import { MConfigs } from "./MConfigs";
export default class GuideMask extends engine.Container {
constructor(index: number, x: number, y: number) {
super();
const config = MConfigs.guide[index];
let bg = new engine.Shape();
bg.beginFill(0x000000);
bg.drawRect(0, 0, 750, 1624);
bg.endFill();
bg.alpha = 0.7;
let texture = RES.getRes(config.mask);
let bitmap = new engine.Sprite(texture);
bitmap.x = x - texture.width / 2;
bitmap.y = y - texture.height / 2;
//TODO
/* let container: engine.Container = new engine.Container();
container.addChild(bg);
container.addChild(bitmap);
bitmap.blendMode = engine.BlendMode.ERASE;
let renderTexture: engine.RenderTexture = new engine.RenderTexture();
renderTexture.drawToTexture(container);
let blendBitmap = new engine.Bitmap(renderTexture);
this.addChild(blendBitmap); */
let offsetToMask = config.text.offsetToMask;
let label = new engine.Label();
label.text = config.text.str;
label.size = 24;
label.x = offsetToMask.x + bitmap.x;
label.y = offsetToMask.y + bitmap.y;
this.addChild(label);
//TODO:拿到最新的尺寸
// label.validateSize();
if (label.x < 0) {
label.x = 0;
} else if (label.x + label.width > 750) {
label.x = 750 - label.width;
}
this.addEventListener(engine.MouseEvent.MOUSE_DOWN, () => {
this.onClick && this.onClick();
}, this);
}
onClick: () => void;
}
\ No newline at end of file
import Game from "../Game"
import Game from "../Game/Game"
export class DataMgr {
private static _game: Game = null;
public static init(game: Game) {
DataMgr._game = game;
}
public static get game() {
return DataMgr._game;
}
export namespace DataMgr {
export let game: Game = null;
export let minEnableCaptchaScore: number = null;
}
\ No newline at end of file
import UILayer from "../UILayer";
import MTimer from "../MTimer";
import UILayer from "../Component/UILayer";
import MTimer from "../Global/MTimer";
export default class DebugMgr extends UILayer {
public enabled: boolean = true;
......
import Drop from "../Drop";
import MTimer from "../MTimer";
import Drop from "../Game/Drop";
import MTimer from "../Global/MTimer";
export default class DropBlinkMgr {
private static _instance: DropBlinkMgr = null;
......
import { MUtils } from "./MUtils";
import BoomEffect from "./BoomEffect";
import FrameAnimation from "./Component/FrameAnimation";
import { Pool, PoolGroup, PoolElement } from "./Pool";
import SpBoomEffect from "./SpBoomEffect";
import spBoomEffectPool from "./SpBoomEffect";
import { MUtils } from "../Global/MUtils";
import BoomEffect from "../Game/BoomEffect";
import FrameAnimation from "../Component/FrameAnimation";
import { Pool, PoolGroup, PoolElement } from "../Component/Pool";
import SpBoomEffect from "../Game/SpBoomEffect";
import spBoomEffectPool from "../Game/SpBoomEffect";
export namespace EffectMgr {
let effectLayer: engine.Container = null;
......
import SoundMgr from "./SoundMgr";
import GuideMask from "./GuideMask";
import { ShootPlanet } from "./ShootPlanet";
import GuideMask from "../Game/GuideMask";
import { ShootPlanet } from "../ShootPlanet";
import { DataMgr } from "./DataMgr";
export default class GuideMgr {
......@@ -13,20 +14,6 @@ export default class GuideMgr {
return GuideMgr._instance;
}
public t: number = 0;
public dropNum: number = 0;
private mainScene: ShootPlanet = null;
init(mainScene: ShootPlanet) {
this.mainScene = mainScene;
}
public switchSound() {
SoundMgr.instance.musicEnabled = !SoundMgr.instance.musicEnabled;
SoundMgr.instance.effectEnabled = !SoundMgr.instance.effectEnabled;
}
public get guideFlag(): boolean {
return localStorage.getItem("guide") != "false";
}
......@@ -35,23 +22,16 @@ export default class GuideMgr {
}
private currentGuideMask: GuideMask = null;
public runGuide(index: number, x: number, y: number, end: boolean = false) {
this.mainScene.game.pause = true;
DataMgr.game.pause = true;
this.currentGuideMask = new GuideMask(index, x, y);
this.currentGuideMask.onClick = () => {
this.currentGuideMask && this.currentGuideMask.destroy();
this.mainScene.game.pause = false;
DataMgr.game.pause = false;
if (end) {
this.guideFlag = false;
}
};
this.mainScene.addChild(this.currentGuideMask);
engine.gameStage.addChild(this.currentGuideMask);
}
public minEnableCaptchaScore: number = null;
public leftTimes: number = null;
public leftShareTimes: number = null;
public allPeriodEnd: number = null;
public isWenzhouUser: boolean = false;
}
\ No newline at end of file
import MTimer from "./MTimer";
import MTimer from "../Global/MTimer";
export default class SoundMgr {
private static _instance: SoundMgr = null;
......
import { PoolGroup, PoolElement } from "./Pool";
export default class MovieClipMgr {
private static _instance: MovieClipMgr = null;
public static get instance(): MovieClipMgr {
if (!this._instance) {
this._instance = new MovieClipMgr();
}
return this._instance;
}
// private movieClipData: { [name: string]: engine.MovieClipData } = {};
/* private pool = new class extends PoolGroup<PoolMovieClip>{
createPool(key: string) {
return new class extends Pool<PoolMovieClip>{
createElement() {
return MovieClipMgr.instance.create(key);
}
}();
}
}(); */
public load(name: string): boolean {
/* if (typeof this.movieClipData[name] == "undefined") {
const data = RES.getRes(name + "_json");
const txtr = RES.getRes(name + "_png");
if (!data || !txtr) {
console.error("can not load clip res:" + name);
return false;
}
this.movieClipData[name] = new engine.MovieClipDataFactory(data, txtr).generateMovieClipData(name);
return true;
} else
return true; */
return false;
}
public create(name: string) {
/* if (typeof this.movieClipData[name] == "undefined") {
if (!this.load(name)) {
return null;
}
}
return new PoolMovieClip(this.movieClipData[name]); */
return null;
}
/* public get(name: string): PoolMovieClip {
return this.pool.spwan(name);
}
public recycle(name: string, clip: PoolMovieClip) {
this.pool.recycle(name, clip);
clip.destroy();
} */
}
class PoolMovieClip extends engine.MovieClip implements PoolElement {
onElementInit() { }
onElementRecycle() { }
playOnComplete(): Promise<void> {
//TODO
// this.gotoAndPlay(0, 1);
return new Promise<void>(resolve => {
this.once(engine.Event.COMPLETE, resolve, this);
});
}
autoRecyclePlay(name: string) {
/* this.playOnComplete().then(() => {
MovieClipMgr.instance.recycle(name, this);
}); */
}
}
\ No newline at end of file
import GameComponent from "./GameComponent";
import GameObject from "./GameObject";
import GameComponent from "../Game/GameComponent";
import GameObject from "../Game/GameObject";
import PhycicsSystem from "./PhycicsSystem";
import Physics from "./Physics";
......
import Physics from "./Physics";
import Collider, { CircleCollider, RectCollider, ColliderType, ColliderGroup, PointCollider } from "./Collider";
import { arrayRemove } from "./GUtils";
import MTimer from "./MTimer";
import DebugMgr from "./Mgr/DebugMgr";
import { arrayRemove } from "../Global/GUtils";
import MTimer from "../Global/MTimer";
import DebugMgr from "../Mgr/DebugMgr";
let instanceId1: number = null;
let instanceId2: number = null;
......
import GameComponent from "./GameComponent";
import GameObject from "./GameObject";
import GameComponent from "../Game/GameComponent";
import GameObject from "../Game/GameObject";
import PhycicsSystem from "./PhycicsSystem";
import Collider from "./Collider";
......
/* import { PoolElement } from "./Pool";
import GameObject from "./GameObject";
export default abstract class PoolMgr<T extends PoolElement & engine.Container>{
public layer: engine.Container = null;
public pool: Pool<T> = new class extends Pool<T>{
private context: PoolMgr<T> = null;
constructor(context: PoolMgr<T>) {
super();
this.context = context;
}
createElement(...args: any[]) {
return this.context.createElement(args);
}
}(this);
constructor(layer: engine.Container) {
this.layer = layer;
}
create(...args: any[]): T {
let element = this.pool.get(...args);
this.layer.addChild(element);
return element;
}
destroy(element: T) {
this.pool.recycle(element);
}
abstract createElement(...args: any[]): T;
} */
\ No newline at end of file
import { Pool, PoolGroup } from "../Pool";
import Ball from "../Ball";
import Game from "../Game";
import { Pool, PoolGroup } from "../Component/Pool";
import Ball from "../Game/Ball";
import Game from "../Game/Game";
import { DataMgr } from "../Mgr/DataMgr";
class BallPool extends Pool<Ball>{
......
import { Pool, PoolElement, PoolGroup } from "../Pool";
import { BoomEffectSprite } from "../BoomEffect";
import { Pool, PoolElement, PoolGroup } from "../Component/Pool";
import { BoomEffectSprite } from "../Game/BoomEffect";
/* import BoomEffect from "../BoomEffect";
import { Pool, PoolGroup } from "../Pool";
......
import Bullet from "../Bullet";
import { Pool } from "../Pool";
import Bullet from "../Game/Bullet";
import { Pool } from "../Component/Pool";
class BulletPool extends Pool<Bullet> {
public spwan() {
......
import { Pool, PoolGroup } from "../Pool";
import Drop from "../Drop";
import { Pool, PoolGroup } from "../Component/Pool";
import Drop from "../Game/Drop";
class DropPool extends Pool<Drop> {
public spwan(id: number) {
......
import Game from "./Game";
import PhycicsSystem from "./PhycicsSystem";
import MTimer from "./MTimer";
import { MTween } from "./MTween";
import Game from "./Game/Game";
import PhycicsSystem from "./Phycics/PhycicsSystem";
import MTimer from "./Global/MTimer";
import { MTween } from "./Component/MTween";
import DropBlinkMgr from "./Mgr/DropBlinkMgr";
import Ball from "./Ball";
import MEvent from "./MEvent";
import Ball from "./Game/Ball";
import MEvent from "./Component/MEvent";
import { DataMgr } from "./Mgr/DataMgr";
import DebugMgr from "./Mgr/DebugMgr";
import FrameAnimation from "./Component/FrameAnimation";
import Drop from "./Drop";
import { SpBoomEffectMgr } from "./SpBoomEffect";
import Drop from "./Game/Drop";
import { SpBoomEffectMgr } from "./Game/SpBoomEffect";
import GuideMask from "./Game/GuideMask";
import GuideMgr from "./Mgr/GuideMgr";
import { MConst } from "./Global/MConst";
import { NetUtils } from "./Global/NetUtils";
import Net from "./Global/Net";
import Loading from "./Global/Loading";
import { initNECaptcha } from "./Component/InitNECaptcha";
/**
* Created by rockyl on 2019-11-22.
......@@ -17,8 +24,28 @@ import { SpBoomEffectMgr } from "./SpBoomEffect";
export class ShootPlanet extends engine.Container {
public game: Game = null;
private isSubmited = false;
private constantSubmitSeq = 1;
private needSubmitCount = 0; //实际分数减去ConstantSubmitScoreNum的次数
private isSubmiting = false;
public startId: number = null;
private onFrame: MEvent<(t: number) => void> = new MEvent();
private _localScore: number = 0;
public get localScore(): number {
return this._localScore;
}
public set localScore(v: number) {
this._localScore = v;
if (this._localScore >= MConst.ConstantSubmitScoreNum) {
let count = Math.floor(this._localScore / MConst.ConstantSubmitScoreNum);
this.needSubmitCount += count;
this._localScore -= MConst.ConstantSubmitScoreNum * count;
if (!this.isSubmiting) {
this.constantSubmit();
}
}
}
constructor() {
super();
......@@ -29,6 +56,11 @@ export class ShootPlanet extends engine.Container {
this.height = 1624;
this.addEventListener(engine.Event.REMOVED_FROM_STAGE, this.onDestroy, this);
this.init();
if (GuideMgr.instance.guideFlag == true) {
const car = this.game._car;
GuideMgr.instance.runGuide(0, car.x + car.width / 2, car.y + car.height / 2 /* - 130 */);
}
}
private init() {
......@@ -36,7 +68,7 @@ export class ShootPlanet extends engine.Container {
MTimer.init();
MTween.init();
DropBlinkMgr.init();
DataMgr.init(this.game);
DataMgr.game = this.game;
DebugMgr.instance.init(this);
MTimer.onFrame("FrameAnimation", FrameAnimation.onUpdate, FrameAnimation);
......@@ -70,6 +102,116 @@ export class ShootPlanet extends engine.Container {
this.parent.removeChild(this);
}
}
private constantSubmit(score: number = MConst.ConstantSubmitScoreNum) {
if (this.isSubmiting) {
return;
}
if (this.needSubmitCount == 0) {
return;
} else if (this.needSubmitCount < 0) {
//异常,有bug
console.error("invalid needSubmitCount value");
return;
}
this.isSubmiting = true;
let seq = NetUtils.encryptSeq(this.constantSubmitSeq);
return new Promise((resolve, reject) => {
Net.sendPost(Net.Url.constantSubmit, {
startId: this.startId,
seq: seq,
score: score,
token: NetUtils.md5(this.startId.toString() + seq.toString() + score.toString() + "wzmsBank123")
}, () => {
this.constantSubmitSeq++;
this.needSubmitCount--;
this.isSubmiting = false;
resolve();
}, (res) => {
this.isSubmiting = false;
Net.defaultOnFail(res);
reject();
});
});
}
/* private updateTime() {
let temp = Math.ceil(this.game.timer / 1000);
let second = temp % 60;
let minute = (temp - second) / 60;
let str = "";
str += (minute < 10 ? "0" : "") + minute.toString();
str += ":";
str += (second < 10 ? "0" : "") + second.toString();
this.labelTime.text = str;
} */
public async finalSubmit(propsId?: string, onSubmited?: () => void) {
if (this.isSubmited) {
return;
}
this.isSubmited = true;
Loading.instace.show();
if (this.needSubmitCount > 0) {
if (!this.isSubmiting) {
while (this.needSubmitCount > 0) {
await this.constantSubmit();
}
}
}
const score = this.game.score;
let serverScore = this.localScore + (this.constantSubmitSeq - 1 + this.needSubmitCount) * MConst.ConstantSubmitScoreNum;
if (serverScore != score) {
console.error(`[score error] server:${serverScore} local:${score}`);
} else {
console.log(`[score] server:${serverScore} local:${score}`);
}
//中途提交最后一次
if (this.localScore > 0) {
this.needSubmitCount++;
await this.constantSubmit(this.localScore);
console.log("extra submit:" + this.localScore);
}
//滑块验证
let validate = await new Promise<string>(resolve => {
if (typeof DataMgr.minEnableCaptchaScore == "number" && score >= DataMgr.minEnableCaptchaScore) {
initNECaptcha({
captchaId: MConst.captchaId,
callback: (ret: { validate: string }) => {
resolve(ret.validate);
}
});
} else {
resolve("");
}
});
return new Promise<any>((resolve, reject) => {
//调用接口
Net.sendPost(Net.Url.finalSubmit, {
startId: this.startId,
score: score,
useSpId: propsId || "",
token: NetUtils.md5(this.startId.toString() + score.toString() + "wzmsBank123"),
validate: validate
}, (res) => {
Loading.instace.hide();
resolve(res);
}, (res) => {
Net.defaultOnFail(res);
reject(res);
});
});
}
}
export class ToastPanel {
......
......@@ -147,7 +147,7 @@
"ext": ".png"
},
{
"url": "//yun.duiba.com.cn/aurora/assets/65378e37b388fddb8fe5124a8e9bc49ed1a716fb.png",
"url": "//yun.duiba.com.cn/aurora/assets/146264ea11a3cbb28b6d22b3ee19e98c71fe9273.png",
"uuid": "217164f4-a185-429c-8706-818137a4e438",
"ext": ".png"
},
......@@ -161,11 +161,6 @@
"uuid": "53c65221-3fbc-41d9-8cef-8a846876fe06",
"ext": ".png"
},
{
"url": "",
"uuid": "",
"ext": ".png"
},
{
"url": "//yun.duiba.com.cn/aurora/4b4af30efa87c1ec74e361a505053639f1d8e471.png",
"uuid": "ddf5128e-be66-4c00-8505-e4167aac37bc",
......@@ -215,6 +210,31 @@
"url": "//yun.duiba.com.cn/aurora/assets/dd5a9c4b4cb94bd0049890c0aad320ec539a7e16.png",
"uuid": "2ddd9477-12de-4f13-bb35-5b255f1624bd",
"ext": ".png"
},
{
"url": "",
"uuid": "",
"ext": ".png"
},
{
"url": "//yun.duiba.com.cn/aurora/assets/d4ac501c938e2b7cd4beaf737ff07c53afe18c44.png",
"uuid": "3cc0aa86-0581-4caa-b662-266e58fd39b7",
"ext": ".png"
},
{
"url": "//yun.duiba.com.cn/aurora/assets/905239e8db76682f47339668e7d9279b2ec4f0e2.png",
"uuid": "93992a62-e3c4-46d5-99f4-f7ba35fe4f4f",
"ext": ".png"
},
{
"url": "//yun.duiba.com.cn/aurora/assets/fe3739eac24e5e558ac52aea656316ce4f264863.png",
"uuid": "2c0f91d4-eed0-4df3-ac1f-7013d564927d",
"ext": ".png"
},
{
"url": "//yun.duiba.com.cn/aurora/assets/3a3e5a0f6836282e7262e27479379e61ffcd9a56.png",
"uuid": "b15bd553-b54b-4cc9-85de-bc967eb4d485",
"ext": ".png"
}
]
}
\ No newline at end of file
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
<meta content="telephone=no" name="format-detection" />
<title>我的奖品</title>
<script>
!function (e, i) { var t = e.documentElement, n = navigator.userAgent.match(/iphone|ipod|ipad/gi), a = n ? Math.min(i.devicePixelRatio, 3) : 1, m = "orientationchange" in window ? "orientationchange" : "resize"; t.dataset.dpr = a; for (var d, l, c = !1, o = e.getElementsByTagName("meta"), r = 0; r < o.length; r++)l = o[r], "viewport" == l.name && (c = !0, d = l); if (c) d.content = "width=device-width,initial-scale=1.0,maximum-scale=1.0, minimum-scale=1.0,user-scalable=no"; else { var o = e.createElement("meta"); o.name = "viewport", o.content = "width=device-width,initial-scale=1.0,maximum-scale=1.0, minimum-scale=1.0,user-scalable=no", t.firstElementChild.appendChild(o) } var s = function () { var e = t.clientWidth; e / a > 640 && (e = 640 * a), window.remScale = e / 640, t.style.fontSize = 200 * (e / 640) + "px" }; s(), e.addEventListener && i.addEventListener(m, s, !1) }(document, window);
</script>
<script type="text/javascript">
if (localStorage && localStorage.iswebp) {
document.getElementsByTagName('html')[0].setAttribute('duiba-webp', 'true')
}
</script>
</head>
<body>
<link rel="stylesheet" type="text/css" href="https://yun.duiba.com.cn/h5/common/base_201710241714.css">
<link href="//yun.duiba.com.cn/h5/activity_custom/skins/nanjing-record-190807/index.6748f280.css" rel="stylesheet">
<div id="db-content" style="display: none;">
<!--<a href="javascript:history.go(-1)" class="back1" ></a>-->
<div class="recordBox">
<!-- 填充 -->
</div>
<div class="nomore">已经没有更多了!</div>
<div style="display: none" class="noData">暂无数据</div>
</div>
<script>
var CFG = CFG || {};
CFG.needCouponModal = false;
CFG.projectId = 'projectx/' + location.pathname.split('/')[2];
CFG.asyncFiles = [
'//yun.duiba.com.cn/h5/activity_custom/skins/nanjing-record-190807/components.5560b2c5.js',
'//yun.duiba.com.cn/h5/activity_custom/skins/nanjing-record-190807/components.0e433876.css'
]
</script>
<script type="text/javascript" crossorigin="anonymous"
src="https://yun.duiba.com.cn/h5/common/base_201812191516.js"></script>
<script type="text/javascript" crossOrigin="anonymous"
src="//yun.duiba.com.cn/h5/activity_custom/skins/nanjing-record-190807/index.5815e161.js"></script>
<script type="text/javascript" src="https://m1.cmbc.com.cn/CMBC_MBServer/scripts/js/cmbcForClient.js"></script>
<script>
var titleName = document.title
var title = {
"title": titleName, // 标题名
"leftButton": { // 左按钮
"exist": "true", // true:显示左按钮,false:也显示左按钮,客户端不调用左按钮的返回事件
"name": "返回", // 按钮的说明
"func": "window.history.go(-1)" // 点击左按钮时,客户端回调服务器的方法
},
"rightButton": {
"exist": "false" // 不显示右按钮
}
}
setTitleBar(title);
</script>
<script>
/* var oHead = document.querySelector('body');
var oScript = document.createElement('script');
oScript.type = 'text/javascript';
oScript.src = '//yun.duiba.com.cn/webapp/js/vconsole.min.js';
oHead.appendChild(oScript);
oScript.onload = function () {
var vConsole = new VConsole();
} */
</script>
</body>
</html>
\ No newline at end of file
{
"file": "num2.png",
"frames": {
".": {
"x": 3,
"y": 215,
"w": 16,
"h": 17,
"offX": 7,
"offY": 49,
"sourceW": 29,
"sourceH": 66
},
"k": {
"x": 155,
"y": 3,
"w": 42,
"h": 65,
"offX": 6,
"offY": 0,
"sourceW": 48,
"sourceH": 66
},
"0": {
"x": 3,
"y": 144,
"w": 44,
"h": 65,
"offX": 2,
"offY": 1,
"sourceW": 48,
"sourceH": 66
},
"1": {
"x": 145,
"y": 74,
"w": 27,
"h": 65,
"offX": 7,
"offY": 0,
"sourceW": 48,
"sourceH": 66
},
"2": {
"x": 53,
"y": 74,
"w": 41,
"h": 64,
"offX": 3,
"offY": 1,
"sourceW": 48,
"sourceH": 66
},
"3": {
"x": 100,
"y": 74,
"w": 39,
"h": 65,
"offX": 5,
"offY": 1,
"sourceW": 48,
"sourceH": 66
},
"4": {
"x": 3,
"y": 3,
"w": 48,
"h": 64,
"offX": 0,
"offY": 1,
"sourceW": 48,
"sourceH": 66
},
"5": {
"x": 53,
"y": 144,
"w": 39,
"h": 65,
"offX": 5,
"offY": 1,
"sourceW": 48,
"sourceH": 66
},
"6": {
"x": 106,
"y": 3,
"w": 43,
"h": 65,
"offX": 3,
"offY": 1,
"sourceW": 48,
"sourceH": 66
},
"7": {
"x": 203,
"y": 3,
"w": 42,
"h": 64,
"offX": 3,
"offY": 1,
"sourceW": 48,
"sourceH": 66
},
"8": {
"x": 3,
"y": 73,
"w": 44,
"h": 65,
"offX": 2,
"offY": 1,
"sourceW": 48,
"sourceH": 66
},
"9": {
"x": 57,
"y": 3,
"w": 43,
"h": 65,
"offX": 2,
"offY": 1,
"sourceW": 48,
"sourceH": 66
}
}
}
\ No newline at end of file
let t = {
}
\ No newline at end of file
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