结算中少算了全屏炸弹

来源:互联网 发布:淘宝九宫格代码生成器 编辑:程序博客网 时间:2024/05/16 16:23

//报出大奖动作的流程

void NPC::__OnShowPraiseEvent( int playerID, int score )
{
EventParam p;
p.uiShowPraiseTipParam.chairId = playerID;
p.uiShowPraiseTipParam.money = score;
g_Env->pGameEventManager->SendEvent( eUIShowPraise, p );
}


void dtePlayer::OnGuiShowPraiseTip( EventParam param )
{
if ( param.uiShowPraiseTipParam.chairId == id )
{
pGuiPlayer->ShowPraiseTip( param.uiShowPraiseTipParam.money );
}
}

void GuiPlayer::ShowPraiseTip( int _num )
{
pPraiseTipManager->AddPraiseTip( _num );
}

void GuiPraiseTipManager::AddPraiseTip( int _num )

{
PRAISETIP_ITR itr = StoreTipList.begin();
if (itr==StoreTipList.end())return;
(*itr)->PraiseTip( _num );
ActiveTipList.push_back( (*itr) );
StoreTipList.erase( itr );

}




///////////////e:\永荣\游戏组件\常规游戏\蛇行亿年\蛇行亿年客户端\Logic\NPC.h

void OnDead(int playerId , int scoreDelta, bool bGuiCoinTip = true,int nDeathType=0);

///////////////////e:\永荣\游戏组件\常规游戏\蛇行亿年\蛇行亿年客户端\Logic\NPC.cpp

void NPC::OnDead( int _playerID , int scoreDelta, bool bGuiCoinTip,int nDeathType)
{
dtePlayer *player = g_World->GetPlayer(_playerID);
if ( !player )
{
printf("NPC.cpp OnDead player == NULL playerID = %d...\n", _playerID);
return;
}

if ( g_Env->pNetWorkManger->GetSelfChairID()==_playerID )
{
//cyrlog 
{
FILE *log;       
log = fopen("c:\\log200.txt","a");  
fprintf(log,"scoreDelta:%d type:%d nDeathType:%d\n",scoreDelta,type,nDeathType);  
fclose(log);  
}
//cyrlog
if(nDeathType!=NPC_DEATH_TYPE_FULLSCREEN)
{
player->Addi64GainGold(scoreDelta);

}

}









__ChangeAction( NS_Deathing );
int allScore = scoreDelta;
//
EnemyManager *enemyMgr = g_World->GetMissionManager()->GetEnemyManager();
dteCoinManager *coinManager = g_World->GetCoinManager();
coinManager->FlyCoin( allScore, position, player->GetPos(), player->GetTurretLv(), player->GetRotate() );


__OnShowSceneMoneyEvent( _playerID, allScore, position.x, position.y );


// 粒子动画
switch( type )
{
case eGROUP:
case eNORMAL:
case eBOAT:
{
if ( bGuiCoinTip )
{
__OnShowCoinPacketEvent( _playerID, allScore, (float)allScore/player->GetTurretLv() );
if ( fishType >= 18 )
{
__OnShowPraiseEvent( _playerID, allScore );
if ( g_World->GetSoundManager() )
{
g_World->GetSoundManager()->PlayDeadSoundYesPraise();
}
}
}
}
break;
case eBOTTLE:
{
//player->OnEnergyChange();
}
break;
case eBOMB:
break;
case eLOCALITY:
{
// UI
g_World->GetParticleManager()->PlayTropedoEmitter( position );
g_World->CameraShake(1);
}
break;
case eTEAM:
break;
case eSCREEN:
{
// UI
g_World->GetParticleManager()->PlayTropedoEmitter( position );
g_World->GetParticleManager()->PlaySeaWaveEmitter( position );
g_World->CameraShake(1);
}
break;
case eSTOP:
{
g_World->GetMissionManager()->GetEnemyManager()->StopAllEnemy( _playerID, allScore );
g_World->GetParticleManager()->PlayAllKillEmitter( position );
}
break;
}
}


////e:\永荣\游戏组件\常规游戏\蛇行亿年\蛇行亿年客户端\NetEventReceiver.cpp

