OrangeRedSeaweed Mod 开发相关

快速开始

首先是目录结构

/frontendModjs.py
/Information.py
/main.py
/management_interface.html # 管理页面

最重要的是 main.py 其他的有没有无所谓,就是没有可能会报错

模组入口是 main.py 里面的 main 函数

示例:

// helloworld mod's main.py
def main(api):

    // api["<ApiName>"] = <API processing function (an object)>
    api['helloWrold'] = helloWrold
    return api

def helloWrold(get_or_post,EnableSession,rep,**para):
    from other import Main
    s = EnableSession()
    s.data['hello'] = 'yes'
    s.refresh()
    get = get_or_post('hello','没有啦')
    return rep(__file__,s)

def AtRuntimeForTheFirstTime():
    ''' Functions that will be executed every time the program runs mod '''
    pass

返回值是一个字典,里面是 api 的定义

这里是 “helloWrold” API 对应的处理函数是 helloWrold

API 调用方式 :/api/mod?ModName=ModName&ApiName=ApiName

API processing function 函数传值介绍

get_or_post

这个是一个获取HTTP传值的 function

get_or_post(<参数名>,<当参数值为 None 时的返回值,默认为 None>)

EnableSession

开启会话( session ),返回 Session object

rep

生成返回对象

frontendModjs.py

里面装填 modjs 函数

# This is frontendModjs.py,
# which is used to store the modjs() function that returns the module JavaScript code

def modjs() -> str:
    return '''
//Modjs v1.0
//All rights reserved by Star Weaving
//Modjs is used to load the JavaScript code for mod
    '''

Information.py

里面是 mod 信息

# Mod information storage location
# This is an example
# The mod information is stored in the Information variable of this file, \
# in the form of a dictionary

information = {
    'name':'mod', # This is consistent with the mod directory name (REQUIRED)
    'version': '1.0', # (REQUIRED)
    'author': 'Star weaving', # (REQUIRED)
    'mail': None, 
    'official website': 'https://www.df100.ltd/',
    'warehouse address': 'https://github.com/hengshizhi/OrangeRedSeaweed/tree/main/mod/mods/mod',
    'describe' :'Essential components for managing mods, adding mods, loading mods, and more', # (REQUIRED)
}

logo = bytes # bytes 的图片
{
'title' :'OrangeRedSeaweed Mod 开发相关',
'Current page link''https://www.df100.ltd/532.asp',
'author''星姮十织',
'copyright': '维度前沿|Dimension Frontier © 2020-2023. 版权所有',
}
暂无评论

发送评论 编辑评论


				
|´・ω・)ノ
ヾ(≧∇≦*)ゝ
(☆ω☆)
(╯‵□′)╯︵┴─┴
 ̄﹃ ̄
(/ω\)
∠( ᐛ 」∠)_
(๑•̀ㅁ•́ฅ)
→_→
୧(๑•̀⌄•́๑)૭
٩(ˊᗜˋ*)و
(ノ°ο°)ノ
(´இ皿இ`)
⌇●﹏●⌇
(ฅ´ω`ฅ)
(╯°A°)╯︵○○○
φ( ̄∇ ̄o)
ヾ(´・ ・`。)ノ"
( ง ᵒ̌皿ᵒ̌)ง⁼³₌₃
(ó﹏ò。)
Σ(っ °Д °;)っ
( ,,´・ω・)ノ"(´っω・`。)
╮(╯▽╰)╭
o(*////▽////*)q
>﹏<
( ๑´•ω•) "(ㆆᴗㆆ)
😂
😀
😅
😊
🙂
🙃
😌
😍
😘
😜
😝
😏
😒
🙄
😳
😡
😔
😫
😱
😭
💩
👻
🙌
🖕
👍
👫
👬
👭
🌚
🌝
🙈
💊
😶
🙏
🍦
🍉
😣
Source: github.com/k4yt3x/flowerhd
颜文字
Emoji
小恐龙
花!
上一篇
下一篇