本文整理汇总了C++中PlayGameSound函数的典型用法代码示例。如果您正苦于以下问题:C++ PlayGameSound函数的具体用法?C++ PlayGameSound怎么用?C++ PlayGameSound使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了PlayGameSound函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: switch
//时间消息
bool CGameClientDlg::OnTimerMessage(WORD wChairID, UINT nElapse, UINT nTimerID)
{
switch (nTimerID)
{
case IDI_OUT_CARD: //用户出牌
{
//超时判断
if (nElapse==0)
{
if ((IsLookonMode()==false)&&(wChairID==GetMeChairID())) AutomatismOutCard();
return false;
}
//播放声音
if (m_bHandCardCount<m_bTurnCardCount) return true;
if ((nElapse<=3)&&(wChairID==GetMeChairID())&&(IsLookonMode()==false)) PlayGameSound(AfxGetInstanceHandle(),TEXT("GAME_WARN"));
return true;
}
case IDI_START_GAME: //开始游戏
{
if (nElapse==0)
{
if ((IsLookonMode()==false)&&(wChairID==GetMeChairID())) OnStart(0,0);
return false;
}
if ((nElapse<=3)&&(wChairID==GetMeChairID())&&(IsLookonMode()==false)) PlayGameSound(AfxGetInstanceHandle(),TEXT("GAME_WARN"));
return true;
}
}
return false;
}
示例2: switch
//时间消息
bool CGameClientDlg::OnTimerMessage(WORD wChairID, UINT nElapse, UINT nTimerID)
{
switch(nTimerID)
{
case IDI_START_GAME:
{
if (nElapse==0)
{
if ((IsLookonMode()==false)&&(wChairID==GetMeChairID()))
PostMessage(WM_CLOSE,0,0);
return true;
}
if ((nElapse<=3)&&(wChairID==GetMeChairID())&&(IsLookonMode()==false))
PlayGameSound(AfxGetInstanceHandle(),TEXT("GAME_WARN"));
return true;
}
case IDI_USER_ADD_SCORE:
{
if (nElapse==0)
{
if ((IsLookonMode()==false)&&(wChairID==GetMeChairID()))
{
//删除定时器
KillGameTimer(IDI_USER_ADD_SCORE);
OnGiveUp(0,0);
}
return true;
}
if ((nElapse<=3)&&(wChairID==GetMeChairID())&&(IsLookonMode()==false))
PlayGameSound(AfxGetInstanceHandle(),TEXT("GAME_WARN"));
return true;
}
}
return false;
}
示例3: ASSERT
//用户加注
bool CGameClientDlg::OnSubPlaceJetton(const void * pBuffer, WORD wDataSize)
{
//效验数据
ASSERT(wDataSize==sizeof(CMD_S_PlaceJetton));
if (wDataSize!=sizeof(CMD_S_PlaceJetton)) return false;
//消息处理
CMD_S_PlaceJetton * pPlaceJetton=(CMD_S_PlaceJetton *)pBuffer;
//加注界面
m_GameClientView.PlaceUserJetton(pPlaceJetton->cbJettonArea,pPlaceJetton->lJettonScore);
//播放声音
if (IsEnableSound())
{
if (pPlaceJetton->wChairID!=GetMeChairID() || IsLookonMode())
{
if (pPlaceJetton->lJettonScore==5000000) PlayGameSound(AfxGetInstanceHandle(),TEXT("ADD_GOLD_EX"));
else PlayGameSound(AfxGetInstanceHandle(),TEXT("ADD_GOLD"));
m_DTSDCheer[rand()%3].Play();
}
}
return true;
}
示例4: ASSERT
//移动棋子
bool CGameClientDlg::OnSubMoveChess(const void * pBuffer, WORD wDataSize)
{
//效验数据
ASSERT(wDataSize==sizeof(CMD_S_MoveChess));
if (wDataSize!=sizeof(CMD_S_MoveChess)) return false;
//消息处理
CMD_S_MoveChess * pMoveChess=(CMD_S_MoveChess *)pBuffer;
m_wCurrentUser=pMoveChess->wCurrentUser;
//设置时间
CopyMemory(m_wLeftClock,pMoveChess->wLeftClock,sizeof(m_wLeftClock));
//记录棋谱
WORD wMoveUser=(pMoveChess->wCurrentUser+1)%GAME_PLAYER;
//设置界面
m_ShamView=false;
WORD wMeChairID=GetMeChairID();
if ((IsLookonMode()==true)||(wMoveUser!=wMeChairID))
{
//变量定义
BYTE cbXSourcePos=pMoveChess->cbXSourcePos,cbYSourcePos=pMoveChess->cbYSourcePos;
BYTE cbXTargetPos=pMoveChess->cbXTargetPos,cbYTargetPos=pMoveChess->cbYTargetPos;
//播放声音
const tagChessItem * pSourceChessItem=m_GameLogic.GetChessItem(cbXSourcePos,cbYSourcePos);
const tagChessItem * pTargetChessItem=m_GameLogic.GetChessItem(cbXTargetPos,cbYTargetPos);
if ((pTargetChessItem!=NULL)&&(pSourceChessItem->cbColor!=pTargetChessItem->cbColor))
{
if (pSourceChessItem->cbColor==m_cbChessColor) PlayGameSound(AfxGetInstanceHandle(),TEXT("CHESS_EAT"));
else PlayGameSound(AfxGetInstanceHandle(),TEXT("CHESS_DEAD"));
}
else PlayGameSound(AfxGetInstanceHandle(),TEXT("PLACE_CHESS"));
//移动棋子
m_GameLogic.MoveChess(cbXSourcePos,cbYSourcePos,cbXTargetPos,cbYTargetPos,pMoveChess->cbSwitchChess);
//设置棋盘
m_GameClientView.m_ChessBorad.SetChessBorad(m_GameLogic.m_ChessBorad);
m_GameClientView.m_ChessBorad.SetChessFrame(cbXSourcePos,cbYSourcePos,cbXTargetPos,cbYTargetPos);
}
//玩家设置
if ((IsLookonMode()==false)&&(pMoveChess->wCurrentUser==wMeChairID))
{
//设置界面
ActiveGameFrame();
CancelChessSelect();
m_GameClientView.m_ChessBorad.SetPositively(true);
m_GameClientView.m_ChessBorad.SetSelectChess(m_cbXSourcePos,m_cbYSourcePos);
}
return true;
}
示例5: PlayGameSound
//时间消息
bool CGameClientDlg::OnTimerMessage(WORD wChairID, UINT nElapse, UINT nTimerID)
{
static int num = 0;
if ((nTimerID==IDI_PLACE_JETTON)&&(nElapse==0))
{
num = 0;
//设置光标
m_GameClientView.SetCurrentJetton(0L);
//禁止按钮
m_GameClientView.m_btJetton100.EnableWindow(FALSE);
m_GameClientView.m_btJetton1000.EnableWindow(FALSE);
m_GameClientView.m_btJetton10000.EnableWindow(FALSE);
m_GameClientView.m_btJetton100000.EnableWindow(FALSE);
m_GameClientView.m_btJetton1000000.EnableWindow(FALSE);
m_GameClientView.m_btJetton5000000.EnableWindow(FALSE);
m_GameClientView.m_btJetton10000000.EnableWindow(FALSE);
//庄家按钮
m_GameClientView.m_btApplyBanker.EnableWindow( FALSE );
m_GameClientView.m_btCancelBanker.EnableWindow( FALSE );
}
if ((nTimerID==IDI_PLACE_JETTON)&&IsEnableSound())
{
if (nElapse<=2&&nElapse>1) PlayGameSound(HORSE_READY);
}
if (nTimerID == IDI_HORSE_RUN && nElapse > 11 && (nElapse%3) == 0)
{
m_GameClientView.SetEveryHorseSpeed(8- (nElapse-11)/3);
}
if (nTimerID == IDI_HORSE_RUN)
{
if (nElapse == 34)
{
PlayGameSound(RACE_RUN);
}
if (IsEnableSound() && m_GameClientView.GetIsFinishRace())
{
num ++;
if (num == 3)
{
PlayGameSound(RACE_OVER);
}
}
}
return true;
}
示例6: switch
//时间消息
bool CGameClientDlg::OnTimerMessage(WORD wChairID, UINT nElapse, UINT nTimerID)
{
switch (nTimerID)
{
case IDI_START_GAME: //开始定时器
{
//中止判断
if (nElapse==0)
{
PostMessage(WM_CLOSE,0,0);
return false;
}
//警告通知
if (nElapse<=5) PlayGameSound(AfxGetInstanceHandle(),TEXT("GAME_WARN"));
return true;
}
case IDI_NULLITY: //过滤时器
{
//中止判断
if (nElapse==0)
{
KillGameTimer(IDI_NULLITY);
return false;
}
//警告通知
if (nElapse<=5) PlayGameSound(AfxGetInstanceHandle(),TEXT("GAME_WARN"));
return true;
}
case IDI_CALL_BANKER: //叫庄定时
{
//中止判断
if (nElapse==0)
{
//测试代码
//放弃做庄
OnBanker(0,0);
return false;
}
//警告通知
if (nElapse<=5) PlayGameSound(AfxGetInstanceHandle(),TEXT("GAME_WARN"));
return true;
}
}
return false;
}
示例7: KillTimer
//加注按钮
LRESULT CGameClientDlg::OnAddScore(WPARAM wParam, LPARAM lParam)
{
//删除定时器
KillTimer(IDI_TIME_USER_ADD_SCORE);
//获取筹码
WORD wMeChairID=GetMeChairID();
BYTE bTemp=(BYTE)wParam;
LONGLONG lCurrentScore=0;
if(bTemp==1)lCurrentScore=__max(m_lTurnMaxScore/8,1L);
else if(bTemp==2)lCurrentScore=__max(m_lTurnMaxScore/4,1L);
else if(bTemp==3)lCurrentScore=__max(m_lTurnMaxScore/2,1L);
else if(bTemp==4)lCurrentScore=__max(m_lTurnMaxScore,1L);
//控制按钮
UpdateScoreControl(NULL,SW_HIDE);
//界面设置
m_lTableScore[wMeChairID]=lCurrentScore;
m_GameClientView.SetUserTableScore(m_wViewChairID[wMeChairID],m_lTableScore[wMeChairID]);
PlayGameSound(AfxGetInstanceHandle(),TEXT("ADD_SCORE"));
//发送消息
CMD_C_AddScore AddScore;
AddScore.lScore=lCurrentScore;
SendData(SUB_C_ADD_SCORE,&AddScore,sizeof(AddScore));
return 0;
}
示例8: UpdateScoreControl
//加注按钮
LRESULT CGameClientDlg::OnAddScore(WPARAM wParam, LPARAM lParam)
{
//取消按钮
if( lParam == -1 )
{
UpdateScoreControl();
return 0;
}
else if( lParam == 0 )
{
//不加或跟注
return OnFollow(0,0);
}
//获取筹码
WORD wMeChairID=GetMeChairID();
LONG lCurrentScore=m_lTurnLessScore-m_lTableScore[wMeChairID*2+1]+m_lCellScore*(lParam);
//加注设置
m_bAddScore=true;
HideScoreControl();
m_GameClientView.m_PlayerJeton[2].SetScore(lCurrentScore);
//界面设置
KillGameTimer(IDI_USER_ADD_SCORE);
m_GameClientView.UpdateGameView(NULL);
PlayGameSound(AfxGetInstanceHandle(),TEXT("ADD_SCORE"));
//发送消息
CMD_C_AddScore AddScore;
AddScore.lScore=lCurrentScore;
SendData(SUB_C_ADD_SCORE,&AddScore,sizeof(AddScore));
return 0;
}
示例9: HideScoreControl
//用户放弃
bool CGameClientDlg::OnSubGiveUp(const void * pBuffer, WORD wDataSize)
{
//效验数据
if (wDataSize!=sizeof(CMD_S_GiveUp)) return false;
CMD_S_GiveUp * pGiveUp=(CMD_S_GiveUp *)pBuffer;
//设置变量
m_cbPlayStatus[pGiveUp->wGiveUpUser]=FALSE;
//变量定义
WORD wGiveUpUser=pGiveUp->wGiveUpUser;
BYTE cbCardData[MAX_COUNT]={0,0,0,0,0};
WORD wViewChairID=SwitchViewChairID(wGiveUpUser);
BYTE cbCardCount=(BYTE)m_GameClientView.m_CardControl[wViewChairID].GetCardCount();
//设置扑克
m_GameClientView.m_CardControl[wViewChairID].SetPositively(false);
m_GameClientView.m_CardControl[wViewChairID].SetDisplayHead(false);
m_GameClientView.m_CardControl[wViewChairID].SetCardData(cbCardData,cbCardCount);
//状态设置
if ((IsLookonMode()==false)&&(pGiveUp->wGiveUpUser==GetMeChairID()))
{
HideScoreControl();
SetGameStatus(GS_FREE);
}
//环境设置
if (wGiveUpUser==GetTimeChairID()) KillGameTimer(IDI_USER_ADD_SCORE);
if ((IsLookonMode()==true)||(wGiveUpUser!=GetMeChairID())) PlayGameSound(AfxGetInstanceHandle(),TEXT("GIVE_UP"));
return true;
}
示例10: OnTimerMessage
//时间消息
bool CGameClientDlg::OnTimerMessage(WORD wChairID, UINT nElapse, UINT nTimerID)
{
if ((nTimerID==IDI_PLACE_JETTON)&&(nElapse==0))
{
//设置光标
m_GameClientView.SetCurrentJetton(0L);
//禁止按钮
m_GameClientView.m_btJetton100.EnableWindow(FALSE);
m_GameClientView.m_btJetton1000.EnableWindow(FALSE);
m_GameClientView.m_btJetton10000.EnableWindow(FALSE);
m_GameClientView.m_btJetton50000.EnableWindow(FALSE);
m_GameClientView.m_btJetton100000.EnableWindow(FALSE);
m_GameClientView.m_btJetton500000.EnableWindow(FALSE);
m_GameClientView.m_btJetton1000000.EnableWindow(FALSE);
m_GameClientView.m_btJetton5000000.EnableWindow(FALSE);
//庄家按钮
m_GameClientView.m_btApplyBanker.EnableWindow( FALSE );
m_GameClientView.m_btCancelBanker.EnableWindow( FALSE );
}
if (IsEnableSound())
{
if (nTimerID==IDI_PLACE_JETTON&&nElapse<=5) PlayGameSound(AfxGetInstanceHandle(),TEXT("TIME_WARIMG"));
}
return true;
}
示例11: Notify
/**
** Check if enough resources for are available.
**
** @param costs How many costs.
**
** @return False if all enough, otherwise a bit mask.
**
** @note The return values of the PlayerCheck functions are inconsistent.
*/
int CPlayer::CheckCosts(const int *costs, bool notify) const
{
//Wyrmgus start
bool sound_played = false;
//Wyrmgus end
int err = 0;
for (int i = 1; i < MaxCosts; ++i) {
if (this->Resources[i] + this->StoredResources[i] >= costs[i]) {
continue;
}
if (notify) {
const char *name = DefaultResourceNames[i].c_str();
const char *actionName = DefaultActions[i].c_str();
//Wyrmgus start
// Notify(_("Not enough %s...%s more %s."), _(name), _(actionName), _(name));
Notify(_("Not enough %s... %s more %s."), _(name), _(actionName), _(name)); //added extra space to look better
//Wyrmgus end
//Wyrmgus start
// if (this == ThisPlayer && GameSounds.NotEnoughRes[this->Race][i].Sound) {
if (this == ThisPlayer && GameSounds.NotEnoughRes[this->Race][i].Sound && !sound_played) {
sound_played = true;
//Wyrmgus end
PlayGameSound(GameSounds.NotEnoughRes[this->Race][i].Sound, MaxSampleVolume);
}
}
err |= 1 << i;
}
return err;
}
示例12: memset
//开始按钮
LRESULT CGameClientDlg::OnStart(WPARAM wParam, LPARAM lParam)
{
//设置变量
m_wTimeOutCount=0;
m_bHandCardCount=0;
m_bTurnCardCount=0;
m_bTurnOutType=CT_INVALID;
m_wMostUser=INVALID_CHAIR;
memset(m_bHandCardData,0,sizeof(m_bHandCardData));
memset(m_bTurnCardData,0,sizeof(m_bTurnCardData));
//设置界面
KillGameTimer(IDI_START_GAME);
m_GameClientView.SetCardCount(INVALID_CHAIR,0);
m_GameClientView.SetPassFlag(INVALID_CHAIR,false);
//隐藏控件
m_GameClientView.m_btStart.ShowWindow(FALSE);
m_GameClientView.m_ScoreView.ShowWindow(SW_HIDE);
//设置扑克
m_GameClientView.m_HandCardControl.SetCardData(NULL,0);
m_GameClientView.m_HandCardControl.SetPositively(false);
// m_GameClientView.m_LeaveCardControl[0].SetCardData(NULL,0);
// m_GameClientView.m_LeaveCardControl[1].SetCardData(NULL,0);
for (WORD i=0;i<GAME_PLAYER;i++) m_GameClientView.m_UserCardControl[i].SetCardData(NULL,0);
//发送消息
SendUserReady(NULL,0);
PlayGameSound(AfxGetInstanceHandle(),TEXT("Ready"));
return 0;
}
示例13: KillGameTimer
//出牌消息
LRESULT CGameClientDlg::OnOutCard(WPARAM wParam, LPARAM lParam)
{
//状态判断
if ((m_GameClientView.m_btOutCard.IsWindowEnabled()==FALSE)
||(m_GameClientView.m_btOutCard.IsWindowVisible()==FALSE)) return 0;
//设置界面
KillGameTimer(IDI_OUT_CARD);
m_GameClientView.m_btOutCard.ShowWindow(SW_HIDE);
m_GameClientView.m_btOutCard.EnableWindow(FALSE);
m_GameClientView.m_btPassCard.ShowWindow(SW_HIDE);
m_GameClientView.m_btPassCard.EnableWindow(FALSE);
m_GameClientView.m_btOutPrompt.ShowWindow(SW_HIDE);
m_GameClientView.m_btOutPrompt.EnableWindow(FALSE);
//发送数据
CMD_C_OutCard OutCard;
OutCard.bCardCount=(BYTE)m_GameClientView.m_HandCardControl.GetShootCard(OutCard.bCardData,CountArray(OutCard.bCardData));
m_GameLogic.SortCardList(OutCard.bCardData,OutCard.bCardCount);
SendData(SUB_C_OUT_CART,&OutCard,sizeof(OutCard)-sizeof(OutCard.bCardData)+OutCard.bCardCount*sizeof(BYTE));
//预先显示
PlayGameSound(AfxGetInstanceHandle(),TEXT("OUT_CARD"));
m_GameClientView.m_UserCardControl[2].SetCardData(OutCard.bCardData,OutCard.bCardCount);
//预先删除
BYTE bSourceCount=m_bHandCardCount;
m_bHandCardCount-=OutCard.bCardCount;
m_GameLogic.RemoveCard(OutCard.bCardData,OutCard.bCardCount,m_bHandCardData,bSourceCount);
m_GameClientView.m_HandCardControl.SetCardData(m_bHandCardData,m_bHandCardCount);
return 0;
}
示例14: KillGameTimer
//自动出牌
bool CGameClientDlg::AutomatismOutCard()
{
//先出牌者
if (m_bTurnCardCount==0)
{
//控制界面
KillGameTimer(IDI_OUT_CARD);
m_GameClientView.m_btOutCard.ShowWindow(SW_HIDE);
m_GameClientView.m_btOutCard.EnableWindow(FALSE);
m_GameClientView.m_btPassCard.ShowWindow(SW_HIDE);
m_GameClientView.m_btPassCard.EnableWindow(FALSE);
m_GameClientView.m_btAutoOutCard.ShowWindow(SW_HIDE);
m_GameClientView.m_btAutoOutCard.EnableWindow(FALSE);
//发送数据
CMD_C_OutCard OutCard;
OutCard.bCardCount=1;
OutCard.bCardData[0]=m_bHandCardData[m_bHandCardCount-1];
SendData(SUB_C_OUT_CART,&OutCard,sizeof(OutCard)-sizeof(OutCard.bCardData)+OutCard.bCardCount*sizeof(BYTE));
//预先处理
PlayGameSound(AfxGetInstanceHandle(),TEXT("OUT_CARD"));
m_GameClientView.m_UserCardControl[1].SetCardData(OutCard.bCardData,OutCard.bCardCount);
//预先删除
BYTE bSourceCount=m_bHandCardCount;
m_bHandCardCount-=OutCard.bCardCount;
m_GameLogic.RemoveCard(OutCard.bCardData,OutCard.bCardCount,m_bHandCardData,bSourceCount);
m_GameClientView.m_HandCardControl.SetCardData(m_bHandCardData,m_bHandCardCount);
}
else OnPassCard(0,0);
return true;
}
示例15: ASSERT
//发送扑克
bool CGameClientDlg::OnSubSendCard(const void * pBuffer, WORD wDataSize)
{
//效验数据
ASSERT(wDataSize==sizeof(CMD_S_SendCard));
if (wDataSize!=sizeof(CMD_S_SendCard)) return false;
//变量定义
CMD_S_SendCard * pSendCard=(CMD_S_SendCard *)pBuffer;
//设置数据
m_bHandCardCount=CountArray(pSendCard->bCardData);
CopyMemory(m_bHandCardData,pSendCard->bCardData,sizeof(pSendCard->bCardData));
for (WORD i=0;i<GAME_PLAYER;i++) m_bCardCount[i]=CountArray(pSendCard->bCardData);
//设置界面
for (WORD i=0;i<GAME_PLAYER;i++)
{
m_GameClientView.SetLandScore(i,0);
m_GameClientView.SetPassFlag(i,false);
m_GameClientView.SetCardCount(i,m_bCardCount[i]);
m_GameClientView.m_UserCardControl[i].SetCardData(NULL,0);
}
if (IsLookonMode()==true)
{
m_GameClientView.SetLandUser(INVALID_CHAIR,0);
m_GameClientView.m_ScoreView.ShowWindow(SW_HIDE);
m_GameClientView.m_LeaveCardControl[0].SetCardData(NULL,0);
m_GameClientView.m_LeaveCardControl[1].SetCardData(NULL,0);
}
m_GameClientView.ShowLandTitle(true);
m_GameClientView.SetBombTime(m_wBombTime);
//设置扑克
BYTE bBackCard[LEFT_CARD_NUM /*3*/]={0,0,0,0};
m_GameClientView.m_HandCardControl.SetCardData(pSendCard->bCardData, ONE_USER_GET_CARD_NUM /*17*/);
m_GameClientView.m_BackCardControl.SetCardData(bBackCard,CountArray(bBackCard));
if (IsLookonMode()==true) m_GameClientView.m_HandCardControl.SetDisplayFlag(false);
//当前玩家
if ((IsLookonMode()==false)&&(pSendCard->wCurrentUser==GetMeChairID()))
{
ActiveGameFrame();
m_GameClientView.m_btOneScore.ShowWindow(SW_SHOW);
m_GameClientView.m_btTwoScore.ShowWindow(SW_SHOW);
m_GameClientView.m_btThreeScore.ShowWindow(SW_SHOW);
m_GameClientView.m_btGiveUpScore.ShowWindow(SW_SHOW);
}
//播放声音
PlayGameSound(AfxGetInstanceHandle(),TEXT("KAI_WA"));
//设置时间
SetGameTimer(pSendCard->wCurrentUser,IDI_LAND_SCORE,30);
return true;
}