Skip to content

Commit

Permalink
Merge pull request #5 from Tigeia-Workshop/dev
Browse files Browse the repository at this point in the history
[PATCH] 0.0.4
  • Loading branch information
yudonglin authored Jul 6, 2021
2 parents ed011ad + f6ef260 commit a65b349
Show file tree
Hide file tree
Showing 11 changed files with 274 additions and 268 deletions.
2 changes: 1 addition & 1 deletion Data/version.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
patch: 3
patch: 4
revision: 0
version: 0
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# GirlsFrontLine-LastWish 少女前线-遗愿

[![Total alerts](https://img.shields.io/lgtm/alerts/g/Tigeia-Workshop/GirlsFrontLine-LastWish.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/Tigeia-Workshop/GirlsFrontLine-LastWish/alerts/) [![Language grade: Python](https://img.shields.io/lgtm/grade/python/g/Tigeia-Workshop/GirlsFrontLine-LastWish.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/Tigeia-Workshop/GirlsFrontLine-LastWish/context:python) ![GitHub all releases](https://img.shields.io/github/downloads/Tigeia-Workshop/GirlsFrontLine-LastWish/total) ![GitHub](https://img.shields.io/github/license/Tigeia-Workshop/GirlsFrontLine-LastWish) ![GitHub release (latest by date including pre-releases)](https://img.shields.io/github/v/release/Tigeia-Workshop/GirlsFrontLine-LastWish?include_prereleases) ![PyPI - Python Version](https://img.shields.io/pypi/pyversions/linpg)



# :speech_balloon: Preamble / 前言

Their stories may be forgotten by history, but what they have done will be remembered forever.
Expand Down
8 changes: 4 additions & 4 deletions Source/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,20 @@
#discord接口
RPC:object
#如果不想要展示Discord的Rich Presence
if linpg.try_get_setting("DiscordRichPresence") is False:
if linpg.setting.try_get("DiscordRichPresence") is False:
RPC = None
else:
#尝试连接Discord
try:
from pypresence import Presence
RPC = Presence(str(CLIENT_ID))
RPC.connect()
RPC.update(state=linpg.get_lang("DiscordStatus","game_is_initializing"),large_image=LARGE_IMAGE)
RPC.update(state=linpg.lang.get_text("DiscordStatus","game_is_initializing"),large_image=LARGE_IMAGE)
except Exception:
RPC = None

#加载版本信息
version_info:dict = linpg.load_config("Data/version.yaml")
version_info:dict = linpg.config.load("Data/version.yaml")
VERSION:int = version_info["version"]
REVISION:int = version_info["revision"]
PATCH:int = version_info["patch"]
Expand All @@ -31,7 +31,7 @@

#alpha构建警告
ALPHA_BUILD_WARNING = linpg.TextSurface(
linpg.render_font(linpg.get_lang("alpha_build_warning"),"white",linpg.get_standard_font_size("medium")/2),0,0
linpg.render_font(linpg.lang.get_text("alpha_build_warning"),"white",linpg.get_standard_font_size("medium")/2),0,0
)
ALPHA_BUILD_WARNING.set_centerx(linpg.display.get_width()/2)
ALPHA_BUILD_WARNING.set_bottom(linpg.display.get_height()-ALPHA_BUILD_WARNING.get_height())
Expand Down
10 changes: 5 additions & 5 deletions Source/component.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,18 @@
def dispaly_loading_screen(screen:linpg.ImageSurface, start:int, end:int, value:int) -> None:
window_x,window_y = screen.get_size()
#获取健康游戏忠告
HealthyGamingAdvice = linpg.try_get_lang("HealthyGamingAdvice")
HealthyGamingAdvice = linpg.lang.try_to_get_text("HealthyGamingAdvice")
if HealthyGamingAdvice == "HealthyGamingAdvice":
HealthyGamingAdvice = []
else:
for i in range(len(HealthyGamingAdvice)):
HealthyGamingAdvice[i] = linpg.render_font(HealthyGamingAdvice[i],"white",window_x/64)
#其他载入页面需要的数据
text1 = linpg.render_font(linpg.get_lang("title1"), "white", window_x/64)
text2 = linpg.render_font(linpg.get_lang("title2"), "white", window_x/64)
text1 = linpg.render_font(linpg.lang.get_text("title1"), "white", window_x/64)
text2 = linpg.render_font(linpg.lang.get_text("title2"), "white", window_x/64)
#主循环
for i in range(start,end,value):
screen.fill(linpg.get_color_rbga("black"))
screen.fill(linpg.color.BLACK)
text1.set_alpha(i)
text2.set_alpha(i)
screen.blits(((text1,(window_x/64,window_y*0.9)),(text2,(window_x/64,window_y*0.9-window_x/32))))
Expand All @@ -34,7 +34,7 @@ def _check_command(self, conditions:list) -> None:
elif conditions[1] == "battle":
battle(linpg.display.screen_window, conditions[2], conditions[3], conditions[4])
else:
self.txtOutput.append("Error, do not know what to load.")
self._txt_output.append("Error, do not know what to load.")
else:
super()._check_command(conditions)

Expand Down
90 changes: 45 additions & 45 deletions Source/gamemode/editor.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# cython: language_level=3
import os
from .ui import *

#地图编辑器系统
Expand All @@ -18,9 +17,9 @@ def __load_characters_data(self, mapFileData:dict) -> None:
def load(self, screen:linpg.ImageSurface, chapterType:str, chapterId:int, projectName:str=None) -> None:
self._initialize(chapterType, chapterId, projectName)
self.folder_for_save_file,self.name_for_save_file = os.path.split(self.get_map_file_location())
self.decorations_setting = linpg.load_config("Data/decorations.yaml","decorations")
self.decorations_setting = linpg.config.load("Data/decorations.yaml","decorations")
#载入地图数据
mapFileData:dict = linpg.load_config(self.get_map_file_location())
mapFileData:dict = linpg.config.load(self.get_map_file_location())
#初始化角色信息
self.__load_characters_data(mapFileData)
#初始化地图
Expand All @@ -31,7 +30,7 @@ def load(self, screen:linpg.ImageSurface, chapterType:str, chapterId:int, projec
block_x = 50
default_map = [[SnowEnvImg[linpg.get_random_int(0,5)] for a in range(block_x)] for i in range(block_y)]
mapFileData["map"] = default_map
linpg.save_config(self.get_map_file_location(),mapFileData)
linpg.config.save(self.get_map_file_location(),mapFileData)
#加载地图
self._create_map(mapFileData)
del mapFileData
Expand All @@ -43,30 +42,31 @@ def load(self, screen:linpg.ImageSurface, chapterType:str, chapterId:int, projec
button_height:int = int(screen.get_height()*0.2)
panding:int = int(screen.get_height()*0.01)
font_size:int = int(button_width/3)
self.__button_select_block = linpg.load_button_with_text_in_center(
"Assets/image/UI/menu.png",linpg.get_lang("MapEditor","block"),"black",font_size,(0,screen.get_width()*0.03),100
self.__button_select_block = linpg.load.button_with_text_in_center(
"Assets/image/UI/menu.png",linpg.lang.get_text("MapEditor","block"),"black",font_size,(0,screen.get_width()*0.03),100
)
self.__button_select_decoration = linpg.load_button_with_text_in_center(
"Assets/image/UI/menu.png",linpg.get_lang("MapEditor","decoration"),"black",font_size,(0,screen.get_width()*0.03),100
self.__button_select_decoration = linpg.load.button_with_text_in_center(
"Assets/image/UI/menu.png",linpg.lang.get_text("MapEditor","decoration"),"black",font_size,(0,screen.get_width()*0.03),100
)
self.__button_select_block.set_left(
int((container_width-self.__button_select_block.get_width()-self.__button_select_decoration.get_width()-panding)/2)
)
self.__button_select_decoration.set_left(self.__button_select_block.right+panding)
self.__UIContainerRight = linpg.load_dynamic_image("Assets/image/UI/container.png",(0,0),container_width,container_height)
self.__UIContainerButtonRight = linpg.load_movable_image("Assets/image/UI/container_button.png",
(screen.get_width()-button_width,int((screen.get_height()-button_height)/2)),
(screen.get_width()-button_width-container_width,int((screen.get_height()-button_height)/2)),
(int(container_width/10),0),button_width,button_height
)
self.__UIContainerRight = linpg.load.dynamic_image(r"Assets/image/UI/container.png", (0,0), (container_width,container_height))
self.__UIContainerButtonRight = linpg.load.movable_image(
r"Assets/image/UI/container_button.png",
(int(screen.get_width()-button_width), int((screen.get_height()-button_height)/2)),
(int(screen.get_width()-button_width-container_width), int((screen.get_height()-button_height)/2)),
(int(container_width/10), 0), (button_width, button_height)
)
self.__UIContainerRight.rotate(90)
self.__UIContainerButtonRight.rotate(90)
#加载背景图片
self.__envImgContainer:object = linpg.SurfaceContainerWithScrollbar(
None, int(container_width*0.075), int(screen.get_height()*0.1), int(container_width*0.85), int(screen.get_height()*0.85), "vertical"
)
for imgPath in glob.glob(r'Assets/image/environment/block/*.png'):
self.__envImgContainer.set(os.path.basename(imgPath).replace(".png",""),linpg.load_img(imgPath,(self.MAP.block_width/3,None)))
self.__envImgContainer.set(os.path.basename(imgPath).replace(".png",""),linpg.load.img(imgPath,(self.MAP.block_width/3,None)))
self.__envImgContainer.set_item_per_line(4)
self.__envImgContainer.set_scroll_bar_pos("right")
self.__envImgContainer.hidden = False
Expand All @@ -76,7 +76,7 @@ def load(self, screen:linpg.ImageSurface, chapterType:str, chapterId:int, projec
None, int(container_width*0.075), int(screen.get_height()*0.1), int(container_width*0.85), int(screen.get_height()*0.85), "vertical"
)
for imgPath in glob.glob(r'Assets/image/environment/decoration/*.png'):
self.__decorationsImgContainer.set(os.path.basename(imgPath).replace(".png",""),linpg.load_img(imgPath,(self.MAP.block_width/3,None)))
self.__decorationsImgContainer.set(os.path.basename(imgPath).replace(".png",""),linpg.load.img(imgPath,(self.MAP.block_width/3,None)))
self.__decorationsImgContainer.set_item_per_line(4)
self.__decorationsImgContainer.set_scroll_bar_pos("right")
self.__decorationsImgContainer.hidden = True
Expand All @@ -88,18 +88,18 @@ def load(self, screen:linpg.ImageSurface, chapterType:str, chapterId:int, projec
button_height = int(screen.get_height()*0.05)
panding = int(screen.get_height()*0.01)
font_size = int(button_height/2)
self.__button_select_character = linpg.load_button_with_text_in_center(
"Assets/image/UI/menu.png",linpg.get_lang("General","griffin_Kryuger"),"black",font_size,(0,0),100
self.__button_select_character = linpg.load.button_with_text_in_center(
"Assets/image/UI/menu.png",linpg.lang.get_text("General","griffin_Kryuger"),"black",font_size,(0,0),100
)
self.__button_select_sangvisFerri = linpg.load_button_with_text_in_center(
"Assets/image/UI/menu.png",linpg.get_lang("General","sangvis_ferri"),"black",font_size,(self.__button_select_character.get_width(),0),100
self.__button_select_sangvisFerri = linpg.load.button_with_text_in_center(
"Assets/image/UI/menu.png",linpg.lang.get_text("General","sangvis_ferri"),"black",font_size,(self.__button_select_character.get_width(),0),100
)
self.__UIContainerBottom = linpg.load_dynamic_image("Assets/image/UI/container.png",(0,0),container_width,container_height)
self.__UIContainerButtonBottom = linpg.load_movable_image(
"Assets/image/UI/container_button.png",
((container_width-button_width)/2,screen.get_height()-button_height),
((container_width-button_width)/2,screen.get_height()-button_height-container_height),
(0,container_height/10),button_width,button_height
self.__UIContainerBottom = linpg.load.dynamic_image(r"Assets/image/UI/container.png", (0,0), (container_width,container_height))
self.__UIContainerButtonBottom = linpg.load.movable_image(
r"Assets/image/UI/container_button.png",
(int((container_width-button_width)/2), int(screen.get_height()-button_height)),
(int((container_width-button_width)/2), int(screen.get_height()-button_height-container_height)),
(0, int(container_height/10)), (button_width, button_height)
)
#加载所有友方的角色的图片文件
self.__charactersImgContainer:object = linpg.SurfaceContainerWithScrollbar(
Expand All @@ -109,7 +109,7 @@ def load(self, screen:linpg.ImageSurface, chapterType:str, chapterId:int, projec
img_name = os.path.basename(imgPath)
self.__charactersImgContainer.set(
img_name,
linpg.cope_bounding(linpg.load_img(os.path.join(imgPath, "wait", "{}_wait_0.png".format(img_name)), (None, container_height*1.5)))
linpg.cope_bounding(linpg.load.img(os.path.join(imgPath, "wait", "{}_wait_0.png".format(img_name)), (None, container_height*1.5)))
)
self.__charactersImgContainer.set_scroll_bar_pos("bottom")
self.__charactersImgContainer.hidden = False
Expand All @@ -122,13 +122,13 @@ def load(self, screen:linpg.ImageSurface, chapterType:str, chapterId:int, projec
img_name = os.path.basename(imgPath)
self.__sangvisFerrisImgContainer.set(
img_name,
linpg.cope_bounding(linpg.load_img(os.path.join(imgPath, "wait", "{}_wait_0.png".format(img_name)), (None, container_height*1.5)))
linpg.cope_bounding(linpg.load.img(os.path.join(imgPath, "wait", "{}_wait_0.png".format(img_name)), (None, container_height*1.5)))
)
self.__sangvisFerrisImgContainer.set_scroll_bar_pos("bottom")
self.__sangvisFerrisImgContainer.hidden = True
self.__sangvisFerrisImgContainer.distance_between_item = panding
#绿色方块/方块标准
self.greenBlock = linpg.load_img("Assets/image/UI/range/green.png",(self.MAP.block_width*0.8,None))
self.greenBlock = linpg.load.img("Assets/image/UI/range/green.png",(self.MAP.block_width*0.8,None))
self.greenBlock.set_alpha(150)
self.redBlock = linpg.load_img("Assets/image/UI/range/red.png",(self.MAP.block_width*0.8,None))
self.redBlock.set_alpha(150)
Expand All @@ -139,20 +139,20 @@ def load(self, screen:linpg.ImageSurface, chapterType:str, chapterId:int, projec
UI_x = self.MAP.block_width*0.5
UI_y = int(screen.get_height()*0.02)
font_size = int(self.MAP.block_width*0.2)
self.UIButton["save"] = linpg.load_button_with_text_in_center(
"Assets/image/UI/menu.png", linpg.get_lang("Global", "save"), "black", font_size, (UI_x, UI_y), 100
self.UIButton["save"] = linpg.load.button_with_text_in_center(
"Assets/image/UI/menu.png", linpg.lang.get_text("Global", "save"), "black", font_size, (UI_x, UI_y), 100
)
UI_x += self.UIButton["save"].get_width()+font_size
self.UIButton["back"] = linpg.load_button_with_text_in_center(
"Assets/image/UI/menu.png", linpg.get_lang("Global", "back"), "black", font_size, (UI_x, UI_y), 100
self.UIButton["back"] = linpg.load.button_with_text_in_center(
"Assets/image/UI/menu.png", linpg.lang.get_text("Global", "back"), "black", font_size, (UI_x, UI_y), 100
)
UI_x += self.UIButton["back"].get_width()+font_size
self.UIButton["delete"] = linpg.load_button_with_text_in_center(
"Assets/image/UI/menu.png", linpg.get_lang("Global", "delete"), "black", font_size, (UI_x, UI_y), 100
self.UIButton["delete"] = linpg.load.button_with_text_in_center(
"Assets/image/UI/menu.png", linpg.lang.get_text("Global", "delete"), "black", font_size, (UI_x, UI_y), 100
)
UI_x += self.UIButton["delete"].get_width()+font_size
self.UIButton["reload"] = linpg.load_button_with_text_in_center(
"Assets/image/UI/menu.png", linpg.get_lang("Global", "reload_file"), "black", font_size, (UI_x, UI_y), 100
self.UIButton["reload"] = linpg.load.button_with_text_in_center(
"Assets/image/UI/menu.png", linpg.lang.get_text("Global", "reload_file"), "black", font_size, (UI_x, UI_y), 100
)
#其他函数
self.UI_local_x = 0
Expand All @@ -162,19 +162,19 @@ def load(self, screen:linpg.ImageSurface, chapterType:str, chapterId:int, projec
#用于储存即将发下的物品的具体参数
self.data_to_edit = None
#读取地图原始文件
self.originalData = linpg.load_config(self.get_map_file_location())
self.originalData = linpg.config.load(self.get_map_file_location())
#将地图制作器的界面画到屏幕上
def draw(self, screen:linpg.ImageSurface) -> None:
mouse_x,mouse_y = linpg.controller.get_mouse_pos()
block_get_click = self.MAP.calBlockInMap(mouse_x,mouse_y)
for event in linpg.controller.events:
if event.type == linpg.KEY.DOWN:
if event.key == linpg.KEY.ESCAPE:
if event.type == linpg.key.DOWN:
if event.key == linpg.key.ESCAPE:
self.object_to_put_down = None
self.data_to_edit = None
self.deleteMode = False
self._check_key_down(event)
elif event.type == linpg.KEY.UP:
elif event.type == linpg.key.UP:
self._check_key_up(event)
elif event.type == linpg.MOUSE_BUTTON_DOWN:
#上下滚轮-放大和缩小地图
Expand Down Expand Up @@ -206,7 +206,7 @@ def draw(self, screen:linpg.ImageSurface) -> None:
elif linpg.is_hover(self.UIButton["save"]) and self.object_to_put_down is None and not self.deleteMode:
self.save_progress()
elif linpg.is_hover(self.UIButton["back"]) and self.object_to_put_down is None and not self.deleteMode:
if linpg.load_config(self.get_map_file_location()) == self.originalData:
if linpg.config.load(self.get_map_file_location()) == self.originalData:
self.stop()
break
else:
Expand All @@ -218,15 +218,15 @@ def draw(self, screen:linpg.ImageSurface) -> None:
elif linpg.is_hover(self.UIButton["reload"]) and self.object_to_put_down is None and not self.deleteMode:
tempLocal_x,tempLocal_y = self.MAP.get_local_pos()
#读取地图数据
mapFileData = linpg.load_config(self.get_map_file_location())
mapFileData = linpg.config.load(self.get_map_file_location())
#初始化角色信息
self.__load_characters_data(mapFileData)
#加载地图
self._create_map(mapFileData)
del mapFileData
self.MAP.setPos(tempLocal_x,tempLocal_y)
self.MAP.set_local_pos(tempLocal_x, tempLocal_y)
#读取地图
self.originalData = linpg.load_config(self.get_map_file_location())
self.originalData = linpg.config.load(self.get_map_file_location())
else:
if linpg.controller.get_event("confirm") and block_get_click is not None and self.object_to_put_down is not None and\
not linpg.is_hover(self.__UIContainerRight,off_set_x=self.__UIContainerButtonRight.right) and\
Expand Down
Loading

0 comments on commit a65b349

Please sign in to comment.