Пример #1
0
        /// <summary>
        /// 设置事件效果
        /// </summary>
        /// <param name="method">事件参数</param>
        public static void EventEffect(MotaEventArgs data)
        {
            if (data.Method == EffectType.Blood || data.Method == EffectType.Goods || data.Method == EffectType.LevelUp)
            {
                MotaWorld.GetInstance().GoodsGetWindow.Open(new ShortMessage("获得" + data.Name, data.ExistStation));
            }

            //获取物品时显示消息
            if (data.Method == EffectType.Goods)
            {
                //播放音效
                SoundsList.PlaySound(SoundType.获得物品);
            }

            if (data.Method == EffectType.Blood)
            {
                SoundsList.PlaySound(SoundType.获取血瓶);
            }

            //获取道具时提升信息
            if (data.Method == EffectType.Prop)
            {
                MotaWorld.GetInstance().MessageShowWindow.Open(Property.GetDescribe(data.Prop));

                SoundsList.PlaySound(SoundType.获取道具);
            }

            if (data.Method == EffectType.LevelUp)
            {
                SoundsList.PlaySound(SoundType.升级);
            }
        }
Пример #2
0
        /// <summary>
        /// 播放音效(用户定义的音效播放)
        /// </summary>
        public static void PlaySound(Queue <MotaEventArgs> datas, Hero player)
        {
            MotaEventArgs data = datas.Dequeue();

            SoundsList.PlaySound(data.Sound);
            EventEffect(data);
        }
Пример #3
0
        /// <summary>
        /// 双方其中一人进行一次攻击,并重绘窗口
        /// </summary>
        private void OneBattle(object sender, EventArgs e)
        {
            if (!Enable || IsEnd)
            {
                return;
            }

            //战斗结束,不再战斗,等待确定按键关闭窗口
            if (MonsterDeath || HeroDeath)
            {
                IsEnd = true;
                if (MonsterDeath)
                {
                    if (MonsterDeath)
                    {
                        //胜利音效和提示
                        SoundsList.PlaySound(SoundType.战斗结束);
                        if (BattleMessages.Count >= 6)
                        {
                            BattleMessages.Dequeue();
                        }
                        BattleMessages.Enqueue("战斗胜利!" + "获得" + Monster.Coin + "金币," + Monster.Exp + "经验");
                    }
                }

                //勇士失败时立即终止
                if (HeroDeath)
                {
                    Close();
                }
                return;
            }
            else
            {
                //轮流交换战斗
                HeroTurn = !HeroTurn;
                if (HeroTurn)
                {
                    if (QuitWaiting)
                    {
                        Close();
                        return;
                    }

                    //勇士攻击怪物
                    OneFight(Hero, Monster);
                }
                else
                {
                    //怪物攻击勇士
                    OneFight(Monster, Hero);
                }
            }

            ReDraw();
        }
Пример #4
0
 /// <summary>
 /// 如果墙可以被破坏的话,破坏一堵墙
 /// </summary>
 /// <param name="pos">墙的位置</param>
 /// <returns>返回一个布尔值,标示是否破坏成功,如果墙不可以破坏,则返回false</returns>
 public bool Destroy(Coord pos)
 {
     if (InFloor(pos) && BackMap[pos.Row, pos.Col].CanDestroy)
     {
         BackMap[pos.Row, pos.Col].Close();
         SoundsList.PlaySound(SoundType.破墙);
         return(true);
     }
     return(false);
 }
Пример #5
0
        /// <summary>
        /// A向B发动一次攻击
        /// </summary>
        private void OneFight(IFighter A, IFighter B)
        {
            int harm = 0;

            //重置所有技能
            foreach (var item in A.Skills)
            {
                item.Reset();
            }
            foreach (var item in B.Skills)
            {
                item.Reset();
            }
            A.SkillOnIt = null;
            B.SkillOnIt = null;

            //主动技能
            foreach (var item in A.Skills)
            {
                if (item.IsAttackSkill)
                {
                    if (item.Onset(ref harm, A, B, BattleMessages))
                    {
                        break;
                    }
                }
            }

            //防御技能
            foreach (var item in B.Skills)
            {
                if (!item.IsAttackSkill)
                {
                    if (item.Onset(ref harm, A, B, BattleMessages))
                    {
                        break;
                    }
                }
            }

            B.Hp -= harm;

            //当信息队列达到一定数量的时候,清空之前的内容以显示最新的信息
            if (BattleMessages.Count >= 7)
            {
                BattleMessages.Clear();
            }

            //战斗消息
            BattleMessages.Enqueue(B.Name + "受到<" + harm + ">点伤害");

            //播放战斗音效
            SoundsList.PlaySound(A.AttackSound);
        }
Пример #6
0
 /// <summary>
 /// 以交易者的身份开启商店,默认选中第一个选项
 /// </summary>
 /// <param name="data">交易者</param>
 public override void Open(object data)
 {
     if (data is Idealer)
     {
         Dealer = data as Idealer;
         base.Open(null);
         SoundsList.PlaySound(SoundType.进入商店);
     }
     else
     {
         throw new Exception("错误的交易者身份,不能开启商店");
     }
 }
Пример #7
0
        /// <summary>
        /// 打开下一个对话
        /// </summary>
        private void NextDialogue()
        {
            if (Enable)
            {
                if (DialogueQueue.Count == 0)
                {
                    this.Enable = false;
                    return;
                }

                SoundsList.PlaySound(SoundType.对话);
                ReDraw();
            }
        }
