コード例 #1
0
//用户加注
bool CGameClientDlg::OnSubAddScore(const void * pBuffer, WORD wDataSize)
{
	//效验数据
	if (wDataSize!=sizeof(CMD_S_AddScore)) return false;
	CMD_S_AddScore * pAddScore=(CMD_S_AddScore *)pBuffer;

	//变量定义
	WORD wMeChairID=GetMeChairID();
	WORD wAddScoreUser=pAddScore->wAddScoreUser;
	WORD wViewChairID=SwitchViewChairID(wAddScoreUser);

	//梭哈判断
	if (m_bShowHand==false)
	{
		//获取用户
		const tagUserData * pUserData=GetUserData(wAddScoreUser);
		if (pUserData!=NULL) m_bShowHand=(pUserData->lScore==(m_lTableScore[wAddScoreUser*2+1]+pAddScore->lAddScoreCount));
	}

	//加注处理
	if ((IsLookonMode()==true)||(pAddScore->wAddScoreUser!=wMeChairID))
	{
		//加注界面
		m_GameClientView.m_PlayerJeton[wViewChairID].SetScore(pAddScore->lAddScoreCount);

		//播放声音
		if (m_cbPlayStatus[wAddScoreUser]==TRUE)
		{
			//获取积分
			const tagUserData * pUserData=(tagUserData *)GetUserData(wAddScoreUser);
			LONG lTableScore=m_lTableScore[wAddScoreUser*2+1];
			LONG lTurnAddScore=m_lTableScore[wAddScoreUser*2];
			LONG lShowHandScore=pUserData->lScore-lTableScore;

			//播放声音
			if ((pAddScore->lAddScoreCount-lTurnAddScore)==0L) PlayGameSound(AfxGetInstanceHandle(),TEXT("NO_ADD"));
			else if (pAddScore->lAddScoreCount==lShowHandScore) PlayGameSound(AfxGetInstanceHandle(),TEXT("SHOW_HAND"));
			else if ((pAddScore->lAddScoreCount+lTableScore)==m_lTurnLessScore) PlayGameSound(AfxGetInstanceHandle(),TEXT("FOLLOW"));
			else PlayGameSound(AfxGetInstanceHandle(),TEXT("ADD_SCORE"));
		}
	}

	//设置变量
	m_wCurrentUser=pAddScore->wCurrentUser;
	m_lTurnLessScore=pAddScore->lTurnLessScore;
	m_lTableScore[wAddScoreUser*2]=pAddScore->lAddScoreCount;

	//设置筹码
	m_GameClientView.SetUserTableScore(wViewChairID,m_lTableScore[wAddScoreUser*2+1]+m_lTableScore[wAddScoreUser*2]);
	m_GameClientView.UpdateGameView(NULL);

	//控制界面
	if ((IsLookonMode()==false)&&(pAddScore->wCurrentUser==wMeChairID))
	{
		ActiveGameFrame();
		UpdateScoreControl();
	}

	//设置时间
	if (m_wCurrentUser==INVALID_CHAIR) KillGameTimer(IDI_USER_ADD_SCORE);
	else SetGameTimer(m_wCurrentUser,IDI_USER_ADD_SCORE,TIME_USER_ADD_SCORE);

	return true;
}
コード例 #2
0
ファイル: GameFrameDlg.cpp プロジェクト: 275958081/netfox
//////////////////////////////////////////////////////////////////////////
//功能:调用视频DLL
//输入:
//返回:
void CGameFrameDlg::SetupVideoDLL()
{
	CString strFile,strTemp;
	CTime tmCur = CTime::GetCurrentTime();
	CString strTime = tmCur.Format("%m%d");
	strFile.Format("log\\%sSetupVideoDLL.log",strTime);

	strTemp.Format("into SetupVideoDLL");
	WriteLog(strFile, strTemp);

	myhinstDLL = AfxLoadLibrary("FlyGameAVClient.dll");

	if (myhinstDLL)
	{}
	else
	{
		AfxMessageBox("视频组件调用失败!");
		isHaveSetupAV = 2;//调用失败
		return ;
	}//End if

	//StopAVClient
	if ( myhinstDLL )
	{
		StopAVClient Proc;
		Proc = (StopAVClient) GetProcAddress( myhinstDLL, "StopAVClient");

		int		iTemp = Proc();
		//	FreeLibrary( hinstDLL );
	}
	else
	{
		//	AfxMessageBox("Not found dll !");
	}//End if	

	if ( myhinstDLL )
	{
		CString avServerIPStr, userIDStr, roomIDStr, tableIDStr, deskIDStr;

		char avServerIP[50];
		char *p;

		WORD wChairID=GetMeChairID();
		const tagUserData * pUserInfo=GetUserData(wChairID);

		if (pUserInfo!=NULL)
		{
			userIDStr.Format("%d", pUserInfo->dwUserID);//
			deskIDStr.Format("%d", wChairID);//椅子位置
			tableIDStr.Format("%d", pUserInfo->wTableID );//桌子号码
		}

		//房间编号
		ASSERT(m_ClientKernelHelper.GetInterface()!=NULL);
		const tagServerAttribute * pServer = m_ClientKernelHelper->GetServerAttribute();
		roomIDStr.Format("%d", pServer->wServerID);

		CString myIPStr ;
		myIPStr = Glb().m_CenterServerIPAddr;
		myIPStr.Replace("http://", "");

		strTemp.Format("myIPStr %s", myIPStr);
		WriteLog(strFile, strTemp);

		avServerIPStr.Format("%s", myIPStr );//采用中心服务器IP

		CString showMsg;
		showMsg.Format("userid=%s, roomid=%s, tableIDStr=%s, deskIDStr=%s,avServerIPStr=%s", userIDStr, roomIDStr,tableIDStr, deskIDStr, avServerIPStr );
		//AfxMessageBox(showMsg);

		strTemp.Format("into SetupVideoDLL %s", showMsg);
		WriteLog(strFile, strTemp);

		p= avServerIPStr.GetBuffer(avServerIPStr.GetLength());
		strcpy( avServerIP, p);

		HWND myhWnd = m_showSelfVideo.m_hWnd;

		StartAVClient Proc;
		Proc = (StartAVClient) GetProcAddress( myhinstDLL, "StartAVClient");

		int		iTemp = Proc(myhWnd /*myCwnd this*/, 
			avServerIP,
			UDP_SOCKET_REG_PORT     , 
			atoi(userIDStr),
			atoi(roomIDStr), 
			atoi(tableIDStr),
			atoi(deskIDStr)
			);
		//	FreeLibrary( hinstDLL );
	}
	else
	{
		//AfxMessageBox("Not found dll !");
	}//End if	

	HWND hRemoteWnd[REMOTE_VIDEO_MAX_NUM];
	hRemoteWnd[0] = 	m_showRemoteVideo.m_hWnd;
	hRemoteWnd[1] = 	m_showRemoteVideo1.m_hWnd;
	hRemoteWnd[2] = 	m_showRemoteVideo2.m_hWnd;
	hRemoteWnd[3] = 	m_showRemoteVideo3.m_hWnd;

	for (int i=0; i <REMOTE_VIDEO_MAX_NUM ; i++)
	{
		SetOneRemoteShowHWND( hRemoteWnd[i], i);
	}
	/*
	if ( myhinstDLL )
	{
	AVClientSendRegMsg Proc;
	Proc = (AVClientSendRegMsg) GetProcAddress( myhinstDLL, "AVClientSendRegMsg");

	int		iTemp = Proc();
	//	FreeLibrary( hinstDLL );
	}
	else
	{
	AfxMessageBox("Not found dll !");

	}	

	if ( myhinstDLL )
	{
	GetOneTablePlayerList Proc;
	Proc = (GetOneTablePlayerList) GetProcAddress( myhinstDLL, "GetOneTablePlayerList");

	int		iTemp = Proc();
	//	FreeLibrary( hinstDLL );
	}
	else
	{
	AfxMessageBox("Not found dll !");
	}	
	*/
	FlyAVClientSendRegMsg();
	FlyGetOneTablePlayerList();

	isHaveSetupAV = 1;//调用成功
}
コード例 #3
0
ファイル: GameClientDlg.cpp プロジェクト: 275958081/netfox
//游戏结束
bool CGameClientDlg::OnSubGameEnd(const void * pBuffer, WORD wDataSize)
{
	//效验数据
	ASSERT(wDataSize==sizeof(CMD_S_GameEnd));
	if (wDataSize!=sizeof(CMD_S_GameEnd)) return false;

	//消息处理
	CMD_S_GameEnd * pGameEnd=(CMD_S_GameEnd *)pBuffer;

	//删除定时器
	KillTimer(IDI_MOST_CARD);
	KillGameTimer(IDI_OUT_CARD);
	KillGameTimer(IDI_LAND_SCORE);

	//隐藏控件
	m_GameClientView.m_btOutCard.ShowWindow(SW_HIDE);
	m_GameClientView.m_btPassCard.ShowWindow(SW_HIDE);
	m_GameClientView.m_btOneScore.ShowWindow(SW_HIDE);
	m_GameClientView.m_btTwoScore.ShowWindow(SW_HIDE);
	m_GameClientView.m_btThreeScore.ShowWindow(SW_HIDE);
	m_GameClientView.m_btGiveUpScore.ShowWindow(SW_HIDE);
	m_GameClientView.m_btAutoOutCard.ShowWindow(SW_HIDE);

	//禁用控件
	m_GameClientView.m_btOutCard.EnableWindow(FALSE);
	m_GameClientView.m_btPassCard.EnableWindow(FALSE);

	//设置积分
	for (WORD i=0;i<GAME_PLAYER;i++)
	{
		const tagUserData * pUserData=GetUserData(i);
		m_GameClientView.m_ScoreView.SetGameScore(i,pUserData->szName,pGameEnd->lGameScore[i]);
	}
	m_GameClientView.m_ScoreView.SetGameTax(pGameEnd->lGameTax);
	m_GameClientView.m_ScoreView.ShowWindow(SW_SHOW);

	//设置扑克
	BYTE bCardPos=0;
	for (WORD i=0;i<GAME_PLAYER;i++)
	{
		WORD wViewChairID=SwitchViewChairID(i);
		if (wViewChairID==0) 
		{
			m_GameClientView.m_LeaveCardControl[0].SetCardData(&pGameEnd->bCardData[bCardPos],pGameEnd->bCardCount[i]);
		}
		else if (wViewChairID==2) 
		{
			m_GameClientView.m_LeaveCardControl[1].SetCardData(&pGameEnd->bCardData[bCardPos],pGameEnd->bCardCount[i]);
		}//End if (wViewChairID==0) 

		bCardPos+=pGameEnd->bCardCount[i];
		if (pGameEnd->bCardCount[i]!=0)
		{
			m_GameClientView.SetPassFlag(wViewChairID,false);
			m_GameClientView.m_UserCardControl[wViewChairID].SetCardData(NULL,0);
		}//End if (pGameEnd->bCardCount[i]!=0)
	}//End for (WORD i=0;i<GAME_PLAYER;i++)

	//显示扑克
	if (IsLookonMode()==true) m_GameClientView.m_HandCardControl.SetDisplayFlag(true);

	//播放声音
	WORD wMeChairID=GetMeChairID();
	LONG lMeScore=pGameEnd->lGameScore[GetMeChairID()];
	if (lMeScore>0L) PlayGameSound(AfxGetInstanceHandle(),TEXT("GAME_WIN"));
	else if (lMeScore<0L) PlayGameSound(AfxGetInstanceHandle(),TEXT("GAME_LOST"));
	else PlayGameSound(GetModuleHandle(NULL),TEXT("GAME_END"));

	//设置界面
	if (IsLookonMode()==false)
	{
		m_GameClientView.m_btStart.ShowWindow(SW_SHOW);
		SetGameTimer(GetMeChairID(),IDI_START_GAME,90);
	}
	m_GameClientView.ShowLandTitle(false);

	return true;
}
コード例 #4
0
	/**
	 * This static method is the window procedure for the dialog.
	 *
	 * @param		hDlg	- handle of the dialog window
	 * @param		uMsg	- message to handle
	 * @param		wParam	- message dependend parameter
	 * @param		lParam	- message dependend parameter
	 *
	 * @return	depends on message
	 **/
	static INT_PTR CALLBACK DlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
	{
		CAnnivList *pDlg = (CAnnivList *)GetUserData(hDlg);
		
		switch (uMsg) {
		case WM_INITDIALOG:
			{
				HWND hCtrl;
				HICON hIcon;
				RECT rc;

				// link the class to the window handle
				pDlg = (CAnnivList *)lParam;
				if (!pDlg)
					break;
				SetUserData(hDlg, lParam);
				pDlg->_hDlg = hDlg;

				// init pointer listview control
				pDlg->_hList = GetDlgItem(hDlg, EDIT_ANNIVERSARY_DATE);
				if (!pDlg->_hList)
					break;

				// set icons
				hIcon = IcoLib_GetIcon(ICO_DLG_ANNIVERSARY);
				SendDlgItemMessage(hDlg, IDC_HEADERBAR, WM_SETICON, 0, (LPARAM)hIcon);
				SendMessage(hDlg, WM_SETICON, ICON_BIG, (LPARAM)hIcon);

				// insert columns into the listboxes
				ListView_SetExtendedListViewStyle(pDlg->_hList, LVS_EX_FULLROWSELECT);

				// add columns
				if (pDlg->AddColumn(CAnnivList::COLUMN_ETA, LPGENT("ETA"), 40)
					|| pDlg->AddColumn(CAnnivList::COLUMN_CONTACT, LPGENT("Contact"), 160)
					|| pDlg->AddColumn(CAnnivList::COLUMN_PROTO, LPGENT("Proto"), 50)
					|| pDlg->AddColumn(CAnnivList::COLUMN_AGE, LPGENT("Age/Nr."), 40)
					|| pDlg->AddColumn(CAnnivList::COLUMN_DESC, LPGENT("Anniversary"), 100)
					|| pDlg->AddColumn(CAnnivList::COLUMN_DATE, LPGENT("Date"), 80))
					break;

				TranslateDialogDefault(hDlg);
				
				// save minimal size
				GetWindowRect(hDlg, &rc);
				pDlg->_sizeMin.cx = rc.right - rc.left;
				pDlg->_sizeMin.cy = rc.bottom - rc.top;
				
				// restore position and size
				Utils_RestoreWindowPosition(hDlg, NULL, MODNAME, "AnnivDlg_");

				//save win pos
				GetWindowRect(hDlg, &pDlg->_rcWin);

				// add filter strings
				if (hCtrl = GetDlgItem(hDlg, COMBO_VIEW)) {
					ComboBox_AddString(hCtrl, TranslateT("All contacts"));
					ComboBox_AddString(hCtrl, TranslateT("Birthdays only"));
					ComboBox_AddString(hCtrl, TranslateT("Anniversaries only"));
					ComboBox_AddString(hCtrl, TranslateT("Disabled reminder"));
					ComboBox_SetCurSel(hCtrl, pDlg->_filter.bFilterIndex);
				}

				// init reminder groups
				pDlg->_bRemindEnable = db_get_b(NULL, MODNAME, SET_REMIND_ENABLED, DEFVAL_REMIND_ENABLED) != REMIND_OFF;
				if (hCtrl = GetDlgItem(hDlg, CHECK_REMIND)) {
					Button_SetCheck(hCtrl, pDlg->_bRemindEnable ? BST_INDETERMINATE : BST_UNCHECKED);
					EnableWindow(hCtrl, pDlg->_bRemindEnable);
				}

				CheckDlgButton(hDlg, CHECK_POPUP, db_get_b(NULL, MODNAME, SET_ANNIVLIST_POPUP, FALSE) ? BST_CHECKED : BST_UNCHECKED);
				// set number of days to show contact in advance
				SetDlgItemInt(hDlg, EDIT_DAYS, pDlg->_filter.wDaysBefore, FALSE);
				if (hCtrl = GetDlgItem(hDlg, CHECK_DAYS)) {
					Button_SetCheck(hCtrl, db_get_b(NULL, MODNAME, SET_ANNIVLIST_FILTER_DAYSENABLED, FALSE));
					DlgProc(hDlg, WM_COMMAND, MAKEWPARAM(CHECK_DAYS, BN_CLICKED), (LPARAM)hCtrl);
				}

				pDlg->_wmINIT = false;
			}
			return TRUE;

		// set propertysheet page's background white in aero mode
		case WM_CTLCOLORSTATIC:
		case WM_CTLCOLORDLG:
			if (IsAeroMode())
				return (INT_PTR)GetStockBrush(WHITE_BRUSH);
			break;

		case WM_NOTIFY:
			switch (((LPNMHDR)lParam)->idFrom) {
			case EDIT_ANNIVERSARY_DATE:
				switch (((LPNMHDR)lParam)->code) {
				// handle changed selection
				case LVN_ITEMCHANGED:
					{
						CItemData *pid;
						HWND hCheck;

						pDlg->_curSel = ((LPNMLISTVIEW)lParam)->iItem;
						pid = pDlg->ItemData(pDlg->_curSel);
						if (pid && pDlg->_bRemindEnable && (hCheck = GetDlgItem(hDlg, CHECK_REMIND))) {
							SetDlgItemInt(hDlg, EDIT_REMIND, pid->_wDaysBefore, FALSE);
							Button_SetCheck(hCheck, pid->_wReminderState);
							DlgProc(hDlg, WM_COMMAND, MAKEWPARAM(CHECK_REMIND, BN_CLICKED), (LPARAM)hCheck);
						}
					}
					break;

				// resort the list
				case LVN_COLUMNCLICK:
					{
						LPNMLISTVIEW pnmv = (LPNMLISTVIEW)lParam;

						if (pDlg->_sortHeader == pnmv->iSubItem)
							pDlg->_sortOrder *= -1;
						else {
							pDlg->_sortOrder = 1;
							pDlg->_sortHeader = pnmv->iSubItem;
						}
						ListView_SortItemsEx(pDlg->_hList, (CMPPROC)cmpProc, pDlg);
					}
					break;

				// show contact menu
				case NM_RCLICK:
					{
						CItemData *pid = pDlg->ItemData(pDlg->_curSel);
						if (pid) {
							HMENU hPopup = Menu_BuildContactMenu(pid->_hContact);
							if (hPopup) {
								POINT pt;
								GetCursorPos(&pt);
								TrackPopupMenu(hPopup, TPM_TOPALIGN | TPM_LEFTALIGN | TPM_RIGHTBUTTON, pt.x, pt.y, 0, hDlg, NULL);
								DestroyMenu(hPopup);
							}
						}
					}
					break;

				// handle double click on contact: show message dialog
				case NM_DBLCLK:
					{
						CItemData *pid = pDlg->ItemData(((LPNMITEMACTIVATE)lParam)->iItem);
						if (pid)
							CallService(MS_MSG_SENDMESSAGE,(WPARAM)pid->_hContact, NULL);
					}
				}
			}
			break;

		case WM_COMMAND:
			if (PtrIsValid(pDlg)) {
				CItemData* pid = pDlg->ItemData(pDlg->_curSel);

				// process contact menu command
				if (pid && CallService(MS_CLIST_MENUPROCESSCOMMAND, MAKEWPARAM(LOWORD(wParam), MPCF_CONTACTMENU), (LPARAM)pid->_hContact))
					break;

				switch (LOWORD(wParam)) {
				// enable/disable reminder checkbox is clicked
				case CHECK_REMIND:
					if (pDlg->_bRemindEnable && HIWORD(wParam) == BN_CLICKED) {
						BYTE checkState = Button_GetCheck((HWND)lParam);

						EnableWindow(GetDlgItem(hDlg, EDIT_REMIND), checkState == BST_CHECKED);
						EnableWindow(GetDlgItem(hDlg, SPIN_REMIND), checkState == BST_CHECKED);
						if (pid && pid->_wReminderState != checkState)
							pid->_wReminderState = checkState;
					}
					break;

				// number of days to remind in advance is edited
				case EDIT_REMIND:
					if (pid && pDlg->_bRemindEnable && HIWORD(wParam) == EN_CHANGE) {
						WORD wDaysBefore = GetDlgItemInt(hDlg, LOWORD(wParam), NULL, FALSE);
						if (pid->_wReminderState == BST_CHECKED && pid->_wDaysBefore != wDaysBefore) {
							pid->_wDaysBefore = wDaysBefore;
						}
					}
					break;

				// the filter to display only contacts which have an anniversary in a certain 
				// period of time is enabled/disabled
				case CHECK_DAYS:
					if (HIWORD(wParam) == BN_CLICKED) {
						BYTE isChecked = Button_GetCheck((HWND)lParam);
						EnableWindow(GetDlgItem(hDlg, EDIT_DAYS), isChecked);
						EnableWindow(GetDlgItem(hDlg, TXT_DAYS), isChecked);
						pDlg->_filter.wDaysBefore = isChecked ? GetDlgItemInt(hDlg, EDIT_DAYS, NULL, FALSE) : (WORD)-1;
						pDlg->RebuildList();
					}
					break;

				// the number of days a contact must have an anniversary in advance to be displayed is edited
				case EDIT_DAYS:
					if (HIWORD(wParam) == EN_CHANGE) {
						WORD wNewDays = GetDlgItemInt(hDlg, LOWORD(wParam), NULL, FALSE);
						if (wNewDays != pDlg->_filter.wDaysBefore) {
							pDlg->_filter.wDaysBefore = wNewDays;
							pDlg->RebuildList();
						}
					}
					break;

				// the filter selection of the filter combobox has changed
				case COMBO_VIEW:
					if (HIWORD(wParam) == CBN_SELCHANGE) {
						pDlg->_filter.bFilterIndex = ComboBox_GetCurSel((HWND)lParam);
						pDlg->RebuildList();
					}
				}
			}
			break;

		case WM_DRAWITEM:
			return Menu_DrawItem((LPDRAWITEMSTRUCT)lParam);

		case WM_MEASUREITEM:
			return Menu_MeasureItem((LPMEASUREITEMSTRUCT)lParam);

		case WM_WINDOWPOSCHANGING:
			if (PtrIsValid(pDlg)) {
				WINDOWPOS *wndPos = (WINDOWPOS *)lParam;
				if (!pDlg->_wmINIT && (wndPos->cx != 0 || wndPos->cy != 0)) {
					//win pos change
					if ((wndPos->cx == pDlg->_rcWin.right - pDlg->_rcWin.left) && (wndPos->cy == pDlg->_rcWin.bottom - pDlg->_rcWin.top))
						//win pos change (store new pos)
						GetWindowRect(hDlg, &pDlg->_rcWin);
					//win size change
					else {
						// l change
						if ((wndPos->cx < pDlg->_sizeMin.cx) && (wndPos->x > pDlg->_rcWin.left)) {
							wndPos->x  = wndPos->x + wndPos->cx - pDlg->_sizeMin.cx;
							wndPos->cx = pDlg->_sizeMin.cx;
						}
						// r change
						else if (wndPos->cx < pDlg->_sizeMin.cx)
							wndPos->cx = pDlg->_sizeMin.cx;

						// t change
						if ((wndPos->cy < pDlg->_sizeMin.cy) && (wndPos->y > pDlg->_rcWin.top)) {
							wndPos->y  = wndPos->y + wndPos->cy - pDlg->_sizeMin.cy;
							wndPos->cy = pDlg->_sizeMin.cy;
						}
						// b change
						else if (wndPos->cy < pDlg->_sizeMin.cy)
							wndPos->cy = pDlg->_sizeMin.cy;

						pDlg->_rcWin.left = wndPos->x;
						pDlg->_rcWin.right = wndPos->x + wndPos->cx;
						pDlg->_rcWin.top = wndPos->y;
						pDlg->_rcWin.bottom = wndPos->y + wndPos->cy;
					}
				}

				CAnchor anchor(wndPos, pDlg->_sizeMin);
				int anchorPos = CAnchor::ANCHOR_LEFT | CAnchor::ANCHOR_RIGHT | CAnchor::ANCHOR_TOP;

				anchor.MoveCtrl(IDC_HEADERBAR, anchorPos);
				anchor.MoveCtrl(GROUP_STATS, anchorPos);

				// birthday list
				anchor.MoveCtrl(EDIT_ANNIVERSARY_DATE, CAnchor::ANCHOR_ALL);

				anchorPos = CAnchor::ANCHOR_RIGHT | CAnchor::ANCHOR_BOTTOM;

				// filter group
				anchor.MoveCtrl(GROUP_FILTER, anchorPos);
				anchor.MoveCtrl(COMBO_VIEW, anchorPos);
				anchor.MoveCtrl(CHECK_DAYS, anchorPos);
				anchor.MoveCtrl(EDIT_DAYS, anchorPos);
				anchor.MoveCtrl(TXT_DAYS, anchorPos);

				// filter group
				anchor.MoveCtrl(GROUP_REMINDER, anchorPos);
				anchor.MoveCtrl(CHECK_REMIND, anchorPos);
				anchor.MoveCtrl(EDIT_REMIND, anchorPos);
				anchor.MoveCtrl(SPIN_REMIND, anchorPos);
				anchor.MoveCtrl(TXT_REMIND6, anchorPos);
				anchor.MoveCtrl(CHECK_POPUP, anchorPos);
			}
			break;

		// This message is sent if eighter the user clicked on the close button or
		// Miranda fires the ME_SYSTEM_SHUTDOWN event.
		case WM_CLOSE:
			DestroyWindow(hDlg);
			break;

		// If the anniversary list is destroyed somehow, the data class must be deleted, too.
		case WM_DESTROY:
			if (PtrIsValid(pDlg)) {
				SetUserData(hDlg, NULL);
				delete pDlg;
			}
			break;
		}
		return FALSE;
	}
