少年修仙传客户端代码仓库
10349 【越南】【英文】【BT】【砍树】跨服竞技场优化 - 时间格式不同
3个文件已修改
268 ■■■■■ 已修改文件
LogicProject/System/CrossServerQualifying/CrossServerQualifyingModel.cs 255 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
LogicProject/System/CrossServerQualifying/CrossServerQualifyingRaceCell.cs 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
LogicProject/System/CrossServerQualifying/CrossServerQualifyingTimeCell.cs 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
LogicProject/System/CrossServerQualifying/CrossServerQualifyingModel.cs
@@ -12,10 +12,10 @@
public class CrossServerQualifyingModel : ILModel<CrossServerQualifyingModel>
{
    public const int DATA_MAPID = 32070;
    List<int> mapList = new List<int>();    //1个分区一个地图
    public int selectIndex; // 跨服排位主标签选择
    public int select64Index = 0;  // 选中的64强比赛标签,非当前赛程
    public List<uint> groupBtnMarks = new List<uint>() { 64, 32, 16 };//64强标签按钮对应的赛程
    public List<uint> group8BtnMarks = new List<uint>() { 8, 4, 2 };//8强
    public uint select64Mark
    {
        get { return groupBtnMarks[select64Index]; }
@@ -34,14 +34,15 @@
    //当前赛程(如64强/32强),0代表不在比赛流程中
    public uint nowGroupMark
    {
        get {
        get
        {
            var battleID = GetBattleID();
            if (battleID == -1) return 0;
            var state = ILChampionshipTimeConfig.Get(battleID).StateValue;
            if (state == 80) return 64;  //8强竞猜
            if (state == 40) return 8;   //四强竞猜
            return (uint)state / 10;
            }
            return (uint)state / 10;
        }
    }
    public List<DateTime> openTimes = new List<DateTime>();
@@ -89,8 +90,10 @@
    public event Action UpdateWorshipEvent;
    public int worshipMaxCnt;
    public int[][] doubleTimeArr;
    public int challengeMaxCnt; //挑战次数
    DungeonModel dungeonModel { get { return ModelCenter.Instance.GetModel<DungeonModel>(); } }
    ServerMirrorFightModel mirrorFightModel { get { return ModelCenter.Instance.GetModel<ServerMirrorFightModel>(); } }
    protected override void Init()
    {
@@ -115,8 +118,6 @@
        {
            openTimes.Add(Convert.ToDateTime(openTimeArr[i]));
        }
        mapList = JsonMapper.ToObject<int[]>(config.Numerical3).ToList();
        config = FuncConfigConfig.Get("CrossChamGuess");
        var moneyInfo = config.Numerical1.Split('|');
@@ -160,6 +161,9 @@
        config = FuncConfigConfig.Get("CrossChamWorship");
        worshipMaxCnt = int.Parse(config.Numerical1);
        doubleTimeArr = JsonMapper.ToObject<int[][]>(config.Numerical3);
        config = FuncConfigConfig.Get("CrossChamMirrorPK");
        challengeMaxCnt = int.Parse(config.Numerical1);
    }
@@ -252,11 +256,12 @@
                    BattleNum = battleList.BattleNum,
                    WinPlayerID = battleList.WinPlayerID,
                    PlayerIDA = battleList.PlayerIDA,
                    PlayerIDB = battleList.PlayerIDB
                    PlayerIDB = battleList.PlayerIDB,
                    battleResult = ConfigParse.ParseIntArray2Dict(battleList.BattleRet),
                };
            }
        }
        }
        UpdateCrossChampionshipPKZoneGroupInfoEvent?.Invoke();
    }
@@ -279,6 +284,8 @@
        myOfficialID = 0;
        myApplyCnt = 0;
        worshipCntToday = 0;
        pushGroupMark = 0;
        isShowRaceInfoYet = false;
    }
    //获取当前的比赛赛程节点,-1代表当前时间不在排位赛流程中
@@ -306,7 +313,7 @@
                continue;
            var startTime = startDay.AddDays(config.StartDay - 1).AddSeconds(config.StartHour * 60 * 60 + config.StartMinute * 60);
            var endTime = startDay.AddDays(config.EndDay - 1).AddSeconds(config.EndHour*60*60 + config.EndMinute * 60 + 59);
            var endTime = startDay.AddDays(config.EndDay - 1).AddSeconds(config.EndHour * 60 * 60 + config.EndMinute * 60 + 59);
            if (ILTimeUtility.ServerCrossNow >= startTime && ILTimeUtility.ServerCrossNow <= endTime)
                return int.Parse(keys[i]);
        }
