From 308cb7927b387782fea5511a564cb6b3876b81f5 Mon Sep 17 00:00:00 2001 From: aNNiMON Date: Wed, 6 Mar 2024 00:18:34 +0200 Subject: [PATCH] Add more view models --- src/view/model/Characters.ts | 92 ++++++++++++++++++++++++++++++++ src/view/model/Menu.ts | 2 +- src/view/model/NameInfo.ts | 6 +++ src/view/model/Transition.ts | 45 ++++++++++++++++ src/view/model/TransitionType.ts | 1 + 5 files changed, 145 insertions(+), 1 deletion(-) create mode 100644 src/view/model/Characters.ts create mode 100644 src/view/model/NameInfo.ts create mode 100644 src/view/model/Transition.ts create mode 100644 src/view/model/TransitionType.ts diff --git a/src/view/model/Characters.ts b/src/view/model/Characters.ts new file mode 100644 index 0000000..dc0768b --- /dev/null +++ b/src/view/model/Characters.ts @@ -0,0 +1,92 @@ +import { NameInfo } from "./NameInfo"; + +type NameInfoMap = { + [key: string]: NameInfo; +}; + +export class Characters { + private static readonly DEFAULT_COLOR: number = 0xFFC0C0C0; + + private names: NameInfoMap; + + constructor() { + this.names = {}; + } + + public contains(shortName: string): boolean { + return shortName in this.names; + } + + public get(shortName: string): NameInfo { + return this.names[shortName]; + } + + public setName(shortName: string, fullName: string, color: number = Characters.DEFAULT_COLOR): boolean { + if (shortName in this.names) { + const info = this.names[shortName]; + info.name = fullName; + info.color = color; + } else { + this.names[shortName] = new NameInfo(fullName, color); + } + return shortName in this.names; + } + + public makeNamesUnknown(): void { + // https://github.com/yakui-lover/eroge-dopil/blob/master/media.rpy#L365 + this.names["me"] = new NameInfo("Семён", 0xFFE1DD7D); + this.names["un"] = new NameInfo("Пионерка", 0xFFB956FF); + this.names["dv"] = new NameInfo("Пионерка", 0xFFFFAA00); + this.names["sl"] = new NameInfo("Пионерка", 0xFFFFD200); + this.names["us"] = new NameInfo("Пионерка", 0xFFFF3200); + this.names["mt"] = new NameInfo("Вожатая", 0xFF00EA32); + this.names["cs"] = new NameInfo("Медсестра", 0xFFA5A5FF); + this.names["mz"] = new NameInfo("Пионерка", 0xFF4A86FF); + this.names["mi"] = new NameInfo("Пионерка", 0xFF00DEFF); + this.names["uv"] = new NameInfo("Странная девочка", 0xFF4EFF00); + this.names["lk"] = new NameInfo("Луркмор-кун", 0xFFFF8080); + this.names["sh"] = new NameInfo("Пионер", 0xFFFFF226); + this.names["el"] = new NameInfo("Пионер", 0xFFFFFF00); + this.names["pi"] = new NameInfo("Пионер", 0xFFE60101); + + this.names["dy"] = new NameInfo("Голос из динамика", 0xFFC0C0C0); + this.names["voice"] = new NameInfo("Голос", 0xFFE1DD7D); + this.names["voices"] = new NameInfo("Голоса", 0xFFC0C0C0); + this.names["message"] = new NameInfo("Сообщение", 0xFFC0C0C0); + this.names["all"] = new NameInfo("Пионеры", 0xFFED4444); + this.names["kids"] = new NameInfo("Малышня", 0xFFEB7883); + this.names["dreamgirl"] = new NameInfo("...", 0xFFC0C0C0); + this.names["bush"] = new NameInfo("Голос", 0xFFC0C0C0); + this.names["FIXME_voice"] = new NameInfo("Голос", 0xFFC0C0C0); + this.names["odn"] = new NameInfo("Одногруппник", 0xFFC0C0C0); + this.names["mt_voice"] = new NameInfo("Голос", 0xFF00EA32); + } + + public makeNamesKnown(): void { + this.setName("me", "Семён"); + this.setName("un", "Лена"); + this.setName("dv", "Алиса"); + this.setName("sl", "Славя"); + this.setName("us", "Ульяна"); + this.setName("mt", "Ольга Дмитриевна"); + this.setName("cs", "Виола"); + this.setName("mz", "Женя"); + this.setName("mi", "Мику"); + this.setName("uv", "Юля"); + this.setName("lk", "Луркмор-кун"); + this.setName("sh", "Шурик"); + this.setName("el", "Электроник"); + this.setName("pi", "Пионер"); + this.setName("dy", "Голос из динамика"); + this.setName("voice", "Голос"); + this.setName("voices", "Голоса"); + this.setName("message", "Сообщение"); + this.setName("all", "Пионеры"); + this.setName("kids", "Малышня"); + this.setName("dreamgirl", "..."); + this.setName("bush", "Голос"); + this.setName("FIXME_voice", "Голос"); + this.setName("odn", "Одногруппник"); + this.setName("mt_voice", "Голос"); + } +} \ No newline at end of file diff --git a/src/view/model/Menu.ts b/src/view/model/Menu.ts index 57cbaf1..21070f5 100644 --- a/src/view/model/Menu.ts +++ b/src/view/model/Menu.ts @@ -1,7 +1,7 @@ import { MenuItem } from "./MenuItem"; export class Menu { - items: MenuItem[]; + private items: MenuItem[]; constructor(private title: string) { this.title = title; diff --git a/src/view/model/NameInfo.ts b/src/view/model/NameInfo.ts new file mode 100644 index 0000000..a954473 --- /dev/null +++ b/src/view/model/NameInfo.ts @@ -0,0 +1,6 @@ +export class NameInfo { + constructor( + public name: string, + public color: number + ) { } +} diff --git a/src/view/model/Transition.ts b/src/view/model/Transition.ts new file mode 100644 index 0000000..abdbc0d --- /dev/null +++ b/src/view/model/Transition.ts @@ -0,0 +1,45 @@ +import { TransitionType } from "./TransitionType"; + +export class Transition { + public static readonly DEFAULT = { + "fade": { + "type": TransitionType.TYPE_FADE, + "outTime": 500, + "holdTime": 0, + "inTime": 500 + }, + "fade2": { + "type": TransitionType.TYPE_FADE, + "outTime": 1000, + "holdTime": 0, + "inTime": 1000 + }, + "fade3": { + "type": TransitionType.TYPE_FADE, + "outTime": 1500, + "holdTime": 0, + "inTime": 1500 + }, + + "dspr": { + "type": TransitionType.TYPE_FADE, + "outTime": 200, + "holdTime": 0, + "inTime": 200 + }, + "dissolve": { + "type": TransitionType.TYPE_FADE, + "outTime": 1000, + "holdTime": 0, + "inTime": 1000 + }, + "dissolve2": { + "type": TransitionType.TYPE_FADE, + "outTime": 2000, + "holdTime": 0, + "inTime": 2000 + } + }; + + constructor(public type: string) { } +} \ No newline at end of file diff --git a/src/view/model/TransitionType.ts b/src/view/model/TransitionType.ts new file mode 100644 index 0000000..626ba96 --- /dev/null +++ b/src/view/model/TransitionType.ts @@ -0,0 +1 @@ +export enum TransitionType { TYPE_FADE, TYPE_DISSOLVE }; \ No newline at end of file