コード例 #5
0
ファイル: OpPersonalbar.cpp プロジェクト: prestocore/browser
BOOL OpPersonalbar::OnInputAction(OpInputAction* action)
{
    OpTreeModel* model = (OpTreeModel*) GetUserData(GetFocused());

    if (model)
    {
        INT32 id = GetWidget(GetFocused())->GetID();

        switch (action->GetAction())
        {
        case OpInputAction::ACTION_EDIT_PROPERTIES:
        {
#ifdef DESKTOP_UTIL_SEARCH_ENGINES
            if (model != g_searchEngineManager)
            {
#endif // DESKTOP_UTIL_SEARCH_ENGINES
                g_desktop_bookmark_manager->EditItem( id, GetWidgetContainer()->GetParentDesktopWindow());
#ifdef DESKTOP_UTIL_SEARCH_ENGINES
            }
            else
            {
                g_input_manager->InvokeAction(OpInputAction::ACTION_SHOW_PREFERENCES, NewPreferencesDialog::SearchPage);
            }
#endif // DESKTOP_UTIL_SEARCH_ENGINES
            return TRUE;
        }

        case OpInputAction::ACTION_HIDE_FROM_PERSONAL_BAR:
        {
#ifdef DESKTOP_UTIL_SEARCH_ENGINES
            if (model != g_searchEngineManager)
            {
#endif // DESKTOP_UTIL_SEARCH_ENGINES
                g_hotlist_manager->ShowOnPersonalBar(id, FALSE );
                Write();
#ifdef DESKTOP_UTIL_SEARCH_ENGINES
            }
            else
            {
                OpTreeModelItem* search;
                g_searchEngineManager->GetItemByID(id, search);
                if(search)
                {
                    ((SearchTemplate*)search)->SetPersonalbarPos(-1);
                    g_searchEngineManager->ChangeItem((SearchTemplate*)search,
                                                      g_searchEngineManager->FindItem((SearchTemplate*)search),
                                                      SearchEngineManager::FLAG_PERSONALBAR);
                }
                Write();
            }
#endif // DESKTOP_UTIL_SEARCH_ENGINES
            return TRUE;
        }
        }
    }

    BOOL handled = OpToolbar::OnInputAction(action);

    if(!g_application->IsCustomizingToolbars())
    {
        // this action comes from a menu so only refresh it then
        switch (action->GetAction())
        {
        case OpInputAction::ACTION_SET_ALIGNMENT:
        case OpInputAction::ACTION_SET_BUTTON_STYLE:
        {
            // force a relayout of the window
            g_application->SettingsChanged(SETTINGS_TOOLBAR_SETUP);
            break;
        }
        }

    }
    return handled;
}
コード例 #6
0
//游戏开始
bool CGameClientDlg::OnSubGameStart(const void * pBuffer, WORD wDataSize)
{
	//效验数据
	ASSERT(wDataSize==sizeof(CMD_S_GameStart));
	if (wDataSize!=sizeof(CMD_S_GameStart)) return false;
	m_GameClientView.SetCenterCount();

	//设置状态
	SetGameStatus(GS_PLAYING);

	//旁观玩家
	if(IsLookonMode())
	{
		//清理界面
		m_GameClientView.SetGameEndEnd();
		m_GameClientView.m_ScoreView.ShowWindow(SW_HIDE);
		m_GameClientView.m_btStart.ShowWindow(SW_HIDE);
		m_GameClientView.m_btExit.ShowWindow(SW_HIDE);
		m_GameClientView.m_ScoreView.SetStartTimes(false);
		ZeroMemory(m_cbHandCardData,sizeof(m_cbHandCardData));
		ZeroMemory(m_cbCenterCardData,sizeof(m_cbCenterCardData));
		ZeroMemory(m_cbPlayStatus,sizeof(m_cbPlayStatus));
		ZeroMemory(m_lTableScore,sizeof(m_lTableScore));
		for (WORD i = 0;i<GAME_PLAYER;i++)
		{
			m_GameClientView.SetUserTableScore(i,m_lTableScore[i]);
			m_GameClientView.SetTotalScore(i,0L);
			m_GameClientView.m_SmallCardControl[i].SetCardData(NULL,0);
			m_GameClientView.m_CardControl[i].SetCardData(NULL,0);
		}
		m_GameClientView.m_CenterCardControl.SetCardData(NULL,0);
		m_GameClientView.SetDFlag(INVALID_CHAIR);
		m_GameClientView.SetCenterScore(0L);
		m_lCenterScore = 0L;
		m_lCellScore = 0L;
	}

	//消息处理
	CMD_S_GameStart * pGameStart=(CMD_S_GameStart *)pBuffer;

	//设置变量
	m_wDUser = pGameStart->wDUser;
	m_wCurrentUser = pGameStart->wCurrentUser;
	m_lAddLessScore = pGameStart->lAddLessScore;
	m_lTurnLessScore = pGameStart->lTurnLessScore;
	m_lTurnMaxScore = pGameStart->lTurnMaxScore;
	m_lCellScore = pGameStart->lCellScore;

	//用户状态
	for (WORD i=0;i<GAME_PLAYER;i++)
	{
		//获取用户
		const tagUserData * pUserData=GetUserData(i);
		if (pUserData!=NULL) 
		{
			//游戏信息
			//m_GameClientView.SetUserIdInfo(i,pUserData);
			m_cbPlayStatus[i]=TRUE;
		}
		else 
		{
			//m_GameClientView.SetUserIdInfo(i,NULL);
			m_cbPlayStatus[i]=FALSE;
		}
	}

	//环境设置
	PlayGameSound(AfxGetInstanceHandle(),TEXT("GAME_START"));

	//加注信息
	m_lTableScore[pGameStart->wDUser] += m_lCellScore;
	m_lTableScore[pGameStart->wMaxChipInUser] = 2*m_lCellScore;
	m_lTotalScore[pGameStart->wDUser] =  m_lCellScore;
	m_lTotalScore[pGameStart->wMaxChipInUser] = 2*m_lCellScore;

	//设置界面
	m_GameClientView.SetDFlag(m_wDUser);
	m_GameClientView.DrawMoveAnte(pGameStart->wDUser,CGameClientView::AA_BASEFROM_TO_BASEDEST,m_lTotalScore[pGameStart->wDUser]);
	m_GameClientView.DrawMoveAnte(pGameStart->wMaxChipInUser,CGameClientView::AA_BASEFROM_TO_BASEDEST,m_lTotalScore[pGameStart->wMaxChipInUser]);	
	m_GameClientView.SetTotalScore(pGameStart->wDUser,m_lTotalScore[pGameStart->wDUser]);
	m_GameClientView.SetTotalScore(pGameStart->wMaxChipInUser,m_lTotalScore[pGameStart->wMaxChipInUser]);

	//发送暗牌
	CopyMemory(m_cbHandCardData,pGameStart->cbCardData,sizeof(m_cbHandCardData));
	for (BYTE j = 0;j<2;j++)
	{
		for (WORD i=0;i<GAME_PLAYER;i++)
		{
			if (m_cbPlayStatus[i]==TRUE)
			{
				if(GetMeChairID()==i)
				{
					m_GameClientView.DrawMoveCard(i,TO_USERCARD,m_cbHandCardData[i][j]);
				}
				else 
				{
					m_GameClientView.DrawMoveCard(i,TO_USERCARD,0);
				}
			}
		}
	}

	////控件设置
	//if ((IsLookonMode()==false)&&(m_wCurrentUser==GetMeChairID()))
	//{
	//	ActiveGameFrame();
	//	UpdateScoreControl();
	//}
	//SetGameTimer(m_wCurrentUser,IDI_USER_ADD_SCORE,TIME_USER_ADD_SCORE);

	return true;
}
コード例 #7
0
ファイル: GameClientDlg.cpp プロジェクト: codercold/whgame
//播放出牌声音
void CGameClientDlg::PlayCardSound(WORD wChairID, BYTE cbCardData)
{
	if(m_GameLogic.IsValidCard(cbCardData) == false)
	{
		return;
	}
	if(wChairID < 0 || wChairID > 3)
	{
		return;
	}

	//判断性别
	const tagUserData* pUserData = GetUserData(wChairID);
	if(pUserData == 0)
	{
		assert(0 && "得不到玩家信息");
		return;
	}
	bool bGirl = ((pUserData->cbGender==2) ? true : false);
	BYTE cbType= (cbCardData & MASK_COLOR);
	BYTE cbValue= (cbCardData & MASK_VALUE);
	CString strSoundName;
	switch(cbType)
	{
	case 0X30:	//风
		{
			switch(cbValue) 
			{
			case 1:
				{
					strSoundName = _T("F_1");
					break;
				}
			case 2:
				{
					strSoundName = _T("F_2");
					break;
				}
			case 3:
				{
					strSoundName = _T("F_3");
					break;
				}
			case 4:
				{
					strSoundName = _T("F_4");
					break;
				}
			case 5:
				{
					strSoundName = _T("F_5");
					break;
				}
			case 6:
				{
					strSoundName = _T("F_6");
					break;
				}
			case 7:
				{
					strSoundName = _T("F_7");
					break;
				}
			default:
				{
					strSoundName=_T("BU_HUA");
				}

			}
			break;
		}		
	case 0X20:	//筒
		{
			strSoundName.Format(_T("T_%d"), cbValue);
			break;
		}

	case 0X10:	//索
		{
			strSoundName.Format(_T("S_%d"), cbValue);
			break;
		}
	case 0X00:	//万
		{
			strSoundName.Format(_T("W_%d"), cbValue);
			break;
		}
	}	

	if(!bGirl)
	{
		strSoundName = _T("BOY_") +strSoundName;
	}
	else
	{
		strSoundName = _T("GIRL_") + strSoundName;
	}
	PlayGameSound(AfxGetInstanceHandle(), strSoundName);
}
コード例 #8
0
void ON_Brep::DestroyRegionTopology()
{
    ON_UserData* ud = GetUserData(ON_BrepRegionTopologyUserData::m_ON_BrepRegionTopologyUserData_class_id.Uuid());
    if ( ud )
        delete ud;
}
コード例 #9
0
ファイル: opennurbs_hatch.cpp プロジェクト: ToMadoRe/v4r
// Added March 23, 2008 -LW
// This function is temporary and will be removed next time the SDK can be modified.
class ON_HatchExtra* ON_Hatch::HatchExtension()
{
  ON_HatchExtra* pExtra = ON_HatchExtra::Cast( GetUserData( ON_HatchExtra::m_ON_HatchExtra_class_id.Uuid()));
  return pExtra;
}
コード例 #10
0
	void CMenuElementUI::DoEvent(TEventUI& event)
	{
		if( event.Type == UIEVENT_MOUSEENTER )
		{
			CListContainerElementUI::DoEvent(event);
			if( m_pWindow ) return;
			bool hasSubMenu = false;
			for( int i = 0; i < GetCount(); ++i )
			{
				if( GetItemAt(i)->GetInterface(_T("MenuElement")) != NULL )
				{
					(static_cast<CMenuElementUI*>(GetItemAt(i)->GetInterface(_T("MenuElement"))))->SetVisible(true);
					(static_cast<CMenuElementUI*>(GetItemAt(i)->GetInterface(_T("MenuElement"))))->SetInternVisible(true);

					hasSubMenu = true;
				}
			}
			if( hasSubMenu )
			{
				m_pOwner->SelectItem(GetIndex(), true);
				CreateMenuWnd();
			}
			else
			{
				ContextMenuParam param;
				param.hWnd = m_pManager->GetPaintWindow();
				param.wParam = 2;
				CMenuWnd::GetGlobalContextMenuObserver().RBroadcast(param);
				m_pOwner->SelectItem(GetIndex(), true);
			}
			return;
		}

		if( event.Type == UIEVENT_BUTTONUP )
		{
			if( IsEnabled() ){
				CListContainerElementUI::DoEvent(event);

				if( m_pWindow ) return;

				bool hasSubMenu = false;
				for( int i = 0; i < GetCount(); ++i ) {
					if( GetItemAt(i)->GetInterface(_T("MenuElement")) != NULL ) {
						(static_cast<CMenuElementUI*>(GetItemAt(i)->GetInterface(_T("MenuElement"))))->SetVisible(true);
						(static_cast<CMenuElementUI*>(GetItemAt(i)->GetInterface(_T("MenuElement"))))->SetInternVisible(true);

						hasSubMenu = true;
					}
				}
				if( hasSubMenu )
				{
					CreateMenuWnd();
				}
				else
				{
					SetChecked(!GetChecked());

					MenuCmd* pMenuCmd = new MenuCmd();
					lstrcpy(pMenuCmd->szName, GetName().GetData());
					lstrcpy(pMenuCmd->szUserData, GetUserData().GetData());
					lstrcpy(pMenuCmd->szText, GetText().GetData());
					pMenuCmd->bChecked = GetChecked();

					ContextMenuParam param;
					param.hWnd = m_pManager->GetPaintWindow();
					param.wParam = 1;
					CMenuWnd::GetGlobalContextMenuObserver().RBroadcast(param);

					if (CMenuWnd::GetGlobalContextMenuObserver().GetManager() != NULL)
					{
						if (!PostMessage(CMenuWnd::GetGlobalContextMenuObserver().GetManager()->GetPaintWindow(), WM_MENUCLICK, (WPARAM)pMenuCmd, NULL))
						{
							delete pMenuCmd;
							pMenuCmd = NULL;
						}
					}
				}
			}

			return;
		}

		if ( event.Type == UIEVENT_KEYDOWN && event.chKey == VK_RIGHT )
		{
			if( m_pWindow ) return;
			bool hasSubMenu = false;
			for( int i = 0; i < GetCount(); ++i )
			{
				if( GetItemAt(i)->GetInterface(_T("MenuElement")) != NULL )
				{
					(static_cast<CMenuElementUI*>(GetItemAt(i)->GetInterface(_T("MenuElement"))))->SetVisible(true);
					(static_cast<CMenuElementUI*>(GetItemAt(i)->GetInterface(_T("MenuElement"))))->SetInternVisible(true);

					hasSubMenu = true;
				}
			}
			if( hasSubMenu )
			{
				m_pOwner->SelectItem(GetIndex(), true);
				CreateMenuWnd();
			}
			else
			{
				ContextMenuParam param;
				param.hWnd = m_pManager->GetPaintWindow();
				param.wParam = 2;
				CMenuWnd::GetGlobalContextMenuObserver().RBroadcast(param);
				m_pOwner->SelectItem(GetIndex(), true);
			}

			return;
		}

		CListContainerElementUI::DoEvent(event);
	}
