1 Star 8 Fork 0

yanji255 / desktop_pet

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
MIT

桌面宠物 (desktop_pet)

下载体验

桌面宠物是基于PyQt5开发的PC应用.宠物会移动, 做动作, 还可以切换角色. 你也可以自定义角色与动作

效果展示

自定义角色与动作

  • 配置均采用JSON格式

  • 所有可用角色的列表配置文件: 根目录/res/pets.json

  • 一个角色所有的资源与配置文件在根目录/res/role下, 文件夹名称为角色名, 与 根目录/res/pets.json中的名字相同

例: 蓝忘机目录为 根目录/res/role/蓝忘机 
并加这个名字添加到 根目录/res/pets.json 中
  • 角色目录下, action 目录为角色的动作图片, 存放编号的角色动作图片. act_conf.json 为动作配置文件. pet_conf.json为宠物配置图片
例: 魏无羡/action 放了角色从0编号的45张图
act_conf.json 定义了不同种类的图片
pet_conf.json 定义了角色展示的动作
  • act_conf.json key 为动作名称, value是动作对象, 相关属性如下
字段名 类型 是否必填 含义 示例
images Array 动作包含的图片, [开始图片编号, 结束图片编号] 魏无羡左移动作8, 9, 10 共3张图片, 则配置"images": [8, 10]
act_num Number 动作执行次数, 默认1次 魏无羡下落动作, 图片7, 执行10次, 配置: "act_num": 10
need_move Boolean 动作图片是否需要移动, 默认false 魏无羡left动作, "need_move": true
direction String need_move 为 true 时, 必填 移动方向, 上下左右, left, right, up, down 魏无羡left动作, "direction": "left"
frame_move Number 图片单帧移动距离, 默认10 魏无羡下落动作, "frame_move": 30
frame_refresh Number 单张图片刷新时间, 默认0.04 魏无羡下落动作, "frame_refresh": 0.1
  • pet_conf.json key 为属性名称, value是 act_conf.json 中的key, 相关属性如下
字段名 类型 是否必填 含义 示例
random_act Array 随机动作数组, 二维数组, 内部每个数组对象包含act_conf.json配置下的多个动作 魏无羡随机动作数组 "random_act": [["right", "up", "down", "left", "pose2"]]
default String 默认动作 魏无羡默认动作, "default": "default"
up String 上移动作 魏无羡上移动作, "up": "up"
down String 下移动作 魏无羡下移动作, "down": "down"
left String 左移动作 魏无羡下移动作, "left": "left"
right String 右移动作 魏无羡下移动作, "right": "right"
size Number 窗口大小, 默认128 配置窗口500, "size": 500
refresh Number 动作刷新频率, 默认5000 1秒刷新1次, "refresh": 1000

技术实现简介

  • 基于PyQt5开发, 一个无边框, 半透明, 永远置顶的窗口, 展示图片
  • 图片连续切换为静态动作, 图片切换的同时移动窗体为移动动作
  • 鼠标事件(按下, 移动, 抬起)实现拖拽
  • 添加右键菜单与最小化菜单
MIT License Copyright (c) 2022 yanji255 Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

简介

PyQt5实现的桌面宠物 展开 收起
Python
MIT
取消

发行版 (2)

全部

贡献者

全部

近期动态

加载更多
不能加载更多了
Python
1
https://gitee.com/yanji255/desktop_pet.git
git@gitee.com:yanji255/desktop_pet.git
yanji255
desktop_pet
desktop_pet
master

搜索帮助