コード例 #1
0
    private void OnEditorReloadConfig(Event_ e)
    {
        var config = (string)e.param1;

        if (config == "config_animmotioninfos")
        {
            ResetMotion();
        }
        if (config == "config_upskillinfos")
        {
            m_skillDamageMul = m_skill > -1 && m_level > -1 ? UpSkillInfo.GetOverrideDamage(m_skill, m_level) : 0;
        }
    }
コード例 #2
0
    public static StateMachineState Create(StateMachine stateMachine, StateMachineInfo parent, StateMachineInfo.StateDetail info, SkilLEntry skill)
    {
        var state = Create(false);

        state.stateMachine = stateMachine;
        state.parent       = parent;
        state.info         = info;

        state.OnInitialize();

        if (skill.valid)
        {
            state.m_skill = skill.skillId;
            state.m_level = skill.level;

            state.m_skillDamageMul  = state.m_skill > -1 && state.m_level > -1 ? UpSkillInfo.GetOverrideDamage(state.m_skill, state.m_level) : 0;
            state.m_skillDamageMul *= 1 + skill.addtion; // @TODO: ??
        }

        return(state);
    }
コード例 #3
0
ファイル: Window_Skill.cs プロジェクト: NoeCalmness/CoreFrame
    private void SetExpsendText(UpSkillInfo info)
    {
        spParent.gameObject.SetActive(modulePlayer.roleInfo.level >= info.needLv);
        coinParent.gameObject.SetActive(modulePlayer.roleInfo.level >= info.needLv);
        lvParent.gameObject.SetActive(modulePlayer.roleInfo.level < info.needLv);

        if (modulePlayer.roleInfo.level < info.needLv)
        {
            string lv = Util.Format(ConfigText.GetDefalutString(TextForMatType.SkillUIText, 36), info.needLv);
            Util.SetText(needLvText, modulePlayer.roleInfo.level >= info.needLv ? lv : GeneralConfigInfo.GetNoEnoughColorString(lv));
            var needStr = Util.GetString((int)TextForMatType.SkillUIText, 34);
            Util.SetText(needLvText01, GeneralConfigInfo.GetNoEnoughColorString(needStr));
        }
        else
        {
            if (moduleSkill.skillInfo == null)
            {
                return;
            }
            string str = Util.Format(ConfigText.GetDefalutString(TextForMatType.SkillUIText, 30), info.expendSp);
            Util.SetText(expendSkillPoint, moduleSkill.skillInfo.skillPoint >= info.expendSp ? str : GeneralConfigInfo.GetNoEnoughColorString(str));
            Util.SetText(expendCoin, modulePlayer.roleInfo.coin >= info.expendGold ? info.expendGold.ToString() : GeneralConfigInfo.GetNoEnoughColorString(info.expendGold.ToString()));
        }
    }
コード例 #4
0
ファイル: Window_Skill.cs プロジェクト: NoeCalmness/CoreFrame
    private void SetIconItem(SkillData info, Transform skill, UpSkillInfo _info, UpSkillInfo _nextInfo, bool isLockNow)
    {
        if (_info == null || moduleSkill.skillInfo == null)
        {
            return;
        }
        skill.gameObject.SetActive(true);
        AtlasHelper.SetSkillIcon(skill.Find("icon/img"), info.skillInfo.skillIcon);

        Transform lvParent = skill.Find("level");

        if (lvParent)
        {
            lvParent.gameObject.SetActive(!isLockNow);
        }
        Transform mask = skill.Find("icon/mask");

        if (mask)
        {
            mask.gameObject.SetActive(isLockNow);
        }

        Transform newLock = skill.Find("newLock");

        if (newLock)
        {
            newLock.gameObject.SetActive(isLockNow && modulePlayer.roleInfo.level >= info.skillInfo.unLockLv);
        }

        if (!isLockNow)
        {
            Transform lv_text = skill.Find("level/bg");
            Transform lv_max  = skill.Find("level/max");
            if (lv_text && lv_max)
            {
                lv_text.gameObject.SetActive(_nextInfo != null);
                lv_max.gameObject.SetActive(_nextInfo == null);
            }
            Util.SetText(skill.Find("level/bg/txt")?.GetComponent <Text>(), _nextInfo != null ? _info.skillLevel.ToString() : "-1");

            Transform up_image     = skill.Find("level/bg/level_up");
            Transform noMoneyImage = skill.Find("level/bg/level_up_02");
            if (!up_image || !noMoneyImage)
            {
                return;
            }
            if (_nextInfo != null)
            {
                int lv   = _nextInfo.needLv;
                int coin = _nextInfo.expendGold;
                int sp   = _nextInfo.expendSp;
                up_image.gameObject.SetActive(modulePlayer.roleInfo.level >= lv && modulePlayer.roleInfo.coin >= coin && moduleSkill.skillInfo.skillPoint >= sp);
                noMoneyImage.gameObject.SetActive(modulePlayer.roleInfo.level >= lv && (modulePlayer.roleInfo.coin < coin || moduleSkill.skillInfo.skillPoint < sp));
            }
            else
            {
                up_image.gameObject.SetActive(false);
                noMoneyImage.gameObject.SetActive(false);
            }
        }
    }
