Overview Package Class Source Class tree Glossary
previous class      next class frames      no frames

ROInterface.ROUT2K4Tab_MainSP


00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098
00099
00100
00101
00102
00103
00104
00105
00106
00107
00108
00109
00110
00111
00112
00113
00114
00115
00116
00117
00118
00119
00120
00121
00122
00123
00124
00125
00126
00127
00128
00129
00130
00131
00132
00133
00134
00135
00136
00137
00138
00139
00140
00141
00142
00143
00144
00145
00146
00147
00148
00149
00150
00151
00152
00153
00154
00155
00156
00157
00158
00159
00160
00161
00162
00163
00164
00165
00166
00167
00168
00169
00170
00171
00172
00173
00174
00175
00176
00177
00178
00179
00180
00181
00182
00183
00184
00185
00186
00187
00188
00189
00190
00191
00192
00193
00194
00195
00196
00197
00198
00199
00200
00201
00202
00203
00204
00205
00206
00207
00208
00209
00210
00211
00212
00213
00214
00215
00216
00217
00218
00219
00220
00221
00222
00223
00224
00225
00226
00227
00228
00229
00230
00231
00232
00233
00234
00235
00236
00237
00238
00239
00240
00241
00242
00243
00244
00245
00246
00247
00248
00249
00250
00251
00252
00253
00254
00255
00256
00257
00258
00259
00260
00261
00262
00263
00264
00265
00266
00267
00268
00269
00270
00271
00272
00273
00274
00275
00276
00277
00278
00279
00280
00281
00282
00283
00284
00285
00286
00287
00288
00289
00290
00291
00292
00293
00294
00295
00296
00297
00298
00299
00300
00301
00302
00303
00304
00305
00306
00307
00308
00309
00310
00311
00312
00313
00314
//-----------------------------------------------------------
// Modified by emh, 12/02/2005
//-----------------------------------------------------------
class ROUT2K4Tab_MainSP extends UT2K4Tab_MainSP;

var automated GUISectionBackground  sb_options2;

var automated moComboBox            co_Difficulty;

var array<float>                    difficulties;

var bool                            bHideDifficultyControl;

delegate OnChangeDifficulty(int index);

function InitComponent(GUIController MyController, GUIComponent MyOwner)
{
    Super(UT2K4GameTabBase).InitComponent(MyController, MyOwner);

    class'ROInterfaceUtil'.static.SetROStyle(MyController, Controls);

	if ( lb_Maps != None )
		li_Maps = lb_Maps.List;

	if ( li_Maps != None )
	{
	    li_Maps.OnDblClick = MapListDblClick;
	    li_Maps.bSorted = True;
	    lb_Maps.NotifyContextSelect = HandleContextSelect;
	}

	lb_Maps.bBoundToParent=false;
	lb_Maps.bScaleToParent=false;

	sb_Selection.ManageComponent(lb_Maps);

	asb_Scroll.ManageComponent(lb_MapDesc);

    InitMapHandler();
    InitGameType();
    //log("ROUT2K4Tab_MainSP::InitComponent()");

    InitDifficulty();
}

function ShowPanel(bool bShow)	// Show Panel should be subclassed if any special processing is needed
{
	super.ShowPanel(bShow);

    if (bHideDifficultyControl)
    {
	   co_Difficulty.SetVisibility(false);
	   sb_options2.SetVisibility(false);
	}
}

