Skip to content

Commit

Permalink
TypeScript: update the dependencies to support RobotlegsJS-Pixi-Palidor
Browse files Browse the repository at this point in the history
  • Loading branch information
RonaldoSetzer committed Sep 5, 2017
1 parent a077a78 commit 6ba6ce3
Show file tree
Hide file tree
Showing 44 changed files with 1,363 additions and 1,470 deletions.
24 changes: 0 additions & 24 deletions typescript-tetris/Grid.test.ts

This file was deleted.

15 changes: 8 additions & 7 deletions typescript-tetris/README.md
Original file line number Diff line number Diff line change
@@ -1,25 +1,26 @@
![cover](img_cover_tetris_ts.png)
![cover](media/img_cover_tetris_ts.png)

This is a TypeScript open-source game which is a port of the ActionScript version, following the same concepts, graphics, and architecture.

+ **Category:** Puzzle.
+ **Platform:** Web.
+ **Language:** TypeScript.
+ **Technologies:** PixiJs, RobotlegsJs, RobotlegsJs-Pixi, Palidor.
+ **Technologies:** PixiJs, RobotlegsJS, RobotlegsJS-Pixi, RobotlegsJS-Pixi-Palidor.

* * *

### Gameplay

![gif_ts](gif_tetris_ts_demo.gif)
![gif_ts](media/gif_tetris_ts_demo.gif)

* * *

### Dependencies

