using System;
using System.Collections.Generic;
using Shared.Phone.UserCenter;
namespace Shared.Common
{
///
/// 场景
///
[System.Serializable]
public class SceneUI
{
#region ■ 变量声明_________________________
///
/// 场景文件
///
/// The name of the file.
[Newtonsoft.Json.JsonIgnore]
public string FileName
{
get
{
return $"Scene_{Id}.json";
}
}
///
/// 场景id
///
public int Id = -1;
///
/// 场景名
///
public string Name = string.Empty;
///
/// 图片路径
///
public string IconPath = "Scene/SceneDefault.png";
///
/// 图片来源 0--本地图库 1--拍照 2--系统图库
///
public int IconPathType = 0;
///
/// 延时执行时间--设备延时
///
public int DelayTime = 0;
///
/// 标识当前场景是否是分享的场景
///
public bool IsSharedScene = false;
///
/// 延时执行时间--整个场景延时(不是延时场景里面的执行目标)
/// 不序列化,重新打开APP置。即只对本次编辑场景延时执行有效
///
[Newtonsoft.Json.JsonIgnore]
public int SceneDelayTime = 0;
///
/// 剩余触发时间,单位秒
///
[Newtonsoft.Json.JsonIgnore]
public int RemainTime;
///
/// 延时时间线程是否运行
///
[Newtonsoft.Json.JsonIgnore]
public bool RemainThreadAction = false;
///
/// 场景执行目标
///
public List AdjustTargetList = new List();
#endregion
#region ■ 保存_____________________________
///
/// 保存
///
/// 是否备份
public void Save(bool autoBackup = true)
{
Global.WriteFileByBytesByHomeId(FileName, System.Text.Encoding.UTF8.GetBytes(Newtonsoft.Json.JsonConvert.SerializeObject(this)));
if (autoBackup == true)
{
HdlAutoBackupLogic.AddOrEditorFile(FileName);
}
}
#endregion
}
}