From 6a9ad7ec93218913a2ce3b898bb036f18f8f0da4 Mon Sep 17 00:00:00 2001 From: wxr <464027401@qq.com> Date: 星期四, 13 八月 2020 17:06:36 +0800 Subject: [PATCH] 20200813 --- HDL_ON/Entity/Room.cs | 74 +++++++++++++++++++++++-------------- 1 files changed, 46 insertions(+), 28 deletions(-) diff --git a/HDL_ON/Entity/Room.cs b/HDL_ON/Entity/Room.cs index 84d802a..c128f9e 100644 --- a/HDL_ON/Entity/Room.cs +++ b/HDL_ON/Entity/Room.cs @@ -4,11 +4,28 @@ namespace HDL_ON.Entity { + /// <summary> /// 鎴块棿瀵硅薄 - /// 鎴块棿鍛藉悕瑙勫垯 typeof (Room).Name + "_" + etNameBox.Text.Trim (); /// </summary> - [System.Serializable] + [Serializable] + public class Floor + { + /// <summary> + /// 妤煎眰鍚嶇О + /// </summary> + public string name = "1 F"; + /// <summary> + /// 妤煎眰ID + /// </summary> + public string sid; + } + + + /// <summary> + /// 鎴块棿瀵硅薄 + /// </summary> + [Serializable] public class Room { /// <summary> @@ -19,6 +36,10 @@ /// 鎴块棿ID /// </summary> public string sid; + /// <summary> + /// 妤煎眰绱㈠紩 + /// </summary> + public string floorId = ""; /// <summary> /// 鎴块棿鑳屾櫙 @@ -27,43 +48,40 @@ /// <summary> /// 妤煎眰 /// </summary> - public string floor { + public string floor + { get { - string str = ""; - if (floorIndex != -1) + if (DB_ResidenceData.residenceData.floors.Count > 0) { - if (floorIndex < DB_ResidenceData.residenceData.floors.Count) - str = DB_ResidenceData.residenceData.floors[floorIndex]; + var f = DB_ResidenceData.residenceData.floors.Find((obj) => obj.sid == floorId); + if (f != null) + { + return f.name; + } } - return str; + return ""; } } - /// <summary> - /// 妤煎眰绱㈠紩 - /// </summary> - public int floorIndex = -1; - /// <summary> - /// 鎴块棿娣诲姞鐨勫姛鑳藉垪琛� - /// 淇濆瓨鍔熻兘ID - /// </summary> - public List<string> roomFunctionList = new List<string>(); + /// <summary> /// 鎴块棿鍔熻兘鍒楄〃 /// </summary> [Newtonsoft.Json.JsonIgnore] public List<Function> functions = new List<Function>(); - /// <summary> - /// 鎴块棿娣诲姞鐨勫満鏅垪琛� - /// 淇濆瓨鍦烘櫙ID - /// </summary> - public List<string> roomSceneList = new List<string>(); - /// <summary> - /// 鎴块棿鍦烘櫙鍒楄〃 - /// </summary> - [Newtonsoft.Json.JsonIgnore] - public List<Scene> scenes = new List<Scene>(); + public void RefreshFunctions() + { + List<Function> funcList = new List<Function>(); + foreach (var f in DB_ResidenceData.residenceData.functionList.functions) + { + if (f.roomIdList.Contains(sid) && sid != null) + { + funcList.Add(f); + } + } + functions = funcList; + } } -} +} \ No newline at end of file -- Gitblit v1.8.0