摘要: 类似下面这样的层级结构,白色区域为ScrollView可见区域,RectMask2D添加在ScrollView上。 可以看到Canvas下的Image1没被裁剪掉,不在Canvas下的Image2裁剪掉了。 【原因分析】 RectMask2D内部有一个裁剪对象列表,只有在这个列表中的对象才会被裁剪, 阅读全文
posted @ 2021-12-23 01:38 yanghui01 阅读(1259) 评论(0) 推荐(2)
摘要: TestAsset.cs 1 [CreateAssetMenu(menuName = "My/Test Asset")] 2 public class TestAsset : ScriptableObject 3 { 4 public List<TestAssetItem> list; 5 } Te 阅读全文
posted @ 2021-12-21 00:10 yanghui01 阅读(828) 评论(0) 推荐(0)
摘要: GUI.enabled的使用 1 public override void OnInspectorGUI() 2 { 3 GUILayout.Button("Button"); 4 EditorGUILayout.ToggleLeft("Toggle", true); 5 EditorGUILayo 阅读全文
posted @ 2021-12-17 23:33 yanghui01 阅读(312) 评论(0) 推荐(0)
摘要: 1 private SearchField _searchField; 2 private string _searchText; 3 private ReorderableList _choicesList; 4 private List<string> _allListItems; 5 6 pu 阅读全文
posted @ 2021-12-17 23:25 yanghui01 阅读(159) 评论(0) 推荐(0)
摘要: 内嵌函数可以访问外包函数的局部变量,而这些局部变量则称为该内嵌函数的外部局部变量(或者upvalue) 1 function A(n) 2 3 function A_1() --n就是这个内嵌函数的upvalue 4 print(n) 5 end 6 7 return A_1 8 end 9 10 阅读全文
posted @ 2021-12-17 22:05 yanghui01 阅读(284) 评论(0) 推荐(0)
摘要: 【find实现字符串分割】 # 只支持ascii字符,不支持中文这种 function Split(str, delimiter) local arr = {} local index = 1 while true do local index1, index2 = string.find(str, 阅读全文
posted @ 2021-12-04 00:40 yanghui01 阅读(279) 评论(0) 推荐(0)
摘要: 【lua的匹配模式可以看做是功能不完整的正则表达式,只实现了大部分】 使用过程中,遇到的不支持的功能: # 分组匹配多次, 比如: abcabc, 无法用(abc)+匹配到 # 匹配次数范围, 比如: a{1,3}这种, 最少匹配1次,最多匹配3次 【可以使用匹配模式的函数】 # string.fi 阅读全文
posted @ 2021-11-13 23:20 yanghui01 阅读(1071) 评论(0) 推荐(0)
摘要: 1 --常见字符串功能 2 local function Test1() 3 --大小写 4 assert("AA" == string.upper("aa")) 5 assert("aa" == string.lower("AA")) 6 7 --字符串长度 8 assert(2 == strin 阅读全文
posted @ 2021-11-13 21:06 yanghui01 阅读(131) 评论(0) 推荐(0)
摘要: 函数参照c#的StringBuilder 1 require "utf8Ext" 2 3 StringBuilder = StringBuilder or {} 4 5 function StringBuilder.new() 6 local inst = {} 7 8 local charBuff 阅读全文
posted @ 2021-11-12 01:03 yanghui01 阅读(131) 评论(0) 推荐(0)
摘要: 【关于unicode和utf-8】 # unicode字符集,包含了全世界的字符,然而它只是规定了字符的二进制编码,并没有规定二级制编码是如何存储的。utf-8就是unicode的一个实现方式,就是怎么存储和读取这个unicode二进制编码。 就像一张jpg图片,我们可以选择直接存放在硬盘上,也可以 阅读全文
posted @ 2021-11-12 00:58 yanghui01 阅读(1565) 评论(0) 推荐(0)