少年修仙传客户端代码仓库
client_Wu Xijin
2019-02-01 58a277db9cd747b0a4a93e788950c8fae053f231
3335 场景切换重构
4个文件已修改
40 ■■■■ 已修改文件
Core/NetworkPackage/DTCFile/ServerPack/H01_System/DTC0102_tagCDBPlayer.cs 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Core/NetworkPackage/DTCFile/ServerPack/HA1_Sys/DTCA127_tagMCStartChangeMap.cs 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Fight/Stage/StageLoad.cs 35 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Fight/Stage/StageLoadProcessor.cs 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
Core/NetworkPackage/DTCFile/ServerPack/H01_System/DTC0102_tagCDBPlayer.cs
@@ -163,6 +163,7 @@
        if (package.socketType == ServerType.Main
    && GameNetSystem.Instance.crossServerData.crossState == GameNetSystem.CrossServerState.Yes)
        {
            StageLoad.Instance.UpdateServerFlag(package.socketType, false);
            StageLoad.Instance.PushSceneLoadCommand(new StageLoad.StageLoadCommand()
            {
                toMapId = mapConfig.MapID,
@@ -181,6 +182,7 @@
        }
        else
        {
            StageLoad.Instance.UpdateServerFlag(package.socketType, false);
            StageLoad.Instance.PushSceneLoadCommand(new StageLoad.StageLoadCommand()
            {
                toMapId = mapConfig.MapID,
Core/NetworkPackage/DTCFile/ServerPack/HA1_Sys/DTCA127_tagMCStartChangeMap.cs
@@ -97,6 +97,7 @@
                break;
        }
        StageLoad.Instance.UpdateServerFlag(package.socketType, false);
        StageLoad.Instance.PushSceneLoadCommand(new StageLoad.StageLoadCommand()
        {
            toMapId = (int)package.MapID,
Fight/Stage/StageLoad.cs
@@ -38,6 +38,7 @@
    public event Action<int> onStartStageLoadingEvent;
    public UnityAction onStageLoadFinish;
    StageLoadCommand currentCommand;
    Queue<StageLoadCommand> commands = new Queue<StageLoadCommand>();
    bool server0109Ok_Main = false;
@@ -155,6 +156,25 @@
    public void UpdateServerFlag(ServerType serverType, bool ok)
    {
        if (ok)
        {
            if (currentCommand != null && !currentCommand.serverFlag0109)
            {
                currentCommand.serverFlag0109 = true;
            }
            else
            {
                foreach (var command in commands)
                {
                    if (command.serverType == serverType && !command.serverFlag0109)
                    {
                        command.serverFlag0109 = true;
                        break;
                    }
                }
            }
        }
        switch (serverType)
        {
            case ServerType.Main:
@@ -188,10 +208,10 @@
    {
        if (!isLoading && commands.Count > 0)
        {
            var command = commands.Dequeue();
            command.fromMapId = mapIdRecord;
            command.fromLineId = lineIdRecord;
            ExcuteCommand(command);
            currentCommand = commands.Dequeue();
            currentCommand.fromMapId = mapIdRecord;
            currentCommand.fromLineId = lineIdRecord;
            ExcuteCommand(currentCommand);
        }
        if (isLoading)
@@ -204,6 +224,7 @@
                    stageLoadProcessor = null;
                }
                currentCommand = null;
                isLoading = false;
                commands.Clear();
                StageLoadTimeOutCatcher.ReportLoadingOverTime();
@@ -212,17 +233,19 @@
        }
    }
    public struct StageLoadCommand
    public class StageLoadCommand
    {
        public int fromMapId;
        public int fromLineId;
        public int toMapId;
        public int toLineId;
        public bool needEmpty;
        public ServerType serverType;
        public bool isClientLoadMap;
        public bool needLoadResource;
        public bool serverFlag0109 = false;
    }
    public bool IsServerPrepareOk(ServerType socketType)
Fight/Stage/StageLoadProcessor.cs
@@ -399,7 +399,7 @@
        public override void Update()
        {
            timer += Time.deltaTime;
            if (!StageLoad.Instance.IsServerPrepareOk(command.serverType))
            if (!command.serverFlag0109)
            {
                done = false;
                progress = timer / duration;