Skip to content

Commit

Permalink
Fix bug, add features
Browse files Browse the repository at this point in the history
  • Loading branch information
cth-inni committed Sep 3, 2021
1 parent 64bff04 commit 84369ef
Show file tree
Hide file tree
Showing 17 changed files with 409 additions and 108 deletions.
45 changes: 22 additions & 23 deletions TODO.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,32 +18,31 @@
- [x] dev tutorial (with sample)
- [x] allow easy mode use first line as main cast
## Aug 2021
- [] default narrator ['Narrator','narrator','系统','旁白'];
- [] default colon [':',':'];
- [] replace --- with _ADVANCE_
- [] custom setBreakPoint('_EMANYAN_')
- [] reverse stories & setting template
- [] Allow @, # in string
- [] Added rawscript (will toggle)
- [] Fix p, h1-h6 container
- [] Allow adjust head size
- [] Allow show unformatted line as warning messages (only works when single colon as index)
- [] Allow fork script
- []
- []
- [] Allow export as json
- [] rawscriptquote:5-10 (allow include the script in certainline)
- [] Fork this script
- [] navigation link button
- [x] default narrator ['Narrator','narrator','系统','旁白'];
- [x] default colon [':',':'];
- [x] replace --- with _ADVANCE_
- [x] custom setBreakPoint('_I_LOVE_EMANYAN_')
- [x] setting template
- [x] Allow @, # in string
- [x] Added rawscript (will toggle use site class)
- [x] Fix p, h1-h6 container
- [x] Allow adjust head size
- [x] Show once header if the lines belongs to same person
- [x] Allow show unformatted line as warning messages (only works when single colon as index)
- [x] Allow export as json
- [x] showCasts()

# version 2 roadmap
- [] global setting before render
- [] reverse stories (switch lines to major based on header)
- [] rawscriptquote:5-10 (allow include the script in certainline)
- [] Fork this script (button only, default false)
- [] Allow fork script (editor)
- [] action button
- [] link button
- [] Invalid Image handle
- [] default head image for minor casts (assign a random background color)
- [] JS editor (shortcut & preview)
- [] export format (txt,json,csv,custom)



# refer
对话里面,如果有这种卡片效果的插图,会打扰阅读体验吗?
https://codepen.io/nicolaspavlotsky/pen/wqGgLO?editors=1100
# resources
[profile card](https://codepen.io/nicolaspavlotsky/pen/wqGgLO?editors=1100)
15 changes: 12 additions & 3 deletions demo.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,23 +67,32 @@
case '106':
$sample = file_get_contents('./sample/test.raw.txt');
break;
case '107':
$sample = file_get_contents('./sample/story.2.1.txt');
break;
}
//
// $cui = new ChatUI([
// ....
// ]);
// $cui->setDefaultChatImgHeader('/img/path.ext');
// start from here
$cui = new ChatUI();
// $cui = new ChatUI();
$cui = new ChatUI([
'chatHeaderSize' => 'large' // default:normal,small,large
]);
// echo '<pre>';
// var_dump($cui->settings->chatHeaderSize);
// die();
// Setting
// $cui->setColon([':',':']);
$cui->setColon(['']);
$cui->setNarrator(['Narrator','narrator','系统','旁白']);
$cui->setBreakPoint('_EMANYAN_');
$cui->setBreakPoint('_I_LOVE_EMANYAN_');
echo sprintf('<style>%s</style>', $cui->renderCss());
$cui->feed($sample);
echo $cui->showCasts(); // For header introduction, header button
echo $cui->showWarnings();
echo $cui->showCasts(); // For header introduction, header button
echo $cui->render();


Expand Down
5 changes: 4 additions & 1 deletion json.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,16 @@
case '106':
$sample = file_get_contents('./sample/test.raw.txt');
break;
case '107':
$sample = file_get_contents('./sample/story.2.1.txt');
break;
}
//
header('Content-Type: application/json'); // <-- header declaration
$cui = new ChatUI();
$cui->setColon(['']);
$cui->setNarrator(['Narrator','narrator','系统','旁白']);
$cui->setBreakPoint('_EMANYAN_');
$cui->setBreakPoint('_I_LOVE_EMANYAN_');
$cui->feed($sample);
echo $cui->json();
?>
2 changes: 1 addition & 1 deletion sample/emanyan.1.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
程式猿:好啊!
rawscript:

_EMANYAN_
_I_LOVE_EMANYAN_

程式猿@https://www.itsfun.com.tw/images/da/f5/nBnaugjNkVzN5UTM5AjZ2YjMilTMwQ3Lt92Yuc2cthWcuw2cz5SMw9yL6MHc0RHa.jpg
色长@https://cdn.emanyan.com/uploads/author/thumbnail/e1b6dd94428bae0eaa06ad43bf6d879e70330c5f.adaptiveResize.100x100.jpg
2 changes: 1 addition & 1 deletion sample/sample.2.txt
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,6 @@ linebreak:
h1:以下显示的是原格式,大家可以参考写法等等。
rawscript:

_EMANYAN_
_I_LOVE_EMANYAN_
金主爸爸@//i.imgur.com/pW71NE5.jpeg
小漫@//i.imgur.com/Jvh1OQm.jpeg
2 changes: 1 addition & 1 deletion sample/sample.custom.colon.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ background://www.yummy-sounds.com/data/music/music/zoomplayer/2-0521_Lino_Rise
linebreak:
rawscript:

_EMANYAN_
_I_LOVE_EMANYAN_

