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 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 | 22x 22x 22x 22x 22x 120x 158x 4x 4x 154x 148x 4x 4x 144x 148x 4x 4x 144x 211x 66x 66x 145x 158x 14x 14x 144x 147x 5x 5x 142x 22x 2x 22x 3x 22x 22x 123x 91x 123x 91x 123x 123x 93x 93x | import { SpotConfigure, SpotConfigureImpl } from './spotConfigure' import { image } from '../util/loader' import { SpotAssetRecord, SpotConfigSupplier } from '../value/spotConfig' import { Live, SampleLive } from '../model/live' /** * 訪問先 {@link Spot} を簡便に作るためのクラス. * * Spot は本クラスを用いて作成してください. */ export class SpotBuilder extends SpotConfigureImpl { private static lastUsedScene?: g.Scene private static defaultConfig?: SpotConfigSupplier private static defaultConfigure?: SpotConfigure constructor (scene: g.Scene) { super(false, scene, new SpotConfigSupplier(SpotBuilder.getDefaultConfig(scene).get())) } /** * 描画に使用する画像アセットを設定します. * * @param assets 状態ごとに使用する画像アセット */ override image (assets: Partial<SpotAssetRecord>): SpotBuilder /** * 描画に使用される画像アセットをすべての状態について取得します. */ override image (): Readonly<SpotAssetRecord> override image (args?: Partial<SpotAssetRecord>): SpotBuilder | Readonly<SpotAssetRecord> { if (args) { super.image(args) return this } return super.image() } /** * マップに表示される名称を取得します. */ override name (): string /** * マップに表示される名称を設定します. * * @param name 名称 */ override name (name: string): SpotBuilder override name (args?: string): SpotBuilder | string { if (args === '' || args) { super.name(args) return this } return super.name() } /** * 名称の描画に用いるフォントを取得します. */ override labelFont (): g.Font /** * 名称の描画に用いるフォントを設定します. * * @param font 名称描画用のフォント */ override labelFont (font: g.Font): SpotBuilder override labelFont (args?: g.Font): SpotBuilder | g.Font { if (args) { super.labelFont(args) return this } return super.labelFont() } /** * 作成する Spot を配置する座標を設定します. * * @param location Spot を配置する座標 */ override location (location: g.CommonOffset): SpotBuilder /** * 作成する Spot を配置する座標を取得します. */ override location (): Readonly<g.CommonOffset> override location (args?: g.CommonOffset): SpotBuilder | Readonly<g.CommonOffset> { if (args) { super.location(args) return this } return super.location() } /** * 作成する Spot に到達すると開始する生放送を取得します. */ override liveClass (): new () => Live /** * 作成する Spot に到達すると開始する生放送を設定します. * * @param liveClass 開始する生放送クラス名. インスタンスでない点にご留意ください. */ override liveClass (liveClass: new () => Live): SpotBuilder override liveClass (args?: new () => Live): SpotBuilder | Readonly<new () => Live> { if (args) { super.liveClass(args) return this } return super.liveClass() } /** * 作成する Spot のライブラリ利用者が自由に使えるフィールドを取得します. */ override vars (): unknown /** * 作成する Spot のライブラリ利用者が自由に使えるフィールドを設定します. * * @param vars ライブラリ利用者が自由に使えるフィールド */ override vars (vars: unknown): SpotBuilder override vars (args?: unknown): unknown | SpotBuilder { if (arguments.length > 0) { super.vars(args) return this } return super.vars() } /** * {@link build} を使用して Spot を作成する際、 * 個別の設定を省略した際のデフォルト値. * * 個々の Spot によらず共通の設定をしたい場合は、 * 本パラメタを利用して設定を変更してください. */ static getDefault (scene: g.Scene): SpotConfigure { if (SpotBuilder.lastUsedScene !== scene) { SpotBuilder.resetDefault() } if (!SpotBuilder.defaultConfigure) { SpotBuilder.defaultConfigure = new SpotConfigureImpl(true, scene, SpotBuilder.getDefaultConfig(scene)) } SpotBuilder.lastUsedScene = scene return SpotBuilder.defaultConfigure } private static getDefaultConfig (scene: g.Scene): SpotConfigSupplier { if (SpotBuilder.lastUsedScene !== scene) { SpotBuilder.resetDefault() } if (!SpotBuilder.defaultConfig) { SpotBuilder.defaultConfig = new SpotConfigSupplier({ x: 0, y: 0, locked: image(scene, 'image/spot.default.locked.png'), unvisited: image(scene, 'image/spot.default.unvisited.png'), disabled: image(scene, 'image/spot.default.disabled.png'), normal: image(scene, 'image/spot.default.normal.png'), name: '', labelFont: new g.DynamicFont({ game: scene.game, fontFamily: 'sans-serif', size: 25, fontColor: 'black', strokeColor: 'white', strokeWidth: 3 }), liveClass: SampleLive, vars: undefined }) } SpotBuilder.lastUsedScene = scene return SpotBuilder.defaultConfig } /** * {@link getDefault} で設定した変更を消去します. * @internal */ private static resetDefault () { delete SpotBuilder.defaultConfig delete SpotBuilder.defaultConfigure } } |