Esempio n. 1
0
    public void initHero(int hashcode)
    {
        heroHashcode = hashcode;
        refreshUnlockBtn();
        if (heroHashcode == 0)
        {
            initEmptyHero();
        }
        else
        {
            addImg.gameObject.SetActive(false);
            string      id   = SDDataManager.Instance.getHeroIdByHashcode(heroHashcode);
            GDEHeroData hero = SDDataManager.Instance.GetHeroOwnedByHashcode(heroHashcode);
            ROHeroData  dal  = SDDataManager.Instance.getHeroDataByID(id, hero.starNumUpgradeTimes);

            levelText.gameObject.SetActive(true);
            levelText.text = "Lv." + SDDataManager.Instance.getLevelByExp(hero.exp);
            //nameText.text = SDGameManager.T(dal.Info.Name);
            icon.sprite   = dal.Info.FaceIcon;
            bgIcon.sprite = SDDataManager.Instance.baseBgSpriteByRarity
                                (dal.Info.Rarity);
            frameIcon.sprite = SDDataManager.Instance.heroBoxFrameByRarity
                                   (dal.Info.Rarity);
        }
    }
Esempio n. 2
0
    public void setHero(int hashcode)
    {
        GDEHeroData heroData = SDDataManager.Instance.GetHeroOwnedByHashcode(hashcode);
        string      id       = heroData.id;

        ID          = id;
        careerIndex = SDDataManager.Instance.getHeroCareerById(id);
        raceIndex   = SDDataManager.Instance.getHeroRaceById(id);

        ROHeroData dal = SDDataManager.Instance.getHeroDataByID(id, heroData.starNumUpgradeTimes);


        //career
        RoleCareer c = dal.Info.Career;

        CareerIconImg.sprite = c.Icon;
        CareerIconImg.SetNativeSize();
        CareerText.text = SDGameManager.T(c.NAME);
        //race
        HeroRace r = dal.Info.Race;

        RaceIconImg.sprite = r.Icon;
        RaceIconImg.SetNativeSize();
        RaceText.text = SDGameManager.T(r.NAME);
        //rarity
        RarityImg.sprite = SDDataManager.Instance.raritySprite(dal.quality);
        RarityImg.SetNativeSize();
        //personalDrawImg
        if (dal.Info.PersonalDrawImg == null)
        {
            HCdI_Bg.gameObject.SetActive(false);
            heroCharacterDrawingImg.sprite = RaceIconImg.sprite;
            heroCharacterDrawingImg.SetNativeSize();
            heroCharacterDrawingImg.color = Color.grey;
        }
        else
        {
            HCdI_Bg.gameObject.SetActive(true);
            heroCharacterDrawingImg.sprite = dal.Info.PersonalDrawImg;
            heroCharacterDrawingImg.SetNativeSize();
            heroCharacterDrawingImg.color = Color.white;
            HCdI_Bg.sprite = RaceIconImg.sprite;
            HCdI_Bg.SetNativeSize();
            HCdI_Bg.color = Color.white;
        }



        //RaceIconImg.sprite =
        int grade = SDDataManager.Instance.getLevelByExp(heroData.exp);

        _hero.gender = (CharacterSex)heroData.sex;
        _hero.initData_Hero((Job)careerIndex, raceIndex, grade, dal.quality, dal.starNum
                            , dal.ExportRAL
                            , dal.CRIDmg, dal.DmgReduction, dal.DmgReflection, dal.RewardRate
                            , dal.BarChartRegendPerTurn, ID, dal.Info.Name, heroData.wakeNum);
    }
Esempio n. 3
0
    public void initInjuriedHero(GDEHeroData hero)
    {
        type         = SDConstants.ItemType.Hero;
        itemId       = hero.id;
        itemHashcode = hero.hashCode;
        //
        float fatigueRate = SDDataManager.Instance.getHeroFatigueRate(hero.hashCode);
        int   status      = SDDataManager.Instance.getHeroStatus(hero.hashCode);

        Debug.Log("该英雄疲劳值:" + hero.Fatigue);
        //
        ROHeroData dal = SDDataManager.Instance.getHeroDataByID(itemId, hero.starNumUpgradeTimes);

        upText.gameObject.SetActive(true);
        upText.text = "Lv." + SDDataManager.Instance.getLevelByExp(hero.exp);
        if (downText)
        {
            downText.text = SDGameManager.T(dal.Info.Name);
        }
        if (slider)
        {
            slider.gameObject.SetActive(true);
        }
        //
        if (status == 2)
        {
            isSelected = false;
            isUnable   = false;
        }//受伤且未进行治疗状态
        else if (status == 3)
        {
            isSelected = false;
            isUnable   = true;
        }//已经在治疗状态
        else if (status == 0)
        {
            isSelected = false;
            if (fatigueRate > 0.1f)
            {
                isUnable = false;
            }
            else
            {
                isUnable = true;
            }
        }//无事可做状态
        else
        {
            isSelected = false;
            isUnable   = true;
        }
        //starVision.StarNum = dal.starNum;
        starVision.gameObject.SetActive(false);
        slider.GetChild(0).localScale
            = new Vector3(1 - fatigueRate, 1, 1);
    }
