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 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 | 22x 22x 123x 894x 123x 172x 5x 5x 167x 167x 151x 5x 5x 146x 151x 5x 5x 146x 214x 67x 67x 147x 147x 161x 15x 15x 146x 147x 5x 5x 142x 141x | import { SpotAssetRecord, SpotConfig, SpotConfigSupplier } from '../value/spotConfig' import { Spot, SpotImpl } from '../model/spot' import { Live } from '../model/live' /** * {@link Spot} を新規作成する際の各種設定を格納します. */ export interface SpotConfigure { /** * 描画に使用する画像アセットを設定します. * * @param assets 状態ごとに使用する画像アセット */ image(assets: Partial<SpotAssetRecord>): SpotConfigure /** * 描画に使用される画像アセットをすべての状態について取得します. */ image(): Readonly<SpotAssetRecord> /** * マップに表示される名称を取得します. */ name(): string /** * マップに表示される名称を設定します. * * @param name 名称 */ name(name: string): SpotConfigure /** * 名称の描画に用いるフォントを取得します. */ labelFont(): g.Font /** * 名称の描画に用いるフォントを設定します. * * @param font 名称描画用のフォント */ labelFont(font: g.Font): SpotConfigure /** * 作成する Spot を配置する座標を設定します. * * @param location Spot を配置する座標 */ location(location: g.CommonOffset): SpotConfigure /** * 作成する Spot を配置する座標を取得します. */ location(): Readonly<g.CommonOffset> /** * 作成する Spot に到達すると開始する生放送を取得します. */ liveClass(): new () => Live /** * 作成する Spot に到達すると開始する生放送を設定します. * * @param liveClass 開始する生放送クラス名. インスタンスでない点にご留意ください. */ liveClass(liveClass: new() => Live): SpotConfigure /** * 作成する Spot のライブラリ利用者が自由に使えるフィールドを取得します. */ vars (): unknown /** * 作成する Spot のライブラリ利用者が自由に使えるフィールドを設定します. * * @param vars ライブラリ利用者が自由に使えるフィールド */ vars (vars: unknown): SpotConfigure } export class SpotConfigureImpl implements SpotConfigure { private readonly getter: () => SpotConfig private readonly setter: (obj: Partial<SpotConfig>) => void constructor (isDefault: boolean, private readonly scene: g.Scene, config: SpotConfigSupplier) { this.getter = () => isDefault ? config.default() : config.get() this.setter = obj => isDefault ? config.defaultIf(obj) : config.setIf(obj) } image (assets: Partial<SpotAssetRecord>): SpotConfigure image (): Readonly<SpotAssetRecord> image (args?: Partial<SpotAssetRecord>): SpotConfigure | Readonly<SpotAssetRecord> { if (args) { this.setter(args) return this } const value = this.getter() return { locked: value.locked, unvisited: value.unvisited, disabled: value.disabled, normal: value.normal } } name (): string name (name: string): SpotConfigure name (args?: string): SpotConfigure | string { if (args === '' || args) { this.setter({ name: args }) return this } return this.getter().name } labelFont (): g.Font labelFont (name: g.Font): SpotConfigure labelFont (args?: g.Font): SpotConfigure | g.Font { if (args) { this.setter({ labelFont: args }) return this } return this.getter().labelFont } location (location: g.CommonOffset): SpotConfigure location (): Readonly<g.CommonOffset> location (args?: g.CommonOffset): SpotConfigure | Readonly<g.CommonOffset> { if (args) { this.setter(args) return this } const value = this.getter() return { x: value.x, y: value.y } } liveClass (): new () => Live liveClass (liveClass: new () => Live): SpotConfigure liveClass (args?: new () => Live): SpotConfigure | Readonly<new () => Live> { if (args) { this.setter({ liveClass: args }) return this } return this.getter().liveClass } vars (): unknown vars (vars: unknown): SpotConfigure vars (args?: unknown): unknown | SpotConfigure { if (arguments.length > 0) { this.setter({ vars: args }) return this } return this.getter().vars } /** * 指定された設定で Spot を作成します */ build (): Spot { return new SpotImpl({ scene: this.scene, image: this.image(), name: this.name(), labelFont: this.labelFont(), location: this.location(), liveClass: this.liveClass(), vars: this.vars() }) } } |