+ [PixiJs](http://www.pixijs.com/)
+ [RobotlegsJs](https://github.com/GoodgameStudios/RobotlegsJS)
+ [Robotlegs-Pixi](https://github.com/GoodgameStudios/RobotlegsJS-Pixi)
+ [RobotlegsJs](https://github.com/RobotlegsJS/RobotlegsJS)
+ [Robotlegs-Pixi](https://github.com/RobotlegsJS/RobotlegsJS-Pixi)
+ [Robotlegs-Pixi-Palidor](https://github.com/RobotlegsJS/RobotlegsJS-Pixi-Palidor)

* * *

Expand All @@ -33,12 +34,12 @@ This is a TypeScript open-source game which is a port of the ActionScript versio

#### Game Flow

![screenshot01](img_ss_tetris_ts_01.png)
![screenshot01](media/img_ss_tetris_ts_01.png)

* * *

### Screenshots
![screenshot01](img_game_tetris_ts.png)
![screenshot01](media/img_game_tetris_ts.png)
* * *

**Ronaldo Santiago** - Game Developer [ [portfolio](https://ronaldosetzer.github.io/portfolio/) ]
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
40 changes: 21 additions & 19 deletions typescript-tetris/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,34 +6,36 @@
"author": "Ronaldo Santiago",
"license": "MIT",
"dependencies": {
"pixi.js": "4.3.5",
"reflect-metadata": "0.1.8",
"robotlegs": "^1.0.0-alpha.14",
"robotlegs-pixi": "^1.0.0-alpha.15",
"typescript": "^2.3.2"
"@robotlegsjs/core": "^0.0.4",
"@robotlegsjs/pixi": "^0.0.2",
"@robotlegsjs/pixi-palidor": "^0.0.2",
"pixi.js": "^4.5.4",
"reflect-metadata": "^0.1.10",
"typescript": "^2.4.2"
},
"devDependencies": {
"@types/pixi.js": "^4.1.1",
"@types/chai": "^3.4.35",
"@types/mocha": "^2.2.39",
"mocha": "^3.2.0",
"chai": "^3.5.0",
"ts-node": "^2.1.0",
"html-webpack-plugin": "^2.28.0",
"@types/chai": "^4.0.3",
"@types/mocha": "^2.2.41",
"@types/pixi.js": "^4.5.2",
"chai": "^4.1.1",
"html-webpack-plugin": "^2.30.1",
"http-server": "^0.10.0",
"ts-loader": "^2.0.3",
"tslint": "^5.2.0",
"mocha": "^3.5.0",
"ts-loader": "^2.3.2",
"ts-node": "^3.3.0",
"tslint": "^5.6.0",
"typescript-formatter": "^5.1.3",
"typings": "^2.1.1",
"webpack": "^2.5.0",
"webpack-dev-server": "^2.4.5"
"webpack": "^3.5.3",
"webpack-dev-server": "^2.7.1"
},
"scripts": {
"start": "webpack-dev-server --config ./webpack.setzer.config.js",
"test": "mocha test/**/*.test.ts --require ts-node/register || true"
"test": "mocha test/**/*.test.ts --require ts-node/register"
},
"keywords": [
"RobotlegsJs",
"RobotlegsJS",
"RobotlegsJS-Pixi",
"RobotlegsJS-Pixi-Palidor",
"TypeScript",
"PixiJs",
"Game"
Expand Down
8 changes: 4 additions & 4 deletions typescript-tetris/src/commands/CreateLevelCommand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,19 @@ import { GameModel } from "./../models/GameModel";
import { GameStatus } from "./../models/GameStatus";
import { TileGroupFactory } from "./../utils/TileGroupFactory";

import { ICommand, injectable, inject } from "robotlegs";
import { ICommand, injectable, inject } from "@robotlegsjs/core";

@injectable()
export class CreateLevelCommand implements ICommand {

@inject(GameModel)
public model: GameModel;
private model: GameModel;

@inject(GameService)
public gameService: GameService;
private gameService: GameService;

@inject(FlowService)
public flowService: FlowService;
private flowService: FlowService;

/*@inject(SharedObjectManager)
public sharedObjectManager: SharedObjectManager;*/
Expand Down
6 changes: 3 additions & 3 deletions typescript-tetris/src/commands/GameOverCommand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@ import { FlowService } from "./../services/FlowService";
import { GameModel } from "./../models/GameModel";
import { GameStatus } from "./../models/GameStatus";

import { inject, injectable, ICommand } from "robotlegs";
import { inject, injectable, ICommand } from "@robotlegsjs/core";

@injectable()
export class GameOverCommand implements ICommand {

@inject(GameModel)
public model: GameModel;
private model: GameModel;

@inject(FlowService)
public flowService: FlowService;
private flowService: FlowService;

/*@inject(SharedObjectManager)
public sharedObjectManager:SharedObjectManager;*/
Expand Down
6 changes: 3 additions & 3 deletions typescript-tetris/src/commands/GetNextPieceCommand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@ import { GameService } from "./../services/GameService";
import { GameModel } from "./../models/GameModel";
import { TileGroupFactory } from "./../utils/TileGroupFactory";

import { inject, injectable, ICommand } from "robotlegs";
import { inject, injectable, ICommand } from "@robotlegsjs/core";

@injectable()
export class GetNextPieceCommand implements ICommand {

@inject(GameModel)
public model: GameModel;
private model: GameModel;

@inject(GameService)
public gameService: GameService;
private gameService: GameService;

public execute(): void {
this.model.currentPiece = this.model.nextPiece;
Expand Down
8 changes: 4 additions & 4 deletions typescript-tetris/src/commands/IncreasePointsCommand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,19 @@ import { GameModel } from "./../models/GameModel";
import { GameService } from "./../services/GameService";
import { GameUtils } from "./../utils/GameUtils";

import { inject, injectable, ICommand } from "robotlegs";
import { inject, injectable, ICommand } from "@robotlegsjs/core";

@injectable()
export class IncreasePointsCommand implements ICommand {

@inject(GameModel)
public model: GameModel;
private model: GameModel;

@inject(GameEvent)
public event: GameEvent;
private event: GameEvent;

@inject(GameService)
public gameService: GameService;
private gameService: GameService;

public execute(): void {
this.model.score += GameUtils.getPointsByLines(this.event.lines);
Expand Down
6 changes: 3 additions & 3 deletions typescript-tetris/src/configs/GameConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,16 @@ import { GameManager } from "./../managers/GameManager";
import { GameModel } from "./../models/GameModel";
import { GameService } from "./../services/GameService";

import { IConfig, injectable, inject, IEventCommandMap, IContext } from "robotlegs";
import { IConfig, injectable, inject, IEventCommandMap, IContext } from "@robotlegsjs/core";

@injectable()
export class GameConfig implements IConfig {

@inject(IContext)
public context: IContext;
private context: IContext;

@inject(IEventCommandMap)
public commandMap: IEventCommandMap;
private commandMap: IEventCommandMap;

public configure(): void {
TilePool.init();
Expand Down
18 changes: 9 additions & 9 deletions typescript-tetris/src/configs/PalidorConfig.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

import { FlowEvent } from "./../events/FlowEvent";
import { FlowService } from "./../services/FlowService";

Expand All @@ -12,37 +11,38 @@ import { PausePopup } from "./../views/PausePopup";
import { ResetConfirmPopup } from "./../views/ResetConfirmPopup";
import { StartingPopup } from "./../views/StartingPopup";

import { IFlowManager } from "./../robotlegs/bender/extensions/palidorFlowManager/api/IFlowManager";
import { PixiContainer } from "./../robotlegs/bender/extensions/palidorFlowManager/impl/PixiContainer";

import { injectable, IConfig, inject, IContext } from "robotlegs";
import { IFlowManager } from "@robotlegsjs/pixi-palidor";
import { injectable, IConfig, inject, IContext, IEventDispatcher } from "@robotlegsjs/core";

@injectable()
export class PalidorConfig implements IConfig {

@inject(IContext)
public context: IContext;
private context: IContext;

@inject(IFlowManager)
public flowManager: IFlowManager;
private flowManager: IFlowManager;

@inject(IEventDispatcher)
private eventDispatcher: IEventDispatcher;

public configure(): void {
this.mapPalidor();
this.eventDispatcher.dispatchEvent(new FlowEvent(FlowEvent.SHOW_INTRO_VIEW));
}

private mapPalidor(): void {
this.context.injector.bind(FlowService).to(FlowService).inSingletonScope();

this.flowManager.map(FlowEvent.SHOW_GAME_VIEW).toView(GameView);
this.flowManager.map(FlowEvent.SHOW_HOME_VIEW).toView(HomeView);
this.flowManager.map(FlowEvent.SHOW_INTRO_VIEW).toView(IntroView);
this.flowManager.map(FlowEvent.SHOW_OPTIONS_VIEW).toView(OptionsView);

this.flowManager.map(FlowEvent.SHOW_GAME_OVER_POPUP).toFloatingView(GameOverPopup);
this.flowManager.map(FlowEvent.SHOW_INFO_POPUP).toFloatingView(InfoPopup);
this.flowManager.map(FlowEvent.SHOW_PAUSE_POPUP).toFloatingView(PausePopup);
this.flowManager.map(FlowEvent.SHOW_RESET_CONFIRM_POPUP).toFloatingView(ResetConfirmPopup);
this.flowManager.map(FlowEvent.SHOW_STARTING_POPUP).toFloatingView(StartingPopup);

this.flowManager.map(FlowEvent.CLOSE_POPUP).toRemoveLastFloatingView();
}
}
10 changes: 3 additions & 7 deletions typescript-tetris/src/configs/ViewsConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import { InfoPopupMediator } from "./../mediators/InfoPopupMediator";
import { IntroViewMediator } from "./../mediators/IntroViewMediator";
import { NextPieceComponentMediator } from "./../mediators/NextPieceComponentMediator";
import { OptionsViewMediator } from "./../mediators/OptionsViewMediator";
import { PixiContainerMediator } from "./../mediators/PixiContainerMediator";
import { PausePopupMediator } from "./../mediators/PausePopupMediator";
import { ResetConfirmPopupMediator } from "./../mediators/ResetConfirmPopupMediator";
import { StartingPopupMediator } from "./../mediators/StartingPopupMediator";
Expand All @@ -26,16 +25,14 @@ import { PausePopup } from "./../views/PausePopup";
import { ResetConfirmPopup } from "./../views/ResetConfirmPopup";
import { StartingPopup } from "./../views/StartingPopup";

import { PixiContainer } from "./../robotlegs/bender/extensions/palidorFlowManager/impl/PixiContainer";

import { IMediatorMap } from "robotlegs-pixi";
import { injectable, IConfig, inject } from "robotlegs";
import { IMediatorMap } from "@robotlegsjs/pixi";
import { injectable, IConfig, inject } from "@robotlegsjs/core";

@injectable()
export class ViewsConfig implements IConfig {

@inject(IMediatorMap)
public mediatorMap: IMediatorMap;
private mediatorMap: IMediatorMap;

public configure(): void {
this.mapMediators();
Expand All @@ -46,7 +43,6 @@ export class ViewsConfig implements IConfig {
this.mediatorMap.map(HomeView).toMediator(HomeViewMediator);
this.mediatorMap.map(IntroView).toMediator(IntroViewMediator);
this.mediatorMap.map(OptionsView).toMediator(OptionsViewMediator);
this.mediatorMap.map(PixiContainer).toMediator(PixiContainerMediator);

this.mediatorMap.map(GridComponent).toMediator(GridComponentMediator);
this.mediatorMap.map(HUDGameComponent).toMediator(HUDGameComponentMediator);
Expand Down
2 changes: 1 addition & 1 deletion typescript-tetris/src/events/FlowEvent.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Event } from "robotlegs";
import { Event } from "@robotlegsjs/core";

export class FlowEvent extends Event {

Expand Down
2 changes: 1 addition & 1 deletion typescript-tetris/src/events/GameEvent.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Event } from "robotlegs";
import { Event } from "@robotlegsjs/core";

export class GameEvent extends Event {

Expand Down
15 changes: 6 additions & 9 deletions typescript-tetris/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/// <reference path="../node_modules/robotlegs-pixi/definitions/pixi.d.ts" />
/// <reference path="../node_modules/@robotlegsjs/pixi/definitions/pixi.d.ts" />

import "reflect-metadata";
import PIXI = require("pixi.js");
Expand All @@ -7,11 +7,9 @@ import { GameConfig } from "./configs/GameConfig";
import { PalidorConfig } from "./configs/PalidorConfig";
import { ViewsConfig } from "./configs/ViewsConfig";

import { PixiContainer } from "./robotlegs/bender/extensions/palidorFlowManager/impl/PixiContainer";
import { PalidorFlowManagerExtension } from "./robotlegs/bender/extensions/palidorFlowManager/PalidorFlowManagerExtension";

import { Context, MVCSBundle, LogLevel } from "robotlegs";
import { PixiBundle, ContextView } from "robotlegs-pixi";
import { Context, MVCSBundle, LogLevel } from "@robotlegsjs/core";
import { PixiBundle, ContextView } from "@robotlegsjs/pixi";
import { PalidorPixiExtension, PixiRootContainer } from "@robotlegsjs/pixi-palidor";

class Main {
private stage: PIXI.Container;
Expand All @@ -24,13 +22,12 @@ class Main {
this.context = new Context();
// this.context.logLevel = LogLevel.DEBUG;
this.context.install(MVCSBundle, PixiBundle)
.install(PalidorPixiExtension)
.configure(new ContextView((<any>this.renderer).plugins.interaction))
.configure(new PixiRootContainer(this.stage))
.configure(ViewsConfig, GameConfig, PalidorConfig)
.install(PalidorFlowManagerExtension)
.initialize();

this.stage.addChild(new PixiContainer());

document.body.appendChild(this.renderer.view);
}

Expand Down
Loading

0 comments on commit 6ba6ce3

Please sign in to comment.