Просмотр исходного кода

update to HomePageBuilder b0.11

Nattiden 2 лет назад
Родитель
Сommit
775f0883ca

+ 1 - 1
Resources/Components/VersionToolBar.xaml

@@ -12,7 +12,7 @@ ${@IF|translator|
     EventData="${version-id}" LogoScale="0.85" Logo="{StaticResource LaunchIcon}" />
     EventData="${version-id}" LogoScale="0.85" Logo="{StaticResource LaunchIcon}" />
 <local:MyIconTextButton Style="{StaticResource DownloadVersionButton}"
 <local:MyIconTextButton Style="{StaticResource DownloadVersionButton}"
     LogoScale="0.85" Logo="{StaticResource DownloadIcon}"/>
     LogoScale="0.85" Logo="{StaticResource DownloadIcon}"/>
-${@IF|server-jar|
+${@IF|$server-jar|
 <local:MyIconTextButton Style="{StaticResource ServerJarDownloadButton}"
 <local:MyIconTextButton Style="{StaticResource ServerJarDownloadButton}"
     LogoScale="1.05" EventData="${server-jar}" Logo="{StaticResource CloudIcon}" />
     LogoScale="1.05" EventData="${server-jar}" Logo="{StaticResource CloudIcon}" />
 }
 }

+ 8 - 6
Resources/Scripts/GetLink.py

@@ -19,15 +19,17 @@ def gen_official_link(vid:str):
         return f'https://minecraft.net/article/minecraft-java-edition-{vid.replace(".","-")}'
         return f'https://minecraft.net/article/minecraft-java-edition-{vid.replace(".","-")}'
     return ''
     return ''
 
 
-def script(card,args,res):
+def script(link_type,link_key=None,**kwargs):
+    card = kwargs['card']
+    res = kwargs['res']
     name:str = card['version-id']
     name:str = card['version-id']
-    if card.get('not_finished') == 'true' and args[1] != 'Official':
+    if card.get('not_finished') == 'true' and link_type != 'Official':
         return ''
         return ''
-    data = res.data[f'{args[1]}Link']
-    if len(args) >= 3:
-        return data[args[2]]
+    data = res.data[f'{link_type}Link']
+    if link_key:
+        return data[link_key]
     if '${' in name:
     if '${' in name:
         raise KeyError()
         raise KeyError()
-    if args[1] == 'Official' and name not in data:
+    if link_type == 'Official' and name not in data:
         return gen_official_link(name)
         return gen_official_link(name)
     return data[name]
     return data[name]

+ 6 - 4
Resources/Scripts/LatestVersion.py

@@ -18,11 +18,13 @@ LATEST_VERSIONS.update(MANIFSET['latest'])
 FULL_VERSIONS = MANIFSET.get('versions')
 FULL_VERSIONS = MANIFSET.get('versions')
 LogInfo(f'[VersionScript] 最新快照版:{LATEST_VERSIONS["snapshot"]}; 最新正式版:{LATEST_VERSIONS["release"]}')
 LogInfo(f'[VersionScript] 最新快照版:{LATEST_VERSIONS["snapshot"]}; 最新正式版:{LATEST_VERSIONS["release"]}')
 
 
-def script(card,arg,res):
-    if len(arg) <= 2 or (count := int(arg[2])) <= 1:
-        return f"{LATEST_VERSIONS[arg[1]]} | latest = true"
+def script(version_type,version_rank = '1',**kwagrs):
+    version_rank = int(version_rank)
+    if version_rank <= 1:
+        return f"{LATEST_VERSIONS[version_type]} | latest = true"
+    count = version_rank
     for version in FULL_VERSIONS:
     for version in FULL_VERSIONS:
-        if version['type'] == arg[1]:
+        if version['type'] == version_type:
             count -= 1
             count -= 1
             if count == 0:
             if count == 0:
                 return version['id']
                 return version['id']

+ 1 - 1
Resources/Scripts/SeparatorContent.py

@@ -1,3 +1,3 @@
-def script(card,arg,res):
+def script(card,**kwargs):
     content = card['content']
     content = card['content']
     return '  '.join(list(content))
     return '  '.join(list(content))

+ 4 - 4
Resources/Templates/VersionBase.yml

@@ -1,8 +1,8 @@
 components:
 components:
- - ${@IF|version-image-link|VersionHeaderImage}
- - ${@IF|!not_finished|FlowDocumentViewer|Loading}
- - ${@IF|!disable-websites|VersionWebsites}
- - ${@IF|!disable-toolbar|VersionToolBar}
+ - ${@IF|$version-image-link|VersionHeaderImage}
+ - ${@IF|!$not_finished|FlowDocumentViewer|Loading}
+ - ${@IF|!$disable-websites|VersionWebsites}
+ - ${@IF|!$disable-toolbar|VersionToolBar}
 base: Card
 base: Card
 fill:
 fill:
    loading_content: 新版本内容翻译施工中,过一阵子再来吧
    loading_content: 新版本内容翻译施工中,过一阵子再来吧