-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathPhone_ren.py
67 lines (55 loc) · 1.82 KB
/
Phone_ren.py
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
from typing import Any
from game.phone.achievements.achievements_ren import achievements_app
from game.phone.kiwii.kiwii_ren import Kiwii
from game.phone.messenger.Messenger_ren import Messenger
from game.phone.relationships.relationships_ren import relationship_app
from game.phone.reputation.reputation_app_ren import reputation_app
from game.phone.simplr.simplr_ren import Simplr
from game.phone.Application_ren import Application
from renpy.common.action_control import Hide, Return
import renpy.exports as renpy
messenger = Messenger()
kiwii = Kiwii()
simplr_app = Simplr()
phone_from_phone_icon: bool
"""renpy
init python:
"""
class Phone:
def __init__(self) -> None:
self.applications: list[Application] = [
messenger,
achievements_app,
relationship_app,
kiwii,
reputation_app,
]
@property
def notifications(self) -> tuple[Application, ...]:
return tuple(app for app in self.applications if app.notification)
@property
def notification(self) -> bool:
return bool(self.notifications)
@property
def icon(self) -> str:
if self.notification:
return "phone_icon_notification"
else:
return "phone_icon"
@staticmethod
def get_exit_actions() -> list[Any]:
actions: list[Any] = [
Hide("tutorial"),
SetVariable("phone_from_phone_icon", False), # type: ignore
]
if (
not phone_from_phone_icon
and renpy.context()._current_interact_type == "screen" # type: ignore
):
actions.append(Return())
else:
actions.append(Hide("phone_tag"))
return actions
def clear_notifications(self) -> None:
for app in self.notifications:
app.clear_notifications()