| | |
| | | /// <summary> |
| | | /// 场景 |
| | | /// </summary> |
| | | [System.Serializable] |
| | | [System.Serializable] |
| | | public class Scene : Common |
| | | { |
| | | public readonly static string GlobalSceneFilePath = "GlobalScene"; |
| | | static Scene () |
| | | { |
| | | Refresh (); |
| | | Refresh (); |
| | | } |
| | | |
| | | public static void Refresh() |
| | | public static void Refresh () |
| | | { |
| | | if (null == Newtonsoft.Json.JsonConvert.DeserializeObject<List<string>> (Encoding.UTF8.GetString (IO.FileUtils.ReadFile (GlobalSceneFilePath)))) { |
| | | //初始化房间列表 |
| | |
| | | { |
| | | this.Type = DeviceType.Scene; |
| | | DeviceTextID = SimpleControl.R.MyInternationalizationString.Scenes; |
| | | |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | /// <summary> |
| | | /// 场景唯一ID |
| | | /// </summary> |
| | | public string Sid = ""; |
| | | |
| | | /// <summary> |
| | | /// 场景小图标 |
| | |
| | | /// 场景的背景图 |
| | | /// </summary> |
| | | public string BackgroundImagePath = "Scene/s1.png"; |
| | | |
| | | /// <summary> |
| | | /// 场景保存路径 |
| | | /// </summary> |
| | | public string SceneFilePath = ""; |
| | | |
| | | /// <summary> |
| | | /// 根据场景路径恢复场景对象 |
| | |
| | | /// <param name="sceneFilePath">Scence file path.</param> |
| | | public void Save (string sceneFilePath) |
| | | { |
| | | if(string.IsNullOrEmpty(this.SceneFilePath) || this.SceneFilePath != sceneFilePath) { |
| | | this.SceneFilePath = sceneFilePath; |
| | | } |
| | | |
| | | IO.FileUtils.WriteFileByBytes (sceneFilePath, System.Text.Encoding.UTF8.GetBytes (Newtonsoft.Json.JsonConvert.SerializeObject (this))); |
| | | } |
| | | |
| | |
| | | //var ssfsdf = IO.FileUtils.ReadFile ("GlobalScene_busScene"); |
| | | //var cp = CommonPage.MyEncodingUTF8.GetString (ssfsdf); |
| | | } |
| | | |
| | | |
| | | } |
| | | } |