Exemplo n.º 1
0
void App::onMenuCommand( WORD id )
{
	switch( id )
	{
	case IDM_EXIT:
		onQuit();
		break;

	case IDM_RELOADSETUP:
		GetGame()->reload_setup();
		break;
	}
}
Exemplo n.º 2
0
AFlareAsteroid* UFlareSector::LoadAsteroid(const FFlareAsteroidSave& AsteroidData)
{
    FActorSpawnParameters Params;
    Params.bNoFail = true;
	Params.SpawnCollisionHandlingOverride = ESpawnActorCollisionHandlingMethod::AdjustIfPossibleButAlwaysSpawn;

	AFlareAsteroid* Asteroid = GetGame()->GetWorld()->SpawnActor<AFlareAsteroid>(AFlareAsteroid::StaticClass(), AsteroidData.Location, AsteroidData.Rotation, Params);
    Asteroid->Load(AsteroidData);

	// TODO Check double add
	SectorAsteroids.Add(Asteroid);
    return Asteroid;
}
Exemplo n.º 3
0
void NLight::Draw(NCamera* View)
{
    //If the light isn't on the current level of the map, don't draw it! This is required because 2d lighting!
    if (GetGame()->GetMap()->GetLevel() != GetGame()->GetMap()->GetLevel(GetRealPos()))
    {
        return;
    }
    //Clear out the stencil buffer with 0's so we have a clean slate to work with.
    glClear(GL_STENCIL_BUFFER_BIT);
    glEnable(GL_STENCIL_TEST);
    //Make it so whatever we draw replaces everything it touches in the stencil to 1.
    glStencilFunc(GL_ALWAYS,0x1,0x1);
    glStencilOp(GL_KEEP, GL_KEEP, GL_REPLACE);
    //Draw all our shadow volumes.
    DrawShadow(View);
    //Now we make it so we can only draw on 0's, we also don't want to replace anything in the stencil buffer so we lock it up.
    glStencilFunc(GL_EQUAL,0x0,0x1);
    glStencilOp(GL_KEEP, GL_KEEP, GL_KEEP);
    //Finally draw the light into whatever's not shadow.
    DrawLight(View);
    glDisable(GL_STENCIL_TEST);
}
void FactionOper::RecvJoindNotifyMsg(CMessage* pMsg)
{
    // 族员结构
    tagFacMemInfo	stFacMemInfo;
    pMsg->GetEx( &stFacMemInfo, sizeof(stFacMemInfo) );
    CGUID           FactionGuid;
    pMsg->GetGUID( FactionGuid );

    // 添加一个族员
    CFacMember::SMemberInfo	stMemberInfo;
    stMemberInfo.guidFac = FactionGuid;
    stMemberInfo.guidMember = stFacMemInfo.MemberGuid;
    stMemberInfo.strName = stFacMemInfo.szName;
    stMemberInfo.strTitle = stFacMemInfo.szTitle;
    stMemberInfo.lLevel = stFacMemInfo.lLvl;
    stMemberInfo.lJob = stFacMemInfo.lJobLvl;
    stMemberInfo.lOccupation = stFacMemInfo.lOccu;
    stMemberInfo.lContribute = stFacMemInfo.lContribute;
    stMemberInfo.bOnline = stFacMemInfo.bIsOnline != 0;
    stMemberInfo.strRegion = stFacMemInfo.szRegion;

    
    m_pFactionManager->AddMyConfrere( &stMemberInfo );

    // 是否是自己
    if( GetGame()->GetMainPlayer()->GetExID() == stFacMemInfo.MemberGuid )
    {
        GetGame()->GetMainPlayer()->SetFactionID(FactionGuid);

        m_pFactionManager->SetMyJob( stFacMemInfo.lJobLvl );

        // "您已经加入家族: %s"
        TCHAR	szPrompt[ 1024 ];
        wsprintf( szPrompt, AppFrame::GetText("FA_308"), GetGame()->GetMainPlayer()->GetFactionName().c_str() );
        GetInst(MsgEventManager).PushEvent(Msg_Ok,szPrompt);
    }

    FireUIEvent("FactionPage","UpdateFacAppList");
}
Exemplo n.º 5
0
bool Ghost::IsMobGhost()
{
    static size_t mob_id = 0;
    static bool draw = true;
    if (!GetGame().GetMob())
    {
        return false;
    }
    if (mob_id != GetGame().GetMob().ret_id())
    {
        if (id_ptr_on<Ghost> g = GetGame().GetMob())
        {
            draw = true;
        }
        else
        {
            draw = false;
        }
        mob_id = GetGame().GetMob().ret_id();
    }
    return draw;
}
	virtual void Execute(const DataObject &)
	{
        // The current player is now in a blocking action.
        RULE.Execute(shRuleBeginBlockingAction, DataObject(current()));

		wxInt32 index = gameData<wxInt32>(shMasterMerchantVictim);
		const wxString& name = playerGame(index).player().Name();

		wxString str = wxString::Format(
			stSelectTwoCardsToStealFrom.c_str(), swStringFormat.c_str(), 
			name.c_str());
		wxString str2 = wxString::Format(
			stWaitingSelectTwoCardsToSteal.c_str(), 
            swStringFormat.c_str(), name.c_str());
		RULE.Execute(shRuleUpdateMessageUI, DataObject(str, str2));

		Controller::get().Transmit(shEventControlsUI, DataObject(false));
		Controller::get().Transmit(shEventBuildUI, 
				DataObject(false, GetGame()));

		Controller::get().Transmit(shEventMasterMerchantResource, GetGame());
	}
