home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Revista CD Expert 51
/
PCGamer51_17Demos.iso
/
games
/
CM
/
CyclingManagerDemoCangas.exe
/
CyclingManagerDemo
/
scripts
/
team
/
roster
/
page_team_roster.cnc
< prev
next >
Wrap
Text File
|
2001-07-09
|
47KB
|
1,253 lines
//----------------------------------------------------------------------------------------------------------------//
//----------------------------------------------------------------------------------------------------------------//
// return true if roster can be edited
//----------------------------------------------------------------------------------------------------------------//
//----------------------------------------------------------------------------------------------------------------//
func i32x bRoster_CanBeEdited()
{
var i32x bTest;
bTest = true;
if(oObject_TeamListbox.m_iSelectedTeamID != g_oUser.m_iMyTeamID)
bTest = false;
if(g_oGameConfig.m_iPhaseID != G_iPhase_Management)
bTest = false;
if(g_oGameConfig.m_iGameMode != GAME_MODE_STAGE)
{
if(Page_Team_Roster_GetCurrentStageNumber() != 1)
bTest = false;
}
return bTest;
}
//----------------------------------------------------------------------------------------------------------------//
//----------------------------------------------------------------------------------------------------------------//
// Refresh racing team panel
//----------------------------------------------------------------------------------------------------------------//
//----------------------------------------------------------------------------------------------------------------//
func void DisplayPull ()
{
var component pOldParserComponent;
// Get Current Context
pOldParserComponent=GetParserComponent();
// Set page Roaster context
SetParserComponent(oPage_Team_Roaster.pComponent);
// MistER-j test
PushEventOnChild(oPage_Team_Roaster.iPanelRacingTeamID,GUI_COMPONENT_REFRESH);
// show add & remove buttons if we are displaying our team
if (bRoster_CanBeEdited())
{
SetComponentEnableStatus(oPage_Team_Roaster.iSelectID,true);
SetComponentEnableStatus(oPage_Team_Roaster.iRemoveID,true);
}
else
{
SetComponentEnableStatus(oPage_Team_Roaster.iSelectID,false);
SetComponentEnableStatus(oPage_Team_Roaster.iRemoveID,false);
}
// restore old parser component
SetParserComponent(pOldParserComponent);
}
//----------------------------------------------------------------------------------------------------------------//
//----------------------------------------------------------------------------------------------------------------//
// Add a cyclist in the racing team (check if cyclist is already present...)
//----------------------------------------------------------------------------------------------------------------//
//----------------------------------------------------------------------------------------------------------------//
func void Page_Team_Roster_AddPullCyclist (i32x _iCyclistID)
{
var i32x iLoop,iFreeSlot;
var boolx bTest;
if (bRoster_CanBeEdited())
{
iFreeSlot = -1;
bTest = true;
iLoop = 8;
while (iLoop>=0)
{
if (oPage_Team_Roaster.iCyclistsPull[iLoop]==_iCyclistID)
bTest = false;
if(oPage_Team_Roaster.iCyclistsPull[iLoop] == -1)
{
// Found free slot
iFreeSlot = iLoop;
}
iLoop=iLoop-1;
}
if((bTest)&&(iFreeSlot>=0))
{
oPage_Team_Roaster.iCyclistsPull[iFreeSlot] = _iCyclistID;
oPage_Team_Roaster.iNbCyclistsInPull = oPage_Team_Roaster.iNbCyclistsInPull + 1;
// Update pull display
DisplayPull();
}
}
}
//----------------------------------------------------------------------------------------------------------------//
//----------------------------------------------------------------------------------------------------------------//
// Remove a cyclist from the racing team and defrag the pull
//----------------------------------------------------------------------------------------------------------------//
//----------------------------------------------------------------------------------------------------------------//
func void Page_Team_Roster_RemovePullCyclist (i32x _iCyclistID)
{
// defrag the pull
var i32x iLoop,iNextCyclistID,iSlot;
if (bRoster_CanBeEdited())
{
// Find the slot to free
iSlot = -1;
iLoop = 0;
while (iLoop < 9)
{
if(oPage_Team_Roaster.iCyclistsPull[iLoop] == _iCyclistID)
{
// Remove this cyclist
iSlot = iLoop;
oPage_Team_Roaster.iCyclistsPull[iLoop] = -1;
// set new nb cyclists in pull
oPage_Team_Roaster.iNbCyclistsInPull = oPage_Team_Roaster.iNbCyclistsInPull - 1;
// break loop
iLoop = 8;
}
iLoop=iLoop+1;
}
if(iSlot>=0)
{
// Defrag the pull
iLoop = iSlot;
while (iLoop < 9)
{
if(iLoop < 8)
iNextCyclistID = oPage_Team_Roaster.iCyclistsPull[iLoop+1];
else
iNextCyclistID = -1;
oPage_Team_Roaster.iCyclistsPull[iLoop] = iNextCyclistID;
iLoop=iLoop+1;
}
// Update display
DisplayPull();
}
}
}
//----------------------------------------------------------------------------------------------------------------//
//----------------------------------------------------------------------------------------------------------------//
//
//----------------------------------------------------------------------------------------------------------------//
//----------------------------------------------------------------------------------------------------------------//
func void Page_Team_Roaster_SaveRacingTeam ()
{
if ((g_oUser.m_iUserMode!=G_iGuestUser)&&
(g_oGameConfig.m_iPhaseID==G_iPhase_Management)&&
( (Page_Team_Roster_GetCurrentStageNumber()==1)||
(g_oGameConfig.m_iGameMode == GAME_MODE_STAGE) ) )
{
// get our team id
var i32x iCyclistIndex,i,iNumRegisters,iNumCyclists,iStartIndex;
var i32x iTeamID,iCyclistID,bRegistered,iFreeSlot;
iTeamID=g_oUser.m_iMyTeamID;
// Clear the Subset
DatabaseSubset_Clear(TEMP_DATABASE);
// create query to fill the cyclist of team subset
Query_Create(0, TEMP_DATABASE);
Query_SetNumJoinTables( 0, 1);
Query_SelectJoinTable( 0, 0, "DYN_cyclist");
Query_SelectWhereIntEqual(0, "DYN_cyclist.fkIDteam", iTeamID);
Query_Execute(0);
// Check each slot to have nine cyclists in roster
iNumCyclists = Join_GetNumRows(oPage_Team_Roaster.m_jCyclistID);
iNumRegisters = 0;
iCyclistIndex=0;
while(iCyclistIndex<9)
{
if(oPage_Team_Roaster.iCyclistsPull[iCyclistIndex] <= 0)
{
// Free slot : register cyclist
iNumRegisters = iNumRegisters + 1;
}
iCyclistIndex=iCyclistIndex+1;
}
//print("NumRegiter :");println(itoa(iNumRegisters));
// Register cyclist
i=0;
while((iNumRegisters>0)&&(i<iNumCyclists))
{
iCyclistID = Join_GetIntFromIndex(oPage_Team_Roaster.m_jCyclistID,i);
// Check if cyclist already registered
bRegistered = false;
iCyclistIndex = 0;
iFreeSlot = -1;
while(iCyclistIndex<9)
{
if(oPage_Team_Roaster.iCyclistsPull[iCyclistIndex] == iCyclistID)
bRegistered = true;
else if(oPage_Team_Roaster.iCyclistsPull[iCyclistIndex] <= 0)
iFreeSlot = iCyclistIndex;
iCyclistIndex=iCyclistIndex+1;
}
if(bRegistered == false)
{
if(iFreeSlot>=0)
{
//print("RegisterCyclist :");println(itoa(iCyclistID));
// Register it
oPage_Team_Roaster.iCyclistsPull[iFreeSlot] = iCyclistID;
}
iNumRegisters = iNumRegisters - 1;
}
i=i+1;
}
// update local database
iCyclistIndex=0;
while(iCyclistIndex<9)
{
Join_SetIntFromKey(oPage_Team_Roaster.m_jRacingCyclist[iCyclistIndex],iTeamID,oPage_Team_Roaster.iCyclistsPull[iCyclistIndex]);
iCyclistIndex=iCyclistIndex+1;
}
// send update to server
g_oMenuServer.m_oServer << mSetRacingTeam(
oPage_Team_Roaster.iCyclistsPull[0],
oPage_Team_Roaster.iCyclistsPull[1],
oPage_Team_Roaster.iCyclistsPull[2],
oPage_Team_Roaster.iCyclistsPull[3],
oPage_Team_Roaster.iCyclistsPull[4],
oPage_Team_Roaster.iCyclistsPull[5],
oPage_Team_Roaster.iCyclistsPull[6],
oPage_Team_Roaster.iCyclistsPull[7],
oPage_Team_Roaster.iCyclistsPull[8]
);
}
}
//----------------------------------------------------------------------------------------------------------------//
//----------------------------------------------------------------------------------------------------------------//
// Page Team Roster Destructor
//----------------------------------------------------------------------------------------------------------------//
//----------------------------------------------------------------------------------------------------------------//
func void Page_Team_Roaster_Destructor ()
{
Reset_Tool_Bar_Text();
if(oPage_Team_Roaster.bDataReceived)
{
// save current team if needed
if(oObject_TeamListbox.m_iSelectedTeamID==g_oUser.m_iMyTeamID)
{
// keep current parser component
var component pComponent;
pComponent=GetParserComponent();
// call save func in Page_Team_Roaster context
SetParserComponent(oPage_Team_Roaster.pComponent);
// save current racing team
Page_Team_Roaster_SaveRacingTeam();
// restore old parser component
SetParserComponent(pComponent);
}
}
// Destroy page global join
vPage_Team_Roaster_DestroyJoins();
// delete the page
DeleteComponent(oPage_Team_Roaster.iWindowID);
}
// Destroy page global join
//----------------------------------------------------------------------------------------------------------------//
func void vPage_Team_Roaster_DestroyJoins()
{
var i32x i;
if(oPage_Team_Roaster.m_jCyclistID != 0)
{
Join_Destructor(oPage_Team_Roaster.m_jCyclistID);
oPage_Team_Roaster.m_jCyclistID = 0;
}
if(oPage_Team_Roaster.m_jCyclistFirstName != 0)
{
Join_Destructor(oPage_Team_Roaster.m_jCyclistFirstName);
oPage_Team_Roaster.m_jCyclistFirstName = 0;
}
if(oPage_Team_Roaster.m_jCyclistLastName != 0)
{
Join_Destructor(oPage_Team_Roaster.m_jCyclistLastName);
oPage_Team_Roaster.m_jCyclistLastName = 0;
}
if(oPage_Team_Roaster.m_jCyclistAge != 0)
{
Join_Destructor(oPage_Team_Roaster.m_jCyclistAge);
oPage_Team_Roaster.m_jCyclistAge = 0;
}
if(oPage_Team_Roaster.m_jCyclistRiding != 0)
{
Join_Destructor(oPage_Team_Roaster.m_jCyclistRiding);
oPage_Team_Roaster.m_jCyclistRiding = 0;
}
if(oPage_Team_Roaster.m_jCyclistClimbing != 0)
{
Join_Destructor(oPage_Team_Roaster.m_jCyclistClimbing);
oPage_Team_Roaster.m_jCyclistClimbing = 0;
}
if(oPage_Team_Roaster.m_jCyclistDownhill != 0)
{
Join_Destructor(oPage_Team_Roaster.m_jCyclistDownhill);
oPage_Team_Roaster.m_jCyclistDownhill = 0;
}
if(oPage_Team_Roaster.m_jCyclistSprint != 0)
{
Join_Destructor(oPage_Team_Roaster.m_jCyclistSprint);
oPage_Team_Roaster.m_jCyclistSprint = 0;
}
if(oPage_Team_Roaster.m_jCyclistEndurance != 0)
{
Join_Destructor(oPage_Team_Roaster.m_jCyclistEndurance);
oPage_Team_Roaster.m_jCyclistEndurance = 0;
}
if(oPage_Team_Roaster.m_jCyclistRecuperation != 0)
{
Join_Destructor(oPage_Team_Roaster.m_jCyclistRecuperation);
oPage_Team_Roaster.m_jCyclistRecuperation = 0;
}
if(oPage_Team_Roaster.m_jCyclistAcceleration != 0)
{
Join_Destructor(oPage_Team_Roaster.m_jCyclistAcceleration);
oPage_Team_Roaster.m_jCyclistAcceleration = 0;
}
if(oPage_Team_Roaster.m_jCyclistAgility != 0)
{
Join_Destructor(oPage_Team_Roaster.m_jCyclistAgility);
oPage_Team_Roaster.m_jCyclistAgility = 0;
}
if(oPage_Team_Roaster.m_jCyclistIntelligence != 0)
{
Join_Destructor(oPage_Team_Roaster.m_jCyclistIntelligence);
oPage_Team_Roaster.m_jCyclistIntelligence = 0;
}
if(oPage_Team_Roaster.m_jCyclistDiscipline != 0)
{
Join_Destructor(oPage_Team_Roaster.m_jCyclistDiscipline);
oPage_Team_Roaster.m_jCyclistDiscipline = 0;
}
if(oPage_Team_Roaster.m_jCyclistFitness != 0)
{
Join_Destructor(oPage_Team_Roaster.m_jCyclistFitness);
oPage_Team_Roaster.m_jCyclistFitness = 0;
}
if(oPage_Team_Roaster.m_jCyclistRating != 0)
{
Join_Destructor(oPage_Team_Roaster.m_jCyclistRating);
oPage_Team_Roaster.m_jCyclistRating = 0;
}
// Delete old racing team join if exist (should not :) )
i=0;
while(i<9)
{
if(oPage_Team_Roaster.m_jRacingCyclist[i] != 0)
{
Join_Destructor(oPage_Team_Roaster.m_jRacingCyclist[i]);
oPage_Team_Roaster.m_jRacingCyclist[i] = 0;
}
i=i+1;
}
}
func szx szGetColumnNameFromIndex(i32x _iColumnIndex)
{
var szx szColumnName;
// Select sorted column
szColumnName="gene_sz_lastname"; // Name by default
// if (oPage_Team_Roaster.iSortedComponent==oPage_Team_Roaster.iColumnTitleID[0])
// szColumnName="gene_sz_name";
if (_iColumnIndex==oPage_Team_Roaster.iColumnTitleID[1])
szColumnName="gene_i_age";
else if (_iColumnIndex==oPage_Team_Roaster.iColumnTitleID[2])
szColumnName="gene_i_rating";
else if (_iColumnIndex==oPage_Team_Roaster.iColumnTitleID[3])
szColumnName="carac_f_riding";
else if (_iColumnIndex==oPage_Team_Roaster.iColumnTitleID[4])
szColumnName="carac_f_climbing";
else if (_iColumnIndex==oPage_Team_Roaster.iColumnTitleID[5])
szColumnName="carac_f_downhill";
else if (_iColumnIndex==oPage_Team_Roaster.iColumnTitleID[6])
szColumnName="carac_f_sprint";
else if (_iColumnIndex==oPage_Team_Roaster.iColumnTitleID[7])
szColumnName="carac_f_endurance";
else if (_iColumnIndex==oPage_Team_Roaster.iColumnTitleID[8])
szColumnName="carac_f_recuperation";
else if (_iColumnIndex==oPage_Team_Roaster.iColumnTitleID[9])
szColumnName="carac_f_acceleration";
else if (_iColumnIndex==oPage_Team_Roaster.iColumnTitleID[10])
szColumnName="carac_f_agility";
else if (_iColumnIndex==oPage_Team_Roaster.iColumnTitleID[11])
szColumnName="carac_f_intelligence";
else if (_iColumnIndex==oPage_Team_Roaster.iColumnTitleID[12])
szColumnName="carac_f_discipline";
else if (_iColumnIndex==oPage_Team_Roaster.iColumnTitleID[13])
szColumnName="fkIDgame_menu_fitness";
return szColumnName;
}
func szx szGetLocalizedCaracNameFromIndex(i32x _iColumnIndex)
{
var szx szColumnName;
if (_iColumnIndex==oPage_Team_Roaster.iColumnTitleID[0])
szColumnName = GetLocalizedFromGMKey(65); // name
else if (_iColumnIndex==oPage_Team_Roaster.iColumnTitleID[1])
szColumnName = GetLocalizedFromGMKey(31); // age
else if (_iColumnIndex==oPage_Team_Roaster.iColumnTitleID[2])
szColumnName = GetLocalizedFromGMKey(33); //rating
else if (_iColumnIndex==oPage_Team_Roaster.iColumnTitleID[3])
szColumnName = GetLocalizedFromGMKey(98); // riding
else if (_iColumnIndex==oPage_Team_Roaster.iColumnTitleID[4])
szColumnName = GetLocalizedFromGMKey(99); // climbing
else if (_iColumnIndex==oPage_Team_Roaster.iColumnTitleID[5])
szColumnName=GetLocalizedFromGMKey(100); // downhill
else if (_iColumnIndex==oPage_Team_Roaster.iColumnTitleID[6])
szColumnName = GetLocalizedFromGMKey(101); // sprint
else if (_iColumnIndex==oPage_Team_Roaster.iColumnTitleID[7])
szColumnName = GetLocalizedFromGMKey(102); // endurance
else if (_iColumnIndex==oPage_Team_Roaster.iColumnTitleID[8])
szColumnName = GetLocalizedFromGMKey(104); // recup
else if (_iColumnIndex==oPage_Team_Roaster.iColumnTitleID[9])
szColumnName = GetLocalizedFromGMKey(106); // acceleration
else if (_iColumnIndex==oPage_Team_Roaster.iColumnTitleID[10])
szColumnName = GetLocalizedFromGMKey(105); // agility
else if (_iColumnIndex==oPage_Team_Roaster.iColumnTitleID[11])
szColumnName = GetLocalizedFromGMKey(103); // intelligence
else if (_iColumnIndex==oPage_Team_Roaster.iColumnTitleID[12])
szColumnName = GetLocalizedFromGMKey(107); // discipline
else if (_iColumnIndex==oPage_Team_Roaster.iColumnTitleID[13])
szColumnName = GetLocalizedFromGMKey(127); // fitness
return szColumnName;
}
func void vUpdateRoasterSubset()
{
// Clear the Subset
DatabaseSubset_Clear(TEMP_DATABASE);
// create query to fill the cyclist of team subset
Query_Create(0, TEMP_DATABASE);
Query_SetNumJoinTables( 0, 1);
Query_SelectJoinTable( 0, 0, "DYN_cyclist");
Query_SelectWhereIntEqual(0, "DYN_cyclist.fkIDteam", oObject_TeamListbox.m_iSelectedTeamID);
Query_Execute(0);
// Sort subset
vSortRoasterSubset();
}
func void vSortRoasterSubset()
{
Table_Sort(TEMP_DATABASE,"DYN_cyclist",szGetColumnNameFromIndex(oPage_Team_Roaster.iSortedComponent),oPage_Team_Roaster.iSortDirection);
}
//----------------------------------------------------------------------------------------------------------------//
//----------------------------------------------------------------------------------------------------------------//
// Page Team Roster Create
//----------------------------------------------------------------------------------------------------------------//
//----------------------------------------------------------------------------------------------------------------//
func void Page_Team_Roaster_Create ()
{
oPage_Team_Roaster.pThis = GetParserComponent();
oPage_Team_Roaster.bDataReceived = false;
oPage_Team_Roaster.iCurrentStageNumber = Page_Team_Roster_GetCurrentStageNumber();
// MistER-j antibug
oPage_Team_Roaster.iSelectedDivisionID = 1;
var i32x iLoop;
var i32x iID;
// *** Update Title Bar ***
Set_Title_Bar_Text(GetLocalizedFromGMKey(151)); // page title
// init pull
iLoop = 0;
while (iLoop<9)
{
oPage_Team_Roaster.iCyclistsPull[iLoop] = -1;
iLoop=iLoop+1;
}
oPage_Team_Roaster.iNbCyclistsInPull=0;
// Get Page context
oPage_Team_Roaster.pComponent=GetParserComponent();
// list component not initialized
oPage_Team_Roaster.iCyclistListID = ID_NOT_CREATED;
// Page component number
SetComponentNumber(65);
// Init page global join
vPage_Team_Roaster_DestroyJoins();
// Page Background
iID = Init_LibObject_FilledCadre(tCadreDialbox,700,550);
SetEvents(iID,0);
// Guest or registered user ?
Table_Sort(QUERY_GLOBAL_TEAMS,"DYN_team","gene_sz_name",1);
if(g_oUser.m_iUserMode == G_iRegisteredUser)
{
// first display current team
oObject_TeamListbox.m_iSelectedTeamID = g_oUser.m_iMyTeamID;
oPage_Team_Roaster.m_cSubscribe = ID_NOT_CREATED;
// Don't Create unsubscribe button
oPage_Team_Roaster.m_cUnsubscribe = ID_NOT_CREATED;
//oPage_Team_Roaster.m_cUnsubscribe = InitLibMultiSpriteButtonWithText(tButton32Multi,5,GetLocalizedFromGMKey(158),tFontArial,1274);
//SetComponentPosition(oPage_Team_Roaster.m_cUnsubscribe,350,35);
}
else if(g_oUser.m_iUserMode == G_iGuestUser)
{
// Guest user
// Display the first team g_oMenuJoins
oObject_TeamListbox.m_iSelectedTeamID = Join_GetIntFromSortedIndex(g_oMenuJoins.m_iTeamID,0);
oPage_Team_Roaster.m_cSubscribe = InitLibMultiSpriteButtonWithText(tButton32Multi,5,GetLocalizedFromGMKey(156),tFontArial,1273);
oPage_Team_Roaster.m_cUnsubscribe = ID_NOT_CREATED;
// Hide this button by default
SetComponentVisibleStatus(oPage_Team_Roaster.m_cSubscribe,0);
SetComponentPosition(oPage_Team_Roaster.m_cSubscribe,350,35);
}
// panel racing team
Panel_Team_Roster_RacingTeam_InitMembers();
iID = InitObject(
oPanel_Team_Roster_RacingTeam.szName,
oPanel_Team_Roster_RacingTeam.oFunc.pcreate,
oPanel_Team_Roster_RacingTeam.oFunc.pevent
);
SetComponentPosition(iID,10,75);
oPage_Team_Roaster.iPanelRacingTeamID = iID;
// Page_Team_Roster_Create_List();
// buttons to edit pull
oPage_Team_Roaster.iSelectID = InitButton(tButtonUpRoaster);
SetContainerStateFunc(oPage_Team_Roaster.iSelectID, ButtonState);
SetComponentPosition(oPage_Team_Roaster.iSelectID,625-(2*GetComponentWidth(oPage_Team_Roaster.iSelectID)),35);
oPage_Team_Roaster.iRemoveID = InitButton(tButtonDownRoaster);
SetContainerStateFunc(oPage_Team_Roaster.iRemoveID, ButtonState);
SetComponentPosition(oPage_Team_Roaster.iRemoveID,635-GetComponentWidth(oPage_Team_Roaster.iRemoveID),35);
// display team list box
Object_Roster_Team_Listbox_InitMembers(QUERY_GLOBAL_TEAMS);
oPage_Team_Roaster.m_cTeamListBox = InitObject(
oObject_TeamListbox.m_szName, // Object name
oObject_TeamListbox.oFunc.pcreate, // Object create func
oObject_TeamListbox.oFunc.pevent); // Object event func
SetComponentPosition(oPage_Team_Roaster.m_cTeamListBox,15,35);
UpdateSubscribe();
AutoResize();
}
func void Page_Team_Roster_Create_List()
{
var component pComponent;
pComponent = GetParserComponent();
SetParserComponent(oPage_Team_Roaster.pThis);
var i32x iID, iLoop;
// Create a subset to be filled by cyclists of team...
DatabaseSubset_Create( TEMP_DATABASE, QUERY_GLOBAL_CYCLISTS);
Database_AddTables( TEMP_DATABASE, 1);
Table_SetName( TEMP_DATABASE, 0, "DYN_cyclist");
TableSubset_SelectColumns( TEMP_DATABASE, 0, "*");
// Create page global join on this
oPage_Team_Roaster.m_jCyclistID = Join_Constructor(TEMP_DATABASE,"DYN_cyclist.IDcyclist");
oPage_Team_Roaster.m_jCyclistFirstName = Join_Constructor(TEMP_DATABASE,"DYN_cyclist.gene_sz_firstname");
oPage_Team_Roaster.m_jCyclistLastName = Join_Constructor(TEMP_DATABASE,"DYN_cyclist.gene_sz_lastname");
oPage_Team_Roaster.m_jCyclistAge = Join_Constructor(TEMP_DATABASE,"DYN_cyclist.gene_i_age");
oPage_Team_Roaster.m_jCyclistRiding = Join_Constructor(TEMP_DATABASE,"DYN_cyclist.carac_f_riding");
oPage_Team_Roaster.m_jCyclistClimbing = Join_Constructor(TEMP_DATABASE,"DYN_cyclist.carac_f_climbing");
oPage_Team_Roaster.m_jCyclistDownhill = Join_Constructor(TEMP_DATABASE,"DYN_cyclist.carac_f_downhill");
oPage_Team_Roaster.m_jCyclistSprint = Join_Constructor(TEMP_DATABASE,"DYN_cyclist.carac_f_sprint");
oPage_Team_Roaster.m_jCyclistEndurance = Join_Constructor(TEMP_DATABASE,"DYN_cyclist.carac_f_endurance");
oPage_Team_Roaster.m_jCyclistRecuperation = Join_Constructor(TEMP_DATABASE,"DYN_cyclist.carac_f_recuperation");
oPage_Team_Roaster.m_jCyclistAcceleration = Join_Constructor(TEMP_DATABASE,"DYN_cyclist.carac_f_acceleration");
oPage_Team_Roaster.m_jCyclistAgility = Join_Constructor(TEMP_DATABASE,"DYN_cyclist.carac_f_agility");
oPage_Team_Roaster.m_jCyclistIntelligence = Join_Constructor(TEMP_DATABASE,"DYN_cyclist.carac_f_intelligence");
oPage_Team_Roaster.m_jCyclistDiscipline = Join_Constructor(TEMP_DATABASE,"DYN_cyclist.carac_f_discipline");
oPage_Team_Roaster.m_jCyclistRating = Join_Constructor(TEMP_DATABASE,"DYN_cyclist.gene_i_rating");
oPage_Team_Roaster.m_jCyclistFitness = Join_Constructor(TEMP_DATABASE,"DYN_cyclist.fkIDgame_menu_fitness");
var i32x iLineHeight, iLinePosY;
iLineHeight = 293;
iLinePosY = 230;
{ // table init
// slider ruler
oPage_Team_Roaster.iTableBorderID[0] = InitContainer(tCommonTableBorder);
SetComponentPosition(oPage_Team_Roaster.iTableBorderID[0],654-16,iLinePosY+22);
SetContainerSize(oPage_Team_Roaster.iTableBorderID[0], 16, iLineHeight-22-16);
oPage_Team_Roaster.iTableBorderID[1] = InitContainer(tCommonTableBorder);
SetComponentPosition(oPage_Team_Roaster.iTableBorderID[1],654-15,iLinePosY+21+3);
SetContainerSize(oPage_Team_Roaster.iTableBorderID[1],14, iLineHeight -21-16 - 3);
SetContainerColor(oPage_Team_Roaster.iTableBorderID[1],MakeARGB(255,30,40,100));
}
// *** Cyclist List ***
oPage_Team_Roaster.iCyclistListID = InitList(
"Cyclist List",
40,
654,252,
Team_Roaster_List_Item_Create,
Team_Roaster_List_Item_Update,
Team_Roaster_List_Item_Event,
t_btn_slider_large,
ButtonState
);
SetComponentPosition(oPage_Team_Roaster.iCyclistListID,0,iLinePosY+22+3);
// title background
iID=InitContainer(tCommonTableBorder);
SetContainerColor(iID,c_TitleList);
SetContainerSize(iID,649,22);
SetComponentPosition(iID,5,iLinePosY);
SetEvents(iID,GUI_NoEvent);
// horizontal lines
oPage_Team_Roaster.iTableBorderID[2] = InitContainer(tCommonTableBorder);
SetComponentPosition(oPage_Team_Roaster.iTableBorderID[2],5,iLinePosY);
SetContainerSize(oPage_Team_Roaster.iTableBorderID[2], 649, 2);
oPage_Team_Roaster.iTableBorderID[3] = InitContainer(tCommonTableBorder);
SetComponentPosition(oPage_Team_Roaster.iTableBorderID[3],5,iLinePosY + 22);
SetContainerSize(oPage_Team_Roaster.iTableBorderID[3], 649, 2);
oPage_Team_Roaster.iTableBorderID[4] = InitContainer(tCommonTableBorder);
SetComponentPosition(oPage_Team_Roaster.iTableBorderID[4],5,507);
SetContainerSize(oPage_Team_Roaster.iTableBorderID[4], 649, 2);
iLoop = 0;
while (iLoop < 13)
{
iID = iLoop + 5;
oPage_Team_Roaster.iTableBorderID[iID] = InitContainer(tCommonTableBorder);
SetComponentPosition(oPage_Team_Roaster.iTableBorderID[iID],iLoop * 30 + 190,iLinePosY);
SetContainerSize(oPage_Team_Roaster.iTableBorderID[iID], 1, iLineHeight - 16);
iLoop = iLoop + 1;
}
//** column titles
iLinePosY=iLinePosY+7;
iLoop = 0;
while (iLoop < 14)
{
iID=InitButton(tFontArialItalique);
oPage_Team_Roaster.iColumnTitleID[iLoop] = iID;
iLoop = iLoop + 1;
}
// Set column name
SetContainerText(oPage_Team_Roaster.iColumnTitleID[0],GetLocalizedFromGMKey(65)); // name
SetContainerText(oPage_Team_Roaster.iColumnTitleID[1],GetLocalizedFromGMKey(66)); // age
SetContainerText(oPage_Team_Roaster.iColumnTitleID[2],GetLocalizedFromGMKey(126)); // rating
SetContainerText(oPage_Team_Roaster.iColumnTitleID[3],GetLocalizedFromGMKey(108)); // riding
SetContainerText(oPage_Team_Roaster.iColumnTitleID[4],GetLocalizedFromGMKey(109)); // climbing
SetContainerText(oPage_Team_Roaster.iColumnTitleID[5],GetLocalizedFromGMKey(110)); // downhill
SetContainerText(oPage_Team_Roaster.iColumnTitleID[6],GetLocalizedFromGMKey(111)); // sprint
SetContainerText(oPage_Team_Roaster.iColumnTitleID[7],GetLocalizedFromGMKey(112)); // endurance
SetContainerText(oPage_Team_Roaster.iColumnTitleID[8],GetLocalizedFromGMKey(114)); // recuperation
SetContainerText(oPage_Team_Roaster.iColumnTitleID[9],GetLocalizedFromGMKey(116)); // acceleration
SetContainerText(oPage_Team_Roaster.iColumnTitleID[10],GetLocalizedFromGMKey(115)); // agility
SetContainerText(oPage_Team_Roaster.iColumnTitleID[11],GetLocalizedFromGMKey(113)); // intelligence
SetContainerText(oPage_Team_Roaster.iColumnTitleID[12],GetLocalizedFromGMKey(117)); // discipline
SetContainerText(oPage_Team_Roaster.iColumnTitleID[13],GetLocalizedFromGMKey(127)); // fitness
// Refresh component
var i32x iPosX=5;
iLoop = 0;
while (iLoop < 14)
{
SetContainerStateFunc(oPage_Team_Roaster.iColumnTitleID[iLoop],ColumnTextButtonState);
SetComponentPosition(oPage_Team_Roaster.iColumnTitleID[iLoop],iPosX,iLinePosY);
if(iLoop>=1)
iPosX = iPosX + 30;
else
iPosX = iPosX + 190;
ResizeComponent(oPage_Team_Roaster.iColumnTitleID[iLoop]);
iLoop = iLoop + 1;
}
// sort init
oPage_Team_Roaster.iSortDirection = 1;
oPage_Team_Roaster.iSortedComponent = oPage_Team_Roaster.iColumnTitleID[0];
SetParserComponent(pComponent);
}
//----------------------------------------------------------------------------------------------------------------//
//----------------------------------------------------------------------------------------------------------------//
// Page Team Roster Constructor
//----------------------------------------------------------------------------------------------------------------//
//----------------------------------------------------------------------------------------------------------------//
func i32x Page_Team_Roaster_Constructor ()
{
// create page
oPage_Team_Roaster.iWindowID = InitObject(oPage_Team_Roaster.szName, oPage_Team_Roaster.oFunc.pcreate, oPage_Team_Roaster.oFunc.pevent);
// create waiting dialog
CreateDialog(DIALOG_LOADING_DATA);
// query databases
// MistER-j WARNING LOCALIZED
Dialog_Loading_Data_SetText("Loading teams");
ResetQuery(QUERY_TEAMS_DIVISIONS);
GetQuery(g_oMenuServer.m_oServer,QUERY_TEAMS_DIVISIONS,"Query Teams Divisions",vPage_Team_Roaster_TeamsDivisionsOk,0);
// reset for this query is done on phase change
ResetQuery(QUERY_CYCLISTS_FITNESS);
GetQuery(g_oMenuServer.m_oServer,QUERY_CYCLISTS_FITNESS,"Query Cyclists Fitness",vPage_Team_Roaster_CyclistsFitnessOK,0);
ResetQuery(QUERY_RACING_CYCLISTS);
GetQuery(g_oMenuServer.m_oServer,QUERY_RACING_CYCLISTS,"Query Racing Cyclists",vPage_Team_Roaster_RacingTeamsOK,0);
return oPage_Team_Roaster.iWindowID;
}
//----------------------------------------------------------------------------------------------------------------//
//----------------------------------------------------------------------------------------------------------------//
// Update Display of racing team
//----------------------------------------------------------------------------------------------------------------//
//----------------------------------------------------------------------------------------------------------------//
func void UpdatePullDisplay ()
{
var i32x i,iTeamID,iCyclistID,iPullIndex;
// Get team id
iTeamID = oObject_TeamListbox.m_iSelectedTeamID;
// Database are okay ?
if(oPage_Team_Roaster.m_jRacingCyclist[i] > 0)
{
iPullIndex=0;
i=0;
while(i<9)
{
iCyclistID = Join_GetIntFromKey(oPage_Team_Roaster.m_jRacingCyclist[i],iTeamID);
if (iCyclistID > 0)
{
oPage_Team_Roaster.iCyclistsPull[iPullIndex] = iCyclistID;
iPullIndex=iPullIndex+1;
}
else
oPage_Team_Roaster.iCyclistsPull[iPullIndex] = -1;
i = i+1;
}
oPage_Team_Roaster.iNbCyclistsInPull=iPullIndex;
// Hades : ???
if(iTeamID==g_oUser.m_iMyTeamID)
oPage_Team_Roaster.bDataReceived = true;
// Display pull
DisplayPull();
}
}
//----------------------------------------------------------------------------------------------------------------//
//----------------------------------------------------------------------------------------------------------------//
//
//----------------------------------------------------------------------------------------------------------------//
//----------------------------------------------------------------------------------------------------------------//
func void UpdateListDisplay ()
{
var component pOldParserComponent;
pOldParserComponent=GetParserComponent();
SetParserComponent(oPage_Team_Roaster.pComponent);
// Fill The subset with new data
vUpdateRoasterSubset();
// Sort roaster subset
vSortRoasterSubset();
// Get Cyclist number in subset
var i32x iNumCyclists;
if(oPage_Team_Roaster.m_jCyclistID != 0)
{
iNumCyclists = Join_GetNumRows(oPage_Team_Roaster.m_jCyclistID);
}
else
{
iNumCyclists = 0;
}
// Update item number
SetListNbItems(oPage_Team_Roaster.iCyclistListID,iNumCyclists);
// restore old parser component
SetParserComponent(pOldParserComponent);
}
//----------------------------------------------------------------------------------------------------------------//
//----------------------------------------------------------------------------------------------------------------//
//
//----------------------------------------------------------------------------------------------------------------//
//----------------------------------------------------------------------------------------------------------------//
func void UpdateSubscribe()
{
var i32x iTeamID;
// Selected team
iTeamID = oObject_TeamListbox.m_iSelectedTeamID;
if(g_oUser.m_iUserMode == G_iGuestUser)
{
// if Guest mode : display or hide subscribe button depend on team
if(Join_GetIntFromKey(g_oMenuJoins.m_iTeam_iUserID, iTeamID) != 0)
{
// Hide this button if team has already a human manager
SetComponentVisibleStatus(oPage_Team_Roaster.m_cSubscribe,0);
}
else
{
// Display subscribe button
SetComponentVisibleStatus(oPage_Team_Roaster.m_cSubscribe,1);
}
}
else
{
// registered user
// if Guest mode : display or hide subscribe button depend on team
if(iTeamID == g_oUser.m_iMyTeamID)
{
if(oPage_Team_Roaster.m_cUnsubscribe != ID_NOT_CREATED)
{
// Display unsubscribe button
SetComponentVisibleStatus(oPage_Team_Roaster.m_cUnsubscribe,1);
}
}
else
{
if(oPage_Team_Roaster.m_cUnsubscribe != ID_NOT_CREATED)
{
// Hide unsubscribe button if not on player team
SetComponentVisibleStatus(oPage_Team_Roaster.m_cUnsubscribe,0);
}
}
}
}
//----------------------------------------------------------------------------------------------------------------//
//----------------------------------------------------------------------------------------------------------------//
//
//----------------------------------------------------------------------------------------------------------------//
//----------------------------------------------------------------------------------------------------------------//
func void UpdateDisplay()
{
UpdateSubscribe();
// Update cyclist list
UpdateListDisplay();
// Update Roster
UpdatePullDisplay();
}
//----------------------------------------------------------------------------------------------------------------//
//----------------------------------------------------------------------------------------------------------------//
// Page Team Roster Event
//----------------------------------------------------------------------------------------------------------------//
//----------------------------------------------------------------------------------------------------------------//
func i32x Page_Team_RoasterEvent (i32x _iComponentID,i32x _iEvent)
{
if(_iComponentID == oPage_Team_Roaster.m_cTeamListBox)
{
if(_iEvent == GUI_COMPONENT_REFRESH)
{
UpdateDisplay();
}
}
// list titles
if ((_iComponentID>=oPage_Team_Roaster.iColumnTitleID[0])&&(_iComponentID<=oPage_Team_Roaster.iColumnTitleID[13]))
{
if(_iEvent == GUI_COMPONENT_MOUSE_ENTER )
{
Set_Tool_Bar_Text(szGetLocalizedCaracNameFromIndex(_iComponentID));
}
else if(_iEvent == GUI_COMPONENT_MOUSE_LEAVE )
{
Reset_Tool_Bar_Text();
}
if(_iEvent == GUI_BUTTON_PRESSED )
{
PlaySound(0,sbClickSound[0]);
// sort direction
if (oPage_Team_Roaster.iSortedComponent==_iComponentID)
{
// invert sorting direction
oPage_Team_Roaster.iSortDirection = -oPage_Team_Roaster.iSortDirection;
}
else
{
// new sorted column
oPage_Team_Roaster.iSortedComponent= _iComponentID;
// default sort direction
if (strcmp(szGetColumnNameFromIndex(oPage_Team_Roaster.iSortedComponent),"gene_sz_name")==0)
{
// name in ascending order
oPage_Team_Roaster.iSortDirection = 1;
}
else
{
// carac in descending order
oPage_Team_Roaster.iSortDirection = -1;
}
}
// sort table
vSortRoasterSubset();
// Update display
UpdateListDisplay ();
}
}
// select button
if(_iComponentID == oPage_Team_Roaster.iSelectID)
{
if(_iEvent == GUI_COMPONENT_MOUSE_LDOWN )
PlaySound(0,sbClickSound[0]);
if(_iEvent == GUI_BUTTON_PRESSED )
{
Page_Team_Roster_AddPullCyclist(oPage_Team_Roaster.iSelectedCyclistID);
}
}
// remove button
if(_iComponentID == oPage_Team_Roaster.iRemoveID)
{
if(_iEvent == GUI_BUTTON_PRESSED )
{
PlaySound(0,sbClickSound[0]);
Page_Team_Roster_RemovePullCyclist(oPage_Team_Roaster.iSelectedCyclistID);
}
}
// Subscribe button
if(_iComponentID == oPage_Team_Roaster.m_cSubscribe)
{
// Guest mode verification (could maybe prevent multi click)
if(g_oUser.m_iUserMode == G_iGuestUser)
{
if(_iEvent == GUI_BUTTON_PRESSED )
{
var i32x iTeamID;
var szx szInfo;
PlaySound(0,sbClickSound[0]);
// Selected team
iTeamID = oObject_TeamListbox.m_iSelectedTeamID;
szInfo = strcat(GetLocalizedFromGMKey(341)," ");
szInfo = strcat(szInfo,Join_GetStringFromKey(oObject_TeamListbox.m_jTeamName, iTeamID));
CreateMessageBox(szInfo, 1, Subscribe_MessageBoxCallback);
}
}
}
// Unsubscribe button
if(_iComponentID == oPage_Team_Roaster.m_cUnsubscribe)
{
// Registered mode verification (could maybe prevent multi click)
if(g_oUser.m_iUserMode == G_iRegisteredUser)
{
if(_iEvent == GUI_BUTTON_PRESSED )
{
var szx szInfo;
PlaySound(0,sbClickSound[0]);
szInfo = strcat(GetLocalizedFromGMKey(342)," ");
szInfo = strcat(szInfo,Join_GetStringFromKey(oObject_TeamListbox.m_jTeamName, g_oUser.m_iMyTeamID));
CreateMessageBox(szInfo, 1, Unsubscribe_MessageBoxCallback);
}
}
}
return 1;
}
//----------------------------------------------------------------------------------------------------------------//
//----------------------------------------------------------------------------------------------------------------//
// Page Team Roster Members Init
//----------------------------------------------------------------------------------------------------------------//
//----------------------------------------------------------------------------------------------------------------//
func void Page_Team_Roaster_InitMembers ()
{
oPage_Team_Roaster.szName = "Page_Team_Roaster";
oPage_Team_Roaster.oFunc.pcreate = Page_Team_Roaster_Create;
oPage_Team_Roaster.oFunc.pevent = Page_Team_RoasterEvent;
}
//----------------------------------------------------------------------------------------------------------------//
//----------------------------------------------------------------------------------------------------------------//
// Query reception funcs
//----------------------------------------------------------------------------------------------------------------//
//----------------------------------------------------------------------------------------------------------------//
func void vPage_Team_Roaster_TeamsDivisionsOk()
{
Dialog_Loading_Data_SetText(GetLocalizedFromGMKey(317));
}
func void vPage_Team_Roaster_CyclistsTeamsOk()
{
Dialog_Loading_Data_SetText(GetLocalizedFromGMKey(326));
}
func void vPage_Team_Roaster_CyclistsFitnessOK()
{
// update global cyclist database with new fitness
var i32x iReadJoin, iReadIDJoin, iWriteJoin;
var i32x iNbRows, iCyclistIndex;
iReadJoin = Join_Constructor(QUERY_CYCLISTS_FITNESS,"DYN_cyclist.fkIDgame_menu_fitness");
iReadIDJoin = Join_Constructor(QUERY_CYCLISTS_FITNESS,"DYN_cyclist.IDcyclist");
iWriteJoin = Join_Constructor(QUERY_GLOBAL_CYCLISTS,"DYN_cyclist.fkIDgame_menu_fitness");
iNbRows = Join_GetNumRows(iReadJoin);
iCyclistIndex = 0;
while (iCyclistIndex < iNbRows)
{
Join_SetIntFromKey(iWriteJoin,Join_GetIntFromIndex(iReadIDJoin,iCyclistIndex),Join_GetIntFromIndex(iReadJoin,iCyclistIndex));
iCyclistIndex = iCyclistIndex + 1;
}
Join_Destructor(iReadJoin);
Join_Destructor(iReadIDJoin);
Join_Destructor(iWriteJoin);
// display cyclist list
Page_Team_Roster_Create_List();
UpdateListDisplay();
Dialog_Loading_Data_SetText(GetLocalizedFromGMKey(327));
}
func void vPage_Team_Roaster_RacingTeamsOK()
{
var i32x i;
// Delete old racing team join if exist (should not :) )
i=0;
while(i<9)
{
if(oPage_Team_Roaster.m_jRacingCyclist[i] != 0)
{
Join_Destructor(oPage_Team_Roaster.m_jRacingCyclist[i]);
oPage_Team_Roaster.m_jRacingCyclist[i] = 0;
}
i=i+1;
}
// Create Racing team join
oPage_Team_Roaster.m_jRacingCyclist[0] = Join_Constructor(QUERY_RACING_CYCLISTS,"DYN_team.fkIDcyclist_1");
oPage_Team_Roaster.m_jRacingCyclist[1] = Join_Constructor(QUERY_RACING_CYCLISTS,"DYN_team.fkIDcyclist_2");
oPage_Team_Roaster.m_jRacingCyclist[2] = Join_Constructor(QUERY_RACING_CYCLISTS,"DYN_team.fkIDcyclist_3");
oPage_Team_Roaster.m_jRacingCyclist[3] = Join_Constructor(QUERY_RACING_CYCLISTS,"DYN_team.fkIDcyclist_4");
oPage_Team_Roaster.m_jRacingCyclist[4] = Join_Constructor(QUERY_RACING_CYCLISTS,"DYN_team.fkIDcyclist_5");
oPage_Team_Roaster.m_jRacingCyclist[5] = Join_Constructor(QUERY_RACING_CYCLISTS,"DYN_team.fkIDcyclist_6");
oPage_Team_Roaster.m_jRacingCyclist[6] = Join_Constructor(QUERY_RACING_CYCLISTS,"DYN_team.fkIDcyclist_7");
oPage_Team_Roaster.m_jRacingCyclist[7] = Join_Constructor(QUERY_RACING_CYCLISTS,"DYN_team.fkIDcyclist_8");
oPage_Team_Roaster.m_jRacingCyclist[8] = Join_Constructor(QUERY_RACING_CYCLISTS,"DYN_team.fkIDcyclist_9");
// Update pull
UpdatePullDisplay();
// Destroy loading data dialog
DestroyDialog();
}
//----------------------------------------------------------------------------------------------------------------//
//----------------------------------------------------------------------------------------------------------------//
// Page Team Roster LoadData
//----------------------------------------------------------------------------------------------------------------//
//----------------------------------------------------------------------------------------------------------------//
func void Page_Team_Roster_LoadData ()
{
}
//----------------------------------------------------------------------------------------------------------------//
//----------------------------------------------------------------------------------------------------------------//
// Page Team Roster LoadData
//----------------------------------------------------------------------------------------------------------------//
//----------------------------------------------------------------------------------------------------------------//
func void Page_Team_Roster_Refresh ()
{
// Refresh roster after MS notify
// Update cyclist list display
UpdateListDisplay();
// Update pull
// Display pull
DisplayPull();
}
//----------------------------------------------------------------------------------------------------------------//
//----------------------------------------------------------------------------------------------------------------//
// Page Team Roster SaveData
//----------------------------------------------------------------------------------------------------------------//
//----------------------------------------------------------------------------------------------------------------//
func void Page_Team_Roster_SaveData ()
{
Page_Team_Roaster_SaveRacingTeam();
}
//----------------------------------------------------------------------------------------------------------------//
//----------------------------------------------------------------------------------------------------------------//
// Return the current stage number
//----------------------------------------------------------------------------------------------------------------//
//----------------------------------------------------------------------------------------------------------------//
func i32x Page_Team_Roster_GetCurrentStageNumber ()
{
var i32x iTemp;
iTemp = 0;
// get current stage number from database
iTemp = Database_GetIntData(QUERY_GLOBAL_STAGES,
"STA_stage.gene_i_stage_number",
ROW_KEY,
g_oGameConfig.m_iCurrentStageID );
// debug print
//print("current stage number : ");
//println(itoa(iTemp));
return iTemp;
}
//----------------------------------------------------------------------------------------------------------------//
//----------------------------------------------------------------------------------------------------------------//
//
//----------------------------------------------------------------------------------------------------------------//
//----------------------------------------------------------------------------------------------------------------//
func void Page_Team_Roster_SetSelectedListItem (i32x _iSelectedItem)
{
// set context
var component pComponent;
pComponent=GetParserComponent();
SetParserComponent(oPage_Team_Roaster.pThis);
// set selected item in list
SetListSelectedItem(oPage_Team_Roaster.iCyclistListID, _iSelectedItem);
// restore context
SetParserComponent(pComponent);
}
//----------------------------------------------------------------------------------------------------------------//
//----------------------------------------------------------------------------------------------------------------//
//
//----------------------------------------------------------------------------------------------------------------//
//----------------------------------------------------------------------------------------------------------------//
func void Page_Team_Roster_SetListPosition (i32x _iSelectedItem)
{
// set context
var component pComponent;
pComponent=GetParserComponent();
SetParserComponent(oPage_Team_Roaster.pThis);
// set selected item in list
SetListPosition(oPage_Team_Roaster.iCyclistListID, _iSelectedItem);
// restore context
SetParserComponent(pComponent);
}
//----------------------------------------------------------------------------------------------------------------//
//----------------------------------------------------------------------------------------------------------------//
// Message box callback func
//----------------------------------------------------------------------------------------------------------------//
//----------------------------------------------------------------------------------------------------------------//
func void Subscribe_MessageBoxCallback(i32x _iResult)
{
if(_iResult == g_iTypeOkDialog)
{
var i32x iTeamID;
var szx szInfo;
// Selected team
iTeamID = oObject_TeamListbox.m_iSelectedTeamID;
// create waiting dialog
CreateDialog(DIALOG_LOADING_DATA);
szInfo = GetLocalizedFromGMKey(156);
Dialog_Loading_Data_SetText(szInfo);
// Send subscribe message to menu server and wait for validation SubscribeOk message
g_oMenuServer.m_oServer<<mGame_UserSubscribe(iTeamID);
}
}
func void Unsubscribe_MessageBoxCallback(i32x _iResult)
{
if(_iResult == g_iTypeOkDialog)
{
var szx szInfo;
// create waiting dialog
CreateDialog(DIALOG_LOADING_DATA);
szInfo = GetLocalizedFromGMKey(158);
Dialog_Loading_Data_SetText(szInfo);
// Send unsubscribe message to menu server and wait for validation UnsubscribeOk message
g_oMenuServer.m_oServer<<mGame_UserUnsubscribe();
}
}