zhangyang 6 years ago
parent
commit
6d45927f07

BIN
bin/Win32/Debug/zhipuzi_pos_windows/zhipuzi_pos_windows.exe


+ 12 - 124
lewaimai_dispatch/CGameFrameWnd.h

@@ -1,4 +1,4 @@
-#pragma once
+#pragma once
 
 #include "pch/pch.h"
 
@@ -10,107 +10,18 @@ public:
 	UINT GetClassStyle() const { return CS_DBLCLKS; };
 	void OnFinalMessage(HWND /*hWnd*/) { delete this; };
 
-	void Init() {
+	void Init()
+	{
 		m_pCloseBtn = static_cast<CButtonUI*>(m_pm.FindControl(_T("closebtn")));
 		m_pMaxBtn = static_cast<CButtonUI*>(m_pm.FindControl(_T("maxbtn")));
 		m_pRestoreBtn = static_cast<CButtonUI*>(m_pm.FindControl(_T("restorebtn")));
 		m_pMinBtn = static_cast<CButtonUI*>(m_pm.FindControl(_T("minbtn")));
-
-		CActiveXUI* pActiveXUI = static_cast<CActiveXUI*>(m_pm.FindControl(_T("ie")));
-		if (pActiveXUI) {
-			IWebBrowser2* pWebBrowser = NULL;
-			pActiveXUI->GetControl(IID_IWebBrowser2, (void**)&pWebBrowser);
-			if (pWebBrowser != NULL) {
-				pWebBrowser->Navigate(::SysAllocString(L"https://github.com/duilib/duilib"), NULL, NULL, NULL, NULL);
-				//pWebBrowser->Navigate(L"about:blank",NULL,NULL,NULL,NULL); 
-				pWebBrowser->Release();
-			}
-		}
-	}
-
-	void OnPrepare() {
-		GameListUI* pGameList = static_cast<GameListUI*>(m_pm.FindControl(_T("gamelist")));
-		GameListUI::Node* pCategoryNode = NULL;
-		GameListUI::Node* pGameNode = NULL;
-		GameListUI::Node* pServerNode = NULL;
-		GameListUI::Node* pRoomNode = NULL;
-		pCategoryNode = pGameList->AddNode(_T("{x 4}{i gameicons.png 18 3}{x 4}推荐游戏"));
-		for (int i = 0; i < 4; ++i)
-		{
-			pGameNode = pGameList->AddNode(_T("{x 4}{i gameicons.png 18 10}{x 4}四人斗地主"), pCategoryNode);
-			for (int i = 0; i < 3; ++i)
-			{
-				pServerNode = pGameList->AddNode(_T("{x 4}{i gameicons.png 18 10}{x 4}测试服务器"), pGameNode);
-				for (int i = 0; i < 3; ++i)
-				{
-					pRoomNode = pGameList->AddNode(_T("{x 4}{i gameicons.png 18 10}{x 4}测试房间"), pServerNode);
-				}
-			}
-		}
-		pCategoryNode = pGameList->AddNode(_T("{x 4}{i gameicons.png 18 3}{x 4}最近玩过的游戏"));
-		for (int i = 0; i < 2; ++i)
-		{
-			pGameList->AddNode(_T("三缺一"), pCategoryNode);
-		}
-		pCategoryNode = pGameList->AddNode(_T("{x 4}{i gameicons.png 18 3}{x 4}棋牌游戏"));
-		for (int i = 0; i < 8; ++i)
-		{
-			pGameList->AddNode(_T("双扣"), pCategoryNode);
-		}
-		pCategoryNode = pGameList->AddNode(_T("{x 4}{i gameicons.png 18 3}{x 4}休闲游戏"));
-		for (int i = 0; i < 8; ++i)
-		{
-			pGameList->AddNode(_T("飞行棋"), pCategoryNode);
-		}
-
-		CListUI* pUserList = static_cast<CListUI*>(m_pm.FindControl(_T("userlist")));
-		pUserList->SetTextCallback(this);
-		for (int i = 0; i < 400; i++) {
-			CListTextElementUI* pListElement = new CListTextElementUI;
-			pUserList->Add(pListElement);
-		}
 	}
 
-	void SendChatMessage() {
-		CEditUI* pChatEdit = static_cast<CEditUI*>(m_pm.FindControl(_T("chatEdit")));
-		if (pChatEdit == NULL) return;
-		pChatEdit->SetFocus();
-		if (pChatEdit->GetText().IsEmpty()) return;
-
-		CRichEditUI* pRichEdit = static_cast<CRichEditUI*>(m_pm.FindControl(_T("chatmsglist")));
-		if (pRichEdit == NULL) return;
-		long lSelBegin = 0, lSelEnd = 0;
-		CHARFORMAT2 cf;
-		ZeroMemory(&cf, sizeof(CHARFORMAT2));
-		cf.cbSize = sizeof(cf);
-		cf.dwReserved = 0;
-		cf.dwMask = CFM_COLOR;
-		cf.crTextColor = RGB(220, 0, 0);
-
-		lSelEnd = lSelBegin = pRichEdit->GetTextLength();
-		pRichEdit->SetSel(lSelEnd, lSelEnd);
-		pRichEdit->ReplaceSel(_T("某人"), false);
-		lSelEnd = pRichEdit->GetTextLength();
-		pRichEdit->SetSel(lSelBegin, lSelEnd);
-		pRichEdit->SetSelectionCharFormat(cf);
-
-		lSelBegin = lSelEnd;
-		pRichEdit->SetSel(-1, -1);
-		pRichEdit->ReplaceSel(_T("说:"), false);
-
-		pRichEdit->SetSel(-1, -1);
-		pRichEdit->ReplaceSel(pChatEdit->GetText(), false);
-		pChatEdit->SetText(_T(""));
-
-		pRichEdit->SetSel(-1, -1);
-		pRichEdit->ReplaceSel(_T("\n"), false);
-
-		cf.crTextColor = RGB(0, 0, 0);
-		lSelEnd = pRichEdit->GetTextLength();
-		pRichEdit->SetSel(lSelBegin, lSelEnd);
-		pRichEdit->SetSelectionCharFormat(cf);
-
-		pRichEdit->EndDown();
+	void OnPrepare()
+	{
+		
+	
 	}
 
 	void Notify(TNotifyUI& msg)
@@ -124,7 +35,7 @@ public:
 					if (pFadeControl) pFadeControl->SetVisible(true);
 				}
 				else {
-					/*Close()*/PostQuitMessage(0); // 因为activex的原因,使用close可能会出现错误
+					/*Close()*/PostQuitMessage(0); // 因为activex的原因,使用close可能会出现错误
 				}
 				return;
 			}
