Overview | Package | Class | Source | Class tree | Glossary | UnrealScript Documentation |
previous class next class | frames no frames |
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 |
/** * Copyright 1998-2008 Epic Games, Inc. All Rights Reserved. * * Tab page for content a user has installed. */ class UTUITabPage_MyContent extends UTTabPage placeable dependson(UTUIScene_MessageBox) native(UI); /** Reference to the list that displays user content. */ var transient UIList ContentList; /** Reference to a message box scene. */ var transient UTUIScene_MessageBox MessageBoxReference; /** * Actually deletes the content from the storage device. * * @param ContentName Filename of content to delete. */ native function PerformDeleteContent(string ContentName); /** * Reloads all downloaded content. */ native function ReloadContent(); /** * Returns the filename of some content given its content idx. * * @param ContentIdx Index of the content file to retrieve. */ function bool GetContentName(int ContentIdx, out string ContentName) { return class'UTUIMenuList'.static.GetCellFieldString(ContentList, 'FileName', ContentIdx, ContentName); } /** Post initialization event - Setup widget delegates.*/ event PostInitialize() { Super.PostInitialize(); // Get widget references ContentList = UIList(FindChild('lstContent', true)); ContentList.OnValueChanged = OnContentList_ValueChanged; // Set the button tab caption. SetDataStoreBinding("<Strings:UTGameUI.Community.MyContent>"); } /** Callback allowing the tabpage to setup the button bar for the current scene. */ function SetupButtonBar(UTUIButtonBar ButtonBar) { if(ContentList.GetCurrentItem()!=INDEX_NONE) { ButtonBar.AppendButton("<Strings:UTGameUI.ButtonCallouts.DeleteContent>", OnButtonBar_DeleteContent); ButtonBar.AppendButton("<Strings:UTGameUI.ButtonCallouts.DeleteAllContent>", OnButtonBar_DeleteAllContent); } } /** Deletes the currently selected content file. */ function OnDeleteContent() { local string ContentName; local int ContentIdx; local string FinalString; local array<string> MessageBoxOptions; ContentIdx = ContentList.GetCurrentItem(); // Display messagebox to confirm deletion. MessageBoxReference = UTUIScene(GetScene()).GetMessageBoxScene(); if(MessageBoxReference != none && GetContentName(ContentIdx, ContentName)) { FinalString = Localize("MessageBox", "DeleteContent_Message", "UTGameUI"); FinalString = Repl(FinalString, "%ContentName%", ContentName); MessageBoxOptions.AddItem("<Strings:UTGameUI.ButtonCallouts.DeleteContentAccept>"); MessageBoxOptions.AddItem("<Strings:UTGameUI.ButtonCallouts.Cancel>"); MessageBoxReference.SetPotentialOptions(MessageBoxOptions); MessageBoxReference.Display(FinalString, "<Strings:UTGameUI.MessageBox.DeleteContent_Title>", OnDeleteContent_Confirm, 1); } } /** Confirmation for the delete content dialog. */ function OnDeleteContent_Confirm(UTUIScene_MessageBox MessageBox, int SelectedItem, int PlayerIndex) { local string ContentName; MessageBoxReference = None; if(SelectedItem==0 && GetContentName(ContentList.GetCurrentItem(), ContentName)) { PerformDeleteContent(ContentName); ReloadContent(); OnContentListChanged(); } } /** Deletes all content. */ function OnDeleteAllContent() { local string FinalString; local array<string> MessageBoxOptions; // Display messagebox to confirm deletion. MessageBoxReference = UTUIScene(GetScene()).GetMessageBoxScene(); if(MessageBoxReference != none) { FinalString = Localize("MessageBox", "DeleteAllContent_Message", "UTGameUI"); MessageBoxOptions.AddItem("<Strings:UTGameUI.ButtonCallouts.DeleteContentAccept>"); MessageBoxOptions.AddItem("<Strings:UTGameUI.ButtonCallouts.Cancel>"); MessageBoxReference.SetPotentialOptions(MessageBoxOptions); MessageBoxReference.Display(FinalString, "<Strings:UTGameUI.MessageBox.DeleteAllContent_Title>", OnDeleteAllContent_Confirm, 1); } } /** Confirmation for the delete all content dialog. */ function OnDeleteAllContent_Confirm(UTUIScene_MessageBox MessageBox, int SelectedItem, int PlayerIndex) { local int ElementIdx; local string ContentName; MessageBoxReference = None; if(SelectedItem==0) { // Delete all items. for(ElementIdx=0; ElementIdx<ContentList.Items.length; ElementIdx++) { if(GetContentName(ContentList.Items[ElementIdx], ContentName)) { PerformDeleteContent(ContentName); } } ReloadContent(); OnContentListChanged(); } } /** Callback for when the content list has changed. */ function OnContentListChanged() { local int OldIdx; OldIdx = ContentList.Index; ContentList.RefreshSubscriberValue(); ContentList.SetIndex(OldIdx); } /** Buttonbar Callbacks */ function bool OnButtonBar_DeleteContent(UIScreenObject InButton, int PlayerIndex) { OnDeleteContent(); return true; } function bool OnButtonBar_DeleteAllContent(UIScreenObject InButton, int PlayerIndex) { OnDeleteAllContent(); return true; } /** Callback for when the user changes the currently selected list item. */ function OnContentList_ValueChanged( UIObject Sender, optional int PlayerIndex=0 ) { UTUIFrontEnd(GetScene()).SetupButtonBar(); } /** * Provides a hook for unrealscript to respond to input using actual input key names (i.e. Left, Tab, etc.) * * Called when an input key event is received which this widget responds to and is in the correct state to process. The * keys and states widgets receive input for is managed through the UI editor's key binding dialog (F8). * * This delegate is called BEFORE kismet is given a chance to process the input. * * @param EventParms information about the input event. * * @return TRUE to indicate that this input key was processed; no further processing will occur on this input key event. */ function bool HandleInputKey( const out InputEventParameters EventParms ) { local bool bResult; bResult=false; if(EventParms.EventType==IE_Released) { if(EventParms.InputKeyName=='XboxTypeS_Y') { OnDeleteContent(); bResult=true; } else if(EventParms.InputKeyName=='XboxTypeS_Back') { OnDeleteAllContent(); bResult=true; } } return bResult; } defaultproperties { Begin Object Class=UIComp_Event Name=WidgetEventComponent ObjName=WidgetEventComponent Archetype=UIComp_Event'UTGame.Default__UTTabPage:WidgetEventComponent' ObjectArchetype=UIComp_Event'UTGame.Default__UTTabPage:WidgetEventComponent' End Object EventProvider=WidgetEventComponent Name="Default__UTUITabPage_MyContent" ObjectArchetype=UTTabPage'UTGame.Default__UTTabPage' } |
Overview | Package | Class | Source | Class tree | Glossary | UnrealScript Documentation |
previous class next class | frames no frames |