示例#1
0
    /// <summary>
    /// 初始化
    /// </summary>
    /// <param name="data">PlayerSirenConfigData</param>
    /// <param name="selected">SelectedSirenDelegate</param>
    public void Init(PlayerSirenConfigData data, SelectedSirenDelegate selected)
    {
        //赋值
        m_PlayerSirenConfigData = data;
        var sirenInfo = SirenManager.Instance.GetYaoNvList().SingleOrDefault(p => p.byYaoNvID == data._sirenID);

        m_CurLevel = sirenInfo.byLevel;//sirenInfo可能是空值

        //妖女头像
        //GameObject headGO = (GameObject)Instantiate(data._portraitPrefab);
        //headGO.transform.parent = HeadTrans;
        //headGO.transform.localScale = data._portraitPrefab.transform.localScale;
        //headGO.transform.localPosition = Vector3.zero;

        //关联委托
        m_SelectedDelegae = selected;

        //显示界面
        //Label_Name.text = LanguageTextManager.GetString(data._name);
        Sprite_Name.spriteName = data._nameRes;

        //关联回调
        Button.SetCallBackFuntion(OnButtonClick);
        //TODO GuideBtnManager.Instance.RegGuideButton(Button.gameObject, UI.MainUI.UIType.Siren, SubType.SirenItemList, out m_guideBtnID);

        //加成信息
        //显示属性加成信息
        m_PlayerSirenConfigData._sirenConfigDataList.ApplyAllItem(p =>
        {
            string[] growthItem  = p._growthEffect.Split('|');
            int growthItemLength = growthItem.Length;
            List <SirenGrowthEffect> effectList = new List <SirenGrowthEffect>();
            for (int i = 0; i < growthItemLength; i++)
            {
                string[] growthEffect = growthItem[i].Split('+');
                //growthEffect[0] 属性名称
                //growthEffect[1] 属性加成
                var effectData = ItemDataManager.Instance.GetEffectData(growthEffect[0]);
                if (effectData != null)
                {
                    SirenGrowthEffect sirenGrowthEffect = new SirenGrowthEffect()
                    {
                        EffectData        = effectData,
                        GrowthEffectValue = Convert.ToInt32(growthEffect[1])
                    };
                    effectList.Add(sirenGrowthEffect);
                }
            }
            EffectDict.Add(p._growthLevels, effectList);
        });
    }
示例#2
0
    /// <summary>
    /// 初始化
    /// </summary>
    /// <param name="data">PlayerSirenConfigData</param>
    /// <param name="selected">SelectedSirenDelegate</param>
    public void Init(PlayerSirenConfigData data, SelectedSirenDelegate selected)
    {
        //赋值
        m_PlayerSirenConfigData = data;
        var sirenInfo = SirenManager.Instance.GetYaoNvList().SingleOrDefault(p => p.byYaoNvID == data._sirenID);

        m_CurLevel      = sirenInfo.byLevel;   //sirenInfo可能是空值
        m_CurExperience = sirenInfo.lExperience;

        //关联委托
        m_SelectedDelegae = selected;

        //加成信息
        //显示属性加成信息
        m_PlayerSirenConfigData._sirenConfigDataList.ApplyAllItem(p =>
        {
            string[] growthItem    = p._GrowthEffect.Split('|');
            string[] growthMaxItem = p._MaxGrowthEffect.Split('|');
            int growthItemLength   = growthItem.Length;
            List <SirenGrowthEffect> effectList = new List <SirenGrowthEffect>();
            for (int i = 0; i < growthItemLength; i++)
            {
                string[] growthEffect    = growthItem[i].Split('+');
                string[] growthMaxEffect = growthMaxItem[i].Split('+');
                //growthEffect[0] 属性名称
                //growthEffect[1] 属性加成
                var effectData = ItemDataManager.Instance.GetEffectData(growthEffect[0]);
                if (effectData != null)
                {
                    SirenGrowthEffect sirenGrowthEffect = new SirenGrowthEffect()
                    {
                        EffectData           = effectData,
                        GrowthEffectValue    = Convert.ToInt32(growthEffect[1]),
                        GrowthEffectMaxValue = Convert.ToInt32(growthMaxEffect[1])
                    };
                    effectList.Add(sirenGrowthEffect);
                }
            }
            EffectDict.Add(p._growthLevels, effectList);
        });

        //解锁条件
        m_UnlockTexts = m_PlayerSirenConfigData._UnlockText.Split('|');
    }