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 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 00315 00316 00317 00318 00319 00320 00321 00322 00323 00324 00325 00326 00327 00328 00329 00330 00331 00332 00333 00334 00335 00336 00337 00338 00339 00340 00341 00342 00343 00344 00345 00346 00347 00348 00349 00350 00351 00352 00353 00354 00355 00356 00357 00358 00359 00360 00361 00362 00363 00364 00365 00366 00367 00368 00369 00370 00371 00372 00373 00374 |
/** * Copyright 1998-2008 Epic Games, Inc. All Rights Reserved. * * Specific version of the menu list that draws a number of the currently selected character part. */ class UTUICharacterCustomizationList extends UTUIMenuList; /** Text information. */ var transient vector2D PartSelectionPadding; var transient string CurrentPartSelectionStr; var() color PartSelectionTextColor; /** Left/Right Selection Arrow */ var() texture2D LeftRightArrowImage; var() bool bLeftArrowPressed; var() bool bRightArrowPressed; var() float LeftRightArrowHeightMultiplier; /** Height of the selection left/right arrow in percentage. */ var() float LeftRightArrowWidthRatio; /** Ratio if scroll ratio width to height. */ var() vector2D LeftRightArrowOffset; /** Arrow state colors. */ var() color ArrowColorNormal; var() color ArrowColorMouseOver; var() color ArrowColorPressed; /** We cache the rendering bounds of the Left/Right arrows for quick mouse look up. */ var transient float LeftArrowBounds[4]; var transient float RightArrowBounds[4]; var transient ECharPart CurrentlySelectedPartType; var transient array<int> CurrentlySelectedPartIndex; var transient array<name> PartCellTags; var transient array<ECharPart> ListEnumMap; /** Mapping of list index's to part enums. */ var transient UTUIDataStore_CustomChar CustomCharDataStore; event PostInitialize() { Super.PostInitialize(); CustomCharDataStore=UTUIDataStore_CustomChar(UTUIScene(GetScene()).FindDataStore('UTCustomChar')); // Set the parts length of the array to the max possible CurrentlySelectedPartIndex.length = PART_MAX; } /** Sets the currently selected list item. */ event SelectItem(int NewSelection) { Super.SelectItem(NewSelection); OnCurrentPartChanged(false); } /** @return Returns the currently selected char part type. */ function ECharPart GetSelectedCharPartType() { if(Selection >= 0 && Selection < ListEnumMap.length) { return ListEnumMap[Selection]; } else { return ListEnumMap[0]; } } /** Selects the previous part for the current part type. */ function SelectPrevPart() { local int NumParts; local ECharPart CurrentType; CurrentType = ListEnumMap[Selection]; NumParts = CustomCharDataStore.GetProviderElementCount(PartCellTags[CurrentType]); if(NumParts==0) { NumParts=1; } // Wrap the list if(CurrentlySelectedPartIndex[CurrentType]>0) { CurrentlySelectedPartIndex[CurrentType]--; } else { CurrentlySelectedPartIndex[CurrentType]=NumParts-1; } PlayUISound('ArmorPartChanged'); OnCurrentPartChanged(); } /** Selects the next part for the current part type. */ function SelectNextPart() { local int NumParts; local ECharPart CurrentType; CurrentType = ListEnumMap[Selection]; NumParts = CustomCharDataStore.GetProviderElementCount(PartCellTags[CurrentType]); if(NumParts==0) { NumParts=1; } // Increment but allow list wrap CurrentlySelectedPartIndex[CurrentType]=(CurrentlySelectedPartIndex[CurrentType]+1)%NumParts; PlayUISound('ArmorPartChanged'); OnCurrentPartChanged(); } /** Notification for when the current part for the current part type has changed. */ function OnCurrentPartChanged(optional bool bUpdatePreviewactor=true) { local string PartID; local ECharPart CurrentPartType; local int NumParts; CurrentPartType = ListEnumMap[Selection]; NumParts = CustomCharDataStore.GetProviderElementCount(PartCellTags[CurrentPartType]); if(bUpdatePreviewactor && GetPartID(CurrentPartType, CurrentlySelectedPartIndex[CurrentPartType], PartID)) { UTUIFrontEnd_CharacterCustomization(GetScene()).OnPreviewPartChanged(CurrentPartType, PartID); } // Update the selection string, make sure it is 2 digits long. if(CurrentlySelectedPartIndex[CurrentPartType]<9) { CurrentPartSelectionStr="0"$(CurrentlySelectedPartIndex[ListEnumMap[Selection]]+1); } else { CurrentPartSelectionStr=""$(CurrentlySelectedPartIndex[ListEnumMap[Selection]]+1); } // Append the number of total parts to the end. if(NumParts<=0) { CurrentPartSelectionStr="00/00"; } else if(NumParts < 9) { CurrentPartSelectionStr=CurrentPartSelectionStr$"/0"$NumParts; } else { CurrentPartSelectionStr=CurrentPartSelectionStr$"/"$NumParts; } } /** UI Input processing handler. */ function bool ProcessInputKey( const out SubscribedInputEventParameters EventParms ) { local bool bResult; bResult = false; if (EventParms.EventType == IE_Pressed || EventParms.EventType == IE_Repeat || EventParms.EventType == IE_DoubleClick) { if ( EventParms.InputAliasName == 'SelectionLeft' ) { bLeftArrowPressed=true; SelectPrevPart(); return true; } else if ( EventParms.InputAliasName == 'SelectionRight' ) { bRightArrowPressed=true; SelectNextPart(); return true; } } else if(EventParms.EventType==IE_Released) { if ( EventParms.InputAliasName == 'SelectionLeft' ) { bLeftArrowPressed=false; } else if ( EventParms.InputAliasName == 'SelectionRight' ) { bRightArrowPressed=false; } } // Try letting the left/right arrow's process input bResult = CheckArrowInput(EventParms); if(!bResult) { Super.ProcessInputKey(EventParms); } return bResult; } /** Checks to see if the user has clicked on the scroll arrows. */ function bool CheckArrowInput(const SubscribedInputEventParameters EventParms) { local bool bResult; bResult = false; if(EventParms.EventType==IE_Pressed||EventParms.EventType==IE_DoubleClick) { if(CursorCheck(LeftArrowBounds[0],LeftArrowBounds[1],LeftArrowBounds[2],LeftArrowBounds[3]) && EventParms.InputAliasName == 'Click') { bLeftArrowPressed=true; bResult=true; } else if(CursorCheck(RightArrowBounds[0],RightArrowBounds[1],RightArrowBounds[2],RightArrowBounds[3]) && EventParms.InputAliasName == 'Click') { bRightArrowPressed=true; bResult=true; } } else if(EventParms.EventType==IE_Released) { if(bLeftArrowPressed && CursorCheck(LeftArrowBounds[0],LeftArrowBounds[1],LeftArrowBounds[2],LeftArrowBounds[3]) && EventParms.InputAliasName == 'Click') { // The user released their mouse on the button. SelectPrevPart(); bResult=true; } else if(bRightArrowPressed && CursorCheck(RightArrowBounds[0],RightArrowBounds[1],RightArrowBounds[2],RightArrowBounds[3]) && EventParms.InputAliasName == 'Click') { // The user released their mouse on the button. SelectNextPart(); bResult=true; } bLeftArrowPressed=false; bRightArrowPressed=false; } return bResult; } /** @return Returns whether or not OutValue contains the partID for the given part type and part index */ function bool GetPartID(ECharPart PartType, int PartIndex, out string OutValue) { local bool Result; local array<int> ListElements; Result = false; ListElements = CustomCharDataStore.GetProviderListElements(PartCellTags[PartType]); if(PartIndex < ListElements.length) { PartIndex = ListElements[PartIndex]; Result = CustomCharDataStore.GetValueFromProviderSet(PartCellTags[PartType], 'PartID', PartIndex, OutValue); } return Result; } /** Returns a part index given a part type and part ID. */ function int GetPartIndex(ECharPart PartType, string PartID) { local int Result; local int ListIdx; local array<int> ListElements; ListElements = CustomCharDataStore.GetProviderListElements(PartCellTags[PartType]); Result = CustomCharDataStore.FindValueInProviderSet(PartCellTags[PartType], 'PartID', PartID); if(Result==INDEX_NONE) { Result=0; } // Find the list index the result corresponds to. for(ListIdx=0; ListIdx<ListElements.length; ListIdx++) { if(ListElements[ListIdx]==Result) { Result=ListIdx; break; } } return Result; } /** Sets the current selection for the specified part type. */ function SetPartSelection(ECharPart PartType, string PartID) { if(PartType < CurrentlySelectedPartIndex.length) { CurrentlySelectedPartIndex[PartType]=GetPartIndex(PartType, PartID); } } /** Draws the background of the currently selected list element. */ function DrawSelectionBG(float YPos) { local float Width,Height; local float ArrowWidth, ArrowHeight; local bool bOverArrow; Height = DefaultCellHeight * SelectionCellHeightMultiplier * ResScaling.Y; Width = Height * ScrollWidthRatio; Super.DrawSelectionBG(YPos); // Draw selected part text Canvas.SetPos(Width*PartSelectionPadding.X, YPos+Height*PartSelectionPadding.Y); Canvas.DrawColor=PartSelectionTextColor; DrawStringToFit(CurrentPartSelectionStr,Width*PartSelectionPadding.X,YPos+Height*PartSelectionPadding.Y,YPos+Height-(Height*PartSelectionPadding.Y)); // Draw left/right selection arrows ArrowHeight = LeftRightArrowHeightMultiplier*Height; ArrowWidth = ArrowHeight*LeftRightArrowWidthRatio; LeftArrowBounds[0]=Width-ArrowWidth*2-Width*LeftRightArrowOffset.X; LeftArrowBounds[1]=YPos+(Height-ArrowHeight)/2+Height*LeftRightArrowOffset.Y; LeftArrowBounds[2]=LeftArrowBounds[0]+ArrowWidth; LeftArrowBounds[3]=LeftArrowBounds[1]+ArrowHeight; bOverArrow=CursorCheck(LeftArrowBounds[0], LeftArrowBounds[1], LeftArrowBounds[2], LeftArrowBounds[3]); DrawSelectionArrow(LeftArrowBounds[0], LeftArrowBounds[1], ArrowWidth, ArrowHeight,147,191,121,59,bOverArrow, bLeftArrowPressed); RightArrowBounds[0]=Width-ArrowWidth-Width*LeftRightArrowOffset.X; RightArrowBounds[1]=YPos+(Height-ArrowHeight)/2+Height*LeftRightArrowOffset.Y; RightArrowBounds[2]=RightArrowBounds[0]+ArrowWidth; RightArrowBounds[3]=RightArrowBounds[1]+ArrowHeight; bOverArrow=CursorCheck(RightArrowBounds[0], RightArrowBounds[1], RightArrowBounds[2], RightArrowBounds[3]); DrawSelectionArrow(RightArrowBounds[0], RightArrowBounds[1], ArrowWidth, ArrowHeight,268,191,121,59, bOverArrow, bRightArrowPressed); } /** Draws one of the left/right selection arrows. */ function DrawSelectionArrow(float DrawX, float DrawY, float DrawW, float DrawH, float TexU, float TexV, float TexUL, float TexVL, bool bOver, bool bPressed) { if (bPressed) { Canvas.DrawColor=ArrowColorPressed; } else if(bOver) { Canvas.DrawColor=ArrowColorMouseOver; } else { Canvas.DrawColor=ArrowColorNormal; } Canvas.SetPos(DrawX,DrawY); Canvas.DrawTile(LeftRightArrowImage, DrawW, DrawH, TexU, TexV, TexUL, TexVL); } defaultproperties { PartSelectionTextColor=(B=255,G=255,R=255,A=255) LeftRightArrowImage=Texture2D'UI_HUD.HUD.UI_HUD_BaseC' LeftRightArrowHeightMultiplier=0.500000 LeftRightArrowWidthRatio=1.500000 LeftRightArrowOffset=(X=0.050000,Y=0.100000) ArrowColorNormal=(B=124,G=224,R=224,A=192) ArrowColorMouseOver=(B=189,G=240,R=240,A=255) ArrowColorPressed=(B=255,G=255,R=255,A=255) ScrollWidthRatio=3.000000 Begin Object Class=UIComp_Event Name=WidgetEventComponent ObjName=WidgetEventComponent Archetype=UIComp_Event'UTGame.Default__UTUIMenuList:WidgetEventComponent' ObjectArchetype=UIComp_Event'UTGame.Default__UTUIMenuList:WidgetEventComponent' End Object EventProvider=WidgetEventComponent Name="Default__UTUICharacterCustomizationList" ObjectArchetype=UTUIMenuList'UTGame.Default__UTUIMenuList' } |
Overview | Package | Class | Source | Class tree | Glossary | UnrealScript Documentation |
previous class next class | frames no frames |