mirror of
https://github.com/FullScreenShenanigans/MenuGraphr.git
synced 2026-08-12 02:18:35 -07:00
(v0.7.0) Used shenanigans-manager@0.2 instead of Gulp
This commit is contained in:
+2
-2
@@ -1,8 +1,8 @@
|
|||||||
language: node_js
|
language: node_js
|
||||||
|
|
||||||
node_js:
|
node_js:
|
||||||
- "7"
|
- "node"
|
||||||
- "5"
|
- "5"
|
||||||
|
|
||||||
script:
|
script:
|
||||||
node_modules/gulp/bin/gulp.js
|
npm run verify
|
||||||
|
|||||||
Vendored
+7
@@ -0,0 +1,7 @@
|
|||||||
|
{
|
||||||
|
"editor.tabSize": 4,
|
||||||
|
"editor.trimAutoWhitespace": true,
|
||||||
|
"tslint.alwaysShowRuleFailuresAsWarnings": true,
|
||||||
|
"tslint.autoFixOnSave": true,
|
||||||
|
"typescript.tsdk": "node_modules\\typescript\\lib"
|
||||||
|
}
|
||||||
@@ -1 +0,0 @@
|
|||||||
require("gulp-shenanigans").initialize(require("gulp"));
|
|
||||||
Generated
+456
-8428
File diff suppressed because it is too large
Load Diff
+68
-55
@@ -1,56 +1,69 @@
|
|||||||
{
|
{
|
||||||
"name": "menugraphr",
|
"author": {
|
||||||
"description": "In-game menu and dialog creation and management for GameStartr.",
|
"email": "joshuakgoldberg@outlook.com",
|
||||||
"version": "0.6.4",
|
"name": "Josh Goldberg"
|
||||||
"author": {
|
},
|
||||||
"name": "Josh Goldberg",
|
"browser": "./src/index.js",
|
||||||
"email": "joshuakgoldberg@outlook.com"
|
"bugs": {
|
||||||
},
|
"url": "https://github.com/FullScreenShenanigans/MenuGraphr/issues"
|
||||||
"repository": {
|
},
|
||||||
"type": "git",
|
"dependencies": {
|
||||||
"url": "ssh://git@github.com:FullScreenShenanigans/MenuGraphr.git"
|
"gamestartr": "^0.7.0"
|
||||||
},
|
},
|
||||||
"bugs": {
|
"description": "In-game menu and dialog creation and management for GameStartr.",
|
||||||
"url": "https://github.com/FullScreenShenanigans/MenuGraphr/issues"
|
"devDependencies": {
|
||||||
},
|
"@types/chai": "^4.0.4",
|
||||||
"license": "MIT",
|
"@types/lolex": "^1.5.32",
|
||||||
"dependencies": {
|
"@types/mocha": "^2.2.44",
|
||||||
"areaspawnr": "0.6.X",
|
"@types/sinon": "^4.0.0",
|
||||||
"audioplayr": "0.6.X",
|
"@types/sinon-chai": "^2.7.29",
|
||||||
"changelinr": "0.6.X",
|
"chai": "^4.1.2",
|
||||||
"devicelayr": "0.6.X",
|
"glob": "^7.1.2",
|
||||||
"eightbittr": "0.6.X",
|
"lolex": "^2.3.0",
|
||||||
"fpsanalyzr": "0.6.X",
|
"mocha": "^4.0.1",
|
||||||
"gamesrunnr": "0.6.X",
|
"mocha-headless-chrome": "^1.7.1",
|
||||||
"gamestartr": "0.6.X",
|
"requirejs": "^2.3.5",
|
||||||
"groupholdr": "0.6.X",
|
"run-for-every-file": "^1.1.0",
|
||||||
"inputwritr": "0.6.X",
|
"shenanigans-manager": "^0.2.0",
|
||||||
"itemsholdr": "0.6.X",
|
"sinon": "^4.1.2",
|
||||||
"mapscreatr": "0.6.X",
|
"sinon-chai": "^2.14.0",
|
||||||
"mapscreenr": "0.6.X",
|
"tslint": "5.8.0",
|
||||||
"mathdecidr": "0.6.X",
|
"typedoc": "^0.9.0",
|
||||||
"modattachr": "0.6.X",
|
"typescript": "^2.6.2",
|
||||||
"numbermakr": "0.6.X",
|
"webpack": "^3.10.0"
|
||||||
"objectmakr": "0.6.X",
|
},
|
||||||
"pixeldrawr": "0.6.X",
|
"license": "MIT",
|
||||||
"pixelrendr": "0.6.X",
|
"name": "menugraphr",
|
||||||
"quadskeepr": "0.6.X",
|
"repository": {
|
||||||
"sceneplayr": "0.6.X",
|
"type": "git",
|
||||||
"stringfilr": "0.6.X",
|
"url": "ssh://git@github.com:FullScreenShenanigans/MenuGraphr.git"
|
||||||
"thinghittr": "0.6.X",
|
},
|
||||||
"timehandlr": "0.6.X",
|
"scripts": {
|
||||||
"touchpassr": "0.6.X",
|
"dist": "npm run dist:webpack",
|
||||||
"worldseedr": "0.6.X"
|
"dist:webpack": "webpack --config webpack.config.js",
|
||||||
},
|
"docs": "npm run docs:typedoc",
|
||||||
"devDependencies": {
|
"docs:typedoc": "typedoc src/ --out docs/generated",
|
||||||
"gulp": "^3.9.1",
|
"init": "npm install && npm run setup && npm run verify",
|
||||||
"gulp-shenanigans": "^0.6.17"
|
"setup": "npm run setup:copy && npm run setup:package",
|
||||||
},
|
"setup:copy": "npm run setup:copy:default",
|
||||||
"scripts": {
|
"setup:copy:default": "run-for-every-file --dot --src \"node_modules/shenanigans-manager/setup/default/\" --file \"**/*\" --run \"mustache package.json {{src-file}} {{file}}\" --dest \".\" --only-files",
|
||||||
"gulp": "gulp",
|
"setup:package": "shenanigans-manager hydrate-package-json",
|
||||||
"test": "gulp test"
|
"src": "npm run src:tsc && npm run src:tslint",
|
||||||
},
|
"src:tsc": "tsc -p .",
|
||||||
"shenanigans": {
|
"src:tslint": "tslint -c tslint.json --exclude ./node_modules/**/*.ts* -p tsconfig.json -t stylish",
|
||||||
"name": "MenuGraphr"
|
"test": "npm run test:setup && npm run test:run",
|
||||||
}
|
"test:run": "mocha-headless-chrome --file test/index.html",
|
||||||
}
|
"test:setup": "npm run test:setup:copy && npm run test:setup:html && npm run test:setup:tsc",
|
||||||
|
"test:setup:copy": "npm run test:setup:copy:default",
|
||||||
|
"test:setup:copy:default": "run-for-every-file --dot --src \"node_modules/shenanigans-manager/setup/test/\" --file \"**/*\" --run \"mustache package.json {{src-file}} ./test/{{file}}\" --dest \".\" --only-files",
|
||||||
|
"test:setup:html": "shenanigans-manager generate-test-html",
|
||||||
|
"test:setup:tsc": "tsc -p test",
|
||||||
|
"verify": "npm run src && npm run test && npm run dist && npm run docs",
|
||||||
|
"watch": "run-p \"tsc -p . -w\" \"echo sup\""
|
||||||
|
},
|
||||||
|
"shenanigans": {
|
||||||
|
"name": "MenuGraphr"
|
||||||
|
},
|
||||||
|
"types": "./src/index.d.ts",
|
||||||
|
"version": "0.7.0"
|
||||||
|
}
|
||||||
+14
-19
@@ -1,5 +1,4 @@
|
|||||||
import { GameStartr } from "gamestartr/lib/GameStartr";
|
import { GameStartr, IThing } from "gamestartr";
|
||||||
import { IThing } from "gamestartr/lib/IGameStartr";
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* General attributes for both Menus and MenuSchemas.
|
* General attributes for both Menus and MenuSchemas.
|
||||||
@@ -13,7 +12,7 @@ export interface IMenuBase {
|
|||||||
/**
|
/**
|
||||||
* A callback for when this menu is set as active.
|
* A callback for when this menu is set as active.
|
||||||
*/
|
*/
|
||||||
callback?: (...args: any[]) => void;
|
callback?(...args: any[]): void;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Schemas of children to add on creation.
|
* Schemas of children to add on creation.
|
||||||
@@ -74,42 +73,42 @@ export interface IMenuBase {
|
|||||||
/**
|
/**
|
||||||
* A callback for when this becomes active.
|
* A callback for when this becomes active.
|
||||||
*/
|
*/
|
||||||
onActive?: (name: string) => void;
|
onActive?(name: string): void;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A callback for when this is deselected.
|
* A callback for when this is deselected.
|
||||||
*/
|
*/
|
||||||
onBPress?: (name: string) => void;
|
onBPress?(name: string): void;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A callback for a user event directing down.
|
* A callback for a user event directing down.
|
||||||
*/
|
*/
|
||||||
onDown?: (GameStartr: GameStartr) => void;
|
onDown?(gameStarter: GameStartr): void;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A callback for when this becomes inactive.
|
* A callback for when this becomes inactive.
|
||||||
*/
|
*/
|
||||||
onInactive?: (name: string) => void;
|
onInactive?(name: string): void;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A callback for a user event directing to the left.
|
* A callback for a user event directing to the left.
|
||||||
*/
|
*/
|
||||||
onLeft?: (GameStartr: GameStartr) => void;
|
onLeft?(gameStarter: GameStartr): void;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A callback for when this is deleted.
|
* A callback for when this is deleted.
|
||||||
*/
|
*/
|
||||||
onMenuDelete?: (GameStartr: GameStartr) => void;
|
onMenuDelete?(gameStarter: GameStartr): void;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A callback for a user event directing to the right.
|
* A callback for a user event directing to the right.
|
||||||
*/
|
*/
|
||||||
onRight?: (GameStartr: GameStartr) => void;
|
onRight?(gameStarter: GameStartr): void;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A callback for a user event directing up.
|
* A callback for a user event directing up.
|
||||||
*/
|
*/
|
||||||
onUp?: (GameStartr: GameStartr) => void;
|
onUp?(gameStarter: GameStartr): void;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A sizing description for this, including width and height.
|
* A sizing description for this, including width and height.
|
||||||
@@ -211,7 +210,7 @@ export interface IMenuProgress {
|
|||||||
/**
|
/**
|
||||||
* A callback for when the dialog completes.
|
* A callback for when the dialog completes.
|
||||||
*/
|
*/
|
||||||
onCompletion?: (...args: any[]) => void;
|
onCompletion?(...args: any[]): void;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Whether the dialog is currently being added to the menu.
|
* Whether the dialog is currently being added to the menu.
|
||||||
@@ -602,7 +601,7 @@ export interface IGridCell {
|
|||||||
/**
|
/**
|
||||||
* A callback for selecting this cell with a user selection event.
|
* A callback for selecting this cell with a user selection event.
|
||||||
*/
|
*/
|
||||||
callback?: (...args: any[]) => void;
|
callback?(...args: any[]): void;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The column containing this option.
|
* The column containing this option.
|
||||||
@@ -672,9 +671,7 @@ export interface IListMenuOptions {
|
|||||||
/**
|
/**
|
||||||
* Options within the menu, or a Function to generate them.
|
* Options within the menu, or a Function to generate them.
|
||||||
*/
|
*/
|
||||||
options: any[] | {
|
options: any[] | (() => any[]);
|
||||||
(): any[];
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A default starting selected index.
|
* A default starting selected index.
|
||||||
@@ -735,9 +732,7 @@ export interface IReplacements {
|
|||||||
/**
|
/**
|
||||||
* A Function to generate a word replacement based on the GameStarter's state.
|
* A Function to generate a word replacement based on the GameStarter's state.
|
||||||
*/
|
*/
|
||||||
export interface IReplacerFunction {
|
export type IReplacerFunction = (gameStarter: GameStartr) => string[];
|
||||||
(gameStarter: GameStartr): string[];
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Settings to initialize a new IMenuGraphr.
|
* Settings to initialize a new IMenuGraphr.
|
||||||
|
|||||||
+34
-48
@@ -1,5 +1,4 @@
|
|||||||
import { GameStartr } from "gamestartr/lib/GameStartr";
|
import { GameStartr, IThing } from "gamestartr";
|
||||||
import { IThing } from "gamestartr/lib/IGameStartr";
|
|
||||||
|
|
||||||
import {
|
import {
|
||||||
IAliases, IGridCell, IListMenu, IListMenuOptions, IListMenuProgress,
|
IAliases, IGridCell, IListMenu, IListMenuOptions, IListMenuProgress,
|
||||||
@@ -8,7 +7,7 @@ import {
|
|||||||
IMenuSchemaPositionOffset, IMenuSchemas, IMenuSchemaSize,
|
IMenuSchemaPositionOffset, IMenuSchemas, IMenuSchemaSize,
|
||||||
IMenusContainer, IMenuThingSchema, IMenuWordCommand, IMenuWordCommandBase,
|
IMenusContainer, IMenuThingSchema, IMenuWordCommand, IMenuWordCommandBase,
|
||||||
IMenuWordPadLeftCommand, IMenuWordPosition, IMenuWordSchema, IReplacements,
|
IMenuWordPadLeftCommand, IMenuWordPosition, IMenuWordSchema, IReplacements,
|
||||||
IReplacerFunction, ISoundNames, IText
|
IReplacerFunction, ISoundNames, IText,
|
||||||
} from "./IMenuGraphr";
|
} from "./IMenuGraphr";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -18,7 +17,7 @@ export enum Direction {
|
|||||||
Top = 0,
|
Top = 0,
|
||||||
Right = 1,
|
Right = 1,
|
||||||
Bottom = 2,
|
Bottom = 2,
|
||||||
Left = 3
|
Left = 3,
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -56,11 +55,6 @@ export class MenuGraphr implements IMenuGraphr {
|
|||||||
*/
|
*/
|
||||||
private readonly replacements: IReplacements;
|
private readonly replacements: IReplacements;
|
||||||
|
|
||||||
/**
|
|
||||||
* Separator for words to replace using replacements.
|
|
||||||
*/
|
|
||||||
private readonly replacerKey: string;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The currently "active" (user-selected) menu.
|
* The currently "active" (user-selected) menu.
|
||||||
*/
|
*/
|
||||||
@@ -84,7 +78,6 @@ export class MenuGraphr implements IMenuGraphr {
|
|||||||
this.schemas = settings.schemas || {};
|
this.schemas = settings.schemas || {};
|
||||||
this.aliases = settings.aliases || {};
|
this.aliases = settings.aliases || {};
|
||||||
this.replacements = settings.replacements || {};
|
this.replacements = settings.replacements || {};
|
||||||
this.replacerKey = settings.replacerKey || "%%%%%%%";
|
|
||||||
this.sounds = settings.sounds || {};
|
this.sounds = settings.sounds || {};
|
||||||
|
|
||||||
this.menus = {};
|
this.menus = {};
|
||||||
@@ -175,7 +168,7 @@ export class MenuGraphr implements IMenuGraphr {
|
|||||||
left: 0,
|
left: 0,
|
||||||
width: this.gameStarter.mapScreener.width,
|
width: this.gameStarter.mapScreener.width,
|
||||||
height: this.gameStarter.mapScreener.height,
|
height: this.gameStarter.mapScreener.height,
|
||||||
children: []
|
children: [],
|
||||||
} as any;
|
} as any;
|
||||||
|
|
||||||
this.deleteMenu(name);
|
this.deleteMenu(name);
|
||||||
@@ -221,7 +214,7 @@ export class MenuGraphr implements IMenuGraphr {
|
|||||||
return this.createMenuThing(name, schema as IMenuThingSchema);
|
return this.createMenuThing(name, schema as IMenuThingSchema);
|
||||||
|
|
||||||
default:
|
default:
|
||||||
throw new Error("Unknown schema type: " + schema.type);
|
throw new Error(`Unknown schema type: '${schema.type}'.`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -327,7 +320,7 @@ export class MenuGraphr implements IMenuGraphr {
|
|||||||
*/
|
*/
|
||||||
public addMenuDialog(name: string, dialog: IMenuDialogRaw, onCompletion?: () => any): void {
|
public addMenuDialog(name: string, dialog: IMenuDialogRaw, onCompletion?: () => any): void {
|
||||||
const dialogParsed: (string[] | IMenuWordCommand)[][] = this.parseRawDialog(dialog);
|
const dialogParsed: (string[] | IMenuWordCommand)[][] = this.parseRawDialog(dialog);
|
||||||
let currentLine: number = 1;
|
let currentLine = 1;
|
||||||
|
|
||||||
const callback: () => void = (): void => {
|
const callback: () => void = (): void => {
|
||||||
// If all dialog has been exhausted, delete the menu and finish
|
// If all dialog has been exhausted, delete the menu and finish
|
||||||
@@ -344,7 +337,7 @@ export class MenuGraphr implements IMenuGraphr {
|
|||||||
currentLine += 1;
|
currentLine += 1;
|
||||||
|
|
||||||
// Delete any previous texts. This is only done if continuing
|
// Delete any previous texts. This is only done if continuing
|
||||||
// so that when the dialog is finished, the last text remains
|
// So that when the dialog is finished, the last text remains
|
||||||
this.deleteMenuChildren(name);
|
this.deleteMenuChildren(name);
|
||||||
|
|
||||||
// This continues the dialog with the next iteration (word)
|
// This continues the dialog with the next iteration (word)
|
||||||
@@ -352,8 +345,8 @@ export class MenuGraphr implements IMenuGraphr {
|
|||||||
};
|
};
|
||||||
|
|
||||||
// This first call to addMenuText shouldn't be the callback, because if
|
// This first call to addMenuText shouldn't be the callback, because if
|
||||||
// being called from a childrenSchema of type "text", it shouldn't delete
|
// Being called from a childrenSchema of type "text", it shouldn't delete
|
||||||
// any other menu children from childrenSchemas.
|
// Any other menu children from childrenSchemas.
|
||||||
this.addMenuText(name, dialogParsed[0], callback);
|
this.addMenuText(name, dialogParsed[0], callback);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -418,7 +411,7 @@ export class MenuGraphr implements IMenuGraphr {
|
|||||||
const textPaddingY: number = menu.textPaddingY || textProperties.paddingY;
|
const textPaddingY: number = menu.textPaddingY || textProperties.paddingY;
|
||||||
const selectedIndex: [number, number] = settings.selectedIndex || [0, 0];
|
const selectedIndex: [number, number] = settings.selectedIndex || [0, 0];
|
||||||
const optionChildren: any[] = [];
|
const optionChildren: any[] = [];
|
||||||
let index: number = 0;
|
let index = 0;
|
||||||
let y: number = top;
|
let y: number = top;
|
||||||
let option: any;
|
let option: any;
|
||||||
let optionChild: any;
|
let optionChild: any;
|
||||||
@@ -450,8 +443,8 @@ export class MenuGraphr implements IMenuGraphr {
|
|||||||
x = left;
|
x = left;
|
||||||
option = options[i];
|
option = options[i];
|
||||||
optionChild = {
|
optionChild = {
|
||||||
"option": option,
|
option,
|
||||||
"things": []
|
things: [],
|
||||||
};
|
};
|
||||||
|
|
||||||
optionChildren.push(optionChild);
|
optionChildren.push(optionChild);
|
||||||
@@ -502,7 +495,7 @@ export class MenuGraphr implements IMenuGraphr {
|
|||||||
y += schema[j][k].y;
|
y += schema[j][k].y;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
option.title = title = "Char" + this.getCharacterEquivalent(schema[j][k]);
|
option.title = title = `Char${this.getCharacterEquivalent(schema[j][k])}`;
|
||||||
character = this.gameStarter.objectMaker.make<IText>(title);
|
character = this.gameStarter.objectMaker.make<IText>(title);
|
||||||
menu.children.push(character);
|
menu.children.push(character);
|
||||||
optionChild.things.push(character);
|
optionChild.things.push(character);
|
||||||
@@ -535,8 +528,8 @@ export class MenuGraphr implements IMenuGraphr {
|
|||||||
option.schema = schema = this.filterText(option.text);
|
option.schema = schema = this.filterText(option.text);
|
||||||
|
|
||||||
optionChild = {
|
optionChild = {
|
||||||
"option": option,
|
option,
|
||||||
"things": []
|
things: [],
|
||||||
};
|
};
|
||||||
optionChildren.push(optionChild);
|
optionChildren.push(optionChild);
|
||||||
|
|
||||||
@@ -599,7 +592,7 @@ export class MenuGraphr implements IMenuGraphr {
|
|||||||
} else {
|
} else {
|
||||||
menu.selectedIndex = selectedIndex;
|
menu.selectedIndex = selectedIndex;
|
||||||
this.gameStarter.itemsHolder.addItem(name, {
|
this.gameStarter.itemsHolder.addItem(name, {
|
||||||
"value": selectedIndex
|
value: selectedIndex,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -729,13 +722,17 @@ export class MenuGraphr implements IMenuGraphr {
|
|||||||
public registerDirection(direction: number): void {
|
public registerDirection(direction: number): void {
|
||||||
switch (direction) {
|
switch (direction) {
|
||||||
case Direction.Top:
|
case Direction.Top:
|
||||||
return this.registerUp();
|
this.registerUp();
|
||||||
|
break;
|
||||||
case Direction.Right:
|
case Direction.Right:
|
||||||
return this.registerRight();
|
this.registerRight();
|
||||||
|
break;
|
||||||
case Direction.Bottom:
|
case Direction.Bottom:
|
||||||
return this.registerDown();
|
this.registerDown();
|
||||||
|
break;
|
||||||
case Direction.Left:
|
case Direction.Left:
|
||||||
return this.registerLeft();
|
this.registerLeft();
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
throw new Error("Unknown direction: " + direction);
|
throw new Error("Unknown direction: " + direction);
|
||||||
}
|
}
|
||||||
@@ -1090,7 +1087,6 @@ export class MenuGraphr implements IMenuGraphr {
|
|||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
this.gameStarter.physics.setLeft(thing, menu.left);
|
this.gameStarter.physics.setLeft(thing, menu.left);
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (position.vertical) {
|
switch (position.vertical) {
|
||||||
@@ -1102,7 +1098,6 @@ export class MenuGraphr implements IMenuGraphr {
|
|||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
this.gameStarter.physics.setTop(thing, menu.top);
|
this.gameStarter.physics.setTop(thing, menu.top);
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (offset.top) {
|
if (offset.top) {
|
||||||
@@ -1134,7 +1129,7 @@ export class MenuGraphr implements IMenuGraphr {
|
|||||||
const textPaddingY: number = menu.textPaddingY || textProperties.paddingY;
|
const textPaddingY: number = menu.textPaddingY || textProperties.paddingY;
|
||||||
const title: string = "Char" + this.getCharacterEquivalent(character);
|
const title: string = "Char" + this.getCharacterEquivalent(character);
|
||||||
const thing: IText = this.gameStarter.objectMaker.make<IText>(title, {
|
const thing: IText = this.gameStarter.objectMaker.make<IText>(title, {
|
||||||
textPaddingY: textPaddingY
|
textPaddingY,
|
||||||
});
|
});
|
||||||
|
|
||||||
menu.children.push(thing);
|
menu.children.push(thing);
|
||||||
@@ -1283,7 +1278,7 @@ export class MenuGraphr implements IMenuGraphr {
|
|||||||
private computeMenuScrollingItems(menu: IListMenu): number {
|
private computeMenuScrollingItems(menu: IListMenu): number {
|
||||||
const bottom: number = menu.bottom - (menu.textPaddingY || 0) - (menu.textYOffset || 0);
|
const bottom: number = menu.bottom - (menu.textPaddingY || 0) - (menu.textYOffset || 0);
|
||||||
|
|
||||||
for (let i: number = 0; i < menu.gridRows; i += 1) {
|
for (let i = 0; i < menu.gridRows; i += 1) {
|
||||||
if (menu.grid[0][i].y >= bottom) {
|
if (menu.grid[0][i].y >= bottom) {
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
@@ -1326,14 +1321,9 @@ export class MenuGraphr implements IMenuGraphr {
|
|||||||
|
|
||||||
for (j = 0; j < optionChild.things.length; j += 1) {
|
for (j = 0; j < optionChild.things.length; j += 1) {
|
||||||
this.gameStarter.physics.shiftVert(optionChild.things[j], offset);
|
this.gameStarter.physics.shiftVert(optionChild.things[j], offset);
|
||||||
if (
|
optionChild.things[j].hidden = !!(
|
||||||
i < menu.scrollingVisualOffset
|
i < menu.scrollingVisualOffset
|
||||||
|| i >= (menu.scrollingItems || 1) + menu.scrollingVisualOffset
|
|| i >= (menu.scrollingItems || 1) + menu.scrollingVisualOffset);
|
||||||
) {
|
|
||||||
optionChild.things[j].hidden = true;
|
|
||||||
} else {
|
|
||||||
optionChild.things[j].hidden = false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1382,7 +1372,7 @@ export class MenuGraphr implements IMenuGraphr {
|
|||||||
const characters: string[] = this.filterWord(dialogRaw);
|
const characters: string[] = this.filterWord(dialogRaw);
|
||||||
const words: string[][] = [];
|
const words: string[][] = [];
|
||||||
let word: string[] = [];
|
let word: string[] = [];
|
||||||
let currentlyWhitespace: boolean = false;
|
let currentlyWhitespace = false;
|
||||||
|
|
||||||
// For each character to be added...
|
// For each character to be added...
|
||||||
for (const character of characters) {
|
for (const character of characters) {
|
||||||
@@ -1502,7 +1492,7 @@ export class MenuGraphr implements IMenuGraphr {
|
|||||||
|
|
||||||
const characters: string[] = [];
|
const characters: string[] = [];
|
||||||
const total: string = textRaw as string;
|
const total: string = textRaw as string;
|
||||||
let component: string = "";
|
let component = "";
|
||||||
let i: number;
|
let i: number;
|
||||||
|
|
||||||
for (i = 0; i < total.length; i += 1) {
|
for (i = 0; i < total.length; i += 1) {
|
||||||
@@ -1642,14 +1632,10 @@ export class MenuGraphr implements IMenuGraphr {
|
|||||||
* used in dialogs that react to box size. This may be wrong.
|
* used in dialogs that react to box size. This may be wrong.
|
||||||
*/
|
*/
|
||||||
private computeFutureWordLength(wordRaw: string[] | IMenuWordCommand, textWidth: number, textPaddingX: number): number {
|
private computeFutureWordLength(wordRaw: string[] | IMenuWordCommand, textWidth: number, textPaddingX: number): number {
|
||||||
let total: number = 0;
|
let total = 0;
|
||||||
let word: string[];
|
const word: string[] = wordRaw.constructor === Array
|
||||||
|
? wordRaw as string[]
|
||||||
if (wordRaw.constructor === Array) {
|
: this.parseWordCommand(wordRaw as IMenuWordCommand);
|
||||||
word = wordRaw as string[];
|
|
||||||
} else {
|
|
||||||
word = this.parseWordCommand(wordRaw as IMenuWordCommand);
|
|
||||||
}
|
|
||||||
|
|
||||||
for (const character of word) {
|
for (const character of word) {
|
||||||
if (/\s/.test(character)) {
|
if (/\s/.test(character)) {
|
||||||
|
|||||||
@@ -0,0 +1,2 @@
|
|||||||
|
export * from "./IMenuGraphr";
|
||||||
|
export * from "./MenuGraphr";
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
import { mochaLoader } from "../main";
|
|
||||||
|
|
||||||
mochaLoader.it("_", (): void => { });
|
|
||||||
+2
-17
@@ -1,19 +1,4 @@
|
|||||||
{
|
{
|
||||||
"compilerOptions": {
|
"extends": "../tsconfig.json",
|
||||||
"declaration": true,
|
"include": ["*.ts"]
|
||||||
"lib": ["dom", "es2015.collection", "es2015.promise", "es5"],
|
|
||||||
"module": "amd",
|
|
||||||
"moduleResolution": "node",
|
|
||||||
"noFallthroughCasesInSwitch": true,
|
|
||||||
"noImplicitAny": true,
|
|
||||||
"noImplicitReturns": true,
|
|
||||||
"noImplicitThis": true,
|
|
||||||
"noUnusedLocals": true,
|
|
||||||
"noUnusedParameters": true,
|
|
||||||
"strictNullChecks": true,
|
|
||||||
"target": "es5"
|
|
||||||
},
|
|
||||||
"include": [
|
|
||||||
"./**/*.ts"
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
|
|||||||
+9
-3
@@ -1,6 +1,8 @@
|
|||||||
{
|
{
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"declaration": true,
|
"declaration": true,
|
||||||
|
"experimentalDecorators": true,
|
||||||
|
"jsx": "react",
|
||||||
"lib": ["dom", "es2015.collection", "es2015.promise", "es5"],
|
"lib": ["dom", "es2015.collection", "es2015.promise", "es5"],
|
||||||
"module": "amd",
|
"module": "amd",
|
||||||
"moduleResolution": "node",
|
"moduleResolution": "node",
|
||||||
@@ -8,12 +10,16 @@
|
|||||||
"noImplicitReturns": true,
|
"noImplicitReturns": true,
|
||||||
"noImplicitThis": true,
|
"noImplicitThis": true,
|
||||||
"noFallthroughCasesInSwitch": true,
|
"noFallthroughCasesInSwitch": true,
|
||||||
"noUnusedLocals": true,
|
"pretty": true,
|
||||||
"noUnusedParameters": true,
|
|
||||||
"strictNullChecks": true,
|
"strictNullChecks": true,
|
||||||
"target": "es5"
|
"target": "es5"
|
||||||
},
|
},
|
||||||
|
"exclude": [
|
||||||
|
"dist",
|
||||||
|
"node_modules"
|
||||||
|
],
|
||||||
"include": [
|
"include": [
|
||||||
"./src/**/*.ts"
|
"./src/**/*.ts",
|
||||||
|
"./src/**/*.tsx"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
+15
-52
@@ -1,56 +1,19 @@
|
|||||||
{
|
{
|
||||||
"extends": "tslint:all",
|
"extends": "./node_modules/shenanigans-manager/setup/tslint.json",
|
||||||
"rules": {
|
"rules": {
|
||||||
"array-type": [false],
|
"completed-docs": false,
|
||||||
"arrow-return-shorthand": [false],
|
"cyclomatic-complexity": false,
|
||||||
"ban-types": [false],
|
"max-file-line-count": false,
|
||||||
"callable-types": [false],
|
"no-any": false,
|
||||||
"comment-format": [false],
|
"no-bitwise": false,
|
||||||
"completed-docs": [false],
|
"no-non-null-assertion": false,
|
||||||
"cyclomatic-complexity": [false],
|
"no-unbound-method": false,
|
||||||
"forin": [false],
|
"no-unsafe-any": false,
|
||||||
"linebreak-style": [false],
|
"no-void-expression": false,
|
||||||
"max-file-line-count": [false],
|
"prefer-function-over-method": false,
|
||||||
"max-line-length": [true, 140],
|
"prefer-template": false,
|
||||||
"member-ordering": [
|
"restrict-plus-operands": false,
|
||||||
true,
|
"strict-boolean-expressions": false,
|
||||||
"public-before-private",
|
"strict-type-predicates": false
|
||||||
"static-before-instance",
|
|
||||||
"variables-before-functions"
|
|
||||||
],
|
|
||||||
"newline-before-return": [false],
|
|
||||||
"no-any": [false],
|
|
||||||
"no-bitwise": [false],
|
|
||||||
"no-console": [false],
|
|
||||||
"no-default-export": [false],
|
|
||||||
"no-inferrable-types": [false],
|
|
||||||
"no-magic-numbers": [false],
|
|
||||||
"no-redundant-jsdoc": [false],
|
|
||||||
"no-non-null-assertion": [false],
|
|
||||||
"no-object-literal-type-assertion": [false],
|
|
||||||
"no-submodule-imports": [false],
|
|
||||||
"no-require-imports": false,
|
|
||||||
"no-unbound-method": [false],
|
|
||||||
"no-unsafe-any": [false],
|
|
||||||
"no-unused-variable": [false],
|
|
||||||
"no-void-expression": [false],
|
|
||||||
"number-literal-format": [false],
|
|
||||||
"object-literal-key-quotes": [false],
|
|
||||||
"object-literal-shorthand": [false],
|
|
||||||
"object-literal-sort-keys": [false],
|
|
||||||
"only-arrow-functions": [false],
|
|
||||||
"prefer-function-over-method": [false],
|
|
||||||
"prefer-method-signature": [false],
|
|
||||||
"prefer-switch": [false],
|
|
||||||
"prefer-conditional-expression": [false],
|
|
||||||
"prefer-template": [false],
|
|
||||||
"restrict-plus-operands": [false],
|
|
||||||
"space-before-function-paren": [false],
|
|
||||||
"strict-boolean-expressions": [false],
|
|
||||||
"strict-type-predicates": [false],
|
|
||||||
"switch-final-break": [false],
|
|
||||||
"trailing-comma": [false],
|
|
||||||
"typedef": [false],
|
|
||||||
"variable-name": [false]
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user