xm
2021-12-01 6d73bf6e816570291865674bef8bce8972e4de3f
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 @@
            //场景正在倒计时执行中
            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));
@@ -349,6 +362,7 @@
            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)