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

上海本市企业查询一键优化软件

上海本市企业查询,一键优化软件,成都网站建设制作价格,网站建设前期预算1、目标 保存下面库存栏中信息到文件中。 2、修改SceneSave.cs脚本 添加2行代码: 3、修改InventoryManager对象 添加Generate GUID组件。 4、修改InventoryManager.cs脚本 添加继承自ISaveable 添加属性信息: private string _iSaveableUniqueID;pub…

1、目标

保存下面库存栏中信息到文件中。

2、修改SceneSave.cs脚本

添加2行代码:

3、修改InventoryManager对象

添加Generate GUID组件。

4、修改InventoryManager.cs脚本

添加继承自ISaveable

添加属性信息:

    private string _iSaveableUniqueID;public string ISaveableUniqueID { get { return _iSaveableUniqueID; } set { _iSaveableUniqueID = value; } }private GameObjectSave _gameObjectSave;public GameObjectSave GameObjectSave { get { return _gameObjectSave; } set { _gameObjectSave = value; } }private UIInventoryBar inventoryBar;

在Awake()方法中添加2行代码:

添加如下几个方法:

 private void OnDisable(){ISaveableDeregister();}private void OnEnable(){ISaveableRegister();}private void Start()
{inventoryBar = FindObjectOfType<UIInventoryBar>();
}public void ISaveableRegister(){SaveLoadManager.Instance.iSaveableObjectList.Add(this);}public void ISaveableDeregister(){SaveLoadManager.Instance.iSaveableObjectList.Remove(this);}public GameObjectSave ISaveableSave(){// Create new scene saveSceneSave sceneSave = new SceneSave();// Remove any existing scene save for persistent scene for this gameobjectGameObjectSave.sceneData.Remove(Settings.PersistentScene);// Add inventory lists array to persistent scene savesceneSave.listInvItemArray = inventoryLists;// Add inventory list capacity array to persistent scene savesceneSave.intArrayDictionary = new Dictionary<string, int[]>();sceneSave.intArrayDictionary.Add("inventoryListCapacityArray", inventoryListCapacityIntArray);// Add scene save for gameobjectGameObjectSave.sceneData.Add(Settings.PersistentScene, sceneSave);return GameObjectSave;}public void ISaveableLoad(GameSave gameSave){if(gameSave.gameObjectData.TryGetValue(ISaveableUniqueID, out GameObjectSave gameObjectSave)){GameObjectSave = gameObjectSave;// Need to find inventory lists - start by trying to locate saveScene for game objectif(gameObjectSave.sceneData.TryGetValue(Settings.PersistentScene, out SceneSave sceneSave)){// list inv items array exists for persistent sceneif(sceneSave.listInvItemArray != null){inventoryLists = sceneSave.listInvItemArray;// Send events that inventory has been updatedfor(int i = 0; i < (int)InventoryLocation.count; i++){EventHandler.CallInventoryUpdatedEvent((InventoryLocation)i, inventoryLists[i]);}// Clear any items player was carryingPlayer.Instance.ClearCarriedItem();// Clear any highlights on inventory barinventoryBar.ClearHighlightOnInventorySlots();}// int array dictionary exists for sceneif(sceneSave.intArrayDictionary != null && sceneSave.intArrayDictionary.TryGetValue("inventoryListCapacityArray", out int[] inventoryCapacityArray)){inventoryListCapacityIntArray = inventoryCapacityArray;}}}}public void ISaveableStoreScene(string sceneName){// Nothing required here since the inventory manager is on a persistent scene;}public void ISaveableRestoreScene(string sceneName){// Nothing required here since the inventory manager is on a persistent scene;}

5、运行游戏

角色收集的item放到库存栏中,save game后退出游戏,重新进入游戏后load game,库存栏中的信息保持不变。

http://www.dtcms.com/wzjs/25274.html

相关文章:

  • 网站独立ip百度收录网络推广怎么样
  • 驾校网站建设费用短视频seo询盘获客系统
  • 国外公司做中国网站软件外包公司有哪些
  • 找做包子师傅的网站长沙百度快速优化排名
  • wordpress添加账户编辑是什么意思关键词优化排名软件流量词
  • 陕西省建设资质是哪个网站电商网站前端页面内容编写
  • 东莞营销网站建设推广万网域名查询注册商
  • 建设中小企业网站html+css网页制作成品
  • 微网站建设资讯seo排名赚官网
  • 做网站php语言用什么工具优化网站怎么真实点击
  • 福州网站建设出格网络杭州免费网站制作
  • 珠海企业网站建设公司推广合作
  • python搭建web网站网络营销的概念和特点是什么
  • 有没有做任务赚钱网站太原seo
  • 企业建网站租用服务器好还是买一个好优化加速
  • 北京 响应式网站建设网站怎么制作免费的
  • 在哪里建立个人网站b2b平台网站
  • 英文独立站建设公司哪家好惠州百度seo在哪
  • 做网络投票网站好做吗搜索风云榜百度
  • 武汉建立网站的公司设计师必备的6个网站
  • 关键字挖掘爱站网网站建设平台哪家好
  • 潍坊网站建设wfxtseoseo排名优化课程
  • 怎么做网站的登录界面长春网站seo
  • 模仿别人的网站百度推广云南总代理
  • 个人网站名字网店推广策略
  • 如何在网站插做视频大连seo建站
  • 外贸网站翻墙做广告郑州整站关键词搜索排名技术
  • 在pc端网站基础上做移动端跨境电商
  • 网页设计教程百度云西安seo王尘宇
  • 内容型网站的运营竞价推广平台有哪些