Beispiel #1
0
    public void Equip()
    {
        if (!CurretnSelect.icon.gameObject.activeSelf)
        {
            return;
        }
        switch (CurretnSelect.data.itemtype)
        {
        case ItemType.武器:
            var config = WeaponConfig.Get(CurretnSelect.data.config_id);
            if (config.需要等级 > ActorModel.Model.GetLevel())
            {
                View.CurrentScene.OpenView <TipView>().SetContent("等级不够 需要等级: " + DreamerTool.Util.DreamerUtil.GetColorRichText(config.需要等级.ToString(), Color.red));
                return;
            }
            Equip(config, WeaponConfig.Get(ActorModel.Model.GetPlayerEquipment(EquipmentType.武器)), EquipmentType.武器);
            break;

        case ItemType.肩膀:
            var arm_config = ArmConfig.Get(CurretnSelect.data.config_id);
            Equip(arm_config, ArmConfig.Get(ActorModel.Model.GetPlayerEquipment(EquipmentType.肩膀左)), EquipmentType.肩膀左);
            break;

        case ItemType.衣:
            var torso_config = TorsoConfig.Get(CurretnSelect.data.config_id);
            Equip(torso_config, TorsoConfig.Get(ActorModel.Model.GetPlayerEquipment(EquipmentType.衣)), EquipmentType.衣);
            break;

        case ItemType.手链:
            var sleeve_config = SleeveConfig.Get(CurretnSelect.data.config_id);
            Equip(sleeve_config, SleeveConfig.Get(ActorModel.Model.GetPlayerEquipment(EquipmentType.手链)), EquipmentType.手链);
            break;

        case ItemType.裤子:
            var pelvis_config = PelvisConfig.Get(CurretnSelect.data.config_id);
            Equip(pelvis_config, PelvisConfig.Get(ActorModel.Model.GetPlayerEquipment(EquipmentType.裤子)), EquipmentType.裤子);
            break;

        case ItemType.鞋子:
            var foot_config = FootConfig.Get(CurretnSelect.data.config_id);
            Equip(foot_config, FootConfig.Get(ActorModel.Model.GetPlayerEquipment(EquipmentType.鞋子)), EquipmentType.鞋子);
            break;

        case ItemType.消耗品:
            GameStaticMethod.ExecuteCommond(ConsumablesConfig.Get(CurretnSelect.data.config_id).function);
            ActorModel.Model.bag_items.Remove(CurretnSelect.data);
            CurretnSelect.icon.gameObject.SetActive(false);
            ItemUITip.gameObject.SetActive(false);
            break;

        case ItemType.盾牌:
            var shield_config = ShieldConfig.Get(CurretnSelect.data.config_id);
            Equip(shield_config, ShieldConfig.Get(ActorModel.Model.GetPlayerEquipment(EquipmentType.盾牌)), EquipmentType.盾牌);
            break;

        default:
            break;
        }
    }
Beispiel #2
0
    private void Awake()
    {
        switch (item_type)
        {
        case ItemType.武器:
            GetComponent <SpriteRenderer>().sprite = WeaponConfig.Get(config_id).GetSprite();
            transform.localScale = Vector2.one * 3;
            transform.rotation   = Quaternion.Euler(0, 0, -90);
            _text.text           = WeaponConfig.Get(config_id).物品名字;
            _text.color          = GameStaticData.ITEM_COLOR_DICT[WeaponConfig.Get(config_id).物品阶级];
            break;

        case ItemType.衣:
            GetComponent <SpriteRenderer>().sprite = TorsoConfig.Get(config_id).GetSprite();
            _text.text  = TorsoConfig.Get(config_id).物品名字;
            _text.color = GameStaticData.ITEM_COLOR_DICT[TorsoConfig.Get(config_id).物品阶级];
            break;

        case ItemType.手链:
            GetComponent <SpriteRenderer>().sprite = SleeveConfig.Get(config_id).GetSprite();
            _text.text  = SleeveConfig.Get(config_id).物品名字;
            _text.color = GameStaticData.ITEM_COLOR_DICT[SleeveConfig.Get(config_id).物品阶级];
            break;

        case ItemType.肩膀:
            GetComponent <SpriteRenderer>().sprite = ArmConfig.Get(config_id).GetSprite();
            _text.text  = ArmConfig.Get(config_id).物品名字;
            _text.color = GameStaticData.ITEM_COLOR_DICT[ArmConfig.Get(config_id).物品阶级];
            break;

        case ItemType.裤子:
            GetComponent <SpriteRenderer>().sprite = PelvisConfig.Get(config_id).GetSprite();
            _text.text  = PelvisConfig.Get(config_id).物品名字;
            _text.color = GameStaticData.ITEM_COLOR_DICT[PelvisConfig.Get(config_id).物品阶级];
            break;

        case ItemType.鞋子:
            GetComponent <SpriteRenderer>().sprite = FootConfig.Get(config_id).GetSprite();
            _text.text  = FootConfig.Get(config_id).物品名字;
            _text.color = GameStaticData.ITEM_COLOR_DICT[FootConfig.Get(config_id).物品阶级];
            break;

        case ItemType.盾牌:
            GetComponent <SpriteRenderer>().sprite = ShieldConfig.Get(config_id).GetSprite();
            _text.text  = ShieldConfig.Get(config_id).物品名字;
            _text.color = GameStaticData.ITEM_COLOR_DICT[ShieldConfig.Get(config_id).物品阶级];
            break;

        default:
            break;
        }
        if (!GetComponent <PolygonCollider2D>())
        {
            gameObject.AddComponent <PolygonCollider2D>().isTrigger = true;
        }
    }
