完善关卡逻辑
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
import { StorageManager } from "./StorageManager"
|
||||
import { DOBlock } from "./DOBlock"
|
||||
import { DataBlock, DataUndo, DataStage } from "../types/global"
|
||||
import { LevelManager } from "./LevelManager"
|
||||
|
||||
|
||||
export class DOStage {
|
||||
@@ -13,7 +14,7 @@ export class DOStage {
|
||||
private letterToNumber: Map<string, number>;
|
||||
private numberToLetter: Map<number, string>;
|
||||
|
||||
constructor(dataStage: DataStage, levelStr: string) {
|
||||
constructor(dataStage: DataStage) {
|
||||
this.data = dataStage
|
||||
|
||||
this.letterToNumber = new Map();
|
||||
@@ -44,8 +45,9 @@ export class DOStage {
|
||||
blockMap.set(dataBlock.index, dataBlock)
|
||||
}
|
||||
|
||||
if (levelStr.length != 81) {
|
||||
console.log("levelStr error", levelStr.length)
|
||||
var levelStr = LevelManager.getInstance().getLevelStr(this.data.difficulty, this.data.index)
|
||||
if (!levelStr || levelStr.length != 81) {
|
||||
console.log("levelStr error", this.data.difficulty, this.data.index, levelStr)
|
||||
}
|
||||
var list = new Map();
|
||||
for (var i=0; i<levelStr.length; i++) {
|
||||
@@ -79,12 +81,26 @@ export class DOStage {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public getData(): DataStage {
|
||||
return this.data
|
||||
}
|
||||
|
||||
//====================================持久化数据
|
||||
public get_difficulty(): number {
|
||||
public get_stageID(): string {
|
||||
return this.data.id
|
||||
}
|
||||
public get_stageType(): number {
|
||||
return this.data.type
|
||||
}
|
||||
public get_stageName(): string {
|
||||
return this.data.name
|
||||
}
|
||||
public get_difficulty(): string {
|
||||
return this.data.difficulty
|
||||
}
|
||||
public get_stageIndex(): number {
|
||||
return this.data.index
|
||||
}
|
||||
|
||||
public get_mistake(): number {
|
||||
return this.data.mistake
|
||||
@@ -99,7 +115,7 @@ export class DOStage {
|
||||
}
|
||||
public set_duration(duration: number): void {//关卡计时
|
||||
this.data.duration = duration
|
||||
// StorageManager.getInstance().onChanged()
|
||||
StorageManager.getInstance().onChanged()
|
||||
}
|
||||
|
||||
public get_note_open(): boolean {
|
||||
|
||||
Reference in New Issue
Block a user