Laya bitmap text, highlight text, photo-text

Test version: Laya 2.1.1.1

 

Bitmap text

Egret bitmap text is produced by TextureMerger, then use exml years.

Laya is used directly FontClip components.

In edit mode, right-level window, select the components to create a UI, select FontClip

 

The bitmap is assigned to the text of Fine Arts offers Properties panel FontClip skin, so that is a bitmap text. To convenient than egrets.

 

 

 

Highlight text 

Highlight the text style of text egret

tx.textFlow = <Array<egret.ITextElement>>[
    {text: "花费", style: {"textColor": 0x0000}}
    , {text: "100", style: {"textColor": 0xf1e81b}}
    , {text: " 金币", style: {"textColor": 0x0000}}
    }
];

laya is not in, found the next need to use HTMLDivElement.

var p = new HTMLDivElement();

After using error

 

 

 In edit mode F9, increased html library

 

 

 

Retries error. . .

 

Re-download the latest engine laya2.20beta4, still error

According laya.html.js then copy the file https://ask.layabox.com/question/43974 forum is still being given

 

No solution. Finally, do not create the code, but to create a HTMLDivElement directly in the scene is not being given.

 

Ultimately code and performance

public p:laya.html.dom.HTMLDivElement;

 

this.p.innerHTML = "<span style='color:#ffffff'>花费</span><span style='color:#f1e81b'>100</span><span style='color:#ffffff'>金币</span>";

 

 

 

 

Photo-text

Egret did not provide tutorials

 

laya there is a tutorial: https: //ldc.layabox.com/doc/ nav = zh-as-6-1-0?

 

 

 

 

General principle

1. In the input box "Hello, everyone! Nice to meet you! @ @ 1", "@ @ 1" as the expression of a code.

2. Get input box string, global search "@ 1 @" symbol into the face emoticon <img> tag.

3. HTMLDivElement string assigned to innerHTML display assembly.

 

 

 

Error. Because the demo version 1.x is. This version 2.0 there may be a problem this method. Forum search solution failed, ah, real trouble.

 

Guess you like

Origin www.cnblogs.com/gamedaybyday/p/11498447.html