@@ -133,7 +44,7 @@ public:
 			else if (msg.pSender == m_pRestoreBtn) { SendMessage(WM_SYSCOMMAND, SC_RESTORE, 0); return; }
 			CDuiString name = msg.pSender->GetName();
 			if (name == _T("quitbtn")) {
-				/*Close()*/PostQuitMessage(0); // 因为activex的原因,使用close可能会出现错误
+				/*Close()*/PostQuitMessage(0); // 因为activex的原因,使用close可能会出现错误
 			}
 			else if (name == _T("returnhallbtn")) {
 				CControlUI* pFadeControl = m_pm.FindControl(_T("fadeEffect"));
@@ -166,9 +77,6 @@ public:
 					if (pControl) pControl->SetVisible(false);
 				}
 			}
-			else if (name == _T("sendbtn")) {
-				SendChatMessage();
-			}
 		}
 		else if (msg.sType == _T("selectchanged")) {
 			CDuiString name = msg.pSender->GetName();
@@ -184,7 +92,7 @@ public:
 					pDeskList->SetFocus();
 					CRichEditUI* pRichEdit = static_cast<CRichEditUI*>(m_pm.FindControl(_T("chatmsglist")));
 					if (pRichEdit) {
-						pRichEdit->SetText(_T("欢迎进入XXX游戏,祝游戏愉快!\n\n"));
+						pRichEdit->SetText(_T("娆㈣繋杩涘叆XXX娓告垙锛岀�娓告垙鎰夊揩锛乗n\n"));
 						long lSelBegin = 0, lSelEnd = 0;
 						CHARFORMAT2 cf;
 						ZeroMemory(&cf, sizeof(CHARFORMAT2));
@@ -242,26 +150,6 @@ public:
 				static_cast<CComboUI*>(msg.pSender)->SelectItem(-1);
 			}
 		}
