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

什么是网站管理系统广告海报

什么是网站管理系统,广告海报,专业建站公司怎么收费,企业网站建设综合实训学习体会Alex教程每一P的教程原代码加上我自己的理解初步理解写的注释#xff0c;可供学习Alex教程的人参考 此代码仅为较上一P有所改变的代码 【Unity教程】从0编程制作类银河恶魔城游戏_哔哩哔哩_bilibili ItemData_Equipment.cs using System.Collections; using System.Collecti…Alex教程每一P的教程原代码加上我自己的理解初步理解写的注释可供学习Alex教程的人参考 此代码仅为较上一P有所改变的代码 【Unity教程】从0编程制作类银河恶魔城游戏_哔哩哔哩_bilibili ItemData_Equipment.cs using System.Collections; using System.Collections.Generic; using UnityEngine;public enum EquipmentType {sword,armor }[CreateAssetMenu(fileName New Item Data, menuName Data/Equipment)] public class ItemData_Equipment : ItemData {public EquipmentType equipmentType; }Inventory.cs using System.Collections; using System.Collections.Generic; using UnityEngine;public class Inventory : MonoBehaviour {public static Inventory instance;public ListInventoryItem inventory;//inventoryItems类型的列表public DictionaryItemData, InventoryItem inventoryDictionary;//以ItemData为Key寻找InventoryItem的字典public ListInventoryItem stash;public DictionaryItemData, InventoryItem stashDictionary;[Header(Inventory UI)][SerializeField] private Transform inventorySlotParent;[SerializeField] private Transform stashSlotParent;private UI_itemSlot[] inventoryItemSlot;//UI Slot的数组private UI_itemSlot[] stashItemSlot;private void Awake(){if (instance null)instance this;elseDestroy(gameObject);//防止多次创建Inventory}public void Start(){inventory new ListInventoryItem();inventoryDictionary new DictionaryItemData, InventoryItem();stash new ListInventoryItem();stashDictionary new DictionaryItemData, InventoryItem();inventoryItemSlot inventorySlotParent.GetComponentsInChildrenUI_itemSlot();//拿到的方式有点绕显示拿到Canvas 里的 Inventory 然后通过GetComponentsInChildren拿到其下的使用UISlotstashItemSlot stashSlotParent.GetComponentsInChildrenUI_itemSlot();}private void UpdateSlotUI(){for(int i 0;i inventory.Count;i ){inventoryItemSlot[i].UpdateSlots(inventory[i]);}for(int i 0;i stash.Count; i){stashItemSlot[i].UpdateSlots(stash[i]);}}public void AddItem(ItemData _item)//将物体存入Inventory的函数{if(_item.itemType ItemType.Equipment){AddToInventory(_item);}else if(_item.itemType ItemType.Material){AddToStash(_item);}UpdateSlotUI();}private void AddToStash(ItemData _item)//向stash加物体的函数{if (stashDictionary.TryGetValue(_item, out InventoryItem value))//只有这种方法才能在查找到是否存在key对应value是否存在的同时能够同时拿到value其他方法的拿不到value{value.AddStack();}//字典的使用通过ItemData类型的数据找到InventoryItem里的与之对应的同样类型的数据else//初始时由于没有相同类型的物体故调用else是为了初始化库存使其中含有一个基本的值{InventoryItem newItem new InventoryItem(_item);stash.Add(newItem);//填进列表里只有一次stashDictionary.Add(_item, newItem);//同上}}private void AddToInventory(ItemData _item){if (inventoryDictionary.TryGetValue(_item, out InventoryItem value))//只有这种方法才能在查找到是否存在key对应value是否存在的同时能够同时拿到value其他方法的拿不到value{value.AddStack();}//字典的使用通过ItemData类型的数据找到InventoryItem里的与之对应的同样类型的数据else//初始时由于没有相同类型的物体故调用else是为了初始化库存使其中含有一个基本的值{InventoryItem newItem new InventoryItem(_item);inventory.Add(newItem);//填进列表里只有一次inventoryDictionary.Add(_item, newItem);//同上}}public void RemoveItem(ItemData _item)//将物体剔除Inventory的函数{if(inventoryDictionary.TryGetValue(_item,out InventoryItem value)){if (value.stackSize 1){inventory.Remove(value);inventoryDictionary.Remove(_item);}elsevalue.RemoveStack();}if (stashDictionary.TryGetValue(_item, out InventoryItem stashValue)){if (stashValue.stackSize 1){stash.Remove(value);stashDictionary.Remove(_item);}elsestashValue.RemoveStack();}UpdateSlotUI();}} using System.Collections; using System.Collections.Generic; using UnityEngine;public class Inventory : MonoBehaviour {public static Inventory instance;public ListInventoryItem inventory;//inventoryItems类型的列表public DictionaryItemData, InventoryItem inventoryDictionary;//以ItemData为Key寻找InventoryItem的字典public ListInventoryItem stash;public DictionaryItemData, InventoryItem stashDictionary;[Header(Inventory UI)][SerializeField] private Transform inventorySlotParent;[SerializeField] private Transform stashSlotParent;private UI_itemSlot[] inventoryItemSlot;//UI Slot的数组private UI_itemSlot[] stashItemSlot;private void Awake(){if (instance null)instance this;elseDestroy(gameObject);//防止多次创建Inventory}public void Start(){inventory new ListInventoryItem();inventoryDictionary new DictionaryItemData, InventoryItem();stash new ListInventoryItem();stashDictionary new DictionaryItemData, InventoryItem();inventoryItemSlot inventorySlotParent.GetComponentsInChildrenUI_itemSlot();//拿到的方式有点绕显示拿到Canvas 里的 Inventory 然后通过GetComponentsInChildren拿到其下的使用UISlotstashItemSlot stashSlotParent.GetComponentsInChildrenUI_itemSlot();}private void UpdateSlotUI(){for(int i 0;i inventory.Count;i ){inventoryItemSlot[i].UpdateSlots(inventory[i]);}for(int i 0;i stash.Count; i){stashItemSlot[i].UpdateSlots(stash[i]);}}public void AddItem(ItemData _item)//将物体存入Inventory的函数{if(_item.itemType ItemType.Equipment){AddToInventory(_item);}else if(_item.itemType ItemType.Material){AddToStash(_item);}UpdateSlotUI();}private void AddToStash(ItemData _item)//向stash加物体的函数{if (stashDictionary.TryGetValue(_item, out InventoryItem value))//只有这种方法才能在查找到是否存在key对应value是否存在的同时能够同时拿到value其他方法的拿不到value{value.AddStack();}//字典的使用通过ItemData类型的数据找到InventoryItem里的与之对应的同样类型的数据else//初始时由于没有相同类型的物体故调用else是为了初始化库存使其中含有一个基本的值{InventoryItem newItem new InventoryItem(_item);stash.Add(newItem);//填进列表里只有一次stashDictionary.Add(_item, newItem);//同上}}private void AddToInventory(ItemData _item){if (inventoryDictionary.TryGetValue(_item, out InventoryItem value))//只有这种方法才能在查找到是否存在key对应value是否存在的同时能够同时拿到value其他方法的拿不到value{value.AddStack();}//字典的使用通过ItemData类型的数据找到InventoryItem里的与之对应的同样类型的数据else//初始时由于没有相同类型的物体故调用else是为了初始化库存使其中含有一个基本的值{InventoryItem newItem new InventoryItem(_item);inventory.Add(newItem);//填进列表里只有一次inventoryDictionary.Add(_item, newItem);//同上}}public void RemoveItem(ItemData _item)//将物体剔除Inventory的函数{if(inventoryDictionary.TryGetValue(_item,out InventoryItem value)){if (value.stackSize 1){inventory.Remove(value);inventoryDictionary.Remove(_item);}elsevalue.RemoveStack();}if (stashDictionary.TryGetValue(_item, out InventoryItem stashValue)){if (stashValue.stackSize 1){stash.Remove(value);stashDictionary.Remove(_item);}elsestashValue.RemoveStack();}UpdateSlotUI();}}
http://www.pierceye.com/news/383537/

