[client] display fps setting
This commit is contained in:
4
WORK.md
4
WORK.md
@@ -4,7 +4,7 @@
|
|||||||
* game series
|
* game series
|
||||||
* network series
|
* network series
|
||||||
* map packs
|
* map packs
|
||||||
* import in game
|
* import in game
|
||||||
* save imported in local storage
|
* save imported in local storage
|
||||||
* database
|
* database
|
||||||
* cache
|
* cache
|
||||||
@@ -18,3 +18,5 @@
|
|||||||
* screen gamepad (button enabled, count label)
|
* screen gamepad (button enabled, count label)
|
||||||
* ui:
|
* ui:
|
||||||
* game frame layouts
|
* game frame layouts
|
||||||
|
* fix:
|
||||||
|
* ice brick fix
|
||||||
|
|||||||
@@ -36,7 +36,9 @@ class Device {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#end
|
|
||||||
return false;
|
return false;
|
||||||
|
#else
|
||||||
|
return false;
|
||||||
|
#end
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,11 +4,14 @@ import flash.Lib;
|
|||||||
import haxework.animate.Animate;
|
import haxework.animate.Animate;
|
||||||
import haxework.log.TraceLogger;
|
import haxework.log.TraceLogger;
|
||||||
import haxework.view.Root;
|
import haxework.view.Root;
|
||||||
|
import ru.m.tankz.storage.SettingsStorage;
|
||||||
import ru.m.tankz.view.ClientView;
|
import ru.m.tankz.view.ClientView;
|
||||||
|
|
||||||
class Client {
|
class Client {
|
||||||
private static inline var TAG = "Tankz";
|
private static inline var TAG = "Tankz";
|
||||||
|
|
||||||
|
@:provide private static var settings:SettingsStorage;
|
||||||
|
|
||||||
public static function main() {
|
public static function main() {
|
||||||
L.push(new TraceLogger());
|
L.push(new TraceLogger());
|
||||||
#if flash
|
#if flash
|
||||||
@@ -30,9 +33,16 @@ class Client {
|
|||||||
Root.bind(view);
|
Root.bind(view);
|
||||||
view.launch();
|
view.launch();
|
||||||
|
|
||||||
#if debug
|
|
||||||
var fps = new openfl.display.FPS(0, 0, 0x00ff00);
|
var fps = new openfl.display.FPS(0, 0, 0x00ff00);
|
||||||
|
fps.visible = settings.displayFPS;
|
||||||
Lib.current.addChild(fps);
|
Lib.current.addChild(fps);
|
||||||
#end
|
|
||||||
|
settings.signal.connect(function(setting) {
|
||||||
|
switch setting {
|
||||||
|
case DISPLAY_FPS(value):
|
||||||
|
fps.visible = value;
|
||||||
|
case _:
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package ru.m.tankz.storage;
|
package ru.m.tankz.storage;
|
||||||
|
|
||||||
import flash.ui.Keyboard;
|
import flash.ui.Keyboard;
|
||||||
|
import haxework.signal.Signal;
|
||||||
import haxework.storage.SharedObjectStorage;
|
import haxework.storage.SharedObjectStorage;
|
||||||
import haxework.utils.ObjectUtil;
|
import haxework.utils.ObjectUtil;
|
||||||
import ru.m.control.DeviceAction;
|
import ru.m.control.DeviceAction;
|
||||||
@@ -9,10 +10,30 @@ import ru.m.geom.Direction;
|
|||||||
import ru.m.tankz.control.Binding;
|
import ru.m.tankz.control.Binding;
|
||||||
import ru.m.tankz.control.Control;
|
import ru.m.tankz.control.Control;
|
||||||
|
|
||||||
|
enum Setting {
|
||||||
|
CONTROL(index:Int, value:Binding);
|
||||||
|
DISPLAY_FPS(value:Bool);
|
||||||
|
ENABLE_NETWORK(value:Bool);
|
||||||
|
}
|
||||||
|
|
||||||
class SettingsStorage extends SharedObjectStorage {
|
class SettingsStorage extends SharedObjectStorage {
|
||||||
|
|
||||||
private static inline var VERSION = 4.1;
|
private static inline var VERSION = 4.1;
|
||||||
|
|
||||||
|
public var signal(default, null):Signal<Setting> = new Signal();
|
||||||
|
|
||||||
|
public var displayFPS(get, set):Bool;
|
||||||
|
|
||||||
|
private function get_displayFPS():Bool {
|
||||||
|
return read("setting:display_fps");
|
||||||
|
}
|
||||||
|
|
||||||
|
private function set_displayFPS(value:Bool):Bool {
|
||||||
|
write("setting:display_fps", value);
|
||||||
|
signal.emit(DISPLAY_FPS(value));
|
||||||
|
return get_displayFPS();
|
||||||
|
}
|
||||||
|
|
||||||
public function new() {
|
public function new() {
|
||||||
super('settings_${VERSION}');
|
super('settings_${VERSION}');
|
||||||
}
|
}
|
||||||
@@ -23,6 +44,7 @@ class SettingsStorage extends SharedObjectStorage {
|
|||||||
|
|
||||||
public function saveBinding(index:Int, value:Binding) {
|
public function saveBinding(index:Int, value:Binding) {
|
||||||
write('action:$index', value);
|
write('action:$index', value);
|
||||||
|
signal.emit(CONTROL(index, value));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getDefaultBinding(index:Int):Binding {
|
public static function getDefaultBinding(index:Int):Binding {
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ import ru.m.tankz.network.NetworkGame;
|
|||||||
import ru.m.tankz.sound.SoundManager;
|
import ru.m.tankz.sound.SoundManager;
|
||||||
import ru.m.tankz.storage.GameStorage;
|
import ru.m.tankz.storage.GameStorage;
|
||||||
import ru.m.tankz.storage.SettingsStorage;
|
import ru.m.tankz.storage.SettingsStorage;
|
||||||
|
import ru.m.tankz.Type;
|
||||||
import ru.m.tankz.view.game.GameViewA;
|
import ru.m.tankz.view.game.GameViewA;
|
||||||
import ru.m.tankz.view.game.GameViewB;
|
import ru.m.tankz.view.game.GameViewB;
|
||||||
import ru.m.tankz.view.game.IGameView;
|
import ru.m.tankz.view.game.IGameView;
|
||||||
@@ -36,6 +37,8 @@ import ru.m.tankz.view.gamepad.GamepadView;
|
|||||||
@:view("game") private var gameViewContainer(default, null):GroupView;
|
@:view("game") private var gameViewContainer(default, null):GroupView;
|
||||||
@:view private var gamepad(default, null):GamepadView;
|
@:view private var gamepad(default, null):GamepadView;
|
||||||
|
|
||||||
|
private var gamepadPlayerId:PlayerId;
|
||||||
|
|
||||||
private var gameView:IGameView;
|
private var gameView:IGameView;
|
||||||
|
|
||||||
private var game:IGame;
|
private var game:IGame;
|
||||||
@@ -72,6 +75,7 @@ import ru.m.tankz.view.gamepad.GamepadView;
|
|||||||
for (control in game.controls) {
|
for (control in game.controls) {
|
||||||
if (Std.is(control, HumanControl)) {
|
if (Std.is(control, HumanControl)) {
|
||||||
if (cast(control, HumanControl).hasDevice(SCREEN)) {
|
if (cast(control, HumanControl).hasDevice(SCREEN)) {
|
||||||
|
gamepadPlayerId = control.playerId;
|
||||||
gamepad.visible = true;
|
gamepad.visible = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -91,6 +95,11 @@ import ru.m.tankz.view.gamepad.GamepadView;
|
|||||||
|
|
||||||
public function onGameEvent(event:GameEvent):Void {
|
public function onGameEvent(event:GameEvent):Void {
|
||||||
switch event {
|
switch event {
|
||||||
|
case SPAWN(TANK(id, rect, playerId, info)):
|
||||||
|
if (gamepadPlayerId != null && playerId == gamepadPlayerId) {
|
||||||
|
var tankConfig = game.config.getTank(info.type);
|
||||||
|
gamepad.weapons = tankConfig.weapons;
|
||||||
|
}
|
||||||
case COMPLETE(result):
|
case COMPLETE(result):
|
||||||
stop();
|
stop();
|
||||||
switcher.change(ResultFrame.ID, result);
|
switcher.change(ResultFrame.ID, result);
|
||||||
|
|||||||
@@ -1,14 +1,37 @@
|
|||||||
package ru.m.tankz.view;
|
package ru.m.tankz.view;
|
||||||
|
|
||||||
|
import haxework.view.form.ToggleButtonView;
|
||||||
import haxework.view.frame.FrameSwitcher;
|
import haxework.view.frame.FrameSwitcher;
|
||||||
import haxework.view.frame.FrameView;
|
import haxework.view.frame.FrameView;
|
||||||
|
import ru.m.tankz.storage.SettingsStorage;
|
||||||
|
|
||||||
@:template class SettingsFrame extends FrameView<Dynamic> {
|
@:template class SettingsFrame extends FrameView<Dynamic> {
|
||||||
public static var ID(default, never):String = "settings";
|
public static var ID(default, never):String = "settings";
|
||||||
|
|
||||||
|
@:view("fps") var fpsButton:ToggleButtonView;
|
||||||
|
|
||||||
@:provide static var switcher:FrameSwitcher;
|
@:provide static var switcher:FrameSwitcher;
|
||||||
|
@:provide static var settings:SettingsStorage;
|
||||||
|
|
||||||
public function new() {
|
public function new() {
|
||||||
super(ID);
|
super(ID);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override public function onShow(data:Dynamic):Void {
|
||||||
|
super.onShow(data);
|
||||||
|
fpsButton.on = settings.displayFPS;
|
||||||
|
settings.signal.connect(onSettingChange);
|
||||||
|
}
|
||||||
|
|
||||||
|
override public function onHide():Void {
|
||||||
|
settings.signal.disconnect(onSettingChange);
|
||||||
|
}
|
||||||
|
|
||||||
|
private function onSettingChange(setting:Setting):Void {
|
||||||
|
switch setting {
|
||||||
|
case DISPLAY_FPS(value):
|
||||||
|
fpsButton.on = value;
|
||||||
|
case _:
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,21 +6,29 @@ views:
|
|||||||
- $type: haxework.view.form.LabelView
|
- $type: haxework.view.form.LabelView
|
||||||
style: text.header
|
style: text.header
|
||||||
text: Settings
|
text: Settings
|
||||||
- $type: haxework.view.group.GroupView
|
- $type: haxework.view.group.VGroupView
|
||||||
geometry.width: 100%
|
geometry.stretch: true
|
||||||
geometry.height: 100%
|
layout.hAlign: center
|
||||||
overflow.y: scroll
|
overflow.y: scroll
|
||||||
layout:
|
|
||||||
$type: haxework.view.layout.TailLayout
|
|
||||||
vAlign: top
|
|
||||||
margin: 20
|
|
||||||
views:
|
views:
|
||||||
- id: settings0
|
- $type: haxework.view.group.GroupView
|
||||||
$type: ru.m.tankz.view.settings.SettingsEditor
|
geometry.width: 100%
|
||||||
controlIndex: 0
|
layout:
|
||||||
- id: settings1
|
$type: haxework.view.layout.TailLayout
|
||||||
$type: ru.m.tankz.view.settings.SettingsEditor
|
vAlign: top
|
||||||
controlIndex: 1
|
margin: 20
|
||||||
|
views:
|
||||||
|
- id: settings0
|
||||||
|
$type: ru.m.tankz.view.settings.SettingsEditor
|
||||||
|
controlIndex: 0
|
||||||
|
- id: settings1
|
||||||
|
$type: ru.m.tankz.view.settings.SettingsEditor
|
||||||
|
controlIndex: 1
|
||||||
|
- id: fps
|
||||||
|
$type: haxework.view.form.ToggleButtonView
|
||||||
|
geometry.margin.top: 20
|
||||||
|
text: Display FPS
|
||||||
|
+onPress: ~function(button) settings.displayFPS = !cast(button,ToggleButtonView).on
|
||||||
- $type: haxework.view.group.HGroupView
|
- $type: haxework.view.group.HGroupView
|
||||||
style: panel
|
style: panel
|
||||||
layout.margin: 10
|
layout.margin: 10
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
package ru.m.tankz.view.game;
|
package ru.m.tankz.view.game;
|
||||||
|
|
||||||
import ru.m.tankz.render.IRender;
|
|
||||||
import haxework.view.data.DataView;
|
import haxework.view.data.DataView;
|
||||||
import haxework.view.form.LabelView;
|
import haxework.view.form.LabelView;
|
||||||
import haxework.view.IView;
|
import haxework.view.IView;
|
||||||
import ru.m.tankz.game.GameState;
|
import ru.m.tankz.game.GameState;
|
||||||
import ru.m.tankz.game.IGame;
|
import ru.m.tankz.game.IGame;
|
||||||
|
import ru.m.tankz.render.IRender;
|
||||||
|
|
||||||
interface IGameView extends IView<Dynamic> extends GameListener {
|
interface IGameView extends IView<Dynamic> extends GameListener {
|
||||||
public var render(default, null):IRender;
|
public var render(default, null):IRender;
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package ru.m.tankz.view.gamepad;
|
|||||||
import flash.display.Graphics;
|
import flash.display.Graphics;
|
||||||
import haxework.color.Color;
|
import haxework.color.Color;
|
||||||
import haxework.view.skin.ISkin;
|
import haxework.view.skin.ISkin;
|
||||||
|
import ru.m.control.DeviceAction;
|
||||||
|
|
||||||
@:style class GamepadSkin implements ISkin<GamepadView> {
|
@:style class GamepadSkin implements ISkin<GamepadView> {
|
||||||
|
|
||||||
@@ -17,10 +18,14 @@ import haxework.view.skin.ISkin;
|
|||||||
var actives = [for (item in view.activeAreas.iterator()) item];
|
var actives = [for (item in view.activeAreas.iterator()) item];
|
||||||
var graphics:Graphics = view.content.graphics;
|
var graphics:Graphics = view.content.graphics;
|
||||||
graphics.clear();
|
graphics.clear();
|
||||||
graphics.beginFill(0, 0.0);
|
|
||||||
graphics.drawRect(0, 0, view.width, view.height);
|
|
||||||
graphics.endFill();
|
|
||||||
for (area in view.areas) {
|
for (area in view.areas) {
|
||||||
|
switch area.action {
|
||||||
|
case KEY(code):
|
||||||
|
if (view.weapons.length < code + 1) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
case _:
|
||||||
|
}
|
||||||
var color = actives.indexOf(area) > -1 ? activeColor : color;
|
var color = actives.indexOf(area) > -1 ? activeColor : color;
|
||||||
graphics.lineStyle(2, color);
|
graphics.lineStyle(2, color);
|
||||||
graphics.beginFill(color, 0.2);
|
graphics.beginFill(color, 0.2);
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package ru.m.tankz.view.gamepad;
|
package ru.m.tankz.view.gamepad;
|
||||||
|
|
||||||
|
import flash.display.Sprite;
|
||||||
import flash.display.Stage;
|
import flash.display.Stage;
|
||||||
import flash.events.MouseEvent;
|
import flash.events.MouseEvent;
|
||||||
import flash.events.TouchEvent;
|
import flash.events.TouchEvent;
|
||||||
@@ -9,6 +10,7 @@ import ru.m.control.DeviceAction;
|
|||||||
import ru.m.control.DeviceType;
|
import ru.m.control.DeviceType;
|
||||||
import ru.m.control.IControlDevice;
|
import ru.m.control.IControlDevice;
|
||||||
import ru.m.geom.Point;
|
import ru.m.geom.Point;
|
||||||
|
import ru.m.tankz.config.Config;
|
||||||
|
|
||||||
class GamepadView extends SpriteView implements IControlDevice {
|
class GamepadView extends SpriteView implements IControlDevice {
|
||||||
|
|
||||||
@@ -18,9 +20,19 @@ class GamepadView extends SpriteView implements IControlDevice {
|
|||||||
public var areas(default, null):Array<IActionArea>;
|
public var areas(default, null):Array<IActionArea>;
|
||||||
public var activeAreas(default, null):Map<Int, IActionArea>;
|
public var activeAreas(default, null):Map<Int, IActionArea>;
|
||||||
|
|
||||||
|
public var weapons(default, set):Array<WeaponConfig>;
|
||||||
|
|
||||||
|
private function set_weapons(value:Array<WeaponConfig>):Array<WeaponConfig> {
|
||||||
|
weapons = value;
|
||||||
|
toRedraw();
|
||||||
|
return weapons;
|
||||||
|
}
|
||||||
|
|
||||||
private var builder:IActionAreaBuilder;
|
private var builder:IActionAreaBuilder;
|
||||||
private var stage:Stage;
|
private var stage:Stage;
|
||||||
|
|
||||||
|
private var actionLayer:Sprite;
|
||||||
|
|
||||||
public function new() {
|
public function new() {
|
||||||
super();
|
super();
|
||||||
style = "gamepad";
|
style = "gamepad";
|
||||||
@@ -28,15 +40,18 @@ class GamepadView extends SpriteView implements IControlDevice {
|
|||||||
builder = new SmartActionAreaBuilder();
|
builder = new SmartActionAreaBuilder();
|
||||||
signal = new Signal2();
|
signal = new Signal2();
|
||||||
areas = [];
|
areas = [];
|
||||||
|
weapons = [];
|
||||||
activeAreas = new Map();
|
activeAreas = new Map();
|
||||||
skin = new GamepadSkin();
|
skin = new GamepadSkin();
|
||||||
content.addEventListener(MouseEvent.MOUSE_DOWN, onMouseDown);
|
actionLayer = new Sprite();
|
||||||
content.addEventListener(TouchEvent.TOUCH_BEGIN, onTouchBegin);
|
actionLayer.addEventListener(MouseEvent.MOUSE_DOWN, onMouseDown);
|
||||||
|
actionLayer.addEventListener(TouchEvent.TOUCH_BEGIN, onTouchBegin);
|
||||||
|
content.addChild(actionLayer);
|
||||||
}
|
}
|
||||||
|
|
||||||
private function onMouseDown(event:MouseEvent):Void {
|
private function onMouseDown(event:MouseEvent):Void {
|
||||||
onMouseMove(event);
|
onMouseMove(event);
|
||||||
stage = content.stage;
|
stage = actionLayer.stage;
|
||||||
stage.addEventListener(MouseEvent.MOUSE_MOVE, onMouseMove);
|
stage.addEventListener(MouseEvent.MOUSE_MOVE, onMouseMove);
|
||||||
stage.addEventListener(MouseEvent.MOUSE_UP, onMouseUp);
|
stage.addEventListener(MouseEvent.MOUSE_UP, onMouseUp);
|
||||||
}
|
}
|
||||||
@@ -54,7 +69,7 @@ class GamepadView extends SpriteView implements IControlDevice {
|
|||||||
|
|
||||||
private function onTouchBegin(event:TouchEvent):Void {
|
private function onTouchBegin(event:TouchEvent):Void {
|
||||||
onTouchMove(event);
|
onTouchMove(event);
|
||||||
stage = content.stage;
|
stage = actionLayer.stage;
|
||||||
stage.addEventListener(TouchEvent.TOUCH_MOVE, onTouchMove);
|
stage.addEventListener(TouchEvent.TOUCH_MOVE, onTouchMove);
|
||||||
stage.addEventListener(TouchEvent.TOUCH_END, onTouchEnd);
|
stage.addEventListener(TouchEvent.TOUCH_END, onTouchEnd);
|
||||||
}
|
}
|
||||||
@@ -103,10 +118,15 @@ class GamepadView extends SpriteView implements IControlDevice {
|
|||||||
override public function update():Void {
|
override public function update():Void {
|
||||||
super.update();
|
super.update();
|
||||||
areas = builder.build(width, height);
|
areas = builder.build(width, height);
|
||||||
|
actionLayer.graphics.clear();
|
||||||
|
actionLayer.graphics.beginFill(0, 0.0);
|
||||||
|
actionLayer.graphics.drawRect(0, 0, width, height);
|
||||||
|
actionLayer.graphics.endFill();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public function dispose():Void {
|
public function dispose():Void {
|
||||||
|
actionLayer.removeEventListener(MouseEvent.MOUSE_DOWN, onMouseDown);
|
||||||
|
actionLayer.removeEventListener(TouchEvent.TOUCH_BEGIN, onTouchBegin);
|
||||||
stage = null;
|
stage = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,13 +1,11 @@
|
|||||||
package ru.m.tankz.util;
|
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.Bytes;
|
||||||
import haxe.io.BytesInput;
|
import haxe.io.BytesInput;
|
||||||
|
import haxe.io.BytesOutput;
|
||||||
import haxe.zip.Entry;
|
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.config.Config;
|
||||||
import ru.m.tankz.Type;
|
import ru.m.tankz.Type;
|
||||||
import yaml.Parser;
|
import yaml.Parser;
|
||||||
@@ -29,32 +27,13 @@ class LevelUtil {
|
|||||||
return result;
|
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 {
|
public static function loads(data:String):LevelConfig {
|
||||||
// If first char is digit load as old format
|
var obj:LevelSource = Yaml.parse(data, Parser.options().useObjects());
|
||||||
if (Std.parseInt(data.charAt(0)) != null) {
|
return {
|
||||||
return loadsOld(data);
|
data: obj.data.split('').map(function(c) return Std.parseInt(c)),
|
||||||
} else {
|
points: obj.points,
|
||||||
var obj:LevelSource = Yaml.parse(data, Parser.options().useObjects());
|
name: obj.name,
|
||||||
return {
|
size: obj.size,
|
||||||
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 bytes = Bytes.ofString(content);
|
||||||
var crc = haxe.crypto.Crc32.make(bytes);
|
var crc = haxe.crypto.Crc32.make(bytes);
|
||||||
var result:Entry = {
|
var result:Entry = {
|
||||||
fileName: '${formatLevel(level.id)}.txt',
|
fileName: '${formatLevel(level.id)}.yml',
|
||||||
fileSize: bytes.length,
|
fileSize: bytes.length,
|
||||||
fileTime : Date.now(),
|
fileTime: Date.now(),
|
||||||
compressed : false,
|
compressed: false,
|
||||||
dataSize : bytes.length,
|
dataSize: bytes.length,
|
||||||
data : bytes,
|
data: bytes,
|
||||||
crc32 : crc,
|
crc32: crc,
|
||||||
};
|
};
|
||||||
Tools.compress(result, 9);
|
Tools.compress(result, 9);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function unpack(bytes:Bytes):Array<LevelConfig> {
|
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));
|
return Lambda.array(files.map(extract));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user