Beispiel #3
0
    public void UpdateSpriteRenderSprite()
    {
        switch (equipment_type)
        {
        case EquipmentType.鞋子:
            _sprite.sprite = FootConfig.Get(ActorModel.Model.GetPlayerEquipment(equipment_type)).GetSprite();
            break;

        case EquipmentType.裤子:
            _sprite.sprite = PelvisConfig.Get(ActorModel.Model.GetPlayerEquipment(equipment_type)).GetSprite();
            break;

        case EquipmentType.肩膀右:
            _sprite.sprite = ArmConfig.Get(ActorModel.Model.GetPlayerEquipment(equipment_type)).GetSprite();
            break;

        case EquipmentType.肩膀左:
            _sprite.sprite = ArmConfig.Get(ActorModel.Model.GetPlayerEquipment(equipment_type)).GetLsprite();
            break;

        case EquipmentType.手链:
            _sprite.sprite = SleeveConfig.Get(ActorModel.Model.GetPlayerEquipment(equipment_type)).GetSprite();
            break;

        case EquipmentType.武器:
            _sprite.sprite = WeaponConfig.Get(ActorModel.Model.GetPlayerEquipment(equipment_type)).GetSprite();
            break;

        case EquipmentType.衣:
            _sprite.sprite = TorsoConfig.Get(ActorModel.Model.GetPlayerEquipment(equipment_type)).GetSprite();
            break;

        case EquipmentType.盾牌:
            _sprite.sprite = ShieldConfig.Get(ActorModel.Model.GetPlayerEquipment(equipment_type)).GetSprite();
            break;

        default:
            break;
        }
    }
