MapServer.PlayerObject.OpenDialog C# (CSharp) Method

OpenDialog() public method

public OpenDialog ( int dwData ) : void
dwData int
return void
        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;
                    }

            }
        }

Usage Example

Example #1
0
 private void Action_OpenDialog(ActionInfo info, PlayerObject play)
 {
     int dwData = Convert.ToInt32(info.data);
     play.OpenDialog(dwData);
 }