Пример #1
0
        public bool CanLevelUp(SkillItem skillItem)
        {
            ItemDTO reduceDTO = GetSkillUpdateItem();

            if (reduceDTO == null)
            {
                return(false);
            }
            int       level       = GetSkillLevel(skillItem.id);
            SkillItem skillConfig = Global.gApp.gGameData.SkillData.Get(skillItem.id);

            Skill_dataItem levelData = Global.gApp.gGameData.SkillDataConfig.Get(level + 1);

            float[] param = null;
            try
            {
                param = ReflectionUtil.GetValueByProperty <Skill_dataItem, float[]>(skillItem.id, levelData);
            }
            catch (Exception e)
            {
                Debug.LogError(skillItem.id + "在等级表中不存在");
            }

            return(skillConfig.weight > 0 && param != null && param.Length > 0 && GameItemFactory.GetInstance().GetItem(reduceDTO.itemId) >= reduceDTO.num);
        }
Пример #2
0
        private void InitNode()
        {
            int skillLevel = Global.gApp.gSystemMgr.GetSkillMgr().GetSkillLevel(m_ShowSkillItem.id);

            m_Pre_Lv.text.text = (skillLevel - 1).ToString();
            m_Cur_Lv.text.text = (skillLevel).ToString();
            string         tips            = Global.gApp.gGameData.GetTipsInCurLanguage(m_ShowSkillItem.desc);
            string         maxTips         = Global.gApp.gGameData.GetTipsInCurLanguage(m_ShowSkillItem.max_desc);
            string         title           = Global.gApp.gGameData.GetTipsInCurLanguage(m_ShowSkillItem.name);
            Skill_dataItem skillItemConfig = Global.gApp.gGameData.SkillDataConfig.Get(skillLevel);

            float[]        curSkillParam       = skillItemConfig == null ? null : ReflectionUtil.GetValueByProperty <Skill_dataItem, float[]>(m_ShowSkillItem.id, skillItemConfig);
            Skill_dataItem nextSkillItemConfig = Global.gApp.gGameData.SkillDataConfig.Get(skillLevel + 1);

            float[] nextSkillParam = nextSkillItemConfig == null ? null : ReflectionUtil.GetValueByProperty <Skill_dataItem, float[]>(m_ShowSkillItem.id, nextSkillItemConfig);

            //等级最大
            if (nextSkillParam == null || nextSkillParam.Length == 0)
            {
                m_tip.text.text = string.Format(maxTips, Global.gApp.gSystemMgr.GetPassMgr().GetParamStr(m_ShowSkillItem, curSkillParam));
            }
            else
            {
                m_tip.text.text = string.Format(tips, Global.gApp.gSystemMgr.GetPassMgr().GetParamStr(m_ShowSkillItem, curSkillParam)
                                                , Global.gApp.gSystemMgr.GetPassMgr().GetParamStr(m_ShowSkillItem, nextSkillParam));
            }

            m_titletxt.text.text = title;
            m_CloseBtn.button.onClick.AddListener(CloseCall);
            m_Icon.image.sprite = Global.gApp.gResMgr.LoadAssets <Sprite>(m_ShowSkillItem.icon);
            m_Icon.image.SetNativeSize();
            m_AllNode.gameObject.SetActive(false);
            gameObject.AddComponent <DelayCallBack>().SetAction(DelayCall, 0.2f, true);
        }
Пример #3
0
        public float GetHitTimeSkillParam()
        {
            //设置攻速技能
            int            skillLevel     = GetSkillLevel(GameConstVal.SExHitTime);
            Skill_dataItem skillLevelData = Global.gApp.gGameData.SkillDataConfig.Get(skillLevel);
            float          skillParam     = (skillLevelData == null) ? 1f : skillLevelData.skill_exhittime[0];

            return(skillParam);
        }
Пример #4
0
        public ItemDTO GetSkillUpdateItem()
        {
            GeneralConfigItem skillUpdateConfig = Global.gApp.gGameData.GeneralConfigData.Get(GeneralConfigConstVal.SKILL_UPDATE);
            Skill_dataItem    skillItemConfig   = Global.gApp.gGameData.SkillDataConfig.Get(Global.gApp.gSystemMgr.GetSkillMgr().GetTimes() + 1);

            if (skillItemConfig == null)
            {
                return(null);
            }
            int    itemId = SpecialItemIdConstVal.GOLD;
            double cum    = skillItemConfig.coinCost;

            return(new ItemDTO(itemId, cum, BehaviorTypeConstVal.OPT_SKILL_UPDATE));
        }
Пример #5
0
 private void InitOnceInfo(GameObject player, EZ.Data.MonsterItem monsterItem)
 {
     if (m_PlayerGo != null)
     {
         return;
     }
     if (SkinePlayerAnim != null)
     {
         SkinePlayerAnim.Init();
     }
     m_OriLayer    = gameObject.layer;
     m_BodyNode    = transform.Find(GameConstVal.BodyNode);
     m_HpNode      = transform.Find(GameConstVal.HpNode);
     m_AiBase      = GetComponents <AiBase>();
     m_MonsterId   = monsterItem.tag;
     m_PlayerGo    = player;
     m_Player      = player.GetComponent <Player>();
     m_MonsterItem = monsterItem;
     m_Rigidbody2D = GetComponent <Rigidbody2D>();
     m_OriMass     = m_Rigidbody2D.mass;
     m_Collider2D  = GetComponent <Collider2D>();
     m_AiPauseAct  = GetComponentInChildren <AIPauseAct>();
     m_OriScale    = transform.localScale;
     m_OriSpeed    = monsterItem.aniSpeed;
     if (monsterItem.type == (int)MonsterType.Boss)
     {
         int            skillLevel     = Global.gApp.gSystemMgr.GetSkillMgr().GetSkillLevel(GameConstVal.SExBossHarm);
         Skill_dataItem skillLevelData = Global.gApp.gGameData.SkillDataConfig.Get(skillLevel);
         m_DamageParam   = (skillLevelData == null) ? 1f : skillLevelData.skill_exbossharm[0];
         m_DeadthBackAct = false;
     }
     if (monsterItem.type == (int)MonsterType.Normal)
     {
         m_IsNormalMonster = true;
     }
     else
     {
         m_IsNormalMonster = false;
     }
 }
