Пример #1
0
        //打开对话框
        public void OpenDialog(int dwData)
        {
            if (mNpcInfo == null)
            {

                return;
            }
            NetMsg.MsgOpenDialog msg = new NetMsg.MsgOpenDialog();
            msg.Create(null, this.GetGamePackKeyEx());
            msg.playid = GetTypeId();
            msg.npc_x = mNpcInfo.x;
            msg.npc_y = mNpcInfo.y;
            msg.npcid = mNpcInfo.id;
            msg.dialog_type = dwData;
            this.SendData(msg.GetBuffer());

            switch (dwData)
            {
                //发送仓库数据
                case NetMsg.MsgOpenDialog.OPENDIALOGTYPE_STRONG:
                    {
                        //需要延时一下,不然客户端无法显示-
                        System.Threading.Thread.Sleep(50);

                        List<GameStruct.RoleItemInfo> list_item = new List<GameStruct.RoleItemInfo>();
                        this.GetItemSystem().GetItemStrongInfo(list_item);

                        int nPage = list_item.Count / 6;
                        if (list_item.Count % 6 > 0) nPage++;

                       for(int i = 0;i < nPage;i++)
                       {
                           NetMsg.MsgStrongInfo stronginfo = new NetMsg.MsgStrongInfo();
                           if (i > 0) stronginfo.param1 = 3;
                           stronginfo.playid = this.GetTypeId();
                           int nStartIndex = i * 6;
                           for (int j = 0; j < 6; j++)
                           {
                               if (nStartIndex >= list_item.Count) break;
                               stronginfo.list_item.Add(list_item[nStartIndex]);
                               nStartIndex++;
                           }
                           stronginfo.Create(null, this.GetGamePackKeyEx());
                           this.SendData(stronginfo.GetBuffer());

                        }

                        //仓库的金币
                       byte[] gold = NetMsg.MsgStrongInfo.GetStrongMoneyBuffer(this.GetTypeId(), this.GetMoneyCount(MONEYTYPE.STRONGGOLD));
                       this.SendData(gold,true);
                        break;
                    }

            }
        }
Пример #2
0
 //仓库取钱 小心溢出!
 public void GiveStrongMoney(int gold)
 {
     if (play.GetMoneyCount(GameStruct.MONEYTYPE.STRONGGOLD) < gold) return;
     play.ChangeAttribute(GameStruct.UserAttribute.GOLD, gold);
     play.ChangeMoney(GameStruct.MONEYTYPE.STRONGGOLD, -gold);
     //发送仓库剩余道具
     NetMsg.MsgStrongInfo stronginfo = new NetMsg.MsgStrongInfo();
     stronginfo.Create(null, play.GetGamePackKeyEx());
     byte[] data = NetMsg.MsgStrongInfo.GetStrongMoneyBuffer(play.GetTypeId(), play.GetMoneyCount(GameStruct.MONEYTYPE.STRONGGOLD));
     play.SendData(data,true);
 }