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 | 22x 22x 22x 18x 8x 6x 5x 2x 8x 6x 5x 2x 7x 5x 5x 2x 7x 6x 6x 1x 1x 1x 1x 1x 1x 1x 19x 18x 19x 18x 19x 19x 19x 19x | import { CommentDeployerConfigSupplier } from '../value/commentDeployerConfig' import { CommentDeployerConfigure, CommentDeployerConfigureImpl } from './commentDeployerConfigure' /** * 画面上に流れるコメントを配置する {@link CommentDeployer} を簡便に作るためのクラス. * * CommentDeployer は本クラスを用いて作成してください. */ export class CommentDeployerBuilder extends CommentDeployerConfigureImpl { private static lastUsedScene?: g.Scene private static defaultConfig?: CommentDeployerConfigSupplier private static defaultConfigure?: CommentDeployerConfigure constructor (scene: g.Scene) { super(false, scene, new CommentDeployerConfigSupplier(CommentDeployerBuilder.getDefaultConfig(scene).get())) } /** * 作成する CommentDeployer に設定するコメントの移動速度を取得します. */ override speed (): number /** * 作成する CommentDeployer に設定するコメントの移動速度を設定します. * * @param speed 移動速度 */ override speed (speed: number): CommentDeployerBuilder override speed (args?: number): number | CommentDeployerBuilder { if (typeof args === 'number') { super.speed(args) return this } return super.speed() } /** * 作成する CommentDeployer に設定するコメント間隔(y座標値)を取得します. */ override intervalY (): number /** * 作成する CommentDeployer に設定するコメント間隔(y座標値)を設定します. * * @param intervalY コメント間隔(y座標値) */ override intervalY (intervalY: number): CommentDeployerBuilder override intervalY (args?: number): number | CommentDeployerBuilder { if (typeof args === 'number') { super.intervalY(args) return this } return super.intervalY() } /** * 作成する CommentDeployer に設定するコメントのフォントを取得します. */ override font (): g.Font /** * 作成する CommentDeployer に設定するコメントのフォントを設定します. * * @param font コメントのフォント */ override font (font: g.Font): CommentDeployerBuilder override font (args?: g.Font): g.Font | CommentDeployerBuilder { if (args) { super.font(args) return this } return super.font() } /** * 作成する CommentDeployer のライブラリ利用者が自由に使えるフィールドを取得します. */ override vars (): unknown /** * 作成する CommentDeployer のライブラリ利用者が自由に使えるフィールドを設定します. * * @param vars ライブラリ利用者が自由に使えるフィールド */ override vars (vars: unknown): CommentDeployerBuilder override vars (args?: unknown): unknown | CommentDeployerBuilder { if (arguments.length > 0) { super.vars(args) return this } return super.vars() } /** * 各属性値に値を設定しなかった際に使用されるデフォルト値を設定します. * * @param scene 現在の scene を指定してください. */ static getDefault (scene: g.Scene): CommentDeployerConfigure { if (CommentDeployerBuilder.lastUsedScene !== scene) { CommentDeployerBuilder.resetDefault() } if (!CommentDeployerBuilder.defaultConfigure) { CommentDeployerBuilder.defaultConfigure = new CommentDeployerConfigureImpl(true, scene, CommentDeployerBuilder.getDefaultConfig(scene)) } CommentDeployerBuilder.lastUsedScene = scene return CommentDeployerBuilder.defaultConfigure } private static getDefaultConfig (scene: g.Scene): CommentDeployerConfigSupplier { if (CommentDeployerBuilder.lastUsedScene !== scene) { CommentDeployerBuilder.resetDefault() } if (!CommentDeployerBuilder.defaultConfig) { CommentDeployerBuilder.defaultConfig = new CommentDeployerConfigSupplier({ speed: 4, intervalY: 40, font: new g.DynamicFont({ game: scene.game, fontFamily: 'sans-serif', size: 35, strokeColor: 'white', strokeWidth: 4 }), vars: undefined }) } CommentDeployerBuilder.lastUsedScene = scene return CommentDeployerBuilder.defaultConfig } /** * {@link getDefault} で設定した変更を消去します. * @internal */ private static resetDefault () { delete CommentDeployerBuilder.defaultConfig delete CommentDeployerBuilder.defaultConfigure } } |