少年修仙传客户端代码仓库
client_Wu Xijin
2019-01-31 15a8bb5fee29d781971c1512285b2e245ab8b8f1
3335 场景切换重构
9个文件已修改
133 ■■■■■ 已修改文件
Core/GameEngine/Login/Launch.cs 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Core/GameEngine/Model/Player/PlayerDatas.cs 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Core/NetworkPackage/DTCFile/ServerPack/H01_System/DTC0102_tagCDBPlayer.cs 20 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Core/NetworkPackage/DTCFile/ServerPack/H01_System/DTC0109_tagServerPrepareOK.cs 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
Core/NetworkPackage/DTCFile/ServerPack/HA1_Sys/DTCA127_tagMCStartChangeMap.cs 18 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Core/NetworkPackage/GameNetSystem.cs 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Fight/Stage/StageLoad.cs 79 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Fight/Stage/StageLoadProcessor.cs 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/Login/LoginModel.cs 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Core/GameEngine/Login/Launch.cs
@@ -243,8 +243,6 @@
            this.enabled = false;
            StageLoad.Instance.PushSceneLoadCommand(new StageLoad.StageLoadCommand()
            {
                fromMapId = StageLoad.Instance.mapIdRecord,
                fromLineId = StageLoad.Instance.lineIdRecord,
                toMapId = 1,
                toLineId = 0,
                needEmpty = false,
Core/GameEngine/Model/Player/PlayerDatas.cs
@@ -609,8 +609,6 @@
                        StageLoad.Instance.PushSceneLoadCommand(new StageLoad.StageLoadCommand()
                        {
                            fromMapId = StageLoad.Instance.mapIdRecord,
                            fromLineId = StageLoad.Instance.lineIdRecord,
                            toMapId = baseData.MapID,
                            toLineId = 0,
                            needEmpty = true,
Core/NetworkPackage/DTCFile/ServerPack/H01_System/DTC0102_tagCDBPlayer.cs
@@ -165,8 +165,6 @@
        {
            StageLoad.Instance.PushSceneLoadCommand(new StageLoad.StageLoadCommand()
            {
                fromMapId = StageLoad.Instance.mapIdRecord,
                fromLineId = StageLoad.Instance.lineIdRecord,
                toMapId = mapConfig.MapID,
                toLineId = MapUtility.GetLineId(mapConfig.MapID, PlayerDatas.Instance.baseData.dungeonLineId),
                needEmpty = true,
@@ -183,28 +181,12 @@
        }
        else
        {
            var fromMapId = StageLoad.Instance.mapIdRecord;
            var fromLineId = StageLoad.Instance.lineIdRecord;
            var needLoadResource = true;
            if (fromMapId != package.MapID)
            {
                needLoadResource = true;
            }
            else
            {
                var config1 = MapResourcesConfig.GetConfig(MapUtility.GetDataMapId(fromMapId), fromLineId);
                var config2 = MapResourcesConfig.GetConfig(MapUtility.GetDataMapId(package.MapID), lineId);
                needLoadResource = config1.MapResources != config2.MapResources;
            }
            StageLoad.Instance.PushSceneLoadCommand(new StageLoad.StageLoadCommand()
            {
                fromMapId = StageLoad.Instance.mapIdRecord,
                fromLineId = StageLoad.Instance.lineIdRecord,
                toMapId = mapConfig.MapID,
                toLineId = MapUtility.GetLineId(mapConfig.MapID, PlayerDatas.Instance.baseData.dungeonLineId),
                needEmpty = true,
                needLoadResource = needLoadResource,
                needLoadResource = true,
                serverType = package.socketType,
                isClientLoadMap = false
            });
Core/NetworkPackage/DTCFile/ServerPack/H01_System/DTC0109_tagServerPrepareOK.cs
@@ -26,7 +26,7 @@
        StageLoadTimeOutCatcher.RecordProtocol(vNetData.socketType, "0109", DateTime.Now);
        //修改技能快捷设置发包顺序
        PlayerDatas.Instance.skill.CheckQuickSet();
        StageLoad.Instance.UpdateServerFlag( StageLoad.ServerFlagType.Flag_0109, vNetData.socketType, true);
        StageLoad.Instance.UpdateServerFlag(vNetData.socketType, true);
    }
}
Core/NetworkPackage/DTCFile/ServerPack/HA1_Sys/DTCA127_tagMCStartChangeMap.cs
@@ -97,28 +97,12 @@
                break;
        }
        var fromMapId = StageLoad.Instance.mapIdRecord;
        var fromLineId = StageLoad.Instance.lineIdRecord;
        var needLoadResource = true;
        if (fromMapId != (int)package.MapID)
        {
            needLoadResource = true;
        }
        else
        {
            var config1 = MapResourcesConfig.GetConfig(MapUtility.GetDataMapId(fromMapId), fromLineId);
            var config2 = MapResourcesConfig.GetConfig(MapUtility.GetDataMapId((int)package.MapID), lineId);
            needLoadResource = config1.MapResources != config2.MapResources;
        }
        StageLoad.Instance.PushSceneLoadCommand(new StageLoad.StageLoadCommand()
        {
            fromMapId = StageLoad.Instance.mapIdRecord,
            fromLineId = StageLoad.Instance.lineIdRecord,
            toMapId = (int)package.MapID,
            toLineId = lineId,
            needEmpty = true,
            needLoadResource = needLoadResource,
            needLoadResource = true,
            serverType = package.socketType,
            isClientLoadMap = false
        });
Core/NetworkPackage/GameNetSystem.cs
@@ -341,8 +341,6 @@
            StageLoad.Instance.PushSceneLoadCommand(new StageLoad.StageLoadCommand()
            {
                fromMapId=StageLoad.Instance.mapIdRecord,
                fromLineId=StageLoad.Instance.lineIdRecord,
                toMapId = 1,
                toLineId = 0,
                needEmpty = false,
Fight/Stage/StageLoad.cs
@@ -40,8 +40,8 @@
    Queue<StageLoadCommand> commands = new Queue<StageLoadCommand>();
    ServerFlag serverFlag_0109;
    ServerFlag serverFlag_0403;
    bool server0109Ok_Main = false;
    bool server0109Ok_CrossServer;
    float loadStartTime = 0f;
    public bool isLoading { get; private set; }
@@ -57,6 +57,26 @@
    private void ExcuteCommand(StageLoadCommand command)
    {
        var tasks = new Queue<StageLoadProcessor.StageLoadTask>();
        var needLoadResource = true;
        if (command.needLoadResource)
        {
            var fromMapId = command.fromMapId;
            var fromLineId = command.fromLineId;
            if (fromMapId != command.toMapId)
            {
                needLoadResource = true;
            }
            else
            {
                var config1 = MapResourcesConfig.GetConfig(MapUtility.GetDataMapId(fromMapId), fromLineId);
                var config2 = MapResourcesConfig.GetConfig(MapUtility.GetDataMapId(command.toMapId), command.toLineId);
                needLoadResource = config1.MapResources != config2.MapResources;
            }
        }
        else
        {
            needLoadResource = false;
        }
        var assetValid = AssetVersionUtility.IsSceneAssetValid(command.toMapId, command.toLineId);
        if (!assetValid)
@@ -71,18 +91,18 @@
        }
        else
        {
            if (command.needLoadResource)
            if (needLoadResource)
            {
                tasks.Enqueue(new StageLoadProcessor.PreProcessTask(command));
                tasks.Enqueue(new StageLoadProcessor.UnLoadAndGCTask(command));
            }
            if (command.needLoadResource && command.needEmpty)
            if (needLoadResource && command.needEmpty)
            {
                tasks.Enqueue(new StageLoadProcessor.LoadEmptyTask(command));
            }
            if (command.needLoadResource)
            if (needLoadResource)
            {
                tasks.Enqueue(new StageLoadProcessor.LoadNewSceneTask(command));
            }
@@ -96,13 +116,13 @@
                }
            }
            if (command.needLoadResource)
            if (needLoadResource)
            {
                tasks.Enqueue(new StageLoadProcessor.PostProcessTask(command));
            }
        }
        serverFlag_0109 = default(ServerFlag);
        UpdateServerFlag(command.serverType, false);
        var gameObject = new GameObject("StageLoadProcessor");
        DontDestroyOnLoad(gameObject);
@@ -127,17 +147,15 @@
        }
    }
    public void UpdateServerFlag(ServerFlagType flagType, ServerType socketType, bool flag)
    public void UpdateServerFlag(ServerType serverType, bool ok)
    {
        switch (flagType)
        switch (serverType)
        {
            case ServerFlagType.Flag_0109:
                serverFlag_0109 = new ServerFlag()
                {
                    flagType = flagType,
                    serverType = socketType,
                    flag = flag,
                };
            case ServerType.Main:
                server0109Ok_Main = ok;
                break;
            case ServerType.CrossSever:
                server0109Ok_CrossServer = ok;
                break;
            default:
                break;
@@ -164,12 +182,15 @@
    {
        if (!isLoading && commands.Count > 0)
        {
            ExcuteCommand(commands.Dequeue());
            var command = commands.Dequeue();
            command.fromMapId = mapIdRecord;
            command.fromLineId = lineIdRecord;
            ExcuteCommand(command);
        }
        if (isLoading)
        {
            if (Time.time - loadStartTime > 30f)
            if (Time.time - loadStartTime > 25f)
            {
                if (stageLoadProcessor != null)
                {
@@ -198,32 +219,14 @@
        public bool needLoadResource;
    }
    public enum ServerFlagType
    {
        None = 0,
        Flag_0109 = 109,
        Flag_0403 = 403,
    }
    public struct ServerFlag
    {
        public ServerFlagType flagType;
        public ServerType serverType;
        public bool flag;
    }
    public bool IsServerPrepareOk(ServerType socketType)
    {
        switch (socketType)
        {
            case ServerType.Main:
                return serverFlag_0109.flagType == ServerFlagType.Flag_0109
                    && serverFlag_0109.serverType == ServerType.Main
                    && serverFlag_0109.flag;
                return server0109Ok_Main;
            case ServerType.CrossSever:
                return serverFlag_0109.flagType == ServerFlagType.Flag_0109
                    && serverFlag_0109.serverType == ServerType.CrossSever
                    && serverFlag_0109.flag;
                return server0109Ok_CrossServer;
            default:
                return false;
        }
Fight/Stage/StageLoadProcessor.cs
@@ -408,12 +408,12 @@
    {
        public WaitLoginCompleteTask(StageLoad.StageLoadCommand command) : base(command)
        {
            exceptedWeight = 0.1f;
            exceptedWeight = 0.2f;
        }
        public override void Begin()
        {
            duration = 0.3f;
            duration = 2f;
        }
        public override void End()
System/Login/LoginModel.cs
@@ -382,8 +382,6 @@
                    EnterWorld(1);
                    StageLoad.Instance.PushSceneLoadCommand(new StageLoad.StageLoadCommand()
                    {
                        fromMapId = StageLoad.Instance.mapIdRecord,
                        fromLineId = StageLoad.Instance.lineIdRecord,
                        toMapId = 2,
                        toLineId = 0,
                        needEmpty = false,
@@ -404,8 +402,6 @@
                            NetLinkWin.Hide();
                            StageLoad.Instance.PushSceneLoadCommand(new StageLoad.StageLoadCommand()
                            {
                                fromMapId = StageLoad.Instance.mapIdRecord,
                                fromLineId = StageLoad.Instance.lineIdRecord,
                                toMapId = 3,
                                toLineId = 0,
                                needEmpty = false,