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

深圳企业网站建设推广外包服务商wordpress 在线答题

深圳企业网站建设推广外包服务商,wordpress 在线答题,wordpress视频教学,兰州做网站优化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/803782.html

相关文章:

  • 温州最便宜网站建设网站在百度突然搜不到了
  • 老河口网站排版设计说明
  • 怎么能让我的网站被百度收录dw软件怎么做网页
  • 新建的网站可以百度推广google网站质量
  • 网站优化北京seoui页面设计图
  • 免费的行情网站app软件推荐阿里云cdn wordpress错位
  • 品牌网站设计打造wordpress 4.9 正式版
  • 秦皇岛网站开发公司电话订阅号可以做微网站
  • 设计logo免费网站汕头论坛贴吧
  • sharepoint做门户网站一键生成详情页的软件
  • 门户网站开发架构浦口区网站建设
  • python写网站莱芜网站建设怎么样
  • 云南省建设厅标准员网站论坛网站在线生成
  • 做商城网站哪里好违法网站开发者
  • 网站开发培训深圳北京厦门网站优化
  • 网站建设要做哪些前期准备工作中国建筑网官网查询阮国方
  • 产品做网站如何谁来维护价格网站生成word
  • 自己有网站源码就可以建设吗湘潭网站设计外包公司
  • 筹备网站建设彩票网站怎么做推广
  • 合肥网页设计公司校企合作网站地图seo
  • 门户网站的案例分析开发公司总经理岗位职责
  • 网站建设与网页设计...一元购物网站开发
  • wordpress主题 排名wordpress seo文件
  • 网站建设柒首先金手指8确保网站建设又在前列
  • 找能做网站的wordpress特效主题免费
  • 电商网站开发流程图中山百度关键词搜索
  • 大淘客做的网站可以吗软件技术的了解
  • 网站开发引发的官司重庆公司网站制作公司
  • 平顶山建设街小学网站网页版微信网址是多少
  • 学院门户网站建设自评厦门网站建设系统