Example #1
0
    public int LevelUp(EquipVo vo)
    {
        //-1 已经满级 0 灵魂不足 1 强化失败 2 强化成功
        StaticEquipLevelVo staticVo = StaticDataPool.Instance.staticEquipLevelPool.GetStaticDataVo(vo.equipId, vo.level);

        if (staticVo.level == 10)
        {
            return(-1);
        }
        if (DataManager.Instance.roleVo.exp < staticVo.upPrice)
        {
            return(0);
        }
        else
        {
            DataManager.Instance.roleVo.exp -= staticVo.upPrice;
            GameRoot.Instance.evt.CallEvent(GameEventDefine.ROLE_INFO, null);
            float random = Random.Range(0, 1);
            if (random <= staticVo.upRate)
            {
                vo.level += 1;
                return(2);
            }
            else
            {
                return(1);
            }
        }
    }
Example #2
0
    private void OnUpdate(object obj)
    {
        num.text = DataManager.Instance.equipModel._dataList.Count + "/" + DataManager.Instance.roleVo.maxEquipNum;
        for (int i = 0; i < equipCell.Length; i++)
        {
            equipCell[i].Create(null, ChangeSelectCell);
            for (int j = 0; j < DataManager.Instance.equipModel.nowEquip.Count; j++)
            {
                StaticEquipVo staticEquipVo = StaticDataPool.Instance.staticEquipPool.GetStaticDataVo(DataManager.Instance.equipModel.nowEquip[j].equipId);
                if (staticEquipVo.part == equipCell[i].pos)
                {
                    equipCell[i].Create(DataManager.Instance.equipModel.nowEquip[j], ChangeSelectCell);
                }
            }
            equipCell[i].ChangeSelect(-1);
        }
        int count = 0;

        Tools.ClearChildFromParent(scrollRect.content);
        barList.Clear();
        for (int i = 0; i < DataManager.Instance.equipModel._dataList.Count; i++)
        {
            StaticEquipLevelVo staticEquipLevelVo = StaticDataPool.Instance.staticEquipLevelPool.GetStaticDataVo(DataManager.Instance.equipModel._dataList[i].equipId, DataManager.Instance.equipModel._dataList[i].level);
            if (nowTab == staticEquipLevelVo.part)
            {
                GameObject barObj = Tools.CreateGameObject("UI/EquipPanel/EquipBar", scrollRect.content);
                EquipBar   bar    = barObj.GetComponent <EquipBar>();
                barList.Add(bar);
                bar.Create(DataManager.Instance.equipModel._dataList[i], ChangeSelect);
                count++;
            }
        }
        scrollRect.content.sizeDelta = new Vector2(scrollRect.content.sizeDelta.x, 150 * count);
        ShowTip(nowVo);
    }
Example #3
0
    private void ShowTip(EquipVo vo)
    {
        Tools.ClearChildFromParent(tsAffect);
        if (vo == null)
        {
            return;
        }
        StaticEquipLevelVo staticEquipLevelVo = StaticDataPool.Instance.staticEquipLevelPool.GetStaticDataVo(vo.equipId, vo.level);
        StaticEquipVo      staticEquipVo      = StaticDataPool.Instance.staticEquipPool.GetStaticDataVo(vo.equipId);

        textName.text = staticEquipLevelVo.equipName + "+" + vo.level;
        switch (staticEquipVo.role)
        {
        case -1: textRole.text = "全职业通用"; break;

        case 0: textRole.text = "猎人专用"; break;

        case 1: textRole.text = "战士专用"; break;

        case 2: textRole.text = "法师专用"; break;

        case 3: textRole.text = "菜鸟专用"; break;
        }
        int i = 0;

        foreach (var d in staticEquipLevelVo.effect)
        {
            string str = "";
            switch (d.Key)
            {
            case 1: str = "生命:+"; break;

            case 2: str = "攻击:+"; break;

            case 3: str = "法攻:+"; break;

            case 4: str = "护甲:+"; break;

            case 5: str = "暴击:+"; break;

            case 6: str = "闪避:+"; break;

            case 7: str = "暴伤:+"; break;

            case 8: str = "法力:+"; break;

            case 9: str = "速度:+"; break;

            case 10: str = "法抗:+"; break;

            case 11: str = "格挡率:+"; break;
            }
            str += (int)d.Value;
            GameObject obj = Tools.CreateGameObject("UI/EquipPanel/affectCell", tsAffect, new Vector3(0, -30 * i, 0), Vector3.one);
            obj.GetComponent <Text>().text = str;
            i++;
        }
    }
