随笔分类 - unity
摘要:写入txt不需要打开这个提醒他文件,写完记得关闭写入流。 void NoteReStart() { restartCnt++; StreamWriter sw = new StreamWriter(txt_path); sw.WriteLine("重启次数:" + restartCnt.ToStri
阅读全文
摘要:代码如下: void Update() { if (clientScene.msgCount > preMsgCount) //长时间没有得到进程的反馈 { preMsgCount = clientScene.msgCount; recentGetMsgTick = Time.time; } if
阅读全文
摘要:void Update() { if(Input.GetKeyUp(KeyCode.D)) { flag = !flag; } if (flag) { open_txt_btn.GetComponent<CanvasGroup>().alpha = 1; } else { open_txt_btn.
阅读全文
摘要:using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; using System.Net; //IPAddress,IPEndPoint using Sy
阅读全文
摘要:using System.IO;using System.Xml; void Awake() { StreamReader sr = new StreamReader(xmlPath); string xmlstr = sr.ReadToEnd(); sr.Close(); XmlDocument
阅读全文
摘要:float lastTime; void start(){ lastTime=Time.time; } void update(){ if(Time .time -lastTime > 3.0f) { function(); lastTime = Time.time; } }
阅读全文
摘要:using UnityEngine.UI; public Button Btn; Btn.onClick.AddListener(Query); 按钮触发事件: 先把按钮挂到类上, 在类里写一个public函数,把代码挂到按钮上,按钮的OnClick里通过加号“+”可以找到这个函数,表示每次点击该按
阅读全文
摘要:void Update() { //按A全屏 if (Input.GetKey(KeyCode.A)) { Screen.SetResolution(1366, 768, true); //设置分辨率 Screen.fullScreen = true; //设置成全屏, } // 按ESC退出全屏
阅读全文

浙公网安备 33010602011771号