Пример #1
0
    void UpdataUI()
    {
        if (_heroData != null)
        {
            _iconBg.spriteName = _heroData.IconBgName;
            _icon_Texture.SetHeroSmallTexture(_heroData.id);
            switch (_heroData.team)
            {
            case HeroDataManager.TEAM.NOTEAM:
                _formation_sprite.gameObject.SetActive(false);
                break;

            case HeroDataManager.TEAM.FIRSTTEAM:
                _formation_sprite.gameObject.SetActive(true);
                _formation_sprite.spriteName = "heroTeam_" + (int)_heroData.team;
                break;

            case HeroDataManager.TEAM.SECONDTEAM:
                _formation_sprite.gameObject.SetActive(true);
                _formation_sprite.spriteName = "heroTeam_" + (int)_heroData.team;
                break;

            case HeroDataManager.TEAM.THIRDTEAM:
                _formation_sprite.gameObject.SetActive(true);
                _formation_sprite.spriteName = "heroTeam_" + (int)_heroData.team;
                break;
            }
            _rank_sprite.spriteName = _heroData.rankName;
            _type_Sprite.spriteName = "arms_" + (int)_heroData.heroType;

            _heroName_Label.color = _heroData.nameColor;
            _heroName_Label.text  = _heroData.data.name;

            int             exp             = 0;
            int             level           = 0;
            Model_HeroGroup model_heroGroup = InstancePlayer.instance.model_User.model_heroGroup;
            Hero            hero            = model_heroGroup.GetHero(_heroData.id);
            exp   = hero.exp;
            level = model_heroGroup.GetCurrentLevel(_heroData.id);
            float heroExpToNextLevel      = (float)DataManager.instance.dataHeroGroup.GetHeroExpToNextLevel(_heroData.id, exp);
            float heroTotalExpToNextLevel = (float)DataManager.instance.dataHeroGroup.GetHeroTotalExpToNextLevel(_heroData.id, exp);
            if (heroExpToNextLevel == 0 || heroTotalExpToNextLevel == 0)
            {
                _expLabel.text = "军官已满级";
            }
            if (exp == 0 && level == 1)
            {
                _Timer_Colored_Slider.value = 0;
                _expLabel.text = 0 + "/" + heroTotalExpToNextLevel;
            }
            else
            {
                _Timer_Colored_Slider.value = (heroTotalExpToNextLevel - heroExpToNextLevel) / heroTotalExpToNextLevel;
                _expLabel.text = (heroTotalExpToNextLevel - heroExpToNextLevel) + "/" + heroTotalExpToNextLevel;
            }
            _heroLevel_Label.text = level.ToString();
        }
    }
Пример #2
0
    void UpdataUI()
    {
        if (_heroData != null)
        {
            Model_HeroGroup model_heroGroup  = InstancePlayer.instance.model_User.model_heroGroup;
            Hero            hero             = model_heroGroup.GetHero(_heroData.id);
            DataHeroUpgrade dataHeroUpgrade1 = DataManager.instance.dataHeroGroup.GetHeroUpgrade(_heroData.id, hero.stage);

            Item item = InstancePlayer.instance.model_User.model_itemGroup.QueryItem(dataHeroUpgrade1.itemId);
            _currentValue_Label.text = item.num.ToString();
            _needValue_Label.text    = dataHeroUpgrade1.itemCount.ToString();
        }
    }