コード例 #11
0
bool ON_Brep::HasRegionTopology() const
{
    ON_UserData* ud = GetUserData(ON_BrepRegionTopologyUserData::m_ON_BrepRegionTopologyUserData_class_id.Uuid());
    return (0 != ud);
}
コード例 #12
0
ファイル: GameClientDlg.cpp プロジェクト: anyboo/project
//游戏结束
bool CGameClientDlg::OnSubGameEnd(const void * pBuffer, WORD wDataSize)
{
	//效验参数
	if (wDataSize!=sizeof(CMD_S_GameEnd)) return false;
	CMD_S_GameEnd * pGameEnd=(CMD_S_GameEnd *)pBuffer;

	//删除定时器
	KillGameTimer(IDI_NULLITY);
	KillGameTimer(IDI_CALL_BANKER);
	KillTimer(IDI_TIME_USER_ADD_SCORE);
	KillTimer(IDI_TIME_OPEN_CARD);

	//清理数据
	for(WORD i=0;i<GAME_PLAYER;i++)
	{
		m_GameClientView.ShowOpenCard(i,FALSE);
	}	
	m_GameClientView.SetWaitInvest(false);
	UpdateScoreControl(NULL,SW_HIDE);
	m_GameClientView.m_btOx.ShowWindow(SW_HIDE);
	m_GameClientView.m_btHintOx.ShowWindow(SW_HIDE);
	m_GameClientView.m_btOpenCard.ShowWindow(SW_HIDE);
	m_GameClientView.m_btReSort.ShowWindow(SW_HIDE);
	m_GameClientView.m_btShortcut.ShowWindow(SW_HIDE);
	m_GameClientView.m_btBanker.ShowWindow(SW_HIDE);
	m_GameClientView.m_btIdler.ShowWindow(SW_HIDE);
	m_GameClientView.SetWaitCall(0xff);
	m_GameClientView.m_bOpenCard=false;

	//状态设置
	SetGameStatus(GS_FREE);

	//播放声音
	if (IsLookonMode()==false)
	{
		if (pGameEnd->lGameScore[GetMeChairID()]>0L) PlayGameSound(AfxGetInstanceHandle(),TEXT("GAME_WIN"));
		else PlayGameSound(AfxGetInstanceHandle(),TEXT("GAME_LOST"));
	}
	else PlayGameSound(GetModuleHandle(NULL),TEXT("GAME_END"));

	//显示积分
	for (WORD i=0;i<GAME_PLAYER;i++)
	{
		if(GetUserData(i)!=NULL)m_GameClientView.ShowScore(m_wViewChairID[i],true);
		m_GameClientView.SetUserTableScore(m_wViewChairID[i],pGameEnd->lGameScore[i]);
	}
	m_GameClientView.m_ScoreView.ResetScore();
	for (WORD i=0;i<GAME_PLAYER;i++)
	{
		//设置信息
		if (pGameEnd->lGameScore[i]!=0L || i==m_wBankerUser)
		{
			m_GameClientView.m_ScoreView.SetGameTax(pGameEnd->lGameTax[i],i);
			if (m_szAccounts[i][0]=='#') m_GameClientView.m_ScoreView.SetGameScore(i,TEXT("已离开"),pGameEnd->lGameScore[i]);
			else m_GameClientView.m_ScoreView.SetGameScore(i,m_szAccounts[i],pGameEnd->lGameScore[i]);
		}
	}
	m_GameClientView.m_ScoreView.ShowWindow(SW_SHOW);

	//显示牌型
	bool bOxSound=false;
	for (WORD i=0;i<GAME_PLAYER;i++)
	{
		WORD wViewChairID=m_wViewChairID[i];
		if(i==GetMeChairID() && !IsLookonMode())continue;
		m_GameClientView.m_CardControl[wViewChairID].SetDisplayFlag(true);

		//牛牛牌型
		if(m_cbHandCardData[i][0]>0)
		{
			if(m_bUserOxCard[i]==TRUE)
			{
				//扑克数据
				BYTE bCardData[MAX_COUNT];
				CopyMemory(bCardData,m_cbHandCardData[i],sizeof(bCardData));

				//获取牛牛数据
				m_GameLogic.GetOxCard(bCardData,MAX_COUNT);

				BYTE bCardValue=m_GameLogic.GetCardType(bCardData,MAX_COUNT);
				ASSERT(bCardValue>0);

				//加载数据
				if(bCardValue<OX_THREE_SAME)
				{
					m_GameClientView.m_CardControl[wViewChairID].SetCardData(bCardData,3);
					m_GameClientView.m_CardControlOx[wViewChairID].SetCardData(&bCardData[3],2);
				}

				//显示点数
				if(bCardValue>=10)bOxSound=true;
				m_GameClientView.SetUserOxValue(wViewChairID,bCardValue);
			}
			else
			{
				//无牛
				m_GameClientView.SetUserOxValue(wViewChairID,0);
			}
		}
	}
	m_GameClientView.DisplayType(true);

	//////////////////////////////////////////////////////////////////////////
// 	WORD wMeChiarID = GetMeChairID();
// 	if(m_bUserOxCard[wMeChiarID]==TRUE)//牛牌分类
// 	{
// 		//设置变量
// 		BYTE bTemp[MAX_COUNT];
// 		CopyMemory(bTemp,m_cbHandCardData[wMeChiarID],sizeof(bTemp));
// 
// 		//获取牛牌
// 		m_GameLogic.GetOxCard(bTemp,MAX_COUNT);				
// 
// 		//显示点数
// 		BYTE bValue=m_GameLogic.GetCardLogicValue(bTemp[3])+m_GameLogic.GetCardLogicValue(bTemp[4]);
// 		ASSERT(bValue>0);
// 		if(bValue>10)
// 			bValue-=10;
// 		if(bValue>=10)bOxSound=true;
// 		else
// 			bOxSound =false;
// 	}
// 
// 	//牛牛声音
// 	if (bOxSound)
// 	{
// 		if(GetUserData(GetMeChairID())->cbGender== 0)
// 			PlayGameSound(AfxGetInstanceHandle(),TEXT("GAME_OXOX0"));
// 		else
// 			PlayGameSound(AfxGetInstanceHandle(),TEXT("GAME_OXOX1"));
// 	}
	//////////////////////////////////////////////////////////////////////////

// 	//牛牛声音
// 	if(bOxSound)
// 	{
// 		PlayGameSound(AfxGetInstanceHandle(),TEXT("GAME_OXOX"));
// 	}

	//开始按钮
	if (IsLookonMode()==false)
	{
		m_GameClientView.m_btStart.ShowWindow(SW_SHOW);
		SetGameTimer(GetMeChairID(),IDI_START_GAME,TIME_USER_START_GAME);
	}

	//成绩显示在即时聊天对话框
	TCHAR szBuffer[512]=TEXT("");
	_snprintf(szBuffer,CountArray(szBuffer),TEXT("\n本局结束,成绩统计:"));
	InsertGeneralString(szBuffer,RGB(0,128,255),true);
	for (WORD i=0;i<GAME_PLAYER;i++)
	{
		//变量定义
		const tagUserData * pUserData=GetUserData(i);
		//成绩输出
		if (pUserData!=NULL)
		{
			_snprintf(szBuffer,CountArray(szBuffer),TEXT("%s:%+I64d"),pUserData->szName,pGameEnd->lGameScore[i]);
			InsertGeneralString(szBuffer,RGB(0,128,255),true);
		}
		else if(m_szAccounts[i][0]=='#')
		{
			_snprintf(szBuffer,CountArray(szBuffer),TEXT("%s:%+I64d"),TEXT("用户离开"),pGameEnd->lGameScore[i]);
			InsertGeneralString(szBuffer,RGB(0,128,255),true);
		}
	}

	//状态变量
	m_wBankerUser=INVALID_CHAIR;
	ZeroMemory(m_szAccounts,sizeof(m_szAccounts));
	ZeroMemory(m_cbPlayStatus,sizeof(m_cbPlayStatus));

	return true;
}
コード例 #13
0
ファイル: GameClientDlg.cpp プロジェクト: anyboo/project
//游戏场景
bool CGameClientDlg::OnGameSceneMessage(BYTE cbGameStation, bool bLookonOther, const void * pBuffer, WORD wDataSize)
{
	if(IsLookonMode())m_GameClientView.m_bLookOnUser=true;
	switch (cbGameStation)
	{
	case GS_FREE:		//空闲状态
		{
			//效验数据
			if (wDataSize!=sizeof(CMD_S_StatusFree)) return false;
			CMD_S_StatusFree * pStatusFree=(CMD_S_StatusFree *)pBuffer;

			//设置控件
			if (IsLookonMode()==false)
			{
				SetGameTimer(GetMeChairID(),IDI_START_GAME,TIME_USER_START_GAME);
				m_GameClientView.m_btStart.ShowWindow(SW_SHOW);
				m_GameClientView.m_btStart.SetFocus();
			}

			return true;
		}
	case GS_TK_CALL:	// 叫庄状态
		{
			//效验数据
			if (wDataSize!=sizeof(CMD_S_StatusCall)) return false;
			CMD_S_StatusCall * pStatusCall=(CMD_S_StatusCall *)pBuffer;

			//用户信息
			for (WORD i=0;i<GAME_PLAYER;i++)
			{
				//视图位置
				m_wViewChairID[i]=SwitchViewChairID(i);

				//获取用户
				const tagUserData * pUserData=GetUserData(i);
				if (pUserData==NULL) continue;

				//游戏信息
				m_cbPlayStatus[i]=TRUE;

				//用户名字
				lstrcpyn(m_szAccounts[i],pUserData->szName,CountArray(m_szAccounts[i]));
			}
			
			//始叫用户
			if(!IsLookonMode() && pStatusCall->wCallBanker==GetMeChairID())
			{
				//控件显示
				//ActiveGameFrame();
				m_GameClientView.m_btBanker.ShowWindow(SW_SHOW);
				m_GameClientView.m_btIdler.ShowWindow(SW_SHOW);
			}

			//等待标志
			WORD wViewID=m_wViewChairID[pStatusCall->wCallBanker];
			m_GameClientView.SetWaitCall((BYTE)wViewID);

			//实际定时器
			if(pStatusCall->wCallBanker==GetMeChairID())
			{
				SetGameTimer(pStatusCall->wCallBanker,IDI_CALL_BANKER,TIME_USER_CALL_BANKER);
			}
			else SetGameTimer(pStatusCall->wCallBanker,IDI_NULLITY,TIME_USER_CALL_BANKER);

			return true;
		}
	case GS_TK_SCORE:	//下注状态
		{
			//效验数据
			if (wDataSize!=sizeof(CMD_S_StatusScore)) return false;
			CMD_S_StatusScore * pStatusScore=(CMD_S_StatusScore *)pBuffer;

			//设置变量
			m_lTurnMaxScore=pStatusScore->lTurnMaxScore;
			m_wBankerUser=pStatusScore->wBankerUser;			
			CopyMemory(m_lTableScore,pStatusScore->lTableScore,sizeof(m_lTableScore));
			for (WORD i=0;i<GAME_PLAYER;i++)
			{
				//视图位置
				m_wViewChairID[i]=SwitchViewChairID(i);

				//桌面筹码
				if(m_lTableScore[i]>0L)m_GameClientView.SetUserTableScore(m_wViewChairID[i],m_lTableScore[i]);
				
				//获取用户
				const tagUserData * pUserData=GetUserData(i);
				if (pUserData==NULL) continue;
				
				//游戏信息
				m_cbPlayStatus[i]=TRUE;
				
				//用户名字
				lstrcpyn(m_szAccounts[i],pUserData->szName,CountArray(m_szAccounts[i]));
			}

			//设置筹码
			if (!IsLookonMode() && pStatusScore->lTurnMaxScore>0L && m_lTableScore[GetMeChairID()]==0L)
			{
				LONGLONG lUserMaxScore[GAME_PLAYER];
				ZeroMemory(lUserMaxScore,sizeof(lUserMaxScore));
				LONGLONG lTemp=m_lTurnMaxScore;
				for (WORD i=0;i<GAME_PLAYER;i++)
				{
					if(i>0)lTemp/=2;
					lUserMaxScore[i]=__max(lTemp,1L);
				}

				//更新控件
				UpdateScoreControl(lUserMaxScore,SW_SHOW);

				//实际定时器
				SetTimer(IDI_TIME_USER_ADD_SCORE,(TIME_USER_ADD_SCORE)*1000,NULL);
			}

			//庄家标志
			WORD wID=m_wViewChairID[m_wBankerUser];
			m_GameClientView.SetBankerUser(wID);

			//等待标志
			m_GameClientView.SetWaitInvest(true);


			//辅助显示中心时钟
			SetGameTimer(GetMeChairID(),IDI_NULLITY,TIME_USER_ADD_SCORE);

			return true;
		}
	case GS_TK_PLAYING:	//游戏状态
		{
			//效验数据
			if (wDataSize!=sizeof(CMD_S_StatusPlay)) return false;
			CMD_S_StatusPlay * pStatusPlay=(CMD_S_StatusPlay *)pBuffer;

			//设置变量
			m_lTurnMaxScore=pStatusPlay->lTurnMaxScore;
			m_wBankerUser=pStatusPlay->wBankerUser;
			CopyMemory(m_lTableScore,pStatusPlay->lTableScore,sizeof(m_lTableScore));
			CopyMemory(m_bUserOxCard,pStatusPlay->bOxCard,sizeof(m_bUserOxCard));
			for (WORD i=0;i<GAME_PLAYER;i++)
			{
				//视图位置
				m_wViewChairID[i]=SwitchViewChairID(i);

				//桌面筹码
				if(m_lTableScore[i]>0L)m_GameClientView.SetUserTableScore(m_wViewChairID[i],m_lTableScore[i]);
				
				//获取用户
				const tagUserData * pUserData=GetUserData(i);
				if (pUserData==NULL) continue;
				
				//游戏信息
				m_cbPlayStatus[i]=TRUE;
				
				//扑克数据
				CopyMemory(m_cbHandCardData[i],pStatusPlay->cbHandCardData[i],MAX_COUNT);

				//用户名字
				lstrcpyn(m_szAccounts[i],pUserData->szName,CountArray(m_szAccounts[i]));
			}

			//庄家标志
			WORD wID=m_wViewChairID[m_wBankerUser];
			m_GameClientView.SetBankerUser(wID);

			//左上信息
			//m_GameClientView.SetScoreInfo(m_lTurnMaxScore,0);

			//设置界面
			LONGLONG lTableScore=0L;
			for (WORD i=0;i<GAME_PLAYER;i++)
			{
				//设置位置
				WORD wViewChairID=m_wViewChairID[i];

				//设置扑克
				if (m_cbPlayStatus[i]==TRUE) 
				{
					m_GameClientView.m_CardControl[wViewChairID].SetCardData(pStatusPlay->cbHandCardData[i],MAX_COUNT);
				}
			}

			WORD wMeChiarID=GetMeChairID();
			WORD wViewChairID=m_wViewChairID[wMeChiarID];
			if(!IsLookonMode())m_GameClientView.m_CardControl[wViewChairID].SetPositively(true);
			if(IsAllowLookon() || !IsLookonMode())
			{				
				m_GameClientView.m_CardControl[wViewChairID].SetDisplayFlag(true);
			}

			//摊牌标志
			for (WORD i=0;i<GAME_PLAYER;i++)
			{
				if(m_bUserOxCard[i]!=0xff)
				{
					m_GameClientView.ShowOpenCard(m_wViewChairID[i]);
				}
			}

			//控件处理
			if(!IsLookonMode())
			{
				//显示控件
				if(m_bUserOxCard[wMeChiarID]==0xff)
				{
					OnSendCardFinish(0,0);
				}
				else 
				{
					m_GameClientView.m_CardControl[wViewChairID].SetPositively(false);
					if(m_bUserOxCard[wMeChiarID]==TRUE)//牛牌分类
					{
						//设置变量
						BYTE bTemp[MAX_COUNT];
						CopyMemory(bTemp,m_cbHandCardData[wMeChiarID],sizeof(bTemp));

						//获取牛牌
						m_GameLogic.GetOxCard(bTemp,MAX_COUNT);

						BYTE bCardValue=m_GameLogic.GetCardType(bTemp,MAX_COUNT);
						ASSERT(bCardValue>0);

						if(bCardValue<OX_THREE_SAME)
						{
							//设置控件
							m_GameClientView.m_CardControl[wViewChairID].SetCardData(bTemp,3);
							m_GameClientView.m_CardControlOx[wViewChairID].SetCardData(&bTemp[3],2);	
						}

						//显示点数
						m_GameClientView.SetUserOxValue(wViewChairID,bCardValue);
					}
					else 
					{
						//无牛
						m_GameClientView.SetUserOxValue(wViewChairID,0);
					}					
				}
			}
			return true;
		}
	}

	return false;
}
コード例 #14
0
ファイル: Window.hpp プロジェクト: kwtskran/XCSoar
 /**
  * Converts a #HWND into a #Window pointer, without checking if that
  * is legal.
  */
 gcc_const
 static Window *GetUnchecked(HWND hWnd) {
   return (Window *)GetUserData(hWnd);
 }
