示例#1
0
 public void clearInfo()
 {
     id               = 0;
     info             = null;
     num              = 0;
     numlabel.enabled = false;
 }
示例#2
0
    public void setid(int id)
    {
        this.id = id;
        objectinfo info = objectsinfo._instance.GetObjectInFoById(id);

        setinfo(info);
    }
示例#3
0
    public objectinfo GetObjectInFoById(int id)
    {
        objectinfo info = null;

        objectinfodict.TryGetValue(id, out info);

        return(info);
    }
示例#4
0
 void plusProperty(Equipmentitem item)
 {
     if (item != null)
     {
         objectinfo equipinfo = objectsinfo._instance.GetObjectInFoById(item.id);
         this.attack += equipinfo.attack;
         this.def    += equipinfo.def;
         this.speed  += equipinfo.speed;
     }
 }
示例#5
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;
     }
 }
示例#6
0
    private string GetEquipDes(objectinfo info)
    {
        string str = "";

        str += "名称: " + info.name + "\n";
        switch (info.dressType)
        {
        case DressType.Headgear:
            str += "穿戴类型:头盔\n";
            break;

        case DressType.Armor:
            str += "穿戴类型:盔甲\n";
            break;

        case DressType.RightHand:
            str += "穿戴类型:右手\n";
            break;

        case DressType.LeftHand:
            str += "穿戴类型:左手\n";
            break;

        case DressType.Shoe:
            str += "穿戴类型:鞋\n";
            break;

        case DressType.Accessory:
            str += "穿戴类型:饰品\n";
            break;
        }

        switch (info.applictiontype)
        {
        case ApplicationType.Swordman:
            str += "适用类型:剑士\n";
            break;

        case ApplicationType.Megiclan:
            str += "适用类型:魔法师\n";
            break;

        case ApplicationType.Commoon:
            str += "适用类型:通用\n";
            break;
        }

        str += "伤害值: " + info.attack + "\n";
        str += "防御值: " + info.def + "\n";
        str += "速度值: " + info.speed + "\n";
        str += "出售价: " + info.price_sell + "\n";
        str += "购买价: " + info.price_buy;
        return(str);
    }
示例#7
0
    public void selid(int id, int num = 1)
    {
        this.id = id;
        info    = objectsinfo._instance.GetObjectInFoById(id);
        inventoryitem item = this.GetComponentInChildren <inventoryitem>();

        item.setIconName(id, info.icon_name);
        numlabel.enabled = true;
        this.num         = num;
        numlabel.text    = num.ToString();
    }
示例#8
0
    private string GetDrugDse(objectinfo info)
    {
        string str = "";

        str += "名称: " + info.name + "\n";
        str += "+HP: " + info.hp + "\n";
        str += "+MP: " + info.mp + "\n";
        str += "出售价: " + info.price_sell + "\n";
        str += "购买价: " + info.price_buy;

        return(str);
    }
示例#9
0
    public void OndrugUse()
    {
        bool success = inventory._instance.MinusId(id, 1);

        if (success)
        {
            ps.GetDrug(objectinfo.hp, objectinfo.mp);
        }
        else
        {
            type = shortcuttype.None;
            icon.gameObject.SetActive(false);
            id         = 0;
            skillinfo  = null;
            objectinfo = null;
        }
    }
示例#10
0
    public void onokButtonclick()
    {
        int        count       = int.Parse(numberInput.value);
        objectinfo info        = objectsinfo._instance.GetObjectInFoById(buy_id);
        int        price       = info.price_buy;
        int        price_total = price * count;
        bool       success     = inventory._instance.GetCoin(price_total);

        if (success)
        {
            if (count > 0)
            {
                inventory._instance.GetId(buy_id, count);
            }
        }
        numberdialog.SetActive(false);
    }
示例#11
0
    public void show(int id)
    {
        this.gameObject.SetActive(true); timer = 0.1f;
        transform.position = UICamera.currentCamera.ScreenToWorldPoint(Input.mousePosition);
        objectinfo info = objectsinfo._instance.GetObjectInFoById(id);
        string     des  = "";

        switch (info.type)
        {
        case objectType.Drug:
            des = GetDrugDse(info);
            break;

        case objectType.Equip:
            des = GetEquipDes(info);
            break;

        case objectType.Mat:
            break;
        }
        label.text = des;
    }
示例#12
0
    public void setid(int id)
    {
        this.id = id;
        info    = objectsinfo._instance.GetObjectInFoById(id);

        Icon_sprite.spriteName = info.icon_name;
        name_label.text        = info.name;
        if (info.attack > 0)
        {
            effect_label.text = "+伤害 " + info.attack;
        }
        else if (info.def > 0)
        {
            effect_label.text = "防御 " + info.def;
        }
        else if (info.speed > 0)
        {
            effect_label.text = "速度 " + info.speed;
        }

        pricesell_label.text = info.price_sell.ToString();
    }
