diff --git a/Assets/NetworkLib/Debug/netstandard2.1/CSNetwork.dll b/Assets/NetworkLib/Debug/netstandard2.1/CSNetwork.dll index 47ff33e0aa..753c88efd5 100644 Binary files a/Assets/NetworkLib/Debug/netstandard2.1/CSNetwork.dll and b/Assets/NetworkLib/Debug/netstandard2.1/CSNetwork.dll differ diff --git a/Assets/PerfectWorld/Scripts/Managers/EC_ManPlayer.cs b/Assets/PerfectWorld/Scripts/Managers/EC_ManPlayer.cs index b01a12fda0..5f4639a771 100644 --- a/Assets/PerfectWorld/Scripts/Managers/EC_ManPlayer.cs +++ b/Assets/PerfectWorld/Scripts/Managers/EC_ManPlayer.cs @@ -9,7 +9,7 @@ namespace PerfectWorld.Scripts.Managers { public class EC_ManPlayer : IMsgHandler { - public int HandlerId => MANAGER_INDEX.MAN_PLAYER; + public int HandlerId => (int)MANAGER_INDEX.MAN_PLAYER; public bool ProcessMessage(ECMSG Msg) { if (Msg.iSubID == 0) @@ -45,7 +45,7 @@ namespace PerfectWorld.Scripts.Managers byteArray[i] = data[i]; } int cid = BitConverter.ToInt32(byteArray); - switch (Msg.dwParam2) + switch (Convert.ToInt32(Msg.dwParam2)) { case CommandID.PLAYER_INFO_1: case CommandID.PLAYER_ENTER_WORLD: @@ -53,7 +53,7 @@ namespace PerfectWorld.Scripts.Managers { if (cid != iHostID) { - + GameController.Instance.Log("ElsePlayer has join"); } break; } diff --git a/Assets/PerfectWorld/Scripts/Players.meta b/Assets/PerfectWorld/Scripts/Players.meta new file mode 100644 index 0000000000..4c9f3da9b4 --- /dev/null +++ b/Assets/PerfectWorld/Scripts/Players.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 8511a50fc48e2cf4bbd9a6bf91442d50 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/PerfectWorld/Scripts/Players/EC_ElsePlayer.cs b/Assets/PerfectWorld/Scripts/Players/EC_ElsePlayer.cs new file mode 100644 index 0000000000..9885ebb9d4 --- /dev/null +++ b/Assets/PerfectWorld/Scripts/Players/EC_ElsePlayer.cs @@ -0,0 +1,16 @@ +using UnityEngine; + +public class EC_ElsePlayer : MonoBehaviour +{ + // Start is called once before the first execution of Update after the MonoBehaviour is created + void Start() + { + + } + + // Update is called once per frame + void Update() + { + + } +} diff --git a/Assets/PerfectWorld/Scripts/Players/EC_ElsePlayer.cs.meta b/Assets/PerfectWorld/Scripts/Players/EC_ElsePlayer.cs.meta new file mode 100644 index 0000000000..f991a743ac --- /dev/null +++ b/Assets/PerfectWorld/Scripts/Players/EC_ElsePlayer.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 0feb504dc7975e84dab03230dd3277a8 \ No newline at end of file diff --git a/Assets/Prefabs/Character.prefab b/Assets/Prefabs/Character.prefab index 508f1ab281..1648a595dd 100644 --- a/Assets/Prefabs/Character.prefab +++ b/Assets/Prefabs/Character.prefab @@ -11,9 +11,9 @@ GameObject: - component: {fileID: 3412441340983701579} - component: {fileID: 4963688309523522575} - component: {fileID: 8371471143466595520} - - component: {fileID: 8750866330409519469} - - component: {fileID: 2579337816850146009} - component: {fileID: 7639115115142978997} + - component: {fileID: 8960181021787475507} + - component: {fileID: 1591670752219322405} m_Layer: 0 m_Name: Character m_TagString: Untagged @@ -90,56 +90,6 @@ MeshRenderer: m_SortingLayer: 0 m_SortingOrder: 0 m_AdditionalVertexStreams: {fileID: 0} ---- !u!136 &8750866330409519469 -CapsuleCollider: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 2013293210786114121} - m_Material: {fileID: 0} - m_IncludeLayers: - serializedVersion: 2 - m_Bits: 0 - m_ExcludeLayers: - serializedVersion: 2 - m_Bits: 0 - m_LayerOverridePriority: 0 - m_IsTrigger: 0 - m_ProvidesContacts: 0 - m_Enabled: 1 - serializedVersion: 2 - m_Radius: 0.5 - m_Height: 2 - m_Direction: 1 - m_Center: {x: 0, y: 0, z: 0} ---- !u!54 &2579337816850146009 -Rigidbody: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 2013293210786114121} - serializedVersion: 4 - m_Mass: 1 - m_Drag: 0 - m_AngularDrag: 0.05 - m_CenterOfMass: {x: 0, y: 0, z: 0} - m_InertiaTensor: {x: 1, y: 1, z: 1} - m_InertiaRotation: {x: 0, y: 0, z: 0, w: 1} - m_IncludeLayers: - serializedVersion: 2 - m_Bits: 0 - m_ExcludeLayers: - serializedVersion: 2 - m_Bits: 0 - m_ImplicitCom: 1 - m_ImplicitTensor: 1 - m_UseGravity: 1 - m_IsKinematic: 0 - m_Interpolate: 0 - m_Constraints: 0 - m_CollisionDetection: 0 --- !u!114 &7639115115142978997 MonoBehaviour: m_ObjectHideFlags: 0 @@ -153,11 +103,58 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: txtName: {fileID: 0} - controller: {fileID: 0} - animator: {fileID: 0} + controller: {fileID: 8960181021787475507} + animator: {fileID: 1591670752219322405} joystick: {fileID: 0} btnJump: {fileID: 0} btnRun: {fileID: 0} +--- !u!143 &8960181021787475507 +CharacterController: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2013293210786114121} + m_Material: {fileID: 0} + m_IncludeLayers: + serializedVersion: 2 + m_Bits: 0 + m_ExcludeLayers: + serializedVersion: 2 + m_Bits: 0 + m_LayerOverridePriority: 0 + m_ProvidesContacts: 0 + m_Enabled: 1 + serializedVersion: 3 + m_Height: 2 + m_Radius: 0.5 + m_SlopeLimit: 45 + m_StepOffset: 0.3 + m_SkinWidth: 0.08 + m_MinMoveDistance: 0.001 + m_Center: {x: 0, y: 0, z: 0} +--- !u!95 &1591670752219322405 +Animator: + serializedVersion: 7 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2013293210786114121} + m_Enabled: 1 + m_Avatar: {fileID: 0} + m_Controller: {fileID: 0} + m_CullingMode: 0 + m_UpdateMode: 0 + m_ApplyRootMotion: 0 + m_LinearVelocityBlending: 0 + m_StabilizeFeet: 0 + m_AnimatePhysics: 0 + m_WarningMessage: + m_HasTransformHierarchy: 1 + m_AllowConstantClipSamplingOptimization: 1 + m_KeepAnimatorStateOnDisable: 0 + m_WriteDefaultValuesOnDisable: 0 --- !u!1 &5363758751412688596 GameObject: m_ObjectHideFlags: 0 diff --git a/Assets/Scenes/Demo.unity b/Assets/Scenes/Demo.unity index 5620cf3438..b75ea6a022 100644 --- a/Assets/Scenes/Demo.unity +++ b/Assets/Scenes/Demo.unity @@ -2988,6 +2988,7 @@ Transform: m_ConstrainProportionsScale: 0 m_Children: - {fileID: 626090657} + - {fileID: 2034856886} m_Father: {fileID: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!114 &1018020457 @@ -3799,6 +3800,75 @@ RectTransform: m_AnchoredPosition: {x: 0, y: 98} m_SizeDelta: {x: 0, y: 100} m_Pivot: {x: 0.5, y: 0.5} +--- !u!1001 &2034856885 +PrefabInstance: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + serializedVersion: 3 + m_TransformParent: {fileID: 1018020456} + m_Modifications: + - target: {fileID: 2013293210786114121, guid: 633f7b514d73bdb459636883927e2b1b, type: 3} + propertyPath: m_Name + value: Character + objectReference: {fileID: 0} + - target: {fileID: 2013293210786114121, guid: 633f7b514d73bdb459636883927e2b1b, type: 3} + propertyPath: m_IsActive + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 3412441340983701579, guid: 633f7b514d73bdb459636883927e2b1b, type: 3} + propertyPath: m_LocalPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 3412441340983701579, guid: 633f7b514d73bdb459636883927e2b1b, type: 3} + propertyPath: m_LocalPosition.y + value: 2.73 + objectReference: {fileID: 0} + - target: {fileID: 3412441340983701579, guid: 633f7b514d73bdb459636883927e2b1b, type: 3} + propertyPath: m_LocalPosition.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 3412441340983701579, guid: 633f7b514d73bdb459636883927e2b1b, type: 3} + propertyPath: m_LocalRotation.w + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 3412441340983701579, guid: 633f7b514d73bdb459636883927e2b1b, type: 3} + propertyPath: m_LocalRotation.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 3412441340983701579, guid: 633f7b514d73bdb459636883927e2b1b, type: 3} + propertyPath: m_LocalRotation.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 3412441340983701579, guid: 633f7b514d73bdb459636883927e2b1b, type: 3} + propertyPath: m_LocalRotation.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 3412441340983701579, guid: 633f7b514d73bdb459636883927e2b1b, type: 3} + propertyPath: m_LocalEulerAnglesHint.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 3412441340983701579, guid: 633f7b514d73bdb459636883927e2b1b, type: 3} + propertyPath: m_LocalEulerAnglesHint.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 3412441340983701579, guid: 633f7b514d73bdb459636883927e2b1b, type: 3} + propertyPath: m_LocalEulerAnglesHint.z + value: 0 + objectReference: {fileID: 0} + m_RemovedComponents: [] + m_RemovedGameObjects: [] + m_AddedGameObjects: [] + m_AddedComponents: + - targetCorrespondingSourceObject: {fileID: 5363758751412688596, guid: 633f7b514d73bdb459636883927e2b1b, type: 3} + insertIndex: -1 + addedObject: {fileID: 0} + m_SourcePrefab: {fileID: 100100000, guid: 633f7b514d73bdb459636883927e2b1b, type: 3} +--- !u!4 &2034856886 stripped +Transform: + m_CorrespondingSourceObject: {fileID: 3412441340983701579, guid: 633f7b514d73bdb459636883927e2b1b, type: 3} + m_PrefabInstance: {fileID: 2034856885} + m_PrefabAsset: {fileID: 0} --- !u!1 &2082488502 GameObject: m_ObjectHideFlags: 0 diff --git a/Assets/Scripts/CharacterCtrl.cs b/Assets/Scripts/CharacterCtrl.cs index 7a014bedc7..bf0c3cc872 100644 --- a/Assets/Scripts/CharacterCtrl.cs +++ b/Assets/Scripts/CharacterCtrl.cs @@ -93,32 +93,32 @@ public class CharacterCtrl : MonoBehaviour playerVelocity.y = 0f; } - float x = joystick.Horizontal; - float z = joystick.Vertical; + //float x = joystick.Horizontal; + //float z = joystick.Vertical; - Vector3 move = new Vector3(x, 0, z); - move = Vector3.ClampMagnitude(move, 1f); + //Vector3 move = new Vector3(x, 0, z); + //move = Vector3.ClampMagnitude(move, 1f); - if (move != Vector3.zero) - { - transform.forward = move; - if (isRun) - { - SetAnimRun(); - } - else - { - SetAnimWalk(); - } - } - else - { - SetAnimIdle(); - } + //if (move != Vector3.zero) + //{ + // transform.forward = move; + // if (isRun) + // { + // SetAnimRun(); + // } + // else + // { + // SetAnimWalk(); + // } + //} + //else + //{ + // SetAnimIdle(); + //} - playerVelocity.y += gravityValue * Time.deltaTime; - Vector3 finalMove = (move * playerSpeed) + (playerVelocity.y * Vector3.up); - controller.Move(finalMove * Time.deltaTime); + //playerVelocity.y += gravityValue * Time.deltaTime; + //Vector3 finalMove = (move * playerSpeed) + (playerVelocity.y * Vector3.up); + //controller.Move(finalMove * Time.deltaTime); } diff --git a/Assets/Scripts/GameController.cs b/Assets/Scripts/GameController.cs index 494a0a5aac..5098a43ea9 100644 --- a/Assets/Scripts/GameController.cs +++ b/Assets/Scripts/GameController.cs @@ -1,18 +1,47 @@ using CSNetwork.Protocols.RPCData; using System.Data; +using Unity.VisualScripting; using UnityEngine; public class GameController : MonoBehaviour { + private static GameController instance; + [SerializeField] private CharacterCtrl characterPrefab; [SerializeField] private Transform ground; Camera camera; + + public static GameController Instance + { + get + { + if (instance == null) + { + instance = new GameController(); + } + return instance; + } + } + + private void Awake() + { + if(instance == null) + { + instance = this; + } + } + private void Start() { camera = Camera.main; } + public void Log(string s) + { + Debug.LogError(s); + } + public void InitCharacter(RoleInfo roleInfo) { CharacterCtrl character = Instantiate(characterPrefab, transform);