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 00228 00229 00230 00231 00232 |
/** * Creates and manages all globally accessible persistent data stores. * Copyright 1998-2011 Epic Games, Inc. All Rights Reserved. */ class DataStoreClient extends UIRoot native(inherit) Config(Engine); /** * Represents a collection of data stores that are linked to a specific player. */ struct native transient PlayerDataStoreGroup { /** * the player that this group is associated with. */ var const transient LocalPlayer PlayerOwner; /** * the list of data stores registered for this player. */ var const transient array<UIDataStore> DataStores; }; /** * List of global data store class names to create when the data store client is created. */ var config array<string> GlobalDataStoreClasses; /** * The list of global persistent data stores. */ var const array<UIDataStore> GlobalDataStores; /** * List of data store class names that should be loaded at initialization time, but not created. Instances of these data * stores will be created as they are needed (i.e. PlayerOwner, etc.) */ var config array<string> PlayerDataStoreClassNames; /** * Stores the list of dynamic player data store classes that were loaded from PlayerDataStoreClassNames. */ var const private array<class<UIDataStore> > PlayerDataStoreClasses; /** * the list of dynamic data stores that are created per-player. */ var const array<PlayerDataStoreGroup> PlayerDataStores; cpptext { /** * Loads each of the classes from the GlobalDataStoreClasses array, creates an instance of that class, and stores * that instance in the GlobalDataStores array. */ virtual void InitializeDataStores(); } /** * Finds the data store indicated by DataStoreTag and returns a pointer to it. * * @param DataStoreTag A name corresponding to the 'Tag' property of a data store * @param PlayerOwner used for resolving the correct data stores in split-screen games. * * @return a pointer to the data store that has a Tag corresponding to DataStoreTag, or NULL if no data * were found with that tag. */ native final function UIDataStore FindDataStore( name DataStoreTag, optional LocalPlayer PlayerOwner ); /** * Creates and initializes an instance of the data store class specified. * * @param DataStoreClass the data store class to create an instance of. DataStoreClass should be a child class * of UUIDataStore * * @return a pointer to an instance of the data store class specified. */ native final function coerce UIDataStore CreateDataStore( class<UIDataStore> DataStoreClass ); /** * Adds a new data store to the GlobalDataStores array. * * @param DataStore the data store to add * @param PlayerOwner if specified, the data store will be added to the list of PlayerDataStores, rather than the list of global data stores * * @return TRUE if the data store was successfully added, or if the data store was already in the list. */ native final function bool RegisterDataStore( UIDataStore DataStore, optional LocalPlayer PlayerOwner ); /** * Removes a data store from the GlobalDataStores array. * * @param DataStore the data store to remove * * @return TRUE if the data store was successfully removed, or if the data store wasn't in the list. */ native final function bool UnregisterDataStore( UIDataStore DataStore ); /** * Finds the index into the PlayerDataStores array for the data stores associated with the specified player. * * @param PlayerOwner the player to search for associated data stores for. */ native final function int FindPlayerDataStoreIndex( LocalPlayer PlayerOwner ) const; /* === Unrealscript === */ /** * Accessor for grabbing the list of player data store classes. */ final function GetPlayerDataStoreClasses( out array<class<UIDataStore> > out_DataStoreClasses ) { out_DataStoreClasses = PlayerDataStoreClasses; } /** * Searches the data store client's data store class arrays for a child of the specified meta class. * * @param RequiredMetaClass the data store base class to search for. * * @return a pointer to a child class of RequiredMetaClass that was specified in the ini. */ final function class<UIDataStore> FindDataStoreClass( class<UIDataStore> RequiredMetaClass ) { local int i; local class<UIDataStore> Result; // first, search through the global data stores array for ( i = 0; i < GlobalDataStores.Length; i++ ) { // if this global data store is an instance of the class we're searching for, stop here if ( GlobalDataStores[i].IsA(RequiredMetaClass.Name) ) { Result = GlobalDataStores[i].Class; break; } } if ( Result == None ) { // search through the player data store class arrays for ( i = 0; i < PlayerDataStoreClasses.Length; i++ ) { if ( ClassIsChildOf(PlayerDataStoreClasses[i], RequiredMetaClass) ) { Result = PlayerDataStoreClasses[i]; break; } } } return Result; } /** * Called when the current map is being unloaded. Cleans up any references which would prevent garbage collection. */ final event NotifyGameSessionEnded() { local int i, DataStoreIndex; local array<UIDataStore> DataStoreArray; DataStoreArray = GlobalDataStores; // notify all global data stores for ( DataStoreIndex = 0; DataStoreIndex < DataStoreArray.Length; DataStoreIndex++ ) { if ( DataStoreArray[DataStoreIndex].NotifyGameSessionEnded() ) { UnregisterDataStore(DataStoreArray[DataStoreIndex]); } } // now notify all dynamic data stores for ( i = PlayerDataStores.Length - 1; i >= 0; i-- ) { DataStoreArray = PlayerDataStores[i].DataStores; for ( DataStoreIndex = 0; DataStoreIndex < DataStoreArray.Length; DataStoreIndex++ ) { DataStoreArray[DataStoreIndex].NotifyGameSessionEnded(); UnregisterDataStore(DataStoreArray[DataStoreIndex]); } } } final function DebugDumpDataStoreInfo( bool bVerbose ) { `if(`notdefined(FINAL_RELEASE)) local int DataStoreIndex, PlayerDataStoreIndex; local string PlayerName; local LocalPlayer PlayerOwner; local array<UIDataStore> PlayerGroupDataStores; // first, search through the global data stores array `log("GlobalDataStores: " $ GlobalDataStores.Length,,'DevDataStore'); for ( DataStoreIndex = 0; DataStoreIndex < GlobalDataStores.Length; DataStoreIndex++ ) { //@todo ronp - expose UUIDataStore::GetDataStoreId() as a native unrealscript function, rather than using the data store's tag directly `log(" GlobalDataStore[" $ DataStoreIndex $ "]:" @ GlobalDataStores[DataStoreIndex].Tag @ "(" $ GlobalDataStores[DataStoreIndex] $ ")",,'DevDataStore'); //@todo ronp - call a function on the GlobalDataStore to allow it to log more detailed information } `log(""); `log("Player data store groups:" $ PlayerDataStores.Length,,'DevDataStore'); for ( DataStoreIndex = 0; DataStoreIndex < PlayerDataStores.Length; DataStoreIndex++ ) { PlayerOwner = PlayerDataStores[DataStoreIndex].PlayerOwner; PlayerGroupDataStores = PlayerDataStores[DataStoreIndex].DataStores; PlayerName = (PlayerOwner != None && PlayerOwner.Actor != None && PlayerOwner.Actor.PlayerReplicationInfo != None) ? PlayerOwner.Actor.PlayerReplicationInfo.PlayerName : "None"; `log(" PlayerDataStores for player " $ DataStoreIndex $ ":" @ PlayerGroupDataStores.Length @ "(" $ Playername @ "-" @ PlayerOwner $ ")",,'DevDataStore'); for ( PlayerDataStoreIndex = 0; PlayerDataStoreIndex < PlayerGroupDataStores.Length; PlayerDataStoreIndex++ ) { //@todo ronp - expose UUIDataStore::GetDataStoreId() as a native unrealscript function, rather than using the data store's tag directly `log(" PlayerDataStore[" $ PlayerDataStoreIndex $ "]:" @ PlayerGroupDataStores[PlayerDataStoreIndex].Tag @ "(" $ PlayerGroupDataStores[PlayerDataStoreIndex] $ ")",,'DevDataStore'); //@todo ronp - call a function on the GlobalDataStore to allow it to log more detailed information } } `endif } DefaultProperties { } |
Overview | Package | Class | Source | Class tree | Glossary | UnrealScript Documentation |
previous class next class | frames no frames |