10 2016 档案

摘要:恢复内容开始 using UnityEngine; using System.Collections; public class Script1 : MonoBehaviour { public float movespeed; private Vector3 PresentPosition; pr 阅读全文
posted @ 2016-10-28 20:00 无畏先锋 阅读(150) 评论(0) 推荐(0) 编辑
摘要:using UnityEngine; using System.Collections; public class Script1 : MonoBehaviour { public float movespeed; private Vector3 PresentPosition; private V 阅读全文
posted @ 2016-10-28 19:58 无畏先锋 阅读(258) 评论(0) 推荐(0) 编辑
摘要:lua文件如下: print("ddhdhh")function login(username,pswd)if username =="ms" and pswd=="ms" thenprint('用户存在')return true;elseprint('用户不存在')return falseende 阅读全文
posted @ 2016-10-28 19:55 无畏先锋 阅读(796) 评论(0) 推荐(0) 编辑
摘要:using UnityEngine;using System.Collections;using LuaInterface;//引入lua接口public class MyHellowWorld : MonoBehaviour { //创建lua对象 LuaState lua; //string s 阅读全文
posted @ 2016-10-28 19:30 无畏先锋 阅读(2768) 评论(0) 推荐(0) 编辑
摘要:using UnityEngine;using System.Collections;public class MicPhoneScripts : MonoBehaviour{ private AudioSource audioSource; AudioClip clip; void Awake() 阅读全文
posted @ 2016-10-28 09:45 无畏先锋 阅读(1929) 评论(0) 推荐(0) 编辑
摘要:--男人类man = {name = "man",age=123}--继承空间man.__index=man--儿童类child= {}--继承setmetatable(child,man)print(child.age)yong= {}setmetatable(yong,man)child.age 阅读全文
posted @ 2016-10-27 21:50 无畏先锋 阅读(451) 评论(0) 推荐(0) 编辑
摘要:--使用table封装面向对象beauty={name = " "}--封装对象方法function beauty.init(self, name)print("十八年前的一天王小丫出生")self.name= nameend--一般使用下面这种形式function beauty:init( nam 阅读全文
posted @ 2016-10-27 21:49 无畏先锋 阅读(313) 评论(0) 推荐(0) 编辑
摘要:function SayHey(mag) for i = 1 , 3 doprint(mag)coroutine.yield()end end --创建携程(协同) coFunc= coroutine.create(SayHey)--查看携程状态print(coroutine.status(coFu 阅读全文
posted @ 2016-10-27 21:48 无畏先锋 阅读(1081) 评论(0) 推荐(0) 编辑
摘要:--require("6-Coroutine")--仅加载一次,并不执行,参数为文件名不加后缀--dofile("6-Coroutine.lua") --加载并执行,参数为文件名加后缀--SayHey("kkkk")x=10 --默认是全局变量 show= function()local x = 1 阅读全文
posted @ 2016-10-27 21:47 无畏先锋 阅读(1151) 评论(0) 推荐(0) 编辑
摘要:--...表示课可见参数function alert(...)t = {...}for k , v in pairs(t) doprint(v)endendalert ("你好吗",{"error","warning"}) 阅读全文
posted @ 2016-10-27 21:17 无畏先锋 阅读(1485) 评论(0) 推荐(0) 编辑
摘要:--函数--语法 function函数名(参数) end--参数 ...表示无限多个参数--返回值用return 可以有多个返回值function add(a,b)return a +b--bodyend--委托myadd= addevent= {}event.add = addprint(eve 阅读全文
posted @ 2016-10-27 21:14 无畏先锋 阅读(2088) 评论(0) 推荐(0) 编辑
摘要:--table的嵌套playerInfo = {[1]={160701,"Unity",33},[2]={160702,"Ios",32},[3]={160403,"H5",40},}print(playerInfo[1][2])--排序函数function mysort(x,y)return x 阅读全文
posted @ 2016-10-27 21:09 无畏先锋 阅读(1624) 评论(0) 推荐(0) 编辑
摘要:--ipairs和pairs的区别arr = {1,3,[5]=5,name="kaikai",age=12, 89}--arr[4]= 23--ipairs--ipairs仅仅遍历值 按照索引升序遍历 索引中断停止遍历for i,v in ipairs(arr) doprint(i,v)end-- 阅读全文
posted @ 2016-10-27 21:06 无畏先锋 阅读(3884) 评论(2) 推荐(0) 编辑
摘要:--输入n个数--[[4blueblueredblueoutput:blue]]--输入一个数n= io.read()--循环输入n个字符串,将其记录到table中dic= {}for i = 1,n dostr = io.read()--如果字符串已经在table中存在了if dic[str] t 阅读全文
posted @ 2016-10-27 21:01 无畏先锋 阅读(544) 评论(0) 推荐(0) 编辑
摘要:--遍历数组arrAges= {1,"123",5,true,9}for i = 1,5 doprint(arrages[i])end--#运算符 取table和字符串长度--table下表从1开始for i=1,#arrAges doprint(arrAges do)end 阅读全文
posted @ 2016-10-27 20:51 无畏先锋 阅读(5794) 评论(0) 推荐(0) 编辑
摘要:--table的集合使用--tab了的key值必须是字符串类型--dic = {1,name = "lanou",age= 4,55,54}--dic.name = "蓝鸥"--dic.age= 4--print(dic.name)--print(#dic)--print(dic[2])dic = 阅读全文
posted @ 2016-10-27 19:24 无畏先锋 阅读(1097) 评论(0) 推荐(0) 编辑
摘要:--数组的长宽不比固定arr_age={1,2,3,4}arr_age[0]=1arr_age[1]=2arr_age[2]= 3--for循环 for i=起始值,终止值,增量(可省略)-- 循环体-- end--输出偶数for i=2,10,2 doprint(i)endi=2while i < 阅读全文
posted @ 2016-10-27 19:23 无畏先锋 阅读(200) 评论(0) 推荐(0) 编辑
摘要:--lua数据类型--[[nil nullboolean;boolnumber:整数string:字符创table:数组和集合]]print(type(ms)..type(true)..type(123)..type({1,2,3}))print(type(ms))print(type(true)) 阅读全文
posted @ 2016-10-27 19:21 无畏先锋 阅读(139) 评论(0) 推荐(0) 编辑
摘要:isok = false;--逻辑运算符--规定nil为false--print( ms and isok)--print(4 and 5)--print (false and 13)--print(false and 13)--a or b a为true 返回a 否则返回b--print (4 a 阅读全文
posted @ 2016-10-27 19:11 无畏先锋 阅读(2194) 评论(0) 推荐(0) 编辑
摘要:--单行注释--[[多行注释]]--变量声明的时候 不需要声明类型str = "Hello World"--多个变量name,age ="LanOu",4,5,10print(str)print(name,age,ad) 阅读全文
posted @ 2016-10-27 19:09 无畏先锋 阅读(1505) 评论(0) 推荐(0) 编辑
摘要:--冒泡排序nums = {3,11,2,123,1}len = #numsfor i = 1,len-1 do for j = 1,len-i do if nums[j]>nums[j+1] then temp= nums[j+1] nums[j+1]= nums[j] nums[j]= temp 阅读全文
posted @ 2016-10-27 19:07 无畏先锋 阅读(2188) 评论(0) 推荐(0) 编辑
摘要:--男人类man = {name = "man",age=123}--继承空间man.__index=man--儿童类child= {}--继承setmetatable(child,man)print(child.age)yong= {}setmetatable(yong,man)child.age 阅读全文
posted @ 2016-10-27 19:05 无畏先锋 阅读(163) 评论(0) 推荐(0) 编辑
摘要:--使用table封装面向对象beauty={name = " "}--封装对象方法function beauty.init(self, name)print("十八年前的一天王小丫出生")self.name= nameend--一般使用下面这种形式function beauty:init( nam 阅读全文
posted @ 2016-10-27 19:03 无畏先锋 阅读(124) 评论(0) 推荐(0) 编辑
摘要:function SayHey(mag) for i = 1 , 3 doprint(mag)coroutine.yield()end end --创建携程(协同) coFunc= coroutine.create(SayHey)--查看携程状态print(coroutine.status(coFu 阅读全文
posted @ 2016-10-27 19:01 无畏先锋 阅读(1143) 评论(0) 推荐(0) 编辑
摘要:--require("6-Coroutine")--仅加载一次,并不执行--dofile("6-Coroutine.lua") --加载并执行--SayHey("kkkk")x=10 --默认是全局变量 show= function()local x = 1for i = 1 ,5 dox = x+ 阅读全文
posted @ 2016-10-27 19:00 无畏先锋 阅读(1963) 评论(0) 推荐(0) 编辑
摘要:http://www.itnose.net/detail/6090246.html 阅读全文
posted @ 2016-10-26 21:41 无畏先锋 阅读(345) 评论(0) 推荐(0) 编辑
摘要:单一职责:功能分类里是装换:父 子 父 依赖倒置 : 抽象决定具体 设计模式 单例 观察者 迭代器 阅读全文
posted @ 2016-10-26 16:02 无畏先锋 阅读(126) 评论(0) 推荐(0) 编辑
摘要:Invoke() 方法是 Unity3D 的一种委托机制 如: Invoke("SendMsg", 5); 它的意思是:5 秒之后调用 SendMsg() 方法; 使用 Invoke() 方法需要注意 3点: 1 :它应该在 脚本的生命周期里的(Start、Update、OnGUI、FixedUpd 阅读全文
posted @ 2016-10-24 19:07 无畏先锋 编辑
摘要:using UnityEngine;using System.Collections;public class MetrixTools { //全局静态方法,随机获取(返回)一种形状 public static int[,] GetRandomMetrix() { int id = Random.R 阅读全文
posted @ 2016-10-21 21:53 无畏先锋 阅读(565) 评论(0) 推荐(0) 编辑
摘要:2048 using UnityEngine;using System.Collections.Generic;public class Game : MonoBehaviour { Map map;//地图类 Card[,] mCards;//存放卡片的数组 //存放隐藏的卡牌 List<Card 阅读全文
posted @ 2016-10-20 22:33 无畏先锋 阅读(963) 评论(0) 推荐(0) 编辑
摘要:注:首先在Plugins文件夹下面引入三个dll文件mono.data.sqlite System.Data sqlite3 /***************************************/using UnityEngine;using System.Collections;usi 阅读全文
posted @ 2016-10-19 20:09 无畏先锋 阅读(529) 评论(0) 推荐(0) 编辑
摘要:static 和const修饰的变量都是静态变量; static readonly 修饰的变量是只读的 只能在定义变量的时候和静态构造方法里面给其赋值 class Weapon { public static readonly Weapon Instance; static Weapon() { I 阅读全文
posted @ 2016-10-19 15:04 无畏先锋 阅读(114) 评论(0) 推荐(0) 编辑
摘要:http://unity.jb51.net/chengxukaifa/kaifajingyan/1643.html 阅读全文
posted @ 2016-10-18 19:18 无畏先锋 阅读(136) 评论(0) 推荐(0) 编辑
摘要:首先:编写一个处理AssetsBuddle(打包资源的按钮)的编辑器按钮;脚本如下: Using UnityEngine; Using System.Collections; Using UnityEditor;//注意 要引入编辑器命名空间 Public class AssetBundleBuil 阅读全文
posted @ 2016-10-18 17:12 无畏先锋 阅读(374) 评论(0) 推荐(0) 编辑
摘要:Model基类: using UnityEngine;using System.Collections;/// <summary>/// Model,数据类型基类,永久存在/// </summary>public abstract class Model { //名字 public abstract 阅读全文
posted @ 2016-10-12 17:53 无畏先锋 阅读(4052) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示