Пример #3
0
    void UpdataUI()
    {
        if (_heroData != null)
        {
            _iconBg.spriteName = _heroData.IconBgName;
            _icon_Texture.SetHeroSmallTexture(_heroData.id);
            switch (_heroData.team)
            {
            case HeroDataManager.TEAM.NOTEAM:
                _formation_sprite.gameObject.SetActive(false);
                break;

            case HeroDataManager.TEAM.FIRSTTEAM:
                _formation_sprite.gameObject.SetActive(true);
                _formation_sprite.spriteName = "heroTeam_" + (int)_heroData.team;
                break;

            case HeroDataManager.TEAM.SECONDTEAM:
                _formation_sprite.gameObject.SetActive(true);
                _formation_sprite.spriteName = "heroTeam_" + (int)_heroData.team;
                break;

            case HeroDataManager.TEAM.THIRDTEAM:
                _formation_sprite.gameObject.SetActive(true);
                _formation_sprite.spriteName = "heroTeam_" + (int)_heroData.team;
                break;
            }
            _type_Sprite.spriteName = "arms_" + (int)_heroData.heroType;
            _heroName_Label.color   = _heroData.nameColor;
            _heroName_Label.text    = _heroData.data.name;
            int             exp             = 0;
            Model_HeroGroup model_heroGroup = InstancePlayer.instance.model_User.model_heroGroup;
            if (_heroData.recruitType == HeroDataManager.RecruitType.ALREADYRECRUIT)
            {
                Hero hero = model_heroGroup.GetHero(_heroData.id);
                exp = hero.exp;
                _manager_Btn.gameObject.SetActive(true);
                _upLevel_Btn.gameObject.SetActive(true);
                _heroLevel_Label.gameObject.SetActive(true);
                _heroLevel_Label.text = model_heroGroup.GetCurrentLevel(_heroData.id).ToString();
                _rank_sprite.gameObject.SetActive(true);
                _rank_sprite.spriteName = UICommon.HERO_RANK_ICON_PATH + model_heroGroup.GetCurrentStage(_heroData.id);
                DataHero dataHero = DataManager.instance.dataHeroGroup.GetHero(_heroData.id, hero.exp, hero.stage);
                //hp
                _attributeValue_Label_1.text = ((int)dataHero.basicParam.hp).ToString();
                //ap
                _attributeValue_Label_2.text = ((int)dataHero.basicParam.damage).ToString();
                //dp
                _attributeValue_Label_3.text = ((int)dataHero.basicParam.ammo).ToString();
                //hitRate
                float  hitDodDou     = 0.0f;
                string hitDodDouDesc = "";
                if (dataHero.basicParam.hitRate != 0.0f)
                {
                    hitDodDouDesc = "命中";
                    hitDodDou     = dataHero.basicParam.hitRate;
                }
                if (dataHero.basicParam.dodgeRate != 0.0f)
                {
                    hitDodDouDesc = "闪避";
                    hitDodDou     = dataHero.basicParam.dodgeRate;
                }
                if (dataHero.basicParam.doubleDamageRate != 0.0f)
                {
                    hitDodDouDesc = "暴击";
                    hitDodDou     = dataHero.basicParam.doubleDamageRate;
                }
                if (hitDodDou != 0.0f)
                {
                    _attribute_Label_4.gameObject.SetActive(true);
                    _attributeValue_Label_4.text = hitDodDou.ToString();
                }
                else
                {
                    _attribute_Label_4.gameObject.SetActive(false);
                }
            }
            else
            {
                _manager_Btn.gameObject.SetActive(false);
                _upLevel_Btn.gameObject.SetActive(false);
                exp = _heroData.exp;
                _heroLevel_Label.gameObject.SetActive(false);
                _rank_sprite.gameObject.SetActive(false);
                //hp
                _attributeValue_Label_1.text = ((int)_heroData.data.basicParam.hp).ToString();
                //ap
                _attributeValue_Label_2.text = ((int)_heroData.data.basicParam.damage).ToString();
                //dp
                _attributeValue_Label_3.text = ((int)_heroData.data.basicParam.ammo).ToString();
                //hitRate
                _attribute_Label_4.gameObject.SetActive(false);
                _attributeValue_Label_4.text = (_heroData.data.basicParam.hitRate).ToString();
            }

            float heroExpToNextLevel      = (float)DataManager.instance.dataHeroGroup.GetHeroExpToNextLevel(_heroData.id, exp);
            float heroTotalExpToNextLevel = (float)DataManager.instance.dataHeroGroup.GetHeroTotalExpToNextLevel(_heroData.id, exp);
            if (heroExpToNextLevel == 0 || heroTotalExpToNextLevel == 0)
            {
                _expLabel.text = "军官已满级";
            }
            {
                _Timer_Colored_Slider.value = (heroTotalExpToNextLevel - heroExpToNextLevel) / heroTotalExpToNextLevel;
                _expLabel.text = (heroTotalExpToNextLevel - heroExpToNextLevel) + "/" + heroTotalExpToNextLevel;
            }

            DataHeroLeadership heroLeaderData = DataManager.instance.dataHeroGroup.GetHeroLeadership(_heroData.id);
            DataSkill          skillData      = DataManager.instance.dataSkillGroup.GetSkill(heroLeaderData.skill, 1);
            _skillName.text       = skillData.name;
            _skillIcon.spriteName = "SkillICONS_" + (int)heroLeaderData.skill;
//			_skillAttribute_Label.text = skillData.


            _ability_Label_1.text = "坦克" + ((int)(heroLeaderData.kTank * 100)).ToString() + "%";
            _ability_Label_2.text = "导弹" + "\n" + ((int)(heroLeaderData.kMissile * 100)).ToString() + "%";
            _ability_Label_3.text = "反坦" + ((int)(heroLeaderData.kUnknown * 100)).ToString() + "%";
            _ability_Label_4.text = "装甲" + ((int)(heroLeaderData.kGun * 100)).ToString() + "%";
            _ability_Label_5.text = "火炮" + "\n" + ((int)(heroLeaderData.kCannon * 100)).ToString() + "%";
        }
    }
