当前位置: 首页 > news >正文

品牌型网站建设哪家wordpress导入网站文章

品牌型网站建设哪家,wordpress导入网站文章,网址大全2345qiren,中国建筑业网Unity persistentDataPath使用案例 一、Application.persistentDataPath 1、概念 persistentDataPath#xff1a;此属性用于返回一个持久化数据存储目录的路径#xff0c;可以在此路径下存储一些持久化的数据文件#xff1b;是一个可读写的目录#xff1b;此文件夹在Edi…Unity persistentDataPath使用案例 一、Application.persistentDataPath 1、概念 persistentDataPath此属性用于返回一个持久化数据存储目录的路径可以在此路径下存储一些持久化的数据文件是一个可读写的目录此文件夹在Editor阶段没有手机安装App后自动生成 关联的概念-Unity项目文件夹StreamingAssets只能读,不能写。 2、应用场景 1手机应用场景中存储当前游戏的进度以便下次运行游戏时读取 如下代码文件存储游戏中的下列数据coins、starCount 0、collection [Serializable] public class SaveData { //Current loaded save file public static SaveData save; private static string fileName; //Unsaved global variables public static bool checkpoint false; public static Vector3 checkpointPos; public static Quaternion checkpointRot; public static bool hubPositionSet false; //Saved variables public int coins 0; public int starCount 0; public Liststring collection new Liststring(); //Save public void Save() { System.IO.File.WriteAllText(fileName, JsonUtility.ToJson(this)); } //Load (Make sure fileName is set, will be loaded if it exists) public static bool Load() { if (System.IO.File.Exists(fileName)) { save JsonUtility.FromJsonSaveData(System.IO.File.ReadAllText(fileName)); hubPositionSet true; return true; } else return false; } //Create new game public static void NewGame() { save new SaveData(); hubPositionSet false; } public static void SetFileName(string name) { fileName Path.Combine(Application.persistentDataPath, name .json); } //Null check public static void NullCheck() { if (save null) { SetFileName(TestSave); if (!Load()) NewGame(); Debug.Log(Hello Mario Framework: Using test save file!); hubPositionSet false; } } //Get coin count public int GetCoins() { return coins; } //Add or remove coins public void AddCoins(int i) { coins i; } //Collect a single coin public void CollectCoin() { coins; } //Get star count public int GetStarCount() { return starCount; } //Collect a star (Or ignore if already collected) public bool CollectStar(string name) { if (AddCollection(name)) { starCount; return true; } else return false; } //Add to collection public bool AddCollection(string id) { if (!collection.Contains(id)) { collection.Add(id); return true; } else return false; } //Check if something is in the collection public bool CheckCollection(string id) { return collection.Contains(id); } } 2放置一些首次运行时需要的可读写的数据文件 将游戏运行时需要的可读写的文件模板放到只读文件夹“StreamingAssets”手机首次运行时再拷贝到可读写的目录“Application.persistentDataPath” 如下实例游戏在手机平台首次运行时将我们的数据模板文件”data.txt”拷贝到“persistentDataPath”目录以便于以后在手机端游戏运行时实时读写。 public void copy(string fileName data.txt) { string url; //MacWindows或Linux平台 #if UNITY_EDITOR || UNITY_STANDALONE url $file://{Application.dataPath}/StreamingAssets/{fileName}; //ios平台路径 #elif UNITY_IPHONE url $file://{Application.dataPath}/Raw/{fileName}; //安卓路径 #elif UNITY_ANDROID url $jar:file://{Application.dataPath}!/assets/{fileName}; #endif string persistentUrl ${Application.persistentDataPath}/{fileName}; if (!File.Exists(persistentUrl)) { Debug.Log(${persistentUrl} 文件不存在,从StreamingAssets中Copy!); WWW www new WWW(url); while (true) { if (www.isDone) { if (www.error null) { //本次读的文本 File.WriteAllText(persistentUrl, www.text);    File.WriteAllBytes(path, www.bytes); Debug.Log($持久化目录: {persistentUrl}); break; } else { Debug.LogWarning($没得到StreamingAssets的文件 : {fileName}); } } } } else { Debug.Log(${persistentUrl} 文件已存在!); } }
http://www.hkea.cn/news/14578845/

相关文章:

  • 电商网站前端源码做围棋题最好的网站
  • 建站开发软件如何找网站推广
  • 做爰在线网站php网站开发参考文献
  • 爱站网络科技有限公司建筑方案设计考试
  • 好用的h5网站模板专业网站建设是哪家便宜
  • 做的比较好的手机网站wordpress 站点收录
  • 淡水网站建设哪家便宜wordpress语言切换 seo
  • 建设网站需要招聘哪些人域名备案完成了怎么建设网站
  • 深圳网站设计制作数字域名做网站
  • 海口网站建设找薇ls15227网站建设对标行业分析
  • 广东万高建设网站濮阳网站建设推广
  • 清河网站制作男男床做视频网站在线
  • 建设工程质量监督站网站免费申请商家收款码
  • 网站系统怎么做的定制高端网站的公司
  • 顺德大良网站建设国外免费推广网站
  • 做企业礼品的网站百度关键词优化费用
  • 网站建设报价 下载固定ip做网站
  • 上上佳食品 网站建设游戏源码
  • windows系统的vps网站防攻击网页设计与制作课程心得
  • html代码大全网站推荐网站的建设好处
  • 网站排名优化需要多久乐清网站建设yq01
  • 厦门网站建设一般多少钱怎么制作网站准考证在网上打印
  • 潍坊外贸建站大连网站设计公司排名
  • 德语网站建设注意事项站长之家权重
  • 电子商务网站规划与管理火车头 wordpress 4.8
  • 上海做网站高端跨境c2c的平台有哪些
  • 岳阳网站建设开发企业vi设计是什么意思啊
  • 网站中宣传彩页怎么做的开网店怎么开 新手需要多少资金
  • 人才网站cms浙江网站seo
  • seo网站点击量排名优化库存网站建设公司