Example #4
0
    public void Sell(EquipVo vo)
    {
        StaticEquipLevelVo staticVo = StaticDataPool.Instance.staticEquipLevelPool.GetStaticDataVo(vo.equipId, vo.level);

        _dataList.Remove(vo);

        DataManager.Instance.roleVo.exp += staticVo.sellPrice;
        GameRoot.Instance.evt.CallEvent(GameEventDefine.ROLE_INFO, null);
    }
Example #5
0
 public void AddData(string[] lineArray)
 {
     for (int i = 1; i < lineArray.Length; i++)
     {
         lineArray[i] = lineArray[i].Replace("\r", "");
         string[]           strArray = lineArray[i].Split(","[0]);
         StaticEquipLevelVo vo       = new StaticEquipLevelVo(strArray);
         _datapool.Add(vo);
     }
 }
Example #6
0
    private void BtnClick()
    {
        UIManager.Instance.CreateConfirmPanel("确定购买这个商品?", delegate(object obj)
        {
            bool enough = false;
            if (staticShopVo.priceType == 1)
            {
                enough = DataManager.Instance.roleVo.exp >= staticShopVo.price;
            }
            else if (staticShopVo.priceType == 2)
            {
                enough = DataManager.Instance.roleVo.exp >= staticShopVo.price;
            }
            if (enough)
            {
                switch (staticShopVo.type)
                {
                case 1:
                    StaticItemVo staticItemVo = StaticDataPool.Instance.staticItemPool.GetStaticDataVo(staticShopVo.itemId);
                    DataManager.Instance.itemModel.Add(staticItemVo);
                    UIManager.Instance.CreateTipPanel("购买了" + staticItemVo.name);
                    break;

                case 2:
                    StaticEquipVo staticEquipVo           = StaticDataPool.Instance.staticEquipPool.GetStaticDataVo(staticShopVo.itemId);
                    StaticEquipLevelVo staticEquipLevelVo = StaticDataPool.Instance.staticEquipLevelPool.GetStaticDataVo(staticEquipVo.equipId, 1);
                    DataManager.Instance.equipModel.Add(staticEquipLevelVo);
                    UIManager.Instance.CreateTipPanel("购买了" + staticEquipVo.equipName);
                    break;

                case 3:
                    StaticUnitVo staticUnitVo           = StaticDataPool.Instance.staticUnitPool.GetStaticDataVo(staticShopVo.itemId);
                    StaticUnitLevelVo staticUnitLevelVo = StaticDataPool.Instance.staticUnitLevelPool.GetStaticDataVo(staticUnitVo.unitId, 1);
                    DataManager.Instance.servantModel.Add(staticUnitLevelVo);
                    UIManager.Instance.CreateTipPanel("购买了" + staticUnitVo.name);
                    break;
                }
            }
            else
            {
                if (staticShopVo.priceType == 1)
                {
                    UIManager.Instance.CreateTipPanel("灵魂不足");
                }
                else if (staticShopVo.priceType == 2)
                {
                    UIManager.Instance.CreateTipPanel("灵魂不足");
                }
            }
        });
    }
