Bombsquad-Ballistica-Modded.../dist/ba_data/python/bacommon/login.py

55 lines
1.3 KiB
Python
Raw Normal View History

2022-12-25 00:39:49 +05:30
# Released under the MIT License. See LICENSE for details.
#
"""Functionality related to cloud based assets."""
from __future__ import annotations
from enum import Enum
from typing import TYPE_CHECKING
if TYPE_CHECKING:
pass
2023-12-21 15:55:50 +05:30
# NOTE TO SELF:
# Whenever adding login types here, make sure to update all
# basn nodes before trying to send values through to bamaster,
# as they need to be extractable by basn en route.
2022-12-25 00:39:49 +05:30
class LoginType(Enum):
"""Types of logins available."""
2025-04-06 17:17:13 +05:30
#: Email/password
2022-12-25 00:39:49 +05:30
EMAIL = 'email'
2025-04-06 17:17:13 +05:30
#: Google Play Game Services
2022-12-25 00:39:49 +05:30
GPGS = 'gpgs'
2025-04-06 17:17:13 +05:30
#: Apple's Game Center
2023-12-21 15:55:50 +05:30
GAME_CENTER = 'game_center'
2022-12-25 00:39:49 +05:30
@property
def displayname(self) -> str:
2025-04-06 17:17:13 +05:30
"""A human readable name for this value."""
2022-12-25 00:39:49 +05:30
cls = type(self)
match self:
case cls.EMAIL:
return 'Email/Password'
case cls.GPGS:
return 'Google Play Games'
2023-12-21 15:55:50 +05:30
case cls.GAME_CENTER:
return 'Game Center'
2024-11-28 00:23:35 +05:30
@property
def displaynameshort(self) -> str:
2025-04-06 17:17:13 +05:30
"""A short human readable name for this value."""
2024-11-28 00:23:35 +05:30
cls = type(self)
match self:
case cls.EMAIL:
return 'Email'
case cls.GPGS:
return 'GPGS'
case cls.GAME_CENTER:
return 'Game Center'