コード例 #1
0
ファイル: Box.cs プロジェクト: uvbs/DDTank-3.0
 public Box(int id, MapGoodsInfo items)
     : base(id)
 {
     _userID    = 0;
     _items     = items;
     _rect      = new Rectangle(-15, -15, 30, 30);
     _liveCount = 8;
 }
コード例 #2
0
        public Box AddBox(MapGoodsInfo item, Point pos)
        {
            Box box = new Box(m_tempBoxId++, item);

            box.SetXY(pos);
            m_map.AddPhysical(box);
            m_tempBox.Add(box);
            return(box);
        }
コード例 #3
0
 public MapGoodsInfo GetFallItemsID(int index)
 {
     if (_fallItemID.Count > index)
     {
         MapGoodsInfo isType = _fallItemID[index].Items;
         _fallItemID[index].Items = null;
         Arks--;
         return(isType);
     }
     return(null);
 }
コード例 #4
0
        public int AddFallGoods(Point p, MapGoodsInfo itemID)
        {
            Box box = new Box(_fallItemID.Count, itemID);

            box.SetXY(p);
            _currentMap.AddPhysical(box);
            _fallItemID.Add(box);
            TempBox.Add(box);
            Arks++;
            return(0);
        }
コード例 #5
0
        public bool TakeCard(Player player, int index)
        {
            if (player.CanTakeOut == false)
            {
                return(false);
            }

            if (player.IsActive == false || index < 0 || index > 7 || player.HasTakeCard || Cards[index] > 0)
            {
                return(false);
            }

            MapGoodsInfo info = MapMgr.GetRandomAward(m_map.Info.ID, m_map.Info.Type);

            bool isItem = false;
            int  value  = 100;

            if (info != null)
            {
                if (info.GoodsID > 0)
                {
                    ItemTemplateInfo temp = ItemMgr.GetSingleGoods(info.GoodsID);
                    if (temp != null)
                    {
                        isItem = true;
                        value  = info.GoodsID;
                        player.PlayerDetail.TempInventory.AddItemTemplate(temp, info);
                    }
                }
                else if (info.GoodsID == -1)
                {
                    value = info.Value;
                }
            }

            if (isItem == false)
            {
                value = player.PlayerDetail.AddGold(value);
            }

            player.HasTakeCard = true;
            Cards[index]       = 1;

            GSPacketIn pkg = player.PlayerDetail.Out.SendGamePlayerTakeCard(player, index, isItem, value);

            SendToAll(pkg, player.PlayerDetail);

            return(true);
        }
コード例 #6
0
        public bool HandleCommand(TankGameLogicProcessor process, GamePlayer player, GSPacketIn packet)
        {
            //if (player.CurrentGame.Data.CurrentIndex != player && player.CurrentGame.Data.Players[player].State != TankGameState.DEAD)
            //    return false;

            player.CurrentGame.ReturnPacket(player, packet);
            MapGoodsInfo goods = null;

            if (player.CurrentGame.Data.Players[player].State == TankGameState.DEAD)
            {
                int arkID = packet.ReadInt();
                goods = player.CurrentGame.Data.GetFallItemsID(arkID, player);
            }
            else
            {
                int arkID  = packet.ReadInt();
                int bombID = packet.ReadInt();
                int time   = packet.ReadInt();
                goods = player.CurrentGame.Data.GetFallItemsID(arkID, player.PlayerCharacter.ID);
            }
            if (goods != null)
            {
                ItemTemplateInfo temp = Bussiness.Managers.ItemMgr.GetSingleGoods(goods.GoodsID);
                if (temp != null)
                {
                    //如果是道具
                    if (temp.CategoryID == 10)
                    {
                        if (player.PropInventory.AddItemTemplate(temp) == null)
                        {
                            player.Out.SendMessage(Game.Server.Packets.eMessageType.ChatERROR, LanguageMgr.GetTranslation("Game.Server.SceneGames.TankHandle.PropFull"));
                        }
                    }
                    else
                    {
                        player.TempInventory.AddItemTemplate(temp, goods);
                    }
                }
            }

            return(true);
        }