This file contains hidden or 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
function wrap_text(content,max_count) | |
local lines={''}local wcount=0 | |
for i=1,#content do | |
local c=sub(content,i,i) | |
lines[#lines]..=c | |
wcount+=1 | |
if (wcount>=max_count) | |
then | |
wcount=0 | |
lines[#lines]..='\n' |
This file contains hidden or 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
float rect(vec2 uv, vec2 size) { | |
float blur = 0.000; | |
// 让 size 成正比 | |
size = 0.5 - size * 0.5; | |
// 先画一边 | |
vec2 r = vec2(step(size.x, uv.x), step(size.y, uv.y)); | |
// 再画相反的边,相乘得出相交位置就是对应的矩形 | |
r *= vec2(step(size.x, 1.0 - uv.x), step(size.y, 1.0 - uv.y)); | |
// x 和 y 相乘得出矩形的像素点值 | |
return r.x * r.y; |
This file contains hidden or 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
extends Node | |
class_name ArrayUtils | |
static func filter(arr: Array, prop: Dictionary) -> Array: | |
var res = [] | |
for item in arr: | |
for key in prop.keys(): | |
if prop[key] is Array and item[key] in prop[key]: | |
res.push_back(item) | |
elif (!prop[key] is Array) and prop[key] == item[key]: |
This file contains hidden or 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
import dayjs, { Dayjs } from 'dayjs'; | |
import { get } from 'lodash'; | |
type FormatOptions = { | |
reliable: boolean; | |
}; | |
type BaseSchemaField = { | |
type: SchemaFieldType; | |
source?: ((parentSourceData: any, rootSourceData: any) => any) | string; |
OlderNewer