Exemplo n.º 7
0
//! 发送联系人数据到WS
void LinkmanSystem::SendDataToWs(void)
{
	CMessage msgToWs(MSG_S2W_LINKMAN_DATA);
	vector<BYTE> vLinkmanData;

	//! 先给玩家总数占个位置
	_AddToByteArray(&vLinkmanData, (LONG)0L);

	//! 实际发送人数统计
	LONG lNum = 0;
	map<CGUID, VecLinkmanGroup>::iterator ite = m_mapPlayerLinkman.begin();
	for (; ite != m_mapPlayerLinkman.end(); ++ite)
	{
		if(NULL == GetGame()->FindPlayer(ite->first))
		{
			if(NULL == GetGame()->FindSavePlayer(ite->first))
				continue;
		}

		++lNum;
		//! 玩家GUID
		_AddToByteArray(&vLinkmanData, ite->first);
		VecLinkmanGroup &vLinkmanGroup = ite->second;
		//! 联系人组数
		_AddToByteArray(&vLinkmanData, (LONG)vLinkmanGroup.size());
		for (LONG i = 0; i < (long)vLinkmanGroup.size(); ++i)
		{
			//! 联系人数据
			vLinkmanGroup[i].Serialize_ForWS(&vLinkmanData);
		}
	}

	//! 在编码中替换实际人数
	memcpy(&vLinkmanData[0], &lNum, sizeof(LONG));

	msgToWs.Add((LONG)vLinkmanData.size());
	msgToWs.AddEx(&vLinkmanData[0], (long)vLinkmanData.size());
	msgToWs.Send();
}	
Exemplo n.º 8
0
NTextInput::~NTextInput()
{
    glDeleteBuffers(2,Buffers);
    delete[] Buffers;
    if (Texture)
    {
        delete Texture;
    }
    if (HasFocus)
    {
        GetGame()->GetInput()->SetFocus(false);
    }
}
Exemplo n.º 9
0
double CScript::GetAttr(const char* CmdStr, char* retStr)
{
	OBJECT_TYPE type;
	CGUID id;
	double value   = 0;

	if(!GetSrcShape()) return -1.0f;

	int param = GetIntParam(CmdStr, 0);
	if(param != ERROR_CODE && param != INVILID_VALUE)
	{
		type = (OBJECT_TYPE)param;

		char* pIdName = GetStringParam(CmdStr, 1);
		if(!pIdName) return -1.0f;

		id = GetScriptGuidValue((CMoveShape*)GetSrcShape(), pIdName);

		char* name = GetStringParam(CmdStr, 2);
		if(!name)
		{
			M_FREE( pIdName, sizeof(char)*MAX_VAR_LEN );
			return -1.0f;
		}

		CMoveShape* shape = NULL;
		if(NULL_GUID == id) // 默认id=0时,直接调用SrcShape的SetAttr接口
		{
			shape = (CMoveShape*)GetSrcShape();
		}
		else
			shape = GetGame()->FindShape(type, id);

		if(shape)
		{
			long lRet = shape->GetAttribute(std::string(name));
			M_FREE( pIdName, sizeof(char)*MAX_VAR_LEN );
			M_FREE( name, sizeof(char)*MAX_VAR_LEN );
			return lRet;
		}
		
		M_FREE( pIdName, sizeof(char)*MAX_VAR_LEN );
		M_FREE( name, sizeof(char)*MAX_VAR_LEN );
	}
	else // 该参数是字符串
	{
		AddErrorLogText(CStringReading::LoadString(IDS_GS_FUNCTION, STR_GS_FUNCTION_SETATTRFIRSTVARISSTRING));
	}

	return 0.0f;
}
Exemplo n.º 10
0
void SaveCommand::Execute()
{
  ofstream saveFile;
  saveFile.open ("save.txt");
  
  saveFile << "#player "<<GetGame()->GetPlayer().GetName() << "\n";
  saveFile << GetGame()->GetPlayer().GetRace() << "\n";
  saveFile << GetGame()->GetPlayer().GetClass() << "\n";
  saveFile << GetGame()->GetPlayer().GetAge() << "\n";
  saveFile << GetGame()->GetPlayer().GetGender() << "\n";
  saveFile << GetGame()->GetPlayer().GetExperience() << "\n";
  saveFile << GetGame()->GetCurrentRoom()->GetID() << "\n";
  saveFile << GetGame()->GetPlayer().pMoney.GetAmount();
  
  //saveFile << enemy.IsAlive() << "\n";
  saveFile.close();
  
  GetGame()->GetRenderer()->Render("Saved\n");
}
Exemplo n.º 11
0
/*
****Takes the story choice the user made and adjust the game state appropriately.
*/
void ChapterMenu::ProcessChoice(unsigned int key)
{
Tools::Debug::Print("ChapterMenu::ProcessOptionKeyPress() - Story option selected.", Tools::Debug::PRIORITY::MID);
	
	/*	The values to change the player stats are stored in a vector. Since there are two values to retrieve for each choice
		(time lost and rest lost) we need to find which two values in the vector are the ones that correspond with the story 
		choice the user made.
		
		The values are stored sequentially from the results for the first option to the results for the last option. So if
		there are three options for the player to choose from, there are six values in the vector (0-5). These results are
		in pairs of two. The first being time lost and the second being rest lost. For example:
		
		Choosing option 1 would mean the values are at 0 and 1.
		Choosing option 2 would mean the values are at 2 and 3.
		Choosing option 3 would mean the values are at 4 and 5.
		
		I figured out a simple equation that will automatically find the vector index for the first value we need. After
		which we just increment by 1 to get the next value in the pair.
		
		firstValue = (choice - 1) + (choice - 1)
	*/

	// Find the vector indices we need.
	int timeLocation = (key - 1) + (key - 1);
	int restLocation = timeLocation + 1;

	// Grab the values in the vector AT the indices.
	short timeLost = chapter.GetStatChanges().at(timeLocation);
	short restLost = chapter.GetStatChanges().at(restLocation);

	// Subtract those values from the player's stats.
	GetGame().GetDM().RemoveTime(timeLost);
	GetGame().GetDM().RemoveRest(restLost);

	// Check if the game has ended due to stats dropping to zero.
	if (GetGame().GetDM().IsGameOver())
		GetGame().EndGame();
}
Exemplo n.º 12
0
void IRenderSystem::LoadShaders()
{
	if (GetGame()->GetGLSLVersion() >= GetGame()->GetMinGLSLVersion())
	{
		if (GetGame()->GetGLSLVersion() == GLSL_VERSION_330)
		{
			CShader* shader = new CShader("shaders/unlit.vs.glsl", "shaders/unlit.ps.glsl");
			m_Shaders["unlit"] = shader;

			shader = new CShader_GBuffer("shaders/gbuffer.vs.glsl", "shaders/gbuffer.ps.glsl");
			m_Shaders["gbuffer"] = shader;

			shader = new CShader_Deferred("shaders/deferred.vs.glsl", "shaders/deferred.ps.glsl");
			m_Shaders["deferred"] = shader;

			shader = new CShader_SSAO("shaders/ssao.vs.glsl", "shaders/ssao.ps.glsl");
			m_Shaders["ssao"] = shader;

			shader = new CShader_SSAO("shaders/ssao_blur.vs.glsl", "shaders/ssao_blur.ps.glsl");
			m_Shaders["ssao_blur"] = shader;

			m_PPChain.AddShader(m_Shaders["deferred"]);
			m_PPChain.AddShader(m_Shaders["ssao"]);
		}
		else if (GetGame()->GetGLSLVersion() == GLSL_VERSION_130)
		{
			CShader* shader = new CShader("shaders/1_30/unlit.vs.glsl", "shaders/1_30/unlit.ps.glsl");
			m_Shaders["unlit"] = shader;

			shader = new CShader_GBuffer("shaders/1_30/gbuffer.vs.glsl", "shaders/1_30/gbuffer.ps.glsl");
			m_Shaders["gbuffer"] = shader;

			shader = new CShader_Deferred("shaders/1_30/deferred.vs.glsl", "shaders/1_30/deferred.ps.glsl");
			m_Shaders["deferred"] = shader;

			shader = new CShader_SSAO("shaders/1_30/ssao.vs.glsl", "shaders/1_30/ssao.ps.glsl");
			m_Shaders["ssao"] = shader;

			shader = new CShader_SSAO("shaders/1_30/ssao_blur.vs.glsl", "shaders/1_30/ssao_blur.ps.glsl");
			m_Shaders["ssao_blur"] = shader;

			m_PPChain.AddShader(m_Shaders["deferred"]);
			m_PPChain.AddShader(m_Shaders["ssao"]);

		}

	}
	else
	{	
		std::ostringstream errorBuffer;
		errorBuffer << "Hardware requirements not met:\nMinimum GLSL Version: ";
		errorBuffer << GetGame()->GetMinGLSLVersion();
		errorBuffer << "\nDetected GLSL Version: ";
		errorBuffer << GetGame()->GetGLSLVersion();	

		log(LOG_TYPE_ERROR, errorBuffer.str());
	}
}
Exemplo n.º 13
0
void Script::ClearTeamRgnID(const CGUID& playerGuid)
{
	CPlayer* player = GetGame()->FindPlayer(playerGuid);
	if(player==NULL)
		return;


	GSTeam* team = GetOrganiCtrl()->GetGameTeamByID(player->GetTeamID());
	if(team==NULL)
		return;

	CPlayer* master = GetGame()->FindPlayer(team->GetLeader());
	if(NULL != master)
	{
		GameManager::GetInstance()->GetRgnManager()->ClearTeamRgnGUID(playerGuid);
	}
	else
	{
		CMessage msg(MSG_S2W_TEAM_ClearRgnID);
		msg.Add(team->GetLeader());
		msg.Send(false);
	}
}
Exemplo n.º 14
0
 void Status::Render()
 {
     Game& game = GetGame();
     Screen& screen = game.GetScreen();
     m_sprite->Render(screen, 4, 0);
     if (!game.GetSnake().IsAlive())
     {
         m_gameover->Render(screen, (screen.GetWidth() / 2) - (m_gameover->GetWidth() / 2), (screen.GetHeight() / 2) - (m_gameover->GetHeight() / 2));
     }
     else if (game.IsPaused())
     {
         m_pause->Render(screen, (screen.GetWidth() / 2) - (m_pause->GetWidth() / 2), (screen.GetHeight() / 2) - (m_pause->GetHeight() / 2));
     }
 }
