Simplified build process
This commit is contained in:
parent
301bce75e0
commit
2a319c149c
11
.gitignore
vendored
11
.gitignore
vendored
|
@ -1,14 +1,7 @@
|
||||||
.*
|
.*
|
||||||
/bin
|
|
||||||
/bootstrap.py
|
|
||||||
/build
|
|
||||||
/parts
|
|
||||||
/venv
|
|
||||||
/dist
|
|
||||||
/eggs
|
|
||||||
/coverage
|
/coverage
|
||||||
/core
|
|
||||||
/node_modules
|
/node_modules
|
||||||
/src/vendor
|
/src/vendor
|
||||||
|
/src/build.*
|
||||||
/graphics/**/*.blend?*
|
/graphics/**/*.blend?*
|
||||||
|
*.log
|
||||||
|
|
|
@ -1,165 +0,0 @@
|
||||||
#!/usr/bin/env python
|
|
||||||
# Copyright (c) 2014, Jonathan Ballet <jon@multani.info>
|
|
||||||
# All rights reserved.
|
|
||||||
#
|
|
||||||
# Redistribution and use in source and binary forms, with or without
|
|
||||||
# modification, are permitted provided that the following conditions are met:
|
|
||||||
#
|
|
||||||
# 1. Redistributions of source code must retain the above copyright notice, this
|
|
||||||
# list of conditions and the following disclaimer.
|
|
||||||
# 2. Redistributions in binary form must reproduce the above copyright notice,
|
|
||||||
# this list of conditions and the following disclaimer in the documentation
|
|
||||||
# and/or other materials provided with the distribution.
|
|
||||||
#
|
|
||||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|
||||||
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
||||||
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
||||||
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
|
|
||||||
# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
|
||||||
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
|
||||||
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
|
||||||
# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
||||||
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
|
||||||
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
|
|
||||||
"""
|
|
||||||
Bootstrap a Buildout into its own virtualenv environment.
|
|
||||||
|
|
||||||
This script creates a new empty virtualenv, download Buildout's bootstrap script
|
|
||||||
and execute it in the context of the previously created virtualenv.
|
|
||||||
|
|
||||||
python bootstrap-venv.py
|
|
||||||
|
|
||||||
Then, you only have to edit your `buildout.cfg` file and run::
|
|
||||||
|
|
||||||
./bin/buildout
|
|
||||||
|
|
||||||
You can also specify another directory to bootstrap the whole thing in::
|
|
||||||
|
|
||||||
python bootstrap-venv.py some-directory
|
|
||||||
cd some-directory
|
|
||||||
[ edit buildout.cfg ]
|
|
||||||
./bin/buildout
|
|
||||||
|
|
||||||
"""
|
|
||||||
|
|
||||||
|
|
||||||
# This URL is supposed to be stable
|
|
||||||
BOOTSTRAP_BUILDOUT_URL = "https://bootstrap.pypa.io/bootstrap-buildout.py"
|
|
||||||
|
|
||||||
# TODO: find a place where Virtualenv is FOR EVER AND EVER available.
|
|
||||||
VIRTUALENV_URL = "https://pypi.python.org/packages/source/v/virtualenv/" + \
|
|
||||||
"virtualenv-1.11.6.tar.gz"
|
|
||||||
|
|
||||||
|
|
||||||
import io
|
|
||||||
import gzip
|
|
||||||
import os
|
|
||||||
import subprocess
|
|
||||||
import sys
|
|
||||||
import tarfile
|
|
||||||
try:
|
|
||||||
from urllib.request import urlopen
|
|
||||||
except ImportError:
|
|
||||||
from urllib2 import urlopen
|
|
||||||
|
|
||||||
|
|
||||||
def download_virtualenv(destination):
|
|
||||||
print("Downloading virtualenv from %s" % VIRTUALENV_URL)
|
|
||||||
url = urlopen(VIRTUALENV_URL)
|
|
||||||
|
|
||||||
string_fp = io.BytesIO(url.read())
|
|
||||||
gz_fp = gzip.GzipFile(fileobj=string_fp)
|
|
||||||
tar_fp = tarfile.TarFile(fileobj=gz_fp)
|
|
||||||
tar_fp.extractall(destination)
|
|
||||||
|
|
||||||
path = os.path.join(destination, os.listdir(destination)[0])
|
|
||||||
sys.path.insert(0, path)
|
|
||||||
import virtualenv
|
|
||||||
print("Using virtualenv module at %s" % virtualenv.__file__)
|
|
||||||
return virtualenv
|
|
||||||
|
|
||||||
|
|
||||||
def create_virtualenv(destination):
|
|
||||||
venv_dir = os.path.join(destination, "parts", "venv")
|
|
||||||
|
|
||||||
try:
|
|
||||||
import virtualenv
|
|
||||||
except ImportError:
|
|
||||||
venv_dist = os.path.join(destination, "parts", "venv-dist")
|
|
||||||
virtualenv = download_virtualenv(venv_dist)
|
|
||||||
|
|
||||||
|
|
||||||
print("Creating virtual environment in %s..." % venv_dir)
|
|
||||||
virtualenv.create_environment(venv_dir,
|
|
||||||
site_packages=False,
|
|
||||||
clear=True,
|
|
||||||
unzip_setuptools=False)
|
|
||||||
print("Virtual environment created in %s." % venv_dir)
|
|
||||||
return venv_dir
|
|
||||||
|
|
||||||
|
|
||||||
def download_bootstrap(destination):
|
|
||||||
bootstrap_path = os.path.join(destination, "bootstrap.py")
|
|
||||||
print("Downloading Buildout bootstrap from %s..." % BOOTSTRAP_BUILDOUT_URL)
|
|
||||||
url = urlopen(BOOTSTRAP_BUILDOUT_URL)
|
|
||||||
|
|
||||||
with open(bootstrap_path, "wb") as fp:
|
|
||||||
fp.write(url.read())
|
|
||||||
|
|
||||||
print("Downloaded Buildout bootstrap into %s." % bootstrap_path)
|
|
||||||
return bootstrap_path
|
|
||||||
|
|
||||||
|
|
||||||
def make_default_buildout_cfg(buildout_cfg):
|
|
||||||
content = [
|
|
||||||
"[buildout]",
|
|
||||||
"parts = default",
|
|
||||||
"",
|
|
||||||
"[default]",
|
|
||||||
"recipe = zc.recipe.egg",
|
|
||||||
"eggs = zc.recipe.egg",
|
|
||||||
"interpreter = python",
|
|
||||||
]
|
|
||||||
with open(buildout_cfg, "w") as fp:
|
|
||||||
fp.writelines(l + "\n" for l in content)
|
|
||||||
|
|
||||||
|
|
||||||
def bootstrap_buildout(venv_dir, bootstrap_path):
|
|
||||||
python_bin = os.path.join(venv_dir, "bin", "python")
|
|
||||||
assert os.path.exists(python_bin)
|
|
||||||
|
|
||||||
buildout_cfg = os.path.join(os.path.dirname(bootstrap_path), "buildout.cfg")
|
|
||||||
try:
|
|
||||||
fp = open(buildout_cfg)
|
|
||||||
except IOError as err:
|
|
||||||
if err.errno != 2:
|
|
||||||
raise
|
|
||||||
print("Creating a default buildout.cfg file in %s" % buildout_cfg)
|
|
||||||
make_default_buildout_cfg(buildout_cfg)
|
|
||||||
else:
|
|
||||||
fp.close()
|
|
||||||
|
|
||||||
print("Bootstrapping Buildout using: %s %s..." % (
|
|
||||||
python_bin, bootstrap_path))
|
|
||||||
subprocess.check_call([python_bin, bootstrap_path])
|
|
||||||
|
|
||||||
print("Invoking bootstrapped buildout...")
|
|
||||||
buildout_bin = os.path.join(os.path.dirname(bootstrap_path), "bin", "buildout")
|
|
||||||
subprocess.check_call([buildout_bin])
|
|
||||||
|
|
||||||
|
|
||||||
if len(sys.argv) == 2:
|
|
||||||
real_destination = sys.argv[1]
|
|
||||||
else:
|
|
||||||
real_destination = os.getcwd()
|
|
||||||
|
|
||||||
|
|
||||||
print("About to create Buildout environment in %s..." % real_destination)
|
|
||||||
|
|
||||||
os.chdir(real_destination)
|
|
||||||
destination = "."
|
|
||||||
venv_dir = create_virtualenv(destination)
|
|
||||||
bootstrap_path = download_bootstrap(destination)
|
|
||||||
bootstrap_buildout(venv_dir, bootstrap_path)
|
|
||||||
|
|
16
bower.json
Normal file
16
bower.json
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
{
|
||||||
|
"name": "spacetac",
|
||||||
|
"description": "A tactical RPG set in space",
|
||||||
|
"main": "out/build.js",
|
||||||
|
"authors": [
|
||||||
|
"Michael Lemaire"
|
||||||
|
],
|
||||||
|
"license": "MIT",
|
||||||
|
"homepage": "",
|
||||||
|
"private": true,
|
||||||
|
"dependencies": {
|
||||||
|
"phaser": "2.3.0",
|
||||||
|
"jasmine-core": "jasmine#^2.5.2",
|
||||||
|
"deep-diff": "0.3.0"
|
||||||
|
}
|
||||||
|
}
|
78
buildout.cfg
78
buildout.cfg
|
@ -1,78 +0,0 @@
|
||||||
[buildout]
|
|
||||||
update-versions-file = versions.cfg
|
|
||||||
extends =
|
|
||||||
versions.cfg
|
|
||||||
parts =
|
|
||||||
watch
|
|
||||||
js-tools
|
|
||||||
js-libraries
|
|
||||||
init-compile
|
|
||||||
|
|
||||||
[init-compile]
|
|
||||||
recipe = collective.recipe.cmd
|
|
||||||
on_install = true
|
|
||||||
on_update = true
|
|
||||||
cmds = ${buildout:bin-directory}/${compile:name}
|
|
||||||
|
|
||||||
[compile]
|
|
||||||
recipe = yt.recipe.shell
|
|
||||||
name = compile
|
|
||||||
script = ${js-tools:bin-gulp} build
|
|
||||||
|
|
||||||
[watch]
|
|
||||||
recipe = yt.recipe.shell
|
|
||||||
name = watch
|
|
||||||
script = ${js-tools:bin-gulp}
|
|
||||||
|
|
||||||
[nodejs]
|
|
||||||
recipe = gp.recipe.node
|
|
||||||
executable_node = ${buildout:bin-directory}/node
|
|
||||||
executable_npm = ${buildout:bin-directory}/npm
|
|
||||||
|
|
||||||
[js-tools]
|
|
||||||
recipe = rodacom.buildout.npm
|
|
||||||
node_path = ${nodejs:executable_node}
|
|
||||||
npm_path = ${nodejs:executable_npm}
|
|
||||||
strip_extension = true
|
|
||||||
packages =
|
|
||||||
bower
|
|
||||||
del
|
|
||||||
gulp
|
|
||||||
gulp-concat
|
|
||||||
gulp-concat-sourcemap
|
|
||||||
gulp-connect
|
|
||||||
gulp-gh-pages
|
|
||||||
gulp-karma
|
|
||||||
gulp-minify-html
|
|
||||||
gulp-open
|
|
||||||
gulp-processhtml
|
|
||||||
gulp-sourcemaps
|
|
||||||
gulp-tslint
|
|
||||||
gulp-typescript
|
|
||||||
gulp-uglifyjs
|
|
||||||
gulp-util
|
|
||||||
gulp-watch
|
|
||||||
run-sequence
|
|
||||||
karma
|
|
||||||
karma-coverage
|
|
||||||
karma-jasmine
|
|
||||||
karma-phantomjs-launcher
|
|
||||||
karma-firefox-launcher
|
|
||||||
bin-bower = ${buildout:bin-directory}/bower
|
|
||||||
bin-gulp = ${buildout:bin-directory}/gulp
|
|
||||||
|
|
||||||
[js-libraries]
|
|
||||||
recipe = bowerrecipe
|
|
||||||
executable = ${js-tools:bin-bower}
|
|
||||||
base-directory = ${buildout:directory}/src/vendor
|
|
||||||
downloads = .
|
|
||||||
packages =
|
|
||||||
phaser#2.3.0
|
|
||||||
jasmine#2.1.3
|
|
||||||
deep-diff#0.3.0
|
|
||||||
|
|
||||||
[mkdir-var]
|
|
||||||
recipe = z3c.recipe.mkdir
|
|
||||||
paths =
|
|
||||||
var
|
|
||||||
var/cache
|
|
|
@ -1,7 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
|
|
||||||
set -e
|
|
||||||
|
|
||||||
git_root=$(git rev-parse --show-toplevel)
|
|
||||||
PATH=${PATH}:${git_root}/bin ${git_root}/bin/gulp strict
|
|
||||||
|
|
126
gulpfile.js
126
gulpfile.js
|
@ -1,126 +0,0 @@
|
||||||
var gulp = require('gulp'),
|
|
||||||
ts = require('gulp-typescript'),
|
|
||||||
concat = require('gulp-concat-sourcemap'),
|
|
||||||
sourcemaps = require('gulp-sourcemaps'),
|
|
||||||
processhtml = require('gulp-processhtml'),
|
|
||||||
connect = require('gulp-connect'),
|
|
||||||
karma = require('gulp-karma'),
|
|
||||||
tslint = require('gulp-tslint'),
|
|
||||||
open = require('gulp-open'),
|
|
||||||
del = require('del'),
|
|
||||||
uglify = require('gulp-uglifyjs'),
|
|
||||||
deploy = require('gulp-gh-pages'),
|
|
||||||
runSequence = require('run-sequence');
|
|
||||||
|
|
||||||
var paths = {
|
|
||||||
assets: 'src/assets/**/*',
|
|
||||||
index: 'src/index.html',
|
|
||||||
libs: [
|
|
||||||
'src/vendor/jasmine/lib/jasmine-core/jasmine.js',
|
|
||||||
'src/vendor/jasmine/lib/jasmine-core/jasmine-html.js',
|
|
||||||
'src/vendor/jasmine/lib/jasmine-core/boot.js',
|
|
||||||
'src/vendor/phaser/build/phaser.min.js'
|
|
||||||
],
|
|
||||||
ts: 'src/app/**/*.ts',
|
|
||||||
build: './build/',
|
|
||||||
dist: './dist/'
|
|
||||||
};
|
|
||||||
|
|
||||||
gulp.task('clean', function (cb) {
|
|
||||||
return del([paths.build, paths.dist], cb);
|
|
||||||
});
|
|
||||||
|
|
||||||
gulp.task('copy', function () {
|
|
||||||
return gulp.src(paths.assets)
|
|
||||||
.pipe(gulp.dest(paths.dist + 'assets'));
|
|
||||||
});
|
|
||||||
|
|
||||||
var tsProject = ts.createProject({
|
|
||||||
declarationFiles: true,
|
|
||||||
noExternalResolve: true,
|
|
||||||
noImplicitAny: false, // Handled by tslint
|
|
||||||
sortOutput: true,
|
|
||||||
sourceRoot: '../app'
|
|
||||||
});
|
|
||||||
|
|
||||||
gulp.task('typescript', function () {
|
|
||||||
var tsResult = gulp.src(paths.ts)
|
|
||||||
.pipe(sourcemaps.init())
|
|
||||||
.pipe(ts(tsProject));
|
|
||||||
|
|
||||||
return tsResult.js
|
|
||||||
.pipe(concat('main.js'))
|
|
||||||
.pipe(sourcemaps.write())
|
|
||||||
.pipe(gulp.dest(paths.build));
|
|
||||||
});
|
|
||||||
|
|
||||||
gulp.task('tests', ['typescript'], function () {
|
|
||||||
return gulp.src(paths.libs + [paths.build + 'main.js'])
|
|
||||||
.pipe(karma({configFile: 'karma.conf.js', action: 'run'}))
|
|
||||||
});
|
|
||||||
|
|
||||||
gulp.task('tslint', function () {
|
|
||||||
return gulp.src(['src/app/game/**/*.ts', 'src/app/view/**/*.ts'])
|
|
||||||
.pipe(tslint())
|
|
||||||
.pipe(tslint.report('verbose', {
|
|
||||||
emitError: false
|
|
||||||
}));
|
|
||||||
});
|
|
||||||
gulp.task('tslintstrict', function () {
|
|
||||||
return gulp.src(['src/app/game/**/*.ts', 'src/app/view/**/*.ts'])
|
|
||||||
.pipe(tslint())
|
|
||||||
.pipe(tslint.report('verbose'));
|
|
||||||
});
|
|
||||||
|
|
||||||
gulp.task('processhtml', function () {
|
|
||||||
return gulp.src(paths.index)
|
|
||||||
.pipe(processhtml())
|
|
||||||
.pipe(gulp.dest(paths.dist));
|
|
||||||
});
|
|
||||||
|
|
||||||
gulp.task('reload', ['typescript'], function () {
|
|
||||||
gulp.src('src/*.html')
|
|
||||||
.pipe(connect.reload());
|
|
||||||
});
|
|
||||||
|
|
||||||
gulp.task('watch', function () {
|
|
||||||
gulp.watch(paths.ts, ['typescript', 'tslint', 'tests', 'reload']);
|
|
||||||
gulp.watch(paths.less, ['less', 'reload']);
|
|
||||||
gulp.watch(paths.index, ['reload']);
|
|
||||||
});
|
|
||||||
|
|
||||||
gulp.task('connect', function () {
|
|
||||||
connect.server({
|
|
||||||
root: [__dirname + '/src', paths.build],
|
|
||||||
port: 9000,
|
|
||||||
livereload: true
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
gulp.task("open", function () {
|
|
||||||
gulp.src(paths.index)
|
|
||||||
.pipe(open("", {url: "http://localhost:9000"}));
|
|
||||||
});
|
|
||||||
|
|
||||||
gulp.task('minifyJs', ['typescript'], function () {
|
|
||||||
return gulp.src(paths.libs.concat(paths.build + 'main.js'))
|
|
||||||
.pipe(uglify('all.min.js', {outSourceMap: false}))
|
|
||||||
.pipe(gulp.dest(paths.dist));
|
|
||||||
});
|
|
||||||
|
|
||||||
gulp.task('deploy', function () {
|
|
||||||
return gulp.src('./dist/**/*')
|
|
||||||
.pipe(deploy({
|
|
||||||
remoteUrl: "git@github.com:thunderk/spacetac.git"
|
|
||||||
}));
|
|
||||||
});
|
|
||||||
|
|
||||||
gulp.task('default', function () {
|
|
||||||
runSequence('clean', ['typescript', 'tslint', 'connect', 'watch'], ['tests', 'open']);
|
|
||||||
});
|
|
||||||
gulp.task('build', function () {
|
|
||||||
return runSequence('clean', ['typescript', 'tslint', 'copy', 'minifyJs', 'processhtml']);
|
|
||||||
});
|
|
||||||
gulp.task('strict', function () {
|
|
||||||
return runSequence('clean', ['typescript', 'tslintstrict', 'tests']);
|
|
||||||
});
|
|
|
@ -1,20 +0,0 @@
|
||||||
// Configuration for running unit testing using karma
|
|
||||||
module.exports = function (config) {
|
|
||||||
config.set({
|
|
||||||
basePath: '',
|
|
||||||
frameworks: ['jasmine'],
|
|
||||||
files: [
|
|
||||||
'src/vendor/phaser/build/phaser.js',
|
|
||||||
'src/vendor/deep-diff/releases/deep-diff-0.3.0.min.js',
|
|
||||||
'build/main.js'
|
|
||||||
],
|
|
||||||
client: {
|
|
||||||
captureConsole: false
|
|
||||||
},
|
|
||||||
logLevel: config.LOG_WARN,
|
|
||||||
browsers: ['PhantomJS'],
|
|
||||||
singleRun: true,
|
|
||||||
reporters: ['progress', 'coverage'],
|
|
||||||
preprocessors: {'build/main.js': ['coverage']}
|
|
||||||
});
|
|
||||||
};
|
|
23
package.json
Normal file
23
package.json
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
{
|
||||||
|
"name": "spacetac",
|
||||||
|
"version": "0.1.0",
|
||||||
|
"description": "A tactical RPG set in space",
|
||||||
|
"main": "src/build.js",
|
||||||
|
"scripts": {
|
||||||
|
"build": "tsc -p .",
|
||||||
|
"test": "echo \"Error: no test specified\" && exit 1",
|
||||||
|
"serve": "simple-server out 8012"
|
||||||
|
},
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://code.thunderk.net/michael/spacetac.git"
|
||||||
|
},
|
||||||
|
"author": "Michael Lemaire",
|
||||||
|
"license": "MIT",
|
||||||
|
"devDependencies": {
|
||||||
|
"bower": "^1.7.9",
|
||||||
|
"jasmine": "^2.5.2",
|
||||||
|
"simple-server": "^1.0.1",
|
||||||
|
"typescript": "^2.0.6"
|
||||||
|
}
|
||||||
|
}
|
|
@ -41,6 +41,7 @@ module SpaceTac {
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
(<View.BaseView>this.state.getCurrentState()).messages.addMessage("Your browser does not support saving");
|
(<View.BaseView>this.state.getCurrentState()).messages.addMessage("Your browser does not support saving");
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -58,6 +59,7 @@ module SpaceTac {
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
console.error("localStorage not available");
|
console.error("localStorage not available");
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -70,9 +70,7 @@ module SpaceTac.Game {
|
||||||
// Iterator over each code
|
// Iterator over each code
|
||||||
static forEachCode(callback: (code: AttributeCode) => void) {
|
static forEachCode(callback: (code: AttributeCode) => void) {
|
||||||
for (var val in AttributeCode) {
|
for (var val in AttributeCode) {
|
||||||
if (!isNaN(val)) {
|
callback(<AttributeCode>parseInt(val, 10));
|
||||||
callback(<AttributeCode>parseInt(val, 10));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -41,7 +41,6 @@ module SpaceTac.Game {
|
||||||
this.filters.forEach((code: string) => {
|
this.filters.forEach((code: string) => {
|
||||||
if (event.code === code) {
|
if (event.code === code) {
|
||||||
filtered = true;
|
filtered = true;
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
if (filtered) {
|
if (filtered) {
|
||||||
|
|
|
@ -24,11 +24,12 @@ module SpaceTac.View {
|
||||||
|
|
||||||
// Create an empty action bar
|
// Create an empty action bar
|
||||||
constructor(battleview: BattleView) {
|
constructor(battleview: BattleView) {
|
||||||
|
super(battleview.game);
|
||||||
|
|
||||||
this.battleview = battleview;
|
this.battleview = battleview;
|
||||||
this.actions = [];
|
this.actions = [];
|
||||||
this.ship = null;
|
this.ship = null;
|
||||||
|
|
||||||
super(battleview.game);
|
|
||||||
this.x = 230;
|
this.x = 230;
|
||||||
this.y = 0;
|
this.y = 0;
|
||||||
battleview.ui.add(this);
|
battleview.ui.add(this);
|
||||||
|
|
|
@ -35,12 +35,13 @@ module SpaceTac.View {
|
||||||
|
|
||||||
// Create an icon for a single ship action
|
// Create an icon for a single ship action
|
||||||
constructor(bar: ActionBar, x: number, y: number, ship: Game.Ship, action: Game.BaseAction) {
|
constructor(bar: ActionBar, x: number, y: number, ship: Game.Ship, action: Game.BaseAction) {
|
||||||
|
super(bar.game, x, y, "battle-action-inactive");
|
||||||
|
|
||||||
this.bar = bar;
|
this.bar = bar;
|
||||||
this.battleview = bar.battleview;
|
this.battleview = bar.battleview;
|
||||||
this.ship = ship;
|
this.ship = ship;
|
||||||
this.action = action;
|
this.action = action;
|
||||||
|
|
||||||
super(bar.game, x, y, "battle-action-inactive");
|
|
||||||
bar.addChild(this);
|
bar.addChild(this);
|
||||||
|
|
||||||
// Active layer
|
// Active layer
|
||||||
|
|
|
@ -26,14 +26,14 @@ module SpaceTac.View {
|
||||||
|
|
||||||
// Create a graphical arena for ship sprites to fight in a 2D space
|
// Create a graphical arena for ship sprites to fight in a 2D space
|
||||||
constructor(battleview: BattleView) {
|
constructor(battleview: BattleView) {
|
||||||
|
super(battleview.game);
|
||||||
|
|
||||||
this.battleview = battleview;
|
this.battleview = battleview;
|
||||||
this.ship_sprites = [];
|
this.ship_sprites = [];
|
||||||
this.playing = null;
|
this.playing = null;
|
||||||
this.hovered = null;
|
this.hovered = null;
|
||||||
this.range_hint = null;
|
this.range_hint = null;
|
||||||
|
|
||||||
super(battleview.game);
|
|
||||||
|
|
||||||
var offset_x = 206;
|
var offset_x = 206;
|
||||||
var offset_y = 84;
|
var offset_y = 84;
|
||||||
|
|
||||||
|
|
|
@ -17,10 +17,10 @@ module SpaceTac.View {
|
||||||
|
|
||||||
// Create a ship sprite usable in the Arena
|
// Create a ship sprite usable in the Arena
|
||||||
constructor(battleview: BattleView, ship: Game.Ship) {
|
constructor(battleview: BattleView, ship: Game.Ship) {
|
||||||
this.ship = ship;
|
|
||||||
|
|
||||||
super(battleview.game);
|
super(battleview.game);
|
||||||
|
|
||||||
|
this.ship = ship;
|
||||||
|
|
||||||
// Add ship sprite
|
// Add ship sprite
|
||||||
this.sprite = new Phaser.Button(battleview.game, 0, 0, "ship-" + ship.model + "-sprite");
|
this.sprite = new Phaser.Button(battleview.game, 0, 0, "ship-" + ship.model + "-sprite");
|
||||||
this.sprite.rotation = ship.arena_angle;
|
this.sprite.rotation = ship.arena_angle;
|
||||||
|
|
|
@ -17,12 +17,13 @@ module SpaceTac.View {
|
||||||
|
|
||||||
// Create an empty action bar
|
// Create an empty action bar
|
||||||
constructor(battleview: BattleView) {
|
constructor(battleview: BattleView) {
|
||||||
|
super(battleview.game, battleview.ui);
|
||||||
|
|
||||||
this.battleview = battleview;
|
this.battleview = battleview;
|
||||||
this.ships = [];
|
this.ships = [];
|
||||||
this.playing = null;
|
this.playing = null;
|
||||||
this.hovered = null;
|
this.hovered = null;
|
||||||
|
|
||||||
super(battleview.game, battleview.ui);
|
|
||||||
battleview.ui.add(this);
|
battleview.ui.add(this);
|
||||||
|
|
||||||
this.addBackground();
|
this.addBackground();
|
||||||
|
|
|
@ -26,10 +26,10 @@ module SpaceTac.View {
|
||||||
|
|
||||||
// Create a ship button for the battle ship list
|
// Create a ship button for the battle ship list
|
||||||
constructor(list: ShipList, x: number, y: number, ship: Game.Ship, owned: boolean) {
|
constructor(list: ShipList, x: number, y: number, ship: Game.Ship, owned: boolean) {
|
||||||
this.ship = ship;
|
|
||||||
|
|
||||||
super(list.battleview.game, x, y, owned ? "battle-shiplist-own" : "battle-shiplist-enemy");
|
super(list.battleview.game, x, y, owned ? "battle-shiplist-own" : "battle-shiplist-enemy");
|
||||||
|
|
||||||
|
this.ship = ship;
|
||||||
|
|
||||||
this.input.useHandCursor = true;
|
this.input.useHandCursor = true;
|
||||||
this.onInputOver.add(() => {
|
this.onInputOver.add(() => {
|
||||||
list.battleview.cursorOnShip(ship);
|
list.battleview.cursorOnShip(ship);
|
||||||
|
|
|
@ -35,11 +35,11 @@
|
||||||
<!-- /build -->
|
<!-- /build -->
|
||||||
|
|
||||||
<!-- build:js all.min.js -->
|
<!-- build:js all.min.js -->
|
||||||
<script src="vendor/jasmine/lib/jasmine-core/jasmine.js"></script>
|
<script src="vendor/jasmine-core/lib/jasmine-core/jasmine.js"></script>
|
||||||
<script src="vendor/jasmine/lib/jasmine-core/jasmine-html.js"></script>
|
<script src="vendor/jasmine-core/lib/jasmine-core/jasmine-html.js"></script>
|
||||||
<script src="vendor/jasmine/lib/jasmine-core/boot.js"></script>
|
<script src="vendor/jasmine-core/lib/jasmine-core/boot.js"></script>
|
||||||
<script src="vendor/phaser/build/phaser.js"></script>
|
<script src="vendor/phaser/build/phaser.js"></script>
|
||||||
<script src="main.js"></script>
|
<script src="build.js"></script>
|
||||||
<!-- /build -->
|
<!-- /build -->
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
@ -63,4 +63,4 @@
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
23
tsconfig.json
Normal file
23
tsconfig.json
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
{
|
||||||
|
"compilerOptions": {
|
||||||
|
"module": "system",
|
||||||
|
"forceConsistentCasingInFileNames": true,
|
||||||
|
"noFallthroughCasesInSwitch": true,
|
||||||
|
"noImplicitAny": false,
|
||||||
|
"noImplicitThis": true,
|
||||||
|
"noImplicitReturns": true,
|
||||||
|
"removeComments": true,
|
||||||
|
"preserveConstEnums": true,
|
||||||
|
"out": "src/build.js",
|
||||||
|
"strictNullChecks": false,
|
||||||
|
"sourceMap": true,
|
||||||
|
"target": "es5"
|
||||||
|
},
|
||||||
|
"exclude": [
|
||||||
|
"out",
|
||||||
|
"src/vendor",
|
||||||
|
"coverage",
|
||||||
|
"node_modules"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
87
tslint.json
87
tslint.json
|
@ -1,87 +0,0 @@
|
||||||
{
|
|
||||||
"rules": {
|
|
||||||
"ban": [true,
|
|
||||||
["_", "extend"],
|
|
||||||
["_", "isNull"],
|
|
||||||
["_", "isDefined"]
|
|
||||||
],
|
|
||||||
"class-name": true,
|
|
||||||
"comment-format": [true,
|
|
||||||
"check-space",
|
|
||||||
"!check-lowercase"
|
|
||||||
],
|
|
||||||
"curly": true,
|
|
||||||
"eofline": true,
|
|
||||||
"forin": true,
|
|
||||||
"indent": [true, 4],
|
|
||||||
"interface-name": true,
|
|
||||||
"jsdoc-format": true,
|
|
||||||
"label-position": true,
|
|
||||||
"label-undefined": true,
|
|
||||||
"max-line-length": [true, 140],
|
|
||||||
"member-ordering": [true,
|
|
||||||
"public-before-private",
|
|
||||||
"static-before-instance",
|
|
||||||
"variables-before-functions"
|
|
||||||
],
|
|
||||||
"no-arg": true,
|
|
||||||
"no-bitwise": true,
|
|
||||||
"no-console": [true,
|
|
||||||
"debug",
|
|
||||||
"info",
|
|
||||||
"time",
|
|
||||||
"timeEnd",
|
|
||||||
"trace"
|
|
||||||
],
|
|
||||||
"no-construct": true,
|
|
||||||
"no-constructor-vars": true,
|
|
||||||
"no-debugger": true,
|
|
||||||
"no-duplicate-key": true,
|
|
||||||
"no-duplicate-variable": true,
|
|
||||||
"no-empty": true,
|
|
||||||
"no-eval": true,
|
|
||||||
"no-string-literal": true,
|
|
||||||
"no-switch-case-fall-through": true,
|
|
||||||
"no-trailing-comma": true,
|
|
||||||
"no-trailing-whitespace": true,
|
|
||||||
"no-unused-expression": false,
|
|
||||||
"no-unused-variable": true,
|
|
||||||
"no-unreachable": true,
|
|
||||||
"no-use-before-declare": true,
|
|
||||||
"no-var-requires": true,
|
|
||||||
"one-line": [true,
|
|
||||||
"check-open-brace",
|
|
||||||
"check-catch",
|
|
||||||
"check-else",
|
|
||||||
"check-whitespace"
|
|
||||||
],
|
|
||||||
"quotemark": [true, "double"],
|
|
||||||
"radix": true,
|
|
||||||
"semicolon": true,
|
|
||||||
"triple-equals": [true, "allow-null-check"],
|
|
||||||
"typedef": [true,
|
|
||||||
"callSignature",
|
|
||||||
"indexSignature",
|
|
||||||
"parameter",
|
|
||||||
"propertySignature",
|
|
||||||
"variableDeclarator"
|
|
||||||
],
|
|
||||||
"typedef-whitespace": [true,
|
|
||||||
["callSignature", "noSpace"],
|
|
||||||
["catchClause", "noSpace"],
|
|
||||||
["indexSignature", "space"]
|
|
||||||
],
|
|
||||||
"use-strict": [true,
|
|
||||||
"check-module",
|
|
||||||
"check-function"
|
|
||||||
],
|
|
||||||
"variable-name": false,
|
|
||||||
"whitespace": [true,
|
|
||||||
"check-branch",
|
|
||||||
"check-decl",
|
|
||||||
"check-operator",
|
|
||||||
"check-separator",
|
|
||||||
"check-type"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
28
versions.cfg
28
versions.cfg
|
@ -1,28 +0,0 @@
|
||||||
[versions]
|
|
||||||
|
|
||||||
# Added by buildout at 2014-12-28 20:27:17.084358
|
|
||||||
bowerrecipe = 0.1.1
|
|
||||||
collective.recipe.cmd = 0.9
|
|
||||||
gp.recipe.node = 0.10.28.0
|
|
||||||
rodacom.buildout.npm = 0.6
|
|
||||||
yt.recipe.shell = 0.1.7
|
|
||||||
zc.buildout = 2.3.1
|
|
||||||
zc.recipe.egg = 2.0.1
|
|
||||||
|
|
||||||
# Required by:
|
|
||||||
# gp.recipe.node==0.10.28.0
|
|
||||||
hexagonit.recipe.cmmi = 2.0
|
|
||||||
|
|
||||||
# Required by:
|
|
||||||
# hexagonit.recipe.cmmi==2.0
|
|
||||||
hexagonit.recipe.download = 1.7
|
|
||||||
|
|
||||||
# Required by:
|
|
||||||
# gp.recipe.node==0.10.28.0
|
|
||||||
python-archive = 0.2
|
|
||||||
|
|
||||||
# Required by:
|
|
||||||
# gp.recipe.node==0.10.28.0
|
|
||||||
# hexagonit.recipe.cmmi==2.0
|
|
||||||
# zc.recipe.egg==2.0.1
|
|
||||||
setuptools = 8.3
|
|
Loading…
Reference in a new issue