@@ -327,9 +334,22 @@
        return startTime.ToString("dd-MM-yyyy HH:mm");
    }
    //获取流程的结束时间 分钟,负数代表未开始
    public double GetRaceEndRemindMinute(int battleID)
    {
        var index = GetOpenTimeIndex();
        if (index == -1) return -1;
        var startDay = openTimes[index];
        var config = ILChampionshipTimeConfig.Get(battleID);
        var endTime = startDay.AddDays(config.StartDay - 1).AddSeconds(config.EndHour * 60 * 60 + config.EndMinute * 60);
        return (endTime - ILTimeUtility.ServerCrossNow).TotalMinutes;
    }
    public struct CrossChampionshipPKPlayer
    {
        public uint PlayerID;
        public uint PlayerID;
        public string PlayerName;
        public byte Job;
        public long FightPower;
@@ -345,6 +365,7 @@
        public uint WinPlayerID;        // 获胜玩家ID
        public uint PlayerIDA;        // 玩家IDA
        public uint PlayerIDB;        // 玩家IDB
        public Dictionary<int, int[][]> battleResult;  // 战斗结果明细 {"playerID":[[第1局胜负,第1局总积分,胜负基础分,hp分,时间分], ...], ...}
    }
    public struct ChampionshipOfficial
@@ -356,57 +377,35 @@
        public List<CrossChampionshipPKPlayer> ApplyPlayerList;        // 申请该仙官玩家列表
    }
    //场景进入逻辑借用了跨服竞技1V1
    public bool IsCrossServerQualifying()
    {
        var dungeonModel = ModelCenter.Instance.GetModel<DungeonModel>();
        var dataMapId = dungeonModel.GetDataMapIdByMapId(PlayerDatas.Instance.baseData.MapID);
        return mapList.IndexOf(dataMapId) != -1;
    }
    //进入跨服排位赛,借用跨服竞技1v1模拟
    public void EnterCrossServerQualifying()
    {
        int error;
        if (!ILCrossServerModel.Instance.CanEnter(out error))
        uint tagPlayerID;
        var battleResult = GetMyBattleInfo(nowGroupMark, out tagPlayerID);
        int challengeCnt = battleResult.ContainsKey((int)PlayerDatas.Instance.baseData.PlayerID) ? battleResult[(int)PlayerDatas.Instance.baseData.PlayerID].Length : 0;
        if (challengeCnt >= challengeMaxCnt)
        {
            ILCrossServerModel.Instance.ProcessEnterError(error);
        }
        uint otherPlayerID = 0;
        int pos = 1; //我的位置,1-左;2-右
        var battle = battleInfo[nowGroupMark];
        var battleNums = battle.Keys.ToList();
        var playerID = PlayerDatas.Instance.baseData.PlayerID;
        for (int i = 0; i < battleNums.Count; i++)
        {
            var battleNum = battleNums[i];
            //搜索玩家是否参赛者
            if (battle[battleNum].PlayerIDA == playerID)
            {
                otherPlayerID = battle[battleNum].PlayerIDB;
                pos = 1;
                break;
            }
            else if (battle[battleNum].PlayerIDB == playerID)
            {
                otherPlayerID = battle[battleNum].PlayerIDA;
                pos = 2;
                break;
            }
        }
        if (otherPlayerID == 0)
        {
            //轮空
            SysNotifyMgr.Instance.ShowTip("CrossServerQualifying4");
            SysNotifyMgr.Instance.ShowTip("CrossServerQualifying11");
            return;
        }
        var otherPlayerInfo = fightersInfo[otherPlayerID];
        var package = new HC001_tagGCCrossRealmPKMatchOK();
        //package.RoomID = 1001;
        //package.PlayerName = PlayerDatas.Instance.baseData.PlayerName;
        //package.Number = (byte)pos;
        int error;
        if (!dungeonModel.CanEnter(out error))
        {
            dungeonModel.ProcessEnterError(error);
            return;
        }
        var teamModel = ModelCenter.Instance.GetModel<TeamModel>();
        if (teamModel.isMatching)
        {
            teamModel.RequestCancelAutoMatchTeam();
        }
        var otherPlayerInfo = fightersInfo[tagPlayerID];
        var opponent = new HC001_tagGCCrossRealmPKMatchOK.tagGCCrossRealmPKMatchPlayer();
        opponent.Job = otherPlayerInfo.Job;
@@ -414,20 +413,18 @@
        opponent.PlayerID = otherPlayerInfo.PlayerID;
        opponent.LV = otherPlayerInfo.LV;
        //待进入游戏刷新对方血量
        //opponent.MaxProDef = 100;
        //opponent.MaxHP = 100;
        //opponent.MaxHPEx = 0;
        package.MatchPlayer = new HC001_tagGCCrossRealmPKMatchOK.tagGCCrossRealmPKMatchPlayer[] { opponent };
        opponent.RealmLV = otherPlayerInfo.RealmLV;
        opponent.Face = otherPlayerInfo.Face;
        opponent.FacePic = otherPlayerInfo.FacePic;
        opponent.FightPower = (uint)((ulong)otherPlayerInfo.FightPower % Constants.ExpPointValue);
        opponent.FightPowerEx = (uint)((ulong)otherPlayerInfo.FightPower / Constants.ExpPointValue);
        //var sendInfo = new CC105_tagCMEnterCrossServer();
        //sendInfo.DataMapID = DATA_MAPID;
        //GameNetSystem.Instance.SendInfo(sendInfo);
        CrossServerLogin.Instance.InitOneVsOnePlayerInfo(opponent);
        mirrorFightModel.SendMirrorFight(DATA_MAPID, (ushort)(zoneID * 100 + nowGroupMark), tagPlayerID, 0);
        return;
    }
    //查找自己是否有比赛
    //查找自己是否有比赛,包含竞猜 分组和战斗结束的缓存时间
    public bool HaveMyBattle(uint groupMark)
    {
        if (battleInfo.ContainsKey(groupMark))
@@ -449,27 +446,88 @@
        return false;
    }
    public byte OverType;    // 0-正常,1-有人离线
    public uint WinnerID;    // 胜方ID
    public List<uint> RoundWinnerID = new List<uint>();    // 回合获胜ID列表
    public void UpdatePKResult(IL_HC016_tagGCCrossChampionshipPKOver netPack)
    // 8强之前,查找玩家的下一场比赛,胜出未分组前也算
    public int GetMyNextBattle()
    {
        if (IsCrossServerQualifying())//副本结算界面
        {
            OverType = netPack.OverType;
            WinnerID = netPack.WinnerID;
            RoundWinnerID = netPack.RoundWinnerID.ToList();
            if (WindowCenter.Instance.IsOpen<FightingPKWin>())
        int nextGroupMark = 0;
        bool haveBattle = false;
        for (int k = 0; k < groupBtnMarks.Count; k++)
        {
            var groupMark = groupBtnMarks[k];
            nextGroupMark = (int)groupMark;
            if (battleInfo.ContainsKey(groupMark))
            {
                WindowCenter.Instance.Close<FightingPKWin>();
                var playerID = PlayerDatas.Instance.baseData.PlayerID;
                var battle = battleInfo[groupMark];
                var battleNums = battle.Keys.ToList();
                for (int i = 0; i < battleNums.Count; i++)
                {
                    var battleNum = battleNums[i];
                    //搜索玩家是否参赛者
                    if (battle[battleNum].WinPlayerID == playerID)
                    {
                        haveBattle = true;
                        continue;
                    }
                    if (battle[battleNum].PlayerIDA == playerID || battle[battleNum].PlayerIDB == playerID)
                    {
                        haveBattle = true;
                        return nextGroupMark;
                    }
                }
            }
            WindowCenter.Instance.OpenIL<CrossServerQualifyingSettlementWin>();
        }
        return haveBattle ? nextGroupMark : 0;
    }
    //当前的比赛比分情况
    public Dictionary<int, int[][]> GetMyBattleInfo(uint groupMark, out uint tagPlayerID)
    {
        tagPlayerID = 0;
        if (battleInfo.ContainsKey(groupMark))
        {
            var playerID = PlayerDatas.Instance.baseData.PlayerID;
            var battle = battleInfo[groupMark];
            var battleNums = battle.Keys.ToList();
            for (int i = 0; i < battleNums.Count; i++)
            {
                var battleNum = battleNums[i];
                if (battle[battleNum].PlayerIDA == playerID || battle[battleNum].PlayerIDB == playerID)
                {
                    tagPlayerID = battle[battleNum].PlayerIDA == playerID ? battle[battleNum].PlayerIDB : battle[battleNum].PlayerIDA;
                    return battle[battleNum].battleResult;
                }
            }
        }
        return null;
    }
    public uint WinnerID;    // 胜方ID
    public int score;
    public void UpdatePKResult()
    {
        if (dungeonModel.dungeonResult.isWin == 1)
        {
            WinnerID = PlayerDatas.Instance.baseData.PlayerID;
        }
        score = dungeonModel.dungeonResult.addScore;
        if (WindowCenter.Instance.IsOpen<FightingPKWin>())
        {
            WindowCenter.Instance.Close<FightingPKWin>();
        }
        WindowCenter.Instance.OpenIL<CrossServerQualifyingSettlementWin>();
    }
    //竞猜公共信息:支持人数
    public void UpdateGuessCommon(IL_HC022_tagGCChampionshipGuessPubInfo netPack)
@@ -578,8 +636,8 @@
            {
                guessPlayer8List.Add((int)battle.WinPlayerID);
            }
        }
        }
        guessPlayer8List.Sort(CompareGuess8);
        return;
    }
