├── .gitignore
├── Bundles.meta
├── Bundles
├── UI.meta
└── UI
│ ├── UILSLobby.prefab
│ ├── UILSLobby.prefab.meta
│ ├── UILSLogin.prefab
│ ├── UILSLogin.prefab.meta
│ ├── UILSRoom.prefab
│ └── UILSRoom.prefab.meta
├── DotNet~
├── App
│ ├── ET.App.csproj
│ └── Program.cs
├── Hotfix
│ └── ET.Hotfix.csproj
└── Model
│ └── ET.Model.csproj
├── ET.sln
├── ET.sln.meta
├── Editor.meta
├── Editor
├── ET.LockStep.Editor.asmdef
├── ET.LockStep.Editor.asmdef.meta
├── LockStepEditor.cs
└── LockStepEditor.cs.meta
├── Excel.meta
├── Excel
├── StartConfig.meta
├── StartConfig
│ ├── Localhost.meta
│ ├── Localhost
│ │ ├── StartMachineConfig@s.xlsx
│ │ ├── StartMachineConfig@s.xlsx.meta
│ │ ├── StartProcessConfig@s.xlsx
│ │ ├── StartProcessConfig@s.xlsx.meta
│ │ ├── StartSceneConfig@s.xlsx
│ │ ├── StartSceneConfig@s.xlsx.meta
│ │ ├── StartZoneConfig@s.xlsx
│ │ └── StartZoneConfig@s.xlsx.meta
│ ├── Release.meta
│ └── Release
│ │ ├── StartMachineConfig@s.xlsx
│ │ ├── StartMachineConfig@s.xlsx.meta
│ │ ├── StartProcessConfig@s.xlsx
│ │ ├── StartProcessConfig@s.xlsx.meta
│ │ ├── StartSceneConfig@s.xlsx
│ │ ├── StartSceneConfig@s.xlsx.meta
│ │ ├── StartZoneConfig@s.xlsx
│ │ └── StartZoneConfig@s.xlsx.meta
├── UnitConfig.xlsx
└── UnitConfig.xlsx.meta
├── Proto.meta
├── Proto
├── LockStepInner_S_21001.proto
├── LockStepInner_S_21001.proto.meta
├── LockStepOuter_C_11001.proto
└── LockStepOuter_C_11001.proto.meta
├── Runtime.meta
├── Runtime
├── Hotfix.meta
├── Hotfix
│ ├── ET.Hotfix.asmdef
│ └── ET.Hotfix.asmdef.meta
├── HotfixView.meta
├── HotfixView
│ ├── ET.HotfixView.asmdef
│ └── ET.HotfixView.asmdef.meta
├── Model.meta
├── Model
│ ├── ET.Model.asmdef
│ └── ET.Model.asmdef.meta
├── ModelView.meta
└── ModelView
│ ├── ET.ModelView.asmdef
│ └── ET.ModelView.asmdef.meta
├── Scripts.meta
├── Scripts
├── Hotfix.meta
├── Hotfix
│ ├── Client.meta
│ ├── Client
│ │ ├── EnterMapHelper.cs
│ │ ├── EnterMapHelper.cs.meta
│ │ ├── G2C_ChangeSceneHandler.cs
│ │ ├── G2C_ChangeSceneHandler.cs.meta
│ │ ├── G2C_ReconnectHandler.cs
│ │ ├── G2C_ReconnectHandler.cs.meta
│ │ ├── LSClientHelper.cs
│ │ ├── LSClientHelper.cs.meta
│ │ ├── LSClientUpdaterSystem.cs
│ │ ├── LSClientUpdaterSystem.cs.meta
│ │ ├── LSReplayUpdaterSystem.cs
│ │ ├── LSReplayUpdaterSystem.cs.meta
│ │ ├── LSSceneChangeHelper.cs
│ │ ├── LSSceneChangeHelper.cs.meta
│ │ ├── OneFrameInputsHandler.cs
│ │ ├── OneFrameInputsHandler.cs.meta
│ │ ├── Room2C_AdjustUpdateTimeHandler.cs
│ │ ├── Room2C_AdjustUpdateTimeHandler.cs.meta
│ │ ├── Room2C_CheckHashFailHandler.cs
│ │ ├── Room2C_CheckHashFailHandler.cs.meta
│ │ ├── Room2C_EnterMapHandler.cs
│ │ └── Room2C_EnterMapHandler.cs.meta
│ ├── Server.meta
│ ├── Server
│ │ ├── ConfigLoaderInvoker.cs
│ │ ├── ConfigLoaderInvoker.cs.meta
│ │ ├── EntryEvent2_InitServer.cs
│ │ ├── EntryEvent2_InitServer.cs.meta
│ │ ├── Gate.meta
│ │ ├── Gate
│ │ │ ├── C2G_MatchHandler.cs
│ │ │ ├── C2G_MatchHandler.cs.meta
│ │ │ ├── Match2G_NotifyMatchSuccessHandler.cs
│ │ │ ├── Match2G_NotifyMatchSuccessHandler.cs.meta
│ │ │ ├── NetComponentOnReadInvoker_Gate.cs
│ │ │ └── NetComponentOnReadInvoker_Gate.cs.meta
│ │ ├── Map.meta
│ │ ├── Map
│ │ │ ├── C2Room_ChangeSceneFinishHandler.cs
│ │ │ ├── C2Room_ChangeSceneFinishHandler.cs.meta
│ │ │ ├── FiberInit_Map.cs
│ │ │ ├── FiberInit_Map.cs.meta
│ │ │ ├── FrameMessageHandler.cs
│ │ │ ├── FrameMessageHandler.cs.meta
│ │ │ ├── Match2Map_GetRoomHandler.cs
│ │ │ ├── Match2Map_GetRoomHandler.cs.meta
│ │ │ ├── RoomMessageHelper.cs
│ │ │ ├── RoomMessageHelper.cs.meta
│ │ │ ├── RoomServerComponentSystem.cs
│ │ │ └── RoomServerComponentSystem.cs.meta
│ │ ├── Match.meta
│ │ ├── Match
│ │ │ ├── FiberInit_Match.cs
│ │ │ ├── FiberInit_Match.cs.meta
│ │ │ ├── G2Match_MatchHandler.cs
│ │ │ ├── G2Match_MatchHandler.cs.meta
│ │ │ ├── MatchComponentSystem.cs
│ │ │ └── MatchComponentSystem.cs.meta
│ │ ├── Room.meta
│ │ └── Room
│ │ │ ├── C2Room_CheckHashHandler.cs
│ │ │ ├── C2Room_CheckHashHandler.cs.meta
│ │ │ ├── FiberInit_RoomRoot.cs
│ │ │ ├── FiberInit_RoomRoot.cs.meta
│ │ │ ├── G2Room_ReconnectHandler.cs
│ │ │ ├── G2Room_ReconnectHandler.cs.meta
│ │ │ ├── LSServerUpdaterSystem.cs
│ │ │ ├── LSServerUpdaterSystem.cs.meta
│ │ │ ├── RoomManager2Room_InitHandler.cs
│ │ │ └── RoomManager2Room_InitHandler.cs.meta
│ ├── Share.meta
│ └── Share
│ │ ├── EntryEvent1_InitShare.cs
│ │ ├── EntryEvent1_InitShare.cs.meta
│ │ ├── LSInputComponentSystem.cs
│ │ ├── LSInputComponentSystem.cs.meta
│ │ ├── LSUnitFactory.cs
│ │ ├── LSUnitFactory.cs.meta
│ │ ├── RoomSystem.cs
│ │ └── RoomSystem.cs.meta
├── HotfixView.meta
├── HotfixView
│ ├── Client.meta
│ └── Client
│ │ ├── Camera.meta
│ │ ├── Camera
│ │ ├── LSCameraComponentSystem.cs
│ │ └── LSCameraComponentSystem.cs.meta
│ │ ├── ConfigLoaderInvoker.cs
│ │ ├── ConfigLoaderInvoker.cs.meta
│ │ ├── EntryEvent3_InitClient.cs
│ │ ├── EntryEvent3_InitClient.cs.meta
│ │ ├── LSAnimatorComponentSystem.cs
│ │ ├── LSAnimatorComponentSystem.cs.meta
│ │ ├── LSOperaComponentSystem.cs
│ │ ├── LSOperaComponentSystem.cs.meta
│ │ ├── LSSceneChangeStart_AddComponent.cs
│ │ ├── LSSceneChangeStart_AddComponent.cs.meta
│ │ ├── LSSceneInitFinish_Finish.cs
│ │ ├── LSSceneInitFinish_Finish.cs.meta
│ │ ├── LSUnitViewComponentSystem.cs
│ │ ├── LSUnitViewComponentSystem.cs.meta
│ │ ├── LSUnitViewSystem.cs
│ │ ├── LSUnitViewSystem.cs.meta
│ │ ├── Scene.meta
│ │ ├── Scene
│ │ ├── AfterCreateClientScene_LSAddComponent.cs
│ │ ├── AfterCreateClientScene_LSAddComponent.cs.meta
│ │ ├── CurrentScenesComponentSystem.cs
│ │ └── CurrentScenesComponentSystem.cs.meta
│ │ ├── UI.meta
│ │ └── UI
│ │ ├── UIHelper.cs
│ │ ├── UIHelper.cs.meta
│ │ ├── UILSLobby.meta
│ │ ├── UILSLobby
│ │ ├── LoginFinish_CreateUILSLobby.cs
│ │ ├── LoginFinish_CreateUILSLobby.cs.meta
│ │ ├── UILSLobbyComponentSystem.cs
│ │ ├── UILSLobbyComponentSystem.cs.meta
│ │ ├── UILSLobbyEvent.cs
│ │ └── UILSLobbyEvent.cs.meta
│ │ ├── UILSLogin.meta
│ │ ├── UILSLogin
│ │ ├── AppStartInitFinish_CreateUILSLogin.cs
│ │ ├── AppStartInitFinish_CreateUILSLogin.cs.meta
│ │ ├── LoginFinish_RemoveLoginUI.cs
│ │ ├── LoginFinish_RemoveLoginUI.cs.meta
│ │ ├── UILSLoginEvent.cs
│ │ ├── UILSLoginEvent.cs.meta
│ │ ├── UILoginComponentSystem.cs
│ │ └── UILoginComponentSystem.cs.meta
│ │ ├── UILSRoom.meta
│ │ └── UILSRoom
│ │ ├── UILSRoomComponentSystem.cs
│ │ ├── UILSRoomComponentSystem.cs.meta
│ │ ├── UILSRoomEvent.cs
│ │ └── UILSRoomEvent.cs.meta
├── Model.meta
├── Model
│ ├── Client.meta
│ ├── Client
│ │ ├── EventType.cs
│ │ ├── EventType.cs.meta
│ │ ├── LSClientUpdater.cs
│ │ ├── LSClientUpdater.cs.meta
│ │ ├── LSReplayUpdater.cs
│ │ ├── LSReplayUpdater.cs.meta
│ │ ├── Scene.meta
│ │ ├── Scene
│ │ │ ├── CurrentScenesComponent.cs
│ │ │ └── CurrentScenesComponent.cs.meta
│ │ ├── WaitType.cs
│ │ └── WaitType.cs.meta
│ ├── Server.meta
│ ├── Server
│ │ ├── Gate.meta
│ │ ├── Gate
│ │ │ ├── PlayerRoomComponent.cs
│ │ │ └── PlayerRoomComponent.cs.meta
│ │ ├── Map.meta
│ │ ├── Map
│ │ │ ├── RoomManagerComponent.cs
│ │ │ ├── RoomManagerComponent.cs.meta
│ │ │ ├── RoomPlayer.cs
│ │ │ ├── RoomPlayer.cs.meta
│ │ │ ├── RoomServerComponent.cs
│ │ │ └── RoomServerComponent.cs.meta
│ │ ├── Match.meta
│ │ ├── Match
│ │ │ ├── MatchComponent.cs
│ │ │ └── MatchComponent.cs.meta
│ │ ├── Room.meta
│ │ └── Room
│ │ │ ├── LSServerUpdater.cs
│ │ │ └── LSServerUpdater.cs.meta
│ ├── Share.meta
│ └── Share
│ │ ├── FixedTimeCounter.cs
│ │ ├── FixedTimeCounter.cs.meta
│ │ ├── FrameBuffer.cs
│ │ ├── FrameBuffer.cs.meta
│ │ ├── IRoomMessage.cs
│ │ ├── IRoomMessage.cs.meta
│ │ ├── LSConstValue.cs
│ │ ├── LSConstValue.cs.meta
│ │ ├── LSInput.cs
│ │ ├── LSInput.cs.meta
│ │ ├── LSInputComponent.cs
│ │ ├── LSInputComponent.cs.meta
│ │ ├── LSUnit.cs
│ │ ├── LSUnit.cs.meta
│ │ ├── LSUnitComponent.cs
│ │ ├── LSUnitComponent.cs.meta
│ │ ├── OneFrameInputs.cs
│ │ ├── OneFrameInputs.cs.meta
│ │ ├── PackageType.cs
│ │ ├── PackageType.cs.meta
│ │ ├── Replay.cs
│ │ ├── Replay.cs.meta
│ │ ├── Room.cs
│ │ ├── Room.cs.meta
│ │ ├── SceneType.cs
│ │ └── SceneType.cs.meta
├── ModelView.meta
└── ModelView
│ ├── Client.meta
│ └── Client
│ ├── LSAnimatorComponent.cs
│ ├── LSAnimatorComponent.cs.meta
│ ├── LSCameraComponent.cs
│ ├── LSCameraComponent.cs.meta
│ ├── LSOperaComponent.cs
│ ├── LSOperaComponent.cs.meta
│ ├── LSUnitView.cs
│ ├── LSUnitView.cs.meta
│ ├── LSUnitViewComponent.cs
│ ├── LSUnitViewComponent.cs.meta
│ ├── UI.meta
│ └── UI
│ ├── UILSLobby.meta
│ ├── UILSLobby
│ ├── UILSLobbyComponent.cs
│ └── UILSLobbyComponent.cs.meta
│ ├── UILSLogin.meta
│ ├── UILSLogin
│ ├── UILSLoginComponent.cs
│ └── UILSLoginComponent.cs.meta
│ ├── UILSRoom.meta
│ ├── UILSRoom
│ ├── UILSRoomComponent.cs
│ └── UILSRoomComponent.cs.meta
│ ├── UIType.cs
│ └── UIType.cs.meta
├── Settings.meta
├── Settings
├── AssetBundleCollectorSetting.asset
└── AssetBundleCollectorSetting.asset.meta
├── link.xml
├── link.xml.meta
├── package.json
├── package.json.meta
├── packagegit.json
└── packagegit.json.meta
/.gitignore:
--------------------------------------------------------------------------------
1 | obj/
2 | /**/AssemblyReference.asmref
3 | /**/AssemblyReference.asmref.meta
--------------------------------------------------------------------------------
/Bundles.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: e61ea5cafae8aa64c8f70948d8d59a0e
3 | folderAsset: yes
4 | DefaultImporter:
5 | externalObjects: {}
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/Bundles/UI.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 46d77ff0337e90d48b6498af8842df3a
3 | folderAsset: yes
4 | DefaultImporter:
5 | externalObjects: {}
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/Bundles/UI/UILSLobby.prefab.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 5cb3b48a2d2a948d6b2564f64624607c
3 | PrefabImporter:
4 | externalObjects: {}
5 | userData:
6 | assetBundleName:
7 | assetBundleVariant:
8 |
--------------------------------------------------------------------------------
/Bundles/UI/UILSLogin.prefab.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: f29d435e196cd421aa7a7700402942f3
3 | PrefabImporter:
4 | externalObjects: {}
5 | userData:
6 | assetBundleName:
7 | assetBundleVariant:
8 |
--------------------------------------------------------------------------------
/Bundles/UI/UILSRoom.prefab.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: fcad5af85f5a54eb3884cdfb6efc7d27
3 | PrefabImporter:
4 | externalObjects: {}
5 | userData:
6 | assetBundleName:
7 | assetBundleVariant:
8 |
--------------------------------------------------------------------------------
/DotNet~/App/ET.App.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Exe
5 | net8.0
6 | ET
7 | 12
8 | ET.App
9 |
10 |
11 |
12 | false
13 | en
14 |
15 |
16 |
17 | DOTNET
18 | $(SolutionDir)Bin
19 | true
20 | true
21 |
22 |
23 |
24 | false
25 |
26 |
27 |
28 | DOTNET
29 | $(SolutionDir)Bin
30 | true
31 | true
32 |
33 |
34 |
35 |
36 |
37 |
38 |
--------------------------------------------------------------------------------
/DotNet~/App/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Threading;
3 |
4 | namespace ET
5 | {
6 | public static class Program
7 | {
8 | public static void Main()
9 | {
10 | //这里大家看着可能比较困惑,为什么要绕一大圈呢,之前这里直接调用Model层,现在却要在CoderLoader中获取Model的程序集找到Entry入口再调用
11 | //原因是,之前ET.App直接依赖Model,但是在客户端,之前的Loader却不依赖Model。这导致前端跟后端程序集依赖不太一样
12 | //这样前后端Model都引用Loader,Loader通过反射去调用Model的Entry。
13 | //这样前后端的程序集依赖就保持了一致。这里调用了Entry.Init()是为了防止dotnet裁剪Model的程序集,毕竟如果App没有调用model,那么dotnet认为
14 | //model并没有用到,就不会加载,结果会导致CodeLoader反射调用model失败。
15 | //客户端服务端不热更不共享的组件可以写到Loader中,比如表现层需要一个组件不需要热更,可以写在Loader中,这样性能更高。如果客户端跟服务端共享的并且不需要热更的
16 | //的组件可以写在Core中
17 | Entry.Init();
18 |
19 | Init init = new();
20 | init.Start();
21 |
22 | while (true)
23 | {
24 | Thread.Sleep(1);
25 | try
26 | {
27 | init.Update();
28 | init.LateUpdate();
29 | }
30 | catch (Exception e)
31 | {
32 | Log.Error(e);
33 | }
34 | }
35 | }
36 | }
37 | }
--------------------------------------------------------------------------------
/DotNet~/Hotfix/ET.Hotfix.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 | net8.0
4 | ET
5 | 12
6 | ET.Hotfix
7 |
8 |
9 | false
10 | en
11 |
12 |
13 | DOTNET
14 | $(SolutionDir)Bin
15 | true
16 | 0169,0649,3021,8981,CS9193,CS9192
17 |
18 |
19 | DOTNET
20 | $(SolutionDir)Bin
21 | true
22 | false
23 | true
24 | 0169,0649,3021,8981,CS9193,CS9192
25 |
26 |
27 |
28 |
29 | %(RecursiveDir)%(FileName)%(Extension)
30 |
31 |
32 |
33 | %(RecursiveDir)%(FileName)%(Extension)
34 |
35 |
36 |
37 | %(RecursiveDir)%(FileName)%(Extension)
38 |
39 |
40 |
41 | %(RecursiveDir)%(FileName)%(Extension)
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
--------------------------------------------------------------------------------
/DotNet~/Model/ET.Model.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 | net8.0
4 | ET
5 | 12
6 | ET.Model
7 |
8 |
9 | false
10 | en
11 |
12 |
13 | DOTNET
14 | $(SolutionDir)Bin
15 | true
16 | 0169,0649,3021,8981,CS9193,CS9192
17 |
18 |
19 | DOTNET
20 | $(SolutionDir)Bin
21 | true
22 | false
23 | true
24 | 0169,0649,3021,8981,CS9193,CS9192
25 |
26 |
27 |
28 |
29 | %(RecursiveDir)%(FileName)%(Extension)
30 |
31 |
32 |
33 | %(RecursiveDir)%(FileName)%(Extension)
34 |
35 |
36 |
37 | %(RecursiveDir)%(FileName)%(Extension)
38 |
39 |
40 |
41 | %(RecursiveDir)%(FileName)%(Extension)
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
--------------------------------------------------------------------------------
/ET.sln.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 2014c85ed0b48e449af3281445a1db60
3 | DefaultImporter:
4 | externalObjects: {}
5 | userData:
6 | assetBundleName:
7 | assetBundleVariant:
8 |
--------------------------------------------------------------------------------
/Editor.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 94a6715610329d641b577effa809ed71
3 | folderAsset: yes
4 | DefaultImporter:
5 | externalObjects: {}
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/Editor/ET.LockStep.Editor.asmdef:
--------------------------------------------------------------------------------
1 | {
2 | "name": "ET.LockStep.Editor",
3 | "rootNamespace": "",
4 | "references": [
5 | "GUID:8143775d3da845e45a4f85b1ce296dbd",
6 | "GUID:a3afba8ed306dd44d8fc07ebdecebe02",
7 | "GUID:000a53018e5e7c14aa75273e1f7be8e2",
8 | "GUID:8c9e39eefd0c20b4694e7abae61c53b5"
9 | ],
10 | "includePlatforms": [
11 | "Editor"
12 | ],
13 | "excludePlatforms": [],
14 | "allowUnsafeCode": false,
15 | "overrideReferences": false,
16 | "precompiledReferences": [],
17 | "autoReferenced": true,
18 | "defineConstraints": [],
19 | "versionDefines": [],
20 | "noEngineReferences": false
21 | }
--------------------------------------------------------------------------------
/Editor/ET.LockStep.Editor.asmdef.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: b5e205014aeb2ef4e91e0b07e9208a04
3 | AssemblyDefinitionImporter:
4 | externalObjects: {}
5 | userData:
6 | assetBundleName:
7 | assetBundleVariant:
8 |
--------------------------------------------------------------------------------
/Editor/LockStepEditor.cs:
--------------------------------------------------------------------------------
1 | using System.Collections;
2 | using System.Collections.Generic;
3 | using UnityEditor;
4 | using UnityEngine;
5 |
6 | namespace ET
7 | {
8 | public class LockStepEditor
9 | {
10 | [MenuItem("ET/LockStep/Init")]
11 | public static void Init()
12 | {
13 | HybridCLREditor.Init();
14 |
15 | ExcelEditor.Init();
16 |
17 | ProtoEditor.Init();
18 |
19 | LoaderEditor.Init();
20 |
21 | AssetDatabase.Refresh();
22 |
23 | Debug.Log("Init finish!");
24 | }
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/Editor/LockStepEditor.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 3dab93ef6371b7045b5d8f8abbe94c33
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Excel.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: bbea88fb3e8013644ae18e8e5d67132f
3 | folderAsset: yes
4 | DefaultImporter:
5 | externalObjects: {}
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/Excel/StartConfig.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: c2cf11ce420718543b341c8e56af3aaf
3 | folderAsset: yes
4 | DefaultImporter:
5 | externalObjects: {}
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/Excel/StartConfig/Localhost.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: c216baca1410ef044bfe845483e6f6e4
3 | folderAsset: yes
4 | DefaultImporter:
5 | externalObjects: {}
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/Excel/StartConfig/Localhost/StartMachineConfig@s.xlsx:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ET-Packages/cn.etetet.lockstep/44e872e1ddaa5e4eb3d27efd0e192149b2a487a7/Excel/StartConfig/Localhost/StartMachineConfig@s.xlsx
--------------------------------------------------------------------------------
/Excel/StartConfig/Localhost/StartMachineConfig@s.xlsx.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 0c6a443736c53654c84bb430b78df758
3 | DefaultImporter:
4 | externalObjects: {}
5 | userData:
6 | assetBundleName:
7 | assetBundleVariant:
8 |
--------------------------------------------------------------------------------
/Excel/StartConfig/Localhost/StartProcessConfig@s.xlsx:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ET-Packages/cn.etetet.lockstep/44e872e1ddaa5e4eb3d27efd0e192149b2a487a7/Excel/StartConfig/Localhost/StartProcessConfig@s.xlsx
--------------------------------------------------------------------------------
/Excel/StartConfig/Localhost/StartProcessConfig@s.xlsx.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 631281e989abb6c4e80106b0502d46a8
3 | DefaultImporter:
4 | externalObjects: {}
5 | userData:
6 | assetBundleName:
7 | assetBundleVariant:
8 |
--------------------------------------------------------------------------------
/Excel/StartConfig/Localhost/StartSceneConfig@s.xlsx:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ET-Packages/cn.etetet.lockstep/44e872e1ddaa5e4eb3d27efd0e192149b2a487a7/Excel/StartConfig/Localhost/StartSceneConfig@s.xlsx
--------------------------------------------------------------------------------
/Excel/StartConfig/Localhost/StartSceneConfig@s.xlsx.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 96431e2b1becbd041acbca2842de9465
3 | DefaultImporter:
4 | externalObjects: {}
5 | userData:
6 | assetBundleName:
7 | assetBundleVariant:
8 |
--------------------------------------------------------------------------------
/Excel/StartConfig/Localhost/StartZoneConfig@s.xlsx:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ET-Packages/cn.etetet.lockstep/44e872e1ddaa5e4eb3d27efd0e192149b2a487a7/Excel/StartConfig/Localhost/StartZoneConfig@s.xlsx
--------------------------------------------------------------------------------
/Excel/StartConfig/Localhost/StartZoneConfig@s.xlsx.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: f5acaa5394763914297715289ae69489
3 | DefaultImporter:
4 | externalObjects: {}
5 | userData:
6 | assetBundleName:
7 | assetBundleVariant:
8 |
--------------------------------------------------------------------------------
/Excel/StartConfig/Release.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: f35157653367b5340a880c68a61520c8
3 | folderAsset: yes
4 | DefaultImporter:
5 | externalObjects: {}
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/Excel/StartConfig/Release/StartMachineConfig@s.xlsx:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ET-Packages/cn.etetet.lockstep/44e872e1ddaa5e4eb3d27efd0e192149b2a487a7/Excel/StartConfig/Release/StartMachineConfig@s.xlsx
--------------------------------------------------------------------------------
/Excel/StartConfig/Release/StartMachineConfig@s.xlsx.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: aa374e1d46aebcd42be062b678154682
3 | DefaultImporter:
4 | externalObjects: {}
5 | userData:
6 | assetBundleName:
7 | assetBundleVariant:
8 |
--------------------------------------------------------------------------------
/Excel/StartConfig/Release/StartProcessConfig@s.xlsx:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ET-Packages/cn.etetet.lockstep/44e872e1ddaa5e4eb3d27efd0e192149b2a487a7/Excel/StartConfig/Release/StartProcessConfig@s.xlsx
--------------------------------------------------------------------------------
/Excel/StartConfig/Release/StartProcessConfig@s.xlsx.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: f903631f3f41ca645923a79959806dfd
3 | DefaultImporter:
4 | externalObjects: {}
5 | userData:
6 | assetBundleName:
7 | assetBundleVariant:
8 |
--------------------------------------------------------------------------------
/Excel/StartConfig/Release/StartSceneConfig@s.xlsx:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ET-Packages/cn.etetet.lockstep/44e872e1ddaa5e4eb3d27efd0e192149b2a487a7/Excel/StartConfig/Release/StartSceneConfig@s.xlsx
--------------------------------------------------------------------------------
/Excel/StartConfig/Release/StartSceneConfig@s.xlsx.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 24efca463d6dc6544ba48a094f4dbcd2
3 | DefaultImporter:
4 | externalObjects: {}
5 | userData:
6 | assetBundleName:
7 | assetBundleVariant:
8 |
--------------------------------------------------------------------------------
/Excel/StartConfig/Release/StartZoneConfig@s.xlsx:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ET-Packages/cn.etetet.lockstep/44e872e1ddaa5e4eb3d27efd0e192149b2a487a7/Excel/StartConfig/Release/StartZoneConfig@s.xlsx
--------------------------------------------------------------------------------
/Excel/StartConfig/Release/StartZoneConfig@s.xlsx.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: a1e51945b5befcd47adde1074bd312a1
3 | DefaultImporter:
4 | externalObjects: {}
5 | userData:
6 | assetBundleName:
7 | assetBundleVariant:
8 |
--------------------------------------------------------------------------------
/Excel/UnitConfig.xlsx:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ET-Packages/cn.etetet.lockstep/44e872e1ddaa5e4eb3d27efd0e192149b2a487a7/Excel/UnitConfig.xlsx
--------------------------------------------------------------------------------
/Excel/UnitConfig.xlsx.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: f6ac43eb1bcdce840a40c8a31673d33d
3 | DefaultImporter:
4 | externalObjects: {}
5 | userData:
6 | assetBundleName:
7 | assetBundleVariant:
8 |
--------------------------------------------------------------------------------
/Proto.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 16d878764281daf448a27dfd9c8268e9
3 | folderAsset: yes
4 | DefaultImporter:
5 | externalObjects: {}
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/Proto/LockStepInner_S_21001.proto:
--------------------------------------------------------------------------------
1 | syntax = "proto3";
2 | package ET;
3 |
4 | /// 请求匹配
5 | // ResponseType Match2G_Match
6 | message G2Match_Match // IRequest
7 | {
8 | int32 RpcId = 1;
9 |
10 | int64 Id = 2;
11 | }
12 |
13 | message Match2G_Match // IResponse
14 | {
15 | int32 RpcId = 1;
16 | int32 Error = 2;
17 | string Message = 3;
18 | }
19 |
20 | // ResponseType Map2Match_GetRoom
21 | message Match2Map_GetRoom // IRequest
22 | {
23 | int32 RpcId = 1;
24 | repeated int64 PlayerIds = 2;
25 | }
26 |
27 | message Map2Match_GetRoom // IResponse
28 | {
29 | int32 RpcId = 1;
30 | int32 Error = 2;
31 | string Message = 3;
32 |
33 | /// 房间的ActorId
34 | ActorId ActorId = 4;
35 | }
36 |
37 | // ResponseType Room2G_Reconnect
38 | message G2Room_Reconnect // IRequest
39 | {
40 | int32 RpcId = 1;
41 | int64 PlayerId = 2;
42 | }
43 |
44 | message Room2G_Reconnect // IResponse
45 | {
46 | int32 RpcId = 1;
47 | int32 Error = 2;
48 | string Message = 3;
49 |
50 | int64 StartTime = 4;
51 | repeated LockStepUnitInfo UnitInfos = 5;
52 | int32 Frame = 6;
53 | }
54 |
55 | // ResponseType Room2RoomManager_Init
56 | message RoomManager2Room_Init // IRequest
57 | {
58 | int32 RpcId = 1;
59 | repeated int64 PlayerIds = 2;
60 | }
61 |
62 | message Room2RoomManager_Init // IResponse
63 | {
64 | int32 RpcId = 1;
65 | int32 Error = 2;
66 | string Message = 3;
67 | }
--------------------------------------------------------------------------------
/Proto/LockStepInner_S_21001.proto.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 2adafb641a45a4d548b1cc826aca1d6f
3 | DefaultImporter:
4 | externalObjects: {}
5 | userData:
6 | assetBundleName:
7 | assetBundleVariant:
8 |
--------------------------------------------------------------------------------
/Proto/LockStepOuter_C_11001.proto:
--------------------------------------------------------------------------------
1 | syntax = "proto3";
2 | package ET;
3 |
4 | // ResponseType G2C_Match
5 | message C2G_Match // ISessionRequest
6 | {
7 | int32 RpcId = 1;
8 | }
9 |
10 | message G2C_Match // ISessionResponse
11 | {
12 | int32 RpcId = 1;
13 | int32 Error = 2;
14 | string Message = 3;
15 | }
16 |
17 | /// 匹配成功,通知客户端切换场景
18 | message Match2G_NotifyMatchSuccess // IMessage
19 | {
20 | int32 RpcId = 1;
21 | /// 房间的ActorId
22 | ActorId ActorId = 2;
23 | }
24 |
25 | /// 客户端通知房间切换场景完成
26 | message C2Room_ChangeSceneFinish // IRoomMessage
27 | {
28 | int64 PlayerId = 1;
29 | }
30 |
31 | message LockStepUnitInfo
32 | {
33 | int64 PlayerId = 1;
34 | TrueSync.TSVector Position = 2;
35 | TrueSync.TSQuaternion Rotation = 3;
36 | }
37 |
38 | /// 房间通知客户端进入战斗
39 | message Room2C_Start // IMessage
40 | {
41 | int64 StartTime = 1;
42 | repeated LockStepUnitInfo UnitInfo = 2;
43 | }
44 |
45 | message FrameMessage // IMessage
46 | {
47 | int32 Frame = 1;
48 | int64 PlayerId = 2;
49 | LSInput Input = 3;
50 | }
51 |
52 | message OneFrameInputs // IMessage
53 | {
54 | map Inputs = 2;
55 | }
56 |
57 | message Room2C_AdjustUpdateTime // IMessage
58 | {
59 | int32 DiffTime = 1;
60 | }
61 |
62 | message C2Room_CheckHash // IRoomMessage
63 | {
64 | int64 PlayerId = 1;
65 | int32 Frame = 2;
66 | int64 Hash = 3;
67 | }
68 |
69 | message Room2C_CheckHashFail // IMessage
70 | {
71 | int32 Frame = 1;
72 | bytes LSWorldBytes = 2;
73 | }
74 |
75 | message G2C_Reconnect // IMessage
76 | {
77 | int64 StartTime = 1;
78 | repeated LockStepUnitInfo UnitInfos = 2;
79 | int32 Frame = 3;
80 | }
81 |
82 | message RouterSync
83 | {
84 | uint32 ConnectId = 1;
85 | string Address = 2;
86 | }
87 |
88 | // ResponseType G2C_EnterMap
89 | message C2G_EnterMap // ISessionRequest
90 | {
91 | int32 RpcId = 1;
92 | }
93 |
94 | message G2C_EnterMap // ISessionResponse
95 | {
96 | int32 RpcId = 1;
97 | int32 Error = 2;
98 | string Message = 3;
99 | /// 自己的UnitId
100 | int64 MyId = 4;
101 | }
102 |
103 | message G2C_Test // ISessionMessage
104 | {
105 | }
106 |
107 |
108 | // ResponseType M2C_TransferMap
109 | message C2M_TransferMap // ILocationRequest
110 | {
111 | int32 RpcId = 1;
112 | }
113 |
114 | message M2C_TransferMap // ILocationResponse
115 | {
116 | int32 RpcId = 1;
117 | int32 Error = 2;
118 | string Message = 3;
119 | }
--------------------------------------------------------------------------------
/Proto/LockStepOuter_C_11001.proto.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 32e6c63b0256f45a19583fba46f5cfab
3 | DefaultImporter:
4 | externalObjects: {}
5 | userData:
6 | assetBundleName:
7 | assetBundleVariant:
8 |
--------------------------------------------------------------------------------
/Runtime.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 71ec3ee3b48467e429addd9513a6f357
3 | folderAsset: yes
4 | DefaultImporter:
5 | externalObjects: {}
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/Runtime/Hotfix.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: d401a87278673b749aa2ff8a6ca918f6
3 | folderAsset: yes
4 | DefaultImporter:
5 | externalObjects: {}
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/Runtime/Hotfix/ET.Hotfix.asmdef:
--------------------------------------------------------------------------------
1 | {
2 | "name": "ET.Hotfix",
3 | "rootNamespace": "",
4 | "references": [
5 | "ET.Core",
6 | "ET.Loader",
7 | "ET.LSEntity",
8 | "ET.MemoryPack",
9 | "ET.Model",
10 | "ET.SourceGeneratorAttribute",
11 | "ET.TrueSync",
12 | "Unity.Mathematics"
13 | ],
14 | "includePlatforms": [],
15 | "excludePlatforms": [],
16 | "allowUnsafeCode": false,
17 | "overrideReferences": false,
18 | "precompiledReferences": [],
19 | "autoReferenced": false,
20 | "defineConstraints": [
21 | "INITED"
22 | ],
23 | "versionDefines": [],
24 | "noEngineReferences": false,
25 | "optionalUnityReferences": [],
26 | "additionalReferences": [],
27 | "compilerOptions": ""
28 | }
--------------------------------------------------------------------------------
/Runtime/Hotfix/ET.Hotfix.asmdef.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: c180fc01050ff5b4c99317c8d71330bb
3 | AssemblyDefinitionImporter:
4 | externalObjects: {}
5 | userData:
6 | assetBundleName:
7 | assetBundleVariant:
8 |
--------------------------------------------------------------------------------
/Runtime/HotfixView.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: e91be3238e243f64fadab37e89168252
3 | folderAsset: yes
4 | DefaultImporter:
5 | externalObjects: {}
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/Runtime/HotfixView/ET.HotfixView.asmdef:
--------------------------------------------------------------------------------
1 | {
2 | "name": "ET.HotfixView",
3 | "rootNamespace": "",
4 | "references": [
5 | "ET.Core",
6 | "ET.Hotfix",
7 | "ET.Loader",
8 | "ET.LSEntity",
9 | "ET.MemoryPack",
10 | "ET.Model",
11 | "ET.ModelView",
12 | "ET.ReferenceCollector",
13 | "ET.SourceGeneratorAttribute",
14 | "ET.TrueSync",
15 | "ET.UI",
16 | "ET.YooAssets",
17 | "Unity.Mathematics"
18 | ],
19 | "includePlatforms": [],
20 | "excludePlatforms": [],
21 | "allowUnsafeCode": false,
22 | "overrideReferences": false,
23 | "precompiledReferences": [],
24 | "autoReferenced": false,
25 | "defineConstraints": [
26 | "INITED"
27 | ],
28 | "versionDefines": [],
29 | "noEngineReferences": false,
30 | "optionalUnityReferences": [],
31 | "additionalReferences": [],
32 | "compilerOptions": ""
33 | }
--------------------------------------------------------------------------------
/Runtime/HotfixView/ET.HotfixView.asmdef.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 2fb48a193ba95504fa2a4bd194f671e2
3 | AssemblyDefinitionImporter:
4 | externalObjects: {}
5 | userData:
6 | assetBundleName:
7 | assetBundleVariant:
8 |
--------------------------------------------------------------------------------
/Runtime/Model.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 24cf428edcabc4f4d957967893fa3dfd
3 | folderAsset: yes
4 | DefaultImporter:
5 | externalObjects: {}
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/Runtime/Model/ET.Model.asmdef:
--------------------------------------------------------------------------------
1 | {
2 | "name": "ET.Model",
3 | "rootNamespace": "",
4 | "references": [
5 | "ET.Core",
6 | "ET.Loader",
7 | "ET.LSEntity",
8 | "ET.MemoryPack",
9 | "ET.SourceGeneratorAttribute",
10 | "ET.TrueSync",
11 | "Unity.Mathematics",
12 | "ET.YooAssets"
13 | ],
14 | "includePlatforms": [],
15 | "excludePlatforms": [],
16 | "allowUnsafeCode": false,
17 | "overrideReferences": false,
18 | "precompiledReferences": [],
19 | "autoReferenced": false,
20 | "defineConstraints": [
21 | "INITED"
22 | ],
23 | "versionDefines": [],
24 | "noEngineReferences": false,
25 | "optionalUnityReferences": [],
26 | "additionalReferences": [],
27 | "compilerOptions": ""
28 | }
--------------------------------------------------------------------------------
/Runtime/Model/ET.Model.asmdef.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 26a9f93ef662143498f65f11f2c00328
3 | AssemblyDefinitionImporter:
4 | externalObjects: {}
5 | userData:
6 | assetBundleName:
7 | assetBundleVariant:
8 |
--------------------------------------------------------------------------------
/Runtime/ModelView.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 9bec2ff40f376d242af066dcc12b4518
3 | folderAsset: yes
4 | DefaultImporter:
5 | externalObjects: {}
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/Runtime/ModelView/ET.ModelView.asmdef:
--------------------------------------------------------------------------------
1 | {
2 | "name": "ET.ModelView",
3 | "rootNamespace": "",
4 | "references": [
5 | "ET.Core",
6 | "ET.Loader",
7 | "ET.LSEntity",
8 | "ET.Model",
9 | "ET.ReferenceCollector",
10 | "ET.SourceGeneratorAttribute",
11 | "ET.UI",
12 | "ET.YooAssets"
13 | ],
14 | "includePlatforms": [],
15 | "excludePlatforms": [],
16 | "allowUnsafeCode": false,
17 | "overrideReferences": false,
18 | "precompiledReferences": [],
19 | "autoReferenced": false,
20 | "defineConstraints": [
21 | "INITED"
22 | ],
23 | "versionDefines": [],
24 | "noEngineReferences": false,
25 | "optionalUnityReferences": [],
26 | "additionalReferences": [],
27 | "compilerOptions": ""
28 | }
--------------------------------------------------------------------------------
/Runtime/ModelView/ET.ModelView.asmdef.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 6c1cc35cabf0e314593698dedfdd9211
3 | AssemblyDefinitionImporter:
4 | externalObjects: {}
5 | userData:
6 | assetBundleName:
7 | assetBundleVariant:
8 |
--------------------------------------------------------------------------------
/Scripts.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 85bdfd4bd1f68814a9b8c5ba24fcafdd
3 | folderAsset: yes
4 | DefaultImporter:
5 | externalObjects: {}
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/Scripts/Hotfix.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: a7662b1c954242a4d9e670ba2f6c3f42
3 | folderAsset: yes
4 | DefaultImporter:
5 | externalObjects: {}
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/Scripts/Hotfix/Client.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: afea4f19cbbde024f89db079a250a27b
3 | folderAsset: yes
4 | DefaultImporter:
5 | externalObjects: {}
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/Scripts/Hotfix/Client/EnterMapHelper.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 |
4 | namespace ET.Client
5 | {
6 | public static partial class EnterMapHelper
7 | {
8 | public static async ETTask EnterMapAsync(Scene root)
9 | {
10 | try
11 | {
12 | G2C_EnterMap g2CEnterMap = await root.GetComponent().Call(C2G_EnterMap.Create()) as G2C_EnterMap;
13 |
14 | // 等待场景切换完成
15 | await root.GetComponent().Wait();
16 |
17 | EventSystem.Instance.Publish(root, new EnterMapFinish());
18 | }
19 | catch (Exception e)
20 | {
21 | Log.Error(e);
22 | }
23 | }
24 |
25 | public static async ETTask Match(Fiber fiber)
26 | {
27 | try
28 | {
29 | G2C_Match g2CEnterMap = await fiber.Root.GetComponent().Call(C2G_Match.Create()) as G2C_Match;
30 | }
31 | catch (Exception e)
32 | {
33 | Log.Error(e);
34 | }
35 | }
36 | }
37 | }
--------------------------------------------------------------------------------
/Scripts/Hotfix/Client/EnterMapHelper.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 61f3fa6c2bfd434c9a5941094b5c1bfe
3 | timeCreated: 1718525824
--------------------------------------------------------------------------------
/Scripts/Hotfix/Client/G2C_ChangeSceneHandler.cs:
--------------------------------------------------------------------------------
1 | namespace ET.Client
2 | {
3 | [MessageHandler(SceneType.LockStep)]
4 | public class Match2G_NotifyMatchSuccessHandler: MessageHandler
5 | {
6 | protected override async ETTask Run(Scene root, Match2G_NotifyMatchSuccess message)
7 | {
8 | await LSSceneChangeHelper.SceneChangeTo(root, "Map1", message.ActorId.InstanceId);
9 | }
10 | }
11 | }
--------------------------------------------------------------------------------
/Scripts/Hotfix/Client/G2C_ChangeSceneHandler.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: cbf8b88a563eb46bfbaf987167d6a451
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Scripts/Hotfix/Client/G2C_ReconnectHandler.cs:
--------------------------------------------------------------------------------
1 | namespace ET.Client
2 | {
3 | [MessageHandler(SceneType.LockStep)]
4 | public class G2C_ReconnectHandler: MessageHandler
5 | {
6 | protected override async ETTask Run(Scene root, G2C_Reconnect message)
7 | {
8 | await LSSceneChangeHelper.SceneChangeToReconnect(root, message);
9 | await ETTask.CompletedTask;
10 | }
11 | }
12 | }
--------------------------------------------------------------------------------
/Scripts/Hotfix/Client/G2C_ReconnectHandler.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 41d6bacdbd4ca1843a732fc0144dc8fb
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Scripts/Hotfix/Client/LSClientHelper.cs:
--------------------------------------------------------------------------------
1 | using System.IO;
2 |
3 | namespace ET.Client
4 | {
5 | public static partial class LSClientHelper
6 | {
7 | public static void RunLSRollbackSystem(Entity entity)
8 | {
9 | if (entity is LSEntity)
10 | {
11 | return;
12 | }
13 |
14 | LSEntitySystemSingleton.Instance.LSRollback(entity);
15 |
16 | if (entity.ComponentsCount() > 0)
17 | {
18 | foreach (var kv in entity.Components)
19 | {
20 | RunLSRollbackSystem(kv.Value);
21 | }
22 | }
23 |
24 | if (entity.ChildrenCount() > 0)
25 | {
26 | foreach (var kv in entity.Children)
27 | {
28 | RunLSRollbackSystem(kv.Value);
29 | }
30 | }
31 | }
32 |
33 | // 回滚
34 | public static void Rollback(Room room, int frame)
35 | {
36 | room.LSWorld.Dispose();
37 | FrameBuffer frameBuffer = room.FrameBuffer;
38 |
39 | // 回滚
40 | room.LSWorld = room.GetLSWorld(SceneType.LockStepClient, frame);
41 | OneFrameInputs authorityFrameInput = frameBuffer.FrameInputs(frame);
42 | // 执行AuthorityFrame
43 | room.Update(authorityFrameInput);
44 | room.SendHash(frame);
45 |
46 |
47 | // 重新执行预测的帧
48 | for (int i = room.AuthorityFrame + 1; i <= room.PredictionFrame; ++i)
49 | {
50 | OneFrameInputs oneFrameInputs = frameBuffer.FrameInputs(i);
51 | LSClientHelper.CopyOtherInputsTo(room, authorityFrameInput, oneFrameInputs); // 重新预测消息
52 | room.Update(oneFrameInputs);
53 | }
54 |
55 | RunLSRollbackSystem(room);
56 | }
57 |
58 | public static void SendHash(this Room self, int frame)
59 | {
60 | if (frame > self.AuthorityFrame)
61 | {
62 | return;
63 | }
64 | long hash = self.FrameBuffer.GetHash(frame);
65 | C2Room_CheckHash c2RoomCheckHash = C2Room_CheckHash.Create();
66 | c2RoomCheckHash.Frame = frame;
67 | c2RoomCheckHash.Hash = hash;
68 | self.Root().GetComponent().Send(c2RoomCheckHash);
69 | }
70 |
71 | // 重新调整预测消息,只需要调整其他玩家的输入
72 | public static void CopyOtherInputsTo(Room room, OneFrameInputs from, OneFrameInputs to)
73 | {
74 | long myId = room.GetComponent().MyId;
75 | foreach (var kv in from.Inputs)
76 | {
77 | if (kv.Key == myId)
78 | {
79 | continue;
80 | }
81 | to.Inputs[kv.Key] = kv.Value;
82 | }
83 | }
84 |
85 | public static void SaveReplay(Room room, string path)
86 | {
87 | if (room.IsReplay)
88 | {
89 | return;
90 | }
91 |
92 | Log.Debug($"save replay: {path} frame: {room.Replay.FrameInputs.Count}");
93 | byte[] bytes = MemoryPackHelper.Serialize(room.Replay);
94 | File.WriteAllBytes(path, bytes);
95 | }
96 |
97 | public static void JumpReplay(Room room, int frame)
98 | {
99 | if (!room.IsReplay)
100 | {
101 | return;
102 | }
103 |
104 | if (frame >= room.Replay.FrameInputs.Count)
105 | {
106 | frame = room.Replay.FrameInputs.Count - 1;
107 | }
108 |
109 | int snapshotIndex = frame / LSConstValue.SaveLSWorldFrameCount;
110 | Log.Debug($"jump replay start {room.AuthorityFrame} {frame} {snapshotIndex}");
111 | if (snapshotIndex != room.AuthorityFrame / LSConstValue.SaveLSWorldFrameCount || frame < room.AuthorityFrame)
112 | {
113 | room.LSWorld.Dispose();
114 | // 回滚
115 | byte[] memoryBuffer = room.Replay.Snapshots[snapshotIndex];
116 | LSWorld lsWorld = MemoryPackHelper.Deserialize(typeof (LSWorld), memoryBuffer, 0, memoryBuffer.Length) as LSWorld;
117 | room.LSWorld = lsWorld;
118 | room.AuthorityFrame = snapshotIndex * LSConstValue.SaveLSWorldFrameCount;
119 | RunLSRollbackSystem(room);
120 | }
121 |
122 | room.FixedTimeCounter.Reset(TimeInfo.Instance.ServerFrameTime() - frame * LSConstValue.UpdateInterval, 0);
123 |
124 | Log.Debug($"jump replay finish {frame}");
125 | }
126 | }
127 | }
--------------------------------------------------------------------------------
/Scripts/Hotfix/Client/LSClientHelper.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 915aaa51beb994638bd10e0d2ed9d8a7
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Scripts/Hotfix/Client/LSClientUpdaterSystem.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.IO;
3 |
4 | namespace ET.Client
5 | {
6 | [EntitySystemOf(typeof(LSClientUpdater))]
7 | [FriendOf(typeof (LSClientUpdater))]
8 | public static partial class LSClientUpdaterSystem
9 | {
10 | [EntitySystem]
11 | private static void Awake(this LSClientUpdater self)
12 | {
13 | Room room = self.GetParent();
14 | self.MyId = room.Root().GetComponent().MyId;
15 | }
16 |
17 | [EntitySystem]
18 | private static void Update(this LSClientUpdater self)
19 | {
20 | Room room = self.GetParent();
21 | long timeNow = TimeInfo.Instance.ServerNow();
22 | Scene root = room.Root();
23 |
24 | int i = 0;
25 | while (true)
26 | {
27 | if (timeNow < room.FixedTimeCounter.FrameTime(room.PredictionFrame + 1))
28 | {
29 | return;
30 | }
31 |
32 | // 最多只预测5帧
33 | if (room.PredictionFrame - room.AuthorityFrame > 5)
34 | {
35 | return;
36 | }
37 |
38 | ++room.PredictionFrame;
39 | OneFrameInputs oneFrameInputs = self.GetOneFrameMessages(room.PredictionFrame);
40 |
41 | room.Update(oneFrameInputs);
42 | room.SendHash(room.PredictionFrame);
43 |
44 | room.SpeedMultiply = ++i;
45 |
46 | FrameMessage frameMessage = FrameMessage.Create();
47 | frameMessage.Frame = room.PredictionFrame;
48 | frameMessage.Input = self.Input;
49 | root.GetComponent().Send(frameMessage);
50 |
51 | long timeNow2 = TimeInfo.Instance.ServerNow();
52 | if (timeNow2 - timeNow > 5)
53 | {
54 | break;
55 | }
56 | }
57 | }
58 |
59 | private static OneFrameInputs GetOneFrameMessages(this LSClientUpdater self, int frame)
60 | {
61 | Room room = self.GetParent();
62 | FrameBuffer frameBuffer = room.FrameBuffer;
63 |
64 | if (frame <= room.AuthorityFrame)
65 | {
66 | return frameBuffer.FrameInputs(frame);
67 | }
68 |
69 | // predict
70 | OneFrameInputs predictionFrame = frameBuffer.FrameInputs(frame);
71 |
72 | frameBuffer.MoveForward(frame);
73 | if (frameBuffer.CheckFrame(room.AuthorityFrame))
74 | {
75 | OneFrameInputs authorityFrame = frameBuffer.FrameInputs(room.AuthorityFrame);
76 | authorityFrame.CopyTo(predictionFrame);
77 | }
78 | predictionFrame.Inputs[self.MyId] = self.Input;
79 |
80 | return predictionFrame;
81 | }
82 | }
83 | }
--------------------------------------------------------------------------------
/Scripts/Hotfix/Client/LSClientUpdaterSystem.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 46f47e16ad6bc417391e3cdee1b5a851
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Scripts/Hotfix/Client/LSReplayUpdaterSystem.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace ET.Client
4 | {
5 | [EntitySystemOf(typeof(LSReplayUpdater))]
6 | [FriendOf(typeof(LSReplayUpdater))]
7 | public static partial class LSReplayUpdaterSystem
8 | {
9 | [EntitySystem]
10 | private static void Awake(this LSReplayUpdater self)
11 | {
12 |
13 | }
14 |
15 | [EntitySystem]
16 | private static void Update(this LSReplayUpdater self)
17 | {
18 | Room room = self.GetParent();
19 | Fiber fiber = self.Fiber();
20 | long timeNow = TimeInfo.Instance.ServerNow();
21 |
22 | int i = 0;
23 | while (true)
24 | {
25 | if (room.AuthorityFrame + 1 >= room.Replay.FrameInputs.Count)
26 | {
27 | break;
28 | }
29 |
30 | if (timeNow < room.FixedTimeCounter.FrameTime(room.AuthorityFrame + 1))
31 | {
32 | break;
33 | }
34 |
35 | ++room.AuthorityFrame;
36 |
37 | OneFrameInputs oneFrameInputs = room.Replay.FrameInputs[room.AuthorityFrame];
38 |
39 | room.Update(oneFrameInputs);
40 | room.SpeedMultiply = ++i;
41 |
42 | long timeNow2 = TimeInfo.Instance.ServerNow();
43 | if (timeNow2 - timeNow > 5)
44 | {
45 | break;
46 | }
47 | }
48 | }
49 |
50 | public static void ChangeReplaySpeed(this LSReplayUpdater self)
51 | {
52 | Room room = self.Room();
53 | LSReplayUpdater lsReplayUpdater = room.GetComponent();
54 | if (lsReplayUpdater.ReplaySpeed == 8)
55 | {
56 | lsReplayUpdater.ReplaySpeed = 1;
57 | }
58 | else
59 | {
60 | lsReplayUpdater.ReplaySpeed *= 2;
61 | }
62 |
63 | int updateInterval = LSConstValue.UpdateInterval / lsReplayUpdater.ReplaySpeed;
64 | room.FixedTimeCounter.ChangeInterval(updateInterval, room.AuthorityFrame);
65 | }
66 | }
67 | }
--------------------------------------------------------------------------------
/Scripts/Hotfix/Client/LSReplayUpdaterSystem.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 1f2dc3825dd2f4641bce36a7b8b7708e
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Scripts/Hotfix/Client/LSSceneChangeHelper.cs:
--------------------------------------------------------------------------------
1 | namespace ET.Client
2 | {
3 |
4 | public static partial class LSSceneChangeHelper
5 | {
6 | // 场景切换协程
7 | public static async ETTask SceneChangeTo(Scene root, string sceneName, long sceneInstanceId)
8 | {
9 | root.RemoveComponent();
10 |
11 | Room room = root.AddComponentWithId(sceneInstanceId);
12 | room.Name = sceneName;
13 |
14 | // 等待表现层订阅的事件完成
15 | await EventSystem.Instance.PublishAsync(root, new LSSceneChangeStart() {Room = room});
16 |
17 | root.GetComponent().Send(C2Room_ChangeSceneFinish.Create());
18 |
19 | // 等待Room2C_EnterMap消息
20 | Wait_Room2C_Start waitRoom2CStart = await root.GetComponent().Wait();
21 |
22 | room.LSWorld = new LSWorld(SceneType.LockStepClient);
23 | room.Init(waitRoom2CStart.Message.UnitInfo, waitRoom2CStart.Message.StartTime);
24 |
25 | room.AddComponent();
26 |
27 | // 这个事件中可以订阅取消loading
28 | EventSystem.Instance.Publish(root, new LSSceneInitFinish());
29 | }
30 |
31 | // 场景切换协程
32 | public static async ETTask SceneChangeToReplay(Scene root, Replay replay)
33 | {
34 | root.RemoveComponent();
35 |
36 | Room room = root.AddComponent();
37 | room.Name = "Map1";
38 | room.IsReplay = true;
39 | room.Replay = replay;
40 | room.LSWorld = new LSWorld(SceneType.LockStepClient);
41 | room.Init(replay.UnitInfos, TimeInfo.Instance.ServerFrameTime());
42 |
43 | // 等待表现层订阅的事件完成
44 | await EventSystem.Instance.PublishAsync(root, new LSSceneChangeStart() {Room = room});
45 |
46 |
47 | room.AddComponent();
48 | // 这个事件中可以订阅取消loading
49 | EventSystem.Instance.Publish(root, new LSSceneInitFinish());
50 | }
51 |
52 | // 场景切换协程
53 | public static async ETTask SceneChangeToReconnect(Scene root, G2C_Reconnect message)
54 | {
55 | root.RemoveComponent();
56 |
57 | Room room = root.AddComponent();
58 | room.Name = "Map1";
59 |
60 | room.LSWorld = new LSWorld(SceneType.LockStepClient);
61 | room.Init(message.UnitInfos, message.StartTime, message.Frame);
62 |
63 | // 等待表现层订阅的事件完成
64 | await EventSystem.Instance.PublishAsync(root, new LSSceneChangeStart() {Room = room});
65 |
66 |
67 | room.AddComponent();
68 | // 这个事件中可以订阅取消loading
69 | EventSystem.Instance.Publish(root, new LSSceneInitFinish());
70 | }
71 | }
72 | }
--------------------------------------------------------------------------------
/Scripts/Hotfix/Client/LSSceneChangeHelper.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 6b38bd6590f604a9e9bc0360a81fe2b3
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Scripts/Hotfix/Client/OneFrameInputsHandler.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace ET.Client
4 | {
5 | [MessageHandler(SceneType.LockStep)]
6 | public class OneFrameInputsHandler: MessageHandler
7 | {
8 | protected override async ETTask Run(Scene root, OneFrameInputs input)
9 | {
10 | using var _ = input ; // 方法结束时回收消息
11 | Room room = root.GetComponent();
12 |
13 | Log.Debug($"OneFrameInputs: {room.AuthorityFrame + 1} {input.ToJson()}");
14 |
15 | FrameBuffer frameBuffer = room.FrameBuffer;
16 |
17 | ++room.AuthorityFrame;
18 | // 服务端返回的消息比预测的还早
19 | if (room.AuthorityFrame > room.PredictionFrame)
20 | {
21 | OneFrameInputs authorityFrame = frameBuffer.FrameInputs(room.AuthorityFrame);
22 | input.CopyTo(authorityFrame);
23 | }
24 | else
25 | {
26 | // 服务端返回来的消息,跟预测消息对比
27 | OneFrameInputs predictionInput = frameBuffer.FrameInputs(room.AuthorityFrame);
28 | // 对比失败有两种可能,
29 | // 1是别人的输入预测失败,这种很正常,
30 | // 2 自己的输入对比失败,这种情况是自己发送的消息比服务器晚到了,服务器使用了你的上一次输入
31 | // 回滚重新预测的时候,自己的输入不用变化
32 | if (input != predictionInput)
33 | {
34 | Log.Debug($"frame diff: {predictionInput} {input}");
35 | input.CopyTo(predictionInput);
36 | // 回滚到frameBuffer.AuthorityFrame
37 | Log.Debug($"roll back start {room.AuthorityFrame}");
38 | LSClientHelper.Rollback(room, room.AuthorityFrame);
39 | Log.Debug($"roll back finish {room.AuthorityFrame}");
40 | }
41 | else // 对比成功
42 | {
43 | room.Record(room.AuthorityFrame);
44 | room.SendHash(room.AuthorityFrame);
45 | }
46 | }
47 | await ETTask.CompletedTask;
48 | }
49 | }
50 | }
--------------------------------------------------------------------------------
/Scripts/Hotfix/Client/OneFrameInputsHandler.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: ce16289caea864b01988193d7ea2e08a
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Scripts/Hotfix/Client/Room2C_AdjustUpdateTimeHandler.cs:
--------------------------------------------------------------------------------
1 | namespace ET.Client
2 | {
3 | [MessageHandler(SceneType.LockStep)]
4 | public class Room2C_AdjustUpdateTimeHandler: MessageHandler
5 | {
6 | protected override async ETTask Run(Scene root, Room2C_AdjustUpdateTime message)
7 | {
8 | Room room = root.GetComponent();
9 | int newInterval = (1000 + (message.DiffTime - LSConstValue.UpdateInterval)) * LSConstValue.UpdateInterval / 1000;
10 |
11 | if (newInterval < 40)
12 | {
13 | newInterval = 40;
14 | }
15 |
16 | if (newInterval > 66)
17 | {
18 | newInterval = 66;
19 | }
20 |
21 | room.FixedTimeCounter.ChangeInterval(newInterval, room.PredictionFrame);
22 | await ETTask.CompletedTask;
23 | }
24 | }
25 | }
--------------------------------------------------------------------------------
/Scripts/Hotfix/Client/Room2C_AdjustUpdateTimeHandler.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: e4df743a2d294ae59bf4844174591716
3 | timeCreated: 1682414000
--------------------------------------------------------------------------------
/Scripts/Hotfix/Client/Room2C_CheckHashFailHandler.cs:
--------------------------------------------------------------------------------
1 | namespace ET.Client
2 | {
3 | [MessageHandler(SceneType.LockStep)]
4 | public class Room2C_CheckHashFailHandler: MessageHandler
5 | {
6 | protected override async ETTask Run(Scene root, Room2C_CheckHashFail message)
7 | {
8 | LSWorld serverWorld = MemoryPackHelper.Deserialize(typeof(LSWorld), message.LSWorldBytes, 0, message.LSWorldBytes.Length) as LSWorld;
9 | using (root.AddChild(serverWorld))
10 | {
11 | Log.Debug($"check hash fail, server: {message.Frame} {serverWorld.ToJson()}");
12 | }
13 |
14 | Room room = root.GetComponent();
15 | LSWorld clientWorld = room.GetLSWorld(SceneType.LockStepClient, message.Frame);
16 | using (root.AddChild(clientWorld))
17 | {
18 | Log.Debug($"check hash fail, client: {message.Frame} {clientWorld.ToJson()}");
19 | }
20 |
21 | await ETTask.CompletedTask;
22 | }
23 | }
24 | }
--------------------------------------------------------------------------------
/Scripts/Hotfix/Client/Room2C_CheckHashFailHandler.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: bd750474e6e5d437e8f1ac8279a7489d
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Scripts/Hotfix/Client/Room2C_EnterMapHandler.cs:
--------------------------------------------------------------------------------
1 | namespace ET.Client
2 | {
3 | [MessageHandler(SceneType.LockStep)]
4 | public class Room2C_EnterMapHandler: MessageHandler
5 | {
6 | protected override async ETTask Run(Scene root, Room2C_Start message)
7 | {
8 | root.GetComponent().Notify(new Wait_Room2C_Start() {Message = message});
9 | await ETTask.CompletedTask;
10 | }
11 | }
12 | }
--------------------------------------------------------------------------------
/Scripts/Hotfix/Client/Room2C_EnterMapHandler.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: c61c8470e59f14b9eb2ace115446c1c5
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Scripts/Hotfix/Server.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 63696968c3917844cadec42b0aed2d2a
3 | folderAsset: yes
4 | DefaultImporter:
5 | externalObjects: {}
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/Scripts/Hotfix/Server/ConfigLoaderInvoker.cs:
--------------------------------------------------------------------------------
1 | #if DOTNET
2 | using System;
3 | using System.Collections.Generic;
4 | using System.IO;
5 |
6 | namespace ET
7 | {
8 | [Invoke]
9 | public class GetAllConfigBytes: AInvokeHandler>>
10 | {
11 | public override async ETTask> Handle(ConfigLoader.GetAllConfigBytes args)
12 | {
13 | Dictionary output = new Dictionary();
14 | List startConfigs = new List()
15 | {
16 | "StartMachineConfigCategory",
17 | "StartProcessConfigCategory",
18 | "StartSceneConfigCategory",
19 | "StartZoneConfigCategory",
20 | };
21 | HashSet configTypes = CodeTypes.Instance.GetTypes(typeof (ConfigAttribute));
22 | foreach (Type configType in configTypes)
23 | {
24 | string configFilePath;
25 | if (startConfigs.Contains(configType.Name))
26 | {
27 | configFilePath = Path.Combine($"{LSConstValue.ExcelPackagePath}/Config/Bytes/s/{Options.Instance.StartConfig}/{configType.Name}.bytes");
28 | }
29 | else
30 | {
31 | configFilePath = Path.Combine($"{LSConstValue.ExcelPackagePath}/Config/Bytes/s/{configType.Name}.bytes");
32 | }
33 | output[configType] = File.ReadAllBytes(configFilePath);
34 | }
35 |
36 | await ETTask.CompletedTask;
37 | return output;
38 | }
39 | }
40 |
41 | [Invoke]
42 | public class GetOneConfigBytes: AInvokeHandler
43 | {
44 | public override byte[] Handle(ConfigLoader.GetOneConfigBytes args)
45 | {
46 | byte[] configBytes = File.ReadAllBytes($"{LSConstValue.ExcelPackagePath}/Config/Bytes/s/{args.ConfigName}.bytes");
47 | return configBytes;
48 | }
49 | }
50 | }
51 | #endif
--------------------------------------------------------------------------------
/Scripts/Hotfix/Server/ConfigLoaderInvoker.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: f6124912a617d384c85828b970ae9aaf
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Scripts/Hotfix/Server/EntryEvent2_InitServer.cs:
--------------------------------------------------------------------------------
1 | namespace ET.Server
2 | {
3 | [Event(SceneType.LockStep)]
4 | public class EntryEvent2_InitServer: AEvent
5 | {
6 | protected override async ETTask Run(Scene root, EntryEvent2 args)
7 | {
8 | if (Options.Instance.Console == 1)
9 | {
10 | root.AddComponent();
11 | }
12 |
13 | int process = root.Fiber.Process;
14 | StartProcessConfig startProcessConfig = StartProcessConfigCategory.Instance.Get(process);
15 | if (startProcessConfig.Port != 0)
16 | {
17 | await FiberManager.Instance.Create(SchedulerType.ThreadPool, SceneType.NetInner, 0, SceneType.NetInner, "NetInner");
18 | }
19 |
20 | // 根据配置创建纤程
21 | var scenes = StartSceneConfigCategory.Instance.GetByProcess(process);
22 | foreach (StartSceneConfig startConfig in scenes)
23 | {
24 | int sceneType = SceneTypeSingleton.Instance.GetSceneType(startConfig.SceneType);
25 | await FiberManager.Instance.Create(SchedulerType.ThreadPool, startConfig.Id, startConfig.Zone, sceneType, startConfig.Name);
26 | }
27 | }
28 | }
29 | }
--------------------------------------------------------------------------------
/Scripts/Hotfix/Server/EntryEvent2_InitServer.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 58957803f4fc6b944811774dfa1a21fe
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Scripts/Hotfix/Server/Gate.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: b29453dd6d8294ba982500d139b81ed5
3 | folderAsset: yes
4 | DefaultImporter:
5 | externalObjects: {}
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/Scripts/Hotfix/Server/Gate/C2G_MatchHandler.cs:
--------------------------------------------------------------------------------
1 | namespace ET.Server
2 | {
3 | [MessageSessionHandler(SceneType.Gate)]
4 | public class C2G_MatchHandler : MessageSessionHandler
5 | {
6 | protected override async ETTask Run(Session session, C2G_Match request, G2C_Match response)
7 | {
8 | Player player = session.GetComponent().Player;
9 |
10 | StartSceneConfig startSceneConfig = StartSceneConfigCategory.Instance.GetOneBySceneType(session.Zone(), SceneType.Match);
11 |
12 | G2Match_Match g2MatchMatch = G2Match_Match.Create();
13 | g2MatchMatch.Id = player.Id;
14 | await session.Root().GetComponent().Call(startSceneConfig.ActorId, g2MatchMatch);
15 | }
16 | }
17 | }
--------------------------------------------------------------------------------
/Scripts/Hotfix/Server/Gate/C2G_MatchHandler.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 04a4b6c3a76cb4d53ab4655a2cc4f7eb
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Scripts/Hotfix/Server/Gate/Match2G_NotifyMatchSuccessHandler.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 |
4 | namespace ET.Server
5 | {
6 | [MessageHandler(SceneType.Gate)]
7 | public class Match2G_NotifyMatchSuccessHandler : MessageHandler
8 | {
9 | protected override async ETTask Run(Player player, Match2G_NotifyMatchSuccess message)
10 | {
11 | player.AddComponent().RoomActorId = message.ActorId;
12 |
13 | player.GetComponent().Session.Send(message);
14 | await ETTask.CompletedTask;
15 | }
16 | }
17 | }
--------------------------------------------------------------------------------
/Scripts/Hotfix/Server/Gate/Match2G_NotifyMatchSuccessHandler.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: d2320b5939fd246359a4871b18ac94d8
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Scripts/Hotfix/Server/Gate/NetComponentOnReadInvoker_Gate.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace ET.Server
4 | {
5 | [Invoke(SceneType.Gate)]
6 | public class NetComponentOnReadInvoker_Gate: AInvokeHandler
7 | {
8 | public override void Handle(NetComponentOnRead args)
9 | {
10 | HandleAsync(args).NoContext();
11 | }
12 |
13 | private async ETTask HandleAsync(NetComponentOnRead args)
14 | {
15 | Session session = args.Session;
16 | object message = args.Message;
17 | Scene root = args.Session.Root();
18 | // 根据消息接口判断是不是Actor消息,不同的接口做不同的处理,比如需要转发给Chat Scene,可以做一个IChatMessage接口
19 | switch (message)
20 | {
21 | case ISessionMessage:
22 | {
23 | MessageSessionDispatcher.Instance.Handle(session, message);
24 | break;
25 | }
26 | case FrameMessage frameMessage:
27 | {
28 | Player player = session.GetComponent().Player;
29 | ActorId roomActorId = player.GetComponent().RoomActorId;
30 | frameMessage.PlayerId = player.Id;
31 | root.GetComponent().Send(roomActorId, frameMessage);
32 | break;
33 | }
34 | case IRoomMessage actorRoom:
35 | {
36 | Player player = session.GetComponent().Player;
37 | ActorId roomActorId = player.GetComponent().RoomActorId;
38 | actorRoom.PlayerId = player.Id;
39 | root.GetComponent().Send(roomActorId, actorRoom);
40 | break;
41 | }
42 | case ILocationMessage actorLocationMessage:
43 | {
44 | long unitId = session.GetComponent().Player.Id;
45 | root.GetComponent().Get(LocationType.Unit).Send(unitId, actorLocationMessage);
46 | break;
47 | }
48 | case ILocationRequest actorLocationRequest: // gate session收到actor rpc消息,先向actor 发送rpc请求,再将请求结果返回客户端
49 | {
50 | long unitId = session.GetComponent().Player.Id;
51 | int rpcId = actorLocationRequest.RpcId; // 这里要保存客户端的rpcId
52 | long instanceId = session.InstanceId;
53 | IResponse iResponse = await root.GetComponent().Get(LocationType.Unit).Call(unitId, actorLocationRequest);
54 | iResponse.RpcId = rpcId;
55 | // session可能已经断开了,所以这里需要判断
56 | if (session.InstanceId == instanceId)
57 | {
58 | session.Send(iResponse);
59 | }
60 | break;
61 | }
62 | case IRequest actorRequest: // 分发IActorRequest消息,目前没有用到,需要的自己添加
63 | {
64 | break;
65 | }
66 | case IMessage actorMessage: // 分发IActorMessage消息,目前没有用到,需要的自己添加
67 | {
68 | break;
69 | }
70 |
71 | default:
72 | {
73 | throw new Exception($"not found handler: {message}");
74 | }
75 | }
76 | }
77 | }
78 | }
--------------------------------------------------------------------------------
/Scripts/Hotfix/Server/Gate/NetComponentOnReadInvoker_Gate.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: aa009b6186ad6504695f689ae55d1b54
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Scripts/Hotfix/Server/Map.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: a86d2aec3f36c405fa581cf362886820
3 | folderAsset: yes
4 | DefaultImporter:
5 | externalObjects: {}
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/Scripts/Hotfix/Server/Map/C2Room_ChangeSceneFinishHandler.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using TrueSync;
3 |
4 | namespace ET.Server
5 | {
6 | [MessageHandler(SceneType.RoomRoot)]
7 | [FriendOf(typeof (RoomServerComponent))]
8 | public class C2Room_ChangeSceneFinishHandler: MessageHandler
9 | {
10 | protected override async ETTask Run(Scene root, C2Room_ChangeSceneFinish message)
11 | {
12 | Room room = root.GetComponent();
13 | RoomServerComponent roomServerComponent = room.GetComponent();
14 | RoomPlayer roomPlayer = room.GetComponent().GetChild(message.PlayerId);
15 | roomPlayer.Progress = 100;
16 |
17 | if (!roomServerComponent.IsAllPlayerProgress100())
18 | {
19 | return;
20 | }
21 |
22 | await room.Fiber.Root.GetComponent().WaitAsync(1000);
23 |
24 | Room2C_Start room2CStart = Room2C_Start.Create();
25 | room2CStart.StartTime = TimeInfo.Instance.ServerFrameTime();
26 | foreach (RoomPlayer rp in roomServerComponent.Children.Values)
27 | {
28 | LockStepUnitInfo lockStepUnitInfo = LockStepUnitInfo.Create();
29 | lockStepUnitInfo.PlayerId = rp.Id;
30 | lockStepUnitInfo.Position = new TSVector(20, 0, -10);
31 | lockStepUnitInfo.Rotation = TSQuaternion.identity;
32 | room2CStart.UnitInfo.Add(lockStepUnitInfo);
33 | }
34 |
35 | room.Init(room2CStart.UnitInfo, room2CStart.StartTime);
36 |
37 | room.AddComponent();
38 |
39 | RoomMessageHelper.BroadCast(room, room2CStart);
40 | }
41 | }
42 | }
--------------------------------------------------------------------------------
/Scripts/Hotfix/Server/Map/C2Room_ChangeSceneFinishHandler.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 228e4d43b85774ae08bf5da1f3425627
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Scripts/Hotfix/Server/Map/FiberInit_Map.cs:
--------------------------------------------------------------------------------
1 | using System.Net;
2 |
3 | namespace ET.Server
4 | {
5 | [Invoke(SceneType.Map)]
6 | public class FiberInit_Map: AInvokeHandler
7 | {
8 | public override async ETTask Handle(FiberInit fiberInit)
9 | {
10 | Scene root = fiberInit.Fiber.Root;
11 | root.AddComponent(MailBoxType.UnOrderedMessage);
12 | root.AddComponent();
13 | root.AddComponent();
14 | root.AddComponent();
15 | root.AddComponent();
16 | root.AddComponent();
17 | root.AddComponent();
18 | root.AddComponent();
19 |
20 | await ETTask.CompletedTask;
21 | }
22 | }
23 | }
--------------------------------------------------------------------------------
/Scripts/Hotfix/Server/Map/FiberInit_Map.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 5d37c22fa00c59f48a444cc04a1621e4
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Scripts/Hotfix/Server/Map/FrameMessageHandler.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 |
4 | namespace ET.Server
5 | {
6 | [MessageHandler(SceneType.RoomRoot)]
7 | public class FrameMessageHandler: MessageHandler
8 | {
9 | protected override async ETTask Run(Scene root, FrameMessage message)
10 | {
11 | using FrameMessage _ = message; // 让消息回到池中
12 |
13 | Room room = root.GetComponent();
14 | FrameBuffer frameBuffer = room.FrameBuffer;
15 | if (message.Frame % (1000 / LSConstValue.UpdateInterval) == 0)
16 | {
17 | long nowFrameTime = room.FixedTimeCounter.FrameTime(message.Frame);
18 | int diffTime = (int)(nowFrameTime - TimeInfo.Instance.ServerFrameTime());
19 |
20 | Room2C_AdjustUpdateTime room2CAdjustUpdateTime = Room2C_AdjustUpdateTime.Create();
21 | room2CAdjustUpdateTime.DiffTime = diffTime;
22 | room.Root().GetComponent().Get(LocationType.GateSession).Send(message.PlayerId, room2CAdjustUpdateTime);
23 | }
24 |
25 | if (message.Frame < room.AuthorityFrame) // 小于AuthorityFrame,丢弃
26 | {
27 | Log.Warning($"FrameMessage < AuthorityFrame discard: {message}");
28 | return;
29 | }
30 |
31 | if (message.Frame > room.AuthorityFrame + 10) // 大于AuthorityFrame + 10,丢弃
32 | {
33 | Log.Warning($"FrameMessage > AuthorityFrame + 10 discard: {message}");
34 | return;
35 | }
36 |
37 | OneFrameInputs oneFrameInputs = frameBuffer.FrameInputs(message.Frame);
38 | if (oneFrameInputs == null)
39 | {
40 | Log.Error($"FrameMessageHandler get frame is null: {message.Frame}, max frame: {frameBuffer.MaxFrame}");
41 | return;
42 | }
43 | oneFrameInputs.Inputs[message.PlayerId] = message.Input;
44 |
45 | await ETTask.CompletedTask;
46 | }
47 | }
48 | }
--------------------------------------------------------------------------------
/Scripts/Hotfix/Server/Map/FrameMessageHandler.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 40bebd1c111464ddb96d36e4d0966070
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Scripts/Hotfix/Server/Map/Match2Map_GetRoomHandler.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 |
4 | namespace ET.Server
5 | {
6 | [MessageHandler(SceneType.Map)]
7 | public class Match2Map_GetRoomHandler : MessageHandler
8 | {
9 | protected override async ETTask Run(Scene root, Match2Map_GetRoom request, Map2Match_GetRoom response)
10 | {
11 | //RoomManagerComponent roomManagerComponent = root.GetComponent();
12 |
13 | Fiber fiber = root.Fiber();
14 | int fiberId = await FiberManager.Instance.Create(SchedulerType.ThreadPool, fiber.Zone, SceneType.RoomRoot, "RoomRoot");
15 | ActorId roomRootActorId = new(fiber.Process, fiberId);
16 |
17 | // 发送消息给房间纤程,初始化
18 | RoomManager2Room_Init roomManager2RoomInit = RoomManager2Room_Init.Create();
19 | roomManager2RoomInit.PlayerIds.AddRange(request.PlayerIds);
20 | await root.GetComponent().Call(roomRootActorId, roomManager2RoomInit);
21 |
22 | response.ActorId = roomRootActorId;
23 | await ETTask.CompletedTask;
24 | }
25 | }
26 | }
--------------------------------------------------------------------------------
/Scripts/Hotfix/Server/Map/Match2Map_GetRoomHandler.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 7f404c61e317c4fc0ad28508eea3f5f2
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Scripts/Hotfix/Server/Map/RoomMessageHelper.cs:
--------------------------------------------------------------------------------
1 | namespace ET.Server
2 | {
3 |
4 | public static partial class RoomMessageHelper
5 | {
6 | public static void BroadCast(Room room, IMessage message)
7 | {
8 | // 广播的消息不能被池回收
9 | (message as MessageObject).IsFromPool = false;
10 |
11 | RoomServerComponent roomServerComponent = room.GetComponent();
12 |
13 | MessageLocationSenderComponent messageLocationSenderComponent = room.Root().GetComponent();
14 | foreach (var kv in roomServerComponent.Children)
15 | {
16 | RoomPlayer roomPlayer = kv.Value as RoomPlayer;
17 |
18 | if (!roomPlayer.IsOnline)
19 | {
20 | continue;
21 | }
22 |
23 | messageLocationSenderComponent.Get(LocationType.GateSession).Send(roomPlayer.Id, message);
24 | }
25 | }
26 | }
27 | }
--------------------------------------------------------------------------------
/Scripts/Hotfix/Server/Map/RoomMessageHelper.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 015483a7767f844349026490961481a1
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Scripts/Hotfix/Server/Map/RoomServerComponentSystem.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 |
4 | namespace ET.Server
5 | {
6 | [EntitySystemOf(typeof(RoomServerComponent))]
7 | [FriendOf(typeof(RoomServerComponent))]
8 | public static partial class RoomServerComponentSystem
9 | {
10 | [EntitySystem]
11 | private static void Awake(this RoomServerComponent self, List playerIds)
12 | {
13 | foreach (long id in playerIds)
14 | {
15 | RoomPlayer roomPlayer = self.AddChildWithId(id);
16 | }
17 | }
18 |
19 | public static bool IsAllPlayerProgress100(this RoomServerComponent self)
20 | {
21 | foreach (RoomPlayer roomPlayer in self.Children.Values)
22 | {
23 | if (roomPlayer.Progress != 100)
24 | {
25 | return false;
26 | }
27 | }
28 | return true;
29 | }
30 | }
31 | }
--------------------------------------------------------------------------------
/Scripts/Hotfix/Server/Map/RoomServerComponentSystem.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 6d671f754d680422caba612a77dfdb63
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Scripts/Hotfix/Server/Match.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 397b1655e0ba94b23abb42a1a3c6cca8
3 | folderAsset: yes
4 | DefaultImporter:
5 | externalObjects: {}
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/Scripts/Hotfix/Server/Match/FiberInit_Match.cs:
--------------------------------------------------------------------------------
1 | using System.Net;
2 |
3 | namespace ET.Server
4 | {
5 | [Invoke(SceneType.Match)]
6 | public class FiberInit_Match: AInvokeHandler
7 | {
8 | public override async ETTask Handle(FiberInit fiberInit)
9 | {
10 | Scene root = fiberInit.Fiber.Root;
11 | root.AddComponent(MailBoxType.UnOrderedMessage);
12 | root.AddComponent();
13 | root.AddComponent();
14 | root.AddComponent();
15 | root.AddComponent();
16 | root.AddComponent();
17 | root.AddComponent();
18 | root.AddComponent();
19 |
20 | await ETTask.CompletedTask;
21 | }
22 | }
23 | }
--------------------------------------------------------------------------------
/Scripts/Hotfix/Server/Match/FiberInit_Match.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: a6a6101f02189c643accabb36f52c150
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Scripts/Hotfix/Server/Match/G2Match_MatchHandler.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 |
4 | namespace ET.Server
5 | {
6 | [MessageHandler(SceneType.Match)]
7 | public class G2Match_MatchHandler : MessageHandler
8 | {
9 | protected override async ETTask Run(Scene scene, G2Match_Match request, Match2G_Match response)
10 | {
11 | MatchComponent matchComponent = scene.GetComponent();
12 | matchComponent.Match(request.Id).NoContext();
13 | await ETTask.CompletedTask;
14 | }
15 | }
16 | }
--------------------------------------------------------------------------------
/Scripts/Hotfix/Server/Match/G2Match_MatchHandler.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 643a9fc2cab3148718708aba9c790f7d
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Scripts/Hotfix/Server/Match/MatchComponentSystem.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 |
4 | namespace ET.Server
5 | {
6 |
7 | [FriendOf(typeof(MatchComponent))]
8 | public static partial class MatchComponentSystem
9 | {
10 | public static async ETTask Match(this MatchComponent self, long playerId)
11 | {
12 | if (self.waitMatchPlayers.Contains(playerId))
13 | {
14 | return;
15 | }
16 |
17 | self.waitMatchPlayers.Add(playerId);
18 |
19 | if (self.waitMatchPlayers.Count < LSConstValue.MatchCount)
20 | {
21 | return;
22 | }
23 |
24 | // 申请一个房间
25 | List maps = StartSceneConfigCategory.Instance.GetBySceneType(self.Zone(), SceneType.Map);
26 | StartSceneConfig startSceneConfig = RandomGenerator.RandomArray(maps);
27 | Match2Map_GetRoom match2MapGetRoom = Match2Map_GetRoom.Create();
28 | foreach (long id in self.waitMatchPlayers)
29 | {
30 | match2MapGetRoom.PlayerIds.Add(id);
31 | }
32 |
33 | self.waitMatchPlayers.Clear();
34 |
35 | Scene root = self.Root();
36 | Map2Match_GetRoom map2MatchGetRoom = await root.GetComponent().Call(
37 | startSceneConfig.ActorId, match2MapGetRoom) as Map2Match_GetRoom;
38 |
39 | Match2G_NotifyMatchSuccess match2GNotifyMatchSuccess = Match2G_NotifyMatchSuccess.Create();
40 | match2GNotifyMatchSuccess.ActorId = map2MatchGetRoom.ActorId;
41 | MessageLocationSenderComponent messageLocationSenderComponent = root.GetComponent();
42 |
43 | foreach (long id in match2MapGetRoom.PlayerIds) // 这里发送消息线程不会修改PlayerInfo,所以可以直接使用
44 | {
45 | messageLocationSenderComponent.Get(LocationType.Player).Send(id, match2GNotifyMatchSuccess);
46 | // 等待进入房间的确认消息,如果超时要通知所有玩家退出房间,重新匹配
47 | }
48 | }
49 | }
50 |
51 | }
--------------------------------------------------------------------------------
/Scripts/Hotfix/Server/Match/MatchComponentSystem.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: fd80372aeb5d74a3ba66f43bae5613df
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Scripts/Hotfix/Server/Room.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 8795299b519a48719a23f048377da2a9
3 | timeCreated: 1681817967
--------------------------------------------------------------------------------
/Scripts/Hotfix/Server/Room/C2Room_CheckHashHandler.cs:
--------------------------------------------------------------------------------
1 | namespace ET.Server
2 | {
3 | [MessageHandler(SceneType.RoomRoot)]
4 | public class C2Room_CheckHashHandler: MessageHandler
5 | {
6 | protected override async ETTask Run(Scene root, C2Room_CheckHash message)
7 | {
8 | Room room = root.GetComponent();
9 | long hash = room.FrameBuffer.GetHash(message.Frame);
10 | if (message.Hash != hash)
11 | {
12 | byte[] bytes = room.FrameBuffer.Snapshot(message.Frame).ToArray();
13 | Room2C_CheckHashFail room2CCheckHashFail = Room2C_CheckHashFail.Create();
14 | room2CCheckHashFail.Frame = message.Frame;
15 | room2CCheckHashFail.LSWorldBytes = bytes;
16 | room.Root().GetComponent().Get(LocationType.GateSession).Send(message.PlayerId, room2CCheckHashFail);
17 | }
18 | await ETTask.CompletedTask;
19 | }
20 | }
21 | }
--------------------------------------------------------------------------------
/Scripts/Hotfix/Server/Room/C2Room_CheckHashHandler.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 8f87c1aa12fde40b5afda6ea778cfdf4
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Scripts/Hotfix/Server/Room/FiberInit_RoomRoot.cs:
--------------------------------------------------------------------------------
1 | using System.Net;
2 |
3 | namespace ET.Server
4 | {
5 | [Invoke((long)SceneType.RoomRoot)]
6 | public class FiberInit_RoomRoot: AInvokeHandler
7 | {
8 | public override async ETTask Handle(FiberInit fiberInit)
9 | {
10 | Scene root = fiberInit.Fiber.Root;
11 | root.AddComponent(MailBoxType.UnOrderedMessage);
12 | root.AddComponent();
13 | root.AddComponent();
14 | root.AddComponent();
15 | root.AddComponent();
16 | root.AddComponent();
17 | root.AddComponent();
18 |
19 | await ETTask.CompletedTask;
20 | }
21 | }
22 | }
--------------------------------------------------------------------------------
/Scripts/Hotfix/Server/Room/FiberInit_RoomRoot.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 6975fc1c87e4bcf46bdd02dc8bb89bc4
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Scripts/Hotfix/Server/Room/G2Room_ReconnectHandler.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 |
3 | namespace ET.Server
4 | {
5 | [MessageHandler(SceneType.RoomRoot)]
6 | public class G2Room_ReconnectHandler: MessageHandler
7 | {
8 | protected override async ETTask Run(Scene root, G2Room_Reconnect request, Room2G_Reconnect response)
9 | {
10 | Room room = root.GetComponent();
11 | response.StartTime = room.StartTime;
12 | LSUnitComponent lsUnitComponent = room.LSWorld.GetComponent();
13 | foreach (long playerId in room.PlayerIds)
14 | {
15 | LSUnit lsUnit = lsUnitComponent.GetChild(playerId);
16 | LockStepUnitInfo lockStepUnitInfo = LockStepUnitInfo.Create();
17 | lockStepUnitInfo.PlayerId = playerId;
18 | lockStepUnitInfo.Position = lsUnit.Position;
19 | lockStepUnitInfo.Rotation = lsUnit.Rotation;
20 | response.UnitInfos.Add(lockStepUnitInfo);
21 | }
22 |
23 | response.Frame = room.AuthorityFrame;
24 | await ETTask.CompletedTask;
25 | }
26 | }
27 | }
--------------------------------------------------------------------------------
/Scripts/Hotfix/Server/Room/G2Room_ReconnectHandler.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: f78aa3bd3f95d5d4a9b4178c61599dab
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Scripts/Hotfix/Server/Room/LSServerUpdaterSystem.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 |
4 | namespace ET.Server
5 | {
6 | [EntitySystemOf(typeof(LSServerUpdater))]
7 | [FriendOf(typeof(LSServerUpdater))]
8 | public static partial class LSServerUpdaterSystem
9 | {
10 | [EntitySystem]
11 | private static void Awake(this LSServerUpdater self)
12 | {
13 |
14 | }
15 |
16 | [EntitySystem]
17 | private static void Update(this LSServerUpdater self)
18 | {
19 | Room room = self.GetParent();
20 | long timeNow = TimeInfo.Instance.ServerFrameTime();
21 |
22 |
23 | int frame = room.AuthorityFrame + 1;
24 | if (timeNow < room.FixedTimeCounter.FrameTime(frame))
25 | {
26 | return;
27 | }
28 |
29 | OneFrameInputs oneFrameInputs = self.GetOneFrameMessage(frame);
30 | ++room.AuthorityFrame;
31 |
32 | OneFrameInputs sendInput = OneFrameInputs.Create();
33 | oneFrameInputs.CopyTo(sendInput);
34 |
35 | RoomMessageHelper.BroadCast(room, sendInput);
36 |
37 | room.Update(oneFrameInputs);
38 | }
39 |
40 | private static OneFrameInputs GetOneFrameMessage(this LSServerUpdater self, int frame)
41 | {
42 | Room room = self.GetParent();
43 | FrameBuffer frameBuffer = room.FrameBuffer;
44 | OneFrameInputs oneFrameInputs = frameBuffer.FrameInputs(frame);
45 | frameBuffer.MoveForward(frame);
46 |
47 | if (oneFrameInputs.Inputs.Count == LSConstValue.MatchCount)
48 | {
49 | return oneFrameInputs;
50 | }
51 |
52 | OneFrameInputs preFrameInputs = null;
53 | if (frameBuffer.CheckFrame(frame - 1))
54 | {
55 | preFrameInputs = frameBuffer.FrameInputs(frame - 1);
56 | }
57 |
58 | // 有人输入的消息没过来,给他使用上一帧的操作
59 | foreach (long playerId in room.PlayerIds)
60 | {
61 | if (oneFrameInputs.Inputs.ContainsKey(playerId))
62 | {
63 | continue;
64 | }
65 |
66 | if (preFrameInputs != null && preFrameInputs.Inputs.TryGetValue(playerId, out LSInput input))
67 | {
68 | // 使用上一帧的输入
69 | oneFrameInputs.Inputs[playerId] = input;
70 | }
71 | else
72 | {
73 | oneFrameInputs.Inputs[playerId] = new LSInput();
74 | }
75 | }
76 |
77 | return oneFrameInputs;
78 | }
79 | }
80 | }
--------------------------------------------------------------------------------
/Scripts/Hotfix/Server/Room/LSServerUpdaterSystem.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 524fc1d8fab854147a900bad52d3b28f
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Scripts/Hotfix/Server/Room/RoomManager2Room_InitHandler.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 |
3 | namespace ET.Server
4 | {
5 | [MessageHandler(SceneType.RoomRoot)]
6 | public class RoomManager2Room_InitHandler: MessageHandler
7 | {
8 | protected override async ETTask Run(Scene root, RoomManager2Room_Init request, Room2RoomManager_Init response)
9 | {
10 | Room room = root.AddComponent();
11 | room.Name = "Server";
12 | room.AddComponent>(request.PlayerIds);
13 |
14 | room.LSWorld = new LSWorld(SceneType.LockStepServer);
15 | await ETTask.CompletedTask;
16 | }
17 | }
18 | }
--------------------------------------------------------------------------------
/Scripts/Hotfix/Server/Room/RoomManager2Room_InitHandler.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 8cd5223c61a80bb4e8470bed8c0f2304
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Scripts/Hotfix/Share.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: fad091870fce23d4eb30e90e3df49843
3 | folderAsset: yes
4 | DefaultImporter:
5 | externalObjects: {}
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/Scripts/Hotfix/Share/EntryEvent1_InitShare.cs:
--------------------------------------------------------------------------------
1 | namespace ET
2 | {
3 | [Event(SceneType.LockStep)]
4 | public class EntryEvent1_InitShare: AEvent
5 | {
6 | protected override async ETTask Run(Scene root, EntryEvent1 args)
7 | {
8 | root.AddComponent();
9 | root.AddComponent();
10 | root.AddComponent();
11 | root.AddComponent(MailBoxType.UnOrderedMessage);
12 | root.AddComponent();
13 |
14 | await ETTask.CompletedTask;
15 | }
16 | }
17 | }
--------------------------------------------------------------------------------
/Scripts/Hotfix/Share/EntryEvent1_InitShare.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 72f2c2e03d6346a2bdc11c94ddc58629
3 | timeCreated: 1718295591
--------------------------------------------------------------------------------
/Scripts/Hotfix/Share/LSInputComponentSystem.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using TrueSync;
3 |
4 | namespace ET
5 | {
6 | [EntitySystemOf(typeof(LSInputComponent))]
7 | [LSEntitySystemOf(typeof(LSInputComponent))]
8 | public static partial class LSInputComponentSystem
9 | {
10 | [EntitySystem]
11 | private static void Awake(this LSInputComponent self)
12 | {
13 |
14 | }
15 |
16 | [LSEntitySystem]
17 | private static void LSUpdate(this LSInputComponent self)
18 | {
19 | LSUnit unit = self.GetParent();
20 |
21 | TSVector2 v2 = self.LSInput.V * 6 * 50 / 1000;
22 | if (v2.LengthSquared() < 0.0001f)
23 | {
24 | return;
25 | }
26 | TSVector oldPos = unit.Position;
27 | unit.Position += new TSVector(v2.x, 0, v2.y);
28 | unit.Forward = unit.Position - oldPos;
29 | }
30 | }
31 | }
--------------------------------------------------------------------------------
/Scripts/Hotfix/Share/LSInputComponentSystem.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 4fa48744575ea4fd2a4f6e111ce26f11
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Scripts/Hotfix/Share/LSUnitFactory.cs:
--------------------------------------------------------------------------------
1 | namespace ET
2 | {
3 | public static partial class LSUnitFactory
4 | {
5 | public static LSUnit Init(LSWorld lsWorld, LockStepUnitInfo unitInfo)
6 | {
7 | LSUnitComponent lsUnitComponent = lsWorld.GetComponent();
8 | LSUnit lsUnit = lsUnitComponent.AddChildWithId(unitInfo.PlayerId);
9 |
10 | lsUnit.Position = unitInfo.Position;
11 | lsUnit.Rotation = unitInfo.Rotation;
12 |
13 | lsUnit.AddComponent();
14 | return lsUnit;
15 | }
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/Scripts/Hotfix/Share/LSUnitFactory.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 1a93a389ec0e241f099646159dae6dcd
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Scripts/Hotfix/Share/RoomSystem.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.IO;
4 |
5 | namespace ET
6 | {
7 | [FriendOf(typeof(Room))]
8 | public static partial class RoomSystem
9 | {
10 | public static Room Room(this Entity entity)
11 | {
12 | return entity.IScene as Room;
13 | }
14 |
15 | public static void Init(this Room self, List unitInfos, long startTime, int frame = -1)
16 | {
17 | self.StartTime = startTime;
18 | self.AuthorityFrame = frame;
19 | self.PredictionFrame = frame;
20 | self.Replay.UnitInfos = unitInfos;
21 | self.FrameBuffer = new FrameBuffer(frame);
22 | self.FixedTimeCounter = new FixedTimeCounter(self.StartTime, 0, LSConstValue.UpdateInterval);
23 | LSWorld lsWorld = self.LSWorld;
24 | lsWorld.Frame = frame + 1;
25 | lsWorld.AddComponent();
26 | for (int i = 0; i < unitInfos.Count; ++i)
27 | {
28 | LockStepUnitInfo unitInfo = unitInfos[i];
29 | LSUnitFactory.Init(lsWorld, unitInfo);
30 | self.PlayerIds.Add(unitInfo.PlayerId);
31 | }
32 | }
33 |
34 | public static void Update(this Room self, OneFrameInputs oneFrameInputs)
35 | {
36 | LSWorld lsWorld = self.LSWorld;
37 | // 设置输入到每个LSUnit身上
38 | LSUnitComponent unitComponent = lsWorld.GetComponent();
39 | foreach (var kv in oneFrameInputs.Inputs)
40 | {
41 | LSUnit lsUnit = unitComponent.GetChild(kv.Key);
42 | LSInputComponent lsInputComponent = lsUnit.GetComponent();
43 | lsInputComponent.LSInput = kv.Value;
44 | }
45 |
46 | if (!self.IsReplay)
47 | {
48 | // 保存当前帧场景数据
49 | self.SaveLSWorld();
50 | self.Record(self.LSWorld.Frame);
51 | }
52 |
53 | lsWorld.Update();
54 | }
55 |
56 | public static LSWorld GetLSWorld(this Room self, int sceneType, int frame)
57 | {
58 | MemoryBuffer memoryBuffer = self.FrameBuffer.Snapshot(frame);
59 | memoryBuffer.Seek(0, SeekOrigin.Begin);
60 | LSWorld lsWorld = MemoryPackHelper.Deserialize(typeof (LSWorld), memoryBuffer) as LSWorld;
61 | lsWorld.SceneType = sceneType;
62 | memoryBuffer.Seek(0, SeekOrigin.Begin);
63 | return lsWorld;
64 | }
65 |
66 | private static void SaveLSWorld(this Room self)
67 | {
68 | int frame = self.LSWorld.Frame;
69 | MemoryBuffer memoryBuffer = self.FrameBuffer.Snapshot(frame);
70 | memoryBuffer.Seek(0, SeekOrigin.Begin);
71 | memoryBuffer.SetLength(0);
72 |
73 | MemoryPackHelper.Serialize(self.LSWorld, memoryBuffer);
74 | memoryBuffer.Seek(0, SeekOrigin.Begin);
75 |
76 | long hash = memoryBuffer.GetBuffer().Hash(0, (int) memoryBuffer.Length);
77 |
78 | self.FrameBuffer.SetHash(frame, hash);
79 | }
80 |
81 | // 记录需要存档的数据
82 | public static void Record(this Room self, int frame)
83 | {
84 | if (frame > self.AuthorityFrame)
85 | {
86 | return;
87 | }
88 | OneFrameInputs oneFrameInputs = self.FrameBuffer.FrameInputs(frame);
89 | OneFrameInputs saveInput = OneFrameInputs.Create();
90 | oneFrameInputs.CopyTo(saveInput);
91 | self.Replay.FrameInputs.Add(saveInput);
92 | if (frame % LSConstValue.SaveLSWorldFrameCount == 0)
93 | {
94 | MemoryBuffer memoryBuffer = self.FrameBuffer.Snapshot(frame);
95 | byte[] bytes = memoryBuffer.ToArray();
96 | self.Replay.Snapshots.Add(bytes);
97 | }
98 | }
99 | }
100 | }
--------------------------------------------------------------------------------
/Scripts/Hotfix/Share/RoomSystem.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 4a0ef11394d28492caa3959412027a17
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Scripts/HotfixView.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: dec2ccfbb9fce204089eb352e6421c64
3 | folderAsset: yes
4 | DefaultImporter:
5 | externalObjects: {}
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/Scripts/HotfixView/Client.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 8439afd1cddbc7342bf5147b794a9b99
3 | folderAsset: yes
4 | DefaultImporter:
5 | externalObjects: {}
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/Scripts/HotfixView/Client/Camera.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 5d6a8394e7b3248f08588960a9dab4d0
3 | folderAsset: yes
4 | DefaultImporter:
5 | externalObjects: {}
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/Scripts/HotfixView/Client/Camera/LSCameraComponentSystem.cs:
--------------------------------------------------------------------------------
1 | using UnityEngine;
2 |
3 | namespace ET.Client
4 | {
5 | [EntitySystemOf(typeof(LSCameraComponent))]
6 | [FriendOf(typeof(LSCameraComponent))]
7 | public static partial class LSCameraComponentSystem
8 | {
9 | [EntitySystem]
10 | private static void Awake(this LSCameraComponent self)
11 | {
12 | self.Camera = Camera.main;
13 | self.Camera.transform.rotation = Quaternion.Euler(new Vector3(20, 0, 0));
14 | }
15 |
16 | [EntitySystem]
17 | private static void LateUpdate(this LSCameraComponent self)
18 | {
19 | // 摄像机每帧更新位置
20 | Room room = self.GetParent();
21 | if (room.IsReplay)
22 | {
23 | if (Input.GetKeyDown(KeyCode.Tab))
24 | {
25 | ++self.index;
26 | self.MyUnitView = new LSUnitView();
27 | }
28 | }
29 |
30 | LSUnitView lsUnit = self.MyUnitView;
31 | if (lsUnit == null)
32 | {
33 | long id = room.IsReplay? room.PlayerIds[self.index % room.PlayerIds.Count] : room.GetParent().GetComponent().MyId;
34 | self.MyUnitView = room.GetComponent().GetChild(id);
35 | }
36 |
37 | if (lsUnit == null)
38 | {
39 | return;
40 | }
41 |
42 | Vector3 pos = lsUnit.Transform.position;
43 | self.Transform.position = new Vector3(pos.x, pos.y + 3, pos.z - 5);
44 | }
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/Scripts/HotfixView/Client/Camera/LSCameraComponentSystem.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 1484c3702f5a74740939fba06e41c132
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Scripts/HotfixView/Client/ConfigLoaderInvoker.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.IO;
4 | using UnityEngine;
5 |
6 | namespace ET
7 | {
8 | [Invoke]
9 | public class GetAllConfigBytes: AInvokeHandler>>
10 | {
11 | public override async ETTask> Handle(ConfigLoader.GetAllConfigBytes args)
12 | {
13 | Dictionary output = new Dictionary();
14 | HashSet configTypes = CodeTypes.Instance.GetTypes(typeof (ConfigAttribute));
15 |
16 | if (Define.IsEditor)
17 | {
18 | string ct = "cs";
19 | GlobalConfig globalConfig = Resources.Load("GlobalConfig");
20 | CodeMode codeMode = globalConfig.CodeMode;
21 | switch (codeMode)
22 | {
23 | case CodeMode.Client:
24 | ct = "c";
25 | break;
26 | case CodeMode.Server:
27 | ct = "s";
28 | break;
29 | case CodeMode.ClientServer:
30 | ct = "cs";
31 | break;
32 | default:
33 | throw new ArgumentOutOfRangeException();
34 | }
35 | List startConfigs = new List()
36 | {
37 | "StartMachineConfigCategory",
38 | "StartProcessConfigCategory",
39 | "StartSceneConfigCategory",
40 | "StartZoneConfigCategory",
41 | };
42 | foreach (Type configType in configTypes)
43 | {
44 | string configFilePath;
45 | if (startConfigs.Contains(configType.Name))
46 | {
47 | configFilePath = $"{LSConstValue.ExcelPackagePath}/Config/Bytes/{ct}/{Options.Instance.StartConfig}/{configType.Name}.bytes";
48 | }
49 | else
50 | {
51 | configFilePath = $"{LSConstValue.ExcelPackagePath}/Config/Bytes/{ct}/{configType.Name}.bytes";
52 | }
53 | output[configType] = File.ReadAllBytes(configFilePath);
54 | }
55 | }
56 | else
57 | {
58 | foreach (Type type in configTypes)
59 | {
60 | TextAsset v = await ResourcesComponent.Instance.LoadAssetAsync($"{LSConstValue.ExcelPackagePath}/Config/Bytes/c/{type.Name}.bytes");
61 | output[type] = v.bytes;
62 | }
63 | }
64 |
65 | return output;
66 | }
67 | }
68 |
69 | [Invoke]
70 | public class GetOneConfigBytes: AInvokeHandler>
71 | {
72 | public override async ETTask Handle(ConfigLoader.GetOneConfigBytes args)
73 | {
74 | string ct = "cs";
75 | GlobalConfig globalConfig = Resources.Load("GlobalConfig");
76 | CodeMode codeMode = globalConfig.CodeMode;
77 | switch (codeMode)
78 | {
79 | case CodeMode.Client:
80 | ct = "c";
81 | break;
82 | case CodeMode.Server:
83 | ct = "s";
84 | break;
85 | case CodeMode.ClientServer:
86 | ct = "cs";
87 | break;
88 | default:
89 | throw new ArgumentOutOfRangeException();
90 | }
91 | List startConfigs = new List()
92 | {
93 | "StartMachineConfigCategory",
94 | "StartProcessConfigCategory",
95 | "StartSceneConfigCategory",
96 | "StartZoneConfigCategory",
97 | };
98 |
99 | string configName = args.ConfigName;
100 |
101 | string configFilePath;
102 | if (startConfigs.Contains(configName))
103 | {
104 | configFilePath = $"{LSConstValue.ExcelPackagePath}/Config/Bytes/{ct}/{Options.Instance.StartConfig}/{configName}.bytes";
105 | }
106 | else
107 | {
108 | configFilePath = $"{LSConstValue.ExcelPackagePath}/Config/Bytes/{ct}/{configName}.bytes";
109 | }
110 |
111 | await ETTask.CompletedTask;
112 | return File.ReadAllBytes(configFilePath);
113 | }
114 | }
115 | }
--------------------------------------------------------------------------------
/Scripts/HotfixView/Client/ConfigLoaderInvoker.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: ed4987bdd5842724ba8c3064d91af8cc
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Scripts/HotfixView/Client/EntryEvent3_InitClient.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.IO;
4 |
5 | namespace ET.Client
6 | {
7 | [Event(SceneType.LockStep)]
8 | public class EntryEvent3_InitClient: AEvent
9 | {
10 | protected override async ETTask Run(Scene root, EntryEvent3 args)
11 | {
12 | World.Instance.AddSingleton();
13 |
14 | root.AddComponent();
15 | root.AddComponent();
16 | root.AddComponent();
17 | root.AddComponent();
18 | root.AddComponent();
19 | root.AddComponent();
20 |
21 | await EventSystem.Instance.PublishAsync(root, new AppStartInitFinish());
22 | }
23 | }
24 | }
--------------------------------------------------------------------------------
/Scripts/HotfixView/Client/EntryEvent3_InitClient.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 296e45bd0b73bfa408c1717bbfcd21d8
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Scripts/HotfixView/Client/LSAnimatorComponentSystem.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using UnityEngine;
3 |
4 | namespace ET.Client
5 | {
6 | [EntitySystemOf(typeof(LSAnimatorComponent))]
7 | [FriendOf(typeof(LSAnimatorComponent))]
8 | public static partial class LSAnimatorComponentSystem
9 | {
10 | [EntitySystem]
11 | private static void Destroy(this LSAnimatorComponent self)
12 | {
13 | self.animationClips = null;
14 | self.Parameter = null;
15 | self.Animator = null;
16 | }
17 |
18 | [EntitySystem]
19 | private static void Awake(this LSAnimatorComponent self)
20 | {
21 | Animator animator = self.GetParent().GameObject.GetComponent();
22 |
23 | if (animator == null)
24 | {
25 | return;
26 | }
27 |
28 | if (animator.runtimeAnimatorController == null)
29 | {
30 | return;
31 | }
32 |
33 | if (animator.runtimeAnimatorController.animationClips == null)
34 | {
35 | return;
36 | }
37 | self.Animator = animator;
38 | foreach (AnimationClip animationClip in animator.runtimeAnimatorController.animationClips)
39 | {
40 | self.animationClips[animationClip.name] = animationClip;
41 | }
42 | foreach (AnimatorControllerParameter animatorControllerParameter in animator.parameters)
43 | {
44 | self.Parameter.Add(animatorControllerParameter.name);
45 | }
46 | }
47 |
48 | [EntitySystem]
49 | private static void Update(this LSAnimatorComponent self)
50 | {
51 | if (self.isStop)
52 | {
53 | return;
54 | }
55 |
56 | if (self.MotionType == MotionType.None)
57 | {
58 | return;
59 | }
60 |
61 | try
62 | {
63 | self.Animator.SetFloat("MotionSpeed", self.MontionSpeed);
64 |
65 | self.Animator.SetTrigger(self.MotionType.ToString());
66 |
67 | self.MontionSpeed = 1;
68 | self.MotionType = MotionType.None;
69 | }
70 | catch (Exception ex)
71 | {
72 | throw new Exception($"动作播放失败: {self.MotionType}", ex);
73 | }
74 | }
75 |
76 | public static bool HasParameter(this LSAnimatorComponent self, string parameter)
77 | {
78 | return self.Parameter.Contains(parameter);
79 | }
80 |
81 | public static void PlayInTime(this LSAnimatorComponent self, MotionType motionType, float time)
82 | {
83 | AnimationClip animationClip;
84 | if (!self.animationClips.TryGetValue(motionType.ToString(), out animationClip))
85 | {
86 | throw new Exception($"找不到该动作: {motionType}");
87 | }
88 |
89 | float motionSpeed = animationClip.length / time;
90 | if (motionSpeed < 0.01f || motionSpeed > 1000f)
91 | {
92 | Log.Error($"motionSpeed数值异常, {motionSpeed}, 此动作跳过");
93 | return;
94 | }
95 | self.MotionType = motionType;
96 | self.MontionSpeed = motionSpeed;
97 | }
98 |
99 | public static void Play(this LSAnimatorComponent self, MotionType motionType, float motionSpeed = 1f)
100 | {
101 | if (!self.HasParameter(motionType.ToString()))
102 | {
103 | return;
104 | }
105 | self.MotionType = motionType;
106 | self.MontionSpeed = motionSpeed;
107 | }
108 |
109 | public static float AnimationTime(this LSAnimatorComponent self, MotionType motionType)
110 | {
111 | AnimationClip animationClip;
112 | if (!self.animationClips.TryGetValue(motionType.ToString(), out animationClip))
113 | {
114 | throw new Exception($"找不到该动作: {motionType}");
115 | }
116 | return animationClip.length;
117 | }
118 |
119 | public static void PauseAnimator(this LSAnimatorComponent self)
120 | {
121 | if (self.isStop)
122 | {
123 | return;
124 | }
125 | self.isStop = true;
126 |
127 | if (self.Animator == null)
128 | {
129 | return;
130 | }
131 | self.stopSpeed = self.Animator.speed;
132 | self.Animator.speed = 0;
133 | }
134 |
135 | public static void RunAnimator(this LSAnimatorComponent self)
136 | {
137 | if (!self.isStop)
138 | {
139 | return;
140 | }
141 |
142 | self.isStop = false;
143 |
144 | if (self.Animator == null)
145 | {
146 | return;
147 | }
148 | self.Animator.speed = self.stopSpeed;
149 | }
150 |
151 | public static void SetBoolValue(this LSAnimatorComponent self, string name, bool state)
152 | {
153 | if (!self.HasParameter(name))
154 | {
155 | return;
156 | }
157 |
158 | self.Animator.SetBool(name, state);
159 | }
160 |
161 | public static void SetFloatValue(this LSAnimatorComponent self, string name, float state)
162 | {
163 | if (!self.HasParameter(name))
164 | {
165 | return;
166 | }
167 |
168 | self.Animator.SetFloat(name, state);
169 | }
170 |
171 | public static void SetIntValue(this LSAnimatorComponent self, string name, int value)
172 | {
173 | if (!self.HasParameter(name))
174 | {
175 | return;
176 | }
177 |
178 | self.Animator.SetInteger(name, value);
179 | }
180 |
181 | public static void SetTrigger(this LSAnimatorComponent self, string name)
182 | {
183 | if (!self.HasParameter(name))
184 | {
185 | return;
186 | }
187 |
188 | self.Animator.SetTrigger(name);
189 | }
190 |
191 | public static void SetAnimatorSpeed(this LSAnimatorComponent self, float speed)
192 | {
193 | self.stopSpeed = self.Animator.speed;
194 | self.Animator.speed = speed;
195 | }
196 |
197 | public static void ResetAnimatorSpeed(this LSAnimatorComponent self)
198 | {
199 | self.Animator.speed = self.stopSpeed;
200 | }
201 | }
202 | }
--------------------------------------------------------------------------------
/Scripts/HotfixView/Client/LSAnimatorComponentSystem.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: c9a832e4bf80a45aba9c0b0c7efa8396
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Scripts/HotfixView/Client/LSOperaComponentSystem.cs:
--------------------------------------------------------------------------------
1 | using TrueSync;
2 | using UnityEngine;
3 |
4 | namespace ET.Client
5 | {
6 | [EntitySystemOf(typeof(LSOperaComponent))]
7 | [FriendOf(typeof(LSClientUpdater))]
8 | public static partial class LSOperaComponentSystem
9 | {
10 | [EntitySystem]
11 | private static void Awake(this ET.LSOperaComponent self)
12 | {
13 |
14 | }
15 |
16 | [EntitySystem]
17 | private static void Update(this LSOperaComponent self)
18 | {
19 | TSVector2 v = new();
20 | if (Input.GetKey(KeyCode.W))
21 | {
22 | v.y += 1;
23 | }
24 |
25 | if (Input.GetKey(KeyCode.A))
26 | {
27 | v.x -= 1;
28 | }
29 |
30 | if (Input.GetKey(KeyCode.S))
31 | {
32 | v.y -= 1;
33 | }
34 |
35 | if (Input.GetKey(KeyCode.D))
36 | {
37 | v.x += 1;
38 | }
39 |
40 | LSClientUpdater lsClientUpdater = self.GetParent().GetComponent();
41 | lsClientUpdater.Input.V = v.normalized;
42 | }
43 |
44 | }
45 | }
--------------------------------------------------------------------------------
/Scripts/HotfixView/Client/LSOperaComponentSystem.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 8a012a841eb144c2db7d93ef215caa07
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Scripts/HotfixView/Client/LSSceneChangeStart_AddComponent.cs:
--------------------------------------------------------------------------------
1 | using UnityEngine.SceneManagement;
2 |
3 | namespace ET.Client
4 | {
5 | [Event(SceneType.LockStep)]
6 | public class LSSceneChangeStart_AddComponent: AEvent
7 | {
8 | protected override async ETTask Run(Scene clientScene, LSSceneChangeStart args)
9 | {
10 | Room room = clientScene.GetComponent();
11 | ResourcesLoaderComponent resourcesLoaderComponent = room.AddComponent();
12 | room.AddComponent();
13 |
14 | // 创建loading界面
15 |
16 |
17 | // 创建房间UI
18 | await UIHelper.Create(args.Room, UIType.UILSRoom, UILayer.Low);
19 |
20 | // 加载场景资源
21 | await resourcesLoaderComponent.LoadSceneAsync($"Packages/cn.etetet.demores/Scenes/{room.Name}.unity", LoadSceneMode.Single);
22 | }
23 | }
24 | }
--------------------------------------------------------------------------------
/Scripts/HotfixView/Client/LSSceneChangeStart_AddComponent.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 0cd0e782889f141f5875cb20971b9568
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Scripts/HotfixView/Client/LSSceneInitFinish_Finish.cs:
--------------------------------------------------------------------------------
1 | namespace ET.Client
2 | {
3 | [Event(SceneType.LockStep)]
4 | public class LSSceneInitFinish_Finish: AEvent
5 | {
6 | protected override async ETTask Run(Scene clientScene, LSSceneInitFinish args)
7 | {
8 | Room room = clientScene.GetComponent();
9 |
10 | await room.AddComponent().InitAsync();
11 |
12 | room.AddComponent();
13 |
14 | if (!room.IsReplay)
15 | {
16 | room.AddComponent();
17 | }
18 |
19 | await UIHelper.Remove(clientScene, UIType.UILSLobby);
20 | await ETTask.CompletedTask;
21 | }
22 | }
23 | }
--------------------------------------------------------------------------------
/Scripts/HotfixView/Client/LSSceneInitFinish_Finish.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 1ac911ac3f20c49c6a05014a9a2ee9d8
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Scripts/HotfixView/Client/LSUnitViewComponentSystem.cs:
--------------------------------------------------------------------------------
1 | using UnityEngine;
2 |
3 | namespace ET.Client
4 | {
5 | [EntitySystemOf(typeof(LSUnitViewComponent))]
6 | public static partial class LSUnitViewComponentSystem
7 | {
8 | [EntitySystem]
9 | private static void Awake(this LSUnitViewComponent self)
10 | {
11 |
12 | }
13 |
14 | [EntitySystem]
15 | private static void Destroy(this LSUnitViewComponent self)
16 | {
17 |
18 | }
19 |
20 | public static async ETTask InitAsync(this LSUnitViewComponent self)
21 | {
22 | Room room = self.Room();
23 | LSUnitComponent lsUnitComponent = room.LSWorld.GetComponent();
24 | Scene root = self.Root();
25 | foreach (long playerId in room.PlayerIds)
26 | {
27 | LSUnit lsUnit = lsUnitComponent.GetChild(playerId);
28 | string assetsName = $"Packages/cn.etetet.demores/Bundles/Unit/Unit.prefab";
29 | GameObject bundleGameObject = await room.GetComponent().LoadAssetAsync(assetsName);
30 | GameObject prefab = bundleGameObject.Get("Skeleton");
31 |
32 | GlobalComponent globalComponent = root.GetComponent();
33 | GameObject unitGo = UnityEngine.Object.Instantiate(prefab, globalComponent.Unit, true);
34 | unitGo.transform.position = lsUnit.Position.ToVector();
35 |
36 | LSUnitView lsUnitView = self.AddChildWithId(lsUnit.Id, unitGo);
37 | lsUnitView.AddComponent();
38 | }
39 | }
40 | }
41 | }
--------------------------------------------------------------------------------
/Scripts/HotfixView/Client/LSUnitViewComponentSystem.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: a60af096c378e164994c0c5da1a9761c
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Scripts/HotfixView/Client/LSUnitViewSystem.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using TrueSync;
3 | using UnityEngine;
4 |
5 | namespace ET.Client
6 | {
7 | [EntitySystemOf(typeof(LSUnitView))]
8 | [LSEntitySystemOf(typeof(LSUnitView))]
9 | [FriendOf(typeof(LSUnitView))]
10 | public static partial class LSUnitViewSystem
11 | {
12 | [EntitySystem]
13 | private static void Awake(this LSUnitView self, GameObject go)
14 | {
15 | self.GameObject = go;
16 | self.Transform = go.transform;
17 |
18 | }
19 |
20 | [LSEntitySystem]
21 | private static void LSRollback(this LSUnitView self)
22 | {
23 | //LSUnit unit = self.GetUnit();
24 | //self.Transform.position = unit.Position.ToVector();
25 | //self.Transform.rotation = unit.Rotation.ToQuaternion();
26 | //self.t = 0;
27 | //self.totalTime = 0;
28 | }
29 |
30 | [EntitySystem]
31 | private static void Update(this LSUnitView self)
32 | {
33 | LSUnit unit = self.GetUnit();
34 |
35 | Vector3 unitPos = unit.Position.ToVector();
36 | const float speed = 6f;
37 | float speed2 = speed;// * self.Room().SpeedMultiply;
38 |
39 | if (unitPos != self.Position)
40 | {
41 | float distance = (unitPos - self.Position).magnitude;
42 | self.totalTime = distance / speed2;
43 | self.t = 0;
44 | self.Position = unit.Position.ToVector();
45 | self.Rotation = unit.Rotation.ToQuaternion();
46 | }
47 |
48 |
49 | LSInput input = unit.GetComponent().LSInput;
50 | if (input.V != TSVector2.zero)
51 | {
52 | self.GetComponent().SetFloatValue("Speed", speed2);
53 | }
54 | else
55 | {
56 | self.GetComponent().SetFloatValue("Speed", 0);
57 | }
58 | self.t += Time.deltaTime;
59 | self.Transform.rotation = Quaternion.Lerp(self.Transform.rotation, self.Rotation, self.t / 1f);
60 | self.Transform.position = Vector3.Lerp(self.Transform.position, self.Position, self.t / self.totalTime);
61 | }
62 |
63 | private static LSUnit GetUnit(this LSUnitView self)
64 | {
65 | LSUnit unit = self.Unit;
66 | if (unit != null)
67 | {
68 | return unit;
69 | }
70 |
71 | self.Unit = (self.IScene as Room).LSWorld.GetComponent().GetChild(self.Id);
72 | return self.Unit;
73 | }
74 | }
75 | }
--------------------------------------------------------------------------------
/Scripts/HotfixView/Client/LSUnitViewSystem.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 9390f59e3a1a443c9b9f89316a2512c7
3 | timeCreated: 1682061228
--------------------------------------------------------------------------------
/Scripts/HotfixView/Client/Scene.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 40255a3d69a90469586e24c2d6dd4d70
3 | folderAsset: yes
4 | DefaultImporter:
5 | externalObjects: {}
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/Scripts/HotfixView/Client/Scene/AfterCreateClientScene_LSAddComponent.cs:
--------------------------------------------------------------------------------
1 | namespace ET.Client
2 | {
3 | [Event(SceneType.LockStep)]
4 | public class AfterCreateClientScene_LSAddComponent: AEvent
5 | {
6 | protected override async ETTask Run(Scene scene, AfterCreateClientScene args)
7 | {
8 | scene.AddComponent();
9 | scene.AddComponent();
10 | await ETTask.CompletedTask;
11 | }
12 | }
13 | }
--------------------------------------------------------------------------------
/Scripts/HotfixView/Client/Scene/AfterCreateClientScene_LSAddComponent.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 8a211a53e0c3344ee98138e70257542d
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Scripts/HotfixView/Client/Scene/CurrentScenesComponentSystem.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace ET
4 | {
5 | public static partial class CurrentScenesComponentSystem
6 | {
7 | public static Scene CurrentScene(this Scene root)
8 | {
9 | return root.GetComponent()?.Scene;
10 | }
11 | }
12 | }
--------------------------------------------------------------------------------
/Scripts/HotfixView/Client/Scene/CurrentScenesComponentSystem.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 130fe2171b134aec8da3228825b4f599
3 | timeCreated: 1718294486
--------------------------------------------------------------------------------
/Scripts/HotfixView/Client/UI.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 18eaa9b409bad4f9b82e1bbb0811c9fc
3 | folderAsset: yes
4 | DefaultImporter:
5 | externalObjects: {}
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/Scripts/HotfixView/Client/UI/UIHelper.cs:
--------------------------------------------------------------------------------
1 | namespace ET.Client
2 | {
3 | public static class UIHelper
4 | {
5 | [EnableAccessEntiyChild]
6 | public static async ETTask Create(Entity scene, string uiType, UILayer uiLayer)
7 | {
8 | return await scene.GetComponent().Create(uiType, uiLayer);
9 | }
10 |
11 | [EnableAccessEntiyChild]
12 | public static async ETTask Remove(Entity scene, string uiType)
13 | {
14 | scene.GetComponent().Remove(uiType);
15 | await ETTask.CompletedTask;
16 | }
17 | }
18 | }
--------------------------------------------------------------------------------
/Scripts/HotfixView/Client/UI/UIHelper.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: addb826311334f9785ae3667b8edf106
3 | timeCreated: 1718287566
--------------------------------------------------------------------------------
/Scripts/HotfixView/Client/UI/UILSLobby.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 801ad2cb82cd34293864249725f3efca
3 | folderAsset: yes
4 | DefaultImporter:
5 | externalObjects: {}
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/Scripts/HotfixView/Client/UI/UILSLobby/LoginFinish_CreateUILSLobby.cs:
--------------------------------------------------------------------------------
1 | namespace ET.Client
2 | {
3 | [Event(SceneType.LockStep)]
4 | public class LoginFinish_CreateUILSLobby: AEvent
5 | {
6 | protected override async ETTask Run(Scene scene, LoginFinish args)
7 | {
8 | await UIHelper.Create(scene, UIType.UILSLobby, UILayer.Mid);
9 | }
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/Scripts/HotfixView/Client/UI/UILSLobby/LoginFinish_CreateUILSLobby.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 46a23a8347cd34cd895645dc07ff7e63
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Scripts/HotfixView/Client/UI/UILSLobby/UILSLobbyComponentSystem.cs:
--------------------------------------------------------------------------------
1 | using System.IO;
2 | using UnityEngine;
3 | using UnityEngine.UI;
4 |
5 | namespace ET.Client
6 | {
7 | [EntitySystemOf(typeof(UILSLobbyComponent))]
8 | [FriendOf(typeof(UILSLobbyComponent))]
9 | public static partial class UILSLobbyComponentSystem
10 | {
11 | [EntitySystem]
12 | private static void Awake(this UILSLobbyComponent self)
13 | {
14 | ReferenceCollector rc = self.GetParent().GameObject.GetComponent();
15 |
16 | self.enterMap = rc.Get("EnterMap");
17 | self.enterMap.GetComponent