diff --git a/FuZhou_FirstPage/Assets/Resources/prefeb/tabItem.prefab b/FuZhou_FirstPage/Assets/Resources/prefeb/tabItem.prefab index ad047607..18911e12 100644 --- a/FuZhou_FirstPage/Assets/Resources/prefeb/tabItem.prefab +++ b/FuZhou_FirstPage/Assets/Resources/prefeb/tabItem.prefab @@ -59,7 +59,7 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: m_Material: {fileID: 0} - m_Color: {r: 1, g: 1, b: 1, a: 1} + m_Color: {r: 0.5801887, g: 0.7229245, b: 1, a: 1} m_RaycastTarget: 1 m_Maskable: 1 m_OnCullStateChanged: @@ -122,6 +122,21 @@ MonoBehaviour: m_StringArgument: m_BoolArgument: 0 m_CallState: 2 + - eventID: 4 + callback: + m_PersistentCalls: + m_Calls: + - m_Target: {fileID: 552651400290170770} + m_MethodName: Click + m_Mode: 0 + 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!1 &552651400213636529 GameObject: m_ObjectHideFlags: 0 diff --git a/FuZhou_FirstPage/Assets/Scenes/MainScene.unity b/FuZhou_FirstPage/Assets/Scenes/MainScene.unity index 83cfb3a2..6b4fd76a 100644 --- a/FuZhou_FirstPage/Assets/Scenes/MainScene.unity +++ b/FuZhou_FirstPage/Assets/Scenes/MainScene.unity @@ -1171,12 +1171,12 @@ PrefabInstance: - target: {fileID: 552651399343491238, guid: cafcce2d67c06934d8ffdce1ae1059fc, type: 3} propertyPath: m_Color.r - value: 1 + value: 0.5801887 objectReference: {fileID: 0} - target: {fileID: 552651399343491238, guid: cafcce2d67c06934d8ffdce1ae1059fc, type: 3} propertyPath: m_Color.g - value: 1 + value: 0.7229245 objectReference: {fileID: 0} - target: {fileID: 552651399343491238, guid: cafcce2d67c06934d8ffdce1ae1059fc, type: 3} @@ -2166,12 +2166,12 @@ PrefabInstance: - target: {fileID: 552651399343491238, guid: cafcce2d67c06934d8ffdce1ae1059fc, type: 3} propertyPath: m_Color.r - value: 1 + value: 0.5801887 objectReference: {fileID: 0} - target: {fileID: 552651399343491238, guid: cafcce2d67c06934d8ffdce1ae1059fc, type: 3} propertyPath: m_Color.g - value: 1 + value: 0.7229245 objectReference: {fileID: 0} - target: {fileID: 552651399343491238, guid: cafcce2d67c06934d8ffdce1ae1059fc, type: 3} @@ -4741,9 +4741,9 @@ MonoBehaviour: m_PersistentCalls: m_Calls: [] m_FontData: - m_Font: {fileID: 12800000, guid: dcc291d57ccc8074d92b2d97da31a875, type: 3} - m_FontSize: 20 - m_FontStyle: 3 + m_Font: {fileID: 12800000, guid: 43ab4162a30d8984db914784438e67b4, type: 3} + m_FontSize: 25 + m_FontStyle: 2 m_BestFit: 0 m_MinSize: 1 m_MaxSize: 40 diff --git a/FuZhou_FirstPage/Assets/Scripts/CityPanel.cs b/FuZhou_FirstPage/Assets/Scripts/CityPanel.cs index cc1f76df..c35a0692 100644 --- a/FuZhou_FirstPage/Assets/Scripts/CityPanel.cs +++ b/FuZhou_FirstPage/Assets/Scripts/CityPanel.cs @@ -2,6 +2,7 @@ using LitJson; using System.Collections; using System.Collections.Generic; +using System.Linq; using UnityEngine; public class CityPanel : MonoBehaviour @@ -12,6 +13,12 @@ public class CityPanel : MonoBehaviour /// public void Init(string custCodes) { + //删除所有模型 + GetComponentsInChildren(true).ToList().ForEach(a => + { + Destroy(a.gameObject); + }); + //获取关区下所有企业信息 string url = "http://"+FirstPanel.instance.serverIP+":4000/api/Corporation/GetAllPosition?customCodes="+custCodes; Debug.Log("获取企业模型:"+url); @@ -30,7 +37,7 @@ public class CityPanel : MonoBehaviour ModelItem.modelItemPrefb = Resources.Load("prefeb/modelItem"); } GameObject go = Instantiate(ModelItem.modelItemPrefb, transform); - go.GetComponent().Init(v); + go.GetComponent().Init(v,GetComponent()); } } diff --git a/FuZhou_FirstPage/Assets/Scripts/Item/CustomItem.cs b/FuZhou_FirstPage/Assets/Scripts/Item/CustomItem.cs index 3d8dbe4b..41641566 100644 --- a/FuZhou_FirstPage/Assets/Scripts/Item/CustomItem.cs +++ b/FuZhou_FirstPage/Assets/Scripts/Item/CustomItem.cs @@ -1,5 +1,6 @@ using System.Collections; using System.Collections.Generic; +using System.Linq; using UnityEngine; using UnityEngine.EventSystems; using UnityEngine.UI; @@ -27,11 +28,7 @@ public class CustomItem : MonoBehaviour shi_Panel.gameObject.SetActive(false); btn.onClick.AddListener(() => { - //进入市一级 - shi_Panel.gameObject.SetActive(true); - shi_Panel.Init(Custom_Code); - FirstPanel.instance.tab.SetActive(false); - FirstPanel.instance.sheng_Panel.SetActive(false); + EnterCity(); }); } @@ -44,4 +41,18 @@ public class CustomItem : MonoBehaviour { icon.sprite = nochoseSprite; } + + /// + /// 进入市一级 + /// + public void EnterCity() + { + FirstPanel.instance.citys.transform.GetComponentsInChildren().ToList().ForEach(a => + { + a.gameObject.SetActive(false); + }); + shi_Panel.gameObject.SetActive(true); + shi_Panel.Init(Custom_Code); + FirstPanel.instance.sheng_Panel.SetActive(false); + } } diff --git a/FuZhou_FirstPage/Assets/Scripts/Item/ModelItem.cs b/FuZhou_FirstPage/Assets/Scripts/Item/ModelItem.cs index 0b6020f4..369212f6 100644 --- a/FuZhou_FirstPage/Assets/Scripts/Item/ModelItem.cs +++ b/FuZhou_FirstPage/Assets/Scripts/Item/ModelItem.cs @@ -19,11 +19,11 @@ public class ModelItem : MonoBehaviour /// public static GameObject modelItemPrefb; - public void Init(v_model_version modelData) + public void Init(v_model_version modelData,RectTransform citytrans) { this.modelData = modelData; text.text = modelData.ModelName; - GetComponent().anchoredPosition = new Vector2(float.Parse(modelData.MapLongitude), float.Parse(modelData.MapLatitude)); + GetComponent().anchoredPosition = new Vector2(float.Parse(modelData.MapLongitude)* citytrans.rect.width, float.Parse(modelData.MapLatitude)* citytrans.rect.height); btn.onClick.AddListener(() => { diff --git a/FuZhou_FirstPage/Assets/Scripts/Item/TabItem.cs b/FuZhou_FirstPage/Assets/Scripts/Item/TabItem.cs index f2c993b1..62bcb8fe 100644 --- a/FuZhou_FirstPage/Assets/Scripts/Item/TabItem.cs +++ b/FuZhou_FirstPage/Assets/Scripts/Item/TabItem.cs @@ -22,8 +22,9 @@ public class TabItem : MonoBehaviour //联动 if (customItem != null) { - nameText.fontSize = 18; + nameText.fontSize = 20; nameText.font = choseFont; + nameText.color= Color.white; customItem.PointIn(null); } } @@ -37,7 +38,16 @@ public class TabItem : MonoBehaviour { nameText.fontSize = 15; nameText.font = nochoseFont; + nameText.color = new Color(148f / 255f, 184f / 255f, 1, 1); customItem.PointOut(null); } } + + public void Click(BaseEventData data) + { + if (customItem != null) + { + customItem.EnterCity(); + } + } }