Beispiel #4
0
    public void ChooseGrid()
    {
        if (CurretnSelect != null)
        {
            CurretnSelect.UnSelect();
        }
        CurretnSelect = Grids[grid_index];
        CurretnSelect.Select();
        if (CurretnSelect.data != null)
        {
            SetTipPos();
            switch (CurretnSelect.data.itemtype)
            {
            case ItemType.鞋子:
                var foot = FootConfig.Get(CurretnSelect.data.config_id);
                SetTip(foot, FootConfig.Get(ActorModel.Model.GetPlayerEquipment(EquipmentType.鞋子)));
                break;

            case ItemType.裤子:
                var pelvis = PelvisConfig.Get(CurretnSelect.data.config_id);
                SetTip(pelvis, PelvisConfig.Get(ActorModel.Model.GetPlayerEquipment(EquipmentType.裤子)));
                break;

            case ItemType.肩膀:
                var arm = ArmConfig.Get(CurretnSelect.data.config_id);
                SetTip(arm, ArmConfig.Get(ActorModel.Model.GetPlayerEquipment(EquipmentType.肩膀左)));
                break;

            case ItemType.手链:
                var sleeve = SleeveConfig.Get(CurretnSelect.data.config_id);
                SetTip(sleeve, SleeveConfig.Get(ActorModel.Model.GetPlayerEquipment(EquipmentType.手链)));
                break;

            case ItemType.武器:
                var weapon = WeaponConfig.Get(CurretnSelect.data.config_id);
                SetTip(weapon, WeaponConfig.Get(ActorModel.Model.GetPlayerEquipment(EquipmentType.武器)));
                break;

            case ItemType.衣:
                var torso = TorsoConfig.Get(CurretnSelect.data.config_id);
                SetTip(torso, TorsoConfig.Get(ActorModel.Model.GetPlayerEquipment(EquipmentType.衣)));
                break;

            case ItemType.盾牌:
                var shield = ShieldConfig.Get(CurretnSelect.data.config_id);
                SetTip(shield, ShieldConfig.Get(ActorModel.Model.GetPlayerEquipment(EquipmentType.盾牌)));
                break;

            case ItemType.消耗品:
                var consum = ConsumablesConfig.Get(CurretnSelect.data.config_id);
                SetTip(consum, null);
                break;

            default:
                break;
            }

            sell_button.gameObject.SetActive(true);
            sure_button.gameObject.SetActive(true);
            if (CurretnSelect.data.itemtype == ItemType.消耗品)
            {
                sure_button.GetComponentInChildren <Text>().text = "使用";
            }
            else
            {
                sure_button.GetComponentInChildren <Text>().text = "装备";
            }
        }
        else
        {
            sell_button.gameObject.SetActive(false);
            sure_button.gameObject.SetActive(false);
            ItemUITip.gameObject.SetActive(false);
        }
    }
Beispiel #5
0
    public void SetModel(ItemType _type, int _id)
    {
        m_id   = _id;
        m_type = _type;

        switch (_type)
        {
        case ItemType.鞋子:
            var foot = FootConfig.Get(_id);
            m_desText.text = foot.物品描述;
            singlePrice    = foot.购买价格;
            break;

        case ItemType.裤子:
            var sleeve = PelvisConfig.Get(_id);
            m_desText.text = sleeve.物品描述;
            singlePrice    = sleeve.购买价格;
            break;

        case ItemType.肩膀:
            var arm = ArmConfig.Get(_id);
            m_desText.text = arm.物品描述;
            singlePrice    = arm.购买价格;
            break;

        case ItemType.手链:
            var pelvis = SleeveConfig.Get(_id);
            m_desText.text = pelvis.物品描述;
            singlePrice    = pelvis.购买价格;
            break;

        case ItemType.武器:
            var weapon = WeaponConfig.Get(_id);
            m_desText.text = weapon.物品描述;
            singlePrice    = weapon.购买价格;
            break;

        case ItemType.衣:
            var torso = TorsoConfig.Get(_id);
            m_desText.text = torso.物品描述;
            singlePrice    = torso.购买价格;
            break;

        case ItemType.盾牌:
            var shield = ShieldConfig.Get(_id);
            m_desText.text = shield.物品描述;
            singlePrice    = shield.购买价格;
            break;

        case ItemType.消耗品:
            var con = ConsumablesConfig.Get(_id);
            m_desText.text = con.物品描述;
            singlePrice    = con.购买价格;
            break;

        default:
            break;
        }
        UpdateAmountText();
        UpdateAmountSlider();
    }
