format code

This commit is contained in:
yushijinhun 2018-02-09 12:29:42 +08:00
parent 000f29aec8
commit 42959b63d7
No known key found for this signature in database
GPG Key ID: 5BC167F73EA558E4
5 changed files with 95 additions and 83 deletions

View File

@ -1,9 +1,21 @@
{
"defaultSeverity": "error",
"extends": [
"tslint:recommended"
"tslint:latest"
],
"jsRules": {},
"rules": {},
"rules": {
"indent": [
true,
"tabs"
],
"eofline": true,
"linebreak-style": [
true,
"LF"
],
"max-classes-per-file": false,
"interface-name": false
},
"rulesDirectory": []
}

38
types/animation.d.ts vendored
View File

@ -1,37 +1,37 @@
import { PlayerObject } from './model'
import { PlayerObject } from "./model";
type AnimationFn = (player: PlayerObject, time: number) => void
type AnimationFn = (player: PlayerObject, time: number) => void;
interface IAnimation {
play(player: PlayerObject, time: number): void
play(player: PlayerObject, time: number): void;
}
export type Animation = AnimationFn | IAnimation
export type Animation = AnimationFn | IAnimation;
declare function invokeAnimation(
animation: Animation,
player: PlayerObject,
time: number
): void
animation: Animation,
player: PlayerObject,
time: number,
): void;
declare class AnimationHandle implements IAnimation {
readonly animation: Animation
paused: boolean
speed: number
readonly animation: Animation;
paused: boolean;
speed: number;
constructor(animation: Animation)
constructor(animation: Animation);
play(player: PlayerObject, time: number): void
play(player: PlayerObject, time: number): void;
reset(): void
reset(): void;
}
export class CompositeAnimation implements IAnimation {
private handles: Set<AnimationHandle>
private handles: Set<AnimationHandle>;
constructor()
constructor();
add(animation: Animation): AnimationHandle
add(animation: Animation): AnimationHandle;
play(player: PlayerObject, time: number): void
play(player: PlayerObject, time: number): void;
}
export const WalkAnimation: AnimationFn
export const WalkAnimation: AnimationFn;

46
types/model.d.ts vendored
View File

@ -1,35 +1,35 @@
import * as THREE from 'three'
import * as THREE from "three";
export class SkinObject extends THREE.Group {
readonly head: THREE.Group
readonly body: THREE.Group
readonly rightArm: THREE.Group
readonly leftArm: THREE.Group
readonly rightLeg: THREE.Group
readonly leftLeg: THREE.Group
readonly head: THREE.Group;
readonly body: THREE.Group;
readonly rightArm: THREE.Group;
readonly leftArm: THREE.Group;
readonly rightLeg: THREE.Group;
readonly leftLeg: THREE.Group;
constructor(
isSlim: boolean,
layer1Material: THREE.Material,
layer2Material: THREE.Material
)
constructor(
isSlim: boolean,
layer1Material: THREE.Material,
layer2Material: THREE.Material,
);
}
export class CapeObject extends THREE.Group {
readonly cape: THREE.Mesh
readonly cape: THREE.Mesh;
constructor(capeMaterial: THREE.Material)
constructor(capeMaterial: THREE.Material);
}
export class PlayerObject extends THREE.Group {
readonly slim: boolean
readonly skin: SkinObject
readonly cape: CapeObject
readonly slim: boolean;
readonly skin: SkinObject;
readonly cape: CapeObject;
constructor(
isSlim: boolean,
layer1Material: THREE.Material,
layer2Material: THREE.Material,
capeMaterial: THREE.Material
)
constructor(
isSlim: boolean,
layer1Material: THREE.Material,
layer2Material: THREE.Material,
capeMaterial: THREE.Material,
);
}

16
types/skinview3d.d.ts vendored
View File

@ -1,11 +1,11 @@
export {
CompositeAnimation,
WalkAnimation,
Animation,
AnimationFn,
IAnimation
} from './animation'
CompositeAnimation,
WalkAnimation,
Animation,
AnimationFn,
IAnimation,
} from "./animation";
export { SkinViewer, SkinControl } from './viewer'
export { SkinViewer, SkinControl } from "./viewer";
export { SkinObject, CapeObject, PlayerObject } from './model'
export { SkinObject, CapeObject, PlayerObject } from "./model";

62
types/viewer.d.ts vendored
View File

@ -1,45 +1,45 @@
import * as THREE from 'three'
import { CompositeAnimation, WalkAnimation } from './animation'
import { Animation } from './animation'
import { PlayerObject } from './model'
import * as THREE from "three";
import { CompositeAnimation, WalkAnimation } from "./animation";
import { Animation } from "./animation";
import { PlayerObject } from "./model";
interface SkinViewerOptions {
domElement: Element
animation?: Animation
slim?: boolean
skinUrl?: string
capeUrl?: string
width?: number
height?: number
domElement: Element;
animation?: Animation;
slim?: boolean;
skinUrl?: string;
capeUrl?: string;
width?: number;
height?: number;
}
export class SkinViewer {
skinUrl: string
capeUrl: string
width: number
height: number
readonly domElement: Element
animation: Animation
animationPaused: boolean
animationTime: number
readonly playerObject: PlayerObject
readonly disposed: boolean
readonly camera: THREE.Camera
readonly renderer: THREE.Renderer
readonly scene: THREE.Scene
skinUrl: string;
capeUrl: string;
width: number;
height: number;
readonly domElement: Element;
animation: Animation;
animationPaused: boolean;
animationTime: number;
readonly playerObject: PlayerObject;
readonly disposed: boolean;
readonly camera: THREE.Camera;
readonly renderer: THREE.Renderer;
readonly scene: THREE.Scene;
constructor(options: SkinViewerOptions)
constructor(options: SkinViewerOptions);
setSize(width: number, height: number): void
setSize(width: number, height: number): void;
dispose(): void
dispose(): void;
}
export class SkinControl {
enableAnimationControl: boolean
readonly skinViewer: SkinViewer
enableAnimationControl: boolean;
readonly skinViewer: SkinViewer;
constructor(skinViewer: SkinViewer)
constructor(skinViewer: SkinViewer);
dispose(): void
dispose(): void;
}