Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 | 22x 22x 121x 121x 121x 11x 6x 6x 5x 13x 7x 6x 6x 11x 6x 6x 5x 5x 14x 8x 8x 6x 118x 118x | import { BroadcasterConfig, BroadcasterConfigSupplier } from '../value/broadcasterConfig' import { Broadcaster, BroadcasterImpl } from '../model/broadcaster' /** * {@link Broadcaster} を新規作成する際の各種設定を保持します. */ export interface BroadcasterConfigure { /** * 作成する Broadcaster に使用される画像アセットを取得します. */ asset (): g.ImageAsset /** * 作成する Broadcaster に設定する画像アセットを登録します. * * @param asset 描画に使用する画像アセット */ asset (asset: g.ImageAsset): BroadcasterConfigure /** * 作成する Broadcaster に設定する移動速度を取得します. */ speed (): number /** * 作成する Broadcaster に設定する移動速度を設定します. * * @param speed 移動速度 */ speed (speed: number): BroadcasterConfigure /** * 作成する Broadcaster に設定する座標を取得します. */ location (): g.CommonOffset /** * 作成する Broadcaster の座標を設定します. * * @param location Broadcaster の座標 */ location (location: g.CommonOffset): BroadcasterConfigure /** * 作成する Broadcaster のライブラリ利用者が自由に使えるフィールドを取得します. */ vars (): unknown /** * 作成する Broadcaster のライブラリ利用者が自由に使えるフィールドを設定します. * * @param vars ライブラリ利用者が自由に使えるフィールド */ vars (vars: unknown): BroadcasterConfigure } export class BroadcasterConfigureImpl implements BroadcasterConfigure { private readonly getter: () => BroadcasterConfig private readonly setter: (obj: Partial<BroadcasterConfig>) => void constructor (isDefault: boolean, private readonly scene: g.Scene, private readonly config: BroadcasterConfigSupplier) { this.getter = () => isDefault ? config.default() : config.get() this.setter = obj => isDefault ? config.defaultIf(obj) : config.setIf(obj) } asset (): g.ImageAsset asset (asset: g.ImageAsset): BroadcasterConfigure asset (args?: g.ImageAsset): g.ImageAsset | BroadcasterConfigure { if (args) { this.setter({ asset: args }) return this } return this.getter().asset } speed (): number speed (value: number): BroadcasterConfigure speed (args?: number): number | BroadcasterConfigure { if (typeof args === 'number') { this.setter({ speed: args }) return this } return this.getter().speed } location (): Readonly<g.CommonOffset> location (location: g.CommonOffset): BroadcasterConfigure location (args?: g.CommonOffset): Readonly<g.CommonOffset> | BroadcasterConfigure { if (args) { this.setter(args) return this } const value = this.getter() return { x: value.x, y: value.y } } vars (): unknown vars (vars: unknown): BroadcasterConfigure vars (args?: unknown): unknown | BroadcasterConfigure { if (arguments.length > 0) { this.setter({ vars: args }) return this } return this.getter().vars } /** * Broadcaster を作成します. */ build (): Broadcaster { const config = this.config.get() return new BroadcasterImpl({ scene: this.scene, asset: config.asset, speed: config.speed, location: { x: config.x, y: config.y }, vars: config.vars }) } } |