/// <summary> /// 根据参数配置创建类的实例 /// </summary> /// <param name="createArgs">参数配置</param> /// <returns>返回类实例</returns> public static MapEvent Create(XElement createArgs, Coord existCoord) { string fileName = createArgs.Attribute("imagefile").Value; string name = createArgs.Attribute("eventName").Value; string description = createArgs.Attribute("description").Value; int dealCount = createArgs.Element("deals").Elements("deal").Count(); DealArgs[] deals = new DealArgs[dealCount]; for (int i = 0; i < dealCount; i++) { deals[i] = DealArgs.CreateFrom(createArgs.Element("deals").Elements("deal").ElementAt(i)); } return new ShopEvent(fileName, existCoord, name, deals, description, GameIni.UnitSize); }
/// <summary> /// 根据参数配置创建类的实例 /// </summary> /// <param name="createArgs">参数配置</param> /// <returns>返回类实例</returns> public static MapEvent Create(XElement createArgs, Coord existCoord) { string fileName = createArgs.Attribute("imagefile").Value; string name = createArgs.Attribute("eventName").Value; string description = createArgs.Attribute("description").Value; int dealCount = createArgs.Element("deals").Elements("deal").Count(); DealArgs[] deals = new DealArgs[dealCount]; for (int i = 0; i < dealCount; i++) { deals[i] = DealArgs.CreateFrom(createArgs.Element("deals").Elements("deal").ElementAt(i)); } return(new ShopEvent(fileName, existCoord, name, deals, description, GameIni.UnitSize)); }
/// <summary> /// 创建交易选项实例 /// </summary> /// <param name="name">选项名称</param> public DealOption(DealArgs deal) : base(deal.DealName, true) { OnePiece = deal; }
/// <summary> /// 创建商店实例,并提供选项参数 /// </summary> /// <param name="faceFile">商店图像文件</param> /// <param name="p">商店坐标</param> /// <param name="name">商店名称</param> /// <param name="deals">交易参数信息</param> /// <param name="desc">商店说明</param> /// <param name="unitSize">图像分割的尺寸</param> private ShopEvent(string faceFile, Coord p, string name, DealArgs[] deals, string desc, Size unitSize) : base(faceFile, p, TouchMethod.ImmediatelyTouch, true, name, unitSize) { this.DealOptions = deals; this.ShopMessage = desc; }