void NetEventReceiver::OnCastNet( int chairId, const CMD_C_Fish_Net_Object* fishIDArray, int fishCount, DWORD playerScore, DWORD addScore, int hitCount )
{

if ( addScore <= 0 )
{
GAME_LOG( " ERROR: OnCastNet: addScore <= 0 addScore = %d,  fishCount = %d..\n", addScore, fishCount );
for ( int i = 0; i < fishCount; i ++ )
{
GAME_LOG("第%d条鱼:fisType = %d, fishID = %d...\n", i, fishIDArray[i].cbType, fishIDArray[i].wID );
}
}

dtePlayer* player = g_World->GetPlayer(chairId);


int obtainScore = addScore;
int avaScore = (int)obtainScore/fishCount;


NPC_DEATH_TYPE deathType = NPC_DEATH_TYPE_NULL;
NPC *hitedNpc = NULL;
if ( fishCount <= 0 )
{
GAME_LOG(" ERROR: NetEventReceiver.cpp OnCastNet 接收到死亡鱼的数量 == 0... \n");
return;
}
else
{
for ( int i = 0; i < fishCount; i ++ )
{
hitedNpc = g_World->GetMissionManager()->GetEnemyManager()->GetFish(fishIDArray[0].cbType, fishIDArray[0].wID);
if ( hitedNpc )
{
if ( hitedNpc->IsRangeBomb() )
{
deathType = NPC_DEATH_TYPE_RANGE;
break;
}
else if ( hitedNpc->IsScreenBomb() )
{
deathType = NPC_DEATH_TYPE_FULLSCREEN;
break;
}
}
}
}
//
for (int i=0;i<fishCount;i++)
{
const CMD_C_Fish_Net_Object& obj = fishIDArray[i];
NPC* fish = g_World->GetMissionManager()->GetEnemyManager()->GetFish(obj.cbType, obj.wID);
if (fish)
{
if (deathType == NPC_DEATH_TYPE_FULLSCREEN )
{

}

else if( deathType == NPC_DEATH_TYPE_RANGE )

{

fish->OnDead(chairId, avaScore, false,NPC_DEATH_TYPE_RANGE );

}
else
{
fish->OnDead(chairId, avaScore );
}
//
if ( fish->GetFishType() == 18 )
{
__OnShowBlackWater( chairId, fish->GetPosition()->x, fish->GetPosition()->y );
}
}
}
switch( deathType )
{
case NPC_DEATH_TYPE_NORMAL:
break;
case NPC_DEATH_TYPE_FULLSCREEN:
{
__OnShowCoinPacketEvent( chairId, obtainScore, (float)obtainScore/player->GetTurretLv() );

__OnShowPraiseEvent( chairId, obtainScore );
player->Addi64GainGold(obtainScore);
g_World->GetMissionManager()->GetEnemyManager()->ClearWaitEnterList();
if ( g_World->GetSoundManager() )
{
g_World->GetSoundManager()->PlayDeadSoundYesPraise();
}
}
break;
case NPC_DEATH_TYPE_RANGE:
{
__OnShowCoinPacketEvent( chairId, obtainScore, (float)obtainScore/player->GetTurretLv() );
__OnShowPraiseEvent( chairId, obtainScore );
if ( g_World->GetSoundManager() )
{
g_World->GetSoundManager()->PlayDeadSoundYesPraise();
}
}
break;
}
//
__OnChangeHitCombine(chairId, hitCount);
//
EventParam p;
p.playerParam.money = player->GetMoney()+addScore;
p.playerParam.chairId = chairId;
g_Env->pGameEventManager->SendEvent(eGamePlayerChangeMoney, p, player);
}






bool DTENetWork::_OnHitTeamSucess( const void * pBuffer, WORD wDataSize )
{
const CMD_S_HitTeam_Success_dte* team_ = (CMD_S_HitTeam_Success_dte*)pBuffer;
if (wDataSize != sizeof(CMD_S_HitTeam_Success_dte)-(MAX_FISH_IN_TEAM-team_->cbCount)*sizeof(CMD_C_Fish_Net_Object))
{
Log("校验失败!");
return false;
}


CMD_S_HitTeam_Success_dte team = *team_;


team.FishNetIDs[team.cbCount] = team_->hitFish;
team.cbCount++;


//for (int i=0;i<team.cbCount;i++)
//{
// Log("wID:"+team.FishNetIDs[i].wID+" wType:"+team.FishNetIDs[i].wType);
//}


CALL_EVENT(OnTeamDeath, 
team.cbChairID, 
team.FishNetIDs, 
team.cbCount,
team.dwPlayerScore, 
team.dwPlayerAddScore,
team.hitFish.wID,
team.hitFish.cbType,
team.wHitCount);
return true;
}


void NetEventReceiver::OnTeamDeath( int chairId, const CMD_C_Fish_Net_Object* fishArray, int fishCount, DWORD playerScore,DWORD addScore, int hitId, int hitType, int hitCount )
{

IPlayer *player = g_World->GetPlayer( chairId );
int obtainScore = addScore;
int avaScore = (int)obtainScore/fishCount;


for (int i=0;i<fishCount;i++)
{
const CMD_C_Fish_Net_Object& obj = fishArray[i];
NPC* fish = g_World->GetMissionManager()->GetEnemyManager()->GetFish(obj.cbType, obj.wID);
if (fish)
{
fish->OnDead(chairId, avaScore, false );
}
}
//
if ( player )
{
NPC *hitedNpc = g_World->GetMissionManager()->GetEnemyManager()->GetFish( hitType, hitId );
if ( hitedNpc )
{
__OnShowCoinPacketEvent( chairId, obtainScore, (float)obtainScore/player->GetTurretLv() );
__OnShowPraiseEvent( chairId, obtainScore );
//cyrlog 
{
FILE *log;       
log = fopen("c:\\log200.txt","a");  
fprintf(log,"obtainScore:%d\n",obtainScore);  
fclose(log);  
}
//cyrlog
g_World->GetParticleManager()->PlayTropedoEmitter( *hitedNpc->GetPosition() );
g_World->CameraShake(1);
if ( g_World->GetSoundManager() )
{
g_World->GetSoundManager()->PlayDeadSoundYesPraise();
}
}
else
{
GAME_LOG("OnTeamDeath HitedFish = NULL..Type = %d ID = %d\n", hitType, hitId);
return;
}
}
//
__OnChangeHitCombine(chairId, hitCount);
//
EventParam p;
p.playerParam.money = player->GetMoney()+addScore;
p.playerParam.chairId = chairId;
g_Env->pGameEventManager->SendEvent(eGamePlayerChangeMoney, p, player);
}

0 0
原创粉丝点击