├── LICENSE ├── LockStepSimpleFramework-Client-master ├── .gitmodules ├── Assets │ ├── Resources.meta │ ├── Resources │ │ ├── Prefabs.meta │ │ ├── Prefabs │ │ │ ├── Bullet.prefab │ │ │ ├── Bullet.prefab.meta │ │ │ ├── Soldier.prefab │ │ │ ├── Soldier.prefab.meta │ │ │ ├── Tower.prefab │ │ │ ├── Tower.prefab.meta │ │ │ ├── ui.meta │ │ │ └── ui │ │ │ │ ├── BattleUI.prefab │ │ │ │ └── BattleUI.prefab.meta │ │ ├── Texture.meta │ │ └── Texture │ │ │ ├── Materials.meta │ │ │ ├── Materials │ │ │ ├── blue.mat │ │ │ ├── blue.mat.meta │ │ │ ├── green.mat │ │ │ ├── green.mat.meta │ │ │ ├── red.mat │ │ │ └── red.mat.meta │ │ │ ├── blue.png │ │ │ ├── blue.png.meta │ │ │ ├── green.png │ │ │ ├── green.png.meta │ │ │ ├── red.png │ │ │ └── red.png.meta │ ├── Scene.meta │ ├── Scene │ │ ├── main.unity │ │ └── main.unity.meta │ ├── Source.meta │ └── Source │ │ ├── BattleLogicMonoBehaviour.cs │ │ ├── BattleLogicMonoBehaviour.cs.meta │ │ ├── SimpleSocket.cs │ │ ├── SimpleSocket.cs.meta │ │ ├── ui.meta │ │ ├── ui │ │ ├── BattleUI.cs │ │ └── BattleUI.cs.meta │ │ ├── view.meta │ │ └── view │ │ ├── prefab.cs │ │ └── prefab.cs.meta ├── LICENSE ├── ProjectSettings │ ├── AudioManager.asset │ ├── ClusterInputManager.asset │ ├── DynamicsManager.asset │ ├── EditorBuildSettings.asset │ ├── EditorSettings.asset │ ├── GraphicsSettings.asset │ ├── InputManager.asset │ ├── NavMeshAreas.asset │ ├── NetworkManager.asset │ ├── Physics2DSettings.asset │ ├── ProjectSettings.asset │ ├── ProjectVersion.txt │ ├── QualitySettings.asset │ ├── TagManager.asset │ ├── TimeManager.asset │ └── UnityConnectSettings.asset └── README.md └── README.md /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2022 1Xyb 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /LockStepSimpleFramework-Client-master/.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "Assets/Source/battle"] 2 | path = Assets/Source/battle 3 | url = https://github.com/CraneInForest/LockStepSimpleFramework-Shared.git 4 | -------------------------------------------------------------------------------- /LockStepSimpleFramework-Client-master/Assets/Resources.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 4895c6b1f05ed374291cb3e5d3f5c15c 3 | folderAsset: yes 4 | timeCreated: 1534575884 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /LockStepSimpleFramework-Client-master/Assets/Resources/Prefabs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d9421c5629070634794b7b4fe8ed1871 3 | folderAsset: yes 4 | timeCreated: 1534570911 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /LockStepSimpleFramework-Client-master/Assets/Resources/Prefabs/Bullet.prefab: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1Xyb/LockStep/8ca4b0b8790714649c017520f0700f30a4d19474/LockStepSimpleFramework-Client-master/Assets/Resources/Prefabs/Bullet.prefab -------------------------------------------------------------------------------- /LockStepSimpleFramework-Client-master/Assets/Resources/Prefabs/Bullet.prefab.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 4892569d5f540944fbacb21be42225d3 3 | timeCreated: 1534571237 4 | licenseType: Pro 5 | NativeFormatImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /LockStepSimpleFramework-Client-master/Assets/Resources/Prefabs/Soldier.prefab: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1Xyb/LockStep/8ca4b0b8790714649c017520f0700f30a4d19474/LockStepSimpleFramework-Client-master/Assets/Resources/Prefabs/Soldier.prefab -------------------------------------------------------------------------------- /LockStepSimpleFramework-Client-master/Assets/Resources/Prefabs/Soldier.prefab.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 93e73f369bd031e48ad53b6875974270 3 | timeCreated: 1534570933 4 | licenseType: Pro 5 | NativeFormatImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /LockStepSimpleFramework-Client-master/Assets/Resources/Prefabs/Tower.prefab: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1Xyb/LockStep/8ca4b0b8790714649c017520f0700f30a4d19474/LockStepSimpleFramework-Client-master/Assets/Resources/Prefabs/Tower.prefab -------------------------------------------------------------------------------- /LockStepSimpleFramework-Client-master/Assets/Resources/Prefabs/Tower.prefab.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 921b2d16fdd21714c99b2d7f8fab735d 3 | timeCreated: 1534570939 4 | licenseType: Pro 5 | NativeFormatImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /LockStepSimpleFramework-Client-master/Assets/Resources/Prefabs/ui.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 6db3421b3f7abb74298871c7abbb597d 3 | folderAsset: yes 4 | timeCreated: 1534581590 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /LockStepSimpleFramework-Client-master/Assets/Resources/Prefabs/ui/BattleUI.prefab: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1Xyb/LockStep/8ca4b0b8790714649c017520f0700f30a4d19474/LockStepSimpleFramework-Client-master/Assets/Resources/Prefabs/ui/BattleUI.prefab -------------------------------------------------------------------------------- /LockStepSimpleFramework-Client-master/Assets/Resources/Prefabs/ui/BattleUI.prefab.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: a68b9589c9c91b34bbcb52dbfe9659e2 3 | timeCreated: 1534581650 4 | licenseType: Pro 5 | NativeFormatImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /LockStepSimpleFramework-Client-master/Assets/Resources/Texture.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 92ce1b6ae85035c4faf2cfe7310b09a4 3 | folderAsset: yes 4 | timeCreated: 1534570905 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /LockStepSimpleFramework-Client-master/Assets/Resources/Texture/Materials.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: a03d4d60c82bb4c4990adeb56121b295 3 | folderAsset: yes 4 | timeCreated: 1534570951 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /LockStepSimpleFramework-Client-master/Assets/Resources/Texture/Materials/blue.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1Xyb/LockStep/8ca4b0b8790714649c017520f0700f30a4d19474/LockStepSimpleFramework-Client-master/Assets/Resources/Texture/Materials/blue.mat -------------------------------------------------------------------------------- /LockStepSimpleFramework-Client-master/Assets/Resources/Texture/Materials/blue.mat.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 2d968ab704738a942ac907b8472d2b48 3 | timeCreated: 1534571009 4 | licenseType: Pro 5 | NativeFormatImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /LockStepSimpleFramework-Client-master/Assets/Resources/Texture/Materials/green.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1Xyb/LockStep/8ca4b0b8790714649c017520f0700f30a4d19474/LockStepSimpleFramework-Client-master/Assets/Resources/Texture/Materials/green.mat -------------------------------------------------------------------------------- /LockStepSimpleFramework-Client-master/Assets/Resources/Texture/Materials/green.mat.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d7755e77184e79644961cc0d3fbab9b3 3 | timeCreated: 1534571262 4 | licenseType: Pro 5 | NativeFormatImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /LockStepSimpleFramework-Client-master/Assets/Resources/Texture/Materials/red.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1Xyb/LockStep/8ca4b0b8790714649c017520f0700f30a4d19474/LockStepSimpleFramework-Client-master/Assets/Resources/Texture/Materials/red.mat -------------------------------------------------------------------------------- /LockStepSimpleFramework-Client-master/Assets/Resources/Texture/Materials/red.mat.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 034a4f6cb96d1bd46bfa6568ded03de3 3 | timeCreated: 1534570951 4 | licenseType: Pro 5 | NativeFormatImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /LockStepSimpleFramework-Client-master/Assets/Resources/Texture/blue.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1Xyb/LockStep/8ca4b0b8790714649c017520f0700f30a4d19474/LockStepSimpleFramework-Client-master/Assets/Resources/Texture/blue.png -------------------------------------------------------------------------------- /LockStepSimpleFramework-Client-master/Assets/Resources/Texture/blue.png.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 9bdbcbcda71351b4a8be423d2ae657c8 3 | timeCreated: 1534570923 4 | licenseType: Pro 5 | TextureImporter: 6 | fileIDToRecycleName: {} 7 | serializedVersion: 4 8 | mipmaps: 9 | mipMapMode: 0 10 | enableMipMap: 1 11 | sRGBTexture: 1 12 | linearTexture: 0 13 | fadeOut: 0 14 | borderMipMap: 0 15 | mipMapFadeDistanceStart: 1 16 | mipMapFadeDistanceEnd: 3 17 | bumpmap: 18 | convertToNormalMap: 0 19 | externalNormalMap: 0 20 | heightScale: 0.25 21 | normalMapFilter: 0 22 | isReadable: 0 23 | grayScaleToAlpha: 0 24 | generateCubemap: 6 25 | cubemapConvolution: 0 26 | seamlessCubemap: 0 27 | textureFormat: 1 28 | maxTextureSize: 2048 29 | textureSettings: 30 | filterMode: -1 31 | aniso: -1 32 | mipBias: -1 33 | wrapMode: -1 34 | nPOTScale: 1 35 | lightmap: 0 36 | compressionQuality: 50 37 | spriteMode: 0 38 | spriteExtrude: 1 39 | spriteMeshType: 1 40 | alignment: 0 41 | spritePivot: {x: 0.5, y: 0.5} 42 | spriteBorder: {x: 0, y: 0, z: 0, w: 0} 43 | spritePixelsToUnits: 100 44 | alphaUsage: 1 45 | alphaIsTransparency: 0 46 | spriteTessellationDetail: -1 47 | textureType: 0 48 | textureShape: 1 49 | maxTextureSizeSet: 0 50 | compressionQualitySet: 0 51 | textureFormatSet: 0 52 | platformSettings: 53 | - buildTarget: DefaultTexturePlatform 54 | maxTextureSize: 2048 55 | textureFormat: -1 56 | textureCompression: 1 57 | compressionQuality: 50 58 | crunchedCompression: 0 59 | allowsAlphaSplitting: 0 60 | overridden: 0 61 | spriteSheet: 62 | serializedVersion: 2 63 | sprites: [] 64 | outline: [] 65 | spritePackingTag: 66 | userData: 67 | assetBundleName: 68 | assetBundleVariant: 69 | -------------------------------------------------------------------------------- /LockStepSimpleFramework-Client-master/Assets/Resources/Texture/green.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1Xyb/LockStep/8ca4b0b8790714649c017520f0700f30a4d19474/LockStepSimpleFramework-Client-master/Assets/Resources/Texture/green.png -------------------------------------------------------------------------------- /LockStepSimpleFramework-Client-master/Assets/Resources/Texture/green.png.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 8d5229c28c34f0b479452f11b4c9a367 3 | timeCreated: 1534570923 4 | licenseType: Pro 5 | TextureImporter: 6 | fileIDToRecycleName: {} 7 | serializedVersion: 4 8 | mipmaps: 9 | mipMapMode: 0 10 | enableMipMap: 1 11 | sRGBTexture: 1 12 | linearTexture: 0 13 | fadeOut: 0 14 | borderMipMap: 0 15 | mipMapFadeDistanceStart: 1 16 | mipMapFadeDistanceEnd: 3 17 | bumpmap: 18 | convertToNormalMap: 0 19 | externalNormalMap: 0 20 | heightScale: 0.25 21 | normalMapFilter: 0 22 | isReadable: 0 23 | grayScaleToAlpha: 0 24 | generateCubemap: 6 25 | cubemapConvolution: 0 26 | seamlessCubemap: 0 27 | textureFormat: 1 28 | maxTextureSize: 2048 29 | textureSettings: 30 | filterMode: -1 31 | aniso: -1 32 | mipBias: -1 33 | wrapMode: -1 34 | nPOTScale: 1 35 | lightmap: 0 36 | compressionQuality: 50 37 | spriteMode: 0 38 | spriteExtrude: 1 39 | spriteMeshType: 1 40 | alignment: 0 41 | spritePivot: {x: 0.5, y: 0.5} 42 | spriteBorder: {x: 0, y: 0, z: 0, w: 0} 43 | spritePixelsToUnits: 100 44 | alphaUsage: 1 45 | alphaIsTransparency: 0 46 | spriteTessellationDetail: -1 47 | textureType: 0 48 | textureShape: 1 49 | maxTextureSizeSet: 0 50 | compressionQualitySet: 0 51 | textureFormatSet: 0 52 | platformSettings: 53 | - buildTarget: DefaultTexturePlatform 54 | maxTextureSize: 2048 55 | textureFormat: -1 56 | textureCompression: 1 57 | compressionQuality: 50 58 | crunchedCompression: 0 59 | allowsAlphaSplitting: 0 60 | overridden: 0 61 | spriteSheet: 62 | serializedVersion: 2 63 | sprites: [] 64 | outline: [] 65 | spritePackingTag: 66 | userData: 67 | assetBundleName: 68 | assetBundleVariant: 69 | -------------------------------------------------------------------------------- /LockStepSimpleFramework-Client-master/Assets/Resources/Texture/red.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1Xyb/LockStep/8ca4b0b8790714649c017520f0700f30a4d19474/LockStepSimpleFramework-Client-master/Assets/Resources/Texture/red.png -------------------------------------------------------------------------------- /LockStepSimpleFramework-Client-master/Assets/Resources/Texture/red.png.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: c3bcf5e618cf45f46ba6d947673541c2 3 | timeCreated: 1534570923 4 | licenseType: Pro 5 | TextureImporter: 6 | fileIDToRecycleName: {} 7 | serializedVersion: 4 8 | mipmaps: 9 | mipMapMode: 0 10 | enableMipMap: 1 11 | sRGBTexture: 1 12 | linearTexture: 0 13 | fadeOut: 0 14 | borderMipMap: 0 15 | mipMapFadeDistanceStart: 1 16 | mipMapFadeDistanceEnd: 3 17 | bumpmap: 18 | convertToNormalMap: 0 19 | externalNormalMap: 0 20 | heightScale: 0.25 21 | normalMapFilter: 0 22 | isReadable: 0 23 | grayScaleToAlpha: 0 24 | generateCubemap: 6 25 | cubemapConvolution: 0 26 | seamlessCubemap: 0 27 | textureFormat: 1 28 | maxTextureSize: 2048 29 | textureSettings: 30 | filterMode: -1 31 | aniso: -1 32 | mipBias: -1 33 | wrapMode: -1 34 | nPOTScale: 1 35 | lightmap: 0 36 | compressionQuality: 50 37 | spriteMode: 0 38 | spriteExtrude: 1 39 | spriteMeshType: 1 40 | alignment: 0 41 | spritePivot: {x: 0.5, y: 0.5} 42 | spriteBorder: {x: 0, y: 0, z: 0, w: 0} 43 | spritePixelsToUnits: 100 44 | alphaUsage: 1 45 | alphaIsTransparency: 0 46 | spriteTessellationDetail: -1 47 | textureType: 0 48 | textureShape: 1 49 | maxTextureSizeSet: 0 50 | compressionQualitySet: 0 51 | textureFormatSet: 0 52 | platformSettings: 53 | - buildTarget: DefaultTexturePlatform 54 | maxTextureSize: 2048 55 | textureFormat: -1 56 | textureCompression: 1 57 | compressionQuality: 50 58 | crunchedCompression: 0 59 | allowsAlphaSplitting: 0 60 | overridden: 0 61 | spriteSheet: 62 | serializedVersion: 2 63 | sprites: [] 64 | outline: [] 65 | spritePackingTag: 66 | userData: 67 | assetBundleName: 68 | assetBundleVariant: 69 | -------------------------------------------------------------------------------- /LockStepSimpleFramework-Client-master/Assets/Scene.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f9d27b7d4dce5024daa4a17cb98d06fa 3 | folderAsset: yes 4 | timeCreated: 1534571416 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /LockStepSimpleFramework-Client-master/Assets/Scene/main.unity: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1Xyb/LockStep/8ca4b0b8790714649c017520f0700f30a4d19474/LockStepSimpleFramework-Client-master/Assets/Scene/main.unity -------------------------------------------------------------------------------- /LockStepSimpleFramework-Client-master/Assets/Scene/main.unity.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: fe0ec4138e9668e48a4f8dbf551306ae 3 | timeCreated: 1534571408 4 | licenseType: Pro 5 | DefaultImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /LockStepSimpleFramework-Client-master/Assets/Source.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e87828031f5c0e04f9395aa1b43ce349 3 | folderAsset: yes 4 | timeCreated: 1534571796 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /LockStepSimpleFramework-Client-master/Assets/Source/BattleLogicMonoBehaviour.cs: -------------------------------------------------------------------------------- 1 | // 2 | // @brief: 战斗对象挂载脚本 3 | // @version: 1.0.0 4 | // @author helin 5 | // @date: 03/7/2018 6 | // 7 | // 8 | // 9 | 10 | using UnityEngine; 11 | using System.Collections; 12 | 13 | public class BattleLogicMonoBehaviour : MonoBehaviour { 14 | 15 | BattleLogic battleLogic = new BattleLogic(); 16 | 17 | // Use this for initialization 18 | void Start () { 19 | #if _CLIENTLOGIC_ 20 | battleLogic.init(); 21 | #else 22 | GameData.g_uGameLogicFrame = 0; 23 | GameData.g_bRplayMode = true; 24 | battleLogic.init(); 25 | battleLogic.updateLogic(); 26 | #endif 27 | } 28 | 29 | // Update is called once per frame 30 | void Update () { 31 | #if _CLIENTLOGIC_ 32 | battleLogic.updateLogic(); 33 | #endif 34 | } 35 | 36 | public BattleLogic getBattleLogic() 37 | { 38 | return battleLogic; 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /LockStepSimpleFramework-Client-master/Assets/Source/BattleLogicMonoBehaviour.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 6ee3834a54932684bbb6464f0f4f74da 3 | timeCreated: 1534574275 4 | licenseType: Pro 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /LockStepSimpleFramework-Client-master/Assets/Source/SimpleSocket.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using UnityEngine; 4 | using System; 5 | using System.Net; 6 | using System.Net.Sockets; 7 | using System.Text; 8 | using System.Threading; 9 | 10 | public class SimpleSocket { 11 | 12 | private Socket socketClient; 13 | 14 | // Use this for initialization 15 | public void Init () { 16 | Console.WriteLine("Hello World!"); 17 | //创建实例 18 | socketClient = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); 19 | IPAddress ip = IPAddress.Parse("192.168.0.140"); 20 | IPEndPoint point = new IPEndPoint(ip, 2333); 21 | //进行连接 22 | socketClient.Connect(point); 23 | 24 | //不停的接收服务器端发送的消息 25 | Thread thread = new Thread(Recive); 26 | thread.IsBackground = true; 27 | thread.Start(socketClient); 28 | } 29 | 30 | /// 31 | /// 接收消息 32 | /// 33 | /// 34 | static void Recive(object o) 35 | { 36 | var send = o as Socket; 37 | //while (true) 38 | { 39 | //获取发送过来的消息 40 | byte[] buffer = new byte[1024 * 1024 * 2]; 41 | var effective = send.Receive(buffer); 42 | if (effective == 0) 43 | { 44 | //break; 45 | } 46 | var str = Encoding.UTF8.GetString(buffer, 0, effective); 47 | Debug.Log("receive from server: " + str); 48 | BattleUI.m_scServerInfo = str; 49 | } 50 | } 51 | 52 | public void sendBattleRecordToServer(string record) 53 | { 54 | var buffter = Encoding.UTF8.GetBytes(record); 55 | var temp = socketClient.Send(buffter); 56 | Thread.Sleep(1000); 57 | } 58 | } -------------------------------------------------------------------------------- /LockStepSimpleFramework-Client-master/Assets/Source/SimpleSocket.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 8f8b585697144154f8d968f946a8a2cc 3 | timeCreated: 1535025445 4 | licenseType: Pro 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /LockStepSimpleFramework-Client-master/Assets/Source/ui.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d4fb81b2cf357e64fafb0a33bca975ba 3 | folderAsset: yes 4 | timeCreated: 1534581779 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /LockStepSimpleFramework-Client-master/Assets/Source/ui/BattleUI.cs: -------------------------------------------------------------------------------- 1 | // 2 | // @brief: 战斗UI 3 | // @version: 1.0.0 4 | // @author helin 5 | // @date: 03/7/2018 6 | // 7 | // 8 | // 9 | 10 | using System.Collections; 11 | using System.Collections.Generic; 12 | using UnityEngine; 13 | using UnityEngine.UI; 14 | 15 | public class BattleUI : MonoBehaviour { 16 | 17 | public Button btnStartBattle; 18 | public Button btnSendSoldier; 19 | public Button btnEndBattle; 20 | public Button btnReplay; 21 | public Button btnAdjustSpeed; 22 | public Text textResult; 23 | public static string m_scServerInfo = ""; 24 | 25 | public BattleLogicMonoBehaviour monoBehaviour; 26 | 27 | // Use this for initialization 28 | void Start () { 29 | btnStartBattle = btnStartBattle.GetComponent