UiContainer.cpp
上传用户:dzyhzl
上传日期:2019-04-29
资源大小:56270k
文件大小:3k
源码类别:

模拟服务器

开发平台:

C/C++

  1. /* 
  2.  * File:     UiContainer.cpp
  3.  * Desc:     用户面板容器类
  4.  * Author:   flying
  5.  * Creation: 2003/7/4
  6.  */
  7. //-----------------------------------------------------------------------------
  8. #pragma warning(disable:4243)
  9. #include "KWin32.h"
  10. #include "KIniFile.h"
  11. #include "../elem/wnds.h"
  12. #include "../Elem/WndMessage.h"
  13. #include <crtdbg.h>
  14. #include "UiContainer.h"
  15. #include "UiPlayerBar.h"
  16. #include "UiStatus.h"
  17. #include "UiSkillTree.h"
  18. #include "UiEscDlg.h"
  19. #include "UiSelColor.h"
  20. #include "UiMsgCentrePad.h"
  21. #include "UiMiniMap.h"
  22. #include "../ShortcutKey.h"
  23. #include "../UiBase.h"
  24. #include "../UiSoundSetting.h"
  25. #include "../../../core/src/gamedatadef.h"
  26. #include "../../../core/src/MsgGenreDef.h"
  27. #include "../../../core/src/CoreObjGenreDef.h"
  28. #include "../../../core/src/coreshell.h"
  29. #include "../../TextCtrlCmd/TextCtrlCmd.h"
  30. #include "../../../Represent/iRepresent/iRepresentShell.h"
  31. #include "../../../Engine/src/Text.h"
  32. // flying add these include files.
  33. #include "UiChatCentre.h"
  34. #include "UiItem.h"
  35. #include "UiSkills.h"
  36. #include "UiTeamManage.h"
  37. //#include "KCore.h"
  38. //#include "../../../Core/Src/GameDataDef.h"
  39. extern iCoreShell* g_pCoreShell;
  40. KUiContainer::KUiContainer()
  41. {
  42. pCurrentWnd = NULL;
  43. nCurrentSwitch = 0;
  44. }
  45. KUiContainer::~KUiContainer()
  46. {
  47. }
  48. int KUiContainer::DoSwitchUi(int nSwitch)
  49. {
  50. int nResult = false;
  51. if (nSwitch >= SWITCH_COUNT || nSwitch < 0)
  52. goto Exit0;
  53. if (pCurrentWnd != NULL && nCurrentSwitch != SWITCH_TO_MESSAGE)
  54. {
  55. if (pCurrentWnd->IsVisible())
  56. {
  57. //pCurrentWnd->CloseWindow(false);
  58. pCurrentWnd->Hide();
  59. goto Exit2;
  60. }
  61. }
  62. nCurrentSwitch = nSwitch;
  63. switch (nSwitch)
  64. {
  65. case SWITCH_TO_MESSAGE:
  66. pCurrentWnd = (KWndWindow *)KUiMsgCentrePad::OpenWindow();
  67. break;
  68. case SWITCH_TO_FRIEND:
  69. pCurrentWnd = (KWndWindow *)KUiChatCentre::OpenWindow(true);
  70. break;
  71. case SWITCH_TO_STATUS:
  72. pCurrentWnd = (KWndWindow *)KUiStatus::OpenWindow();
  73. break;
  74. case SWITCH_TO_ITEM:
  75. pCurrentWnd = (KWndWindow *)KUiItem::OpenWindow();
  76. break;
  77. case SWITCH_TO_SKILL:
  78. pCurrentWnd = (KWndWindow *)KUiSkills::OpenWindow();
  79. break;
  80. case SWITCH_TO_TEAM:
  81. pCurrentWnd = (KWndWindow *)KUiTeamManage::OpenWindow();
  82. break;
  83. default:
  84. goto Exit0;
  85. }
  86. goto Exit1;
  87. Exit2:
  88. nCurrentSwitch = -1;
  89. pCurrentWnd = NULL;
  90. Exit1:
  91. nResult = true;
  92. Exit0:
  93. return nResult;
  94. }
  95. int KUiContainer::Initialize(KWndWindow* InitWnd)
  96. {
  97. if (InitWnd == NULL)
  98. return false;
  99. pCurrentWnd = InitWnd;
  100. nCurrentSwitch = 0;
  101. return 1;
  102. }
  103. //int KUiContainer::RegisterWnds(KWndWindow* pWnd, int nMessage)
  104. //{
  105. // int nResult = false;
  106. // if (nMessage >= SWITCH_COUNT || nMessage < 0)
  107. // goto Exit0;
  108. // if (pWnd == NULL)
  109. // goto Exit0;
  110. // pWnds[nMessage] = pWnd;
  111. // nResult = true;
  112. //Exit0:
  113. // return nResult;
  114. //}