コード例 #5
0
ファイル: Window_Skill.cs プロジェクト: NoeCalmness/CoreFrame
    private void RefreshSkillDetailPanel(SkillData info)
    {
        if (info == null || info.pskill == null || moduleSkill.skillInfo == null)
        {
            return;
        }
        int  currentLv = info.pskill.level;
        bool isLockNow = moduleSkill.GetIsCurrentLock(info);

        currentLv = isLockNow ? 1 : currentLv;

        UpSkillInfo _info     = moduleSkill.skillLevelInfo.Find(p => p.skillId == info.pskill.skillId && p.skillLevel == currentLv);
        UpSkillInfo _nextInfo = moduleSkill.skillLevelInfo.Find(p => p.skillId == info.pskill.skillId && p.skillLevel == currentLv + 1);

        if (!_info)
        {
            return;
        }
        detaildata = info;

        #region desc相关
        skillName.text = info.skillInfo._name;
        Util.SetText(remainPoint, (int)TextForMatType.SkillUIText, 30, moduleSkill.skillInfo.skillPoint);
        double[] damages = moduleSkill.GetCurrentSkillDamge(_info.skillId, _info.skillLevel);

        string _str    = info.pskill.skillId == moduleSkill.reliveSkillId ? damages[0].ToString() : damages[0].ToString("P2");
        string _spcail = info.pskill.skillId == moduleSkill.reliveSkillId ? damages[1].ToString() : damages[1].ToString("P2");
        if (isLockNow)
        {
            if (info.skillInfo.skillType == (int)SkillType.Single)
            {
                double s = _info.attributes != null && _info.attributes.Length > 0 && _info.attributes[0] != null ? _info.attributes[0].value : 0;
                Util.SetText(skillDesc, info.skillInfo.skillDesc.Length >= 2 ? info.skillInfo.skillDesc[1] : info.skillInfo.skillDesc[0], s);
            }
            else
            {
                int index = info.skillInfo.skillDesc.Length >= 2 ? info.skillInfo.skillDesc[1] : info.skillInfo.skillDesc[0];
                if (damages[1] != 0)
                {
                    Util.SetText(skillDesc, index, _str, _spcail);
                }
                else
                {
                    Util.SetText(skillDesc, index, _str);
                }
            }

            SetExpsendText(_info);
        }
        else
        {
            ConfigText config = ConfigManager.Get <ConfigText>(info.skillInfo.skillDesc[0]);
            if (GeneralConfigInfo.defaultConfig.percentAttriIds == null)
            {
                return;
            }

            bool isContains = config.text[0].Contains("-");

            if (isContains)
            {
                string[] strs = config.text[0].Split('-');
                if (strs.Length == 2)
                {
                    if (_nextInfo)
                    {
                        if (info.skillInfo.skillType == (int)SkillType.Single)
                        {
                            string infoValue = "0";
                            string nextValue = "0";
                            if (_info.attributes != null && _info.attributes.Length > 0 && _info.attributes[0] != null)
                            {
                                double _value = _info.attributes[0].value;
                                infoValue = GeneralConfigInfo.defaultConfig.percentAttriIds.Contains(_info.attributes[0].id) ? _value.ToString("p2") : _value.ToString();
                            }
                            if (_nextInfo.attributes != null && _nextInfo.attributes.Length > 0 && _nextInfo.attributes[0] != null)
                            {
                                double _nextValue = _nextInfo.attributes[0].value;
                                nextValue = GeneralConfigInfo.defaultConfig.percentAttriIds.Contains(_nextInfo.attributes[0].id) ? _nextValue.ToString("p2") : _nextValue.ToString();
                            }
                            Util.SetText(skillDesc, strs[0] + strs[1], infoValue, nextValue);
                        }
                        else
                        {
                            double[] _nextDamages = moduleSkill.GetCurrentSkillDamge(_nextInfo.skillId, _nextInfo.skillLevel);

                            string _nextStr    = info.pskill.skillId == moduleSkill.reliveSkillId ? _nextDamages[0].ToString() : _nextDamages[0].ToString("P2");
                            string _nextSpcail = info.pskill.skillId == moduleSkill.reliveSkillId ? _nextDamages[1].ToString() : _nextDamages[1].ToString("P2");

                            string format = strs[0] + strs[1];
                            var    length = format.Split('{');
                            if (length != null && length.Length == 5)
                            {
                                Util.SetText(skillDesc, format, _str, _spcail, _nextStr, _nextSpcail);
                            }
                            else if (length != null && length.Length == 3)
                            {
                                Util.SetText(skillDesc, format, _str, _nextStr);
                            }
                        }

                        SetExpsendText(_nextInfo);
                    }
                    else
                    {
                        if (info.skillInfo.skillType == (int)SkillType.Single)
                        {
                            string infoValue = "0";
                            if (_info.attributes != null && _info.attributes.Length > 0 && _info.attributes[0] != null)
                            {
                                double _infoValue = _info.attributes[0].value;
                                if (GeneralConfigInfo.defaultConfig.percentAttriIds.Contains(_info.attributes[0].id))
                                {
                                    infoValue = _infoValue.ToString("P2");
                                }
                                else
                                {
                                    infoValue = _infoValue.ToString();
                                }
                            }
                            if (strs[0].Contains("{"))
                            {
                                Util.SetText(skillDesc, strs[0], infoValue);
                            }
                            else
                            {
                                Util.SetText(skillDesc, strs[0]);
                            }
                        }
                        else
                        {
                            if (strs[0].Contains("{"))
                            {
                                var length = strs[0].Split('{');
                                if (length != null && length.Length == 3)
                                {
                                    Util.SetText(skillDesc, strs[0], _str, _spcail);
                                }
                                else if (length != null && length.Length == 2)
                                {
                                    Util.SetText(skillDesc, strs[0], _str);
                                }
                            }
                            else
                            {
                                Util.SetText(skillDesc, strs[0]);
                            }
                        }
                    }
                }
            }
        }

        maxLvTran.gameObject.SetActive(_nextInfo == null);
        consumeTran.gameObject.SetActive(_nextInfo != null);
        #endregion

        #region icon相关
        string haveName = info.skillInfo.skillFrame + "(Clone)";
        Util.DisableAllChildren(iconParent, haveName);
        Transform item = iconParent.Find(haveName);
        if (!item)
        {
            Transform template = GetComponent <Transform>(info.skillInfo.skillFrame);
            if (!template)
            {
                return;
            }
            item = iconParent.AddNewChild(template);
        }
        Transform des = item.Find("des");
        if (des)
        {
            des.gameObject.SetActive(false);
        }
        SetIconItem(info, item, _info, _nextInfo, isLockNow);
        if (info.skillInfo.inputs == null || info.skillInfo.inputs.Length == 0 || info.skillInfo.inputs.Contains(0) || isLockNow)
        {
            Util.DisableAllChildren(inputDetailParent);
            if (info.skillInfo.skillDesc.Length == 3)
            {
                explainDetail.SafeSetActive(true);
                Util.SetText(explainText, (int)TextForMatType.SkillUIText, 39);
                Util.SetText(explainDetail, info.skillInfo.skillDesc[2]);
            }
            else
            {
                explainDetail.SafeSetActive(false);
                Util.SetText(explainText, (int)TextForMatType.SkillUIText, 15);
            }
        }
        else
        {
            Util.SetText(explainText, (int)TextForMatType.SkillUIText, 15);
            explainDetail.SafeSetActive(false);
            SetInputKeys(info, inputDetailParent, inputsInDetail);
        }
        #endregion

        #region btn相关
        Util.SetText(upOrLearnText, (int)TextForMatType.SkillUIText, isLockNow ? 32 : 18);
        if (isLockNow)
        {
            upBtn.interactable = _info && modulePlayer.roleInfo.level >= _info.needLv && modulePlayer.roleInfo.level >= info.skillInfo.unLockLv;
        }
        else
        {
            upBtn.interactable = _nextInfo && modulePlayer.roleInfo.level >= _nextInfo.needLv;
        }
        upBtn.onClick.RemoveAllListeners();
        upBtn.onClick.AddListener(() =>
        {
            if (_nextInfo != null)
            {
                int gold = isLockNow ? _info.expendGold : _nextInfo.expendGold;
                if (modulePlayer.roleInfo.coin < gold)
                {
                    moduleGlobal.ShowMessage(ConfigText.GetDefalutString(TextForMatType.SkillUIText, 24));
                    moduleGlobal.OpenExchangeTip(TipType.BuyGoldTip);
                    return;
                }

                if (moduleSkill.skillInfo.skillPoint < _nextInfo.expendSp)
                {
                    moduleGlobal.ShowMessage(ConfigText.GetDefalutString(TextForMatType.SkillUIText, 23));
                    moduleGlobal.OpenExchangeTip(TipType.BuySkillPointTip);
                    return;
                }
            }
            upBtn.interactable            = false;
            moduleSkill.currentClickSkill = info;
            isLockUP = isLockNow;
            effectUp.gameObject.SetActive(false);
            effectLock.gameObject.SetActive(false);
            moduleSkill.SendUpSkillLv((ushort)info.pskill.skillId);
        });
        #endregion
    }