// Called when a new gametype is selected
function InitGameType()
{
    local int i;
    local array<CacheManager.GameRecord> Games;
    local bool bReloadMaps;

	// Get a list of all gametypes.
    class'CacheManager'.static.GetGameTypeList(Games);
	for (i = 0; i < Games.Length; i++)
    {
        //log("Games[i].ClassName="$ Games[i].ClassName);
        //log("Controller.LastGameType="$Controller.LastGameType);

        // HACK
        // Puma 5-3-2004
        if (Games[i].ClassName == "ROEngine.ROTeamGame")
        {
            //log("ROUT2K4Tab_MainSP: ROTeamGame found");
            CurrentGameType = Games[i];
            bReloadMaps = true;
            break;
        }
    }

	log("Current game type = "$CurrentGameType.ClassName);

    if ( i == Games.Length )
    	return;

    //log("ROUT2K4Tab_MainSP: Init ROGame");

	// Update the gametype label's text
    SetGameTypeCaption();

    // Load Maps for the new gametype, but only if it uses a different maplist
    if (bReloadMaps)
   		InitMaps();

    // Set the selected map
    i = li_Maps.FindIndexByValue(LastSelectedMap);
    if ( i == -1 )
    	i = 0;
    li_Maps.SetIndex(i);
    li_Maps.Expand(i);

	// Load the information (screenshot, desc., etc.) for the currently selected map
//    ReadMapInfo(li_Maps.GetParentCaption());
}

function CheckGameTutorial()
{
}
// Called when user clicks on a new map in the main maplist
function MapListChange(GUIComponent Sender)
{
	local MaplistRecord.MapItem Item;

    if (!Controller.bCurMenuInitialized)
        return;

	if ( Sender == lb_Maps )
	{
		if ( li_Maps.IsValid() )
		{
		   // Puma 05-03-2004
		   // changed to the Anchor's Primary and Secondary
			EnableComponent(p_Anchor.b_Primary);
			EnableComponent(p_Anchor.b_Secondary);
		}

		class'MaplistRecord'.static.CreateMapItem(li_Maps.GetValue(), Item);

		LastSelectedMap = Item.FullURL;
		SaveConfig();
		ReadMapInfo(Item.MapName);
	}
}

function MaplistConfigClick( GUIComponent Sender )
{
	local MaplistEditor MaplistPage;

    // Hack to ignore whats in RedOrchestraUser.ini Puma 5-25-2004
    MaplistEditorMenu="ROInterface.ROMaplistEditor";

	// open maplist config page
	if ( Controller.OpenMenu(MaplistEditorMenu) )
	{
		MaplistPage = MaplistEditor(Controller.ActivePage);
		if ( MaplistPage != None )
		{
			MaplistPage.MainPanel = self;
			MaplistPage.bOnlyShowOfficial = bOnlyShowOfficial;
			MaplistPage.bOnlyShowCustom = bOnlyShowCustom;
			MaplistPage.Initialize(MapHandler);
		}
	}
}

function InitDifficulty()
{
    local string props;
    local array<string> splits;
    local int i, count;

    // We use the property from ROTeamGame to fill the combo
    props = class'ROEngine.ROTeamGame'.static.GetPropsExtra(0);
    count = Split(props, ";", splits);

    // Don't do anything if we don't have an even number of elements (e.g. each element is paired)
    if (count <= 0 || count % 2 != 0)
        return;

    // Add properties to combo + save difficulties to array
    for (i = 0; i < count / 2; i++)
    {
        difficulties[i] = float(splits[i*2]);
        co_Difficulty.AddItem(splits[(i*2)+1],, splits[i*1]);
    }

    UpdateCurrentGameDifficulty();
}

function UpdateCurrentGameDifficulty()
{
    local float currentDifficulty;
    local int i;

    // Get current difficulty and set current in array
    currentDifficulty = class'ROEngine.ROTeamGame'.default.GameDifficulty;
    for (i = 0; i < difficulties.length; i++)
        if (currentDifficulty == difficulties[i])
        {
            co_Difficulty.SilentSetIndex(i);
            return; // all done!
        }

    warn("Unable to set current GameDifficulty in difficulty combobox (difficulty not found)");
}

function OnNewDifficultySelect(GUIComponent Sender)
{
    if (Sender == co_Difficulty)
    {
        // Change difficulty
        class'ROEngine.ROTeamGame'.default.GameDifficulty = difficulties[co_Difficulty.GetIndex()];

        // Save difficulty
        class'ROEngine.ROTeamGame'.static.StaticSaveConfig();

        // Tell rules tab to reload its settings
        OnChangeDifficulty(co_Difficulty.GetIndex());
    }
}

