using System.Collections; using System.Text.RegularExpressions; using IwbZero.IwbBase; using IwbZero.ToolCommon.StringModel; using Newtonsoft.Json; namespace WeEngine.CommonDto.WeInfo { public class WeSceneDto { public string Id { get; set; } public string No { get; set; } public string Name { get; set; } public string Path { get; set; } public string ParentPath { get; set; } public int SceneType { get; set; } public string SceneTag { get; set; } [JsonIgnore] public string _description; public string Description { get { if (Variables != null) { var reg = new Regex("@[0-9,a-z,A-Z]*"); var desc = reg.Replace(_description, match => match.ToString().ToUpper()); foreach (DictionaryEntry entry in Variables) { var variable = (IwbRtVariable)entry.Value; desc = desc.Replace(variable.VarName.ToUpper(), variable.GetStringValue()); } return desc; } return _description; } set => _description = value; } public string BehaviorNos { get; set; } public string VariableStr { get; set; } [JsonIgnore] public Hashtable _variables; public Hashtable Variables { get => _variables != null && _variables.Count > 0 ? _variables : GetVariable(); set => _variables = value; } public string EnvironResourceNos { get; set; } public string GuideNos { get; set; } protected Hashtable GetVariable() { if (VariableStr.IsNotEmpty()) { var table = new Hashtable(); var varArr = VariableStr.StrToArray(); foreach (var v in varArr) { var variable = IwbRtVariable.Str2Variable(v); table[variable.VarName] = variable; } return table; } return null; } } }