コード例 #15
0
ファイル: Update.cpp プロジェクト: Catchouli-old/Box2DSandbox
	void VehicleSim::update(double dt)
	{
		for (b2Body* body = _physWorld.GetBodyList(); body; body = body->GetNext())
		{
			// Simulate rolling resistance
			// Simple version of rolling resistance using formula given by spec
			// Frr = -Crr * v
			// A better implementation of rolling resistance would
			// counteract the movement due to other forces
			// such that a coefficient of 1 would equal no movement
			// To calculate this, you could resolve the forces on the body into the direction of
			// the vector perpendicular to the normal of the contact and then multiply that
			// by the coefficient of friction of the contact
			for (b2ContactEdge* contactEdge = body->GetContactList(); contactEdge; contactEdge = contactEdge->next)
			{ 
				b2Contact* contact = contactEdge->contact;

				// Get fixtures
				b2Fixture* fixA = contact->GetFixtureA();
				b2Fixture* fixB = contact->GetFixtureB();

				b2Fixture* bodyFix = (fixA->GetBody() == body ? fixA : fixB);

				if (bodyFix->GetShape()->GetType() == b2Shape::e_circle)
				{
					// Get friction of fixtures
					float ca = fixA->GetFriction();
					float cb = fixB->GetFriction();

					// Calculate coefficient of friction for this contact
					// (average of both coefficients of friction)
					float c = contact->GetFriction();

					// Calculate force due to rolling resistance
					// F_rr = v * -c_rr
					b2Vec2 F_rr = -c * body->GetLinearVelocity();

					// Apply rolling resistance
					body->ApplyForceToCenter(F_rr, true);
				}
			}

			// Simple aerodynamic drag, calculated using the formula
			// Fad = -Cad * v|v|
			// Where Cad = the cross sectional area of the car
			// And v is the velocity
			// The cross sectional area is scaled down from world coordinates
			// by a factor of 1000 to produce nice results
			// A more complicated form of aerodynamic drag can be calculated
			// the mass density p of the air (dependent on its temperature and pressure),
			// and the drag coefficient Cd calculated using the object's geometry
			// The formula for this would be Fd = 0.5 * p * v|v| * Cd * Cad
			// But this is beyond the scope of this simulation
			b2Fixture* fixtures = body->GetFixtureList();
			if (fixtures != nullptr)
			{
				b2AABB aabb = fixtures->GetAABB(0);

				for (b2Fixture* fix = fixtures; fix; fix = fix->GetNext())
				{
					// The cross sectional area is estimated using the AABB of each shape
					aabb.Combine(fix->GetAABB(0));
				}

				b2Vec2 size = 0.001f * (aabb.upperBound - aabb.lowerBound);

				// Reverse size to get an approximation of cross sectional area
				float temp = size.x;
				size.x = size.y;
				size.y = temp;

				// Calculate v|v|
				b2Vec2 vsquared = body->GetLinearVelocity().Length() * body->GetLinearVelocity();

				// Calculate force of aerodynamic drag
				b2Vec2 Fad(-size.x * vsquared.x, -size.y * vsquared.y);

				// Apply force to body
				body->ApplyForceToCenter(Fad, true);
			}
		}

		// Update physics system
		double time = glfwGetTime();
		float stepTime = (1.0f / _timeStep);
		while (_lastPhysicsUpdate + stepTime < time)
		{
			if (_simulationRunning)
				doStep();

			_lastPhysicsUpdate += stepTime;
		}

		// Update options
		if (!_worldOptionsTabButton->Hidden())
		{
			for (auto it = _updatableOptions.begin(); it != _updatableOptions.end(); ++it)
			{
				(*it)->update();
			}
		}

		// Do frame update
		doFrameInput(dt);

		// Get inner area of dock
		Gwen::Rect innerBounds = _guiDock->GetInnerBounds();

		// Update camera's viewport
		_camera.setViewport(innerBounds.x, innerBounds.y, innerBounds.w, innerBounds.h);

		// Update camera's matrix
		if (innerBounds.h > 0)
		{
			float aspect = (float)innerBounds.w / innerBounds.h;
			_camera.orthographic(_orthoScale, aspect);
		}

		// Handle motor for each joint
		for (auto joint = _physWorld.GetJointList(); joint; joint = joint->GetNext())
		{
			MotorInput* motorInput = (MotorInput*)joint->GetUserData();

			if (motorInput != nullptr)
			{
				motorInput->update(_window, joint);
			}
		}

		// Set window title
		const int TITLE_LEN = 1024;
		char title[1024];
		sprintf(title, VEHICLESIM_TITLE_FORMAT, getFPS());
		glfwSetWindowTitle(_window, title);
	}
コード例 #16
0
ファイル: ctrl_contact.cpp プロジェクト: Seldom/miranda-ng
/**
 * name:	 DlgProc_EditEMail()
 * desc:	 dialog procedure
 *
 * return:	 0 or 1
 **/