Пример #8
0
        /// <summary>
        /// 设置新的楼层
        /// </summary>
        /// <param name="index">楼层索引</param>
        private void SetFloor(int index)
        {
            curFloorIndex = index;

            if (FloorChangeEvent != null)
            {
                FloorChangeEvent(null, EventArgs.Empty);
            }

            //经过的楼层设置为true
            FloorReached[index] = true;

            //楼层跳转效果
            MotaWorld.GetInstance().SkipFlashWindow.Open(new ShortMessage(CurFloorNode.FloorName, Coord.Empty));
            SoundsList.PlaySound(SoundType.楼层跳转);
        }
Пример #9
0
        /// <summary>
        /// 开门,等待门自动关闭
        /// </summary>
        public override void Close()
        {
            //如果存在此种钥匙,则减去钥匙并开门
            Dynamic = true;

            //减去需求的钥匙,如果钥匙不存在,没有影响
            MotaWorld.GetInstance().MapManager.CurHero.Pack.RemoveProperty(Key);

            if (Key == PropName.NULL || Key == PropName.事件钥)
            {
                SoundsList.PlaySound(SoundType.暗墙);
            }
            else
            {
                SoundsList.PlaySound(SoundType.开门);
            }
            Enable = false;
        }
Пример #10
0
        /// <summary>
        /// 触发战斗事件
        /// </summary>
        /// <param name="player">触发者</param>
        public override void TriggerEvent(Hero player)
        {
            //如果可以战斗,打开战斗窗口
            if (CanBattle && !(this.HarmTo(player) == int.MaxValue && player.Level < this.Level))
            {
                IFighter[] fighters = new IFighter[2];
                fighters[0] = player;
                fighters[1] = this;

                //以战斗的双方作为参数开启战斗窗口
                MotaWorld.GetInstance().BattleWindow.Open(fighters);
            }
            else
            {
                //无法战斗
                MotaWorld.GetInstance().MessageShowWindow.Open("攻击力不足,无法与这只怪物战斗!");
                SoundsList.PlaySound(SoundType.错误);
            }

            base.TriggerEvent(player);
        }
Пример #11
0
        /// <summary>
        /// 触发推箱子事件
        /// </summary>
        /// <param name="player">触发者</param>
        public override void TriggerEvent(Hero player)
        {
            //要推到的坐标
            Coord desPoint = this.Station;

            desPoint.Offset(player.FaceTo);

            PushWaitCount++;
            if (PushWaitCount <= GameIni.BoxPushWait)
            {
                return;
            }

            //如果箱子的前方为空,则推动那个位置
            if (MotaWorld.GetInstance().MapManager.ShiftEvent(this.Station, desPoint, player.FaceTo))
            {
                StartMove(player.FaceTo);
                SoundsList.PlaySound(SoundType.推箱子);
                this.MoveCount -= GameIni.BoxMoveTimes;
            }

            base.TriggerEvent(player);
        }
Пример #12
0
        /// <summary>
        /// 与装备接触的装备获取事件.
        /// </summary>
        /// <param name="player">调用者</param>
        public override void TriggerEvent(Hero player)
        {
            //如果人物等级高于需求的等级,获取装备
            if (Enable && player.Level >= this.LevelDemand)
            {
                player.Attack  += this.GetAbility.Attack;
                player.Defence += this.GetAbility.Defence;
                player.Agility += this.GetAbility.Agility;
                player.Magic   += this.GetAbility.Magic;

                MotaWorld.GetInstance().MessageShowWindow.Open(Description);
                SoundsList.PlaySound(SoundType.升级);

                this.Exist = false;
            }
            else
            {
                MotaWorld.GetInstance().MessageShowWindow.Open("获取此装备需要达到" + this.LevelDemand + "级,\r\n您的等级不足够获取此装备!");
                SoundsList.PlaySound(SoundType.错误);
            }

            base.TriggerEvent(player);
        }
Пример #13
0
        /// <summary>
        /// 进行一次交易, 如果无法交易,则发出失败效果音,如果交易成功,发出成功效果音
        /// </summary>
        private void Deal(object sender, EventArgs e)
        {
            DealOption o = sender as DealOption;

            if (o == null || Dealer == null)
            {
                throw new Exception("错误的交易信息或交易对象为空");
            }

            //如果交易参数为空,则关闭商店
            if (o.OnePiece == null)
            {
                this.Enable = false;
                SoundsList.PlaySound(SoundType.关闭商店);
                return;
            }

            if (Dealer.Coin >= o.OnePiece.CoinDemand && Dealer.Exp >= o.OnePiece.ExpDemand)
            {
                //成功交易
                Dealer.Coin    -= o.OnePiece.CoinDemand;
                Dealer.Exp     -= o.OnePiece.ExpDemand;
                Dealer.Hp      += o.OnePiece.HpUp;
                Dealer.Attack  += o.OnePiece.Attack;
                Dealer.Defence += o.OnePiece.Defence;
                Dealer.Level   += o.OnePiece.Level;
                Dealer.Magic   += o.OnePiece.Magic;
                Dealer.Agility += o.OnePiece.Agility;

                SoundsList.PlaySound(SoundType.确认选择);
            }
            else
            {
                //失败交易
                SoundsList.PlaySound(SoundType.错误);
            }
        }
Пример #14
0
 /// <summary>
 /// 被选中之后的效果音
 /// </summary>
 protected virtual void SelectSound()
 {
     SoundsList.PlaySound(SoundType.择);
 }
Пример #15
0
 /// <summary>
 /// 触发后的效果音
 /// </summary>
 protected virtual void EnterSound()
 {
     SoundsList.PlaySound(SoundType.确认选择);
 }
Пример #16
0
        /// <summary>
        /// 保存当前存档到目标文件
        /// </summary>
        /// <param name="saveFile">目标文件</param>
        public void Save(string saveFile)
        {
            XmlRecord.Save(saveFile);

            SoundsList.PlaySound(SoundType.保存);
        }