// Public // Private private void DropCellToHotBar(DragAndDropParam dragAndDropParam) { HotBarCell hotBarCell = dragAndDropParam.dragCell as HotBarCell; hotBarCell.baseCell = dragAndDropParam.dropCell; UIBuilder.UpdateAllPanels(); }
override public void Awake() { base.Awake(); // Set Param HotBarCell hotBarCell = CharacterParam.hotBarInventory.GetHotBarCell(cellCount); rootPanel = rootPanelObject.GetComponent <BasePanel>(); base.SetParam(hotBarCell, rootPanel); }
// Public public void SetParam(HotBarCell hotBarCell, BasePanel rootPanel) { base.SetParam(baseCell, rootPanel); if (hotBarCell.baseCell == null) { imageInnerIcon.gameObject.SetActive(false); return; } if (hotBarCell.baseCell is ItemCell) { ItemCell itemCell = hotBarCell.baseCell as ItemCell; imageInnerIcon.sprite = Resources.Load <Sprite>("Icons/" + itemCell.item.iconName); imageInnerIcon.gameObject.SetActive(true); } if (hotBarCell.baseCell is SkillCell) { SkillCell skillCell = hotBarCell.baseCell as SkillCell; imageInnerIcon.sprite = Resources.Load <Sprite>("Icons/" + skillCell.skill.iconName); imageInnerIcon.gameObject.SetActive(true); } }
// Constructor public HotBarInventory() { HotBarCell hotBarCell = null; listHotBarCell = new List <HotBarCell>(); hotBarCell = new HotBarCell(); hotBarCell.count = 0; listHotBarCell.Add(hotBarCell); hotBarCell = new HotBarCell(); hotBarCell.count = 1; listHotBarCell.Add(hotBarCell); hotBarCell = new HotBarCell(); hotBarCell.count = 2; listHotBarCell.Add(hotBarCell); hotBarCell = new HotBarCell(); hotBarCell.count = 3; listHotBarCell.Add(hotBarCell); hotBarCell = new HotBarCell(); hotBarCell.count = 4; listHotBarCell.Add(hotBarCell); hotBarCell = new HotBarCell(); hotBarCell.count = 5; listHotBarCell.Add(hotBarCell); hotBarCell = new HotBarCell(); hotBarCell.count = 6; listHotBarCell.Add(hotBarCell); hotBarCell = new HotBarCell(); hotBarCell.count = 7; listHotBarCell.Add(hotBarCell); hotBarCell = new HotBarCell(); hotBarCell.count = 8; listHotBarCell.Add(hotBarCell); hotBarCell = new HotBarCell(); hotBarCell.count = 9; listHotBarCell.Add(hotBarCell); }