示例#13
0
 public void setinfo(objectinfo info)
 {
     this.id           = info.id;
     sprite.spriteName = info.icon_name;
 }
示例#14
0
    void ReadInfo()
    {
        string text = objectsInfoListText.text;

        string[] strArray = text.Split('\n');

        foreach (string str in strArray)
        {
            string[]   proArray = str.Split(',');
            objectinfo info     = new objectinfo();

            int        id        = int.Parse(proArray[0]);
            string     name      = proArray[1];
            string     icon_name = proArray[2];
            string     str_type  = proArray[3];
            objectType type      = objectType.Drug;

            switch (str_type)
            {
            case "Drug":
                type = objectType.Drug;
                break;

            case "Equip":
                type = objectType.Equip;
                break;

            case "Mat":
                type = objectType.Mat;
                break;
            }
            info.id        = id;
            info.name      = name;
            info.icon_name = icon_name;
            info.type      = type;
            if (type == objectType.Drug)
            {
                int hp         = int.Parse(proArray[4]);
                int mp         = int.Parse(proArray[5]);
                int price_sell = int.Parse(proArray[6]);
                int price_buy  = int.Parse(proArray[7]);
                info.hp         = hp;
                info.mp         = mp;
                info.price_buy  = price_buy;
                info.price_sell = price_sell;
            }
            else if (type == objectType.Equip)
            {
                info.attack     = int.Parse(proArray[4]);
                info.def        = int.Parse(proArray[5]);
                info.speed      = int.Parse(proArray[6]);
                info.price_sell = int.Parse(proArray[9]);
                info.price_buy  = int.Parse(proArray[10]);
                string str_dresstype = proArray[7];
                switch (str_dresstype)
                {
                case "Headgear":
                    info.dressType = DressType.Headgear;
                    break;

                case "Armor":
                    info.dressType = DressType.Armor;
                    break;

                case "RightHand":
                    info.dressType = DressType.RightHand;
                    break;

                case "LeftHand":
                    info.dressType = DressType.LeftHand;
                    break;

                case "Shoe":
                    info.dressType = DressType.Shoe;
                    break;

                case "Accessory":
                    info.dressType = DressType.Accessory;
                    break;
                }
                string str_apptype = proArray[8];
                switch (str_apptype)
                {
                case "Swordman":
                    info.applictiontype = ApplicationType.Swordman;
                    break;

                case "Magician":
                    info.applictiontype = ApplicationType.Megiclan;
                    break;

                case "Common":
                    info.applictiontype = ApplicationType.Commoon;
                    break;
                }
            }
            objectinfodict.Add(id, info);//添加到字典中,id为key,可以通过id查找到info
        }
        //id
        //名称
        //icon名称
        //类型(药品drag)
        //加血量值
        //加魔法值
        //出售价
        //购买
    }
示例#15
0
    public void SetId(int id)
    {
        objectinfo info = objectsinfo._instance.GetObjectInFoById(id);

        sprite.spriteName = info.icon_name;
    }
示例#16
0
    public bool Dress(int id)
    {
        objectinfo info = objectsinfo._instance.GetObjectInFoById(id);

        if (info.type != objectType.Equip)
        {
            return(false);//穿戴不成功
        }

        if (ps.heroType == HeroType.Megiclan)
        {
            if (info.applictiontype == ApplicationType.Swordman)
            {
                return(false);
            }
        }

        if (ps.heroType == HeroType.Swordman)
        {
            if (info.applictiontype == ApplicationType.Megiclan)
            {
                return(false);
            }
        }
        GameObject parent = null;

        switch (info.dressType)
        {
        case DressType.Headgear:
            parent = heargear;
            break;

        case DressType.Armor:
            parent = armor;
            break;

        case DressType.RightHand:
            parent = righthand;
            break;

        case DressType.LeftHand:
            parent = lefthand;
            break;

        case DressType.Shoe:
            parent = shoe;
            break;

        case DressType.Accessory:
            parent = accessoty;
            break;
        }
        Equipmentitem item = parent.GetComponentInChildren <Equipmentitem>();

        if (item != null)//说明穿了同样类型的装备
        {
            inventory._instance.GetId(item.id);
            item.setinfo(info);
        }
        else
        {
            GameObject itemGo = NGUITools.AddChild(parent, equipmentItem);
            itemGo.transform.localPosition = Vector3.zero;
            itemGo.GetComponent <Equipmentitem>().setinfo(info);
        }
        UpdateProperty();
        return(true);
    }