コード例 #1
0
    public void SetDetail(PacketStructHero heroData)
    {
        ClearView();
        if (heroData == null || heroData.hero_id == 0)
        {
            return;
        }
        MasterDataHero heroMaster = MasterFinder <MasterDataHero> .Instance.Find((int)heroData.hero_id);

        if (heroMaster == null)
        {
            return;
        }

        SetUpHeroName(heroData.hero_id); // 名前
        MessageText = heroMaster.detail; // 詳細テキスト

        AssetBundler.Create().Set("hero_" + heroData.hero_id.ToString("0000"), "hero_" + heroData.hero_id.ToString("0000"), (o) =>
        {
            Sprite[] sprite = o.AssetBundle.LoadAssetWithSubAssets <Sprite>("hero_" + heroData.hero_id.ToString("0000"));
            HeroImage       = sprite[4];
        }).Load();
        //------------------------------------------------------------------
        // グレードの設定
        //------------------------------------------------------------------
        m_GradeNum = heroData.level;

        MasterDataHeroLevel nextHeroLevelMaster = MasterFinder <MasterDataHeroLevel> .Instance.Find((int)heroData.level + 1);

        if (nextHeroLevelMaster != null)
        {
            m_NextGradeNum = nextHeroLevelMaster.exp_next_total - heroData.exp;
        }
        else
        {
            m_NextGradeNum = 0;
        }

        //------------------------------------------------------------------
        // イラストレーター名
        //------------------------------------------------------------------

        /*
         *      MasterDataIllustrator illustratorMaster = MasterFinder<MasterDataIllustrator>.Instance.Find((int)heroMaster.illustrator_id);
         *      if (illustratorMaster != null)
         *      {
         *          IllustratorText = illustratorMaster.name;
         *      }
         */
        //------------------------------------------------------------------
        // スキルの設定
        //------------------------------------------------------------------
        List <UnitSkillContext> skillList = new List <UnitSkillContext>();
        UnitSkillContext        skill     = new UnitSkillContext();

        skill.setupHeroSkill((uint)heroMaster.default_skill_id, 0, 0, true);
        skillList.Add(skill);
        Skills = skillList;
    }
コード例 #2
0
ファイル: HeroDetail.cs プロジェクト: mliuzailin/GitGame
    public void SetDetail(PacketStructHero heroData, Action <HeroStoryListItemContext> _OnClickStoryItem)
    {
        ClearView();
        if (heroData == null || heroData.hero_id == 0)
        {
            return;
        }
        MasterDataHero heroMaster = MasterFinder <MasterDataHero> .Instance.Find((int)heroData.hero_id);

        if (heroMaster == null)
        {
            return;
        }

        SetUpHeroName(heroData.hero_id); // 名前
        MessageText = heroMaster.detail; // 詳細テキスト

        AssetBundler.Create().Set("hero_" + heroData.hero_id.ToString("0000"), "hero_" + heroData.hero_id.ToString("0000"), (o) =>
        {
            Sprite[] sprite = o.AssetBundle.LoadAssetWithSubAssets <Sprite>("hero_" + heroData.hero_id.ToString("0000"));
            HeroImage       = sprite[4];
        }).Load();
        //------------------------------------------------------------------
        // グレードの設定
        //------------------------------------------------------------------
        m_GradeNum = heroData.level;

        MasterDataHeroLevel nextHeroLevelMaster = MasterFinder <MasterDataHeroLevel> .Instance.Find((int)heroData.level + 1);

        if (nextHeroLevelMaster != null)
        {
            m_NextGradeNum = nextHeroLevelMaster.exp_next_total - heroData.exp;
        }
        else
        {
            m_NextGradeNum = 0;
        }

        //------------------------------------------------------------------
        // イラストレーター名
        //------------------------------------------------------------------
        MasterDataIllustrator illustratorMaster = MasterFinder <MasterDataIllustrator> .Instance.Find((int)heroMaster.illustrator_id);

        if (illustratorMaster != null)
        {
            IllustratorText = illustratorMaster.name;
        }

        //------------------------------------------------------------------
        // スキルの設定
        //------------------------------------------------------------------
        List <UnitSkillContext> skillList = new List <UnitSkillContext>();
        UnitSkillContext        skill     = new UnitSkillContext();

        skill.setupHeroSkill((uint)heroMaster.default_skill_id, heroData.hero_id, m_GradeNum, true);
        skillList.Add(skill);
        Skills = skillList;

        //------------------------------------------------------------------
        // ストーリの設定
        //------------------------------------------------------------------
        List <HeroStoryListItemContext> storyList = new List <HeroStoryListItemContext>();

        for (int i = 0; i < 4; ++i)
        {
            var model = new ListItemModel((uint)i);
            HeroStoryListItemContext story = new HeroStoryListItemContext(model);
            story.StoryTitle = "";
            storyList.Add(story);

            model.OnClicked += () =>
            {
                _OnClickStoryItem(story);
            };

            // TODO : 演出を入れるならそこに移動
            model.Appear();
            model.SkipAppearing();
        }

        SetStory(storyList[0], (uint)heroData.hero_id);
        storyList[1].ContentText = "";
        storyList[2].ContentText = "";
        storyList[3].ContentText = "";

        storyList[0].IsOpenStory = true;

        Stories = storyList;
    }