function SilentSetDifficulty(int index)
{
    co_Difficulty.SilentSetIndex(index);
}

defaultproperties
{
     Begin Object Class=GUISectionBackground Name=OptionsContainer
         bFillClient=True
         Caption="Options"
         WinTop=0.634726
         WinLeft=0.016993
         WinWidth=0.482149
         WinHeight=0.325816
         OnPreDraw=OptionsContainer.InternalPreDraw
     End Object
     sb_options2=GUISectionBackground'ROInterface.ROUT2K4Tab_MainSP.OptionsContainer'

     Begin Object Class=moComboBox Name=DifficultyCombo
         bReadOnly=True
         Caption="Difficulty"
         OnCreateComponent=DifficultyCombo.InternalOnCreateComponent
         Hint="Sets how skilled your opponents will be"
         WinTop=0.750547
         WinLeft=0.087169
         WinWidth=0.341797
         WinHeight=0.034236
         TabOrder=0
         OnChange=ROUT2K4Tab_MainSP.OnNewDifficultySelect
     End Object
     co_Difficulty=moComboBox'ROInterface.ROUT2K4Tab_MainSP.DifficultyCombo'

     Begin Object Class=GUISectionBackground Name=SelectionGroup
         bFillClient=True
         Caption="Map Selection"
         WinTop=0.018125
         WinLeft=0.016993
         WinWidth=0.482149
         WinHeight=0.600000
         OnPreDraw=SelectionGroup.InternalPreDraw
     End Object
     sb_Selection=GUISectionBackground'ROInterface.ROUT2K4Tab_MainSP.SelectionGroup'

     Begin Object Class=GUISectionBackground Name=PreviewGroup
         bFillClient=True
         Caption="Preview"
         WinTop=0.018125
         WinLeft=0.515743
         WinWidth=0.470899
         WinHeight=0.942417
         OnPreDraw=PreviewGroup.InternalPreDraw
     End Object
     sb_Preview=GUISectionBackground'ROInterface.ROUT2K4Tab_MainSP.PreviewGroup'

     sb_Options=None

     Begin Object Class=GUISectionBackground Name=ScrollSection
         bFillClient=True
         Caption="Map Desc"
         WinTop=0.525219
         WinLeft=0.546118
         WinWidth=0.409888
         WinHeight=0.412304
         OnPreDraw=ScrollSection.InternalPreDraw
     End Object
     asb_Scroll=GUISectionBackground'ROInterface.ROUT2K4Tab_MainSP.ScrollSection'

     Begin Object Class=GUIScrollTextBox Name=MapDescription
         bNoTeletype=True
         CharDelay=0.002500
         EOLDelay=0.500000
         OnCreateComponent=MapDescription.InternalOnCreateComponent
         WinTop=0.628421
         WinLeft=0.561065
         WinWidth=0.379993
         WinHeight=0.268410
         bTabStop=False
         bNeverFocus=True
     End Object
     lb_MapDesc=GUIScrollTextBox'ROInterface.ROUT2K4Tab_MainSP.MapDescription'

     Begin Object Class=moButton Name=MaplistButton
         ButtonCaption="Maplist Configuration"
         ComponentWidth=1.000000
         OnCreateComponent=MaplistButton.InternalOnCreateComponent
         Hint="Modify the maps that should be used in gameplay"
         WinTop=0.828648
         WinLeft=0.095426
         WinWidth=0.334961
         WinHeight=0.040000
         TabOrder=2
         OnChange=ROUT2K4Tab_MainSP.MaplistConfigClick
     End Object
     b_Maplist=moButton'ROInterface.ROUT2K4Tab_MainSP.MaplistButton'

     b_Tutorial=None

     ch_OfficialMapsOnly=None

     MaplistEditorMenu="ROInterface.ROMaplistEditor"
}

Overview Package Class Source Class tree Glossary
previous class      next class frames      no frames
Class file time: Fri 13-10-2023 03:17:28.000 - Creation time: Fri 13-10-2023 03:19:07.807 - Created with UnCodeX