Example #7
0
    protected override void Die()
    {
        BattleController.Instance.player.AddExp(staticUnitVo.dropExp);
        BattleController.Instance.servant.AddExp(staticUnitVo.dropExp);
        DataManager.Instance.mapModel.AddProgress();
        float ifDropServant = Random.Range(0f, 1f);

        if (ifDropServant < DataManager.Instance.roleVo.dropServantRate)
        {
            bool result = DataManager.Instance.servantModel.Add(staticUnitVo);
            if (result == true)
            {
                UIManager.Instance.CreateTipPanel(staticUnitVo.name + "觉得你很有前途,成为了你的随从");
            }
        }
        if (ifBoss)
        {
            BattleController.Instance.nowMapVo.clear = true;
            DataManager.Instance.mapModel.AddProgress(true);
        }
        base.Die();
        //Todo
        GameRoot.Instance.evt.CallEvent(GameEventDefine.BATTLE_END, false);
        BattleController.Instance.pauseRound = 1;
        StaticMapVo nowMapVo    = StaticDataPool.Instance.staticMapPool.GetStaticDataVo(BattleController.Instance.nowMap);
        int         randomEquip = Random.Range(0, 10000);

        for (int i = 0; i < nowMapVo.dropEquip.Count; i++)
        {
            if (randomEquip > nowMapVo.dropEquip[i][1] && randomEquip < nowMapVo.dropEquip[i][2])
            {
                StaticEquipLevelVo newVo = StaticDataPool.Instance.staticEquipLevelPool.GetStaticDataVo(nowMapVo.dropEquip[i][0]);
                DataManager.Instance.equipModel.Add(newVo);
                UIManager.Instance.CreateTipPanel("获得了" + newVo.equipName);
                break;
            }
        }
        int randomItem = Random.Range(0, 10000);

        for (int i = 0; i < nowMapVo.dropItem.Count; i++)
        {
            if (randomItem > nowMapVo.dropItem[i][1] && randomItem < nowMapVo.dropItem[i][2])
            {
                StaticItemVo newVo = StaticDataPool.Instance.staticItemPool.GetStaticDataVo(nowMapVo.dropItem[i][0]);
                DataManager.Instance.itemModel.Add(newVo);
                UIManager.Instance.CreateTipPanel("获得了" + newVo.name);
                break;
            }
        }
        DataManager.Instance.Save(DataManager.Instance.currentPlayer);
    }
Example #8
0
    private void UpdateProperty(object obj)
    {
        float equipHp = 0, equipMp = 0, equipAttack = 0, equipMagicAttack = 0, equipDefance = 0, equipMagicDefance = 0, equipCritNum = 0, equipDuckNum = 0, equipCritDamage = 0, equipSpeed = 0, equipDefanceRate = 0;

        for (int i = 0; i < DataManager.Instance.equipModel.nowEquip.Count; i++)
        {
            StaticEquipLevelVo staticEquipLevelVo = StaticDataPool.Instance.staticEquipLevelPool.GetStaticDataVo(DataManager.Instance.equipModel.nowEquip[i].equipId, DataManager.Instance.equipModel.nowEquip[i].level);
            foreach (var d in staticEquipLevelVo.effect)
            {
                switch (d.Key)
                {
                case 1: equipHp += d.Value; break;

                case 2: equipAttack += d.Value; break;

                case 3: equipMagicAttack += d.Value; break;

                case 4: equipDefance += d.Value; break;

                case 5: equipCritNum += d.Value; break;

                case 6: equipDuckNum += d.Value; break;

                case 7: equipCritDamage += d.Value; break;

                case 8: equipMp += d.Value; break;

                case 9: equipSpeed += d.Value; break;

                case 10: equipMagicDefance += d.Value; break;

                case 11: equipDefanceRate += d.Value; break;
                }
            }
        }

        maxHp        = DataManager.Instance.roleVo.baseHp + staticUnitVo.hp + equipHp;
        maxMp        = DataManager.Instance.roleVo.baseMp + staticUnitVo.mp + equipMp;
        attackBig    = DataManager.Instance.roleVo.baseAttackBig + staticUnitVo.attackBig + equipAttack;
        attackSmall  = DataManager.Instance.roleVo.baseAttackSmall + staticUnitVo.attackSmall + equipAttack;
        magicAttack  = DataManager.Instance.roleVo.baseMagicAttack + staticUnitVo.magicAttack + equipMagicAttack;
        defance      = DataManager.Instance.roleVo.baseDeface + staticUnitVo.defence + equipDefance;
        magicDefance = DataManager.Instance.roleVo.baseMagicDefance + staticUnitVo.magicDefance + equipMagicDefance;
        critNum      = DataManager.Instance.roleVo.baseCrit + staticUnitVo.critNum + equipCritNum;
        duckNum      = DataManager.Instance.roleVo.baseDuck + staticUnitVo.duckNum + equipDuckNum;
        critDamage   = DataManager.Instance.roleVo.baseCritDamage + staticUnitVo.critDamage + equipCritDamage;
        speed        = DataManager.Instance.roleVo.baseSpeed + staticUnitVo.speed + equipSpeed;
        defanceRate  = DataManager.Instance.roleVo.baseDefanceRate + staticUnitVo.defanceRate + equipDefanceRate;
        magicRate    = DataManager.Instance.roleVo.baseMagicRate + staticUnitVo.magicRate;
    }