static INT_PTR CALLBACK DlgProc_EMail(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
	LPCBEXITEM cbi = (LPCBEXITEM)GetUserData(hDlg);

	switch (msg) {
	case WM_INITDIALOG:
		cbi = (LPCBEXITEM)lParam;
		if (!cbi)
			return FALSE;
		SetUserData(hDlg, lParam);

		SendDlgItemMessage(hDlg, IDC_HEADERBAR, WM_SETICON, 0, (LPARAM)IcoLib_GetIcon(ICO_DLG_EMAIL, TRUE));
		if (db_get_b(NULL, MODNAME, SET_ICONS_BUTTONS, 1)) {
			SendDlgItemMessage(hDlg, IDOK, BM_SETIMAGE, IMAGE_ICON, (LPARAM)IcoLib_GetIcon(ICO_BTN_OK));
			SendDlgItemMessage(hDlg, IDCANCEL, BM_SETIMAGE, IMAGE_ICON, (LPARAM)IcoLib_GetIcon(ICO_BTN_CANCEL));
		}

		if (*cbi->pszVal)
			SetWindowText(hDlg, LPGENT("Edit e-mail"));
		TranslateDialogDefault(hDlg);
		SendDlgItemMessage(hDlg, EDIT_CATEGORY, EM_LIMITTEXT, cbi->ccCat - 1, 0);
		SendDlgItemMessage(hDlg, EDIT_EMAIL, EM_LIMITTEXT, cbi->ccVal - 1, 0);
		SetDlgItemText(hDlg, EDIT_CATEGORY, cbi->pszCat);
		SetDlgItemText(hDlg, EDIT_EMAIL, cbi->pszVal);
		EnableWindow(GetDlgItem(hDlg, EDIT_CATEGORY), !(cbi->wFlags & CBEXIF_CATREADONLY));
		EnableWindow(GetDlgItem(hDlg, IDOK), *cbi->pszVal);

		// translate Userinfo buttons
		{
			TCHAR szButton[MAX_PATH];
			HWND hBtn = GetDlgItem(hDlg, IDOK);
			GetWindowText(hBtn, szButton, _countof(szButton));
			SetWindowText(hBtn, TranslateTS(szButton));

			hBtn = GetDlgItem(hDlg, IDCANCEL);
			GetWindowText(hBtn, szButton, _countof(szButton));
			SetWindowText(hBtn, TranslateTS(szButton));
		}
		return TRUE;

	case WM_CTLCOLORSTATIC:
		SetBkColor((HDC)wParam, RGB(255, 255, 255));
		return (INT_PTR)GetStockObject(WHITE_BRUSH);

	case WM_COMMAND:
		switch (LOWORD(wParam)) {
			case IDOK: {
				if (HIWORD(wParam) == BN_CLICKED) {
					if (cbi->pszVal && cbi->ccVal > 0)
						GetDlgItemText(hDlg, EDIT_EMAIL, cbi->pszVal, cbi->ccVal);
					if (cbi->pszCat && cbi->ccCat > 0)
						GetDlgItemText(hDlg, EDIT_CATEGORY, cbi->pszCat, cbi->ccCat);
				}
				break;
			}
			case IDCANCEL: {
				if (HIWORD(wParam) == BN_CLICKED) 
					EndDialog(hDlg, LOWORD(wParam));
				break;
			}
			case EDIT_EMAIL:
				if (HIWORD(wParam) == EN_UPDATE) {
					TCHAR szText[MAXDATASIZE];
					LPTSTR pszAdd, pszDot;
					if (PtrIsValid(cbi)) {
						GetWindowText((HWND)lParam, szText, _countof(szText));
						EnableWindow(GetDlgItem(hDlg, IDOK), 
							((pszAdd = _tcschr(szText, '@')) && 
							*(pszAdd + 1) != '.' &&
							(pszDot = _tcschr(pszAdd, '.')) &&
							*(pszDot + 1) &&
							mir_tstrcmp(szText, cbi->pszVal)));
					}
				}
				break;
		}
		break;
	}
	return FALSE;
}
コード例 #17
0
//游戏结束
LRESULT CGameClientDlg::OnGameOver(WPARAM wParam,LPARAM lParam)
{
	//设置状态
	SetGameStatus(GS_FREE);

	if(!m_bExitTag)
	{
		if(m_cbPlayStatus[m_wMeChairID] == TRUE)
			m_GameClientView.m_CardControl[m_wMeChairID].SetCardData(m_cbHandCardData[m_wMeChairID],2);
	}
	else
	{
		//胜利列表
		UserWinList WinnerList;

		//临时数据
		BYTE bTempData[GAME_PLAYER][MAX_CENTERCOUNT];
		CopyMemory(bTempData,m_cbOverCardData,GAME_PLAYER*MAX_CENTERCOUNT);

		//查找胜利者
		m_GameLogic.SelectMaxUser(bTempData,WinnerList,NULL);
		ASSERT(WinnerList.bSameCount>0);

		//设置扑克
		for (WORD i = 0;i<GAME_PLAYER;i++)
		{
			if(m_cbPlayStatus[i] == TRUE) m_GameClientView.m_CardControl[i].SetCardData(m_cbHandCardData[i],2);
			else m_GameClientView.m_CardControl[i].SetCardData(NULL,0);
		}

		//特效变量
		bool wIsMyWin =false ;
		WORD wWinnerID = INVALID_CHAIR;		
		BYTE cbEffectHandCard[MAX_COUNT];
		BYTE cbEffectCenterCardData[MAX_CENTERCOUNT];
		ZeroMemory(cbEffectHandCard,sizeof(cbEffectHandCard));
		ZeroMemory(cbEffectCenterCardData,sizeof(cbEffectCenterCardData));
		BYTE bTempCount1,bTempCount2;

		//查找胜利扑克
		for (WORD i=0;i<WinnerList.bSameCount;i++)
		{
			wWinnerID=WinnerList.wWinerList[i];
			if(!wIsMyWin && m_wMeChairID==WinnerList.wWinerList[i])
			{
				wIsMyWin = true;
			}

			//查找扑克数据
			BYTE bTempCount1=m_GameLogic.GetSameCard(m_cbHandCardData[wWinnerID],bTempData[wWinnerID],MAX_COUNT,MAX_CENTERCOUNT,cbEffectHandCard);
			BYTE bTempCount2=m_GameLogic.GetSameCard(m_cbCenterCardData,bTempData[wWinnerID],MAX_CENTERCOUNT,MAX_CENTERCOUNT,cbEffectCenterCardData);
			ASSERT(bTempCount1+bTempCount2<=MAX_CENTERCOUNT);

			//设置扑克特效数据
			m_GameClientView.m_CardControl[wWinnerID].SetCardEffect(cbEffectHandCard,bTempCount1);
			m_GameClientView.m_CenterCardControl.SetCardEffect(cbEffectCenterCardData,bTempCount2);
		}

		//自己扑克
		if(!wIsMyWin)
		{
			wWinnerID = m_wMeChairID;

			//自己扑克数据
			ZeroMemory(cbEffectHandCard,sizeof(cbEffectHandCard));
			ZeroMemory(cbEffectCenterCardData,sizeof(cbEffectCenterCardData));

			//查找扑克数据
			bTempCount1=m_GameLogic.GetSameCard(m_cbHandCardData[wWinnerID],bTempData[wWinnerID],MAX_COUNT,MAX_CENTERCOUNT,cbEffectHandCard);
			bTempCount2=m_GameLogic.GetSameCard(m_cbCenterCardData,bTempData[wWinnerID],MAX_CENTERCOUNT,MAX_CENTERCOUNT,cbEffectCenterCardData);
			ASSERT(bTempCount1+bTempCount2<=MAX_CENTERCOUNT);

			//设置标志扑克数据
			m_GameClientView.m_CardControl[wWinnerID].SetMyCard(cbEffectHandCard,bTempCount1);
			m_GameClientView.m_CenterCardControl.SetMyCard(cbEffectCenterCardData,bTempCount2);
		}

		//游戏结束
		m_GameClientView.SetGameEndStart();
	}

	//赢金币
	for (WORD i =0;i<GAME_PLAYER;i++)
	{
		if(m_cbPlayStatus[i] == FALSE) continue;
		if(m_dEndScore[i]>0L)
		{
			m_lCenterScore = m_lCenterScore -m_dEndScore[i]-m_lTotalScore[i];
			m_GameClientView.UpdateWindow();
			m_GameClientView.DrawMoveAnte(i,CGameClientView::AA_CENTER_TO_BASEFROM,m_dEndScore[i]+m_lTotalScore[i]);
			m_GameClientView.SetCenterScore(m_lCenterScore);
		}
		else if(m_dEndScore[i] == 0L)
		{
			m_GameClientView.DrawMoveAnte(i,CGameClientView::AA_CENTER_TO_BASEFROM,m_lTotalScore[i]);
			m_lCenterScore = m_lCenterScore-m_lTotalScore[i];
			m_GameClientView.SetCenterScore(m_lCenterScore);
			m_GameClientView.UpdateWindow();
		}
		m_GameClientView.SetTotalScore(i,0L);
		m_GameClientView.UpdateWindow();
	}

	//播放声音
	if (IsLookonMode()==false)
	{
		if (m_dEndScore[m_wMeChairID]>=0L) 
			PlayGameSound(AfxGetInstanceHandle(),TEXT("GAME_WIN"));
		else 
			PlayGameSound(AfxGetInstanceHandle(),TEXT("GAME_LOST"));
	}
	else PlayGameSound(GetModuleHandle(NULL),TEXT("GAME_END"));

	if(m_cbPlayStatus[m_wMeChairID]==TRUE && !IsLookonMode())
	{
		//调整位置
		CRect rcControl;
		m_GameClientView.m_ScoreView.GetWindowRect(&rcControl);
		CRect rcView ;
		m_GameClientView.GetWindowRect( &rcView );
		m_GameClientView.m_ScoreView.MoveWindow(rcView.left+5,rcView.bottom-15-rcControl.Height()*3/2,rcControl.Width(),rcControl.Height()/*nWidth/2-rcControl.Width()/2,nHeight/2+56,0,0,SWP_NOZORDER|SWP_NOSIZE*/);

		m_GameClientView.m_ScoreView.SetGameScore(m_wMeChairID,m_dEndScore[m_wMeChairID]);
		m_GameClientView.m_ScoreView.ShowWindow(SW_SHOW);
		m_GameClientView.m_ScoreView.SetShowTimes();
	}
	if(!IsLookonMode())
	{
		//开牌按钮
		if(m_bOpenCard)
		{
			m_GameClientView.m_btOpenCard.ShowWindow(SW_SHOW);
		}

		if (m_GameClientView.m_ScoreView.IsWindowVisible()==TRUE)
		{
			m_GameClientView.m_ScoreView.SetStartTimes();
		}
		else if(m_bAutoStart==FALSE)
		{
			SetGameTimer(m_wMeChairID,IDI_START_GAME,TIME_START_GAME);
		}
		else //自动开始
		{
			m_GameClientView.m_ScoreView.SetStartTimes();
			m_GameClientView.m_ScoreView.SetShowTimes();
			//OnStart(0,0);
		}
	}

	//状态设置
	KillGameTimer(IDI_USER_ADD_SCORE);

	//开始按钮
	if (!IsLookonMode() && m_bAutoStart==FALSE)
	{
		m_GameClientView.m_btStart.ShowWindow(SW_SHOW);
		m_GameClientView.m_btExit.ShowWindow(SW_SHOW);
	}

	//成绩显示在即时聊天对话框
	TCHAR szBuffer[256]=TEXT("");
	_snprintf(szBuffer,CountArray(szBuffer),TEXT("\n本局结束,成绩统计"));
	InsertGeneralString(szBuffer,RGB(0,128,255),true);

	if(m_bReset)
	{
		for (WORD i=0;i<GAME_PLAYER;i++)
		{
			if(m_lTotalScore[i]==0)continue;	
			const tagUserData * pUserData=GetUserData(i);
			//成绩输出
			if (pUserData!=NULL)
			{
				_snprintf(szBuffer,CountArray(szBuffer),TEXT("%s:%+ld"),/*%s玩家\n得分:%ld*/
					pUserData->szName,m_dEndScore[i]);
				InsertGeneralString(szBuffer,RGB(0,128,255),true);
			}
			else
			{
				_snprintf(szBuffer,CountArray(szBuffer),TEXT("用户已离开:%+ld"),-m_lTotalScore[i]);/*\n得分:%ld*/
				InsertGeneralString(szBuffer,RGB(0,128,255),true);
			}
		}
	}
	else	//不足金额
	{
		for (WORD i=0;i<GAME_PLAYER;i++)
		{
			if(m_lTotalScore[i]==0)continue;
			//成绩输出
			if (m_bUserName[i]!=NULL)
			{
				_snprintf(szBuffer,CountArray(szBuffer),TEXT("%s:%+ld"),
					&m_bUserName[i],m_dEndScore[i]);
				InsertGeneralString(szBuffer,RGB(0,128,255),true);
			}
			else
			{
				_snprintf(szBuffer,CountArray(szBuffer),TEXT("用户已离开:%+ld"),-m_lTotalScore[i]);
				InsertGeneralString(szBuffer,RGB(0,128,255),true);
			}
		}
	}

	//重值变量
	ZeroMemory(m_lTotalScore,sizeof(m_lTotalScore));
	ZeroMemory(m_lTableScore,sizeof(m_lTableScore));
	m_lCenterScore = 0L;

	return 0;
}
コード例 #18
0
ファイル: ctrl_contact.cpp プロジェクト: Seldom/miranda-ng
/**
 * name:	 DlgProc_EditPhone()
 * desc:	 dialog procedure
 *
 * return:	 0 or 1
 **/
