2020-08-12 12:16:35 +08:00
|
|
|
module es {
|
|
|
|
|
export class TmxDocument {
|
2020-08-13 17:39:24 +08:00
|
|
|
public tmxDirectory: string;
|
2020-08-12 12:16:35 +08:00
|
|
|
constructor(){
|
2020-08-13 17:39:24 +08:00
|
|
|
this.tmxDirectory = "";
|
2020-08-12 12:16:35 +08:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export interface ITmxElement {
|
|
|
|
|
name: string;
|
|
|
|
|
}
|
|
|
|
|
|
2020-08-13 17:39:24 +08:00
|
|
|
// export class TmxList<T extends ITmxElement> extends Map<string, T>{
|
|
|
|
|
// public _nameCount: Map<string, number> = new Map<string, number>();
|
|
|
|
|
//
|
|
|
|
|
// public add(t: T){
|
|
|
|
|
// let tName = t.name;
|
|
|
|
|
//
|
|
|
|
|
// // 通过附加数字重命名重复的条目
|
|
|
|
|
// if (this.has(tName))
|
|
|
|
|
// this._nameCount.set(tName, this._nameCount.get(tName) + 1);
|
|
|
|
|
// else
|
|
|
|
|
// this._nameCount.set(tName, 0);
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
// protected getKeyForItem(item: T): string {
|
|
|
|
|
// let name = item.name;
|
|
|
|
|
// let count = this._nameCount.get(name);
|
|
|
|
|
//
|
|
|
|
|
// let dupes = 0;
|
|
|
|
|
//
|
|
|
|
|
// // 对于重复的键,附加一个计数器。对于病理情况,插入下划线以确保唯一性
|
|
|
|
|
// while (this.has(name)){
|
|
|
|
|
// name = name + Enumerable.repeat("_", dupes).toString() + count.toString();
|
|
|
|
|
// dupes ++;
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
// return name;
|
|
|
|
|
// }
|
|
|
|
|
// }
|
2020-08-12 12:16:35 +08:00
|
|
|
|
|
|
|
|
export class TmxImage {
|
2020-08-14 11:44:20 +08:00
|
|
|
public texture: egret.Bitmap;
|
|
|
|
|
public bitmap: egret.SpriteSheet;
|
2020-08-12 12:16:35 +08:00
|
|
|
public source: string;
|
|
|
|
|
public format: string;
|
|
|
|
|
public data: any;
|
|
|
|
|
public trans: number;
|
|
|
|
|
public width: number;
|
|
|
|
|
public height: number;
|
|
|
|
|
|
|
|
|
|
public dispose(){
|
2020-08-13 17:39:24 +08:00
|
|
|
if (this.bitmap){
|
2020-08-14 11:44:20 +08:00
|
|
|
this.bitmap.dispose();
|
2020-08-13 17:39:24 +08:00
|
|
|
this.bitmap = null;
|
2020-08-12 12:16:35 +08:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|