Esempio n. 4
0
    /// <summary>
    /// 初始化英雄出战选人页
    /// </summary>
    /// <param name="hero"></param>
    public void initBattleHero(GDEHeroData hero)
    {
        type         = SDConstants.ItemType.Hero;
        itemId       = hero.id;
        itemHashcode = hero.hashCode;
        //

        //
        ROHeroData dal = SDDataManager.Instance.getHeroDataByID(itemId, hero.starNumUpgradeTimes);

        //if (frameImg != null) frameImg.gameObject.SetActive(false);

        upText.gameObject.SetActive(true);
        upText.text   = SDGameManager.T("Lv.") + SDDataManager.Instance.getLevelByExp(hero.exp);
        downText.text = SDGameManager.T(dal.Info.Name);
        slider?.gameObject.SetActive(false);
        //
        int status = SDDataManager.Instance.getHeroStatus(hero.hashCode);

        if (status == 0)
        {
            isSelected = false;
            isUnable   = false;
        }//无业
        else if (status == 1)
        {
            isSelected = true;
            isUnable   = false;
        }//战斗队伍中
        else
        {
            isSelected = false;
            isUnable   = true;
        }//其他状态
        //statusImg.gameObject.SetActive(true);
        //statusImg.sprite = herostat
        starVision.StarNum = dal.starNum;

        if (careerImg)
        {
            Sprite career = dal.Info.Career.Icon;
            careerImg.sprite = career;
        }
        if (raceImg)
        {
            Sprite race = dal.Info.Race.Icon;
            if (dal.Info.Race.NAME == "无种族")
            {
                HeroRace _r = dal.Info.Race;
                race = _r.Icon;
            }
            raceImg.sprite = race;
        }
        itemBgImg.sprite = SDDataManager.Instance.heroBgSpriteByRarity(dal.Info.Rarity);
        frameImg.sprite  = SDDataManager.Instance.heroFrameSpriteByRarity(dal.Info.Rarity);
    }
Esempio n. 5
0
    public void initHero(int heroHashCode)
    {
        unitHashcode = heroHashCode;
        SDHero h;

        if (GetComponent <SDHero>())
        {
            h = GetComponent <SDHero>();
        }
        else
        {
            h = gameObject.AddComponent <SDHero>();
        }
        HeroProperty._hero = h;
        GDEHeroData heroData
            = SDDataManager.Instance.GetHeroOwnedByHashcode(unitHashcode);

        //
        if (heroData != null)
        {
            HeroProperty._hero.nameBeforeId = heroData.nameBeforeId;

            //
            UnitId          = SDDataManager.Instance.getHeroIdByHashcode(unitHashcode);
            HeroProperty.ID = HeroProperty._hero.ID = UnitId;
            ROHeroData dal = SDDataManager.Instance
                             .getHeroDataByID(UnitId, heroData.starNumUpgradeTimes);
            //
            unit_character_model.initHeroCharacterModel(heroHashCode, SDConstants.HERO_MODEL_RATIO);
            //
            int grade = SDDataManager.Instance.getLevelByExp(heroData.exp);
            HeroProperty._hero.grade = grade;

            RoleAttributeList _ral = dal.ExportRAL;
            _ral.Add(RoleAttributeList.GDEToRAL(heroData.RoleAttritubeList));
            //
            Race _race = dal.Info.Race.Race;
            //
            HeroProperty._hero.initData_Hero
                (dal.Info.Career.Career, _race
                , grade, 0, dal.starNum
                , _ral
                , dal.CRIDmg, dal.DmgReduction, dal.DmgReflection, dal.RewardRate
                , dal.BarChartRegendPerTurn, UnitId, dal.Info.Name, heroData.wakeNum);;
            HeroProperty._hero.gender = (CharacterSex)heroData.sex;
            addSkillByCareerByRaceByStarnum(heroHashCode, dal.starNum);
        }
    }
Esempio n. 6
0
    public void initHero(GDEHeroData hero)
    {
        type         = SDConstants.ItemType.Hero;
        itemId       = hero.id;
        itemHashcode = hero.hashCode;
        if (fightForceText)
        {
            fightForceText.text
                = "" + (SDDataManager.Instance.getHeroOriginalBattleForceByHashCode(itemHashcode));//读取角色战斗力
        }
        SDConstants.CharacterAnimType animType = (SDConstants.CharacterAnimType)
                                                     (SDDataManager.Instance.getHeroCareerById(itemId));
        ROHeroData roh = SDDataManager.Instance.getHeroDataByID(itemId, hero.starNumUpgradeTimes);

        if (characterModel != null)
        {
            characterModel.initHeroCharacterModel(itemHashcode, SDConstants.HERO_MODEL_RATIO);
        }
        itemLevel = SDDataManager.Instance.getLevelByExp(hero.exp);
        if (upText)
        {
            upText.gameObject.SetActive(false);
        }
        if (downText)
        {
            downText.text = SDGameManager.T("Lv.") + itemLevel;
        }
        if (slider)
        {
            slider.gameObject.SetActive(false);
        }
        if (starVision)
        {
            starVision.StarNum = roh.starNum;
        }
        if (statusImg)
        {
            statusImg.gameObject.SetActive(true);
            statusImg.sprite = UIEffectManager.Instance.heroStatusSps[hero.status];
        }

        //
        if (itemImg)
        {
        }
        //
        if (careerImg)
        {
            Sprite career = roh.Info.Career.Icon;
            careerImg.sprite = career;
        }
        if (raceImg)
        {
            Sprite race = roh.Info.Race.Icon;
            if (roh.Info.Race.NAME == "无种族")
            {
                HeroRace _r = roh.Info.Race;
                race = _r.Icon;
            }
            raceImg.sprite = race;
        }
        if (itemBgImg)
        {
            itemBgImg.sprite
                = SDDataManager.Instance.heroBgSpriteByRarity(roh.Info.Rarity);
        }
        if (frameImg)
        {
            frameImg.sprite
                = SDDataManager.Instance.heroFrameSpriteByRarity(roh.Info.Rarity);
        }
    }