INT_PTR CALLBACK DlgProc_Phone(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
	LPCBEXITEM cbi = (LPCBEXITEM)GetUserData(hDlg);
	static int noRecursion = 0;

	switch (msg) {
	case WM_INITDIALOG:
		{
			UINT i, item, countryCount;
			LPIDSTRLIST	pCountries;
			HWND hCombo = GetDlgItem(hDlg, EDIT_COUNTRY);

			cbi = (LPCBEXITEM)lParam;
			if (!cbi) return FALSE;
			SetUserData(hDlg, lParam);

			SendDlgItemMessage(hDlg, IDC_HEADERBAR, WM_SETICON, 0, (LPARAM)IcoLib_GetIcon(ICO_DLG_PHONE, TRUE));
			if (db_get_b(NULL, MODNAME, SET_ICONS_BUTTONS, 1)) {
				SendDlgItemMessage(hDlg, IDOK, BM_SETIMAGE, IMAGE_ICON, (LPARAM)IcoLib_GetIcon(ICO_BTN_OK));
				SendDlgItemMessage(hDlg, IDCANCEL, BM_SETIMAGE, IMAGE_ICON, (LPARAM)IcoLib_GetIcon(ICO_BTN_CANCEL));
			}

			// translate Userinfo buttons
			{
				TCHAR szButton[MAX_PATH];
				HWND hBtn;

				hBtn = GetDlgItem(hDlg, IDOK);
				GetWindowText(hBtn, szButton, _countof(szButton));
				SetWindowText(hBtn, TranslateTS(szButton));
				hBtn = GetDlgItem(hDlg, IDCANCEL);
				GetWindowText(hBtn, szButton, _countof(szButton));
				SetWindowText(hBtn, TranslateTS(szButton));
			}
			if (*cbi->pszVal) SetWindowText(hDlg, LPGENT("Edit phone number"));
			if (cbi->wFlags & CBEXIF_SMS) CheckDlgButton(hDlg, CHECK_SMS, BST_CHECKED);
			TranslateDialogDefault(hDlg);

			EnableWindow(GetDlgItem(hDlg, IDOK), *cbi->pszVal);
			SendDlgItemMessage(hDlg, EDIT_AREA, EM_LIMITTEXT, 31, 0);
			SendDlgItemMessage(hDlg, EDIT_NUMBER, EM_LIMITTEXT, 63, 0);
			SendDlgItemMessage(hDlg, EDIT_CATEGORY, EM_LIMITTEXT, cbi->ccCat - 1, 0);
			SendDlgItemMessage(hDlg, EDIT_PHONE, EM_LIMITTEXT, cbi->ccVal - 1, 0);

			GetCountryList(&countryCount, &pCountries);
			for (i = 0; i < countryCount; i++) {
				if (pCountries[i].nID == 0 || pCountries[i].nID == 0xFFFF) continue;
				item = SendMessage(hCombo, CB_ADDSTRING, NULL, (LPARAM)pCountries[i].ptszTranslated);
				SendMessage(hCombo, CB_SETITEMDATA, item, pCountries[i].nID);
			}

			SetDlgItemText(hDlg, EDIT_PHONE, cbi->pszVal);
			SetDlgItemText(hDlg, EDIT_CATEGORY, cbi->pszCat);
			EnableWindow(GetDlgItem(hDlg, EDIT_CATEGORY), !(cbi->wFlags & CBEXIF_CATREADONLY));
		}
		return TRUE;

	case WM_CTLCOLORSTATIC:
		SetBkColor((HDC)wParam, RGB(255, 255, 255));
		return (INT_PTR)GetStockObject(WHITE_BRUSH);

	case WM_COMMAND:
		switch (LOWORD(wParam)) {
			case IDOK:
				if (HIWORD(wParam) == BN_CLICKED) {
					TCHAR szText[MAXDATASIZE];
					int errorPos;

					if (!GetDlgItemText(hDlg, EDIT_PHONE, szText, _countof(szText)) || !CheckPhoneSyntax(szText, cbi->pszVal, cbi->ccVal, errorPos) || errorPos > -1) {
						MsgErr(hDlg, TranslateT("The phone number should start with a + and consist of\nnumbers, spaces, brackets and hyphens only."));
						break;
					}
					// save category string
					GetDlgItemText(hDlg, EDIT_CATEGORY, cbi->pszCat, cbi->ccCat);

					// save SMS flag
					if ((int)IsDlgButtonChecked(hDlg, CHECK_SMS) != ((cbi->wFlags & CBEXIF_SMS) == CBEXIF_SMS))
						cbi->wFlags ^= CBEXIF_SMS;
				}
				//fall through
			case IDCANCEL:
				if (HIWORD(wParam) == BN_CLICKED) 
					EndDialog(hDlg, wParam);
				break;

		case EDIT_COUNTRY:
			if (HIWORD(wParam) != CBN_SELCHANGE)
				break;

		case EDIT_AREA:
		case EDIT_NUMBER:
			if (LOWORD(wParam) != EDIT_COUNTRY && HIWORD(wParam) != EN_CHANGE) break;
			if (noRecursion) break;
			EnableWindow(GetDlgItem(hDlg, IDOK), TRUE);
			{
				TCHAR szPhone[MAXDATASIZE], szArea[32], szData[64];
				int	 nCurSel = SendDlgItemMessage(hDlg, EDIT_COUNTRY, CB_GETCURSEL, 0, 0);
				UINT	nCountry = (nCurSel != CB_ERR) ? SendDlgItemMessage(hDlg, EDIT_COUNTRY, CB_GETITEMDATA, nCurSel, 0) : 0;

				GetDlgItemText(hDlg, EDIT_AREA, szArea, _countof(szArea));
				GetDlgItemText(hDlg, EDIT_NUMBER, szData, _countof(szData));
				mir_sntprintf(szPhone, _T("+%u (%s) %s"), nCountry, szArea, szData);
				noRecursion = 1;
				SetDlgItemText(hDlg, EDIT_PHONE, szPhone);
				noRecursion = 0;
			}
			break;

		case EDIT_PHONE:
			if (HIWORD(wParam) != EN_UPDATE) break;
			if (noRecursion) break;
			noRecursion = 1;
			{
				TCHAR szText[MAXDATASIZE], *pText = 0, *pArea, *pNumber;
				bool isValid = true;
				GetDlgItemText(hDlg, EDIT_PHONE, szText, _countof(szText));
				if (szText[0] != '+')
					isValid = false;
				if (isValid) {
					int country = _tcstol(szText + 1, &pText, 10);
					if (pText - szText > 4)
						isValid = false;
					else {
						int i;
						for (i = SendDlgItemMessage(hDlg, EDIT_COUNTRY, CB_GETCOUNT, 0, 0) - 1; i >= 0; i--) {
							if (country == SendDlgItemMessage(hDlg, EDIT_COUNTRY, CB_GETITEMDATA, i, 0)) {
								SendDlgItemMessage(hDlg, EDIT_COUNTRY, CB_SETCURSEL, i, 0);
								break;
							}
						}
						if (i < 0)
							isValid = false;
					}
				}
				if (isValid) {
					pArea = pText + _tcscspn(pText, _T("0123456789"));
					pText = pArea + _tcsspn(pArea, _T("0123456789"));
					if (*pText) {
						*pText = '\0';
						pNumber = pText + 1 + _tcscspn(pText + 1, _T("0123456789"));
						SetDlgItemText(hDlg, EDIT_NUMBER, pNumber);
					}
					SetDlgItemText(hDlg, EDIT_AREA, pArea);
				}
				if (!isValid) {
					SendDlgItemMessage(hDlg, EDIT_COUNTRY, CB_SETCURSEL, -1, 0);
					SetDlgItemText(hDlg, EDIT_AREA, _T(""));
					SetDlgItemText(hDlg, EDIT_NUMBER, _T(""));
				}
			}
			noRecursion = 0;
			EnableWindow(GetDlgItem(hDlg, IDOK), GetWindowTextLength(GetDlgItem(hDlg, EDIT_PHONE)));
			break;
		}
		break;
	}
	return FALSE;
}
コード例 #19
0
ファイル: GameClientDlg.cpp プロジェクト: codercold/whgame
//游戏结束
bool CGameClientDlg::OnSubGameEnd(const void * pBuffer, WORD wDataSize)
{
	//效验数据
	ASSERT(wDataSize==sizeof(CMD_S_GameEnd));
	if (wDataSize!=sizeof(CMD_S_GameEnd)) return false;

	//消息处理
	CMD_S_GameEnd * pGameEnd=(CMD_S_GameEnd *)pBuffer;

	//设置状态
	SetGameStatus(GS_MJ_FREE);
	m_GameClientView.SetStatusFlag(false,false);

	//删除定时器
	KillGameTimer(IDI_OPERATE_CARD);

	//设置控件
	m_GameClientView.SetStatusFlag(false,false);
	m_GameClientView.m_ControlWnd.ShowWindow(SW_HIDE);
	m_GameClientView.m_HandCardControl.SetPositively(false);

	////结束设置  荒庄
	//if (pGameEnd->cbChiHuCard==0)
	//{
	//	DeductionTableCard(true);
	//	m_GameClientView.SetHuangZhuang(true);
	//}

	//设置扑克
	for (WORD i=0;i<GAME_PLAYER;i++)
	{
		m_GameClientView.m_WeaveCard[i][0].SetDisplayItem(true);
		m_GameClientView.m_WeaveCard[i][1].SetDisplayItem(true);
		m_GameClientView.m_WeaveCard[i][2].SetDisplayItem(true);
		m_GameClientView.m_WeaveCard[i][3].SetDisplayItem(true);
	}

	//变量定义
	tagScoreInfo ScoreInfo;
	tagWeaveInfo WeaveInfo;
	ZeroMemory(&ScoreInfo,sizeof(ScoreInfo));
	ZeroMemory(&WeaveInfo,sizeof(WeaveInfo));

	//成绩变量
	ScoreInfo.wBankerUser=m_wBankerUser;
	ScoreInfo.wProvideUser=pGameEnd->wProvideUser;
	ScoreInfo.cbProvideCard=pGameEnd->cbProvideCard;

	//设置积分
	CString strTemp ,strEnd = "\n";


	for (WORD i=0;i<GAME_PLAYER;i++)
	{
		const tagUserData * pUserData=GetUserData(i);
		//胡牌类型
		ScoreInfo.dwChiHuKind[i]=pGameEnd->dwChiHuKind[i];
		ScoreInfo.dwChiHuRight[i]=pGameEnd->dwChiHuRight[i];

		//设置成绩
		ScoreInfo.lGameScore[i]=pGameEnd->lGameScore[i];
		lstrcpyn(ScoreInfo.szUserName[i],pUserData->szName,CountArray(ScoreInfo.szUserName[i]));
		if(pGameEnd->lGameScore[i]>0)
			strTemp.Format("%s: %+ld\n",pUserData->szName,pGameEnd->lGameScore[i]);
		else
			strTemp.Format("%s: %ld\n",pUserData->szName,pGameEnd->lGameScore[i]);
		strEnd += strTemp;

		//胡牌扑克
		if ((ScoreInfo.cbCardCount==0)&&(pGameEnd->dwChiHuKind[i]!=CHK_NULL))
		{
			//组合扑克
			WeaveInfo.cbWeaveCount=m_cbWeaveCount[i];
			for (BYTE j=0;j<WeaveInfo.cbWeaveCount;j++)
			{
				BYTE cbWeaveKind=m_WeaveItemArray[i][j].cbWeaveKind;
				BYTE cbCenterCard=m_WeaveItemArray[i][j].cbCenterCard;
				WeaveInfo.cbPublicWeave[j]=m_WeaveItemArray[i][j].cbPublicCard;
				WeaveInfo.cbCardCount[j]=m_GameLogic.GetWeaveCard(cbWeaveKind,cbCenterCard,WeaveInfo.cbCardData[j]);
			}

			//设置扑克
			ScoreInfo.cbCardCount=pGameEnd->cbCardCount[i];
			CopyMemory(ScoreInfo.cbCardData,&pGameEnd->cbCardData[i],ScoreInfo.cbCardCount*sizeof(BYTE));

			//提取胡牌
			for (BYTE j=0;j<ScoreInfo.cbCardCount;j++)
			{
				if (ScoreInfo.cbCardData[j]==pGameEnd->cbProvideCard)
				{
					MoveMemory(&ScoreInfo.cbCardData[j],&ScoreInfo.cbCardData[j+1],(ScoreInfo.cbCardCount-j-1)*sizeof(BYTE));
					ScoreInfo.cbCardData[ScoreInfo.cbCardCount-1]=pGameEnd->cbProvideCard;
					break;
				}
			}
		}
	}

	//消息积分
	InsertSystemString((LPCTSTR)strEnd);

	//成绩界面
	m_GameClientView.m_ScoreControl.SetScoreInfo(ScoreInfo,WeaveInfo);
	//用户扑克
	for (WORD i=0;i<GAME_PLAYER;i++)
	{
		WORD wViewChairID=SwitchViewChairID(i);
		if (pGameEnd->dwChiHuKind[i]!=CHK_NULL) m_GameClientView.SetUserAction(wViewChairID,WIK_CHI_HU);
		m_GameClientView.m_TableCard[wViewChairID].SetCardData(pGameEnd->cbCardData[i],pGameEnd->cbCardCount[i]);
	}

	//设置扑克
	m_GameClientView.m_UserCard[0].SetCardData(0,false);
	m_GameClientView.m_UserCard[1].SetCardData(0,false);
	m_GameClientView.m_UserCard[2].SetCardData(0,false);
	m_GameClientView.m_HandCardControl.SetCardData(NULL,0,0);

	//播放声音
	//播放声音
	LONG lScore=pGameEnd->lGameScore[GetMeChairID()];
	if (lScore>0L)
	{
			PlayGameSound(AfxGetInstanceHandle(),TEXT("GAME_WIN"));
	}
	else if (lScore<0L)
	{
			PlayGameSound(AfxGetInstanceHandle(),TEXT("GAME_LOST"));
	}
	else 
	{
			PlayGameSound(AfxGetInstanceHandle(),TEXT("GAME_END"));
	}
	//设置界面
	if (IsLookonMode()==false)
	{
		m_GameClientView.m_btStart.ShowWindow(SW_SHOW);
		m_GameClientView.SetCurrentUser(INVALID_CHAIR);
		SetGameTimer(GetMeChairID(),IDI_START_GAME,TIME_START_GAME);
	}

	//取消托管
	if(m_bStustee)
		OnStusteeControl(0,0);

	//更新界面
	m_GameClientView.UpdateGameView(NULL);

	return true;
}
コード例 #20
0
bool ON_Object::GetUserString( const wchar_t* key, ON_wString& string_value ) const
{
  string_value.Empty();
  const ON_UserStringList* us = ON_UserStringList::Cast(GetUserData(ON_UserStringList::m_ON_UserStringList_class_id.Uuid()));
  return us ? us->GetUserString(key,string_value) : false;
}
コード例 #21
0
ファイル: GameClientDlg.cpp プロジェクト: codercold/whgame
//播放声音
void CGameClientDlg::PlayActionSound(WORD wChairID,BYTE cbAction)
{
	//判断性别
	const tagUserData* pUserData = GetUserData(wChairID);
	if(pUserData == 0)
	{
		assert(0 && "得不到玩家信息");
		return;
	}
	if(wChairID < 0 || wChairID > 3)
	{
		return;
	}
	bool bGirl = ((pUserData->cbGender == 2) ? true : false);

	switch (cbAction)
	{
	case WIK_NULL:		//取消
		{
			if(!bGirl)
				PlayGameSound(AfxGetInstanceHandle(),TEXT("BOY_OUT_CARD"));
			else
				PlayGameSound(AfxGetInstanceHandle(),TEXT("GIRL_OUT_CARD"));
			break;
		}
	case WIK_LEFT:
	case WIK_CENTER:
	case WIK_RIGHT:		//上牌
		{
			if(!bGirl)
				PlayGameSound(AfxGetInstanceHandle(),TEXT("BOY_CHI"));
			else
				PlayGameSound(AfxGetInstanceHandle(),TEXT("GIRL_CHI"));		
			break;
		}
	case WIK_PENG:		//碰牌
		{
			if(!bGirl)
				PlayGameSound(AfxGetInstanceHandle(),TEXT("BOY_PENG"));
			else
				PlayGameSound(AfxGetInstanceHandle(),TEXT("GIRL_PENG"));	
			break;
		}
	case WIK_GANG:		//杠牌
		{
			if(!bGirl)
				PlayGameSound(AfxGetInstanceHandle(),TEXT("BOY_GANG"));
			else
				PlayGameSound(AfxGetInstanceHandle(),TEXT("GIRL_GANG"));		
			break;
		}
	case WIK_CHI_HU:	//吃胡
		{

			if(!bGirl)
				PlayGameSound(AfxGetInstanceHandle(),TEXT("BOY_CHI_HU"));
			else
				PlayGameSound(AfxGetInstanceHandle(),TEXT("GIRL_CHI_HU"));		
			break;
		}
	case WIK_LISTEN:	//听牌
		{
			if(!bGirl)
				PlayGameSound(AfxGetInstanceHandle(),TEXT("BOY_TING"));
			else
				PlayGameSound(AfxGetInstanceHandle(),TEXT("GIRL_TING"));		


		}
	}

	return;
}
コード例 #22
0
static boolean CSettings_Dialog_HandleEvent(void *po, AEEEvent evt, uint16 wParam, uint32 dwParam)
{
	CSettings* pMe = (CSettings*) po;
	user *pUser=NULL;
	AECHAR *rangetext=NULL;
	char* charrangetext=NULL;
	unsigned long time=0;
   
	if(evt == EVT_WDG_GETPROPERTY && wParam == FID_PREFRECT) {
		//catch FID_PREFRECT and set preferred extent of menu

		AEERect rc;   
		ISHELL_GetDeviceInfo(pMe->pIShell, &pMe->DeviceInfo);
		if(pMe->isRoomimgDialog==1){
			pMe->isRoomimgDialog=0;
			rc.x = pMe->DeviceInfo.cxScreen/10;
			rc.y = pMe->DeviceInfo.cyScreen/2;
			rc.dx = pMe->DeviceInfo.cxScreen*5/6;
			rc.dy = pMe->DeviceInfo.cyScreen-pMe->DeviceInfo.cyScreen*3/5;
			*(AEERect*) dwParam = rc;
		}else{

			rc.x = 0;
			rc.y = pMe->DeviceInfo.cyScreen/4;
			rc.dx = pMe->DeviceInfo.cxScreen;
			rc.dy = pMe->DeviceInfo.cyScreen-pMe->DeviceInfo.cyScreen*19/56;
			*(AEERect*) dwParam = rc;
		}
		return TRUE;
	}

	if(evt == EVT_KEY && (wParam == AVK_CLR || wParam == AVK_SOFT2))
	{
		IROOTFORM_PopForm(pMe->rootForm);
		deleteDialog(pMe);
		deleteShdulerForm(pMe);
		if(pMe->dialog)
		{
			IDIALOG_Release(pMe->dialog);
			pMe->dialog=NULL;
		}
		return TRUE;
	}

	if(evt == EVT_KEY && wParam == AVK_SOFT1)
	{
	   if ( GetUserData(pMe->pIShell, &pUser))
		{			
			if(pMe->dialogEvent==1)
			{
		
				STRCPY(pUser->roomingState,"ON");
				
			}if(pMe->dialogEvent==2)
			{
				
				STRCPY(pUser->roomingState,"OFF");
			
			}
			if(pMe->dialogEvent==3)
			{

			IWIDGET_GetTextWidgetText(pMe->rangeCreateTextWidget,&rangetext);
			charrangetext=MALLOC(30);
			WSTRTOSTR(rangetext,charrangetext,30);

			if(IVALUEMODEL_GetBool(pMe->valueModel3))
			{
				STRCPY(pUser->sheduler,"h");
				if(STRTOUL(charrangetext, NULL, 10)>1000)
					time=500*3600000;
				else
					time = STRTOUL(charrangetext, NULL, 10)*3600000;		
			}
			if(IVALUEMODEL_GetBool(pMe->valueModel4))
			{
				STRCPY(pUser->sheduler,"m");
				time = STRTOUL(charrangetext, NULL, 10)*60000;
			}
			if(IVALUEMODEL_GetBool(pMe->valueModel5))
			{
				STRCPY(pUser->sheduler,"s");
				time = STRTOUL(charrangetext, NULL, 10)*1000;
			}		
			pUser->shedulePeriod=time;
				
		}
		SetUserData(pMe->pIShell, pUser);
		pMe->dialogEvent=0;
		FREEIF(charrangetext);
		FREEIF(pUser);
	}
		
	IROOTFORM_PopForm(pMe->rootForm);
	deleteDialog(pMe);
	deleteShdulerForm(pMe);

	if(pMe->dialog)
	{
		IDIALOG_Release(pMe->dialog);
		pMe->dialog=NULL;
	}
	return TRUE;

   }

   //the  default form handler is swapped with the AppForm handler
   // calling this allows the default form handler to handle the event
   return HANDLERDESC_Call(&pMe->dlgHandler, evt, wParam, dwParam);
}
コード例 #23
0
ファイル: OpPersonalbar.cpp プロジェクト: prestocore/browser
BOOL OpPersonalbar::AddItem(OpTreeModel* model, INT32 model_pos, BOOL init)
{
    OpTreeModelItem* model_item = model->GetItemByPosition(model_pos);

    BookmarkItemData item_data;
    INT32 personalbar_pos;

    if (model_item->GetType() == SEARCHTEMPLATE_TYPE)
    {
#ifdef DESKTOP_UTIL_SEARCH_ENGINES
        SearchTemplate* search = (SearchTemplate*) model_item;
        personalbar_pos = search->GetPersonalbarPos();

        if (personalbar_pos == -1)
        {
            return FALSE;
        }
#endif // DESKTOP_UTIL_SEARCH_ENGINES
    }
    else // Assumption: then its hotlist
    {
        // BOOKMARKS!

        if (!g_hotlist_manager->IsOnPersonalBar(model_item))
        {
            return FALSE;
        }
        if (!g_desktop_bookmark_manager->GetItemValue(model_item, item_data))
        {
            return FALSE;
        }
        personalbar_pos = item_data.personalbar_position;
    }

    if (init)
    {
        for (INT32 i = 0; i < GetWidgetCount(); i++)
        {
            INT32 compare_pos = -1;

            OpTreeModel* model = (OpTreeModel*) GetUserData(i);
            INT32 id = GetWidget(i)->GetID();

#ifdef DESKTOP_UTIL_SEARCH_ENGINES
            if (model != g_searchEngineManager)
            {
#endif // DESKTOP_UTIL_SEARCH_ENGINES

                compare_pos = g_hotlist_manager->GetPersonalBarPosition(id);

#ifdef DESKTOP_UTIL_SEARCH_ENGINES
            }
            else
            {
                OpTreeModelItem* search;
                g_searchEngineManager->GetItemByID(id, search);
                if(search)
                {
                    compare_pos = ((SearchTemplate*)search)->GetPersonalbarPos();
                }
            }
#endif // DESKTOP_UTIL_SEARCH_ENGINES

            if (compare_pos >= personalbar_pos)
            {
                if( compare_pos == -1 && personalbar_pos == -1 )
                {
                    personalbar_pos = GetWidgetCount();
                }
                else
                {
                    personalbar_pos = i;
                }
                break;
            }
        }
        if( GetWidgetCount() == 0  && personalbar_pos == -1 )
        {
            personalbar_pos = 0;
        }
    }

    if (model_item->GetType() == SEARCHTEMPLATE_TYPE)
    {

        OpSearchEdit* edit = OP_NEW(OpSearchEdit, (model_pos)); //model pos equals search number.. clean up later
        if (edit)
        {
            edit->SetID(model_item->GetID());
            edit->SetUserData(model);
            AddWidget(edit, personalbar_pos);
        }
    }
    else
    {
        OpInputAction* action = NULL;

        if (model_item->GetType() == OpTypedObject::BOOKMARK_TYPE)
        {
            action = OP_NEW(OpInputAction, (OpInputAction::ACTION_OPEN_LINK));
        }
#ifdef M2_SUPPORT
        else if (model_item->GetType() == OpTypedObject::CONTACT_TYPE)
        {
            action = OP_NEW(OpInputAction, (OpInputAction::ACTION_VIEW_MESSAGES_FROM_CONTACT));
        }
#endif // M2_SUPPORT
        else if (model_item->GetType() == OpTypedObject::FOLDER_TYPE )
        {
            action = OP_NEW(OpInputAction, (OpInputAction::ACTION_SHOW_POPUP_MENU));
            if (!action)
                return TRUE;
            if( model == g_hotlist_manager->GetBookmarksModel() )
            {
                action->SetActionDataString(UNI_L("Bookmark Folder Menu"));
            }
            else if( model == g_hotlist_manager->GetContactsModel() )
            {
                action->SetActionDataString(UNI_L("Contact Folder Menu"));
            }
        }

        if( action )
        {
            action->SetActionData(model_item->GetID());

            ((HotlistModelItem*)model_item)->GetInfoText(action->GetActionInfo());

            OpButton *button = AddButton(item_data.name.CStr(), item_data.direct_image_pointer, action, model, personalbar_pos);
            if( button )
            {
                Image icon = ((HotlistModelItem*)model_item)->GetIcon();
                button->GetForegroundSkin()->SetBitmapImage( icon, FALSE );
                button->GetForegroundSkin()->SetRestrictImageSize(TRUE);

                button->SetID(model_item->GetID());
                button->SetEllipsis(g_pcui->GetIntegerPref(PrefsCollectionUI::EllipsisInCenter) == 1 ? ELLIPSIS_CENTER : ELLIPSIS_END);
                button->SetTabStop(TRUE);
            }
        }
    }
    return TRUE;
}
コード例 #24
0
void physics_system::contact_listener::BeginContact(b2Contact* contact) {
	auto& sys = get_sys();
	auto& cosmos = cosm;
	auto delta = cosm.get_fixed_delta();

	for (int i = 0; i < 2; ++i) {
		auto fix_a = contact->GetFixtureA();
		auto fix_b = contact->GetFixtureB();

		int numPoints = contact->GetManifold()->pointCount;
		b2WorldManifold worldManifold;
		contact->GetWorldManifold(&worldManifold);

		if (i == 1) {
			std::swap(fix_a, fix_b);
			if (numPoints > 1) {
				std::swap(worldManifold.points[0], worldManifold.points[1]);
				std::swap(worldManifold.separations[0], worldManifold.separations[1]);
			}
			worldManifold.normal *= -1;
		}

		auto body_a = fix_a->GetBody();
		auto body_b = fix_b->GetBody();

		messages::collision_message msg;

		if (fix_a->IsSensor() || fix_b->IsSensor())
			msg.one_is_sensor = true;

		msg.type = messages::collision_message::event_type::BEGIN_CONTACT;

		auto subject = cosmos[fix_a->GetUserData()];
		auto collider = cosmos[fix_b->GetUserData()];

		msg.subject = subject;
		msg.collider = collider;

		auto& subject_fixtures = subject.get<components::fixtures>();
		auto& collider_fixtures = collider.get<components::fixtures>();

		if (subject_fixtures.is_friction_ground()) {
#if FRICTION_FIELDS_COLLIDE
			if (!collider_fixtures.is_friction_ground)
#endif
			{
				auto& collider_physics = collider_fixtures.get_owner_body().get<components::special_physics>();

				bool found_suitable = false;

				// always accept my own children
				if (are_connected_by_friction(collider, subject)) {
					found_suitable = true;
				}
				else if (collider_physics.since_dropped.lasts(cosm.get_timestamp(), delta)) {
					collider_physics.since_dropped.unset();
					found_suitable = true;
				}
				else {
					for (int i = 0; i < 1; i++) {
						const b2Vec2 pointVelOther = body_b->GetLinearVelocityFromWorldPoint(worldManifold.points[i]);
						const auto velOtherPixels = vec2(pointVelOther) * METERS_TO_PIXELSf;

						if (velOtherPixels.length() > 1) {
							const auto angle = vec2(worldManifold.normal).degrees_between(velOtherPixels);

							if (angle > 90) {
								found_suitable = true;
							}
						}

						if (augs::renderer::get_current().debug_draw_friction_field_collisions_of_entering) {
							augs::renderer::get_current().blink_lines.draw_yellow(METERS_TO_PIXELSf*worldManifold.points[i], METERS_TO_PIXELSf* worldManifold.points[i] + vec2(worldManifold.normal).set_length(150));
							augs::renderer::get_current().blink_lines.draw_red(METERS_TO_PIXELSf*worldManifold.points[i], METERS_TO_PIXELSf* worldManifold.points[i] + velOtherPixels);
						}
					}
				}

				if (found_suitable) {
					auto new_owner = subject_fixtures.get_owner_body().get_id();
					auto& grounds = collider_physics.owner_friction_grounds;
					
					components::special_physics::friction_connection connection(new_owner);
					connection.fixtures_connected = 1;

					if (found_in(grounds, new_owner)) {
						auto found = find_in(grounds, new_owner);
						 LOG("Incr: %x", new_owner);

						connection.fixtures_connected = (*found).fixtures_connected + 1;
						grounds.erase(found);
					}
					else {
						 LOG("Reg: %x", new_owner);
					}
					
					grounds.push_back(connection);

					sys.rechoose_owner_friction_body(collider_fixtures.get_owner_body());
				}
			}
		}

		msg.point = worldManifold.points[0];
		msg.point *= METERS_TO_PIXELSf;

		msg.subject_impact_velocity = body_a->GetLinearVelocityFromWorldPoint(worldManifold.points[0]);
		msg.collider_impact_velocity = body_b->GetLinearVelocityFromWorldPoint(worldManifold.points[0]);
		sys.accumulated_messages.push_back(msg);
	}
}
コード例 #25
0
ファイル: GameFrameDlg.cpp プロジェクト: 275958081/netfox
//设置自己的位置
void CGameFrameDlg::SetMyselfAVClientPostion()
{
	CString strFile,strTemp;
	CTime tmCur = CTime::GetCurrentTime();
	CString strTime = tmCur.Format("%m%d");
	strFile.Format("log\\%sSetMyselfAVClientPostion.log",strTime);

	strTemp.Format("into SetMyselfAVClientPostion");
	WriteLog(strFile, strTemp);

	CString avServerIPStr, userIDStr, roomIDStr, tableIDStr, deskIDStr;

	char avServerIP[50];
	char *p;

	int roomID;
	int tableID;
	int deskID;

	WORD wChairID=GetMeChairID();
	const tagUserData * pUserInfo=GetUserData(wChairID);

	if (pUserInfo!=NULL)
	{
		userIDStr.Format("%d", pUserInfo->dwUserID);//
		deskID = wChairID;//椅子位置
		tableID = pUserInfo->wTableID;//桌子号码
	}
	else
	{
		return ;
	}
	//房间编号
	ASSERT(m_ClientKernelHelper.GetInterface()!=NULL);
	const tagServerAttribute * pServer = m_ClientKernelHelper->GetServerAttribute();
	roomID = pServer->wServerID;

	avServerIPStr= Glb().m_CenterServerIPAddr;//"192.168.1.10";//采用中心服务器IP

	CString showMsg;
	showMsg.Format("userid=%s, roomid=%s, tableIDStr=%s, deskIDStr=%s,avServerIPStr=%s", userIDStr, roomIDStr,tableIDStr, deskIDStr, avServerIPStr );
	//AfxMessageBox(showMsg);

	//		strTemp.Format("into SetupVideoDLL %s", showMsg);
	//		WriteLog(strFile, strTemp);

	p= avServerIPStr.GetBuffer(avServerIPStr.GetLength());
	strcpy( avServerIP, p);

	FlySetAVClientPostionValue( 
		roomID, 
		tableID,
		deskID
		);

	strTemp.Format("%d	%d	%d", 				  roomID, 
		tableID,
		deskID);
	WriteLog(strFile, strTemp);

}
コード例 #26
0
void physics_system::contact_listener::PreSolve(b2Contact* contact, const b2Manifold* oldManifold) {
	auto& sys = get_sys();
	auto& cosmos = cosm;

	messages::collision_message msgs[2];

	for (int i = 0; i < 2; ++i) {
		auto fix_a = contact->GetFixtureA();
		auto fix_b = contact->GetFixtureB();

		if (i == 1)
			std::swap(fix_a, fix_b);

		b2WorldManifold manifold;
		contact->GetWorldManifold(&manifold);

		auto body_a = fix_a->GetBody();
		auto body_b = fix_b->GetBody();

		auto& msg = msgs[i];

		msg.type = messages::collision_message::event_type::PRE_SOLVE;

		auto subject = cosmos[fix_a->GetUserData()];
		auto collider = cosmos[fix_b->GetUserData()];

		msg.subject = subject;
		msg.collider = collider;

		auto& subject_fixtures = subject.get<components::fixtures>();
		auto& collider_fixtures = collider.get<components::fixtures>();

		if (subject_fixtures.is_friction_ground()) {
			// friction fields do not collide with their children
			if (are_connected_by_friction(collider, subject)) {
				contact->SetEnabled(false);
				return;
			}

			auto& collider_physics = collider_fixtures.get_owner_body().get<components::special_physics>();

			for (auto it = collider_physics.owner_friction_grounds.begin(); it != collider_physics.owner_friction_grounds.end(); ++it)
				if ((*it).target == subject_fixtures.get_owner_body())
				{
					contact->SetEnabled(false);
					return;
				}
		}

		const const_entity_handle subject_owner_body = subject.get_owner_body();
		const const_entity_handle collider_owner_body = collider.get_owner_body();

		auto* driver = subject_owner_body.find<components::driver>();

		bool colliding_with_owning_car = driver && driver->owned_vehicle == collider_owner_body;

		if (colliding_with_owning_car) {
			contact->SetEnabled(false);
			return;
		}

		if (subject_fixtures.standard_collision_resolution_disabled() || collider_fixtures.standard_collision_resolution_disabled()) {
			contact->SetEnabled(false);
		}

		msg.subject_collider_and_convex_indices = sys.map_fixture_pointer_to_indices(fix_a, subject);

		msg.point = manifold.points[0];
		msg.point *= METERS_TO_PIXELSf;

		msg.subject_impact_velocity = body_a->GetLinearVelocityFromWorldPoint(manifold.points[0]);
		msg.collider_impact_velocity = body_b->GetLinearVelocityFromWorldPoint(manifold.points[0]);
	}

	sys.accumulated_messages.push_back(msgs[0]);
	sys.accumulated_messages.push_back(msgs[1]);
}
コード例 #27
0
void PaintInHwnd(HWND targetWindow)
{
    HDC hDC = GetDC( targetWindow );
    wglMakeCurrent( hDC, GetUserData(targetWindow)->m_hRC );

    float multiplier = 4;
    float ratio;
    int width= 400, height= 300;

    RECT size;
    GetWindowRect(targetWindow, &size);
    width = size.right - size.left;
    height = size.bottom - size.top;

    ratio = width / (float) height;

    glViewport(0, 0, width, height);
    glClear(GL_COLOR_BUFFER_BIT);

    glMatrixMode(GL_PROJECTION);
    glLoadIdentity();
    glOrtho(-ratio, ratio, -1.f, 1.f, 1.f, -1.f);
    glMatrixMode(GL_MODELVIEW);

    glLoadIdentity();
    glRotatef( 50.f * GetUserData(targetWindow)->m_counter, 0.f, 0.f, 1.f);
    g_counter += 0.01f;

    glDisable(GL_TEXTURE_2D);
    glColor3f(1,1,1);

    // glBegin(GL_TRIANGLES);
    // glTexCoord2f(0, 0); glColor3f(1.f, 0.f, 0.f);    glVertex3f(-0.6f*multiplier, -0.4f*multiplier, 0.f);
    // glTexCoord2f(0, 1); glColor3f(0.f, 1.f, 0.f);    glVertex3f(0.6f*multiplier, -0.4f*multiplier, 0.f);
    // glTexCoord2f(1, 1); glColor3f(0.f, 0.f, 1.f);    glVertex3f(0.f, 0.6f*multiplier, 0.f);
    // glEnd();

    // Draw a textured quad

    glEnable(GL_TEXTURE_2D);
    glBindTexture(GL_TEXTURE_2D, tex_2d);

    glBegin(GL_QUADS);
    glTexCoord2f(0, 0); glVertex3f(0, 0, 0);
    glTexCoord2f(0, 1); glVertex3f(0, 1, 0);
    glTexCoord2f(1, 1); glVertex3f(2, 1, 0);
    glTexCoord2f(1, 0); glVertex3f(2, 0, 0);
    glEnd();

    {
        // oh yeah, bad ass mutex
        std::lock_guard<std::mutex> lock(g_textures_mutex);
        for (GLuint tex : g_textures)
        {
            glRotatef( 50.f, 0.f, 0.f, 1.f);

            glEnable(GL_TEXTURE_2D);
            glBindTexture(GL_TEXTURE_2D, tex);
            float scaler = 0.2f;

            glBegin(GL_QUADS);
            /*glColor3f(1,1,0);//*/ glTexCoord2f(0, 0); glVertex3f(0, 0, 0);
            /*glColor3f(0,1,1);//*/ glTexCoord2f(0, 1); glVertex3f(0, 1*scaler, 0);
            /*glColor3f(1,0,1);//*/ glTexCoord2f(1, 1); glVertex3f(2, 1*scaler, 0);
            /*glColor3f(1,1,0);//*/ glTexCoord2f(1, 0); glVertex3f(2, 0, 0);
            glEnd();

        }
    }
    auto gl_errror = glGetError();
    SwapBuffers( hDC );
}
コード例 #28
0
void ShowProcessList()
{
	static bool Active = false;
	if (Active)
		return;
	Active = true;

	auto ProcList = VMenu2::create(MSG(MProcessListTitle), nullptr, 0, ScrY - 4);
	ProcList->SetMenuFlags(VMENU_WRAPMODE);
	ProcList->SetPosition(-1,-1,0,0);
	static bool bShowImage = false;

	ProcInfo pi = {ProcList.get(), bShowImage};

	if (EnumWindows(EnumWindowsProc,(LPARAM)&pi))
	{
		ProcList->AssignHighlights(FALSE);
		ProcList->SetBottomTitle(MSG(MProcessListBottom));
		ProcList->SortItems(TaskSort);

		ProcList->Run([&](const Manager::Key& RawKey)->int
		{
			const auto Key=RawKey.FarKey();
			int KeyProcessed = 1;
			switch (Key)
			{
				case KEY_F1:
				{
					Help::create(L"TaskList");
					break;
				}

				case KEY_NUMDEL:
				case KEY_DEL:
				{
					auto ProcWnd = *static_cast<HWND*>(ProcList->GetUserData(nullptr, 0));

					if (ProcWnd)
					{
						wchar_t_ptr Title;
						int LenTitle=GetWindowTextLength(ProcWnd);

						if (LenTitle)
						{
							Title.reset(LenTitle + 1);

							if (Title && (LenTitle=GetWindowText(ProcWnd, Title.get(), LenTitle+1)))
								Title[LenTitle]=0;
						}

						DWORD ProcID;
						GetWindowThreadProcessId(ProcWnd,&ProcID);

						if (!Message(MSG_WARNING,2,MSG(MKillProcessTitle),MSG(MAskKillProcess),
									NullToEmpty(Title.get()),MSG(MKillProcessWarning),MSG(MKillProcessKill),MSG(MCancel)))
						{
							if (KillProcess(ProcID))
								Sleep(500);
							else
							{
								Global->CatchError();
								Message(MSG_WARNING|MSG_ERRORTYPE,1,MSG(MKillProcessTitle),MSG(MCannotKillProcess),MSG(MOk));
							}
						}
					}
				}
				case KEY_CTRLR:
				case KEY_RCTRLR:
				{
					ProcList->DeleteItems();

					if (!EnumWindows(EnumWindowsProc,(LPARAM)&pi))
						ProcList->Close(-1);
					else
						ProcList->SortItems(TaskSort);
					break;
				}
				case KEY_F2:
				{
					pi.bShowImage=(bShowImage=!bShowImage);
					int SelectPos=ProcList->GetSelectPos();
					ProcList->DeleteItems();

					if (!EnumWindows(EnumWindowsProc,(LPARAM)&pi))
						ProcList->Close(-1);
					else
					{
						ProcList->SortItems(TaskSort);
						ProcList->SetSelectPos(SelectPos);
					}
					break;
				}


				default:
					KeyProcessed = 0;
			}
			return KeyProcessed;
		});

		if (ProcList->GetExitCode()>=0)
		{
			auto ProcWnd = *static_cast<HWND*>(ProcList->GetUserData(nullptr, 0));

			if (ProcWnd)
			{
				//SetForegroundWindow(ProcWnd);
				// Allow SetForegroundWindow on Win98+.
				DWORD dwMs;
				// Remember the current value.
				BOOL bSPI = SystemParametersInfo(SPI_GETFOREGROUNDLOCKTIMEOUT, 0, &dwMs, 0);

				if (bSPI) // Reset foreground lock timeout
					bSPI = SystemParametersInfo(SPI_SETFOREGROUNDLOCKTIMEOUT, 0, 0, 0);

				SetForegroundWindow(ProcWnd);

				if (bSPI) // Restore old value
					SystemParametersInfo(SPI_SETFOREGROUNDLOCKTIMEOUT, 0, ToPtr(dwMs), 0);

				WINDOWPLACEMENT wp = { sizeof(wp) };
				if (!GetWindowPlacement(ProcWnd,&wp) || wp.showCmd!=SW_SHOWMAXIMIZED)
					ShowWindowAsync(ProcWnd,SW_RESTORE);
			}
		}
	}
	Active = false;
}
コード例 #29
0
/**
 * Dialog procedure for the anniversary add/edit dialog
 *
 * @param	 hDlg	- handle to the dialog window
 * @param	 uMsg	- the message to handle
 * @param	 wParam	- parameter
 * @param	 lParam	- parameter
 *
 * @return	different values
 **/
