/// <summary> /// 以一定的移动速度创建可移动元素对象 /// </summary> /// <param name="faceIndex">移动对象的图像索引</param> /// <param name="pos">可移动对象的初始位置</param> /// <param name="name">移动对象名称</param> public MoveElement(MotaElement faceIndex, Coord pos, string name) : base(faceIndex, pos, TouchMethod.ImmediatelyTouch, true, name) { this.Speed = GameIni.IniHeroSpeed; MoveDirection = Direction.No; }
/// <summary> /// 以道具名称创建道具的实例 /// </summary> /// <param name="index">道具图像索引</param> /// <param name="name">道具名称</param> /// <param name="isConsumables">道具是否是消耗品</param> /// <param name="keyCode">使用按键</param> /// <param name="number">道具拥有数量, 默认为0</param> public Property(MotaElement index, PropName name, bool isConsumables, System.Windows.Forms.Keys keyCode, int number = 0) { this.FaceIndex = (int)index; this.Name = name; this.count = number; this.UseKeyCode = keyCode; this.Consumable = isConsumables; }
/// <summary> /// 初始加载固有图像,但标准单位尺寸分隔 /// </summary> static MotaImage() { BackImage = new Bitmap("images/map/Empty1.png"); SelectedBackImage = GetImage(MotaElement.中怪物背景); SelectedBackImage.SetOpacity(0.4F); BackWindow = new Bitmap("images/back.png"); for (int i = 0; i < ImageVector.Length; i++) { MotaElement id = (MotaElement)i; ImageVector[i] = GetFaceList(GetImage(id), new Size(GameIni.ElementWidth, GameIni.ElementHeight)); } }
private static Bitmap GetImage(MotaElement id) { Bitmap img = null; string imgFile = string.Empty; switch (id) { case MotaElement.选中怪物背景: imgFile = "images/map/monsterback.png"; break; case MotaElement.指引指针: imgFile = "images/map/指针.png"; break; case MotaElement.向下箭头: imgFile = "images/map/allowDown.png"; break; case MotaElement.向左箭头: imgFile = "images/map/allowLeft.png"; break; case MotaElement.向上箭头: imgFile = "images/map/allowUp.png"; break; case MotaElement.向右箭头: imgFile = "images/map/allowRight.png"; break; case MotaElement.墙1: imgFile = "images/map/Block1.png"; break; case MotaElement.墙2: imgFile = "images/map/Block2.png"; break; case MotaElement.墙3: imgFile = "images/map/Block3.png"; break; case MotaElement.墙4: imgFile = "images/map/Block4.png"; break; case MotaElement.墙5: imgFile = "images/map/Block5.png"; break; case MotaElement.墙6: imgFile = "images/map/Block6.png"; break; case MotaElement.墙7: imgFile = "images/map/Block7.png"; break; case MotaElement.熔岩: imgFile = "images/map/Block8.png"; break; case MotaElement.星星: imgFile = "images/map/Block9.png"; break; case MotaElement.上楼: imgFile = "images/map/梯上.png"; break; case MotaElement.下楼: imgFile = "images/map/梯下.png"; break; case MotaElement.圣水瓶: imgFile = "images/prop/圣水瓶.png"; break; case MotaElement.红血瓶: imgFile = "images/prop/药剂小.png"; break; case MotaElement.蓝血瓶: imgFile = "images/prop/药剂大.png"; break; case MotaElement.蓝宝石: imgFile = "images/prop/蓝宝石.png"; break; case MotaElement.红宝石: imgFile = "images/prop/红宝石.png"; break; case MotaElement.大金币: imgFile = "images/prop/金块.png"; break; case MotaElement.小飞羽: imgFile = "images/prop/飞羽.png"; break; case MotaElement.钥匙盒: imgFile = "images/prop/钥匙盒.png"; break; case MotaElement.黄钥匙: imgFile = "images/prop/黄钥匙.png"; break; case MotaElement.红钥匙: imgFile = "images/prop/红钥匙.png"; break; case MotaElement.蓝钥匙: imgFile = "images/prop/蓝钥匙.png"; break; case MotaElement.小黄钥匙: imgFile = "images/prop/101-01.png"; break; case MotaElement.小蓝钥匙: imgFile = "images/prop/101-02.png"; break; case MotaElement.小红钥匙: imgFile = "images/prop/101-03.png"; break; case MotaElement.黄门: imgFile = "images/map/500.png"; break; case MotaElement.蓝门: imgFile = "images/map/501.png"; break; case MotaElement.红门: imgFile = "images/map/502.png"; break; case MotaElement.花门: imgFile = "images/map/503.png"; break; case MotaElement.铁门: imgFile = "images/map/504.png"; break; case MotaElement.暗墙1: imgFile = "images/map/506.png"; break; case MotaElement.暗墙2: imgFile = "images/map/505.png"; break; case MotaElement.暗墙3: imgFile = "images/map/507.png"; break; case MotaElement.怪物手册: imgFile = "images/prop/101-13.png"; break; case MotaElement.楼层传送器: imgFile = "images/prop/106-01Shoe.png"; break; case MotaElement.黄金盾: imgFile = "images/prop/黄金盾.png"; break; case MotaElement.青峰剑: imgFile = "images/prop/青锋剑.png"; break; case MotaElement.神圣盾: imgFile = "images/prop/光芒神盾.png"; break; case MotaElement.神圣剑: imgFile = "images/prop/星光神剑.png"; break; case MotaElement.铁盾: imgFile = "images/prop/铁盾.png"; break; case MotaElement.铁剑: imgFile = "images/prop/铁剑.png"; break; case MotaElement.破墙镐: imgFile = "images/prop/十字镐.png"; break; case MotaElement.十字架: imgFile = "images/prop/十字架.png"; break; case MotaElement.公主: imgFile = "images/npc/公主.png"; break; case MotaElement.老人: imgFile = "images/npc/NPC蓝.png"; break; case MotaElement.商店: imgFile = "images/npc/商店中.png"; break; case MotaElement.商店右: imgFile = "images/npc/商店右.png"; break; case MotaElement.商店左: imgFile = "images/npc/商店左.png"; break; case MotaElement.商人: imgFile = "images/npc/NPC红.png"; break; case MotaElement.仙子: imgFile = "images/npc/仙女.png"; break; case MotaElement.目标: imgFile = "images/map/target.png"; break; //case MotaElement.初级警卫: // imgFile = "images/monster/0036-Monster06.png"; // break; //case MotaElement.青色史莱姆: // imgFile = "images/monster/0031-Monster01.png"; // break; //case MotaElement.红色史莱姆: // imgFile = "images/monster/1031-Monster01.png"; // break; //case MotaElement.黑色史莱姆: // imgFile = "images/monster/2031-Monster01.png"; // break; //case MotaElement.大史莱姆: // imgFile = "images/monster/3031-Monster01.png"; // break; //case MotaElement.小蝙蝠: // imgFile = "images/monster/0032-Monster02.png"; // break; //case MotaElement.大蝙蝠: // imgFile = "images/monster/1032-Monster02.png"; // break; //case MotaElement.红蝙蝠: // imgFile = "images/monster/2032-Monster02.png"; // break; case MotaElement.箱子: imgFile = "images/map/SandBox1.png"; break; case MotaElement.路障: imgFile = "images/map/路障.png"; break; case MotaElement.道具包: imgFile = "images/prop/102-14.png"; break; case MotaElement.上楼器: imgFile = "images/prop/102-07.png"; break; case MotaElement.自然之靴: imgFile = "images/prop/102-13Shoe.png"; break; case MotaElement.怪物探测器: imgFile = "images/prop/怪物探测器.png"; break; default: break; } if (imgFile != string.Empty) { FileNames[(int)id] = imgFile; img = new Bitmap(imgFile); } return img; }
private static Bitmap GetImage(MotaElement id) { Bitmap img = null; string imgFile = string.Empty; switch (id) { case MotaElement.中怪物背景: imgFile = "images/map/monsterback.png"; break; case MotaElement.指引指针: imgFile = "images/map/指针.png"; break; case MotaElement.向下箭头: imgFile = "images/map/allowDown.png"; break; case MotaElement.向左箭头: imgFile = "images/map/allowLeft.png"; break; case MotaElement.向上箭头: imgFile = "images/map/allowUp.png"; break; case MotaElement.向右箭头: imgFile = "images/map/allowRight.png"; break; case MotaElement.墙1: imgFile = "images/map/Block1.png"; break; case MotaElement.墙2: imgFile = "images/map/Block2.png"; break; case MotaElement.墙3: imgFile = "images/map/Block3.png"; break; case MotaElement.墙4: imgFile = "images/map/Block4.png"; break; case MotaElement.墙5: imgFile = "images/map/Block5.png"; break; case MotaElement.墙6: imgFile = "images/map/Block6.png"; break; case MotaElement.墙7: imgFile = "images/map/Block7.png"; break; case MotaElement.熔岩: imgFile = "images/map/Block8.png"; break; case MotaElement.星星: imgFile = "images/map/Block9.png"; break; case MotaElement.楼: imgFile = "images/map/梯上.png"; break; case MotaElement.楼: imgFile = "images/map/梯下.png"; break; case MotaElement.圣水瓶: imgFile = "images/prop/圣水瓶.png"; break; case MotaElement.红血瓶: imgFile = "images/prop/药剂小.png"; break; case MotaElement.蓝血瓶: imgFile = "images/prop/药剂大.png"; break; case MotaElement.蓝宝石: imgFile = "images/prop/蓝宝石.png"; break; case MotaElement.红宝石: imgFile = "images/prop/红宝石.png"; break; case MotaElement.大金币: imgFile = "images/prop/金块.png"; break; case MotaElement.小飞羽: imgFile = "images/prop/飞羽.png"; break; case MotaElement.钥匙盒: imgFile = "images/prop/钥匙盒.png"; break; case MotaElement.黄钥匙: imgFile = "images/prop/黄钥匙.png"; break; case MotaElement.红钥匙: imgFile = "images/prop/红钥匙.png"; break; case MotaElement.蓝钥匙: imgFile = "images/prop/蓝钥匙.png"; break; case MotaElement.小黄钥匙: imgFile = "images/prop/101-01.png"; break; case MotaElement.小蓝钥匙: imgFile = "images/prop/101-02.png"; break; case MotaElement.小红钥匙: imgFile = "images/prop/101-03.png"; break; case MotaElement.黄门: imgFile = "images/map/500.png"; break; case MotaElement.蓝门: imgFile = "images/map/501.png"; break; case MotaElement.红门: imgFile = "images/map/502.png"; break; case MotaElement.花门: imgFile = "images/map/503.png"; break; case MotaElement.铁门: imgFile = "images/map/504.png"; break; case MotaElement.暗墙1: imgFile = "images/map/506.png"; break; case MotaElement.暗墙2: imgFile = "images/map/505.png"; break; case MotaElement.暗墙3: imgFile = "images/map/507.png"; break; case MotaElement.怪物手册: imgFile = "images/prop/101-13.png"; break; case MotaElement.楼层传送器: imgFile = "images/prop/106-01Shoe.png"; break; case MotaElement.黄金盾: imgFile = "images/prop/黄金盾.png"; break; case MotaElement.青峰剑: imgFile = "images/prop/青锋剑.png"; break; case MotaElement.神圣盾: imgFile = "images/prop/光芒神盾.png"; break; case MotaElement.神圣剑: imgFile = "images/prop/星光神剑.png"; break; case MotaElement.铁盾: imgFile = "images/prop/铁盾.png"; break; case MotaElement.铁剑: imgFile = "images/prop/铁剑.png"; break; case MotaElement.破墙镐: imgFile = "images/prop/十字镐.png"; break; case MotaElement.十字架: imgFile = "images/prop/十字架.png"; break; case MotaElement.公主: imgFile = "images/npc/公主.png"; break; case MotaElement.老人: imgFile = "images/npc/NPC蓝.png"; break; case MotaElement.商店: imgFile = "images/npc/商店中.png"; break; case MotaElement.商店右: imgFile = "images/npc/商店右.png"; break; case MotaElement.商店左: imgFile = "images/npc/商店左.png"; break; case MotaElement.商人: imgFile = "images/npc/NPC红.png"; break; case MotaElement.仙子: imgFile = "images/npc/仙女.png"; break; case MotaElement.目标: imgFile = "images/map/target.png"; break; //case MotaElement.初级警卫: // imgFile = "images/monster/0036-Monster06.png"; // break; //case MotaElement.青色史莱姆: // imgFile = "images/monster/0031-Monster01.png"; // break; //case MotaElement.红色史莱姆: // imgFile = "images/monster/1031-Monster01.png"; // break; //case MotaElement.黑色史莱姆: // imgFile = "images/monster/2031-Monster01.png"; // break; //case MotaElement.大史莱姆: // imgFile = "images/monster/3031-Monster01.png"; // break; //case MotaElement.小蝙蝠: // imgFile = "images/monster/0032-Monster02.png"; // break; //case MotaElement.大蝙蝠: // imgFile = "images/monster/1032-Monster02.png"; // break; //case MotaElement.红蝙蝠: // imgFile = "images/monster/2032-Monster02.png"; // break; case MotaElement.箱子: imgFile = "images/map/SandBox1.png"; break; case MotaElement.路障: imgFile = "images/map/路障.png"; break; case MotaElement.道具包: imgFile = "images/prop/102-14.png"; break; case MotaElement.楼器: imgFile = "images/prop/102-07.png"; break; case MotaElement.自然之靴: imgFile = "images/prop/102-13Shoe.png"; break; case MotaElement.怪物探测器: imgFile = "images/prop/怪物探测器.png"; break; default: break; } if (imgFile != string.Empty) { FileNames[(int)id] = imgFile; img = new Bitmap(imgFile); } return(img); }
/// <summary> /// 创建通向性元素实例 /// </summary> /// <param name="repeated">元素图像是否重复播放</param> /// <param name="interval">每帧的部分间隔</param> /// <param name="faceIndex">图像索引</param> public PassElement(bool repeated, int interval, MotaElement faceIndex) :base(repeated, interval, faceIndex) {}
/// <summary> /// 设置事件元素实例 /// </summary> /// <param name="face">图像索引</param> /// <param name="showPosation">事件在地图上的坐标</param> /// <param name="method">触发方式</param /// <param name="repeated">是否是触发触发的事件</param> /// <param name="eventName">事件名</param> protected MapEvent(MotaElement face, Coord showPosation, TouchMethod method, bool repeated, string eventName) : base(face, showPosation) { SetAttr(method, repeated, eventName); }
/// <summary> /// 设置地图元素实例 /// </summary> /// <param name="face">图像类型</param> /// <param name="pos">元素在地图上的坐标</param> /// <param name="canDestroy">元素是否可以被破墙镐破坏</param> public Background(MotaElement face, Coord pos, bool canDestroy = true) : base(face, pos) { this.canDestroy = canDestroy; }
/// <summary> /// 创建通向性元素实例 /// </summary> /// <param name="repeated">元素图像是否重复播放</param> /// <param name="interval">每帧的部分间隔</param> /// <param name="faceIndex">图像索引</param> public PassElement(bool repeated, int interval, MotaElement faceIndex) : base(repeated, interval, faceIndex) { }
/// <summary> /// 创建动态元素实例 /// </summary> /// <param name="repeated">元素图像是否重复播放</param> /// <param name="interval">每帧的部分间隔</param> /// <param name="faceIndex">图像索引</param> public DynamicElement(bool repeated, int interval, MotaElement faceIndex) { FaceIndex = (int)faceIndex; Initialize(repeated, interval); }
/// <summary> /// 以原有的图像设置地图元素实例 /// </summary> /// <param name="faceIndex">图像索引</param> /// <param name="showPosation">元素在地图上的坐标</param> public MapElement(MotaElement faceIndex, Coord showPosation) : base(true, GameIni.DefaultInterval, faceIndex) { location = new Point(showPosation.Col * GameIni.ElementWidth, showPosation.Row * GameIni.ElementHeight); }
/// <summary> /// 创建持有类的实例 /// </summary> /// <param name="face">道具图像</param> /// <param name="number">拥有数量, 默认为0</param> public HoldProp(PropName name, MotaElement face, int number = 0) : base(face, name, false, System.Windows.Forms.Keys.None, number) { }
/// <summary> /// 以道具名称创建钥匙的实例 /// </summary> /// <param name="name">钥匙名称</param> /// <param name="number">钥匙拥有数量, 默认为0</param> public KeyProp(MotaElement index, PropName name, int number = 0) : base(index, name, true, System.Windows.Forms.Keys.None, number) { }