@@ -605,14 +663,23 @@
        return idA.CompareTo(idB);
    }
    public bool isShowRaceInfoYet = false; //是否已经显示过赛程信息小提示
    uint pushGroupMark = 0; //每场比赛只推送一次
    void OnMinuteEvent()
    {
        if (!WindowCenter.Instance.IsOpen("CrossServerQualifyingWin") && mapList.IndexOf(PlayerDatas.Instance.baseData.MapID) == -1)
        if (!WindowCenter.Instance.IsOpen("CrossServerQualifyingWin") &&
            dungeonModel.GetDataMapIdByMapId(PlayerDatas.Instance.baseData.MapID) != DATA_MAPID)
        {
            uint nowMark = nowGroupMark;
            //准备入场的时候推送
            if (GetBattleID() % 10 == 2 && HaveMyBattle(nowGroupMark))
            {
                HeroControler.Instance.FuncPush(210);
            if (pushGroupMark != nowMark && HaveMyBattle(nowMark))
            {
                int battleID = GetBattleID();
                if (ILChampionshipTimeConfig.Get(battleID).StateValue % 10 == 2)
                {
                    HeroControler.Instance.FuncPush(210);
                    pushGroupMark = nowMark;
                }
            }
        }
    }
@@ -641,12 +708,14 @@
                });
            }
            rankOfficialDict[(int)officialInfo.OfficialID] = new ChampionshipOfficial() {
            rankOfficialDict[(int)officialInfo.OfficialID] = new ChampionshipOfficial()
            {
                LastDismissJuniorTime = officialInfo.LastDismissJuniorTime,
                WorshipCount = officialInfo.WorshipCount,
                WorshipDouble = officialInfo.WorshipDouble,
                OfficialPlayer = new CrossChampionshipPKPlayer() {
                OfficialPlayer = new CrossChampionshipPKPlayer()
                {
                    PlayerID = officialInfo.OfficialPlayer.PlayerID,
                    Job = officialInfo.OfficialPlayer.Job,
                    PlayerName = officialInfo.OfficialPlayer.PlayerName,
@@ -707,7 +776,7 @@
    void RefreshMyApplyCnt()
    {
        if (myOfficialID != 0)
        {
        {
            myApplyCnt = 0;
            return;
        }
@@ -808,9 +877,9 @@
            }
        }
        WindowCenter.Instance.OpenIL<CrossServerQualifyingOfficialNoteWin>();
    }
    }
    public void UpdateWorship(IL_HC109_tagMCChampionshipPlayerInfo netPack)
    {
        worshipCntToday = netPack.WorshipCount;
@@ -852,7 +921,7 @@
    private IEnumerator PlayerQuery()
    {
        for (int i = 0; i < playerIDList.Count; i++)
        {
        {
            QueryKaiKingInfo(playerIDList[i]);
            yield return null;
        }
LogicProject/System/CrossServerQualifying/CrossServerQualifyingRaceCell.cs
@@ -47,7 +47,9 @@
        var index = CrossServerQualifyingModel.Instance.GetOpenTimeIndex();
        var showTime = CrossServerQualifyingModel.Instance.openTimes[index].AddDays(config.StartDay - 1);
        showTime = showTime.AddSeconds(config.StartHour * 60 * 60 + config.StartMinute * 60);
        timeStr.text = showTime.ToString("dd-MM-yyyy HH:mm");
        timeStr.text = StringUtility.Contact(showTime.ToString("dd-MM-yyyy HH:mm"), " -> ",
                        config.EndHour.ToString("D2"), ":", config.EndMinute.ToString("D2"));
        name.text = Language.Get(raceNameList[listIndex]);
        bg.SetActiveIL(listIndex % 2 == 0);
@@ -96,7 +98,7 @@
            }
        }
        else
        {
        {
            desc.text = Language.Get("UnDetermind");
        }
LogicProject/System/CrossServerQualifying/CrossServerQualifyingTimeCell.cs
@@ -31,12 +31,13 @@
        var index = CrossServerQualifyingModel.Instance.GetOpenTimeIndex();
        var showTime = CrossServerQualifyingModel.Instance.openTimes[index].AddDays(config.StartDay - 1);
        showTime = showTime.AddSeconds(config.StartHour * 60 * 60 + config.StartMinute * 60);
        timeStr.text = showTime.ToString("dd-MM-yyyy HH:mm");
        timeStr.text = StringUtility.Contact(showTime.ToString("dd-MM-yyyy HH:mm"), " -> ",
                        config.EndHour.ToString("D2"), ":", config.EndMinute.ToString("D2"));
        name.text = config.Title;
        desc.text = config.Desc;
        bg.SetActiveIL(isShowBG);
        bg.SetActiveIL(isShowBG);
        var battleID = CrossServerQualifyingModel.Instance.GetBattleID();
        if (battleID == -1)
        {