Example #1
0
        /// <summary>
        /// 重写触发函数,加上打开商店窗口的事件
        /// </summary>
        /// <param name="player">调用者</param>
        public override void TriggerEvent(Hero player)
        {
            //获取交易者
            Idealer dealer = MotaWorld.GetInstance().MapManager.CurHero as Idealer;

            //商店引用
            Shop shop = MotaWorld.GetInstance().ShopWindow;

            //重新更新商店选项
            shop.RemoveAllOptions();
            for (int i = 0; i < DealOptions.Length; i++)
            {
                DealOption o = new DealOption(DealOptions[i]);
                shop.AddOption(o);
            }
            //添加交易关闭选项
            shop.AddOption(new DealOption("        关闭商店"));
            shop.ShopMessage = this.ShopMessage;

            shop.Open(dealer);

            base.TriggerEvent(player);
        }
Example #2
0
        /// <summary>
        /// 重写触发函数,加上打开商店窗口的事件
        /// </summary>
        /// <param name="player">调用者</param>
        public override void TriggerEvent(Hero player)
        {
            //获取交易者
            Idealer dealer = MotaWorld.GetInstance().MapManager.CurHero as Idealer;

            //商店引用
            Shop shop = MotaWorld.GetInstance().ShopWindow;
            
            //重新更新商店选项
            shop.RemoveAllOptions();
            for (int i = 0; i < DealOptions.Length; i++)
            {
                DealOption o = new DealOption(DealOptions[i]);
                shop.AddOption(o);
            }
            //添加交易关闭选项
            shop.AddOption(new DealOption("        关闭商店"));
            shop.ShopMessage = this.ShopMessage;

            shop.Open(dealer);

            base.TriggerEvent(player);
        }
Example #3
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.错误);
            }
        }