啊啊啊
This commit is contained in:
parent
4bad8a92a6
commit
5da350f7d8
@ -11,8 +11,11 @@ github: @shenjackyuanjie
|
||||
gitee: @shenjackyuanjie
|
||||
"""
|
||||
|
||||
from libs.semver.semver import VersionInfo
|
||||
|
||||
game_version = '0.6.2'
|
||||
__version__ = game_version
|
||||
semver_game_version = VersionInfo.parse(game_version)
|
||||
|
||||
|
||||
playing = False
|
||||
|
@ -6,12 +6,15 @@
|
||||
# 本文件以 GNU Lesser General Public License v3.0(GNU LGPL v3) 开源协议进行授权 (谢谢狐狸写出这么好的MCDR)
|
||||
# 顺便说一句,我把所有的tab都改成了空格,因为我觉得空格比tab更好看(草,后半句是github copilot自动填充的)
|
||||
|
||||
|
||||
import copy
|
||||
from abc import ABC
|
||||
from enum import EnumMeta
|
||||
from threading import Lock
|
||||
from typing import Union, TypeVar, List, Dict, Type, get_type_hints, Any
|
||||
|
||||
from semver import VersionInfo
|
||||
|
||||
"""
|
||||
This part of code come from MCDReforged(https://github.com/Fallen-Breath/MCDReforged)
|
||||
Very thanks to Fallen_Breath and other coder who helped MCDR worked better
|
||||
@ -43,9 +46,14 @@ def _get_args(cls: Type) -> tuple:
|
||||
return getattr(cls, '__args__', ())
|
||||
|
||||
|
||||
def serialize(obj) -> Union[None, int, float, str, list, dict]:
|
||||
_BASIC_CLASSES = (type(None), bool, int, float, str, list, dict, VersionInfo)
|
||||
|
||||
|
||||
def serialize(obj) -> _BASIC_CLASSES:
|
||||
if type(obj) in (type(None), int, float, str, bool):
|
||||
return obj
|
||||
elif isinstance(obj, VersionInfo):
|
||||
return obj
|
||||
elif isinstance(obj, list) or isinstance(obj, tuple):
|
||||
return list(map(serialize, obj))
|
||||
elif isinstance(obj, dict):
|
||||
@ -64,9 +72,6 @@ def serialize(obj) -> Union[None, int, float, str, list, dict]:
|
||||
return serialize(attr_dict)
|
||||
|
||||
|
||||
_BASIC_CLASSES = (type(None), bool, int, float, str, list, dict)
|
||||
|
||||
|
||||
def deserialize(data, cls: Type[T], *, error_at_missing=False, error_at_redundancy=False) -> T:
|
||||
# in case None instead of NoneType is passed
|
||||
if cls is None:
|
||||
|
@ -11,15 +11,21 @@ github: @shenjackyuanjie
|
||||
gitee: @shenjackyuanjie
|
||||
"""
|
||||
|
||||
# system function
|
||||
from typing import Tuple
|
||||
|
||||
from Difficult_Rocket import game_version
|
||||
# from libs
|
||||
from libs.semver.semver import VersionInfo
|
||||
|
||||
# from DR
|
||||
from Difficult_Rocket import semver_game_version
|
||||
from Difficult_Rocket.api.serializer import Serializable
|
||||
|
||||
"""
|
||||
mod系统参数
|
||||
"""
|
||||
MOD_loader_version = "0.0.1" # mod系统版本 版本号遵守semver2.0.0
|
||||
semver_loader_version = VersionInfo.parse(MOD_loader_version)
|
||||
|
||||
|
||||
"""
|
||||
@ -34,26 +40,30 @@ class MODInfo(Serializable):
|
||||
"""
|
||||
"""基本信息"""
|
||||
name: str # mod名称
|
||||
version: str # mod版本
|
||||
version: VersionInfo # mod版本
|
||||
dependencies: list = [] # mod依赖
|
||||
|
||||
"""作者、描述"""
|
||||
writer: str # 作者
|
||||
link: str = "" # 作者链接
|
||||
description: str = "" # 描述
|
||||
info: str = "" # 其他信息 (可以很多很多)
|
||||
description: str = "" # 描述 (务必简洁明了)
|
||||
info: str = "" # 其他信息 (可以很多很多)
|
||||
|
||||
"""版本兼容信息"""
|
||||
write_version: str # mod编写版本
|
||||
compatible_version: Tuple[str, str] = (game_version, game_version) # mod兼容版本
|
||||
write_version: VersionInfo # mod编写版本
|
||||
write_loader_version: VersionInfo # mod编写的加载器版本
|
||||
compatible_version: Tuple[VersionInfo, VersionInfo] = (semver_game_version, semver_game_version) # mod兼容版本
|
||||
# 第一个是最低兼容版本,第二个是最高兼容版本
|
||||
# 例如: ("1.0.0", "1.1.0")
|
||||
# 例如: ("1.0.0", "1.1.0")
|
||||
|
||||
|
||||
MOD_info = MODInfo(
|
||||
name="Difficult_Rocket",
|
||||
version="0.0.1",
|
||||
writer="shenjackyuanjie"
|
||||
writer="shenjackyuanjie",
|
||||
write_version=semver_game_version,
|
||||
write_loader_version=semver_loader_version
|
||||
)
|
||||
|
||||
"""
|
||||
|
12
Difficult_Rocket/mods/api/__init__.py
Normal file
12
Difficult_Rocket/mods/api/__init__.py
Normal file
@ -0,0 +1,12 @@
|
||||
# -------------------------------
|
||||
# Difficult Rocket
|
||||
# Copyright © 2021-2022 by shenjackyuanjie
|
||||
# All rights reserved
|
||||
# -------------------------------
|
||||
|
||||
"""
|
||||
writen by shenjackyuanjie
|
||||
mail: 3695888@qq.com
|
||||
github: @shenjackyuanjie
|
||||
gitee: @shenjackyuanjie
|
||||
"""
|
12
Difficult_Rocket/mods/loader/__init__.py
Normal file
12
Difficult_Rocket/mods/loader/__init__.py
Normal file
@ -0,0 +1,12 @@
|
||||
# -------------------------------
|
||||
# Difficult Rocket
|
||||
# Copyright © 2021-2022 by shenjackyuanjie
|
||||
# All rights reserved
|
||||
# -------------------------------
|
||||
|
||||
"""
|
||||
writen by shenjackyuanjie
|
||||
mail: 3695888@qq.com
|
||||
github: @shenjackyuanjie
|
||||
gitee: @shenjackyuanjie
|
||||
"""
|
@ -15,6 +15,15 @@
|
||||
- [![Readme-gitee](https://img.shields.io/badge/Readme-中文(点我!)-blue.svg?style=flat-square)](README-cn.md)
|
||||
- Using [SemVer 2.0.0](https://semver.org/) to manage version
|
||||
|
||||
## 202202 V 0.6.2
|
||||
|
||||
### Add
|
||||
|
||||
- 添加模块 `semver` 和协议 (`LICENSE.txt`)
|
||||
- Add modules `semver` Add LICENSE (`LICENSE.txt`)
|
||||
- 添加对 mod 的支持(还在写啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊)
|
||||
|
||||
|
||||
## ~~202111 202112xx 20220119~~ 20220207 V 0.6.1
|
||||
|
||||
~~争取12月内发一个release~~
|
||||
|
27
libs/semver/LICENSE.txt
Normal file
27
libs/semver/LICENSE.txt
Normal file
@ -0,0 +1,27 @@
|
||||
Copyright (c) 2013, Konstantine Rybnikov
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
Redistributions of source code must retain the above copyright notice, this
|
||||
list of conditions and the following disclaimer.
|
||||
|
||||
Redistributions in binary form must reproduce the above copyright notice, this
|
||||
list of conditions and the following disclaimer in the documentation and/or
|
||||
other materials provided with the distribution.
|
||||
|
||||
Neither the name of the {organization} nor the names of its
|
||||
contributors may be used to endorse or promote products derived from
|
||||
this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
|
||||
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
1259
libs/semver/semver.py
Normal file
1259
libs/semver/semver.py
Normal file
File diff suppressed because it is too large
Load Diff
@ -14,4 +14,19 @@ gitee: @shenjackyuanjie
|
||||
"""
|
||||
this is a test of modding in Difficult Rocket
|
||||
just a test
|
||||
只是一个DR的mod测试
|
||||
"""
|
||||
|
||||
# from libs
|
||||
import semver
|
||||
|
||||
# from DR
|
||||
from Difficult_Rocket import semver_game_version
|
||||
from Difficult_Rocket.mods import MODInfo, semver_loader_version
|
||||
|
||||
mod_info = MODInfo(name="test mod",
|
||||
version=semver.VersionInfo.parse("0.0.1"),
|
||||
write_version=semver_game_version,
|
||||
write_loader_version=semver_loader_version)
|
||||
|
||||
print(mod_info.serialize())
|
||||
|
@ -9,8 +9,18 @@ println("Hello, world!")
|
||||
|
||||
# 输入字符,然后输出输入的字符
|
||||
|
||||
abc = readline(stdin)
|
||||
@time
|
||||
function run()
|
||||
|
||||
println("aaaa $abc")
|
||||
ABigFloat = BigFloat(1111111111111111111111111111111111111111.1111111) * BigFloat(11111123.5111)
|
||||
ABigInt = BigInt(11111111111111111111111111111111111111111111111) * BigInt(111111235111)
|
||||
|
||||
|
||||
println("$ABigInt \n$ABigFloat")
|
||||
end
|
||||
run()
|
||||
|
||||
"""
|
||||
1234569279011111111111111111111111111111111111098765418321
|
||||
1.2345692790111111417743419014825244111008694272e+46
|
||||
"""
|
||||
|
28
try/some_big_num.py
Normal file
28
try/some_big_num.py
Normal file
@ -0,0 +1,28 @@
|
||||
# -------------------------------
|
||||
# Difficult Rocket
|
||||
# Copyright © 2021-2022 by shenjackyuanjie
|
||||
# All rights reserved
|
||||
# -------------------------------
|
||||
|
||||
"""
|
||||
writen by shenjackyuanjie
|
||||
mail: 3695888@qq.com
|
||||
github: @shenjackyuanjie
|
||||
gitee: @shenjackyuanjie
|
||||
"""
|
||||
import cProfile
|
||||
|
||||
|
||||
def run():
|
||||
一个很大的整数 = 11111111111111111111111111111111111111111111111 * 111111235111
|
||||
|
||||
一个很大的浮点数 = 1111111111111111111111111111111111111111.1111111 * 11111123.5111
|
||||
print(一个很大的整数, '\n', 一个很大的浮点数)
|
||||
|
||||
|
||||
cProfile.run("run")
|
||||
|
||||
"""
|
||||
1234569279011111111111111111111111111111111111098765418321
|
||||
1.234569279011111e+46
|
||||
"""
|
Loading…
Reference in New Issue
Block a user