using System; using System.Collections.Generic; using System.Linq; using System.Text; using CommonLang.Property; using CommonAI.Zone.Attributes; using CommonAI.Zone.Instance; using CommonAI.RTS; using CommonLang.Vector; using CommonAI.Zone.EventTrigger; namespace CommonAI.Zone.ZoneEditor.EventTrigger { [DescAttribute("", "设置 - 环境变量")] public abstract class SetEnvironmentVar : AbstractAction { abstract public string TKey { get; } abstract public AbstractValue TValue { get; } public override string ToString() { return string.Format("设置环境变量\"{0}\"={1}", TKey, TValue); } override public void DoAction(EventTriggerAdapter api, EventArguments args) { T value = TValue.GetValue(api, args); api.ZoneAPI.SetEnvironmentVar(TKey, value); } } [DescAttribute("设置字符串型", "设置 - 环境变量")] public class SetEnvironmentString : SetEnvironmentVar { [SceneVarIDAttribute(typeof(StringValue))] [DescAttribute("变量名")] public string Key = "VarName"; [DescAttribute("变量值")] public StringValue Value = new StringValue.VALUE("text"); override public AbstractValue TValue { get { return Value; } } override public string TKey { get { return Key; } } } [DescAttribute("设置整数型", "设置 - 环境变量")] public class SetEnvironmentInteger : SetEnvironmentVar { [SceneVarIDAttribute(typeof(IntegerValue))] [DescAttribute("变量名")] public string Key = "VarName"; [DescAttribute("变量值")] public IntegerValue Value = new IntegerValue.VALUE(); override public AbstractValue TValue { get { return Value; } } override public string TKey { get { return Key; } } } [DescAttribute("设置小数型", "设置 - 环境变量")] public class SetEnvironmentReal : SetEnvironmentVar { [SceneVarIDAttribute(typeof(RealValue))] [DescAttribute("变量名")] public string Key = "VarName"; [DescAttribute("变量值")] public RealValue Value = new RealValue.VALUE(); override public AbstractValue TValue { get { return Value; } } override public string TKey { get { return Key; } } } [DescAttribute("设置布尔型", "设置 - 环境变量")] public class SetEnvironmentBool : SetEnvironmentVar { [SceneVarIDAttribute(typeof(BooleanValue))] [DescAttribute("变量名")] public string Key = "VarName"; [DescAttribute("变量值")] public BooleanValue Value = new BooleanValue.VALUE(); override public AbstractValue TValue { get { return Value; } } override public string TKey { get { return Key; } } } [DescAttribute("设置单位", "设置 - 环境变量")] public class SetEnvironmentUnit : SetEnvironmentVar { [SceneVarIDAttribute(typeof(UnitValue))] [DescAttribute("变量名")] public string Key = "VarName"; [DescAttribute("变量值")] public UnitValue Value = new UnitValue.NA(); override public AbstractValue TValue { get { return Value; } } override public string TKey { get { return Key; } } } [DescAttribute("设置Flag", "设置 - 环境变量")] public class SetEnvironmentFlag : SetEnvironmentVar { [SceneVarIDAttribute(typeof(FlagValue))] [DescAttribute("变量名")] public string Key = "VarName"; [DescAttribute("变量值")] public FlagValue Value = new FlagValue.NA(); override public AbstractValue TValue { get { return Value; } } override public string TKey { get { return Key; } } } [DescAttribute("设置物品", "设置 - 环境变量")] public class SetEnvironmentItem : SetEnvironmentVar { [SceneVarIDAttribute(typeof(ItemValue))] [DescAttribute("变量名")] public string Key = "VarName"; [DescAttribute("变量值")] public ItemValue Value = new ItemValue.NA(); override public AbstractValue TValue { get { return Value; } } override public string TKey { get { return Key; } } } [DescAttribute("设置位置坐标", "设置 - 环境变量")] public class SetEnvironmentPosition : SetEnvironmentVar { [SceneVarIDAttribute(typeof(PositionValue))] [DescAttribute("变量名")] public string Key = "VarName"; [DescAttribute("变量值")] public PositionValue Value = new PositionValue.VALUE(); override public AbstractValue TValue { get { return Value; } } override public string TKey { get { return Key; } } } //--------------------------------------------------------------------------------------------------- [DescAttribute("", "设置 - 环境变量")] public abstract class SetEnvironmentVarSV : AbstractAction { abstract public StringValue TKey { get; } abstract public AbstractValue TValue { get; } public override string ToString() { return string.Format("设置环境变量\"{0}\"={1}", TKey, TValue); } override public void DoAction(EventTriggerAdapter api, EventArguments args) { T value = TValue.GetValue(api, args); api.ZoneAPI.SetEnvironmentVar(TKey.GetValue(api, args), value); } } [DescAttribute("设置字符串型(变量)", "设置 - 环境变量")] public class SetEnvironmentStringSV : SetEnvironmentVarSV { [DescAttribute("变量名")] public StringValue Key = new StringValue.VALUE("VarName"); [DescAttribute("变量值")] public StringValue Value = new StringValue.VALUE("text"); override public AbstractValue TValue { get { return Value; } } override public StringValue TKey { get { return Key; } } } [DescAttribute("设置整数型(变量)", "设置 - 环境变量")] public class SetEnvironmentIntegerSV : SetEnvironmentVarSV { [DescAttribute("变量名")] public StringValue Key = new StringValue.VALUE("VarName"); [DescAttribute("变量值")] public IntegerValue Value = new IntegerValue.VALUE(); override public AbstractValue TValue { get { return Value; } } override public StringValue TKey { get { return Key; } } } [DescAttribute("设置小数型(变量)", "设置 - 环境变量")] public class SetEnvironmentRealSV : SetEnvironmentVarSV { [DescAttribute("变量名")] public StringValue Key = new StringValue.VALUE("VarName"); [DescAttribute("变量值")] public RealValue Value = new RealValue.VALUE(); override public AbstractValue TValue { get { return Value; } } override public StringValue TKey { get { return Key; } } } [DescAttribute("设置布尔型(变量)", "设置 - 环境变量")] public class SetEnvironmentBoolSV : SetEnvironmentVarSV { [DescAttribute("变量名")] public StringValue Key = new StringValue.VALUE("VarName"); [DescAttribute("变量值")] public BooleanValue Value = new BooleanValue.VALUE(); override public AbstractValue TValue { get { return Value; } } override public StringValue TKey { get { return Key; } } } [DescAttribute("设置单位(变量)", "设置 - 环境变量")] public class SetEnvironmentUnitSV : SetEnvironmentVarSV { [DescAttribute("变量名")] public StringValue Key = new StringValue.VALUE("VarName"); [DescAttribute("变量值")] public UnitValue Value = new UnitValue.NA(); override public AbstractValue TValue { get { return Value; } } override public StringValue TKey { get { return Key; } } } [DescAttribute("设置Flag(变量)", "设置 - 环境变量")] public class SetEnvironmentFlagSV : SetEnvironmentVarSV { [DescAttribute("变量名")] public StringValue Key = new StringValue.VALUE("VarName"); [DescAttribute("变量值")] public FlagValue Value = new FlagValue.NA(); override public AbstractValue TValue { get { return Value; } } override public StringValue TKey { get { return Key; } } } [DescAttribute("设置物品(变量)", "设置 - 环境变量")] public class SetEnvironmentItemSV : SetEnvironmentVarSV { [DescAttribute("变量名")] public StringValue Key = new StringValue.VALUE("VarName"); [DescAttribute("变量值")] public ItemValue Value = new ItemValue.NA(); override public AbstractValue TValue { get { return Value; } } override public StringValue TKey { get { return Key; } } } [DescAttribute("设置位置坐标(变量)", "设置 - 环境变量")] public class SetEnvironmentPositionSV : SetEnvironmentVarSV { [DescAttribute("变量名")] public StringValue Key = new StringValue.VALUE("VarName"); [DescAttribute("变量值")] public PositionValue Value = new PositionValue.VALUE(); override public AbstractValue TValue { get { return Value; } } override public StringValue TKey { get { return Key; } } } }