摘要: 创建子线程一,不带参数Thread resourcesLoadThread=new Thread (this.resourceLoadTxt);resourcesLoadThread.Start();void resourceLoadTxt(){}二,带参数;第一种:使用ParameterizedThreadStart。调用 System.Threading.Thread.Start(System.Object) 重载方法时将包含数据的对象传递给线程。Thread resourcesLoadThread=newThread (this.resourceLoadTxt);object o=&qu 阅读全文
posted @ 2013-08-22 16:34 韦斯利yx 阅读(4327) 评论(0) 推荐(0) 编辑
摘要: 一,子线程中能做的事:1,数据逻辑方面计算;二,子线程中,不能:1,加载场景相关事件:Application.LoadLevelAsync、Application.LoadLevel等;2,加载Resources文件下的资源:Resources.Load;3,实例GameObject:Instantiate(clone); 阅读全文
posted @ 2013-08-22 16:17 韦斯利yx 阅读(726) 评论(0) 推荐(0) 编辑
摘要: 一些小型数据,可以用txt文本作为媒介,进行获取、传输、修改、存储;比如:User1.2.3.txt,放入 Resources/Data 文件下;一,Unity3d Resources.Load 加载获取数据。 TextAsset TXTFile = (TextAsset)Resources.Load("Data/board"+ boardN.ToString() + "." + rows.ToString() + "." + columns.ToString());TextAsset TXTFile = (TextAsset)Res 阅读全文
posted @ 2013-08-22 15:57 韦斯利yx 阅读(3044) 评论(0) 推荐(0) 编辑
摘要: UICheckboxPrefs.cs1,bool isChecked:false 为“初始”状态,true为“选中”;2,boolstartsChecked:true,一运行,就显示UISprite :checkSprite;3,UISprite checkSprite:一般为“选中”状态的UI;using UnityEngine;using AnimationOrTween;[AddComponentMenu("WuKk/UI/Checkbox Prefs")]publicclass UICheckboxPrefs : MonoBehaviour{static publi 阅读全文
posted @ 2013-08-14 17:21 韦斯利yx 阅读(989) 评论(0) 推荐(0) 编辑
摘要: 检测方式:一,Unity3D 渲染统计窗口Game视窗的Stats去查看渲染统计的信息:1、FPSfps其实就是 frames per second,也就是每一秒游戏执行的帧数,这个数值越小,说明游戏越卡。2、Draw callsbatching之后渲染mesh的数量,和当前渲染到的网格的材质球数量有关。3、Saved by batching渲染的批处理数量,这是引擎将多个对象的绘制进行合并从而减少GPU的开销;很多GUI插件的一个好处就是合并多个对象的渲染,从而降低DrawCalls ,保证游戏帧数。4、Tris 当前绘制的三角面数5、Verts 当前绘制的顶点数6、Used Texture 阅读全文
posted @ 2013-08-14 12:06 韦斯利yx 阅读(1507) 评论(0) 推荐(1) 编辑
摘要: delegate:委托机制,不做一一说明;功能需求1:音量,为一事件为B;改变音量如为0,为事件A。也触发事件B;音量变,所有音乐,如场景,特效,角色,打斗。其所有音量都得变。为C;思路:B事件:PublicDelegate.cspublic delegate void VolumeDelegate(string str,float time,bool isbool);public static event VolumeDelegatevolumeDelegate;internal static voidvolumeDelegate(){if(volumeDelegate!=null)volu 阅读全文
posted @ 2013-08-09 15:39 韦斯利yx 阅读(1326) 评论(0) 推荐(0) 编辑
摘要: 单选按钮:一,常用属性:1,CheckSprite:选中后,才显示的Sprite,即为“选中”状态;2,Starts Checked:true,一开始就显示“选中”状态;3,RadioButtonRoot:一组UICheckbox,在这组UICheckbox中只能是一个被“选中”状态,其它的UICheckbox为“初始”状态;4,Option Can Be None :true,在“选中”状态下,再次选中,即向“初始”状态转变;为fase,不做任何转变;5,Function Name:状态改变,提供接口;二,接口说明:1:UICheckbox.Set(bool );state:true,&qu 阅读全文
posted @ 2013-07-23 12:47 韦斯利yx 阅读(1212) 评论(0) 推荐(0) 编辑
摘要: publicclass OpenClooseGoUI : MonoBehaviour {public GameObject closeBt;public GameObject goUI;public GameObject openBt;void Start () {if(closeBt)UIEventListener.Get(closeBt).onPress += closeList;if(openBt)UIEventListener.Get(openBt).onPress += openList;}void closeList(GameObject go, bool istrue) {... 阅读全文
posted @ 2013-07-23 12:26 韦斯利yx 阅读(728) 评论(0) 推荐(0) 编辑
摘要: 功能需求:点击退出按钮,弹出“退出”UI,询问玩家是否退出游戏;退出按钮退出UI:publicclass GameQuit : MonoBehaviour {// 取消按钮public GameObject closeBt;// 退出UIpublic GameObject goUI;// 退出按钮public GameObject openBt;//确定退出游戏按钮public GameObject quitBt;void Start () {NGUIAddListener();}void NGUIAddListener(){if(openBt) UIEventListener.Get... 阅读全文
posted @ 2013-07-23 12:18 韦斯利yx 阅读(5107) 评论(0) 推荐(0) 编辑
摘要: Input.acceleration 加速度最近一次测量的设备在三维空间中的线性加速度(只读);void Update () {v3=Input.acceleration;}void OnGUI(){GUI.TextArea(new Rect(50,50,300,100)," X "+v3.x+" Y "+v3.y+" Z "+v3.z);}Landscape Left:手机左横方向Y0f;右倾斜;x0f;后倾斜; 阅读全文
posted @ 2013-07-16 12:59 韦斯利yx 阅读(585) 评论(0) 推荐(0) 编辑