This commit is contained in:
陈向学 2024-06-25 14:40:01 +08:00
parent bf40dd4732
commit d819e230bc
6 changed files with 60 additions and 17 deletions

View File

@ -59,7 +59,7 @@ MonoBehaviour:
m_Name: m_Name:
m_EditorClassIdentifier: m_EditorClassIdentifier:
m_Material: {fileID: 0} 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_RaycastTarget: 1
m_Maskable: 1 m_Maskable: 1
m_OnCullStateChanged: m_OnCullStateChanged:
@ -122,6 +122,21 @@ MonoBehaviour:
m_StringArgument: m_StringArgument:
m_BoolArgument: 0 m_BoolArgument: 0
m_CallState: 2 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 --- !u!1 &552651400213636529
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0

View File

@ -1171,12 +1171,12 @@ PrefabInstance:
- target: {fileID: 552651399343491238, guid: cafcce2d67c06934d8ffdce1ae1059fc, - target: {fileID: 552651399343491238, guid: cafcce2d67c06934d8ffdce1ae1059fc,
type: 3} type: 3}
propertyPath: m_Color.r propertyPath: m_Color.r
value: 1 value: 0.5801887
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 552651399343491238, guid: cafcce2d67c06934d8ffdce1ae1059fc, - target: {fileID: 552651399343491238, guid: cafcce2d67c06934d8ffdce1ae1059fc,
type: 3} type: 3}
propertyPath: m_Color.g propertyPath: m_Color.g
value: 1 value: 0.7229245
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 552651399343491238, guid: cafcce2d67c06934d8ffdce1ae1059fc, - target: {fileID: 552651399343491238, guid: cafcce2d67c06934d8ffdce1ae1059fc,
type: 3} type: 3}
@ -2166,12 +2166,12 @@ PrefabInstance:
- target: {fileID: 552651399343491238, guid: cafcce2d67c06934d8ffdce1ae1059fc, - target: {fileID: 552651399343491238, guid: cafcce2d67c06934d8ffdce1ae1059fc,
type: 3} type: 3}
propertyPath: m_Color.r propertyPath: m_Color.r
value: 1 value: 0.5801887
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 552651399343491238, guid: cafcce2d67c06934d8ffdce1ae1059fc, - target: {fileID: 552651399343491238, guid: cafcce2d67c06934d8ffdce1ae1059fc,
type: 3} type: 3}
propertyPath: m_Color.g propertyPath: m_Color.g
value: 1 value: 0.7229245
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 552651399343491238, guid: cafcce2d67c06934d8ffdce1ae1059fc, - target: {fileID: 552651399343491238, guid: cafcce2d67c06934d8ffdce1ae1059fc,
type: 3} type: 3}
@ -4741,9 +4741,9 @@ MonoBehaviour:
m_PersistentCalls: m_PersistentCalls:
m_Calls: [] m_Calls: []
m_FontData: m_FontData:
m_Font: {fileID: 12800000, guid: dcc291d57ccc8074d92b2d97da31a875, type: 3} m_Font: {fileID: 12800000, guid: 43ab4162a30d8984db914784438e67b4, type: 3}
m_FontSize: 20 m_FontSize: 25
m_FontStyle: 3 m_FontStyle: 2
m_BestFit: 0 m_BestFit: 0
m_MinSize: 1 m_MinSize: 1
m_MaxSize: 40 m_MaxSize: 40

View File

