From e47c35dfcca0e252a875e722aaf36fcddcaa9580 Mon Sep 17 00:00:00 2001 From: chenxiangxue <910695411@qq.com> Date: Fri, 19 Jul 2024 09:49:00 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8F=AF=E4=BB=A5=E5=8F=AF=E4=BB=A5=E8=8A=B1?= =?UTF-8?q?=E8=A7=81=E8=8A=B1=E5=BC=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- FuZhou_FirstPage/Assets/Scripts/FirstPanel.cs | 32 ++++++++++++++++--- .../Assets/Scripts/WorkPlacePanel.cs | 3 +- 2 files changed, 29 insertions(+), 6 deletions(-) diff --git a/FuZhou_FirstPage/Assets/Scripts/FirstPanel.cs b/FuZhou_FirstPage/Assets/Scripts/FirstPanel.cs index 5b56934b..39f131ee 100644 --- a/FuZhou_FirstPage/Assets/Scripts/FirstPanel.cs +++ b/FuZhou_FirstPage/Assets/Scripts/FirstPanel.cs @@ -1,6 +1,9 @@ -using System; +using Competition.Mysql.Other; +using LitJson; +using System; using System.Collections; using System.Collections.Generic; +using System.IO; using System.Linq; using UnityEngine; using UnityEngine.Networking; @@ -46,6 +49,11 @@ public class FirstPanel : MonoBehaviour /// [HideInInspector] public string serverIP; + + /// + /// 福清办事处配置 + /// + public string fuqingWorkPlaceJson; /// /// 当前选中的海关 /// @@ -67,6 +75,14 @@ public class FirstPanel : MonoBehaviour { a.gameObject.SetActive(false); }); + //重置办事处item + FirstPanel.instance.workPlace.transform.GetComponentsInChildren().ToList().ForEach(a => + { + a.gameObject.SetActive(false); + }); + //关闭所有办事处 + FirstPanel.instance.workPlace.SetActive(false); + //取消所有标签选中 FirstPanel.instance.tab.GetComponentsInChildren().ToList().ForEach(a => { @@ -76,13 +92,21 @@ public class FirstPanel : MonoBehaviour Debug.Log("调前端回到首页"); }); - //初始化 - Application.ExternalCall("OnWake"); - #if UNITY_EDITOR serverIP = "111.229.30.246"; #endif + + string path =Application.streamingAssetsPath + "/驻福清办事处.txt"; + StartCoroutine(FirstPanel.instance.CallGet(path, (isok, result) => + { + if (isok) + { + fuqingWorkPlaceJson = result; + Debug.Log("福清配置读取成功:"+ fuqingWorkPlaceJson); + } + })); } + /// /// 前端调用初始化传IP diff --git a/FuZhou_FirstPage/Assets/Scripts/WorkPlacePanel.cs b/FuZhou_FirstPage/Assets/Scripts/WorkPlacePanel.cs index f068fc75..4abea6ce 100644 --- a/FuZhou_FirstPage/Assets/Scripts/WorkPlacePanel.cs +++ b/FuZhou_FirstPage/Assets/Scripts/WorkPlacePanel.cs @@ -54,8 +54,7 @@ public class WorkPlacePanel : MonoBehaviour else if (workPlaceItem.workPlaceName == "פ´") { //ȡļ - string json = File.ReadAllText(Application.streamingAssetsPath + "/פ´.txt"); - List tmpComps = JsonMapper.ToObject>(json); + List tmpComps = JsonMapper.ToObject>(FirstPanel.instance.fuqingWorkPlaceJson); showAll.AddRange(tmpComps); }