Exemplo n.º 15
0
void CFixSummonAI::AI()
{
	if(GetRemainedTime() == 0)
	{
		StepEndAI();
		return;
	}
	else
	{
		if(FindEffect(m_vecSummonEffect[0]) == NULL)
		{
			CClientRegion *pRegion = GetGame()->GetRegion();
			float x = GetPosX();
			float y = GetPosY();
			float h = pRegion->GetCellHeight(x, y);
			AddEffect(m_vecSummonEffect[0], x, y, h, true);

			char strFile[MAX_PATH];
			sprintf(strFile, "sounds/skills/%d.wav", m_vecSummonSound[0]);
			GetGame()->GetAudioList()->Play(strFile, x, y, h);
		}
	}
}
Exemplo n.º 16
0
double CScript::GetPlayerAllVariables(const char* CmdStr, char* retStr)
{
	if(p_SrcShape == NULL) return 0;

	CHAR* szName = GetStringParam( CmdStr, 0 );
	if( szName )
	{
		CPlayer* pPlayer = GetGame() -> FindPlayer( szName );
		if( pPlayer )
		{
			//##找到该玩家
			CHAR szText[10240] = {0};
			ZeroMemory( szText, sizeof(szText) );

			CVariableList* pVarList = pPlayer->GetVariableList();

			if (pVarList)
			{
				CVariableList::varlistitr itr = pVarList->VarListBegin();

				for(; itr != pVarList->VarListEnd(); itr++)
				{
					// 简单变量
					if( itr->second->Array == 0 )
					{
						_snprintf(szText, 10240, "%s = %d", itr->first.c_str(), (int)(itr->second->Value));
						((CPlayer*)p_SrcShape) -> SendNotifyMessage( szText, 0xff00ff00, 0, eNOTIFYPOS_LEFT_BOTTOM );
					}
					else if( itr->second->Array > 0)	// 数组变量
					{
						for(int j = 0; j < itr->second->Array; j++)
						{
							_snprintf(szText, 10240, "%s[%d] = %d", itr->first.c_str(), j, itr->second->Value[j]);
							((CPlayer*)p_SrcShape) -> SendNotifyMessage( szText, 0xff00ff00, 0, eNOTIFYPOS_LEFT_BOTTOM );
						}
					}
					else
					{	//字符串变量
						_snprintf(szText, 10240, "%s = \"%s\"", itr->first.c_str(), itr->second->strValue);
						((CPlayer*)p_SrcShape) -> SendNotifyMessage( szText, 0xff00ff00, 0, eNOTIFYPOS_LEFT_BOTTOM );
					}
				}
			}
		}

		M_FREE( szName, sizeof(char)*MAX_VAR_LEN );
	}

	return 1;
}
Exemplo n.º 17
0
void CBounsDBManager::InitOperThread(std::string strProvider, 
									 std::string strDataSource, 
									 std::string strInitialCatalog, 
									 std::string strUserID, 
									 std::string strPassword)
{
	for(int i=0; i<GetGame()->GetSetup()->dwWorkerThreadNum; i++)
	{
		CBounsOperThread* pOperThread = new CBounsOperThread(strProvider, strDataSource, 
									strInitialCatalog,	strUserID, strPassword);
		m_mapOperThread[i] = pOperThread;
		pOperThread->Begin();
	}
}
Exemplo n.º 18
0
bool NNetwork::CreateClient()
{
    if (Client)
    {
        enet_host_destroy(Client);
    }
    Client = enet_host_create(NULL,1,2,0,0);
    if (!Client)
    {
        GetGame()->GetLog()->Send("NETWORK",0,"Failed to create client!");
        return 1;
    }
    return 0;
}
Exemplo n.º 19
0
//! 解散
void GameFaction::Disband(void)
{
	map<CGUID, tagFacMemInfo>::iterator ite = m_mapMemInfo.begin();
	for ( ; ite != m_mapMemInfo.end(); ++ite)
	{
		CPlayer *pPlayer = GetGame()->FindPlayer(ite->first);
		if (NULL != pPlayer)
		{
			pPlayer->SetFactionID(NULL_GUID);
			pPlayer->SetUnionID(NULL_GUID);
			pPlayer->SetFacMemInfo(NULL);
		}
	}
}
Exemplo n.º 20
0
void NTexture::Play(std::string i_Name)
{
    for (unsigned int i=0;i<Animations.size();i++)
    {
        if (i_Name == Animations[i]->GetName())
        {
            PlayingAnimation = i;
            if (ResetOnPlay)
                CurrentTime = 0;
            return;
        }
    }
    GetGame()->GetLog()->Send("TEXTURE",1,"Animation " + i_Name + " not found in texture " + Name + ".");
}
Exemplo n.º 21
0
void  COpGenius::Execute(CMoveShape* pShape)
{
#ifdef _RUNSTACKINFO1_
    CMessage::AsyWriteFile(GetGame()->GetStatckFileName(), "COpGenius::Execute() begin");
#endif
    if( !pShape )
        return ;
    if( m_pParam->SendGeniusList.find(pShape->GetExID()) != m_pParam->SendGeniusList.end() )
        return ;

    m_pParam->SendGeniusList.insert( pShape->GetExID() );

    long  nId = 0 ;
    if ( m_strGenius!="" )
    {
        nId = atol(m_strGenius.c_str());
    }
    m_pParam->pFirer->AddGeniusStates( m_pParam->nID , pShape ,nId );

#ifdef _RUNSTACKINFO1_
    CMessage::AsyWriteFile(GetGame()->GetStatckFileName(), "COpGenius::Execute() end");
#endif
}
Exemplo n.º 22
0
void Script::CreatePHGoods(const CGUID& ownerGuid, const char* name, int counts, 
						   int x, int y, int width, int height, int dir, 
						   const char* script, const char* talk)
{
	if(name==NULL || script==NULL || talk==NULL) 
		return;

	CPlayer* player = GetGame()->FindPlayer(ownerGuid);
	if(player==NULL)
		return;

	CGUID regionGuid = player->GetPersonalHouseRgnGUID();
	CRgnManager::RgnByIDMapItr it = GameManager::GetInstance()->GetRgnManager()->GetPersonalHouseDupRgnMap().find(regionGuid);
	if(it != GameManager::GetInstance()->GetRgnManager()->GetPersonalHouseDupRgnMap().end())
	{
		CServerRegion* region = it->second;
		if(region) // 本地服务器
			GameManager::GetInstance()->GetRgnManager()->CreatePHGoods(regionGuid, name, counts, 
			x, y, width, height, dir, 
			script, talk);
	}
	else
	{
		// 发送消息到WS,由WS在其它GS上创建Goods
		//##发送消息给World Server,发送后不管
		CMessage msg(MSG_S2W_SERVER_CREATEPHGOODS);
		msg.Add((BYTE)0);
		CGUID guid;
		CGUID::CreateGUID(guid);	
		msg.Add(guid);
		msg.Add(ownerGuid);
		msg.Add(name);
		msg.Add((long)counts);
		msg.Add((long)width);
		msg.Add((long)height);			
		msg.Add((long)x);
		msg.Add((long)y);
		msg.Add ((long)-1);
		if(script)
		{
			msg.Add(BYTE(1));
			msg.Add(script);
		}
		else 
		{
			msg.Add(BYTE(0));
		}					
		msg.Send();
	}
}
Exemplo n.º 23
0
bool NFace::Load(std::string File)
{
    FT_Library FTLib = GetGame()->GetTextSystem()->GetFreeTypeLib();
    if (!FTLib)
    {
        return 1;
    }
    NReadFile MyFile = GetGame()->GetFileSystem()->GetReadFile(File);
    if (!MyFile.Good())
    {
        GetGame()->GetLog()->Send("FREETYPE",1,"Failed to load " + File + ", it doesn't exist!");
        return 1;
    }
    FileData = new char[MyFile.Size()];
    MyFile.Read(FileData,MyFile.Size());
    if (FT_New_Memory_Face(FTLib,(const unsigned char*)FileData,MyFile.Size(),0,&Face))
    {
        delete[] FileData;
        GetGame()->GetLog()->Send("FREETYPE",1,"Failed to load " + File + " as a font, it's either corrupt or not a FreeType-compatible format!");
        return 1;
    }
    return 0;
}
Exemplo n.º 24
0
//目标执行一个脚本
double CScript::DesRunScript(const char* cmd, char* retStr)
{
	char * cScriptName= GetStringParam(cmd,0);
	if (cScriptName== NULL)	return -1;

	stRunScript st;
	st.pszFileName = cScriptName;
	st.srcShape = p_DesShape;
	st.pRegion = (CRegion*)(p_SrcShape->GetFather());
	st.desShape = NULL;
	RunScript(&st, (char*)GetGame()->GetScriptFileData(cScriptName));
	M_FREE( cScriptName, sizeof(char)*MAX_VAR_LEN );
	return 0;
}
Exemplo n.º 25
0
//通过脚本发送系统邮件
void	CMailManager::SendSysMailByScript(CMail *pMail)
{
	if (pMail)
	{
		list<string>::iterator it = pMail->GetReceiverList().begin();
		CPlayer *pPlayer=GetGame()->FindPlayer((*it).c_str());
		pMail->AddGoodsToContainerBySys();
		pMail->SetReject(0);
		SendMailToWS(pMail);
		pMail->DeleteMailGoods();
		MP_DELETE(pMail);

	}	
}
Exemplo n.º 26
0
//--------------------------------------------------------------------------
Widget ScriptConsoleRenamePresetDialog::Init()
{
	Widget layoutRoot = CreateWidgets("gui/layouts/script_console_dialog_preset.layout", NULL);
	m_Editbox = layoutRoot.FindAnyWidget("PrimaryEditBox");
	m_Label = layoutRoot.FindAnyWidget("WindowLabel");
	m_Message = layoutRoot.FindAnyWidget("MessageText");

	MissionBase mission = GetGame().GetMission();
	m_Editbox.SetText( mission.m_scriptConsole.GetCurrentPresetName() );
	m_Label.SetText("RENAME PRESET");
	m_Message.SetText( mission.m_scriptConsole.GetCurrentPresetName() );

	return layoutRoot;
}
Exemplo n.º 27
0
bool NNetwork::PollEvent(ENetEvent* Event)
{
    if (!Server && !Client)
    {
        return false;
    }
    if (Server && Client)
    {
        GetGame()->GetLog()->Send("NETWORK",1,"We have a server and client running on the same host! Assuming we're a server...");
        enet_host_destroy(Client);
        Client = NULL;
    }

    if (Server)
    {
        int Check = enet_host_service(Server,Event,0);
        if (Check > 0)
        {
            return true;
        }
        if (Check < 0)
        {
            GetGame()->GetLog()->Send("NETWORK",0,"Failed to poll for events!");
        }
        return false;
    }
    int Check = enet_host_service(Client,Event,0);
    if (Check > 0)
    {
        return true;
    }
    if (Check < 0)
    {
        GetGame()->GetLog()->Send("NETWORK",0,"Failed to poll for events!");
    }
    return false;
}
Exemplo n.º 28
0
//! 响应客户端断开连接
VOID LoginManager::OnClientNetClose(const char *pCdKey, BOOL bInWs)
{
	assert(NULL != pCdKey);
	m_cqueueValidatingCdKey.erase(string(pCdKey));
	m_mapLSSecurityData.erase(string(pCdKey));

#ifdef _OUT_LOGIN_FLOW_INFO_
	if(m_cqueuePassedAccount.find(pCdKey))
		AddLogText("响应客户端[%s]断开,从已通过验证的队列中清除该客户端", pCdKey);
#endif
	m_cqueuePassedAccount.erase(string(pCdKey));

	map<LONG, WaitInWsQueue>::iterator iteWS = m_mapAllWaitInWsQueue.begin();
	for (; iteWS != m_mapAllWaitInWsQueue.end(); ++iteWS)
		iteWS->second.erase(string(pCdKey));

	map<LONG, QueueWsCanInGamePlayer>::iterator iteC = m_mapCanInGamePlayer.begin();
	for (; iteC != m_mapCanInGamePlayer.end(); ++iteC)
		iteC->second.erase(string(pCdKey));

	if(!bInWs)
	{
		if(GetGame()->UseAsFcm())
		{
			DelFcmCdkey(pCdKey);

			CMessage msg(MSG_O2A_ACCOUNT_Logout);
			msg.Add(pCdKey);
			msg.SendToAS();

		}
		else
		{
			GetGame()->GetCSdoaFcm().UserOffline(pCdKey);
		}
	}
}
Exemplo n.º 29
0
	static void SavePlayerGoodsData( CPlayer *pPlayer )
	{
		GetGame()->UpdateSavePlayer( pPlayer, SAVE_DETAIL_ATTRPACKGOODS );										
		GetGame()->UpdateSavePlayer( pPlayer, SAVE_DETAIL_ATTRSUBPACKGOODS1 );					
		GetGame()->UpdateSavePlayer( pPlayer, SAVE_DETAIL_ATTRSUBPACKGOODS2 );						
		GetGame()->UpdateSavePlayer( pPlayer, SAVE_DETAIL_ATTRSUBPACKGOODS3 );					
		GetGame()->UpdateSavePlayer( pPlayer, SAVE_DETAIL_ATTRSUBPACKGOODS4 );					
		GetGame()->UpdateSavePlayer( pPlayer, SAVE_DETAIL_ATTRSUBPACKGOODS5 );
	}
Exemplo n.º 30
0
/*
*功能: 接收 创建联盟协议
*细节描述: 
*参数: pMsg	协议结构
*返回值: 无
*修改时间:2008-4-16
*/
void	CUnionManager::RecvCreationMsg( CMessage* pMsg )
{
	// 检测 成功失败
	if( PLAYER_OPT_SUCCEED == pMsg->GetLong() )
	{
		// "联盟创建成功!"
		/*GetGame()->GetCGuiEx()->GetMessageBoxPageEx()->m_lCallerID = -1;
		GetGame()->GetCGuiEx()->GetMessageBoxPageEx()->Open( GetGame()->GetCGuiEx()->GetFactionPageEx(), "联盟创建成功!", CMessageBoxPageEx::MSG_OK, true );*/
        GetGame()->GetAudioList()->Play2DSound("SOUNDS\\interfaces\\i-19.wav"); 
	}
	else
	{
		// 处理错误
	}
}