| | |
| | | }
|
| | |
|
| | | return sceneUIs;
|
| | | }
|
| | |
|
| | | #endregion
|
| | |
|
| | | #region ■ 调用场景___________________________
|
| | |
|
| | | /// <summary>
|
| | | /// 调用场景
|
| | | /// </summary>
|
| | | /// <param name="scene"></param>
|
| | | /// <returns></returns>
|
| | | public async Task<bool> ControlScene(SceneUI scene)
|
| | | {
|
| | | if (scene.RemainTime > 0)
|
| | | {
|
| | | HdlThreadLogic.Current.RunMain(() =>
|
| | | {
|
| | | //该场景正在延时,请稍后
|
| | | var msgContr = new ShowMsgControl(ShowMsgType.Tip, Language.StringByID(R.MyInternationalizationString.TheSceneIsDelaying));
|
| | | msgContr.Show();
|
| | | });
|
| | | return false;
|
| | | }
|
| | | //执行调用场景
|
| | | var result = await Scene.ControlSceneAsync(scene.Id, scene.SceneDelayTime);
|
| | | if (result == null || result.sceneOpenData == null)
|
| | | {
|
| | | //控制场景失败
|
| | | string msg = Language.StringByID(R.MyInternationalizationString.ControlSceneFail);
|
| | | //拼接上【网关回复超时】的Msg
|
| | | msg = UserCenterLogic.CombineGatewayTimeOutMsg(msg, result);
|
| | | HdlThreadLogic.Current.RunMain(() =>
|
| | | {
|
| | | //该场景正在延时,请稍后
|
| | | var msgContr = new ShowMsgControl(ShowMsgType.Tip, msg);
|
| | | msgContr.Show();
|
| | | });
|
| | | return false;
|
| | | }
|
| | | if (result.sceneOpenData.Result == 0)
|
| | | {
|
| | | //控制场景失败
|
| | | string msg = Language.StringByID(R.MyInternationalizationString.ControlSceneFail);
|
| | | HdlThreadLogic.Current.RunMain(() =>
|
| | | {
|
| | | //该场景正在延时,请稍后
|
| | | var msgContr = new ShowMsgControl(ShowMsgType.Tip, msg);
|
| | | msgContr.Show();
|
| | | });
|
| | | return false;
|
| | | }
|
| | | return true;
|
| | | }
|
| | |
|
| | | #endregion
|
| | |
|
| | | #region ■ 延时时间线程_______________________
|
| | |
|
| | | /// <summary>
|
| | | /// 开启延时时间线程(旨在全部地方的同一场景时间同步)
|
| | | /// </summary>
|
| | | public void StartDelayTimeThread(SceneUI i_scene)
|
| | | {
|
| | | if (i_scene.RemainThreadAction == true)
|
| | | {
|
| | | //线程在运行中
|
| | | return;
|
| | | }
|
| | | i_scene.RemainThreadAction = true;
|
| | |
|
| | | HdlThreadLogic.Current.RunThread(() =>
|
| | | {
|
| | | while (i_scene.RemainTime > 0)
|
| | | {
|
| | | System.Threading.Thread.Sleep(1000);
|
| | | i_scene.RemainTime--;
|
| | | }
|
| | | i_scene.RemainThreadAction = false;
|
| | | });
|
| | | }
|
| | |
|
| | | #endregion
|