[client] display fps setting
This commit is contained in:
@@ -1,13 +1,11 @@
|
||||
package ru.m.tankz.util;
|
||||
|
||||
import haxe.zip.Tools;
|
||||
import haxe.io.BytesOutput;
|
||||
import haxe.zip.Writer;
|
||||
import flash.utils.ByteArray;
|
||||
import haxe.io.Bytes;
|
||||
import haxe.io.BytesInput;
|
||||
import haxe.io.BytesOutput;
|
||||
import haxe.zip.Entry;
|
||||
import haxe.zip.Reader;
|
||||
import haxe.zip.Tools;
|
||||
import haxe.zip.Writer;
|
||||
import ru.m.tankz.config.Config;
|
||||
import ru.m.tankz.Type;
|
||||
import yaml.Parser;
|
||||
@@ -29,32 +27,13 @@ class LevelUtil {
|
||||
return result;
|
||||
}
|
||||
|
||||
public static function loadsOld(data:String):LevelConfig {
|
||||
var bricks:Array<BrickIndex> = [];
|
||||
for (line in ~/\s+/g.split(data)) {
|
||||
for (c in line.split('')) {
|
||||
if (c.length > 0) {
|
||||
bricks.push(Std.parseInt(c));
|
||||
}
|
||||
}
|
||||
}
|
||||
return {
|
||||
data: bricks
|
||||
}
|
||||
}
|
||||
|
||||
public static function loads(data:String):LevelConfig {
|
||||
// If first char is digit load as old format
|
||||
if (Std.parseInt(data.charAt(0)) != null) {
|
||||
return loadsOld(data);
|
||||
} else {
|
||||
var obj:LevelSource = Yaml.parse(data, Parser.options().useObjects());
|
||||
return {
|
||||
data: obj.data.split('').map(function(c) return Std.parseInt(c)),
|
||||
points: obj.points,
|
||||
name: obj.name,
|
||||
size: obj.size,
|
||||
}
|
||||
var obj:LevelSource = Yaml.parse(data, Parser.options().useObjects());
|
||||
return {
|
||||
data: obj.data.split('').map(function(c) return Std.parseInt(c)),
|
||||
points: obj.points,
|
||||
name: obj.name,
|
||||
size: obj.size,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -96,20 +75,20 @@ class LevelUtil {
|
||||
var bytes = Bytes.ofString(content);
|
||||
var crc = haxe.crypto.Crc32.make(bytes);
|
||||
var result:Entry = {
|
||||
fileName: '${formatLevel(level.id)}.txt',
|
||||
fileName: '${formatLevel(level.id)}.yml',
|
||||
fileSize: bytes.length,
|
||||
fileTime : Date.now(),
|
||||
compressed : false,
|
||||
dataSize : bytes.length,
|
||||
data : bytes,
|
||||
crc32 : crc,
|
||||
fileTime: Date.now(),
|
||||
compressed: false,
|
||||
dataSize: bytes.length,
|
||||
data: bytes,
|
||||
crc32: crc,
|
||||
};
|
||||
Tools.compress(result, 9);
|
||||
return result;
|
||||
}
|
||||
|
||||
public static function unpack(bytes:Bytes):Array<LevelConfig> {
|
||||
var files = Reader.readZip(new BytesInput(bytes));
|
||||
var files = haxe.zip.Reader.readZip(new BytesInput(bytes));
|
||||
return Lambda.array(files.map(extract));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user