妖猫@//i.imgur.com/Jvh1OQm.jpeg?color=blue
大蛇丸@//i.imgur.com/FEiFVeO.png?color=green
Expand Down
2 changes: 1 addition & 1 deletion sample/sample.stories.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ background://www.yummy-sounds.com/data/music/music/zoomplayer/2-0521_Lino_Rise
天狗:休想!
妖猫:狗兄!救命!

_EMANYAN_
_I_LOVE_EMANYAN_

妖猫@//i.imgur.com/Jvh1OQm.jpeg?color=blue
大蛇丸@//i.imgur.com/FEiFVeO.png?color=green
Expand Down
2 changes: 1 addition & 1 deletion sample/sample.txt
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ decision:I choose to walk=左边,中间,右边,上面,下面
linebreak:
rawscript:

_EMANYAN_
_I_LOVE_EMANYAN_

小康@//i.imgur.com/pW71NE5.jpeg?color=red
Eve@//i.imgur.com/Jvh1OQm.jpeg?color=blue
Expand Down
2 changes: 1 addition & 1 deletion sample/sep.1.txt
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ p:有什么意见和想法,请在留言区回馈。谢谢。

rawscript:

_EMANYAN_
_I_LOVE_EMANYAN_

程式猿@//www.itsfun.com.tw/images/da/f5/nBnaugjNkVzN5UTM5AjZ2YjMilTMwQ3Lt92Yuc2cthWcuw2cz5SMw9yL6MHc0RHa.jpg
色长@//data.tooliphone.net/iskin/themes/12969/8558/preview-256.png
Expand Down
2 changes: 1 addition & 1 deletion sample/sep.2.txt
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ imagecard://upload.wikimedia.org/wikipedia/commons/b/bf/Twistee_Treat_~_Minden
编剧:正当众人准备往前冲的时候,突然一只穿着人衣的猩猩跳了出来。
程式猿:还好,我赶上了。

_EMANYAN_
_I_LOVE_EMANYAN_

程式猿@//www.itsfun.com.tw/images/da/f5/nBnaugjNkVzN5UTM5AjZ2YjMilTMwQ3Lt92Yuc2cthWcuw2cz5SMw9yL6MHc0RHa.jpg
色长@//cdn.emanyan.com/uploads/author/thumbnail/e1b6dd94428bae0eaa06ad43bf6d879e70330c5f.adaptiveResize.100x100.jpg
Expand Down
2 changes: 1 addition & 1 deletion sample/starter.template.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ narrator:滋滋滋滋
天狗:休想!
妖猫:狗兄!救命!

_EMANYAN_
_I_LOVE_EMANYAN_

妖猫@//i.imgur.com/Jvh1OQm.jpeg?color=blue
大蛇丸@//i.imgur.com/FEiFVeO.png?color=green
Expand Down
57 changes: 57 additions & 0 deletions sample/story.2.1.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
国泰产险:师兄好,我们是国泰产险
国师:您好,我也很想去泰国产检
国泰产险:是国泰不是泰国
国师:所以是秦国还是泰国?
国泰产险:算了,你高兴就好

linebreak:
reflink://www.facebook.com/media/set/?vanity=TigerblueStory&set=a.983834672190261
linebreak:

国泰产险:师兄有没有听过一句话,叫马路如虎口?
太白:有,但我觉得不太像虎口啊
image://lh3.googleusercontent.com/proxy/S7BG3QKTKCLrLY_JNn6PoZk0F8xIsSOHNsYkHpdWLCY28KBVGB0nTtgIqvWCFKsiRU3pXM7d22e4iwALBzaU7qvdiVIrud-1BLhmbX7lMerPrm9NWvQBjUK06LY
国泰产险:我们不是付钱来听烂梗的

linebreak:

国泰产险:这次想合作的是国泰车险
国泰产险:在我们的官网线上办理,五分钟便可完成投保
国泰产险:不用出门就能保完车险
娘娘:不出门干嘛保车险?
娘娘:难道在家也会出车祸?
国泰产险:以你的个性我很难保证

linebreak:

银桑:我阿嫲有时候会用轮椅撞我
银桑:这个可以保吗?
国泰产险:不行,你活该
银桑:不然我妈用遥控车叫我起床可以保吗?
国泰产险:这有什么好保的?
image://scontent.fkul2-2.fna.fbcdn.net/v/t1.6435-9/240676598_983833348857060_8241157138212914974_n.jpg?_nc_cat=101&ccb=1-5&_nc_sid=0debeb&_nc_ohc=Z6i6SJFxOOAAX8NkG23&tn=hF45RJXRcFHR0mBb&_nc_ht=scontent.fkul2-2.fna&oh=c8c52078a8c5547a5dcd5184fbad4f28&oe=61551267

linebreak:

国泰产险:除了强制险,我们也推荐第三人责任险
金主爸爸:这个我知道
国泰产险:你才不知道
金主爸爸:这是防小三用的
国泰产险:我就知道你不知道
金主爸爸:还不是我告诉你你才知道的
narrator:到底有什么好跩的?

linebreak:

小沫:滚,我心里已经有别人了
嘻嘻:是我吗?
小沫:当然不是
嘻嘻:( •̀ ω •́ )y 我在你心里不是别人
小沫:你在我心里简直不是人
嘻嘻:( •̀ ω •́ )y 我在你心里
narrator:偷放闪一下,大家不要介意

linebreak:

narrator:原文来自 www.facebook.com/media/set/?vanity=TigerblueStory&set=a.983834672190261

Loading

0 comments on commit 84369ef

Please sign in to comment.