Пример #4
0
    public HeroData InitHeroData(DataHero data)
    {
        if (data != null)
        {
            DataHeroLeadership heroLeadershipData = heroGroupData.GetHeroLeadership(data.id);

            Model_HeroGroup model_heroGroup = InstancePlayer.instance.model_User.model_heroGroup;
            Model_ItemGroup model_itemGroup = InstancePlayer.instance.model_User.model_itemGroup;
            Model_Formation model_formation = InstancePlayer.instance.model_User.model_Formation;
            HeroData        heroData        = new HeroData();
            heroData.id       = data.id;
            heroData.heroType = (HeroType)data.type;
            heroData.quality  = heroLeadershipData.quality;
            heroData.IconName = UICommon.HERO_TEXTURE_ICON_PATH + data.id;
            heroData.skillId  = (int)heroLeadershipData.skill;
            heroData.data     = data;
            DataHeroUpgrade heroUpgradeData = heroGroupData.GetHeroUpgrade(data.id, 1);
            heroData.heroUpgradeData = heroUpgradeData;
            if (model_heroGroup.heroesMap.ContainsKey(data.id))
            {
                heroData.level       = model_heroGroup.GetCurrentLevel(data.id);
                heroData.recruitType = RecruitType.ALREADYRECRUIT;
                heroData.rank        = model_heroGroup.GetCurrentStage(data.id);
                heroData.rankName    = UICommon.HERO_RANK_ICON_PATH + model_heroGroup.GetCurrentStage(data.id);
                heroData.exp         = model_heroGroup.GetHero(data.id).exp;
            }
            else
            {
                heroData.level    = 1;
                heroData.rank     = 1;            //默认军衔为下士
                heroData.rankName = UICommon.HERO_RANK_ICON_PATH + "1";
                heroData.exp      = 0;

                //isCanUnlock 是否能解锁
                Item item = model_itemGroup.QueryItem(heroUpgradeData.itemId);
                if (item.num >= heroUpgradeData.itemCount)
                {
                    heroData.recruitType = RecruitType.CANRECRUIT;
                }
                else
                {
                    heroData.recruitType = RecruitType.UNABLERECRUIT;
                }
            }
            //英雄是否上阵
            for (int i = 1; i < 4; i++)
            {
                heroData.team = (TEAM)0;
                if (model_formation.IsTeamContaninHero(i, data.id))
                {
                    heroData.team = (TEAM)i;
                    break;
                }
            }

            switch ((int)heroLeadershipData.quality)
            {
            case 1:
                heroData.nameColor  = UICommon.UNIT_NAME_COLOR_0;
                heroData.IconBgName = UICommon.UNIT_ICON_BG + "0";
                break;

            case 2:
                heroData.nameColor  = UICommon.UNIT_NAME_COLOR_1;
                heroData.IconBgName = UICommon.UNIT_ICON_BG + "1";
                break;

            case 3:
                heroData.nameColor  = UICommon.UNIT_NAME_COLOR_2;
                heroData.IconBgName = UICommon.UNIT_ICON_BG + "2";
                break;

            case 4:
                heroData.nameColor  = UICommon.UNIT_NAME_COLOR_3;
                heroData.IconBgName = UICommon.UNIT_ICON_BG + "3";
                break;

            case 5:
                heroData.nameColor  = UICommon.UNIT_NAME_COLOR_4;
                heroData.IconBgName = UICommon.UNIT_ICON_BG + "4";
                break;

            default:
                heroData.nameColor  = UICommon.UNIT_NAME_COLOR_0;
                heroData.IconBgName = UICommon.UNIT_ICON_BG + "0";
                break;
            }

            return(heroData);
        }
        return(null);
    }
