Commit 930b7a1b authored by wjf's avatar wjf

l

parent 1fd66a6e
...@@ -153,8 +153,13 @@ export default class MainBase extends eui.UILayer { ...@@ -153,8 +153,13 @@ export default class MainBase extends eui.UILayer {
for (var i = 0; i <= 9; i++) { for (var i = 0; i <= 9; i++) {
RES.getResAsync("stepNumber" + i + "_png") RES.getResAsync("stepNumber" + i + "_png")
} }
for (var i = 0; i <= 9; i++) {
RES.getResAsync("targetNumber" + i + "_png")
}
var arr = [ var arr = [
"ele5", "ele5",
"ele6",
"ele7",
"iceEle", "iceEle",
"leftArrow", "leftArrow",
"chooseRect", "chooseRect",
...@@ -167,7 +172,9 @@ export default class MainBase extends eui.UILayer { ...@@ -167,7 +172,9 @@ export default class MainBase extends eui.UILayer {
"rectLat", "rectLat",
"rightArrow", "rightArrow",
"rightMark", "rightMark",
"unlightedStar" "unlightedStar",
"mainSoundBtnOff",
"mainMusicBtnOff",
] ]
for (var i = 0; i < arr.length; i++) { for (var i = 0; i < arr.length; i++) {
RES.getResAsync(arr[i] + "_png") RES.getResAsync(arr[i] + "_png")
......
...@@ -57,8 +57,12 @@ ...@@ -57,8 +57,12 @@
"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,iceEle_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,mainMusicBtnClo_png,mainMusicBtnOn_png,mainQuitBtn_png,mainSoundBtnOff_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,iceEle_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",
"name": "mainScene" "name": "mainScene"
},
{
"name": "preload",
"keys": "ele7_png"
} }
], ],
"resources": [ "resources": [
...@@ -1082,11 +1086,6 @@ ...@@ -1082,11 +1086,6 @@
"type": "image", "type": "image",
"name": "mainSoundBtnOn_png" "name": "mainSoundBtnOn_png"
}, },
{
"url": "assets/mainScene/mainMusicBtnClo.png",
"type": "image",
"name": "mainMusicBtnClo_png"
},
{ {
"url": "assets/mainScene/mainMusicBtnOn.png", "url": "assets/mainScene/mainMusicBtnOn.png",
"type": "image", "type": "image",
...@@ -1111,6 +1110,66 @@ ...@@ -1111,6 +1110,66 @@
"url": "assets/mainScene/mainSoundBtnOff.png", "url": "assets/mainScene/mainSoundBtnOff.png",
"type": "image", "type": "image",
"name": "mainSoundBtnOff_png" "name": "mainSoundBtnOff_png"
},
{
"url": "assets/mainScene/mainMusicBtnOff.png",
"type": "image",
"name": "mainMusicBtnOff_png"
},
{
"url": "assets/mainScene/targetNumber9.png",
"type": "image",
"name": "targetNumber9_png"
},
{
"url": "assets/mainScene/targetNumber0.png",
"type": "image",
"name": "targetNumber0_png"
},
{
"url": "assets/mainScene/targetNumber1.png",
"type": "image",
"name": "targetNumber1_png"
},
{
"url": "assets/mainScene/targetNumber2.png",
"type": "image",
"name": "targetNumber2_png"
},
{
"url": "assets/mainScene/targetNumber3.png",
"type": "image",
"name": "targetNumber3_png"
},
{
"url": "assets/mainScene/targetNumber4.png",
"type": "image",
"name": "targetNumber4_png"
},
{
"url": "assets/mainScene/targetNumber5.png",
"type": "image",
"name": "targetNumber5_png"
},
{
"url": "assets/mainScene/targetNumber6.png",
"type": "image",
"name": "targetNumber6_png"
},
{
"url": "assets/mainScene/targetNumber7.png",
"type": "image",
"name": "targetNumber7_png"
},
{
"url": "assets/mainScene/targetNumber8.png",
"type": "image",
"name": "targetNumber8_png"
},
{
"name": "ele7_png",
"type": "image",
"url": "assets/mainScene/ele7.png"
} }
] ]
} }
\ No newline at end of file
...@@ -11,8 +11,9 @@ ...@@ -11,8 +11,9 @@
<e:Image x="54" y="28.85" source="stepsBoard_png"/> <e:Image x="54" y="28.85" source="stepsBoard_png"/>
<e:Image x="226.5" y="88.85" source="dangqianfenshu_png"/> <e:Image x="226.5" y="88.85" source="dangqianfenshu_png"/>
<e:Label id="scoreTxt" touchEnabled="false" size="20" width="194.85" anchorOffsetY="0" height="36" textAlign="left" bold="true" anchorOffsetX="0" verticalAlign="middle" fontFamily="Microsoft YaHei" text="XXXX" y="81.85" textColor="0x00556a" x="320.85"/> <e:Label id="scoreTxt" touchEnabled="false" size="20" width="194.85" anchorOffsetY="0" height="36" textAlign="left" bold="true" anchorOffsetX="0" verticalAlign="middle" fontFamily="Microsoft YaHei" text="0" y="81.85" textColor="0x00556a" x="320.85"/>
<e:Label touchEnabled="false" size="20" width="101.85" anchorOffsetY="0" height="36" textAlign="left" anchorOffsetX="0" verticalAlign="middle" fontFamily="Microsoft YaHei" text="当前分数:" y="63.85" textColor="0x00556A" x="765"/> <e:Label touchEnabled="false" size="20" width="101.85" anchorOffsetY="0" height="36" textAlign="left" anchorOffsetX="0" verticalAlign="middle" fontFamily="Microsoft YaHei" text="当前分数:" y="63.85" textColor="0x00556A" x="765"/>
<e:Label id="targetScoreTxt" touchEnabled="false" size="26" width="292.85" anchorOffsetY="0" height="36" textAlign="center" anchorOffsetX="0" verticalAlign="middle" fontFamily="Microsoft YaHei" text="目标分数" y="169.85" textColor="0x9d4a06" bold="true" horizontalCenter="0.5"/>
<e:Label touchEnabled="false" size="19" width="115.18" anchorOffsetY="0" height="36" textAlign="center" anchorOffsetX="0" verticalAlign="middle" fontFamily="Microsoft YaHei" text="剩余步数" y="53.48" x="66.35" textColor="0xffffff"/> <e:Label touchEnabled="false" size="19" width="115.18" anchorOffsetY="0" height="36" textAlign="center" anchorOffsetX="0" verticalAlign="middle" fontFamily="Microsoft YaHei" text="剩余步数" y="53.48" x="66.35" textColor="0xffffff"/>
<e:Label id="chapterTxt" touchEnabled="false" size="24" width="121.85" anchorOffsetY="0" height="36" textAlign="center" anchorOffsetX="0" verticalAlign="middle" fontFamily="Microsoft YaHei" text="第X关" y="22" textColor="0xffffff" x="316"/> <e:Label id="chapterTxt" touchEnabled="false" size="24" width="121.85" anchorOffsetY="0" height="36" textAlign="center" anchorOffsetX="0" verticalAlign="middle" fontFamily="Microsoft YaHei" text="第X关" y="22" textColor="0xffffff" x="316"/>
<e:Button id="hammerBtn" label="" anchorOffsetX="67.5" anchorOffsetY="60" icon="hammerBtn_png" skinName="ui.IconButtonSkin" y="1100" x="375.5"/> <e:Button id="hammerBtn" label="" anchorOffsetX="67.5" anchorOffsetY="60" icon="hammerBtn_png" skinName="ui.IconButtonSkin" y="1100" x="375.5"/>
......
This diff is collapsed.
import { ChapterData } from "./interface/ChapterData";
import { PassType } from "./enum/PassType";
import { ElementType } from "./enum/ElementType";
export const Chapters: ChapterData[] = [
//第0关为空吧,
null,
//第一关
{
map: {
lattices: [
1, 1, 1, 0, 1, 1, 1, 1, 1,
1, 1, 1, 0, 1, 1, 1, 1, 1,
1, 1, 1, 0, 1, 1, 1, 1, 1,
1, 1, 1, 0, 1, 1, 1, 1, 1,
0, 0, 0, 0, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1,
],
generateLats: [0, 1, 2, 3, 4, 5, 6, 7, 8],
paths: [
{
indexs: ["0_l_u", "8_r_u", "80_r_d", "72_l_d", "63_l_u", "63_r_u", "54_r_u", "54_l_u"],
holes: [
{
indexs: ["50_l_u", "50_l_d", "50_r_d", "50_r_u"],
},
{
indexs: ["48_l_u", "48_l_d", "48_r_d", "48_r_u"],
}
]
}
],
connectedLats: [[27, 45], [28, 46], [29, 47]]
},
iceIndexs: [80],
lollipopCount: 0,
rockIndexs: [54, 75],
baseElementTypes: [0, 1, 2, 3],
effectInitProbability: 0.15,
stepCount: 50,
// passTarget: {
// type: PassType.SCORE_TARGET,
// score: 10000000,
// },
passTarget: {
type: PassType.ELEMENT_TARGET,
elements: [
{
type: ElementType.ICE,
count: 100,
}
],
},
starScores: [3000, 5000, 10000]
}
]
\ No newline at end of file
...@@ -165,7 +165,7 @@ export class Tool { ...@@ -165,7 +165,7 @@ export class Tool {
return false return false
} }
//上方元素为石头,或为冰淇淋 //上方元素为石头,或为冰淇淋
else if (lat.element.type == ElementType.ROCK || lat.element.type == ElementType.ICECREAM) { else if (lat.element.type == ElementType.ROCK || lat.element.type == ElementType.LOLLIPOP) {
return false return false
} }
//剩下情况 //剩下情况
...@@ -211,61 +211,4 @@ export class Tool { ...@@ -211,61 +211,4 @@ export class Tool {
} }
return arr return arr
} }
public static chapters: ChapterData[] = [
//第0关为空吧,
null,
//第一关
{
map: {
lattices: [
1, 1, 1, 0, 1, 1, 1, 1, 1,
1, 1, 1, 0, 1, 1, 1, 1, 1,
1, 1, 1, 0, 1, 1, 1, 1, 1,
1, 1, 1, 0, 1, 1, 1, 1, 1,
0, 0, 0, 0, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1,
],
generateLats: [0, 1, 2, 3, 4, 5, 6, 7, 8],
paths: [
{
indexs: ["0_l_u", "8_r_u", "80_r_d", "72_l_d", "63_l_u", "63_r_u", "54_r_u", "54_l_u"],
holes: [
{
indexs: ["50_l_u", "50_l_d", "50_r_d", "50_r_u"],
},
{
indexs: ["48_l_u", "48_l_d", "48_r_d", "48_r_u"],
}
]
}
],
connectedLats: [[27, 45], [28, 46], [29, 47]]
},
iceIndexs: [80],
iceCreamCount: 0,
rockIndexs: [54, 75],
baseElementTypes: [0, 1, 2, 3],
effectInitProbability: 0.15,
stepCount: 50,
passTarget: {
type: PassType.SCORE_TARGET,
score: 10000000,
},
// passTarget: {
// type: PassType.ELEMENT_TARGET,
// elements: [
// {
// type: ElementType.ICECREAM,
// count: 100,
// }
// ],
// },
starScores: [3000, 5000, 10000]
}
]
} }
\ No newline at end of file
/** /**
* 位图数字 * 位图数字,单个
*/ */
export class BitmapNumber extends egret.Bitmap { export class BitmapNumber extends egret.Bitmap {
/** /**
* 图片前缀 * 图片前缀
* 就是那些图片名字
*/ */
resName: string resName: string
/** /**
...@@ -19,7 +20,6 @@ export class BitmapNumber extends egret.Bitmap { ...@@ -19,7 +20,6 @@ export class BitmapNumber extends egret.Bitmap {
this._num = value; this._num = value;
var texture: egret.Texture = RES.getRes(this.resName + value+"_png"); var texture: egret.Texture = RES.getRes(this.resName + value+"_png");
this.texture = texture; this.texture = texture;
} }
constructor(resName: string) { constructor(resName: string) {
......
...@@ -8,11 +8,11 @@ export enum ElementType { ...@@ -8,11 +8,11 @@ export enum ElementType {
LION,//狮子3 LION,//狮子3
PIG,//猪4 PIG,//猪4
ROCK,//石头5 ROCK,//石头5
ICECREAM,//冰淇淋6 LOLLIPOP,//棒棒糖6
ICE,//冰块7 ICE,//冰块7
} }
//提交时候的对应字段字段,分数额外,字段是1 //提交时候的对应字段字段,分数额外,字段是1
export const submit = { export const submitTran = {
0: 4, 0: 4,
1: 5, 1: 5,
2: 6, 2: 6,
......
...@@ -15,9 +15,9 @@ export interface ChapterData { ...@@ -15,9 +15,9 @@ export interface ChapterData {
*/ */
iceIndexs?: number[]; iceIndexs?: number[];
/** /**
* 冰激凌数量,固定第一排生成 * 棒棒糖数量,固定第一排生成
*/ */
iceCreamCount?: number; lollipopCount?: number;
/** /**
* 石头位置索引 * 石头位置索引
*/ */
......
...@@ -17,8 +17,9 @@ export interface MapData { ...@@ -17,8 +17,9 @@ export interface MapData {
generateLats: number[]; generateLats: number[];
/** /**
* 路径的索引 * 路径的索引
* 暂时不需要了
*/ */
paths:PathData[] paths?:PathData[]
/** /**
* 再考虑 * 再考虑
* 元素为两个索引的数组[8,9],第一个元素为up,第二个元素为down * 元素为两个索引的数组[8,9],第一个元素为up,第二个元素为down
......
import { ElementType } from "../enum/ElementType";
import { TargetNumber } from "./TargetNumber";
/**
* 通关目标是元素时的单个元素的ui
*
*/
export class ElementTarget extends egret.DisplayObjectContainer {
/**
* 元素类型
*/
type: ElementType;
/**
* 打勾完成
*/
zeroMark: egret.Bitmap;
/**
* 数量文案
*/
private countNum: TargetNumber;
/**
* 数量
*/
private _count: number;
get count(): number {
return this._count;
}
set count(value: number) {
this._count = value;
this.countNum.num = value;
if (value == 0) {
this.countNum.visible = false;
this.zeroMark.visible = true;
}
}
constructor(type: ElementType) {
super()
var texture: egret.Texture = RES.getRes("ele" + type + "_png");
var showImage = new egret.Bitmap(texture);
showImage.scaleX = showImage.scaleY = 0.8
this.addChild(showImage);
var texture: egret.Texture = RES.getRes("rightMark_png");
this.zeroMark = new egret.Bitmap(texture);
this.zeroMark.x = 35;
this.zeroMark.y = 35;
this.zeroMark.visible = false;
this.addChild(this.zeroMark);
this.countNum = new TargetNumber();
this.countNum.x = 50;
this.countNum.y = 38;
this.addChild(this.countNum);
}
}
\ No newline at end of file
import { ElementType } from "../enum/ElementType";
import { TargetNumber } from "./TargetNumber";
import { ElementTarget } from "./ElementTarget";
/**
* 通关目标是元素时的单个元素的ui
*
*/
export class ElementTargets extends egret.DisplayObjectContainer {
targets: ElementTarget[];
constructor(passElement: number[]) {
super()
for (var i = 0; i < passElement.length; i++) {
if (passElement[i]) {
var eleTar: ElementTarget = new ElementTarget(i);
eleTar.count = passElement[i];
this.addChild(eleTar);
this.targets[i] = eleTar;
}
}
this.center()
}
center() {
//按顺序排,从右到左,
var len = this.$children.length;
var w = 80 * 0.8;
var space = 25
var right = len / 2 * w - w;
for (var i = this.$children.length - 1; i >= 0; i--) {
this.$children[i].x = right - w * i - space * i;
}
}
}
\ No newline at end of file
...@@ -4,8 +4,9 @@ import { Pool } from "../Pool"; ...@@ -4,8 +4,9 @@ import { Pool } from "../Pool";
import { RecoverName } from "../enum/RecoverName"; import { RecoverName } from "../enum/RecoverName";
/** /**
* 位图数字 * 位图数字,分数
* 不管多少位,都按中间数字居中 * 不管多少位,都按中间数字居中
* 暂不做通用,以后再说,否则回收问题
*/ */
export class ScoreNumber extends egret.DisplayObjectContainer { export class ScoreNumber extends egret.DisplayObjectContainer {
......
import { BitmapNumber } from "../class/BitmapNumber";
import { Tool } from "../Tool";
import { Pool } from "../Pool";
import { RecoverName } from "../enum/RecoverName";
/**
* 位图数字 目标元素数量
* 不管多少位,都按中间数字居中
* 暂不做通用,以后再说,否则回收问题
*/
export class TargetNumber extends egret.DisplayObjectContainer {
/**
* 数字
*/
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);
//位数从小到大add,
for (var i = 0; i < arr.length; i++) {
if (this.$children[i]) {
//先用完原先$children里的,不通用就没必要修改resName
this.$children[i]["num"] = arr[i];
} else {
//如果没有就
let o: BitmapNumber = Pool.takeOut(RecoverName.BITMAP_NUMBER);
if (!o) {
o = new BitmapNumber("targetNumber");
} else {
o.reset("targetNumber")
}
o.num = arr[i];
this.addChild(o)
}
}
//如果多了,去掉后面的,回收
if (this.$children.length > arr.length) {
//移除后序
for (var i = this.$children.length - 1; i >= arr.length; i--) {
let c = this.$children[i];
this.removeChild(c);
Pool.recover(RecoverName.BITMAP_NUMBER, c);
}
}
//居中适配
this.center()
}
constructor() {
super();
this.num = 0;
}
/**
* 居中位置
*/
center() {
//按顺序排,从右到左,
var len = this.$children.length;
var w = this.$children[0]["texture"].textureWidth;
var right = len / 2 * w - w;
for (var i = 0; i < this.$children.length; i++) {
this.$children[i].x = right - w * i;
}
}
}
\ 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