[client] rename frame => view
This commit is contained in:
@@ -1,16 +1,10 @@
|
||||
package ru.m.tankz;
|
||||
|
||||
import ru.m.tankz.view.ClientView;
|
||||
import flash.Lib;
|
||||
import haxework.animate.Animate;
|
||||
import ru.m.tankz.frame.StartFrame;
|
||||
import flash.ui.Keyboard;
|
||||
import flash.events.KeyboardEvent;
|
||||
import flash.text.Font;
|
||||
import haxework.gui.frame.FrameSwitcher;
|
||||
import haxework.gui.Root;
|
||||
import haxework.log.TraceLogger;
|
||||
import haxework.provider.Provider;
|
||||
import haxework.resources.IResources;
|
||||
#if flash import haxework.log.JSLogger; #end
|
||||
#if debug import haxework.log.SocketLogger; #end
|
||||
|
||||
@@ -40,26 +34,3 @@ class Client {
|
||||
view.launch();
|
||||
}
|
||||
}
|
||||
|
||||
@:template class ClientView extends FrameSwitcher {
|
||||
private static inline var TAG = 'Tankz';
|
||||
|
||||
@:provide var resources:IResources;
|
||||
|
||||
public function init():Void {
|
||||
var font:Font = Font.enumerateFonts()[0];
|
||||
resources.text.put('font', 'Bookman Old Style');
|
||||
resources.text.put('version', 'v${Const.VERSION} (${Const.BUILD})');
|
||||
Provider.set(FrameSwitcher, this);
|
||||
}
|
||||
|
||||
public function launch():Void {
|
||||
content.stage.stageFocusRect = false;
|
||||
content.stage.addEventListener(KeyboardEvent.KEY_UP, function(event:KeyboardEvent):Void {
|
||||
if (event.keyCode == Keyboard.ESCAPE) {
|
||||
change(StartFrame.ID);
|
||||
}
|
||||
});
|
||||
change(StartFrame.ID);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,25 +0,0 @@
|
||||
---
|
||||
$type: haxework.gui.frame.FrameSwitcher
|
||||
geometry.size.stretch: true
|
||||
skinId: dark
|
||||
views:
|
||||
- id: start
|
||||
$type: ru.m.tankz.frame.StartFrame
|
||||
# classic
|
||||
- id: classic.level
|
||||
$type: ru.m.tankz.frame.classic.ClassicLevelFrame
|
||||
- id: classic.game
|
||||
$type: ru.m.tankz.frame.classic.ClassicGameFrame
|
||||
# dota
|
||||
- id: dota.level
|
||||
$type: ru.m.tankz.frame.dota.DotaLevelFrame
|
||||
- id: dota.game
|
||||
$type: ru.m.tankz.frame.dota.DotaGameFrame
|
||||
# result
|
||||
- id: result
|
||||
$type: ru.m.tankz.frame.ResultFrame
|
||||
# - id: network
|
||||
# $type: ru.m.tankz.frame.NetworkFrame
|
||||
# settings
|
||||
- id: settings
|
||||
$type: ru.m.tankz.frame.SettingsFrame
|
||||
@@ -22,7 +22,6 @@ import flash.Lib;
|
||||
import js.Browser;
|
||||
#end
|
||||
|
||||
|
||||
class Init {
|
||||
|
||||
private static function getHost():String {
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
package ru.m.tankz;
|
||||
|
||||
import haxework.gui.layout.Layout;
|
||||
import haxework.color.ColorUtil;
|
||||
import haxework.gui.core.Geometry;
|
||||
import haxework.gui.core.HAlign;
|
||||
import haxework.gui.core.VAlign;
|
||||
import haxework.gui.layout.Layout;
|
||||
import haxework.gui.skin.Skin;
|
||||
import haxework.resources.IResources;
|
||||
import openfl.Assets;
|
||||
@@ -33,12 +33,12 @@ class Style {
|
||||
Skin.color(0x000000, 0.1),
|
||||
Skin.border(lightColor, 1, 2),
|
||||
Skin.text(textColor, 22, fontFamily),
|
||||
Skin.size(200, 38),
|
||||
Skin.geometry(new Geometry().setSize(200, 38).setMargin([0, 0, 0, 30])),
|
||||
]);
|
||||
resources.skin.put("button", [
|
||||
Skin.buttonColor(lightColor),
|
||||
Skin.text(textColor, 18, fontFamily),
|
||||
Skin.size(250, 50)
|
||||
Skin.size(250, 50),
|
||||
]);
|
||||
resources.skin.put("text.box", [
|
||||
Skin.color(0x000000, 0.1),
|
||||
|
||||
31
src/client/haxe/ru/m/tankz/view/ClientView.hx
Normal file
31
src/client/haxe/ru/m/tankz/view/ClientView.hx
Normal file
@@ -0,0 +1,31 @@
|
||||
package ru.m.tankz.view;
|
||||
|
||||
import flash.events.KeyboardEvent;
|
||||
import flash.text.Font;
|
||||
import flash.ui.Keyboard;
|
||||
import haxework.gui.frame.FrameSwitcher;
|
||||
import haxework.resources.IResources;
|
||||
|
||||
@:template class ClientView extends FrameSwitcher {
|
||||
private static inline var TAG = 'Tankz';
|
||||
|
||||
@:provide var resources:IResources;
|
||||
@:provide var switcher:FrameSwitcher;
|
||||
|
||||
public function init():Void {
|
||||
var font:Font = Font.enumerateFonts()[0];
|
||||
resources.text.put('font', 'Bookman Old Style');
|
||||
resources.text.put('version', 'v${Const.VERSION} (${Const.BUILD})');
|
||||
switcher = this;
|
||||
}
|
||||
|
||||
public function launch():Void {
|
||||
content.stage.stageFocusRect = false;
|
||||
content.stage.addEventListener(KeyboardEvent.KEY_UP, function(event:KeyboardEvent):Void {
|
||||
if (event.keyCode == Keyboard.ESCAPE) {
|
||||
change(StartFrame.ID);
|
||||
}
|
||||
});
|
||||
change(StartFrame.ID);
|
||||
}
|
||||
}
|
||||
25
src/client/haxe/ru/m/tankz/view/ClientView.yaml
Executable file
25
src/client/haxe/ru/m/tankz/view/ClientView.yaml
Executable file
@@ -0,0 +1,25 @@
|
||||
---
|
||||
$type: haxework.gui.frame.FrameSwitcher
|
||||
geometry.size.stretch: true
|
||||
skinId: dark
|
||||
views:
|
||||
- id: start
|
||||
$type: ru.m.tankz.view.StartFrame
|
||||
# classic
|
||||
- id: classic.level
|
||||
$type: ru.m.tankz.view.classic.ClassicLevelFrame
|
||||
- id: classic.game
|
||||
$type: ru.m.tankz.view.classic.ClassicGameFrame
|
||||
# dota
|
||||
- id: dota.level
|
||||
$type: ru.m.tankz.view.dota.DotaLevelFrame
|
||||
- id: dota.game
|
||||
$type: ru.m.tankz.view.dota.DotaGameFrame
|
||||
# result
|
||||
- id: result
|
||||
$type: ru.m.tankz.view.ResultFrame
|
||||
# - id: network
|
||||
# $type: ru.m.tankz.view.NetworkFrame
|
||||
# settings
|
||||
- id: settings
|
||||
$type: ru.m.tankz.view.SettingsFrame
|
||||
@@ -1,4 +1,4 @@
|
||||
package ru.m.tankz.frame;
|
||||
package ru.m.tankz.view;
|
||||
|
||||
import haxework.gui.ButtonView;
|
||||
import haxework.gui.frame.IFrameSwitcher;
|
||||
@@ -105,4 +105,4 @@ import ru.m.tankz.proto.core.UserProto;
|
||||
network.startGame();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -44,7 +44,7 @@ views:
|
||||
text: Create
|
||||
- id: gameList
|
||||
$type: haxework.gui.list.VListView<ru.m.tankz.proto.core.GameInfoProto>
|
||||
factory: "@class:ru.m.tankz.frame.network.GameItemView"
|
||||
factory: "@class:ru.m.tankz.view.network.GameItemView"
|
||||
pWidth: 100
|
||||
pHeight: 100
|
||||
paddings: 10
|
||||
@@ -74,7 +74,7 @@ views:
|
||||
text: Leave
|
||||
- id: userList
|
||||
$type: haxework.gui.list.VListView<ru.m.tankz.proto.core.UserProto>
|
||||
factory: "@class:ru.m.tankz.frame.network.UserItemView"
|
||||
factory: "@class:ru.m.tankz.view.network.UserItemView"
|
||||
pWidth: 100
|
||||
pHeight: 100
|
||||
paddings: 10
|
||||
@@ -87,4 +87,4 @@ views:
|
||||
skin:
|
||||
$type: haxework.gui.skin.ColorSkin
|
||||
color: "#000000"
|
||||
alpha: 0
|
||||
alpha: 0
|
||||
@@ -1,4 +1,4 @@
|
||||
package ru.m.tankz.frame;
|
||||
package ru.m.tankz.view;
|
||||
|
||||
import haxework.gui.LabelView;
|
||||
import haxework.gui.ButtonView;
|
||||
@@ -6,9 +6,9 @@ import haxework.gui.DataView;
|
||||
import haxework.gui.frame.FrameSwitcher;
|
||||
import haxework.gui.VGroupView;
|
||||
import ru.m.tankz.control.Control;
|
||||
import ru.m.tankz.frame.classic.ClassicGameFrame;
|
||||
import ru.m.tankz.frame.common.LifeView;
|
||||
import ru.m.tankz.frame.dota.DotaGameFrame;
|
||||
import ru.m.tankz.view.classic.ClassicGameFrame;
|
||||
import ru.m.tankz.view.common.LifeView;
|
||||
import ru.m.tankz.view.dota.DotaGameFrame;
|
||||
import ru.m.tankz.game.GameState;
|
||||
import ru.m.tankz.preset.ClassicGame;
|
||||
import ru.m.tankz.preset.DotaGame;
|
||||
@@ -1,4 +1,4 @@
|
||||
package ru.m.tankz.frame;
|
||||
package ru.m.tankz.view;
|
||||
|
||||
import haxework.gui.frame.FrameSwitcher;
|
||||
import haxework.gui.ButtonView;
|
||||
@@ -9,9 +9,9 @@ views:
|
||||
- $type: haxework.gui.HGroupView
|
||||
layout.margin: 20
|
||||
views:
|
||||
- $type: ru.m.tankz.frame.settings.SettingsEditor
|
||||
- $type: ru.m.tankz.view.settings.SettingsEditor
|
||||
controlIndex: 0
|
||||
- $type: ru.m.tankz.frame.settings.SettingsEditor
|
||||
- $type: ru.m.tankz.view.settings.SettingsEditor
|
||||
controlIndex: 1
|
||||
- $type: haxework.gui.HGroupView
|
||||
skinId: panel
|
||||
@@ -1,7 +1,7 @@
|
||||
package ru.m.tankz.frame;
|
||||
package ru.m.tankz.view;
|
||||
|
||||
import ru.m.tankz.frame.classic.ClassicLevelFrame;
|
||||
import ru.m.tankz.frame.dota.DotaLevelFrame;
|
||||
import ru.m.tankz.view.classic.ClassicLevelFrame;
|
||||
import ru.m.tankz.view.dota.DotaLevelFrame;
|
||||
import haxework.gui.ButtonView;
|
||||
import haxework.gui.frame.FrameSwitcher;
|
||||
import haxework.gui.VGroupView;
|
||||
@@ -2,11 +2,11 @@
|
||||
views:
|
||||
- $type: haxework.gui.VGroupView
|
||||
skinId: container
|
||||
layout.margin: 5
|
||||
layout.margin: 10
|
||||
views:
|
||||
- $type: haxework.gui.ImageView
|
||||
image: $asset:image:resources/image/ui/logo.png
|
||||
geometry.margin.bottom: 15
|
||||
geometry.margin.bottom: 30
|
||||
- id: classic
|
||||
$type: haxework.gui.ButtonView
|
||||
skinId: button
|
||||
@@ -34,5 +34,6 @@ views:
|
||||
- $type: haxework.gui.SpriteView
|
||||
geometry.size.width: 100%
|
||||
- $type: haxework.gui.LabelView
|
||||
skinId: text
|
||||
geometry.padding: [20, 5]
|
||||
skinId: text.box
|
||||
text: $r:text:version
|
||||
@@ -1,8 +1,8 @@
|
||||
package ru.m.tankz.frame.classic;
|
||||
package ru.m.tankz.view.classic;
|
||||
|
||||
import ru.m.tankz.frame.common.IGamePanel;
|
||||
import ru.m.tankz.view.common.IGamePanel;
|
||||
import ru.m.tankz.render.Render;
|
||||
import ru.m.tankz.frame.common.GameFrame;
|
||||
import ru.m.tankz.view.common.GameFrame;
|
||||
|
||||
@:template class ClassicGameFrame extends GameFrame {
|
||||
public static inline var ID = "classic.game";
|
||||
@@ -7,4 +7,4 @@ views:
|
||||
- id: render
|
||||
$type: ru.m.tankz.render.Render
|
||||
- id: panel
|
||||
$type: ru.m.tankz.frame.classic.ClassicGamePanel
|
||||
$type: ru.m.tankz.view.classic.ClassicGamePanel
|
||||
@@ -1,9 +1,9 @@
|
||||
package ru.m.tankz.frame.classic;
|
||||
package ru.m.tankz.view.classic;
|
||||
|
||||
import haxework.gui.LabelView;
|
||||
import haxework.gui.VGroupView;
|
||||
import ru.m.tankz.frame.common.IGamePanel;
|
||||
import ru.m.tankz.frame.common.LifeView;
|
||||
import ru.m.tankz.view.common.IGamePanel;
|
||||
import ru.m.tankz.view.common.LifeView;
|
||||
import ru.m.tankz.game.Game;
|
||||
import ru.m.tankz.preset.ClassicGame;
|
||||
|
||||
@@ -12,14 +12,14 @@ views:
|
||||
- $type: haxework.gui.SpriteView
|
||||
geometry.size.height: 50%
|
||||
- id: bot
|
||||
$type: ru.m.tankz.frame.common.LifeView
|
||||
$type: ru.m.tankz.view.common.LifeView
|
||||
tank: ba
|
||||
scoreLabel.visible: false
|
||||
- id: player1
|
||||
$type: ru.m.tankz.frame.common.LifeView
|
||||
$type: ru.m.tankz.view.common.LifeView
|
||||
tank: pa
|
||||
color: 0xFFFF00
|
||||
- id: player2
|
||||
$type: ru.m.tankz.frame.common.LifeView
|
||||
$type: ru.m.tankz.view.common.LifeView
|
||||
tank: pa
|
||||
color: 0x15C040
|
||||
@@ -1,11 +1,11 @@
|
||||
package ru.m.tankz.frame.classic;
|
||||
package ru.m.tankz.view.classic;
|
||||
|
||||
import haxework.gui.ButtonView;
|
||||
import haxework.gui.DataView;
|
||||
import haxework.gui.frame.FrameSwitcher;
|
||||
import haxework.gui.ToggleButtonView;
|
||||
import ru.m.tankz.config.Config;
|
||||
import ru.m.tankz.frame.common.LevelFrame;
|
||||
import ru.m.tankz.view.common.LevelFrame;
|
||||
import ru.m.tankz.preset.ClassicGame;
|
||||
|
||||
@:template class ClassicLevelFrame extends LevelFrame {
|
||||
@@ -1,4 +1,4 @@
|
||||
package ru.m.tankz.frame.common;
|
||||
package ru.m.tankz.view.common;
|
||||
|
||||
import ru.m.tankz.game.GameState;
|
||||
import flash.events.Event;
|
||||
@@ -6,7 +6,7 @@ import haxe.ds.Option;
|
||||
import haxe.Timer;
|
||||
import haxework.gui.frame.FrameSwitcher;
|
||||
import haxework.gui.GroupView;
|
||||
import ru.m.tankz.frame.common.IGamePanel;
|
||||
import ru.m.tankz.view.common.IGamePanel;
|
||||
import ru.m.tankz.game.Game;
|
||||
import ru.m.tankz.network.NetworkManager;
|
||||
import ru.m.tankz.render.Render;
|
||||
@@ -1,4 +1,4 @@
|
||||
package ru.m.tankz.frame.common;
|
||||
package ru.m.tankz.view.common;
|
||||
|
||||
import ru.m.tankz.game.Game;
|
||||
import haxework.gui.IView;
|
||||
@@ -1,4 +1,4 @@
|
||||
package ru.m.tankz.frame.common;
|
||||
package ru.m.tankz.view.common;
|
||||
|
||||
import haxework.gui.ButtonView;
|
||||
import haxework.gui.GroupView;
|
||||
@@ -1,4 +1,4 @@
|
||||
package ru.m.tankz.frame.common;
|
||||
package ru.m.tankz.view.common;
|
||||
|
||||
import openfl.Assets;
|
||||
import haxework.gui.LabelView;
|
||||
@@ -1,4 +1,4 @@
|
||||
package ru.m.tankz.frame.common;
|
||||
package ru.m.tankz.view.common;
|
||||
|
||||
import haxework.color.ColorUtil;
|
||||
import haxework.gui.DataView;
|
||||
@@ -1,7 +1,7 @@
|
||||
package ru.m.tankz.frame.dota;
|
||||
package ru.m.tankz.view.dota;
|
||||
|
||||
import ru.m.tankz.frame.common.GameFrame;
|
||||
import ru.m.tankz.frame.common.IGamePanel;
|
||||
import ru.m.tankz.view.common.GameFrame;
|
||||
import ru.m.tankz.view.common.IGamePanel;
|
||||
import ru.m.tankz.render.Render;
|
||||
|
||||
@:template class DotaGameFrame extends GameFrame {
|
||||
@@ -5,6 +5,6 @@ views:
|
||||
layout.margin: 5
|
||||
views:
|
||||
- id: panel
|
||||
$type: ru.m.tankz.frame.dota.DotaGamePanel
|
||||
$type: ru.m.tankz.view.dota.DotaGamePanel
|
||||
- id: render
|
||||
$type: ru.m.tankz.render.Render
|
||||
@@ -1,9 +1,9 @@
|
||||
package ru.m.tankz.frame.dota;
|
||||
package ru.m.tankz.view.dota;
|
||||
|
||||
import haxework.gui.HGroupView;
|
||||
import haxework.gui.LabelView;
|
||||
import ru.m.tankz.frame.common.IGamePanel;
|
||||
import ru.m.tankz.frame.common.LifeView;
|
||||
import ru.m.tankz.view.common.IGamePanel;
|
||||
import ru.m.tankz.view.common.LifeView;
|
||||
import ru.m.tankz.game.Game;
|
||||
import ru.m.tankz.preset.DotaGame;
|
||||
|
||||
@@ -3,7 +3,7 @@ geometry.size.width: 100%
|
||||
layout.margin: 20
|
||||
views:
|
||||
- id: radiant
|
||||
$type: ru.m.tankz.frame.common.LifeView
|
||||
$type: ru.m.tankz.view.common.LifeView
|
||||
tank: bc
|
||||
color: 0xff4422
|
||||
- $type: haxework.gui.SpriteView
|
||||
@@ -16,6 +16,6 @@ views:
|
||||
- $type: haxework.gui.SpriteView
|
||||
geometry.size.width: 25%
|
||||
- id: dire
|
||||
$type: ru.m.tankz.frame.common.LifeView
|
||||
$type: ru.m.tankz.view.common.LifeView
|
||||
tank: bc
|
||||
color: 0x3284ff
|
||||
@@ -1,10 +1,10 @@
|
||||
package ru.m.tankz.frame.dota;
|
||||
package ru.m.tankz.view.dota;
|
||||
|
||||
import haxework.gui.ButtonView;
|
||||
import haxework.gui.DataView;
|
||||
import haxework.gui.frame.FrameSwitcher;
|
||||
import ru.m.tankz.frame.common.LevelFrame;
|
||||
import ru.m.tankz.frame.common.PlayerView;
|
||||
import ru.m.tankz.view.common.LevelFrame;
|
||||
import ru.m.tankz.view.common.PlayerView;
|
||||
import ru.m.tankz.game.GameState;
|
||||
import ru.m.tankz.preset.DotaGame;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package ru.m.tankz.frame.network;
|
||||
package ru.m.tankz.view.network;
|
||||
|
||||
import haxework.gui.HGroupView;
|
||||
import haxework.gui.LabelView;
|
||||
@@ -18,4 +18,4 @@ import ru.m.tankz.proto.core.GameInfoProto;
|
||||
label.text = '${data.type}';
|
||||
return data;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
package ru.m.tankz.frame.network;
|
||||
package ru.m.tankz.view.network;
|
||||
|
||||
import haxework.gui.HGroupView;
|
||||
import haxework.gui.LabelView;
|
||||
@@ -18,4 +18,4 @@ import ru.m.tankz.proto.core.UserProto;
|
||||
label.text = '${data.uuid} -- ${data.name}';
|
||||
return data;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
package ru.m.tankz.frame.settings;
|
||||
package ru.m.tankz.view.settings;
|
||||
|
||||
import haxework.gui.HGroupView;
|
||||
import haxework.gui.LabelView;
|
||||
@@ -1,4 +1,4 @@
|
||||
package ru.m.tankz.frame.settings;
|
||||
package ru.m.tankz.view.settings;
|
||||
|
||||
import haxework.gui.ButtonView;
|
||||
import haxework.gui.DataView;
|
||||
@@ -10,6 +10,9 @@ class HardBotControl extends BotControl {
|
||||
private var actionTimer:Timer;
|
||||
|
||||
override public function onCollision(with:EntityType):Void {
|
||||
if (tank == null) {
|
||||
return;
|
||||
}
|
||||
switch (with) {
|
||||
case TANK(t):
|
||||
if (t.playerId.team != tank.playerId.team) {
|
||||
|
||||
Reference in New Issue
Block a user