コード例 #6
0
ファイル: Window_Skill.cs プロジェクト: NoeCalmness/CoreFrame
    private void Refresh_skillItem(SkillData info, Transform position, Transform item, SkillType type)
    {
        if (info == null || position == null || item == null)
        {
            return;
        }

        BaseRestrain.SetRestrainData(item.gameObject, info.pskill.skillId, info.skillInfo.protoId);
        int  currentLv = info.pskill.level;
        bool isLockNow = moduleSkill.GetIsCurrentLock(info);

        currentLv = isLockNow ? 1 : currentLv;

        UpSkillInfo _info     = moduleSkill.skillLevelInfo.Find(p => p.skillId == info.pskill.skillId && p.skillLevel == currentLv);
        UpSkillInfo _nextInfo = moduleSkill.skillLevelInfo.Find(p => p.skillId == info.pskill.skillId && p.skillLevel == currentLv + 1);

        if (_info == null)
        {
            return;
        }
        //icon相关
        Util.DisableAllChildren(position, item.name);
        SetIconItem(info, item, _info, _nextInfo, isLockNow);

        //desc相关
        var textParent = position.Find("txt_frame");

        textParent.SafeSetActive(type == SkillType.Special);
        var text = textParent?.GetComponent <Text>("Text");

        if (type == SkillType.Special)
        {
            double[] damages = moduleSkill.GetCurrentSkillDamge(_info.skillId, _info.skillLevel);

            //弱点打击要记两种伤害,普通攻击和弱点打击伤害,复活不显示百分数
            string _str    = info.pskill.skillId == moduleSkill.reliveSkillId ? damages[0].ToString() : damages[0].ToString("P2");
            string _spcail = info.pskill.skillId == moduleSkill.reliveSkillId ? damages[1].ToString() : damages[1].ToString("P2");
            if (isLockNow)
            {
                int index = info.skillInfo.skillDesc.Length >= 2 ? info.skillInfo.skillDesc[1] : info.skillInfo.skillDesc[0];
                if (damages[1] != 0)
                {
                    Util.SetText(text, index, _str, _spcail);
                }
                else
                {
                    Util.SetText(text, index, _str);
                }
            }
            else
            {
                ConfigText config     = ConfigManager.Get <ConfigText>(info.skillInfo.skillDesc[0]);
                bool       isContains = config != null && config.text != null && config.text.Length > 0 ? config.text[0].Contains("-") : false;

                if (isContains)
                {
                    string[] strs = config.text[0].Split('-');
                    if (strs.Length == 2)
                    {
                        if (_nextInfo)
                        {
                            double[] _nextDamages = moduleSkill.GetCurrentSkillDamge(_nextInfo.skillId, _nextInfo.skillLevel);

                            string _nextStr    = info.pskill.skillId == moduleSkill.reliveSkillId ? _nextDamages[0].ToString() : _nextDamages[0].ToString("P2");
                            string _nextSpcail = info.pskill.skillId == moduleSkill.reliveSkillId ? _nextDamages[1].ToString() : _nextDamages[1].ToString("P2");

                            var s      = strs[0] + strs[1];
                            var length = s.Split('{');
                            if (length != null && length.Length == 5)
                            {
                                Util.SetText(text, s, _str, _spcail, _nextStr, _nextSpcail);
                            }
                            else if (length != null && length.Length == 3)
                            {
                                Util.SetText(text, s, _str, _nextStr);
                            }
                        }
                        else
                        {
                            if (strs[0].Contains("{"))
                            {
                                var length = strs[0].Split('{');
                                if (length != null && length.Length == 3)
                                {
                                    Util.SetText(text, strs[0], _str, _spcail);
                                }
                                else if (length != null && length.Length == 2)
                                {
                                    Util.SetText(text, strs[0], _str);
                                }
                            }
                            else
                            {
                                Util.SetText(text, strs[0]);
                            }
                        }
                    }
                }
            }
        }

        //出招方式
        var _desc = item.Find("des");

        if (!_desc)
        {
            return;
        }
        if (info.skillInfo.inputs == null || info.skillInfo.inputs.Length == 0 || info.skillInfo.inputs.Contains(0) || isLockNow)
        {
            _desc.gameObject.SetActive(false);
        }
        else
        {
            SetInputKeys(info, _desc, inputsInMain);
        }

        //btn_Event
        var btn = item.GetComponentDefault <Button>();

        btn.onClick.RemoveAllListeners();
        btn.onClick.AddListener(() => OnClickSkillItem(info));
    }
