- 博客(12)
- 收藏
- 关注
原创 字符创中的正则
// match的使用 var str = "abc:123,def:456,ghi:789"; //把里面所有的数字全部显示出来 var arr = str.match(/\d{3}/g); // g 表示的是全局模式匹配 console.log(arr); // ["123", "456", "789"] RegExp.$ 的使用 var email="1...
2020-02-02 15:48:17 132
原创 正则创建方式和邮箱规则
// 创建方式一 var reg = new RegExp(/\d{5}/); var res = reg.test("abcd12121"); console.log(res); // true // 创建方式二 // 以字母开头1-多个 数字结束1-多个 var pattern = /^[a-z]+[0-9]+$/; console.log(p...
2020-02-02 12:44:47 136
原创 通过bind改变this指向
function One(x,y) { console.log(this.age); // 100 console.log(this); // bind改变了this的指向 console.log(x+y); // 30 } function Two() { this.age=100; } var f2=new Two...
2020-02-01 20:40:37 785
原创 缓动动画函数
// 点击到 400 my$("btn1").onclick = function() { animate(my$("dv"), 400); }; // 点击到 800 my$("btn2").onclick = function() { animate(my$("dv"), 800); }; function animate(...
2020-02-01 20:24:35 132
原创 apply和call改变this的指向
function Person(name) { this.name = name; } Person.prototype.say = function(x, y) { console.log(this); this.study() // Student原型对象中方法 console.log(this.name); return x + y; } ...
2020-02-01 19:57:03 107
原创 AssetBundle资源加载
一、第一种加载方式本地相对路径资源加载 AssetBundle ab = AssetBundle.LoadFromFile("AssetBundle/sphere.unity3d"); // 本地加载相对路径加载 加载ab包 GameObject cube = ab.LoadAsset<GameObject>("Sphere"); // 获取AB包 Instantiate(cube);...
2018-07-18 21:52:43 716
原创 AssetBund简单打包
[MenuItem("AssetBundle/CreateAssetBundle")] static void CreateAssetBundle() { string path = "AssetBundle"; // 设置路径 if(!Directory.Exists(path)) // 判断目录是否存在 { ...
2018-07-18 21:22:34 140
原创 Lua 排序
local table_nums = {2,3,1,5,4,6 ,10,8}table.sort(table_nums)for k,v in pairs(table_nums) do print(v)end
2018-04-17 18:41:33 369
原创 TCP_Socket
// 服务器 public static void Server() { // 创建监听对象 TcpListener tcpListener = new TcpListener(IPAddress.Parse("127.0.0.1"), 30005); // 开始监听 tcpList...
2018-03-12 22:22:40 150
原创 UGUI动态添加Button点击事件
// 第一种方式 void Start() { Button button = GameObject.Find("Button").GetComponent<Button>(); button.onClick.AddListener(delegate () { ButtonOnClick(); });...
2018-03-02 17:49:33 630
原创 在不继承MonoBehaviour的情况下单利的实现单利
public class Ins{ private static Ins instance = null; public static Game Instance { get { if (instance == null) { instance = new Game (); ...
2018-03-02 15:41:13 494
原创 NGUI UIButton动态绑定事件
// 第一种方式 void Start() { UIButton button = transform.Find("Button").GetComponent<UIButton>(); EventDelegate Env = new EventDelegate(this, "OnClick"); button.onClick.Add(E...
2018-03-01 23:47:45 1302
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人