Commit 708a3fd5 authored by wjf's avatar wjf

l

parent 20e8ee56
...@@ -156,10 +156,14 @@ export default class MainBase extends eui.UILayer { ...@@ -156,10 +156,14 @@ export default class MainBase extends eui.UILayer {
for (var i = 0; i <= 9; i++) { for (var i = 0; i <= 9; i++) {
RES.getResAsync("targetNumber" + i + "_png") RES.getResAsync("targetNumber" + i + "_png")
} }
for (var i = 0; i <= 9; i++) {
RES.getResAsync("propNum" + i + "_png")
}
for (var i = 1; i <= 5; i++) { for (var i = 1; i <= 5; i++) {
RES.getResAsync("guideTxt" + i + "_png") RES.getResAsync("guideTxt" + i + "_png")
} }
var arr = [ var arr = [
"propNumBg",
"guideBg", "guideBg",
"guideKnowBtn", "guideKnowBtn",
"bonusShoot", "bonusShoot",
......
...@@ -57,11 +57,11 @@ ...@@ -57,11 +57,11 @@
"name": "startpanel" "name": "startpanel"
}, },
{ {
"keys": "yezi1_png,unlightedStar_png,targetBoard_png,stepsBoard_png,stepNumber9_png,stepNumber8_png,stepNumber7_png,stepNumber6_png,stepNumber5_png,stepNumber4_png,stepNumber3_png,stepNumber2_png,stepNumber1_png,stepNumber0_png,stepBtn_png,starProgress_png,setting_png,scoreNumber9_png,scoreNumber8_png,scoreNumber7_png,scoreNumber6_png,scoreNumber5_png,scoreNumber4_png,scoreNumber3_png,scoreNumber2_png,scoreNumber1_png,scoreNumber0_png,rock6_png,rock5_png,rock4_png,rock3_png,rock2_png,rock1_png,rightMark_png,rightArrow_png,rectLat_png,progressDown_png,playSceneBg_png,magicLionBg_png,magicLion_png,lockUp_png,lockDown_png,lineLight_png,lightedStar_png,leftArrow_png,ice6_png,ice5_png,ice4_png,ice3_png,ice2_png,ice1_png,hammerBtn_png,eleDis9_png,eleDis8_png,eleDis7_png,eleDis6_png,eleDis5_png,eleDis4_png,eleDis3_png,eleDis2_png,eleDis12_png,eleDis11_png,eleDis10_png,eleDis1_png,ele5_png,ele42_png,ele41_png,ele40_png,ele4_png,ele32_png,ele31_png,ele30_png,ele3_png,ele22_png,ele21_png,ele20_png,ele2_png,ele12_png,ele11_png,ele10_png,ele1_png,ele02_png,ele01_png,ele00_png,ele0_png,dangqianfenshu_png,chooseRect_png,boomBtn_png,boom9_png,boom8_png,boom7_png,boom6_png,boom5_png,boom4_png,boom3_png,boom2_png,boom18_png,boom17_png,boom16_png,boom15_png,boom14_png,boom13_png,boom12_png,boom11_png,boom10_png,boom1_png,mainSoundBtnOn_png,mainSettingBg_png,mainQuestionBtn_png,mainMusicBtnOn_png,mainQuitBtn_png,mainSoundBtnOff_png,mainMusicBtnOff_png,targetNumber9_png,targetNumber8_png,targetNumber7_png,targetNumber6_png,targetNumber5_png,targetNumber4_png,targetNumber3_png,targetNumber2_png,targetNumber1_png,targetNumber0_png,ele7_png,ele6_png,bonusFra9_png,bonusFra8_png,bonusFra7_png,bonusFra6_png,bonusFra5_png,bonusFra4_png,bonusFra3_png,bonusFra27_png,bonusFra26_png,bonusFra25_png,bonusFra24_png,bonusFra23_png,bonusFra22_png,bonusFra21_png,bonusFra20_png,bonusFra2_png,bonusFra19_png,bonusFra18_png,bonusFra17_png,bonusFra16_png,bonusFra15_png,bonusFra14_png,bonusFra13_png,bonusFra12_png,bonusFra11_png,bonusFra10_png,bonusFra1_png,bonusShoot_png,guideTxt5_png,guideTxt4_png,guideTxt3_png,guideTxt2_png,guideTxt1_png,guideKnowBtn_png,guideBg_png", "keys": "yezi1_png,unlightedStar_png,targetBoard_png,stepsBoard_png,stepNumber9_png,stepNumber8_png,stepNumber7_png,stepNumber6_png,stepNumber5_png,stepNumber4_png,stepNumber3_png,stepNumber2_png,stepNumber1_png,stepNumber0_png,stepBtn_png,starProgress_png,setting_png,scoreNumber9_png,scoreNumber8_png,scoreNumber7_png,scoreNumber6_png,scoreNumber5_png,scoreNumber4_png,scoreNumber3_png,scoreNumber2_png,scoreNumber1_png,scoreNumber0_png,rock6_png,rock5_png,rock4_png,rock3_png,rock2_png,rock1_png,rightMark_png,rightArrow_png,rectLat_png,progressDown_png,playSceneBg_png,magicLionBg_png,magicLion_png,lockUp_png,lockDown_png,lineLight_png,lightedStar_png,leftArrow_png,ice6_png,ice5_png,ice4_png,ice3_png,ice2_png,ice1_png,hammerBtn_png,eleDis9_png,eleDis8_png,eleDis7_png,eleDis6_png,eleDis5_png,eleDis4_png,eleDis3_png,eleDis2_png,eleDis12_png,eleDis11_png,eleDis10_png,eleDis1_png,ele5_png,ele42_png,ele41_png,ele40_png,ele4_png,ele32_png,ele31_png,ele30_png,ele3_png,ele22_png,ele21_png,ele20_png,ele2_png,ele12_png,ele11_png,ele10_png,ele1_png,ele02_png,ele01_png,ele00_png,ele0_png,dangqianfenshu_png,chooseRect_png,boomBtn_png,boom9_png,boom8_png,boom7_png,boom6_png,boom5_png,boom4_png,boom3_png,boom2_png,boom18_png,boom17_png,boom16_png,boom15_png,boom14_png,boom13_png,boom12_png,boom11_png,boom10_png,boom1_png,mainSoundBtnOn_png,mainSettingBg_png,mainQuestionBtn_png,mainMusicBtnOn_png,mainQuitBtn_png,mainSoundBtnOff_png,mainMusicBtnOff_png,targetNumber9_png,targetNumber8_png,targetNumber7_png,targetNumber6_png,targetNumber5_png,targetNumber4_png,targetNumber3_png,targetNumber2_png,targetNumber1_png,targetNumber0_png,ele7_png,ele6_png,bonusFra9_png,bonusFra8_png,bonusFra7_png,bonusFra6_png,bonusFra5_png,bonusFra4_png,bonusFra3_png,bonusFra27_png,bonusFra26_png,bonusFra25_png,bonusFra24_png,bonusFra23_png,bonusFra22_png,bonusFra21_png,bonusFra20_png,bonusFra2_png,bonusFra19_png,bonusFra18_png,bonusFra17_png,bonusFra16_png,bonusFra15_png,bonusFra14_png,bonusFra13_png,bonusFra12_png,bonusFra11_png,bonusFra10_png,bonusFra1_png,bonusShoot_png,guideTxt5_png,guideTxt4_png,guideTxt3_png,guideTxt2_png,guideTxt1_png,guideKnowBtn_png,guideBg_png,propNum9_png,propNum8_png,propNum7_png,propNum6_png,propNum5_png,propNum4_png,propNum3_png,propNum2_png,propNum1_png,propNum0_png,propNumBg_png",
"name": "mainScene" "name": "mainScene"
}, },
{ {
"keys": "showoff_jpg,share2_jpg", "keys": "showoff_jpg,share2_jpg,propNum9_png,propNum0_png,propNum1_png,propNum2_png,propNum3_png,propNum4_png,propNum5_png,propNum6_png,propNum7_png,propNum8_png,propNumBg_png",
"name": "preload" "name": "preload"
} }
], ],
...@@ -1355,6 +1355,61 @@ ...@@ -1355,6 +1355,61 @@
"url": "assets/mainScene/guideTxt4.png", "url": "assets/mainScene/guideTxt4.png",
"type": "image", "type": "image",
"name": "guideTxt4_png" "name": "guideTxt4_png"
},
{
"url": "assets/mainScene/propNum9.png",
"type": "image",
"name": "propNum9_png"
},
{
"url": "assets/mainScene/propNum0.png",
"type": "image",
"name": "propNum0_png"
},
{
"url": "assets/mainScene/propNum1.png",
"type": "image",
"name": "propNum1_png"
},
{
"url": "assets/mainScene/propNum2.png",
"type": "image",
"name": "propNum2_png"
},
{
"url": "assets/mainScene/propNum3.png",
"type": "image",
"name": "propNum3_png"
},
{
"url": "assets/mainScene/propNum4.png",
"type": "image",
"name": "propNum4_png"
},
{
"url": "assets/mainScene/propNum5.png",
"type": "image",
"name": "propNum5_png"
},
{
"url": "assets/mainScene/propNum6.png",
"type": "image",
"name": "propNum6_png"
},
{
"url": "assets/mainScene/propNum7.png",
"type": "image",
"name": "propNum7_png"
},
{
"url": "assets/mainScene/propNum8.png",
"type": "image",
"name": "propNum8_png"
},
{
"url": "assets/mainScene/propNumBg.png",
"type": "image",
"name": "propNumBg_png"
} }
] ]
} }
\ No newline at end of file
...@@ -43,6 +43,9 @@ import { BonusShootAni, stepPosition } from '../something/anis/BonusShootAni'; ...@@ -43,6 +43,9 @@ import { BonusShootAni, stepPosition } from '../something/anis/BonusShootAni';
import { GuideMsg } from '../something/uis/GuideMsg'; import { GuideMsg } from '../something/uis/GuideMsg';
import Loading from '../../libs/new_wx/components/Loading'; import Loading from '../../libs/new_wx/components/Loading';
import { getlogItem } from '../Main'; import { getlogItem } from '../Main';
import getHomeData, { getPropNums } from '../getHomeData';
import PropType from '../PropType';
import { PropNumShow } from '../something/uis/PropNumShow';
// import BridgeFactory from "../../libs/JSBridge/bridge/BridgeFactory"; // import BridgeFactory from "../../libs/JSBridge/bridge/BridgeFactory";
const aniClass = { const aniClass = {
...@@ -178,7 +181,9 @@ export default class MainScene extends Scene { ...@@ -178,7 +181,9 @@ export default class MainScene extends Scene {
//同时加进度条,和星星的判断 //同时加进度条,和星星的判断
// this.scoreProgress.score=value // this.scoreProgress.score=value
} }
boomBtnNum: PropNumShow;
hammerBtnNum: PropNumShow;
stepBtnNum: PropNumShow;
start(data) { start(data) {
super.start(); super.start();
//初始化索引信息 //初始化索引信息
...@@ -294,7 +299,7 @@ export default class MainScene extends Scene { ...@@ -294,7 +299,7 @@ export default class MainScene extends Scene {
//容器事件 //容器事件
this.elementContainer.addEventListener(egret.TouchEvent.TOUCH_BEGIN, this.mouseDownE, this); this.elementContainer.addEventListener(egret.TouchEvent.TOUCH_BEGIN, this.mouseDownE, this);
this.elementContainer.addEventListener(egret.TouchEvent.TOUCH_MOVE, this.mouseMoveE, this); this.elementContainer.addEventListener(egret.TouchEvent.TOUCH_MOVE, this.mouseMoveE, this);
//根据缓存修改音乐显示按钮 //根据修改音乐显示按钮
if (getSoundOn()) { if (getSoundOn()) {
this.soundBtn.source = "mainSoundBtnOn_png" this.soundBtn.source = "mainSoundBtnOn_png"
} else { } else {
...@@ -305,6 +310,20 @@ export default class MainScene extends Scene { ...@@ -305,6 +310,20 @@ export default class MainScene extends Scene {
} else { } else {
this.musicBtn.source = "mainSoundBtnOff_png" this.musicBtn.source = "mainSoundBtnOff_png"
} }
//初始化道具信息
var arrObj = ["boomBtnNum", "hammerBtnNum", "stepBtnNum"];
var nums = [getPropNums(PropType.BOOM), getPropNums(PropType.HAMMER), getPropNums(PropType.CHANCE_NUM)]
for (var i = 0; i < 3; i++) {
this[arrObj[i]] = new PropNumShow();
this[arrObj[i]].x = 205 + i * 195;
this[arrObj[i]].y = 1125;
this[arrObj[i]].count = nums[i];
this.addChild(this[arrObj[i]])
}
//用一次发一次hc_home接口
// getPropNums(PropType.BOOM);
// getPropNums(PropType.HAMMER);
// getPropNums(PropType.CHANCE_NUM);
} }
//初始化格子 //初始化格子
initLattices() { initLattices() {
...@@ -437,6 +456,16 @@ export default class MainScene extends Scene { ...@@ -437,6 +456,16 @@ export default class MainScene extends Scene {
} }
return Tool.randomT(arr); return Tool.randomT(arr);
} }
/**
* 更新三个道具
*/
updateScene() {
var arrObj = ["boomBtnNum", "hammerBtnNum", "stepBtnNum"];
var nums = [getPropNums(PropType.BOOM), getPropNums(PropType.HAMMER), getPropNums(PropType.CHANCE_NUM)]
for (var i = 0; i < 3; i++) {
this[arrObj[i]].count = nums[i];
}
}
// 初始化埋点信息 // 初始化埋点信息
initBuired() { initBuired() {
...@@ -457,6 +486,10 @@ export default class MainScene extends Scene { ...@@ -457,6 +486,10 @@ export default class MainScene extends Scene {
this.soundBtn.addEventListener(egret.TouchEvent.TOUCH_TAP, this.onTap_soundBtnn, this) this.soundBtn.addEventListener(egret.TouchEvent.TOUCH_TAP, this.onTap_soundBtnn, this)
this.musicBtn.addEventListener(egret.TouchEvent.TOUCH_TAP, this.onTap_musicBtn, this) this.musicBtn.addEventListener(egret.TouchEvent.TOUCH_TAP, this.onTap_musicBtn, this)
this.quitBtn.addEventListener(egret.TouchEvent.TOUCH_TAP, this.onTap_quitBtn, this) this.quitBtn.addEventListener(egret.TouchEvent.TOUCH_TAP, this.onTap_quitBtn, this)
this.boomBtn.addEventListener(egret.TouchEvent.TOUCH_TAP, this.onTap_boomBtn, this)
this.hammerBtn.addEventListener(egret.TouchEvent.TOUCH_TAP, this.onTap_hammerBtn, this)
this.stepBtn.addEventListener(egret.TouchEvent.TOUCH_TAP, this.onTap_stepBtn, this)
} }
removeEvents() { removeEvents() {
...@@ -466,6 +499,10 @@ export default class MainScene extends Scene { ...@@ -466,6 +499,10 @@ export default class MainScene extends Scene {
this.soundBtn.removeEventListener(egret.TouchEvent.TOUCH_TAP, this.onTap_soundBtnn, this) this.soundBtn.removeEventListener(egret.TouchEvent.TOUCH_TAP, this.onTap_soundBtnn, this)
this.musicBtn.removeEventListener(egret.TouchEvent.TOUCH_TAP, this.onTap_musicBtn, this) this.musicBtn.removeEventListener(egret.TouchEvent.TOUCH_TAP, this.onTap_musicBtn, this)
this.quitBtn.removeEventListener(egret.TouchEvent.TOUCH_TAP, this.onTap_quitBtn, this) this.quitBtn.removeEventListener(egret.TouchEvent.TOUCH_TAP, this.onTap_quitBtn, this)
this.boomBtn.removeEventListener(egret.TouchEvent.TOUCH_TAP, this.onTap_boomBtn, this)
this.hammerBtn.removeEventListener(egret.TouchEvent.TOUCH_TAP, this.onTap_hammerBtn, this)
this.stepBtn.removeEventListener(egret.TouchEvent.TOUCH_TAP, this.onTap_stepBtn, this)
} }
onEnterFrame() { onEnterFrame() {
if (this.enableTouch) { if (this.enableTouch) {
...@@ -535,14 +572,37 @@ export default class MainScene extends Scene { ...@@ -535,14 +572,37 @@ export default class MainScene extends Scene {
onTap_quitBtn() { onTap_quitBtn() {
PanelCtrl.instance.show("quit"); PanelCtrl.instance.show("quit");
} }
onTap_boomBtn(){ onTap_boomBtn() {
NetManager.ins.showLog(getlogItem(7)) NetManager.ins.showLog(getlogItem(7));
if (this.boomBtnNum.count <= 0) {
//购买弹框
PanelCtrl.instance.show("Buy1")
} else {
}
} }
onTap_hammerBtn(){ onTap_hammerBtn() {
NetManager.ins.showLog(getlogItem(10)) NetManager.ins.showLog(getlogItem(10));
if (this.hammerBtnNum.count <= 0) {
//购买弹框
PanelCtrl.instance.show("Buy2", {})
} else {
}
} }
onTap_stepBtn(){ onTap_stepBtn() {
NetManager.ins.showLog(getlogItem(13)) NetManager.ins.showLog(getlogItem(13));
if (this.stepBtnNum.count <= 0) {
//购买弹框
PanelCtrl.instance.show("Buy3", {})
} else {
//再写
NetManager.ins.hc_useProp((s) => {
if(s){
}
}, PropType.CHANCE_NUM)
}
} }
mouseDownE(e: egret.TextEvent) { mouseDownE(e: egret.TextEvent) {
...@@ -612,7 +672,7 @@ export default class MainScene extends Scene { ...@@ -612,7 +672,7 @@ export default class MainScene extends Scene {
this.recoverEle(ele.index); this.recoverEle(ele.index);
this.lollipopCount--; this.lollipopCount--;
//通关目标还有棒棒糖,并且,图中已为0,下次需要生成 //通关目标还有棒棒糖,并且,图中已为0,下次需要生成
if (this.passElements[ElementType.LOLLIPOP] && this.lollipopCount <= 0) { if (this.passElements && this.passElements[ElementType.LOLLIPOP] && this.lollipopCount <= 0) {
this.lollipopCount = 0; this.lollipopCount = 0;
this.lollipopMark = true this.lollipopMark = true
} }
...@@ -838,7 +898,7 @@ export default class MainScene extends Scene { ...@@ -838,7 +898,7 @@ export default class MainScene extends Scene {
this.recoverEle(index); this.recoverEle(index);
this.lollipopCount--; this.lollipopCount--;
//通关目标还有棒棒糖,并且,图中已为0,下次需要生成 //通关目标还有棒棒糖,并且,图中已为0,下次需要生成
if (this.passElements[ElementType.LOLLIPOP] && this.lollipopCount <= 0) { if (this.passElements && this.passElements[ElementType.LOLLIPOP] && this.lollipopCount <= 0) {
this.lollipopCount = 0; this.lollipopCount = 0;
this.lollipopMark = true this.lollipopMark = true
} }
......
...@@ -38,27 +38,27 @@ export const Chapters: ChapterData[] = [ ...@@ -38,27 +38,27 @@ export const Chapters: ChapterData[] = [
baseElementTypes: [0, 1, 2, 3], baseElementTypes: [0, 1, 2, 3],
effectInitProbability: 0.15, effectInitProbability: 0.15,
stepCount: 30, stepCount: 30,
// passTarget: {
// type: PassType.SCORE_TARGET,
// score: 10000000,
// },
passTarget: { passTarget: {
type: PassType.ELEMENT_TARGET, type: PassType.SCORE_TARGET,
elements: [ score: 10000,
// {
// type: ElementType.ICE,
// count: 100,
// },
{
type: ElementType.RABBIT,
count: 56,
},
{
type: ElementType.LOLLIPOP,
count: 2,
}
],
}, },
// passTarget: {
// type: PassType.ELEMENT_TARGET,
// elements: [
// // {
// // type: ElementType.ICE,
// // count: 100,
// // },
// {
// type: ElementType.RABBIT,
// count: 56,
// },
// {
// type: ElementType.LOLLIPOP,
// count: 2,
// }
// ],
// },
starScores: [3000, 5000, 10000] starScores: [3000, 5000, 10000]
} }
] ]
\ No newline at end of file
import { PropNumber } from "./PropNumber";
/**
* 道具显示数字
*/
export class PropNumShow extends egret.DisplayObjectContainer {
/**
* 灰度滤镜
*/
private colorFlilter;
/**
* 数量文案
*/
private countNum: PropNumber;
/**
* 数量
*/
private _count: number;
get count(): number {
return this._count;
}
set count(value: number) {
if (value <= 0) {
value = 0;
//变灰
this.filters = [this.colorFlilter];
} else {
this.filters = [];
}
this._count = value;
this.countNum.num = value;
}
constructor() {
super();
//滤镜
var colorMatrix = [
0.3, 0.6, 0, 0, 0,
0.3, 0.6, 0, 0, 0,
0.3, 0.6, 0, 0, 0,
0, 0, 0, 1, 0
];
this.colorFlilter = new egret.ColorMatrixFilter(colorMatrix);
//背景
var bg = new egret.Bitmap(RES.getRes("propNumBg_png"))
this.addChild(bg)
//数字
this.countNum = new PropNumber();
this.countNum.x = 26;
this.countNum.y = 9;
this.addChild(this.countNum);
}
}
\ No newline at end of file
import { BitmapNumber } from "../class/BitmapNumber";
import { Tool } from "../Tool";
/**
* 道具数量,两位
*/
export class PropNumber extends egret.DisplayObjectContainer {
/**
* 数字,最大99
*/
private _num: number;
get num(): number {
return this._num
}
set num(value: number) {
if (value == this._num) return;
this._num = value;
var arr = Tool.returnTO(value);
if (arr.length > 2) arr = [9, 9];
this.ones.num = arr[0];
if (arr[1]) {
this.tens.visible = true;
this.tens.num = arr[1];
} else {
this.tens.visible = false;
}
//居中适配
this.center()
}
/**
* 个位
*/
private ones: BitmapNumber;
/**
* 十位
*/
private tens: BitmapNumber;
constructor() {
super();
this.ones = new BitmapNumber("propNum");
this.tens = new BitmapNumber("propNum");
this.addChild(this.ones)
this.addChild(this.tens)
this.num = 0;
}
/**
* 居中位置
*/
center() {
if (this.tens.visible) {
this.ones.x = 0;
this.tens.x = - this.tens.texture.textureWidth;
} else {
this.ones.x = -this.ones.texture.textureWidth / 2
}
}
}
\ 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