Beispiel #6
0
    public void SetConfig(BagItemData data, bool ispickup = false)
    {
        this.data = data;
        var id  = this.data.config_id;
        var typ = this.data.itemtype;

        switch (typ)
        {
        case ItemType.鞋子:
            icon.sprite = FootConfig.Get(id).GetSprite();
            if (ispickup)
            {
                View.CurrentScene.GetView <GameInfoView>().SetPopText("拾取 " + FootConfig.Get(id).物品名字 + "*1", GameStaticData.ITEM_COLOR_DICT[FootConfig.Get(id).物品阶级]);
            }
            break;

        case ItemType.裤子:
            icon.sprite = PelvisConfig.Get(id).GetSprite();
            if (ispickup)
            {
                View.CurrentScene.GetView <GameInfoView>().SetPopText("拾取 " + PelvisConfig.Get(id).物品名字 + "*1", GameStaticData.ITEM_COLOR_DICT[PelvisConfig.Get(id).物品阶级]);
            }
            break;

        case ItemType.肩膀:
            icon.sprite = ArmConfig.Get(id).GetSprite();
            if (ispickup)
            {
                View.CurrentScene.GetView <GameInfoView>().SetPopText("拾取 " + ArmConfig.Get(id).物品名字 + "*1", GameStaticData.ITEM_COLOR_DICT[ArmConfig.Get(id).物品阶级]);
            }
            break;

        case ItemType.手链:
            icon.sprite = SleeveConfig.Get(id).GetSprite();
            if (ispickup)
            {
                View.CurrentScene.GetView <GameInfoView>().SetPopText("拾取 " + SleeveConfig.Get(id).物品名字 + "*1", GameStaticData.ITEM_COLOR_DICT[SleeveConfig.Get(id).物品阶级]);
            }
            break;

        case ItemType.武器:
            icon.sprite = WeaponConfig.Get(id).GetSprite();
            if (ispickup)
            {
                View.CurrentScene.GetView <GameInfoView>().SetPopText("拾取 " + WeaponConfig.Get(id).物品名字 + "*1", GameStaticData.ITEM_COLOR_DICT[WeaponConfig.Get(id).物品阶级]);
            }

            break;

        case ItemType.衣:
            icon.sprite = TorsoConfig.Get(id).GetSprite();
            if (ispickup)
            {
                View.CurrentScene.GetView <GameInfoView>().SetPopText("拾取 " + TorsoConfig.Get(id).物品名字 + "*1", GameStaticData.ITEM_COLOR_DICT[TorsoConfig.Get(id).物品阶级]);
            }
            break;

        case ItemType.消耗品:
            icon.sprite = ConsumablesConfig.Get(id).GetSprite();
            if (ispickup)
            {
                View.CurrentScene.GetView <GameInfoView>().SetPopText("拾取 " + ConsumablesConfig.Get(id).物品名字 + "*1", GameStaticData.ITEM_COLOR_DICT[ConsumablesConfig.Get(id).物品阶级]);
            }
            break;

        case ItemType.盾牌:
            icon.sprite = ShieldConfig.Get(id).GetSprite();
            if (ispickup)
            {
                View.CurrentScene.GetView <GameInfoView>().SetPopText("拾取 " + ShieldConfig.Get(id).物品名字 + "*1", GameStaticData.ITEM_COLOR_DICT[ShieldConfig.Get(id).物品阶级]);
            }
            break;

        default:
            break;
        }
    }
Beispiel #7
0
    public void SetModel(ActorModel _model)
    {
        foreach (var item in _model.Equipment)
        {
            Sprite sp = null;
            switch (item.Key)
            {
            case EquipmentType.鞋子:
                sp = FootConfig.Get(item.Value).GetSprite();
                break;

            case EquipmentType.裤子:
                sp = PelvisConfig.Get(item.Value).GetSprite();
                break;

            case EquipmentType.肩膀左:
                sp = ArmConfig.Get(item.Value).GetLsprite();
                break;

            case EquipmentType.肩膀右:
                sp = ArmConfig.Get(item.Value).GetSprite();
                break;

            case EquipmentType.手链:
                sp = SleeveConfig.Get(item.Value).GetSprite();
                break;

            case EquipmentType.武器:
                sp = WeaponConfig.Get(item.Value).GetSprite();
                break;

            case EquipmentType.衣:
                sp = TorsoConfig.Get(item.Value).GetSprite();
                break;

            case EquipmentType.盾牌:
                sp = ShieldConfig.Get(item.Value).GetSprite();
                break;

            default:
                break;
            }
            if (equipment.ContainsKey(item.Key))
            {
                equipment[item.Key].sprite = sp;
            }
        }

        foreach (var item in _model.Faces)
        {
            Sprite sp = null;
            switch (item.Key)
            {
            case FaceType.发型:
                sp = HairConfig.Get(item.Value).GetSprite();
                break;

            case FaceType.眼睛:
                sp = EyeConfig.Get(item.Value).GetSprite();
                break;

            case FaceType.嘴巴:
                sp = MouthConfig.Get(item.Value).GetSprite();
                break;

            case FaceType.耳朵:
                sp = EarConfig.Get(item.Value).GetSprite();
                break;

            case FaceType.发饰:
                sp = HairDecorateConfig.Get(item.Value).GetSprite();
                break;

            default:
                break;
            }
            face[item.Key].sprite = sp;
        }
    }