-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
50606bf
commit d72f456
Showing
35 changed files
with
144 additions
and
80 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,51 +1,40 @@ | ||
from typing import Dict | ||
from pathlib import Path | ||
from typing import Dict, Union | ||
|
||
import aiofiles | ||
from PIL import Image | ||
from msgspec import json as msgjson | ||
from gsuid_core.help.model import PluginHelp | ||
from gsuid_core.utils.fonts.fonts import core_font | ||
from gsuid_core.help.draw_plugin_help import get_help | ||
from gsuid_core.help.draw_new_plugin_help import get_new_help | ||
|
||
from ..utils.image import get_footer | ||
from ..version import BlueArchiveUID_version | ||
|
||
ICON = Path(__file__).parent.parent.parent / 'ICON.png' | ||
HELP_DATA = Path(__file__).parent / 'help.json' | ||
ICON_PATH = Path(__file__).parent / 'icon_path' | ||
TEXT_PATH = Path(__file__).parent / 'texture2d' | ||
HELP_DATA = Path(__file__).parent / 'Help.json' | ||
|
||
|
||
async def get_help_data() -> Union[Dict[str, PluginHelp], None]: | ||
if HELP_DATA.exists(): | ||
async with aiofiles.open(HELP_DATA, 'rb') as file: | ||
return msgjson.decode( | ||
await file.read(), | ||
type=Dict[str, PluginHelp], | ||
) | ||
|
||
|
||
async def get_ba_core_help() -> Union[bytes, str]: | ||
help_data = await get_help_data() | ||
if help_data is None: | ||
return '暂未找到帮助数据...' | ||
|
||
img = await get_help( | ||
'BlueArchiveUID', | ||
f'版本号:{BlueArchiveUID_version}', | ||
help_data, | ||
Image.open(TEXT_PATH / 'bg.jpg'), | ||
Image.open(TEXT_PATH / 'icon.png'), | ||
Image.open(TEXT_PATH / 'badge.png'), | ||
Image.open(TEXT_PATH / 'banner.png'), | ||
Image.open(TEXT_PATH / 'button.png'), | ||
core_font, | ||
is_dark=False, | ||
column=4, | ||
is_gaussian=True, | ||
gaussian_blur=10, | ||
text_color=(39, 87, 168), | ||
sub_c=(68, 128, 230), | ||
sv_color=(8, 8, 8), | ||
sv_desc_color=(58, 58, 58), | ||
async def get_help_data() -> Dict[str, PluginHelp]: | ||
async with aiofiles.open(HELP_DATA, 'rb') as file: | ||
return msgjson.decode(await file.read(), type=Dict[str, PluginHelp]) | ||
|
||
|
||
async def get_help(): | ||
return await get_new_help( | ||
plugin_name='BlueArchiveUID', | ||
plugin_info={f'v{BlueArchiveUID_version}': ''}, | ||
plugin_icon=Image.open(ICON), | ||
plugin_help=await get_help_data(), | ||
plugin_prefix='ba', | ||
help_mode='light', | ||
banner_bg=Image.open(TEXT_PATH / 'banner_bg.jpg'), | ||
banner_sub_text='「与你的日常,就是“奇迹”」', | ||
help_bg=Image.open(TEXT_PATH / 'bg.jpg'), | ||
cag_bg=Image.open(TEXT_PATH / 'cag_bg.png'), | ||
item_bg=Image.open(TEXT_PATH / 'item.png'), | ||
icon_path=ICON_PATH, | ||
footer=get_footer(), | ||
enable_cache=True, | ||
) | ||
return img |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
from pathlib import Path | ||
|
||
from PIL import Image | ||
|
||
TEXT_PATH = Path(__file__).parent / 'texture2d' | ||
|
||
|
||
def get_footer(): | ||
return Image.open(TEXT_PATH / 'footer.png') |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
BlueArchiveUID_version = '0.2' | ||
BlueArchiveUID_version = '0.3' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
from gsuid_core.sv import Plugins | ||
|
||
Plugins( | ||
name="BlueArchiveUID", | ||
force_prefix=["ba", "BA"], | ||
allow_empty_prefix=False, | ||
) |