-		else if (msg.sType == _T("return")) {
-			if (msg.pSender->GetName() == _T("chatEdit")) {
-				SendChatMessage();
-			}
-		}
-	}
-
-	LPCTSTR GetItemText(CControlUI* pControl, int iIndex, int iSubItem)
-	{
-		if (pControl->GetParent()->GetParent()->GetName() == _T("userlist")) {
-			if (iSubItem == 0) return _T("<i vip.png>");
-			if (iSubItem == 1) return _T("<i vip.png>");
-			if (iSubItem == 2) return _T("此人昵称");
-			if (iSubItem == 3) return _T("5");
-			if (iSubItem == 4) return _T("50%");
-			if (iSubItem == 5) return _T("0%");
-			if (iSubItem == 6) return _T("100");
-		}
-
-		return _T("");
 	}
 
 	LRESULT OnCreate(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
@@ -274,7 +162,7 @@ public:
 		CDialogBuilder builder;
 		CDialogBuilderCallbackEx cb;
 
-		CControlUI* pRoot = builder.Create(_T("hall.xml"), (UINT)0, &cb, &m_pm);
+		CControlUI* pRoot = builder.Create(_T("main.xml"), (UINT)0, &cb, &m_pm);
 		ASSERT(pRoot && "Failed to parse XML");
 
 		m_pm.AttachDialog(pRoot);
@@ -390,7 +278,7 @@ public:
 
 	LRESULT OnSysCommand(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
 	{
-		// 有时会在收到WM_NCDESTROY后收到wParam为SC_CLOSE的WM_SYSCOMMAND
+		// 鏈夋椂浼氬湪鏀跺埌WM_NCDESTROY鍚庢敹鍒皐Param涓篠C_CLOSE鐨刉M_SYSCOMMAND
 		if (wParam == SC_CLOSE) {
 			::PostQuitMessage(0L);
 			bHandled = TRUE;

+ 8 - 3
lewaimai_dispatch/CLoginWnd.h

@@ -1,4 +1,4 @@
-#pragma once
+#pragma once
 
 #include "pch/pch.h"
 #include "CGameFrameWnd.h"
@@ -23,7 +23,7 @@ public:
 
 	void Init() {
 		CEditUI* pAccountEdit = static_cast<CEditUI*>(m_pm.FindControl(_T("accountedit")));
-		if (pAccountEdit) pAccountEdit->SetText(_T("ワ怀⻌秷巛赽埜馱梖瘍"));
+		if (pAccountEdit) pAccountEdit->SetText(_T(""));
 		pAccountEdit->SetFocus();
 	}
 
@@ -50,7 +50,9 @@ public:
 		styleValue &= ~WS_CAPTION;
 		::SetWindowLong(*this, GWL_STYLE, styleValue | WS_CLIPSIBLINGS | WS_CLIPCHILDREN);
 
+		// 把自己的窗口句柄与窗口绘制管理器挂接在一起
 		m_pm.Init(m_hWnd);
+
 		m_pm.AddPreMessageFilter(this);
 
 		CDialogBuilder builder;
@@ -59,7 +61,10 @@ public:
 		CControlUI* pRoot = builder.Create(_T("login.xml"), (UINT)0, &cb, &m_pm);
 		ASSERT(pRoot && "Failed to parse XML");
 
+		// 把这些控件绘制到本窗口上
 		m_pm.AttachDialog(pRoot);
+
+		// 把自己加入到CPaintManagerUI的m_aNotifiers数组中,用于处理Notify函数
 		m_pm.AddNotifier(this);
 
 		Init();
@@ -182,7 +187,7 @@ public:
 		}
 
 		pFrame->SetIcon(IDI_ICON_DUILIB);
-		pFrame->Create(NULL, _T("蚔牁笢陑"), UI_WNDSTYLE_FRAME, 0L, 0, 0, 1024, 738);
+		pFrame->Create(NULL, _T("游戏中心"), UI_WNDSTYLE_FRAME, 0L, 0, 0, 1024, 738);
 		pFrame->CenterWindow();
 
 		::ShowWindow(*pFrame, SW_SHOWMAXIMIZED);

+ 1 - 1
lewaimai_dispatch/lewaimai_dispatch_windows.cpp

@@ -24,7 +24,7 @@ int APIENTRY wWinMain(_In_ HINSTANCE hInstance,
 
 	CLoginFrameWnd* pLoginFrame = new CLoginFrameWnd();
 	if (pLoginFrame == NULL) { return 0; }
-	pLoginFrame->Create(NULL, _T("请登录"), UI_WNDSTYLE_DIALOG, 0, 0, 0, 0, 0, NULL);
+	pLoginFrame->Create(NULL, _T(""), UI_WNDSTYLE_DIALOG, 0, 0, 0, 0, 0, NULL);
 	pLoginFrame->SetIcon(IDI_ICON_DUILIB);
 	pLoginFrame->CenterWindow();
 	pLoginFrame->ShowModal();