2021-08-20 06:43:59 +02:00
|
|
|
from typing import List, Optional, Type
|
2019-12-08 22:43:49 +01:00
|
|
|
|
|
|
|
from bemani.backend.base import Base, Factory
|
|
|
|
from bemani.backend.museca.museca1 import Museca1
|
|
|
|
from bemani.backend.museca.museca1plus import Museca1Plus
|
|
|
|
from bemani.common import Model, VersionConstants
|
2021-08-20 06:43:59 +02:00
|
|
|
from bemani.data import Config, Data
|
2019-12-08 22:43:49 +01:00
|
|
|
|
|
|
|
|
|
|
|
class MusecaFactory(Factory):
|
|
|
|
MANAGED_CLASSES: List[Type[Base]] = [
|
|
|
|
Museca1,
|
|
|
|
Museca1Plus,
|
|
|
|
]
|
|
|
|
|
|
|
|
@classmethod
|
|
|
|
def register_all(cls) -> None:
|
2022-10-15 20:56:30 +02:00
|
|
|
for gamecode in ["PIX"]:
|
2021-08-19 21:20:31 +02:00
|
|
|
Base.register(gamecode, MusecaFactory)
|
2019-12-08 22:43:49 +01:00
|
|
|
|
|
|
|
@classmethod
|
2022-10-15 20:56:30 +02:00
|
|
|
def create(
|
|
|
|
cls,
|
|
|
|
data: Data,
|
|
|
|
config: Config,
|
|
|
|
model: Model,
|
|
|
|
parentmodel: Optional[Model] = None,
|
|
|
|
) -> Optional[Base]:
|
2019-12-08 22:43:49 +01:00
|
|
|
def version_from_date(date: int) -> Optional[int]:
|
|
|
|
if date <= 2016072600:
|
|
|
|
return VersionConstants.MUSECA
|
|
|
|
if date > 2016072600:
|
|
|
|
return VersionConstants.MUSECA_1_PLUS
|
|
|
|
return None
|
|
|
|
|
2022-10-15 20:56:30 +02:00
|
|
|
if model.gamecode == "PIX":
|
2019-12-08 22:43:49 +01:00
|
|
|
version = version_from_date(model.version)
|
|
|
|
if version == VersionConstants.MUSECA:
|
|
|
|
return Museca1(data, config, model)
|
|
|
|
if version == VersionConstants.MUSECA_1_PLUS:
|
|
|
|
return Museca1Plus(data, config, model)
|
|
|
|
|
|
|
|
# Unknown game version
|
|
|
|
return None
|