Git Product home page Git Product logo

richtext's Introduction


设计目的

  1. 在同一个material中支持图文混排,这样可以有效的降低draw call数目
  2. 支持血条:当场景中人物数量较多的时候,由于人物移动相对频繁,血条的draw call数以及由此引起的panel rebuild可能会成为性能瓶颈

测试案例

  1. 大规模图文混排测试:
    1. 可以看到,当图文在一个material中时,draw call数还是很低的;
    2. 当使用到不同material中的texture时,可以考虑将它们放置到同一个canvas下的不同子节点下面,这样不同的子节点(含子节点下的图文结点)之间的绘制顺序由transform的顺序保证;

使用到的测试用例,结点结构如下:

DrawCall测试布局

从图中也可以看到,水果图标的节点总是在小黑猫(默认图标)节点的后面绘制,从而在结构上保证了drawcall数较低。

DrawCall测试

  1. 血条测试用例:

使用的测试文本如下:

<quad name=foreground src=emoji/bloodbar width=96 height=12 />
<color=lime>这里是头顶的字</color>
<color=#ffa500ff>颜色支持#ffa500ff格式,支持透明度</color>
<b>这一行字是粗的</b>
<i>这一行字是斜的</i>
<size=24>这一行字是大的</size>

效果如图:

头顶血条测试


测试平台

mac os + Unity3d 2017.1.0f3 (64bit)

由于unity3d的场景文件(.unity)在不同的版本间结构改动很大,因此使用其它版本的unity3d打开测试工程的时候可能会打不开。

代码本身最早设计是在Unity3d 5.4.3p1中进行的,因此从代码本身的兼容性上,从5.4 ~ 2017.01应该是没有问题的


references

  1. Unity3D游戏优化之头顶UI
  2. RichText
  3. Unity UGUI图文混排
  4. Unity-EmojiText

richtext's People

Contributors

lixianmin avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

richtext's Issues

图文混排时图片偏移和文字重叠

你好,看了这个插件,在降DC方面的确很不错,但是在图文混合的时候,发生了图与文字重叠的问题,像是图的宽度没有留够的问题

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.