@ -2,6 +2,7 @@
using LitJson; using LitJson;
using System.Collections; using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq;
using UnityEngine; using UnityEngine;
public class CityPanel : MonoBehaviour public class CityPanel : MonoBehaviour
@ -12,6 +13,12 @@ public class CityPanel : MonoBehaviour
/// <param name="custCodes"></param> /// <param name="custCodes"></param>
public void Init(string custCodes) public void Init(string custCodes)
{ {
//删除所有模型
GetComponentsInChildren<ModelItem>(true).ToList().ForEach(a =>
{
Destroy(a.gameObject);
});
//获取关区下所有企业信息 //获取关区下所有企业信息
string url = "http://"+FirstPanel.instance.serverIP+":4000/api/Corporation/GetAllPosition?customCodes="+custCodes; string url = "http://"+FirstPanel.instance.serverIP+":4000/api/Corporation/GetAllPosition?customCodes="+custCodes;
Debug.Log("获取企业模型:"+url); Debug.Log("获取企业模型:"+url);
@ -30,7 +37,7 @@ public class CityPanel : MonoBehaviour
ModelItem.modelItemPrefb = Resources.Load<GameObject>("prefeb/modelItem"); ModelItem.modelItemPrefb = Resources.Load<GameObject>("prefeb/modelItem");
} }
GameObject go = Instantiate<GameObject>(ModelItem.modelItemPrefb, transform); GameObject go = Instantiate<GameObject>(ModelItem.modelItemPrefb, transform);
go.GetComponent<ModelItem>().Init(v); go.GetComponent<ModelItem>().Init(v,GetComponent<RectTransform>());
} }
} }

View File

@ -1,5 +1,6 @@
using System.Collections; using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq;
using UnityEngine; using UnityEngine;
using UnityEngine.EventSystems; using UnityEngine.EventSystems;
using UnityEngine.UI; using UnityEngine.UI;
@ -27,11 +28,7 @@ public class CustomItem : MonoBehaviour
shi_Panel.gameObject.SetActive(false); shi_Panel.gameObject.SetActive(false);
btn.onClick.AddListener(() => btn.onClick.AddListener(() =>
{ {
//进入市一级 EnterCity();
shi_Panel.gameObject.SetActive(true);
shi_Panel.Init(Custom_Code);
FirstPanel.instance.tab.SetActive(false);
FirstPanel.instance.sheng_Panel.SetActive(false);
}); });
} }
@ -44,4 +41,18 @@ public class CustomItem : MonoBehaviour
{ {
icon.sprite = nochoseSprite; icon.sprite = nochoseSprite;
} }
/// <summary>
/// 进入市一级
/// </summary>
public void EnterCity()
{
FirstPanel.instance.citys.transform.GetComponentsInChildren<CityPanel>().ToList().ForEach(a =>
{
a.gameObject.SetActive(false);
});
shi_Panel.gameObject.SetActive(true);
shi_Panel.Init(Custom_Code);
FirstPanel.instance.sheng_Panel.SetActive(false);
}
} }

View File

@ -19,11 +19,11 @@ public class ModelItem : MonoBehaviour
/// </summary> /// </summary>
public static GameObject modelItemPrefb; public static GameObject modelItemPrefb;
public void Init(v_model_version modelData) public void Init(v_model_version modelData,RectTransform citytrans)
{ {
this.modelData = modelData; this.modelData = modelData;
text.text = modelData.ModelName; text.text = modelData.ModelName;
GetComponent<RectTransform>().anchoredPosition = new Vector2(float.Parse(modelData.MapLongitude), float.Parse(modelData.MapLatitude)); GetComponent<RectTransform>().anchoredPosition = new Vector2(float.Parse(modelData.MapLongitude)* citytrans.rect.width, float.Parse(modelData.MapLatitude)* citytrans.rect.height);
btn.onClick.AddListener(() => btn.onClick.AddListener(() =>
{ {

View File

@ -22,8 +22,9 @@ public class TabItem : MonoBehaviour
//联动 //联动
if (customItem != null) if (customItem != null)
{ {
nameText.fontSize = 18; nameText.fontSize = 20;
nameText.font = choseFont; nameText.font = choseFont;
nameText.color= Color.white;
customItem.PointIn(null); customItem.PointIn(null);
} }
} }
@ -37,7 +38,16 @@ public class TabItem : MonoBehaviour
{ {
nameText.fontSize = 15; nameText.fontSize = 15;
nameText.font = nochoseFont; nameText.font = nochoseFont;
nameText.color = new Color(148f / 255f, 184f / 255f, 1, 1);
customItem.PointOut(null); customItem.PointOut(null);
} }
} }
public void Click(BaseEventData data)
{
if (customItem != null)
{
customItem.EnterCity();
}
}
} }