Пример #5
0
    void UpdataUI()
    {
        if (_heroData != null)
        {
            _iconBg.spriteName = _heroData.IconBgName;
            _icon_Texture.SetHeroSmallTexture(_heroData.id);
            switch (_heroData.team)
            {
            case HeroDataManager.TEAM.NOTEAM:
                _formation_sprite.gameObject.SetActive(false);
                break;

            case HeroDataManager.TEAM.FIRSTTEAM:
                _formation_sprite.gameObject.SetActive(true);
                _formation_sprite.spriteName = "heroTeam_" + (int)_heroData.team;
                break;

            case HeroDataManager.TEAM.SECONDTEAM:
                _formation_sprite.gameObject.SetActive(true);
                _formation_sprite.spriteName = "heroTeam_" + (int)_heroData.team;
                break;

            case HeroDataManager.TEAM.THIRDTEAM:
                _formation_sprite.gameObject.SetActive(true);
                _formation_sprite.spriteName = "heroTeam_" + (int)_heroData.team;
                break;
            }

            _type_Sprite.spriteName = "arms_" + (int)_heroData.heroType;

            _heroName_Label.color = _heroData.nameColor;
            _heroName_Label.text  = _heroData.data.name;

            Model_HeroGroup model_heroGroup = InstancePlayer.instance.model_User.model_heroGroup;
            _rank_sprite.spriteName = UICommon.HERO_RANK_ICON_PATH + model_heroGroup.GetCurrentStage(_heroData.id);
            _heroLevel_Label.text   = model_heroGroup.GetCurrentLevel(_heroData.id).ToString();

            int  heroLevel = model_heroGroup.GetCurrentLevel(_heroData.id);
            Hero hero      = model_heroGroup.GetHero(_heroData.id);

            DataHero        dataHero1        = DataManager.instance.dataHeroGroup.GetHero(_heroData.id, hero.exp, hero.stage);
            DataHeroUpgrade dataHeroUpgrade1 = DataManager.instance.dataHeroGroup.GetHeroUpgrade(_heroData.id, hero.stage);
            if (dataHeroUpgrade1.requireLevel > heroLevel)
            {
                _LevelValue_Label.text = UIHelper.SetStringSixteenColor(heroLevel.ToString(), UICommon.SIXTEEN_RED) + UIHelper.SetStringSixteenColor("/" + dataHeroUpgrade1.requireLevel.ToString(), UICommon.SIXTEEN_GREEN);
            }
            else
            {
                _LevelValue_Label.text = UIHelper.SetStringSixteenColor(heroLevel.ToString(), UICommon.SIXTEEN_GREEN) + UIHelper.SetStringSixteenColor("/" + dataHeroUpgrade1.requireLevel.ToString(), UICommon.SIXTEEN_GREEN);
            }
            Item item = InstancePlayer.instance.model_User.model_itemGroup.QueryItem(dataHeroUpgrade1.itemId);
            if (item.num < dataHeroUpgrade1.itemCount)
            {
                _number_Label.text = UIHelper.SetStringSixteenColor(item.num.ToString(), UICommon.SIXTEEN_RED) + UIHelper.SetStringSixteenColor("/" + dataHeroUpgrade1.itemCount.ToString(), UICommon.SIXTEEN_GREEN);
            }
            else
            {
                _number_Label.text = UIHelper.SetStringSixteenColor(item.num.ToString(), UICommon.SIXTEEN_GREEN) + UIHelper.SetStringSixteenColor("/" + dataHeroUpgrade1.itemCount.ToString(), UICommon.SIXTEEN_GREEN);
            }
            //hp
            _current_Label_1.text = ((int)dataHero1.basicParam.hp).ToString();
            //ap
            _current_Label_2.text = ((int)dataHero1.basicParam.damage).ToString();
            //dp
            _current_Label_3.text   = ((int)dataHero1.basicParam.ammo).ToString();
            _UPcurrent_Label_1.text = dataHeroUpgrade1.kHP.ToString();
            _UPcurrent_Label_2.text = dataHeroUpgrade1.kAP.ToString();
            _UPcurrent_Label_3.text = dataHeroUpgrade1.kDP.ToString();

            if (hero.stage + 1 > MAXSTAGE)
            {
                _willbe_Label_1.gameObject.SetActive(false);
                _willbe_Label_2.gameObject.SetActive(false);
                _willbe_Label_3.gameObject.SetActive(false);
                _UPwillbe_Label_1.gameObject.SetActive(false);
                _UPwillbe_Label_2.gameObject.SetActive(false);
                _UPwillbe_Label_3.gameObject.SetActive(false);
            }
            else
            {
                DataHero        dataHero2        = DataManager.instance.dataHeroGroup.GetHero(_heroData.id, hero.exp, hero.stage + 1);
                DataHeroUpgrade dataHeroUpgrade2 = DataManager.instance.dataHeroGroup.GetHeroUpgrade(_heroData.id, hero.stage + 1);
                _willbe_Label_1.gameObject.SetActive(true);
                _willbe_Label_2.gameObject.SetActive(true);
                _willbe_Label_3.gameObject.SetActive(true);
                _UPwillbe_Label_1.gameObject.SetActive(true);
                _UPwillbe_Label_2.gameObject.SetActive(true);
                _UPwillbe_Label_3.gameObject.SetActive(true);
                _willbe_Label_1.text   = ((int)dataHero2.basicParam.hp).ToString();
                _willbe_Label_2.text   = ((int)dataHero2.basicParam.damage).ToString();
                _willbe_Label_3.text   = ((int)dataHero2.basicParam.ammo).ToString();
                _UPwillbe_Label_1.text = dataHeroUpgrade2.kHP.ToString();
                _UPwillbe_Label_2.text = dataHeroUpgrade2.kAP.ToString();
                _UPwillbe_Label_3.text = dataHeroUpgrade2.kDP.ToString();
            }

            //hitRate
            float  hitDodDou     = 0.0f;
            string hitDodDouDesc = "";
            if (dataHero1.basicParam.hitRate != 0.0f)
            {
                hitDodDouDesc = "命中";
                hitDodDou     = dataHero1.basicParam.hitRate;
            }
            if (dataHero1.basicParam.dodgeRate != 0.0f)
            {
                hitDodDouDesc = "闪避";
                hitDodDou     = dataHero1.basicParam.dodgeRate;
            }
            if (dataHero1.basicParam.doubleDamageRate != 0.0f)
            {
                hitDodDouDesc = "暴击";
                hitDodDou     = dataHero1.basicParam.doubleDamageRate;
            }
            if (hitDodDou != 0.0f)
            {
                _attribute_Label_4.gameObject.SetActive(true);
                _current_Label_4.text = hitDodDou.ToString();
            }
            else
            {
                _attribute_Label_4.gameObject.SetActive(false);
            }


            if (hero.stage + 1 > MAXSTAGE)
            {
                _willbe_Label_4.gameObject.SetActive(false);
            }
            else
            {
                _willbe_Label_4.gameObject.SetActive(true);
                DataHero dataHero2 = DataManager.instance.dataHeroGroup.GetHero(_heroData.id, hero.exp, hero.stage + 1);
                if (dataHero2.basicParam.hitRate != 0.0f)
                {
                    hitDodDouDesc = "命中";
                    hitDodDou     = dataHero2.basicParam.hitRate;
                }
                if (dataHero2.basicParam.dodgeRate != 0.0f)
                {
                    hitDodDouDesc = "闪避";
                    hitDodDou     = dataHero2.basicParam.dodgeRate;
                }
                if (dataHero2.basicParam.doubleDamageRate != 0.0f)
                {
                    hitDodDouDesc = "暴击";
                    hitDodDou     = dataHero2.basicParam.doubleDamageRate;
                }
                if (hitDodDou != 0.0f)
                {
                    _willbe_Label_4.gameObject.SetActive(true);
                    _willbe_Label_4.text = hitDodDou.ToString();
                }
                else
                {
                    _willbe_Label_4.gameObject.SetActive(false);
                }
            }
        }
    }