少年修仙传客户端代码仓库
client_linchunjie
2019-05-05 c77e6b82b29f743eb8c17294a6fc9c5a2de09ade
6651 子 【开发】增加丹药属性 / 【前端】【2.0】特殊丹药效果新增
4个文件已修改
97 ■■■■ 已修改文件
Core/NetworkPackage/ServerPack/HA3_Function/HA327_tagMCRealmExpInfo.cs 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/Realm/RealmModel.cs 82 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/Realm/RealmPoolBehaviour.cs 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/Realm/RealmTakeExpWin.cs 9 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Core/NetworkPackage/ServerPack/HA3_Function/HA327_tagMCRealmExpInfo.cs
@@ -5,6 +5,8 @@
public class HA327_tagMCRealmExpInfo : GameNetPackBasic {
    public uint BeginTime;    //开始计时时间
    public uint BuffTime;    //buff剩余时间
    public uint BuffAddRate;    //buff加成万分率
    public uint CurExp;    //当前总经验
    public uint CurExpPoint;    //当前总经验点
@@ -14,6 +16,8 @@
    public override void ReadFromBytes (byte[] vBytes) {
        TransBytes (out BeginTime, vBytes, NetDataType.DWORD);
        TransBytes (out BuffTime, vBytes, NetDataType.DWORD);
        TransBytes (out BuffAddRate, vBytes, NetDataType.DWORD);
        TransBytes (out CurExp, vBytes, NetDataType.DWORD);
        TransBytes (out CurExpPoint, vBytes, NetDataType.DWORD);
    }
System/Realm/RealmModel.cs
@@ -21,42 +21,42 @@
        public int realmExpTime { get; private set; }
        public long startExp { get; private set; }
        public uint buffAddRate { get; private set; }
        public uint buffSeconds { get; private set; }
        public DateTime buffStartTime { get; private set; }
        public long totalExp
        {
            get
            {
                var exp = startExp;
                float exp = startExp;
                var tick = (TimeUtility.ServerNow - expStartTime).Ticks;
                var singleTick = realmExpTime * TimeSpan.TicksPerSecond;
                var times = tick / singleTick;
                float expRate = 0;
                var config = RealmConfig.Get(PlayerDatas.Instance.baseData.realmLevel);
                if (config != null && config.expRate != 0)
                if (config != null)
                {
                    exp = times * config.expRate + startExp;
                    exp = exp > config.expLimit ? config.expLimit : exp;
                    expRate = config.expRate;
                }
                return exp;
            }
        }
        public long exp
        {
            get
            {
                var exp = startExp;
                var tick = (TimeUtility.ServerNow - expStartTime).Ticks;
                var singleTick = realmExpTime * TimeSpan.TicksPerSecond;
                var times = (float)tick / singleTick;
                var config = RealmConfig.Get(PlayerDatas.Instance.baseData.realmLevel);
                if (config != null && config.expRate != 0)
                for (int i = 1; i <= times; i++)
                {
                    exp = (long)(times * config.expRate) + startExp;
                    exp = exp > config.expLimit ? config.expLimit : exp;
                    var time = expStartTime.AddTicks(i * realmExpTime * TimeSpan.TicksPerSecond);
                    if (IsBuffActive(time))
                    {
                        var rate = expRate + expRate * (buffAddRate / 10000f);
                        exp += rate;
                    }
                    else
                    {
                        exp += expRate;
                    }
                }
                return exp;
                exp = exp > config.expLimit ? config.expLimit : exp;
                return (long)exp;
            }
        }
@@ -127,6 +127,8 @@
            expStartTime = DateTime.Now;
            startExp = 0;
            serverInited = false;
            buffSeconds = 0;
            buffAddRate = 0;
            SysNotifyMgr.Instance.OnSystemNotifyEvent -= OnSystemNotifyEvent;
        }
@@ -302,6 +304,12 @@
            return false;
        }
        public bool IsBuffActive(DateTime time)
        {
            return buffSeconds > 0
                    && buffStartTime.AddTicks(TimeSpan.TicksPerSecond * buffSeconds) > time;
        }
        public int GetRealmStage(int realmLevel)
        {
            if (realmLevel == 0)
@@ -412,12 +420,31 @@
            if (FuncOpen.Instance.IsFuncOpen((int)FuncOpenEnum.Realm))
            {
                var realmLevel = PlayerDatas.Instance.baseData.realmLevel;
                if (realmLevel >= realmPoolOpenLevel)
                var config = RealmConfig.Get(realmLevel);
                if (realmLevel >= realmPoolOpenLevel && config.expRate != 0)
                {
                    var config = RealmConfig.Get(realmLevel);
                    if (exp < config.expLimit)
                    if (totalExp < config.expLimit)
                    {
                        remainTime = realmExpTime * ((config.expLimit - exp) / (float)config.expRate);
                        float surplusExp = config.expLimit - totalExp;
                        if (buffSeconds > 0)
                        {
                            var expRate = config.expRate + config.expRate * (buffAddRate / 10000f);
                            var times = buffSeconds / realmExpTime;
                            if (times * expRate >= surplusExp)
                            {
                                remainTime = Mathf.CeilToInt(surplusExp / expRate) * realmExpTime;
                                surplusExp = 0;
                            }
                            else
                            {
                                remainTime = times * realmExpTime;
                                surplusExp = surplusExp - times * expRate;
                            }
                        }
                        if (surplusExp > 0)
                        {
                            remainTime += Mathf.CeilToInt(surplusExp / config.expRate) * realmExpTime;
                        }
                    }
                }
            }
@@ -443,6 +470,9 @@
        {
            expStartTime = TimeUtility.GetTime(package.BeginTime);
            startExp = (long)package.CurExpPoint * Constants.ExpPointValue + package.CurExp;
            buffAddRate = package.BuffAddRate;
            buffSeconds = package.BuffTime;
            buffStartTime = TimeUtility.ServerNow;
            if (realmExpRefresh != null)
            {
                realmExpRefresh();
System/Realm/RealmPoolBehaviour.cs
@@ -65,7 +65,7 @@
        public void DisplayWave()
        {
            var config = RealmConfig.Get(realmLevel);
            var progress = Mathf.Clamp01((float)model.exp / config.expLimit);
            var progress = Mathf.Clamp01((float)model.totalExp / config.expLimit);
            m_WaterSlider.progress = progress;
        }
System/Realm/RealmTakeExpWin.cs
@@ -71,12 +71,19 @@
        void DisplayRate()
        {
            var config = RealmConfig.Get(PlayerDatas.Instance.baseData.realmLevel);
            m_ExpRate.text = Language.Get("RealmExpRate", model.realmExpTime, UIHelper.ReplaceLargeNum(config.expRate));
            float expRate = config.expRate;
            if (model.IsBuffActive(TimeUtility.ServerNow))
            {
                expRate = expRate + expRate * (model.buffAddRate / 10000f);
            }
            m_ExpRate.text = Language.Get("RealmExpRate", model.realmExpTime, UIHelper.ReplaceLargeNum(expRate));
        }
        private void PerSecond()
        {
            DisplayExp();
            DisplayRate();
        }
        private void TakeExp()