Example #9
0
    public void Add(StaticEquipLevelVo vo)
    {
        if (_dataList.Count >= DataManager.Instance.roleVo.maxEquipNum)
        {
            return;
        }

        EquipVo equipVo = new EquipVo();

        equipVo.id      = _dataList.Count;
        equipVo.equipId = vo.equipId;
        equipVo.level   = vo.level;
        equipVo.locked  = false;
        _dataList.Add(equipVo);
    }
Example #10
0
 public void Create(EquipVo equipVo, CallBackFunctionWithObject callback)
 {
     this.equipVo = equipVo;
     if (equipVo != null)
     {
         StaticEquipVo      staticEquipVo      = StaticDataPool.Instance.staticEquipPool.GetStaticDataVo(equipVo.equipId);
         StaticEquipLevelVo staticEquipLevelVo = StaticDataPool.Instance.staticEquipLevelPool.GetStaticDataVo(equipVo.equipId, equipVo.level);
         icon.sprite = ResourceManager.Instance.GetEquipIcon(staticEquipVo.icon);
     }
     else
     {
         icon.sprite = null;
     }
     this.callback = callback;
 }
Example #11
0
    private void OnUpdate(object obj)
    {
        float equipHp = 0, equipMp = 0, equipAttack = 0, equipMagicAttack = 0, equipDefance = 0, equipMagicDefance = 0, equipCritNum = 0, equipDuckNum = 0, equipCritDamage = 0, equipSpeed = 0, equipDefanceRate = 0;

        for (int i = 0; i < DataManager.Instance.equipModel.nowEquip.Count; i++)
        {
            StaticEquipLevelVo staticEquipLevelVo = StaticDataPool.Instance.staticEquipLevelPool.GetStaticDataVo(DataManager.Instance.equipModel.nowEquip[i].equipId, DataManager.Instance.equipModel.nowEquip[i].level);
            foreach (var d in staticEquipLevelVo.effect)
            {
                switch (d.Key)
                {
                case 1: equipHp += d.Value; break;

                case 2: equipAttack += d.Value; break;

                case 3: equipMagicAttack += d.Value; break;

                case 4: equipDefance += d.Value; break;

                case 5: equipCritNum += d.Value; break;

                case 6: equipDuckNum += d.Value; break;

                case 7: equipCritDamage += d.Value; break;

                case 8: equipMp += d.Value; break;

                case 9: equipSpeed += d.Value; break;

                case 10: equipMagicDefance += d.Value; break;

                case 11: equipDefanceRate += d.Value; break;
                }
            }
        }

        StaticUnitLevelVo nowVo = StaticDataPool.Instance.staticUnitLevelPool.GetStaticDataVo(DataManager.Instance.roleVo.charactor, DataManager.Instance.roleVo.level);
        int nextLevel;

        if (nowVo.level == 150)
        {
            nextLevel = 150;
            btnLevelUp.gameObject.SetActive(false);
        }
        else
        {
            nextLevel = nowVo.level + 1;
        }
        StaticUnitLevelVo nextVo = StaticDataPool.Instance.staticUnitLevelPool.GetStaticDataVo(nowVo.unitId, nextLevel);

        charactor.text = nowVo.name;
        roleName.text  = DataManager.Instance.roleVo.name;
        data1[0].text  = nowVo.level.ToString();
        data1[1].text  = nowVo.needExp.ToString();
        data1[2].text  = ((int)(DataManager.Instance.roleVo.baseHp + nowVo.hp + equipHp)).ToString();
        data1[3].text  = ((int)(DataManager.Instance.roleVo.baseMp + nowVo.mp + equipMp)).ToString();
        data1[4].text  = ((int)(DataManager.Instance.roleVo.baseAttackSmall + nowVo.attackSmall + equipAttack)) + "~" + ((int)(DataManager.Instance.roleVo.baseAttackBig + nowVo.attackBig + equipAttack));
        data1[5].text  = ((int)(DataManager.Instance.roleVo.baseMagicAttack + nowVo.magicAttack + equipMagicAttack)).ToString();
        data1[6].text  = ((int)(DataManager.Instance.roleVo.baseDeface + nowVo.defence + equipDefance)).ToString();
        data1[12].text = ((int)(DataManager.Instance.roleVo.baseMagicDefance + nowVo.magicDefance + equipMagicDefance)).ToString();
        data1[7].text  = ((int)(DataManager.Instance.roleVo.baseCrit + nowVo.critNum + equipCritNum)).ToString();
        data1[8].text  = ((int)(DataManager.Instance.roleVo.baseDuck + nowVo.duckNum + equipDuckNum)).ToString();
        data1[9].text  = (DataManager.Instance.roleVo.baseCritDamage + nowVo.critDamage + equipCritDamage) * 100 + "%";
        data1[10].text = ((int)(DataManager.Instance.roleVo.baseSpeed + nowVo.speed + equipSpeed)).ToString();
        data1[11].text = (DataManager.Instance.roleVo.baseMagicRate + nowVo.magicRate) * 100 + "%";
        data1[13].text = ((int)(DataManager.Instance.roleVo.baseDefanceRate + nowVo.defanceRate + equipDefanceRate)).ToString();

        data2[0].text  = nextLevel.ToString();
        data2[1].text  = "";
        data2[2].text  = ((int)(DataManager.Instance.roleVo.baseHp + nextVo.hp + equipHp)).ToString();
        data2[3].text  = ((int)(DataManager.Instance.roleVo.baseMp + nextVo.mp + equipMp)).ToString();
        data2[4].text  = ((int)(DataManager.Instance.roleVo.baseAttackSmall + nextVo.attackSmall + equipAttack)) + "~" + ((int)(DataManager.Instance.roleVo.baseAttackBig + nowVo.attackBig + equipAttack));
        data2[5].text  = ((int)(DataManager.Instance.roleVo.baseMagicAttack + nextVo.magicAttack + equipMagicAttack)).ToString();
        data2[6].text  = ((int)(DataManager.Instance.roleVo.baseDeface + nextVo.defence + equipDefance)).ToString();
        data2[12].text = ((int)(DataManager.Instance.roleVo.baseMagicDefance + nextVo.magicDefance + equipMagicDefance)).ToString();
        data2[7].text  = ((int)(DataManager.Instance.roleVo.baseCrit + nextVo.critNum + equipCritNum)).ToString();
        data2[8].text  = ((int)(DataManager.Instance.roleVo.baseDuck + nextVo.duckNum + equipDuckNum)).ToString();
        data2[9].text  = (DataManager.Instance.roleVo.baseCritDamage + nextVo.critDamage + equipCritDamage) * 100 + "%";
        data2[10].text = ((int)(DataManager.Instance.roleVo.baseSpeed + nextVo.speed + equipSpeed)).ToString();
        data2[11].text = (DataManager.Instance.roleVo.baseMagicRate + nextVo.magicRate) * 100 + "%";
        data2[13].text = ((int)(DataManager.Instance.roleVo.baseDefanceRate + nextVo.defanceRate + equipDefanceRate)).ToString();
    }