From 6d73bf6e816570291865674bef8bce8972e4de3f Mon Sep 17 00:00:00 2001 From: xm <1271024303@qq.com> Date: 星期三, 01 十二月 2021 16:32:57 +0800 Subject: [PATCH] 2021-12-01-01 --- HDL_ON/Entity/Function/Scene.cs | 39 ++++++++++++++++++++++++++++++--------- 1 files changed, 30 insertions(+), 9 deletions(-) diff --git a/HDL_ON/Entity/Function/Scene.cs b/HDL_ON/Entity/Function/Scene.cs index 48481ec..684aad0 100644 --- a/HDL_ON/Entity/Function/Scene.cs +++ b/HDL_ON/Entity/Function/Scene.cs @@ -223,6 +223,18 @@ return "SceneData_" + sid; } } + + /// <summary> + /// 鎵ц鍊掕鏃� + /// </summary> + int countdownTime = 0; + /// <summary> + /// 閲嶇疆鎵ц鍊掕鏃� + /// </summary> + public void ResetCountdownTime() + { + countdownTime = 0; + } /// <summary> /// 鍦烘櫙鎵ц\鍊掕鏃� /// </summary> @@ -232,31 +244,30 @@ //鍦烘櫙姝e湪鍊掕鏃舵墽琛屼腑 if (LastExecutionTime != "" && Convert.ToDouble(LastExecutionTime) + Convert.ToDouble(delay) > Convert.ToDouble(Utlis.GetTimestamp(false))) { - int time = 0; int.TryParse(Convert.ToInt32( Convert.ToDouble(LastExecutionTime) + Convert.ToDouble(delay) - Convert.ToDouble(Utlis.GetTimestamp(false)) - ).ToString(), out time); - if (time > 0) + ).ToString(), out countdownTime); + if (countdownTime > 0) { new System.Threading.Thread(() => { - if (time > 0) + if (countdownTime > 0) { - while (time > 0) + while (countdownTime > 0) { Application.RunOnMainThread(() => { - if (time > 60) + if (countdownTime > 60) { - btnShowDelay.Text = (time / 60).ToString() + "min" + time % 60 + "s"; + btnShowDelay.Text = (countdownTime / 60).ToString() + "min" + countdownTime % 60 + "s"; } else { - btnShowDelay.Text = time.ToString() + "s"; + btnShowDelay.Text = countdownTime.ToString() + "s"; } }); System.Threading.Thread.Sleep(1000); - time--; + countdownTime--; } Application.RunOnMainThread(() => { @@ -317,6 +328,8 @@ var revPack = pm.EditScene(this); if (revPack.Code == StateCode.SUCCESS) { + //閲嶇疆鎵ц鍊掕鏃� + this.countdownTime = 0; if(MainPage.NoLoginMode) { var ssd = System.Text.Encoding.UTF8.GetBytes(Newtonsoft.Json.JsonConvert.SerializeObject(this)); @@ -338,10 +351,18 @@ /// </summary> public string UpdateScene() { + if(MainPage.NoLoginMode) + { + var ssd = System.Text.Encoding.UTF8.GetBytes(Newtonsoft.Json.JsonConvert.SerializeObject(this)); + Common.FileUtlis.Files.WriteFileByBytes(savePath, ssd); + + return "0"; + } var pm = new HttpServerRequest(); var revPack = pm.EditScene(this); if (revPack.Code == StateCode.SUCCESS) { + this.countdownTime = 0; var scenes = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Scene>>(revPack.Data.ToString()); var tempScene = scenes.Find((obj) => obj.sid == sid); if (tempScene != null) -- Gitblit v1.8.0