From 06a144fb6a06eae17c06632541b0aabddb6398da Mon Sep 17 00:00:00 2001 From: YangHua <1475658476@qq.com> Date: Thu, 14 Sep 2023 14:41:03 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0toolmodelclick=E5=A7=94?= =?UTF-8?q?=E6=89=98=E6=96=B9=E6=B3=95=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Assets/Adam/Scenes/UI.unity | 147 ++++++++++++++++++ .../Adam/Scripts/Components/ToolModelClick.cs | 32 +++- .../Assets/Adam/Scripts/Data/SceneData.cs | 27 ++++ .../Adam/Scripts/Data/SceneData.cs.meta | 11 ++ .../Assets/Adam/Scripts/Global.cs | 9 +- .../Adam/Scripts/GoToSceneController.cs | 8 +- 6 files changed, 223 insertions(+), 11 deletions(-) create mode 100644 Electrical_inspectionCompetitionSystem/Assets/Adam/Scripts/Data/SceneData.cs create mode 100644 Electrical_inspectionCompetitionSystem/Assets/Adam/Scripts/Data/SceneData.cs.meta diff --git a/Electrical_inspectionCompetitionSystem/Assets/Adam/Scenes/UI.unity b/Electrical_inspectionCompetitionSystem/Assets/Adam/Scenes/UI.unity index 8c95766a..548c8f56 100644 --- a/Electrical_inspectionCompetitionSystem/Assets/Adam/Scenes/UI.unity +++ b/Electrical_inspectionCompetitionSystem/Assets/Adam/Scenes/UI.unity @@ -34748,6 +34748,151 @@ CanvasRenderer: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 379312740} m_CullTransparentMesh: 1 +--- !u!1 &379354440 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 379354441} + - component: {fileID: 379354444} + - component: {fileID: 379354443} + - component: {fileID: 379354442} + m_Layer: 5 + m_Name: CloseBtn + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &379354441 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 379354440} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 0.49219194, y: 0.47440186, z: 0.47440186} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 7550337382994350724} + m_RootOrder: 2 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 1, y: 1} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: -6.9000244, y: 69.70001} + m_SizeDelta: {x: 100, y: 100} + m_Pivot: {x: 1, y: 1} +--- !u!114 &379354442 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 379354440} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 4e29b1a8efbd4b44bb3f3716e73f07ff, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Navigation: + m_Mode: 3 + m_WrapAround: 0 + m_SelectOnUp: {fileID: 0} + m_SelectOnDown: {fileID: 0} + m_SelectOnLeft: {fileID: 0} + m_SelectOnRight: {fileID: 0} + m_Transition: 1 + m_Colors: + m_NormalColor: {r: 1, g: 1, b: 1, a: 1} + m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} + m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1} + m_SelectedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} + m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608} + m_ColorMultiplier: 1 + m_FadeDuration: 0.1 + m_SpriteState: + m_HighlightedSprite: {fileID: 0} + m_PressedSprite: {fileID: 0} + m_SelectedSprite: {fileID: 0} + m_DisabledSprite: {fileID: 0} + m_AnimationTriggers: + m_NormalTrigger: Normal + m_HighlightedTrigger: Highlighted + m_PressedTrigger: Pressed + m_SelectedTrigger: Selected + m_DisabledTrigger: Disabled + m_Interactable: 1 + m_TargetGraphic: {fileID: 379354443} + m_OnClick: + m_PersistentCalls: + m_Calls: + - m_Target: {fileID: 5090827398298492658} + m_TargetAssemblyTypeName: UnityEngine.GameObject, UnityEngine + m_MethodName: SetActive + m_Mode: 6 + m_Arguments: + m_ObjectArgument: {fileID: 0} + m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine + m_IntArgument: 0 + m_FloatArgument: 0 + m_StringArgument: + m_BoolArgument: 0 + m_CallState: 2 + - m_Target: {fileID: 2047386840} + m_TargetAssemblyTypeName: UnityEngine.UI.Toggle, UnityEngine.UI + m_MethodName: set_isOn + m_Mode: 6 + m_Arguments: + m_ObjectArgument: {fileID: 0} + m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine + m_IntArgument: 0 + m_FloatArgument: 0 + m_StringArgument: + m_BoolArgument: 0 + m_CallState: 2 +--- !u!114 &379354443 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 379354440} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_Sprite: {fileID: 21300000, guid: c0aea48790b60784b81557d730ce388f, type: 3} + m_Type: 0 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 + m_UseSpriteMesh: 0 + m_PixelsPerUnitMultiplier: 1 +--- !u!222 &379354444 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 379354440} + m_CullTransparentMesh: 1 --- !u!1 &379643149 GameObject: m_ObjectHideFlags: 0 @@ -103214,6 +103359,7 @@ MonoBehaviour: m_EditorClassIdentifier: goToSceneBtn: {fileID: 111533111} userID: {fileID: 1653198359} + url: http://111.229.30.246:10013/Handler/Taiqu.ashx?action=changjing&bianhao= --- !u!114 &1067605746 MonoBehaviour: m_ObjectHideFlags: 0 @@ -201146,6 +201292,7 @@ RectTransform: m_Children: - {fileID: 6531847754770110265} - {fileID: 6346542558084323096} + - {fileID: 379354441} m_Father: {fileID: 1550143346451741042} m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} diff --git a/Electrical_inspectionCompetitionSystem/Assets/Adam/Scripts/Components/ToolModelClick.cs b/Electrical_inspectionCompetitionSystem/Assets/Adam/Scripts/Components/ToolModelClick.cs index af642a2a..8e83028b 100644 --- a/Electrical_inspectionCompetitionSystem/Assets/Adam/Scripts/Components/ToolModelClick.cs +++ b/Electrical_inspectionCompetitionSystem/Assets/Adam/Scripts/Components/ToolModelClick.cs @@ -1,6 +1,7 @@ using System.Collections; using System.Collections.Generic; using UnityEngine; +using UnityEngine.Events; using UnityEngine.EventSystems; //============================================================ //支持中文,文件使用UTF-8编码 @@ -49,11 +50,19 @@ public class ToolModelClick : MonoBehaviour public Attribute attribute = Attribute.defaultModel; public RightAndWrong rightAndWrong = RightAndWrong.defaultModel; - + public UnityEvent onEnter = new UnityEvent(); + public UnityEvent onDown = new UnityEvent(); + public UnityEvent onDrag = new UnityEvent(); + public UnityEvent onExit = new UnityEvent(); private void OnMouseEnter() { - + if (EventSystem.current.IsPointerOverGameObject()) + { + Debug.Log(EventSystem.current.gameObject.name); + return; + } + onEnter?.Invoke(); } private void OnMouseDown() @@ -63,12 +72,29 @@ public class ToolModelClick : MonoBehaviour Debug.Log(EventSystem.current.gameObject.name); return; } + onDown?.Invoke(); ToolsItemController.Instance.CreatToolItem(gameObject); Destroy(gameObject); } + + private void OnMouseDrag() + { + if (EventSystem.current.IsPointerOverGameObject()) + { + Debug.Log(EventSystem.current.gameObject.name); + return; + } + onDrag?.Invoke(); + } + private void OnMouseExit() { - + if (EventSystem.current.IsPointerOverGameObject()) + { + Debug.Log(EventSystem.current.gameObject.name); + return; + } + onExit?.Invoke(); } } diff --git a/Electrical_inspectionCompetitionSystem/Assets/Adam/Scripts/Data/SceneData.cs b/Electrical_inspectionCompetitionSystem/Assets/Adam/Scripts/Data/SceneData.cs new file mode 100644 index 00000000..cb345eff --- /dev/null +++ b/Electrical_inspectionCompetitionSystem/Assets/Adam/Scripts/Data/SceneData.cs @@ -0,0 +1,27 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; +//============================================================ +//支持中文,文件使用UTF-8编码 +//@author YangHua +//@create 20230914 +//@company QianHuo +// +//@description: +//============================================================ +namespace Data +{ + public class SceneData + { + public bool state; + public string message; + public Data data; + } + + public class Data + { + public string Isguangfu; + public string jxfs; + public string zhbl; + } +} diff --git a/Electrical_inspectionCompetitionSystem/Assets/Adam/Scripts/Data/SceneData.cs.meta b/Electrical_inspectionCompetitionSystem/Assets/Adam/Scripts/Data/SceneData.cs.meta new file mode 100644 index 00000000..d7c14559 --- /dev/null +++ b/Electrical_inspectionCompetitionSystem/Assets/Adam/Scripts/Data/SceneData.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: c96d0d2268ad8c74880afd201e2b46f6 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Electrical_inspectionCompetitionSystem/Assets/Adam/Scripts/Global.cs b/Electrical_inspectionCompetitionSystem/Assets/Adam/Scripts/Global.cs index 592c69e0..3f038c49 100644 --- a/Electrical_inspectionCompetitionSystem/Assets/Adam/Scripts/Global.cs +++ b/Electrical_inspectionCompetitionSystem/Assets/Adam/Scripts/Global.cs @@ -1,3 +1,4 @@ +using Data; using System.Collections; using System.Collections.Generic; using UnityEngine; @@ -10,11 +11,7 @@ using UnityEngine; //@description: //============================================================ -public class Global : MonoBehaviour +public static class Global { - // Use this for initialization - private void Start() - { - - } + } diff --git a/Electrical_inspectionCompetitionSystem/Assets/Adam/Scripts/GoToSceneController.cs b/Electrical_inspectionCompetitionSystem/Assets/Adam/Scripts/GoToSceneController.cs index ecd3c569..fb149686 100644 --- a/Electrical_inspectionCompetitionSystem/Assets/Adam/Scripts/GoToSceneController.cs +++ b/Electrical_inspectionCompetitionSystem/Assets/Adam/Scripts/GoToSceneController.cs @@ -1,3 +1,4 @@ +using Data; using System.Collections; using System.Collections.Generic; using UnityEngine; @@ -16,15 +17,18 @@ namespace QianHuo { public Button goToSceneBtn; public InputField userID; + public string url = "http://111.229.30.246:10013/Handler/Taiqu.ashx?action=changjing&bianhao="; // Use this for initialization private void Start() { + OnGo(); goToSceneBtn.onClick.AddListener(OnGo); } - public void OnGo() + public async void OnGo() { - + string _url = url + userID.text; + SceneData data = await AsyncWebReq.Get(_url); } } }