Giter Site home page Giter Site logo

danddxuanx / trpg-replay-generator Goto Github PK

View Code? Open in Web Editor NEW
138.0 138.0 23.0 61.17 MB

回声工坊:像编写文档一样简单地创作跑团replay视频

License: GNU General Public License v3.0

Python 99.96% PowerShell 0.04%
pygame python trpg trpg-tool video-production

trpg-replay-generator's People

Contributors

changingself avatar danddxuanx avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

trpg-replay-generator's Issues

关于内建动画插件系统的构想

看了一下最新的代码(alpha 1.15.16)中replay_generator.py的内建动画部分,逻辑大概是:

  1. 检查是否为内建动画行(elif text[0:11] == '<hitpoint>:'以及elif text[0:7] == '<dice>:'
  2. 用正则表达式读取参数
  3. 经过一系列处理,得到对应内建动画的this_timeline(本小节的timeline文件),并将其并入render_timeline,以及将内建动画类初始化的代码(code_to_run_x)加入media_list当中

第三步的处理代码可以提取到BuiltInAnimation的子类当中,每一个内建动画子类都继承自BuiltInAnimation,子类只需要编写一个返回this_timeline以及需要加入media_list的初始化代码的列表(code_to_run_list)的函数即可

而第一步和第二步也可以简化,在parser函数的else分支中(此时已经检查过不是任何其他类型的行)

  1. 遍历一个存储着内建动画行正则表达式(带参数捕获分组)的字典的values(key为内建动画子类名,value为regex)
  2. 检查的同时获取参数(海象运算符配合match函数)
  3. 初始化内建动画子类,调用其函数获取this_timelinecode_to_run_list
  4. code_to_run_list加入media_list,将this_timeline并入render_timeline

提取出来之后,想要写一个新的内建动画的步骤就比较简单了:

  1. 写一个BuiltInAnimation的子类
  2. 覆写父类中的返回this_timeline以及需要加入media_list的初始化代码的列表(code_to_run_list)的函数
  3. 在存储着内建动画行正则表达式(带参数捕获分组)的字典中添加该内建动画的类名及其正则表达式

想要弄预设动画插件的话,就可以从某个指定的文件夹中的py文件中读取写好的BuiltInAnimation子类及其正则表达式

不弄插件的话,也可以更方便后面添加其他的预设动画

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.