GroupWnd.cpp
上传用户:cydong117
上传日期:2009-11-10
资源大小:638k
文件大小:3k
源码类别:

模拟服务器

开发平台:

Visual C++

  1. /******************************************************************************************************************
  2.                                                                                                                    
  3. 葛碘疙:
  4. 累己磊:
  5. 累己老:
  6. [老磊][荐沥磊] : 荐沥 郴侩
  7.                                                                                                                    
  8. *******************************************************************************************************************/
  9. #include "StdAfx.h"
  10. typedef struct tagINTERFACE_BUTTON
  11. {
  12. public:
  13. int m_nLeft;
  14. int m_nTop;
  15. int m_nWidth;
  16. int m_nHeight;
  17. BYTE m_btCommand;
  18. } INTERFACE_BUTTON;
  19. #define GROUPBTN_ALLOWGROUP 1
  20. #define GROUPBTN_CREATEGROUP 2
  21. #define GROUPBTN_ADDMEMBER 3
  22. #define GROUPBTN_DELMEMBER 4
  23. INTERFACE_BUTTON GroupWndButton[] = { { 21, 57, 27, 28, GROUPBTN_ALLOWGROUP },
  24. { 27, 200, 71, 13, GROUPBTN_CREATEGROUP }, 
  25. { 91, 200, 77, 16, GROUPBTN_ADDMEMBER }, 
  26. { 170, 200, 73, 16, GROUPBTN_DELMEMBER } 
  27. };
  28. BOOL g_fAllowGroup = TRUE;
  29. CGroupWnd::CGroupWnd()
  30. {
  31. Init();
  32. }
  33. CGroupWnd::~CGroupWnd()
  34. {
  35. Destroy();
  36. }
  37. VOID CGroupWnd::CreateGroupWnd(INT nID, CWHWilImageData* pxWndImage, INT nFrameImgIdx, INT nStartX, INT nStartY, INT nWidth, INT nHeight, BOOL bCanMove)
  38. {
  39. CreateGameWnd(nID, pxWndImage, nFrameImgIdx, bCanMove, nStartX, nStartY, nWidth, nHeight);
  40. }
  41. VOID CGroupWnd::ShowGroupWnd()
  42. {
  43. CGroupMember* pGroupMember;
  44. RECT tRect = GetGameWndRect();
  45. int nX = tRect.left + 45, nY = tRect.top + 100;
  46. ShowGameWnd();
  47. g_xMainWnd.PutsHan(NULL, tRect.left + 45, tRect.top + 25, RGB(255, 255, 255), RGB(0, 0, 0), g_szUserID, NULL);
  48. if (m_xGroupList.GetCounter())
  49. {
  50. m_xGroupList.MoveCurrentToTop();
  51. for (int i = 1; i <= m_xGroupList.GetCounter(); i++)
  52. {
  53. pGroupMember = m_xGroupList.GetCurrentData();
  54. g_xMainWnd.PutsHan(NULL, nX, nY, RGB(255, 255, 255), RGB(0, 0, 0), pGroupMember->szMemberName);
  55. if (i % 2) 
  56. nX += 100;
  57. else
  58. {
  59. nX -= 100;
  60. nY += 50;
  61. }
  62. m_xGroupList.MoveNextNode();
  63. }
  64. }
  65. }
  66. VOID CGroupWnd::Init()
  67. {
  68. CGameWnd::Init();
  69. }
  70. VOID CGroupWnd::Destroy()
  71. {
  72. CGameWnd::Destroy();
  73. }
  74. BOOL CGroupWnd::OnLButtonUp(POINT ptMouse)
  75. {
  76. RECT tRect = GetGameWndRect();
  77. for (int i = 0; i < sizeof(GroupWndButton)/sizeof(INTERFACE_BUTTON); i++)
  78. {
  79. if (tRect.left + GroupWndButton[i].m_nLeft < ptMouse.x && tRect.left + GroupWndButton[i].m_nLeft + GroupWndButton[i].m_nWidth > ptMouse.x &&
  80. tRect.top + GroupWndButton[i].m_nTop < ptMouse.y && tRect.top + GroupWndButton[i].m_nTop + GroupWndButton[i].m_nHeight > ptMouse.y)
  81. {
  82. switch (GroupWndButton[i].m_btCommand)
  83. {
  84. case GROUPBTN_ALLOWGROUP:
  85. (g_fAllowGroup ? g_fAllowGroup = FALSE : g_fAllowGroup = TRUE);
  86. g_xClientSocket.SendGroupMode(g_fAllowGroup);
  87. break;
  88. case GROUPBTN_CREATEGROUP:
  89. g_xClientSocket.SendCreateGroup("mandul");
  90. break;
  91. case GROUPBTN_ADDMEMBER:
  92. g_xClientSocket.SendAddGroupMember("mandul");
  93. break;
  94. case GROUPBTN_DELMEMBER:
  95. g_xClientSocket.SendDelGroupMember("mandul");
  96. break;
  97. }
  98. }
  99. }
  100. return FALSE;
  101. }
  102. BOOL CGroupWnd::OnLButtonDown(POINT ptMouse)
  103. {
  104. return FALSE;
  105. }
  106. VOID CGroupWnd::OnMouseMove(POINT ptMouse)
  107. {
  108. }