From 163bb1004901f6ba67d3fca056f9dc982e398f3c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E5=8F=B7=E6=95=AC?= <153802103@qq.com> Date: Fri, 20 Dec 2024 14:38:57 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B6=88=E9=98=B2=E6=A0=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- xiaofang/Assets/Scenes/Tmap 1.unity | 203 ++++++++++++------ .../Script/Character/Skills/UseSkill.cs | 23 +- .../Script/DirllInterface/getRoleList.cs | 17 +- xiaofang/Assets/Script/XFS.cs | 16 +- xiaofang/Assets/yhj/scripts/PicXFS.cs | 7 +- xiaofang/Assets/yhj/scripts/PlayerInit.cs | 27 +++ .../Assets/yhj/scripts/PlayerInit.cs.meta | 11 + 7 files changed, 218 insertions(+), 86 deletions(-) create mode 100644 xiaofang/Assets/yhj/scripts/PlayerInit.cs create mode 100644 xiaofang/Assets/yhj/scripts/PlayerInit.cs.meta diff --git a/xiaofang/Assets/Scenes/Tmap 1.unity b/xiaofang/Assets/Scenes/Tmap 1.unity index 94e2d123..175ab24c 100644 --- a/xiaofang/Assets/Scenes/Tmap 1.unity +++ b/xiaofang/Assets/Scenes/Tmap 1.unity @@ -5783,7 +5783,7 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 919132149155446097, guid: b4bc8a6718ad365439657b4dace25c94, type: 3} propertyPath: m_IsActive - value: 1 + value: 0 objectReference: {fileID: 0} - target: {fileID: 5866666021909216657, guid: b4bc8a6718ad365439657b4dace25c94, type: 3} propertyPath: m_Controller @@ -7049,7 +7049,7 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: ea9eb82687dfa674e883273cd7c73386, type: 3} m_Name: m_EditorClassIdentifier: - ain: {fileID: 1235957243} + ain: {fileID: 1948499803} characterState: 0 PlayerCollider: {fileID: 382802810} --- !u!114 &382802815 @@ -7141,7 +7141,7 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: b0e8bb916545c834b8981bdf116ec889, type: 3} m_Name: m_EditorClassIdentifier: - CharacterAnimator: {fileID: 1235957243} + CharacterAnimator: {fileID: 1948499803} player: {fileID: 382802812} relativePosition: {x: 0, y: 0, z: 0} relativeRotation: {x: 0, y: 0, z: 0} @@ -10809,6 +10809,10 @@ PrefabInstance: propertyPath: m_LocalEulerAnglesHint.z value: 0 objectReference: {fileID: 0} + - target: {fileID: 7951206211177526110, guid: 6815aad4cd6cb734a9d63a7210677333, type: 3} + propertyPath: m_IsActive + value: 1 + objectReference: {fileID: 0} m_RemovedComponents: [] m_SourcePrefab: {fileID: 100100000, guid: 6815aad4cd6cb734a9d63a7210677333, type: 3} --- !u!1001 &767724303 @@ -16093,11 +16097,6 @@ MeshCollider: m_Convex: 0 m_CookingOptions: 30 m_Mesh: {fileID: 4615132885752211150, guid: 0c9b084f2070bda45b87da961d2eb0f6, type: 3} ---- !u!95 &1235957243 stripped -Animator: - m_CorrespondingSourceObject: {fileID: 5866666021909216657, guid: b4bc8a6718ad365439657b4dace25c94, type: 3} - m_PrefabInstance: {fileID: 272025129} - m_PrefabAsset: {fileID: 0} --- !u!1001 &1238101222 PrefabInstance: m_ObjectHideFlags: 0 @@ -22619,10 +22618,10 @@ MonoBehaviour: Hand: {fileID: 1036449735} XFsTransform: {fileID: 1604673292} ShuiguanGameObject: {fileID: 0} - gun: {fileID: 0} firewater: {fileID: 8607906409360804035, guid: b5be25eadef55294691fff85129cc656, type: 3} water: {fileID: 0} IShavewater: 0 + UseSkill: {fileID: 0} --- !u!1001 &1402705621 PrefabInstance: m_ObjectHideFlags: 0 @@ -25428,7 +25427,7 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 44720823678ca7c42a08f4409ab025ff, type: 3} m_Name: m_EditorClassIdentifier: - serverIP: ws://192.168.3.110 + serverIP: ws://222.212.15.20:26214 serverPort: 8445 type: --- !u!114 &1526740604 @@ -25455,6 +25454,24 @@ MonoBehaviour: TaskJsonFile: {fileID: 4900000, guid: 4dec25769ed4ed3469693b1c881248af, type: 3} GlobalJsonFile: {fileID: 4900000, guid: 27ecc4e37cb448e45a2611c086cdfb90, type: 3} SelectsJsonFile: {fileID: 4900000, guid: 3efd15f4195557144a45659d2baa1ba3, type: 3} +--- !u!1 &1528375180 stripped +GameObject: + m_CorrespondingSourceObject: {fileID: 919132149155446097, guid: ffc8f56811d7ca145812ba1f6a4be23a, type: 3} + m_PrefabInstance: {fileID: 1893189251} + m_PrefabAsset: {fileID: 0} +--- !u!65 &1528375184 +BoxCollider: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1528375180} + m_Material: {fileID: 0} + m_IsTrigger: 0 + m_Enabled: 1 + serializedVersion: 2 + m_Size: {x: 0.18731062, y: 0.18804662, z: 0.486349} + m_Center: {x: -0.0000009536743, y: 0.0000018291175, z: 0.0000000074505793} --- !u!1001 &1542437476 PrefabInstance: m_ObjectHideFlags: 0 @@ -25517,6 +25534,52 @@ Transform: m_CorrespondingSourceObject: {fileID: 401048, guid: 6a749781e5f719745a7ea468af7bc0d7, type: 3} m_PrefabInstance: {fileID: 1542437476} m_PrefabAsset: {fileID: 0} +--- !u!1 &1545698124 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1545698126} + - component: {fileID: 1545698125} + m_Layer: 0 + m_Name: BurstCollisionWorld + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &1545698125 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1545698124} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: f1a161c4294214a4fbcb7e9e94800494, type: 3} + m_Name: + m_EditorClassIdentifier: + cellSpans: + m_AlignBytes: 16 +--- !u!4 &1545698126 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1545698124} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 38 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!64 &1546963728 MeshCollider: m_ObjectHideFlags: 0 @@ -28988,14 +29051,14 @@ MonoBehaviour: ConnectGun: {fileID: 947202401} ConnectFa: {fileID: 1301153375} OpenFa: {fileID: 1039752002} - Gun: {fileID: 919132149155446097, guid: ffc8f56811d7ca145812ba1f6a4be23a, type: 3} + Gun: {fileID: 1528375180} Hand: {fileID: 1036449735} XFsTransform: {fileID: 1604673292} ShuiguanGameObject: {fileID: 2057924365745864530} - gun: {fileID: 0} firewater: {fileID: 8607906409360804035, guid: b5be25eadef55294691fff85129cc656, type: 3} water: {fileID: 0} IShavewater: 0 + UseSkill: {fileID: 382802817} --- !u!1001 &1875190416 PrefabInstance: m_ObjectHideFlags: 0 @@ -29360,6 +29423,67 @@ MeshFilter: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 1891011313} m_Mesh: {fileID: 10209, guid: 0000000000000000e000000000000000, type: 0} +--- !u!1001 &1893189251 +PrefabInstance: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + m_TransformParent: {fileID: 1855712068} + m_Modifications: + - target: {fileID: -8679921383154817045, guid: ffc8f56811d7ca145812ba1f6a4be23a, type: 3} + propertyPath: m_RootOrder + value: 2 + objectReference: {fileID: 0} + - target: {fileID: -8679921383154817045, guid: ffc8f56811d7ca145812ba1f6a4be23a, type: 3} + propertyPath: m_LocalPosition.x + value: -0.338 + objectReference: {fileID: 0} + - target: {fileID: -8679921383154817045, guid: ffc8f56811d7ca145812ba1f6a4be23a, type: 3} + propertyPath: m_LocalPosition.y + value: 0.447 + objectReference: {fileID: 0} + - target: {fileID: -8679921383154817045, guid: ffc8f56811d7ca145812ba1f6a4be23a, type: 3} + propertyPath: m_LocalPosition.z + value: -0.099 + objectReference: {fileID: 0} + - target: {fileID: -8679921383154817045, guid: ffc8f56811d7ca145812ba1f6a4be23a, type: 3} + propertyPath: m_LocalRotation.w + value: 0 + objectReference: {fileID: 0} + - target: {fileID: -8679921383154817045, guid: ffc8f56811d7ca145812ba1f6a4be23a, type: 3} + propertyPath: m_LocalRotation.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: -8679921383154817045, guid: ffc8f56811d7ca145812ba1f6a4be23a, type: 3} + propertyPath: m_LocalRotation.y + value: 1 + objectReference: {fileID: 0} + - target: {fileID: -8679921383154817045, guid: ffc8f56811d7ca145812ba1f6a4be23a, type: 3} + propertyPath: m_LocalRotation.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: -8679921383154817045, guid: ffc8f56811d7ca145812ba1f6a4be23a, type: 3} + propertyPath: m_LocalEulerAnglesHint.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: -8679921383154817045, guid: ffc8f56811d7ca145812ba1f6a4be23a, type: 3} + propertyPath: m_LocalEulerAnglesHint.y + value: 180 + objectReference: {fileID: 0} + - target: {fileID: -8679921383154817045, guid: ffc8f56811d7ca145812ba1f6a4be23a, type: 3} + propertyPath: m_LocalEulerAnglesHint.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 919132149155446097, guid: ffc8f56811d7ca145812ba1f6a4be23a, type: 3} + propertyPath: m_Name + value: gun + objectReference: {fileID: 0} + - target: {fileID: 919132149155446097, guid: ffc8f56811d7ca145812ba1f6a4be23a, type: 3} + propertyPath: m_TagString + value: CanPick + objectReference: {fileID: 0} + m_RemovedComponents: [] + m_SourcePrefab: {fileID: 100100000, guid: ffc8f56811d7ca145812ba1f6a4be23a, type: 3} --- !u!64 &1894669586 MeshCollider: m_ObjectHideFlags: 0 @@ -29566,7 +29690,7 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 919132149155446097, guid: 6def8c21980f20945bbf5eeab570702a, type: 3} propertyPath: m_IsActive - value: 0 + value: 1 objectReference: {fileID: 0} - target: {fileID: 5866666021909216657, guid: 6def8c21980f20945bbf5eeab570702a, type: 3} propertyPath: m_Controller @@ -29583,6 +29707,11 @@ Transform: m_CorrespondingSourceObject: {fileID: -8679921383154817045, guid: 6def8c21980f20945bbf5eeab570702a, type: 3} m_PrefabInstance: {fileID: 1948499801} m_PrefabAsset: {fileID: 0} +--- !u!95 &1948499803 stripped +Animator: + m_CorrespondingSourceObject: {fileID: 5866666021909216657, guid: 6def8c21980f20945bbf5eeab570702a, type: 3} + m_PrefabInstance: {fileID: 1948499801} + m_PrefabAsset: {fileID: 0} --- !u!1001 &1953218132 PrefabInstance: m_ObjectHideFlags: 0 @@ -29659,52 +29788,6 @@ MeshCollider: m_Convex: 0 m_CookingOptions: 30 m_Mesh: {fileID: 8711619002567319047, guid: 0c9b084f2070bda45b87da961d2eb0f6, type: 3} ---- !u!1 &1955451351 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 1955451353} - - component: {fileID: 1955451352} - m_Layer: 0 - m_Name: BurstCollisionWorld - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!114 &1955451352 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1955451351} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: f1a161c4294214a4fbcb7e9e94800494, type: 3} - m_Name: - m_EditorClassIdentifier: - cellSpans: - m_AlignBytes: 16 ---- !u!4 &1955451353 -Transform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1955451351} - m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} - m_LocalPosition: {x: 0, y: 0, z: 0} - m_LocalScale: {x: 1, y: 1, z: 1} - m_ConstrainProportionsScale: 0 - m_Children: [] - m_Father: {fileID: 0} - m_RootOrder: 38 - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1001 &1955845891 PrefabInstance: m_ObjectHideFlags: 0 @@ -41205,7 +41288,7 @@ RectTransform: m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 1, y: 1} - m_AnchoredPosition: {x: 0, y: 0.0009460449} + m_AnchoredPosition: {x: 0, y: -0.000091552734} m_SizeDelta: {x: 0, y: 0} m_Pivot: {x: 0, y: 1} --- !u!1 &5723411037200588897 diff --git a/xiaofang/Assets/Script/Character/Skills/UseSkill.cs b/xiaofang/Assets/Script/Character/Skills/UseSkill.cs index 53adb39f..05586585 100644 --- a/xiaofang/Assets/Script/Character/Skills/UseSkill.cs +++ b/xiaofang/Assets/Script/Character/Skills/UseSkill.cs @@ -13,7 +13,7 @@ public class UseSkill : MonoBehaviour //private CharacterAin CharacterAin; // 玩家手中当前持有的物品 - [HideInInspector] + //[HideInInspector] public GameObject currentItem = null; public Skill_Pick _skill_Pick; @@ -37,6 +37,12 @@ public class UseSkill : MonoBehaviour Skill_Pick(); } + //连接水管 + public void Initgun(GameObject ob) + { + currentItem = _skill_Pick.Pick(); + currentItem.transform.localRotation = new Quaternion(0, 180, 0, 0); + } //拾取 void Skill_Pick() @@ -71,12 +77,25 @@ public class UseSkill : MonoBehaviour { _skill_Watering.StartWatering(currentItem); - + if (currentItem.gameObject.name == "gun") + { + if (XFS.instance.IShavewater) + { + XFS.instance.water.SetActive(true); + } + } } if (Input.GetMouseButtonUp(0)) { _skill_Watering.StopWatering(currentItem); + if (currentItem.gameObject.name == "gun") + { + if (XFS.instance.IShavewater) + { + XFS.instance.water.SetActive(false); + } + } } } diff --git a/xiaofang/Assets/Script/DirllInterface/getRoleList.cs b/xiaofang/Assets/Script/DirllInterface/getRoleList.cs index b9c9bc04..238312d3 100644 --- a/xiaofang/Assets/Script/DirllInterface/getRoleList.cs +++ b/xiaofang/Assets/Script/DirllInterface/getRoleList.cs @@ -6,29 +6,24 @@ using UnityEngine; public class getRoleList : MonoBehaviour { + // 创建请求头,使用最新的 token // 创建请求头,使用最新的 token public Dictionary CreateHeaders() { - - if (string.IsNullOrEmpty(MyGlobal.global.loginResponse.data.access_token)) - { - Debug.LogWarning("尝试创建请求头时,token 未设置。"); - return new Dictionary(); - } - + Debug.Log("====5555=====" + GlobalData.ServerData.data.access_token); return new Dictionary { - { "Authorization","Bearer "+MyGlobal.global.loginResponse.data.access_token }, + { "Authorization","Bearer "+GlobalData.ServerData.data.access_token }, {"clientId", "e5cd7e4891bf95d1d19206ce24a7b32e" } }; } //角色列表 public async void queryRoleList(string secneId) { - getRoleListBody getRoleListBody = new getRoleListBody(); - getRoleListBody.sceneId = secneId;//============================================================================== - string response = await web.SendRequest(web.URL + "/game/role/list", "GET", JsonConvert.SerializeObject(getRoleListBody), CreateHeaders()); + //getRoleListBody getRoleListBody = new getRoleListBody(); + //getRoleListBody.sceneId = secneId;//============================================================================== + string response = await web.SendRequest(web.URL + "/game/role/list?sceneId=" + secneId, "GET","{}", CreateHeaders()); Debug.Log("查询角色列表: " + response); RoleList serverData = JsonConvert.DeserializeObject(response); diff --git a/xiaofang/Assets/Script/XFS.cs b/xiaofang/Assets/Script/XFS.cs index 0f0d05c6..0acfbcde 100644 --- a/xiaofang/Assets/Script/XFS.cs +++ b/xiaofang/Assets/Script/XFS.cs @@ -14,10 +14,11 @@ public class XFS : MonoBehaviour public Transform Hand; public Transform XFsTransform; public GameObject ShuiguanGameObject; - public GameObject gun; public GameObject firewater; public GameObject water; public bool IShavewater=false; + + public UseSkill UseSkill; void Start() { instance=this; @@ -28,27 +29,26 @@ public class XFS : MonoBehaviour public void connectGun() { - gun = Instantiate(Gun); - gun.transform.SetParent(Hand); - gun.transform.localRotation = new Quaternion(0, 180, 0, 0); - gun.transform.localPosition = new Vector3(0.000419999997f, 0.00138999999f, 0.000569999975f); - gun.transform.localScale = new Vector3(0.01f, 0.01f, 0.01f); + UseSkill.Initgun(Gun); + } public void connectFa() { Solver solver = ShuiguanGameObject.GetComponent(); - solver.INit(gun.transform); + solver.INit(Gun.transform); } public void openFa() { water = Instantiate(firewater); - water.transform.SetParent(gun.transform); + water.transform.SetParent(Gun.transform); water.transform.localPosition = new Vector3(0, 0, 0); water.transform.localRotation = new Quaternion(0, 180, 0, 0); + water.SetActive(false); IShavewater = true; + } // Update is called once per frame void Update() diff --git a/xiaofang/Assets/yhj/scripts/PicXFS.cs b/xiaofang/Assets/yhj/scripts/PicXFS.cs index 4dd80b74..fa13393e 100644 --- a/xiaofang/Assets/yhj/scripts/PicXFS.cs +++ b/xiaofang/Assets/yhj/scripts/PicXFS.cs @@ -13,15 +13,12 @@ public class PicXFS : MonoBehaviour public void picXFS() { - if(XFS.instance.gun==null) return; - XFS.instance.gun.transform.SetParent(this.transform.parent); - XFS.instance.gun.transform.position=this.transform.position; + } public void pickXFS() { - XFS.instance.gun.transform.SetParent(Hand.transform); - XFS.instance.gun.transform.localPosition = new Vector3(0, 0, 0); + } // Update is called once per frame void Update() diff --git a/xiaofang/Assets/yhj/scripts/PlayerInit.cs b/xiaofang/Assets/yhj/scripts/PlayerInit.cs new file mode 100644 index 00000000..1a16400a --- /dev/null +++ b/xiaofang/Assets/yhj/scripts/PlayerInit.cs @@ -0,0 +1,27 @@ +using System.Collections; +using System.Collections.Generic; +using Newtonsoft.Json.Bson; +using UnityEngine; + +public class PlayerInit : MonoBehaviour +{ + // Start is called before the first frame update + public GameObject playerpre; + void Start() + { + + } + + // Update is called once per frame + void Update() + { + + } + + void SetPlayer() + { + GameObject player = Instantiate(playerpre); + //player.transform.position = ; + + } +} diff --git a/xiaofang/Assets/yhj/scripts/PlayerInit.cs.meta b/xiaofang/Assets/yhj/scripts/PlayerInit.cs.meta new file mode 100644 index 00000000..eeefa91a --- /dev/null +++ b/xiaofang/Assets/yhj/scripts/PlayerInit.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 958460e2c70949944bf1643d10cc3cb8 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: