コード例 #1
0
 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;
     }
 }
コード例 #2
0
ファイル: ShortCutGrid.cs プロジェクト: Aagxe/RPGproject
    /// <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);
    }
コード例 #3
0
    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;
    }
コード例 #4
0
    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;
    }
コード例 #5
0
 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;
 }
コード例 #6
0
        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);
        }
コード例 #7
0
        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);
        }
コード例 #8
0
ファイル: ShortCutGrid.cs プロジェクト: Aagxe/RPGproject
    /// <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);
        }
    }
コード例 #9
0
    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;
        }
    }
コード例 #10
0
 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));
 }
コード例 #11
0
 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;
     }
 }
コード例 #12
0
ファイル: ShortCutGrid.cs プロジェクト: Aagxe/RPGproject
    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;
        }
    }
コード例 #13
0
 //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 = "";
         }
     }
 }
コード例 #14
0
    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();
        }
    }