public void SetInventory(int id) { this.id = id; objectInfo = ObjectsInfo._instance.GetObjectInfoById(id); if (objectInfo.type == ObjectType.Drug) { icon.gameObject.SetActive(true); icon.spriteName = objectInfo.icon_name; type = ShortCutType.Drug; } }
/// <summary> /// 将技能设置到快捷栏 /// </summary> public void SetSkill(string id) { m_id = id; icon.gameObject.SetActive(true); shortCutType = ShortCutType.Skill; skillInfo = SkillsInfo.instance.GetSkillInfoById(id); icon.spriteName = skillInfo.icon_name; //技能拖拽上去之后,关闭显示 keyNum.gameObject.SetActive(false); }
public void SetInventory(int id) { this.id = id; objectInfo = ObjectsInfo.instance.GetObjectInfoById(id); icon.gameObject.SetActive(true); StringBuilder sb = new StringBuilder(str); sb.Append(objectInfo.icon_name); icon.sprite = Resources.Load <Sprite>(sb.ToString()); type = ShortCutType.Drug; }
public void SetSkill(int id) { this.id = id; this.skillInfo = SkillsInfo.instance.GetSkillInfoById(id); icon.gameObject.SetActive(true); StringBuilder sb = new StringBuilder(str); sb.Append(skillInfo.icon_name); icon.sprite = Resources.Load <Sprite>(sb.ToString()); type = ShortCutType.Skill; }
public void setDrag2(int id, int count) { count_text = transform.parent.Find("shortcutcount").GetComponent <Text> (); this.id = id; this.count = count; count_text.text = count.ToString(); count_text.gameObject.SetActive(true); this.obinfo = ObjectsInfo.instance.FindObjecInfoById(id); img = this.GetComponent <Image> (); img.overrideSprite = Resources.Load("Icon/" + obinfo.icon_name, typeof(Sprite)) as Sprite; type = ShortCutType.Drug; }
public void AddSnake(int start, int end, ShortCutType type) { if (start == end) { throw new Exception("Start and End cannot be the same."); } if (start < end) { throw new Exception("Snake's start should not be greater than it's end."); } var snake = AddShortCut(start, end, type); _board.AddSnakeToBoard(snake); }
public void AddLadder(int start, int end, ShortCutType type) { if (start == end) { throw new Exception("Start and End cannot be the same."); } if (start > end) { throw new Exception("Ladders's start should not be smaller than it's end."); } var ladder = AddShortCut(start, end, type); _board.AddLadderToBoard(ladder); }
/// <summary> /// 将药品设置到快捷栏 /// </summary> public void SetInventoryItem(string id) { objectInfo = ObjectsInfo.instance.GetObjectInfoById(id); if (objectInfo.type == ObjectType.Drug) { m_id = id; icon.gameObject.SetActive(true); shortCutType = ShortCutType.Drug; icon.spriteName = objectInfo.icon_name; keyNum.gameObject.SetActive(false); } }
public void OnDrugUse() { bool success = Inventory.instance.MinusId(id); if (success) { ps.GetDrug(objectInfo.hp, objectInfo.mp); } else { type = ShortCutType.None; icon.gameObject.SetActive(false); id = 0; objectInfo = null; } }
private ShortCut AddShortCut(int start, int end, ShortCutType type) { if (type == ShortCutType.Regular) { return(new RegularShortCut(start, end)); } else if (type == ShortCutType.ShieldShortCut) { return(new ShieldShortCut(start, end)); } else if (type == ShortCutType.WinShortCut) { return(new WinShortCut(start, end)); } return(new RegularShortCut(start, end)); }
public void SetItem(int id, ShortCutType type) { this.gameObject.SetActive(true); this.id = id; this.type = type; if (type == ShortCutType.Skill) { skillsInfo = SkillInfo._instance.GetSkillsInfoById(id); icon.spriteName = skillsInfo.icon_name; } if (type == ShortCutType.Drug) { objectsInfo = ObjectInfo._instance.GetOjectInfoById(id); icon.spriteName = objectsInfo.icon_name; } }
private void DrugUse() { //减少物品成功,就治疗 if (Inventory.instance.MinusItem(m_id)) { playerStatus.Remedy(objectInfo.hp, objectInfo.mp); } //不管治疗成不成功都检测数量,避免物品不存在还保留在快捷栏上 if (Inventory.instance.CheckItemNum(m_id) == null) { m_id = ""; shortCutType = ShortCutType.None; icon.gameObject.SetActive(false); objectInfo = null; } }
//set drug icon public void SetDrugIcon(int id, int num) { it = ObjectsInfoList._instance.ReadObjectInfo(id); if (it != null && it.infoType != InfoType.equip && it.infoType != InfoType.weapon) { itemSprite.spriteName = it.icon_name; scType = ShortCutType.Drug; drugCount = 0; drugCount += num; if (drugCount > 1) { numLabel.text = drugCount + ""; } else { numLabel.text = ""; } } }
public void UseDrug() { if (id == 0) { return; } int hp = obinfo.hp; int mp = obinfo.mp; ps.GetDrug(hp, mp); count--; if (count <= 0) { count_text.gameObject.SetActive(false); this.id = 0; this.obinfo = null; img.overrideSprite = null; type = ShortCutType.None; } else { count_text.text = count.ToString(); } }