using System; using System.Collections.Generic; using System.Text; using CommonLang.Property; using CommonAI.Zone.ZoneEditor.EventTrigger; using CommonAI.Zone.ZoneEditor; using CommonLang.IO; using CommonLang.IO.Attribute; using CommonAI.Zone.EventTrigger; namespace CommonAI.ZoneEditor { [MessageType(0x4500)] [TableClassAttribute("Name")] public class ZoneVar : IExternalizable { public string Key; public object Value; public bool SyncToClient = false; public DescAttribute ValueDesc { get { return PropertyUtil.GetAttribute(Value.GetType()); } } public TypeDescAttribute BaseDesc { get { return AbstractValueTypeMap.GetBaseValueType(Value.GetType()); } } public override string ToString() { TypeDescAttribute desc = BaseDesc; if (desc != null) { return string.Format("环境变量[{0}] as {1}", Key, desc.Desc.Desc); } return string.Format("环境变量[{0}]", Key); } public void WriteExternal(IOutputStream output) { output.PutBool(SyncToClient); output.PutUTF(Key); output.PutObj2Xml(Value); } public void ReadExternal(IInputStream input) { this.SyncToClient = input.GetBool(); this.Key = input.GetUTF(); this.Value = input.GetXml2Obj(); } } }