コード例 #7
0
    public double[] GetCurrentSkillDamge(int skillId, int level)
    {
        double[]        defaultDouble = new double[] { 0, 0 };
        WeaponAttribute attr          = ConfigManager.Get <WeaponAttribute>(moduleEquip.weapon.itemTypeId);

        if (!attr)
        {
            return(defaultDouble);
        }
        SkillToStateInfo states = m_currentSkillStates.Find(p => p.skillId == skillId && (p.elmentType == attr.elementType || p.elmentType == 0));

        if (!states || states.stateNames == null || states.stateNames.Length < 1)
        {
            return(defaultDouble);
        }

        double damage = 0;
        double spcail = 0;
        int    weapon = moduleEquip.weapon.GetPropItem().subType;

        for (int i = 0; i < states.stateNames.Length; i++)
        {
            int stateID = CreatureStateInfo.NameToID(states.stateNames[i]);
            var _state  = StateOverrideInfo.GetOverrideState(weapon, stateID, level);

            //int reliveID = CreatureStateInfo.NameToID(ReLiveState);
            //if (reliveID == stateID)
            //{
            //    reliveSkillId = states.skillId;
            //    if (_state.buffs.Length > 0)
            //    {
            //        defaultDouble[0] = (double)_state.buffs[0].duration / 1000;
            //        return defaultDouble;
            //    }
            //}

            for (int j = 0; j < _state.sections.Length; j++)
            {
                if (_state.sections[j].attackBox.isEmpty)
                {
                    continue;
                }

                var attack = AttackInfo.Get(_state.sections[j].attackBox.attackInfo);
                if (attack == null || attack.isIgnoreDamge)
                {
                    continue;
                }
                if (attack.execution)
                {
                    spcail += attack.damage;
                    continue;
                }
                damage += attack.damage;
            }

            int fly = _state.flyingEffects.Length;
            if (fly > 0)
            {
                for (int k = 0; k < fly; k++)
                {
                    var effect = ConfigManager.Get <FlyingEffectInfo>(_state.flyingEffects[k].effect);
                    if (effect == null)
                    {
                        continue;
                    }

                    //统计hiteffect的伤害,必须满足subeffect中不包含相同的effectid
                    if (!effect.hitEffect.isEmpty)
                    {
                        StateMachineInfo.FlyingEffect exist = StateMachineInfo.FlyingEffect.empty;
                        if (effect.subEffects != null && effect.subEffects.Length > 0)
                        {
                            exist = effect.subEffects.Find(p => p.effect == effect.hitEffect.effect);
                        }

                        if (exist.isEmpty)
                        {
                            double[] hit = HitEffectDamage(effect.hitEffect);
                            damage += hit[0];
                            spcail += hit[1];
                        }
                    }

                    if (effect.subEffects != null && effect.subEffects.Length > 0)
                    {
                        double[] sub = SubEffectDamage(effect.subEffects);
                        damage += sub[0];
                        spcail += sub[1];
                    }

                    for (int p = 0; p < effect.sections.Length; p++)
                    {
                        if (effect.sections[p].attackBox.isEmpty)
                        {
                            continue;
                        }

                        var attack = AttackInfo.Get(effect.sections[p].attackBox.attackInfo);
                        if (attack == null || attack.isIgnoreDamge)
                        {
                            continue;
                        }
                        if (attack.execution)
                        {
                            spcail += attack.damage;
                            continue;
                        }
                        damage += attack.damage;
                    }
                }
            }
        }
        double _d = UpSkillInfo.GetOverrideDamage(skillId, level) * (1 + modulePlayer.GetSkillDamageAddtion(skillId));

        defaultDouble[0] = damage * (1 + _d);
        defaultDouble[1] = spcail * (1 + _d);
        return(defaultDouble);
    }