🎨 将plant.json迁移至sqlite本地数据库
📝 新增部分作物
This commit is contained in:
@@ -7,7 +7,6 @@ from zhenxun.services.log import logger
|
||||
class CJsonManager:
|
||||
def __init__(self):
|
||||
self.m_pItem = {}
|
||||
self.m_pPlant = {}
|
||||
self.m_pLevel = {}
|
||||
self.m_pSoil = {}
|
||||
|
||||
@@ -15,9 +14,6 @@ class CJsonManager:
|
||||
if not await self.initItem():
|
||||
return False
|
||||
|
||||
if not await self.initPlant():
|
||||
return False
|
||||
|
||||
if not await self.initLevel():
|
||||
return False
|
||||
|
||||
@@ -44,24 +40,6 @@ class CJsonManager:
|
||||
logger.warning(f"item.json JSON格式错误: {e}")
|
||||
return False
|
||||
|
||||
async def initPlant(self) -> bool:
|
||||
current_file_path = Path(__file__)
|
||||
|
||||
try:
|
||||
with open(
|
||||
current_file_path.resolve().parent / "config/plant.json",
|
||||
encoding="utf-8",
|
||||
) as file:
|
||||
self.m_pPlant = json.load(file)
|
||||
|
||||
return True
|
||||
except FileNotFoundError:
|
||||
logger.warning("plant.json 打开失败")
|
||||
return False
|
||||
except json.JSONDecodeError as e:
|
||||
logger.warning(f"plant.json JSON格式错误: {e}")
|
||||
return False
|
||||
|
||||
async def initLevel(self) -> bool:
|
||||
current_file_path = Path(__file__)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user