Пример #6
0
        private void SetSkillInfo(SkillItem skillItem)
        {
            RectTransform_Button_Image_Container skillItemRect = ReflectionUtil.GetValueByProperty <SkillUI, RectTransform_Button_Image_Container>("skill_item" + skillItem.location, this);

            skillItemRect.rectTransform.GetChild(1).GetComponent <Image>().sprite = Global.gApp.gResMgr.LoadAssets <Sprite>(skillItem.icon);
            int skillLevel = Global.gApp.gSystemMgr.GetSkillMgr().GetSkillLevel(skillItem.id);

            skillItemRect.rectTransform.GetChild(2).GetChild(1).GetComponent <Text>().text = skillLevel.ToString();
            skillItemRect.rectTransform.GetChild(5).GetComponent <Text>().text             = Global.gApp.gGameData.GetTipsInCurLanguage(skillItem.name);


            skillItemRect.rectTransform.GetChild(4).gameObject.SetActive(skillLevel == 0);
            skillItemRect.rectTransform.GetChild(1).gameObject.SetActive(skillLevel > 0);
            skillItemRect.rectTransform.GetChild(2).gameObject.SetActive(skillLevel > 0);

            int[] ints = new int[] { 0, 1, 4 };
            if (skillLevel == 0)
            {
                foreach (int i in ints)
                {
                    Color color = skillItemRect.rectTransform.GetChild(i).GetComponent <Image>().color;
                    color.a = 0.5f;
                    skillItemRect.rectTransform.GetChild(i).GetComponent <Image>().color = color;
                }
            }
            else
            {
                foreach (int i in ints)
                {
                    Color color = skillItemRect.rectTransform.GetChild(i).GetComponent <Image>().color;
                    color.a = 1f;
                    skillItemRect.rectTransform.GetChild(i).GetComponent <Image>().color = color;
                }
            }

            int nextLevel  = (Global.gApp.gSystemMgr.GetSkillMgr().GetTimes() / m_LevelSkillTimes + 1) * m_LevelSkillTimes;
            int timesLimit = (Global.gApp.gSystemMgr.GetBaseAttrMgr().GetLevel() / m_LevelSkillTimes) * m_LevelSkillTimes;

            UpBtn.gameObject.SetActive(timesLimit > Global.gApp.gSystemMgr.GetSkillMgr().GetTimes());
            TimesText.gameObject.SetActive(timesLimit <= Global.gApp.gSystemMgr.GetSkillMgr().GetTimes());
            TimesText.text.text = string.Format(Global.gApp.gGameData.GetTipsInCurLanguage(3045), nextLevel);


            string tips        = Global.gApp.gGameData.GetTipsInCurLanguage(skillItem.desc);
            string noLearnTips = Global.gApp.gGameData.GetTipsInCurLanguage(skillItem.desc_nolearn);
            string maxTips     = Global.gApp.gGameData.GetTipsInCurLanguage(skillItem.max_desc);

            Skill_dataItem skillItemConfig = Global.gApp.gGameData.SkillDataConfig.Get(skillLevel);

            float[]        curSkillParam       = skillItemConfig == null ? null : ReflectionUtil.GetValueByProperty <Skill_dataItem, float[]>(skillItem.id, skillItemConfig);
            Skill_dataItem nextSkillItemConfig = Global.gApp.gGameData.SkillDataConfig.Get(skillLevel + 1);

            float[]   nextSkillParam = nextSkillItemConfig == null ? null : ReflectionUtil.GetValueByProperty <Skill_dataItem, float[]>(skillItem.id, nextSkillItemConfig);
            Transform tip            = transform.Find("Tips").Find("m_tip" + skillItem.location);

            if (nextSkillParam == null || nextSkillParam.Length == 0)
            {
                tip.GetComponentInChildren <Text>().text = string.Format(maxTips, Global.gApp.gSystemMgr.GetPassMgr().GetParamStr(skillItem, curSkillParam));
            }
            else if (skillLevel == 0)
            {
                tip.GetComponentInChildren <Text>().text = string.Format(noLearnTips, Global.gApp.gSystemMgr.GetPassMgr().GetParamStr(skillItem, nextSkillParam));
            }
            else
            {
                tip.GetComponentInChildren <Text>().text = string.Format(tips, Global.gApp.gSystemMgr.GetPassMgr().GetParamStr(skillItem, curSkillParam)
                                                                         , Global.gApp.gSystemMgr.GetPassMgr().GetParamStr(skillItem, nextSkillParam));
            }

            m_TotalTimes.text.text = Global.gApp.gSystemMgr.GetSkillMgr().GetTimes().ToString();
        }