-
Notifications
You must be signed in to change notification settings - Fork 115
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
插件的第一个版本
- Loading branch information
0 parents
commit 0f7ac49
Showing
39 changed files
with
1,977 additions
and
0 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
<?php | ||
/** | ||
* 一个简易的 Live2D 插件,建立在 <a href="https://github.com/journey-ad/live2d_src">@Jad</a> 的项目上 | ||
* | ||
* @package Pio | ||
* @author Dreamer-Paul | ||
* @version 1.0 | ||
* @link https://paugram.com | ||
*/ | ||
|
||
class Pio_Plugin implements Typecho_Plugin_Interface{ | ||
|
||
/* 激活插件方法 */ | ||
public static function activate(){ | ||
Typecho_Plugin::factory('Widget_Archive')->header = array('Pio_Plugin', 'header'); | ||
Typecho_Plugin::factory('Widget_Archive')->footer = array('Pio_Plugin', 'footer'); | ||
} | ||
|
||
/* 禁用插件方法 */ | ||
public static function deactivate(){} | ||
|
||
/* 插件配置方法 */ | ||
public static function config(Typecho_Widget_Helper_Form $form){ | ||
$custom_model = new Typecho_Widget_Helper_Form_Element_Text('custom_model', NULL, NULL, _t('自定义配置文件地址'), _t('在这里填入一个模型 JSON 配置文件地址,可供更换模型,不填则使用默认配置文件')); | ||
$form->addInput($custom_model); | ||
} | ||
|
||
/* 个人用户的配置方法 */ | ||
public static function personalConfig(Typecho_Widget_Helper_Form $form){} | ||
|
||
/* 插件实现方法 */ | ||
public static function header(){ | ||
echo "<style>#pio{ left: 0; bottom: 0; position: fixed; pointer-events: none; } @media screen and (max-width: 768px){ #pio{ width: 8em; } }</style>"; | ||
} | ||
public static function footer(){ | ||
$ppd = Helper::options()->pluginUrl; | ||
|
||
echo "<canvas id='pio' width='280' height='250'></canvas>"; | ||
echo "<script src='" . $ppd . "/Pio/l2d.js'></script>" . "\n"; | ||
|
||
if(Typecho_Widget::widget('Widget_Options')->Plugin('Pio')->custom_model){ | ||
echo "<script>loadlive2d('pio', '" . Typecho_Widget::widget('Widget_Options')->Plugin('Pio')->custom_model . "');</script>". "\n"; | ||
} | ||
else{ | ||
echo "<script>loadlive2d('pio', '" . $ppd . "/Pio/model.json');</script>". "\n"; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# Pio | ||
一个简易的 Live2D 插件,供 Typecho 使用。 | ||
|
||
## 使用方法 | ||
1. Star 本项目 | ||
2. Clone 本项目 | ||
3. 将插件文件夹重命名为 `Pio` | ||
4. 上传本插件,并放置在 `usr/plugins/` 目录下 | ||
5. 登录你的 Typecho 后台,并进行安装即可食用~ | ||
6. 如果你有自己的模型,可以在插件设置更改,默认名称应该为 `model.json` | ||
|
||
## 项目故事 | ||
自 [Jad](https://github.com/journey-ad) 发了一篇关于 Live2D 的教程之后,看到各位大佬的博客逐渐增加了这个小挂件。我一直盼望自己的博客也增加一个,而之前一直想找个机会试水一下 Typecho 的插件开发,于是今天就抽时间做出来了。 | ||
|
||
目前本插件不存在任何依赖的样式和库。在新版本当中我会逐渐实现一些交互功能,而不需要任何的库。 | ||
|
||
## 开源协议 | ||
由于原项目使用 GPL 2.0 协议,故本项目也采用相同的开源协议进行授权。 | ||
|
||
原创不易!如果喜欢本项目,请 Star 它以示对我的支持~ | ||
|
||
同时欢迎前往 [我的博客](https://paugram.com/about.html#donate) 为我提供赞助,谢谢您! | ||
|
||
## 使用的开源项目 | ||
- [Live2D-Src](https://github.com/journey-ad/live2d_src) |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
{ | ||
"version":"1.0.0", | ||
"model":"model.moc", | ||
"textures":[ | ||
"textures/default-costume.png", | ||
"textures/pajamas-costume.png", | ||
"textures/school-costume.png" | ||
], | ||
"layout":{ | ||
"center_x":0.0, | ||
"center_y":-0.05, | ||
"width":2.0 | ||
}, | ||
"hit_areas_custom":{ | ||
"head_x":[-0.35, 0.6], | ||
"head_y":[0.19, -0.2], | ||
"body_x":[-0.3, -0.25], | ||
"body_y":[0.3, -0.9] | ||
}, | ||
"motions":{ | ||
"idle":[ | ||
{"file":"motions/WakeUp.mtn"}, | ||
{"file":"motions/Breath1.mtn"}, | ||
{"file":"motions/Breath2.mtn"}, | ||
{"file":"motions/Breath3.mtn"}, | ||
{"file":"motions/Breath5.mtn"}, | ||
{"file":"motions/Breath7.mtn"}, | ||
{"file":"motions/Breath8.mtn"} | ||
], | ||
"sleepy":[ | ||
{"file":"motions/Sleeping.mtn"} | ||
], | ||
"flick_head":[ | ||
{"file":"motions/Touch Dere1.mtn"}, | ||
{"file":"motions/Touch Dere2.mtn"}, | ||
{"file":"motions/Touch Dere3.mtn"}, | ||
{"file":"motions/Touch Dere4.mtn"}, | ||
{"file":"motions/Touch Dere5.mtn"}, | ||
{"file":"motions/Touch Dere6.mtn"} | ||
], | ||
"tap_body":[ | ||
{"file":"motions/Touch1.mtn"}, | ||
{"file":"motions/Touch2.mtn"}, | ||
{"file":"motions/Touch3.mtn"}, | ||
{"file":"motions/Touch4.mtn"}, | ||
{"file":"motions/Touch5.mtn"}, | ||
{"file":"motions/Touch6.mtn"} | ||
], | ||
"":[ | ||
{"file":"motions/Breath1.mtn"}, | ||
{"file":"motions/Breath2.mtn"}, | ||
{"file":"motions/Breath3.mtn"}, | ||
{"file":"motions/Breath4.mtn"}, | ||
{"file":"motions/Breath5.mtn"}, | ||
{"file":"motions/Breath6.mtn"}, | ||
{"file":"motions/Breath7.mtn"}, | ||
{"file":"motions/Breath8.mtn"}, | ||
{"file":"motions/Fail.mtn"}, | ||
{"file":"motions/Sleeping.mtn"}, | ||
{"file":"motions/Success.mtn"}, | ||
{"file":"motions/Sukebei1.mtn"}, | ||
{"file":"motions/Sukebei2.mtn"}, | ||
{"file":"motions/Sukebei3.mtn"}, | ||
{"file":"motions/Touch Dere1.mtn"}, | ||
{"file":"motions/Touch Dere2.mtn"}, | ||
{"file":"motions/Touch Dere3.mtn"}, | ||
{"file":"motions/Touch Dere4.mtn"}, | ||
{"file":"motions/Touch Dere5.mtn"}, | ||
{"file":"motions/Touch Dere6.mtn"}, | ||
{"file":"motions/Touch1.mtn"}, | ||
{"file":"motions/Touch2.mtn"}, | ||
{"file":"motions/Touch3.mtn"}, | ||
{"file":"motions/Touch4.mtn"}, | ||
{"file":"motions/Touch5.mtn"}, | ||
{"file":"motions/Touch6.mtn"}, | ||
{"file":"motions/WakeUp.mtn"} | ||
] | ||
} | ||
} |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.