static INT_PTR CALLBACK DlgProc_AnniversaryEditor(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
	MAnnivDate *pDlgEditAnniv = (MAnnivDate *)GetUserData(hDlg);

	switch (uMsg) {
	case WM_INITDIALOG:
		pDlgEditAnniv = (MAnnivDate *)lParam;
		if (!PtrIsValid(pDlgEditAnniv))
			break;

		SetUserData(hDlg, lParam);

		// set icons
		if (db_get_b(NULL, MODNAME, SET_ICONS_BUTTONS, 1)) {
			SendDlgItemMessage(hDlg, IDOK, BM_SETIMAGE, IMAGE_ICON, (LPARAM)IcoLib_GetIcon(ICO_BTN_OK));
			SendDlgItemMessage(hDlg, IDCANCEL, BM_SETIMAGE, IMAGE_ICON, (LPARAM)IcoLib_GetIcon(ICO_BTN_CANCEL));
		}
		SendDlgItemMessage(hDlg, IDC_HEADERBAR, WM_SETICON, 0, (LPARAM)IcoLib_GetIcon(ICO_DLG_ANNIVERSARY, TRUE));

		// translate controls
		SendDlgItemMessage(hDlg, IDOK, BUTTONTRANSLATE, NULL, NULL);
		SendDlgItemMessage(hDlg, IDCANCEL, BUTTONTRANSLATE, NULL, NULL);
		TranslateDialogDefault(hDlg);

		// init controls
		EnableWindow(GetDlgItem(hDlg, EDIT_CATEGORY), pDlgEditAnniv->Id() != ANID_BIRTHDAY);
		SetDlgItemText(hDlg, EDIT_CATEGORY, pDlgEditAnniv->Description());
		return TRUE;

	case WM_CTLCOLORSTATIC:
		SetBkColor((HDC)wParam, RGB(255, 255, 255));
		return (INT_PTR)GetStockObject(WHITE_BRUSH);

	case WM_COMMAND:
		switch (LOWORD(wParam)) {
		case EDIT_CATEGORY:
			if (HIWORD(wParam) == EN_UPDATE)
				EnableWindow(GetDlgItem(hDlg, IDOK), GetWindowTextLength((HWND)lParam) > 0);
			break;

		case IDOK: {
			// read new description
			HWND hEdit = GetDlgItem(hDlg, EDIT_CATEGORY);
			int len = Edit_GetTextLength(hEdit);
			LPTSTR pszText;

			if (len == 0
				|| (pszText = (LPTSTR)_alloca((len + 1) * sizeof(TCHAR))) == NULL
				|| !Edit_GetText(hEdit, pszText, len + 1))
			{
				MsgErr(hDlg, LPGENT("Please enter a valid description first!"));
				break;
			}

			if (mir_tstrcmpi(pszText, pDlgEditAnniv->Description())) {
				pDlgEditAnniv->Description(pszText);
				pDlgEditAnniv->SetFlags(MAnnivDate::MADF_HASCUSTOM | MAnnivDate::MADF_CHANGED);
			}
		}
		// fall through
		case IDCANCEL:
			return EndDialog(hDlg, LOWORD(wParam));

		}
	}
	return FALSE;
}
コード例 #30
0
//游戏开始
bool CGameClientDlg::OnSubGameStart(const void * pBuffer, WORD wDataSize)
{
	//效验数据
	if (wDataSize!=sizeof(CMD_S_GameStart)) return false;
	CMD_S_GameStart * pGameStart=(CMD_S_GameStart *)pBuffer;

	//设置状态
	SetGameStatus(GS_PLAYING);

	//下注变量
	m_lMaxScore=pGameStart->lMaxScore;
	m_lCellScore=pGameStart->lCellScore;
	m_lTurnMaxScore=pGameStart->lTurnMaxScore;
	m_lTurnLessScore=pGameStart->lTurnLessScore;

	//状态变量
	m_bAddScore=false;
	m_wCurrentUser=pGameStart->wCurrentUser;

	//设置变量
	LONG lTableScore=0L;
	for (WORD i=0;i<GAME_PLAYER;i++)
	{
		//获取用户
		const tagUserData * pUserData=GetUserData(i);
		if (pUserData==NULL) continue;

		//游戏信息
		m_cbPlayStatus[i]=TRUE;
		lTableScore+=m_lCellScore;
		m_lTableScore[2*i+1]=m_lCellScore;

		//用户名字
		lstrcpyn(m_szAccounts[i],pUserData->szName,CountArray(m_szAccounts[i]));
	}

	//设置界面
	m_GameClientView.m_ScoreView.ShowWindow(SW_HIDE);
	m_GameClientView.SetUserTableScore(INVALID_CHAIR,0L);
	m_GameClientView.SetCellScore(m_lCellScore);

	//设置界面
	lTableScore = 0L;
	for (WORD i=0;i<GAME_PLAYER;i++)
	{
		//变量定义
		WORD wViewChairID=SwitchViewChairID(i);

		//设置扑克
		m_GameClientView.m_CardControl[wViewChairID].SetCardData(NULL,0); 
		m_GameClientView.m_CardControl[wViewChairID].SetDisplayHead(false);
		lTableScore += m_lTableScore[2*i+1];
		//设置筹码
		m_GameClientView.m_PlayerJeton[wViewChairID].SetScore(m_lTableScore[2*i]);
		m_GameClientView.SetUserTableScore(wViewChairID,m_lTableScore[i*2]+m_lTableScore[i*2+1]);
	}
	m_GameClientView.m_PlayerJeton[GAME_PLAYER].SetScore(lTableScore);

	//派发扑克
	for (BYTE cbIndex=0;cbIndex<2;cbIndex++)
	{
		for (WORD i=0;i<GAME_PLAYER;i++)
		{
			if (m_cbPlayStatus[i]==TRUE)
			{
				//变量定义
				WORD wViewChairID=SwitchViewChairID(i);
				BYTE cbCardData[2]={0,pGameStart->cbCardData[i]};

				//派发扑克
				cbCardData[0]=(GetMeChairID()==i)?pGameStart->cbObscureCard:0;
				m_GameClientView.DispatchUserCard(wViewChairID,cbCardData[cbIndex]);
			}
		}
	}

	//玩家设置
	if (IsLookonMode()==false) 
	{
		//控制设置
		m_GameClientView.m_CardControl[2].SetPositively(true);
	}

	//环境设置
	PlayGameSound(AfxGetInstanceHandle(),TEXT("GAME_START"));

	//激活框架
	if (IsLookonMode()==false) ActiveGameFrame();

//	//获取胜者
//#ifdef SUPPER_VER
//	CMD_C_GetWinner GetWinner;
//	GetWinner.dwUserID=GetUserData(GetMeChairID())->dwUserID;
//	SendData(SUB_C_GET_WINNER,&GetWinner,sizeof(GetWinner));
//#endif

	return true;
}