摘要:
Rect内部使用m_XMin, m_YMin, m_Width, m_Height存放数据,即:左下角+宽高 1) 设置xMin, xMax时,宽度m_Width会被修改 设置xMin时,认为是只有左侧在动, 右侧是不动的; 左侧往左则m_Width变大, 左侧往右则m_Width变小 设置xMax 阅读全文
摘要:
主要涉及到的类 看到最多的就是EventSystem这个自动添加的GameObject 代码阅读要点 1) 事件系统做了什么? 在Update中不断的检测这一帧发生的输入事件,并根据输入事件解析出当前在进行的操作。 所以,所有的逻辑都是在EventSystem.Update中发生的。Standalo 阅读全文
摘要:
主要的代码: public static readonly Vector2[] s_VertScratch = new Vector2[4]; public static readonly Vector2[] s_UVScratch = new Vector2[4]; private void Ge 阅读全文
摘要:
function Test(num, nDigits) local multi = 10 ^ nDigits --10的n次方 local num1 = math.floor(num * multi) local ret = num1 / multi return ret end 百分比保留1位小数 阅读全文
摘要:
#if UNITY_EDITOR using System; using System.IO; using UnityEditor; using UnityEngine; public static class SpriteTool { // OpenDirAfterExport const str 阅读全文
摘要:
最终效果,左侧为ugui的,右侧为自己实现的 using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; public class MyText : Graphic { public Font m_Font; 阅读全文
摘要:
效果,左侧为ugui的,右侧为自己实现的 using UnityEngine; using UnityEngine.UI; public class MyText : Graphic { public Font m_Font; public string m_Text = ""; public in 阅读全文
摘要:
最终效果 就简简单单一个利用Font把文本渲染出来 using UnityEngine; using UnityEngine.UI; public class MyText : Graphic { public Font m_Font; public string m_Text = "Hellow 阅读全文
摘要:
Dynamic字符 1) ttf字体默认是Dynamic的,就是用到什么字符,运行时渲染对应的字符到字体贴图上 比如:Text组件上的New Text,在运行起来后字体贴图就渲染了NewText上去 2) 使用Font.GetCharacterInfo来获取字符信息 //不传fontSize参数, 阅读全文
摘要:
string str = "abc key=\"hello\" key2=test key3= key4=\"\""; string pattern = @"(\S+)=""?([\w-.]+)""?"; //键值对正则表达式 MatchCollection result = Regex.Match 阅读全文