相关文章:

  • 做网站百度收费吗青岛冠通市政建设有限公司网站
  • 菜鸟建网站福建福州罗源建设局网站
  • 企业内网网站制作自己的网站多少钱
  • 关于公司网站建设的申请wordpress站群功能
  • 外贸做企业什么网站珠海的网站建设
  • 做网站教程百度云外贸soho建站公司
  • 上海市网站建设网站增加导航栏
  • 电子政务网站模版网站制作排名优化
  • 大足网站建设wordpress本地很慢
  • 企业门户网站模板html上线同安区建设局网站
  • 有些人做网站不用钱的,对吗?手机网站建立教程
  • 自适应网站主要用什么做株洲网站设计公司
  • 漂亮大气的装潢室内设计网站模板 单页式html5网页模板包金山网页设计
  • 沈阳养老保险网站手机网站建设ppt
  • 网站培训视频宝安新闻
  • 上海外贸建站推广公司服务专业的网站建设公司
  • 网站上传不了wordpress女孩学电子商务专业好就业吗
  • 石家庄网站开发工程师招聘网蜘蛛互联网站建设
  • 企业网站营销策划衡水企业做网站费用
  • 邯郸网站建设渠道通化网站建设公司
  • 做vip电影网站黑龙江省中国建设银行网站首页
  • 长沙便宜网站建设在线印章生成器
  • 网站编辑的工作内容WordPress添加上传下载
  • 公司网站需求建设银行企业网站首页
  • 一般找素材都是做哪几个网站呢郑州seo外包阿亮
  • 广州个人网站建设公司jsp网站建设模板
  • 全国的网站建设网站建设肆金手指排名7
  • 做网站如何防止被抄袭17zwd一起做网站官网
  • 北京鲜花的网站建设做任务网站有哪些内容
  • 互联网营销网站建设印章在线生成