From bf19f755077e9789d1525c56b66185c9f91efc54 Mon Sep 17 00:00:00 2001 From: kdm2k6 Date: Sun, 3 Jan 2021 00:39:22 -0800 Subject: [PATCH] Provide shorter Promotion screen option without panel tearing NOTE : Whenever I refer to a promotion screen, I am referring to the "New Promotion Screen by Default" promotion screen. ------------------------------ Problem : If you enter a soldier's promotion screen then quickly cycle through soldiers, using a controller or a mouse and keyboard, you will notice strange panel tearing on the right side of the screen. Explanation : It turns out that when you choose to view a soldier's promotions, you are actually viewing a 3D Flash movie which is embedded with : [1] a NPSBDP_UIArmory_PromotionHero promotion screen [2] a bunch of other stuff, including 3D models. Interestingly, it appears that the promotion screen is given a certain area of the movie with which to occupy; a viewport of sorts. Furthermore, the promotion screen appears incapable of moving outside of this bounding rectangle. Now, if a soldier has more than 7 ranks, NPSBDP_UIArmory_PromotionHero.OnInit calls the function ResizeScreenForBrigadierRank whose goal is to add space for an 8th rank column. Within this function : 1.] The promotion screen width is increased 2.] A variety of background panel's have their width increased to fit the new 8th column. 3.] The promotion screen is shifted to the right so that the 8th column is placed in the correct position. 4.] Many of the panels, which are now too far to the right due to step #3, are moved back to the left a bit. The main problem here is that the promotion screen width increase, combined with the UI element shifting, results in the main background panel being placed upon against the bounding rectangle given to the promotion screen by the 3D Flash movie. This, by itself, isn't a problem. However, when a distortion effect is added in, you end up with parts of the background panel moving outside of the promotion screen bounding rectangle and 'wrapping around' to the other side of the bounding rectangle. Solution : One way in which this problem can be solved is by removing the distortion effect from the promotion screen. This works; however, it is not the method I ended up going with. Here is what I did within NPSBDP_UIArmory_PromotionHero.ResizeScreenForBrigadierRank : 1.] I removed the promotion screen width increase since it really wasn't needed. The promotion screen was already well over 1700 pixels; furthermore, elongating a UIScreen seems to actually stretch the panels placed upon it. 2.] I increased the width of a variety of background UIPanel's, much like in the original promotion screen, to make way for the 8th rank column. 3.] I shifted the whole promotion screen away from the left side of its bounding rectangle; this could be done since, with a shorter promotion screen, it would no longer sneak behind the soldier pawn. 4.] I modified the location of the 8th rank column so it wouldn't sit on top of the 7th rank column. 5.] I made a few other minor UI location adjustments. Since the promotion screen's panels were no longer close to the bounding rectangle, the distortion effect could safely play without resulting in any panel tearing/wrapping. Final thoughts : Ultimately, I kept the original promotion screen, and made it the default, since many people will be used to its width and location. Within XComLW_UI.ini I created a config variable, USE_SHORTER_PROMOTION_SCREEN, which, when enabled, substitutes the 'original' promotion screen with the 'shortened' promotion screen. This way users can choose to use the longer promotion screen with panel tearing or the shorter promotion screen without panel tearing. ------------------------------ Problem : Since the shorter promotion screen was moved to the right, to prevent it from hitting the bounding rectangle given to it by the 3D flash movie, Sparks and any other large pawn'd characters would overlap the 8th rank column. Solution : The 'hero' promotion screen umap file, 3DUIBP_Armory_Promotion_Hero.umap, was modified in the following ways : 1.] The camera was rotated a bit, with respect to the Z-Axis, so that the soldier pawn appears farther to the right. 2.] The screen object, within the umap, was moved along the Y axis so that it appears farther to the left. ------------------------------ Problem : The scroll bar would change position when switching from 'fullscreen' mode to 'windowed' mode; in other words, it would look ok in one mode but not the other. Solution : It turns out that this problem only occurred when the scrollbar was being anchored to the screen; consequently, anchoring was removed and its X location was updated accordingly within NPSBDP_UIArmory_PromotionHero.InitPromotion. Now, the scrollbar remains on the right side of the promotion screen regardless of the screen mode. ------------------------------ Modifies : NPSBDP_UIArmory_PromotionHeroColumn The Flash rank label has now been replaced with 2 UITexts; this allows a label such as 'Master Sergeant' to appear on 2 lines. Additionally, to make room for this change, the rank icon and 'rank up' icon have been moved up. NOTE : The rank label UITexts are filled according to this algorithm : 1.] The rank label is split into a string array, using a space as the delimeter. 2.] The 1st word, if it exists, goes into the 1st UIText. 3.] The 2nd word, if it exists, goes into the 2nd UIText. If there are more than 2 words, the 2nd UIText is a concatenation of the 2nd word to the 'nth' word separated by spaces. --- LongWarOfTheChosen/Config/XComLW_UI.ini | 3 + LongWarOfTheChosen/LongWarOfTheChosen.x2proj | 7 + .../Classes/NPSBDP_UIArmory_PromotionHero.uc | 171 +++++++++++------- .../NPSBDP_UIArmory_PromotionHeroColumn.uc | 80 ++++++++ 4 files changed, 200 insertions(+), 61 deletions(-) diff --git a/LongWarOfTheChosen/Config/XComLW_UI.ini b/LongWarOfTheChosen/Config/XComLW_UI.ini index 27cfb74a2..9767ee562 100644 --- a/LongWarOfTheChosen/Config/XComLW_UI.ini +++ b/LongWarOfTheChosen/Config/XComLW_UI.ini @@ -79,3 +79,6 @@ RECRUIT_FONT_SIZE_CTRL = 22 ; Recruit screen font size for controller users. RECRUIT_Y_OFFSET_CTRL = -3 ; Moves the stats up/down; negative numbers move up / positive numbers move down. RECRUIT_FONT_SIZE_MK = 20 ; Recruit screen font size for mouse & keyboard users. RECRUIT_Y_OFFSET_MK = -2; ; Moves the stats up/down; negative numbers move up / positive numbers move down. + +[NewPromotionScreenByDefault_Integrated.NPSBDP_UIArmory_PromotionHero] +USE_SHORTER_PROMOTION_SCREEN = false ; Use a slightly shorter promotion screen; this removes the panel tearing seen when cycling soldiers. diff --git a/LongWarOfTheChosen/LongWarOfTheChosen.x2proj b/LongWarOfTheChosen/LongWarOfTheChosen.x2proj index 0ebb33ea2..67dd68e6e 100644 --- a/LongWarOfTheChosen/LongWarOfTheChosen.x2proj +++ b/LongWarOfTheChosen/LongWarOfTheChosen.x2proj @@ -21,6 +21,7 @@ + @@ -162,6 +163,12 @@ + + Content + + + Content + diff --git a/LongWarOfTheChosen/Src/NewPromotionScreenByDefault_Integrated/Classes/NPSBDP_UIArmory_PromotionHero.uc b/LongWarOfTheChosen/Src/NewPromotionScreenByDefault_Integrated/Classes/NPSBDP_UIArmory_PromotionHero.uc index bdaa289b4..1ae0d8288 100644 --- a/LongWarOfTheChosen/Src/NewPromotionScreenByDefault_Integrated/Classes/NPSBDP_UIArmory_PromotionHero.uc +++ b/LongWarOfTheChosen/Src/NewPromotionScreenByDefault_Integrated/Classes/NPSBDP_UIArmory_PromotionHero.uc @@ -25,13 +25,12 @@ var config array FactionAbilityCosts; var config float BaseAbilityCostModifier; var config int ScrollbarPositionX; +var config(LW_UI) bool USE_SHORTER_PROMOTION_SCREEN; // Position is the number by which we offset all ability indices. // 0 <= Position <= MaxPosition var int Position, MaxPosition; -var int AdjustXOffset; - simulated function ChangeSelectedColumn(int oldIndex, int newIndex) { local int i, NewColumnAbilityIndex, NewColumnAbilities, OldColumnAbilityIndex; @@ -125,20 +124,30 @@ simulated function InitPromotion(StateObjectReference UnitRef, optional bool bIn PopulateData(); - // Only set position and animate in the scrollbar once after data population. Prevents scrollbar flicker on scrolling. + // NPSBD : Set the scrollbar's position, and animate it in, after data population. This prevents scrollbar + // flicker on scrolling. + // + // KDM : When the scrollbar was anchored, it would move around when switching from 'fullscreen' mode + // to 'windowed' mode. Consequently, anchoring has been removed, and its X location has been updated + // so that it remains on the right side of the promotion screen. if (default.ScrollbarPositionX > 0) { Scrollbar.SetPosition(default.ScrollbarPositionX, 310); } else if (HasBrigadierRank()) { - // KDM : The X position was originally set to -465; however, I am perplexed as to why, since the scrollbar was much too far to the right. - // In fact it was nearly always blocked by the soldier pawn. - Scrollbar.SetPosition(-475, 310); + if (!USE_SHORTER_PROMOTION_SCREEN) + { + Scrollbar.SetPosition(1350, 310); + } + else + { + Scrollbar.SetPosition(1505, 310); + } } else { - Scrollbar.SetPosition(-550, 310); + Scrollbar.SetPosition(1275, 310); } Scrollbar.MC.SetNum("_alpha", 0); @@ -453,7 +462,6 @@ simulated function RealizeScrollbar() if(Scrollbar == none) { Scrollbar = Spawn(class'UIScrollbar', self).InitScrollbar(); - Scrollbar.SetAnchor(class'UIUtilities'.const.ANCHOR_TOP_RIGHT); Scrollbar.SetHeight(450); } Scrollbar.NotifyValueChange(OnScrollBarChange, 0.0, MaxPosition); @@ -1148,60 +1156,101 @@ function int GetCustomAbilityCost(name ClassName, name AbilityName) function ResizeScreenForBrigadierRank() { + local int ScreenX, ScreenXOffset, ScreenWidth, RankColumnWidth; - // Fix width and position of elements to make space for the 8th column - // - Width = int(MC.GetNum("_width")); - AdjustXOffset = MC.GetNum("rankColumn6._x") - MC.GetNum("rankColumn5._x"); - SetWidth(Width + AdjustXOffset); - - // Widths - MC.ChildSetNum("bg", "_width", MC.GetNum("bg._width") + AdjustXOffset); - MC.ChildSetNum("topDivider", "_width", MC.GetNum("topDivider._width") + AdjustXOffset); - MC.ChildSetNum("bottomDivider", "_width", MC.GetNum("bottomDivider._width") + AdjustXOffset); - MC.ChildSetNum("headerLines", "_width", MC.GetNum("headerLines._width") + AdjustXOffset); - MC.ChildSetNum("columnGradients", "_width", MC.GetNum("columnGradients._width") + AdjustXOffset); - - // X Positions - MC.SetNum("_x", MC.GetNum("_x") + 50); - MC.ChildSetNum("topDivider", "_x", MC.GetNum("topDivider._x") - AdjustXOffset); - MC.ChildSetNum("bottomDivider", "_x", MC.GetNum("bottomDivider._x") - AdjustXOffset); - MC.ChildSetNum("headerLines", "_x", MC.GetNum("headerLines._x") - AdjustXOffset); - MC.ChildSetNum("columnGradients", "_x", MC.GetNum("columnGradients._x") - AdjustXOffset); - MC.ChildSetNum("factionLogoLarge", "_x", MC.GetNum("factionLogoLarge._x") - AdjustXOffset); - MC.ChildSetNum("factionLogo", "_x", MC.GetNum("factionLogo._x") - AdjustXOffset); - MC.ChildSetNum("classIcon", "_x", MC.GetNum("classIcon._x") - AdjustXOffset); - MC.ChildSetNum("rankIcon", "_x", MC.GetNum("rankIcon._x") - AdjustXOffset); - MC.ChildSetNum("factionName", "_x", MC.GetNum("factionName._x") - AdjustXOffset); - MC.ChildSetNum("abilityLabel", "_x", MC.GetNum("abilityLabel._x") - AdjustXOffset); - //MC.ChildSetNum("soldierAPLabel", "_x", MC.GetNum("soldierAPLabel._x") - AdjustXOffset); - //MC.ChildSetNum("soldierAPValue", "_x", MC.GetNum("soldierAPValue._x") - AdjustXOffset); - //MC.ChildSetNum("teamAPLabel", "_x", MC.GetNum("teamAPLabel._x") - AdjustXOffset); - //MC.ChildSetNum("teamAPValue", "_x", MC.GetNum("teamAPValue._x") - AdjustXOffset); - //MC.ChildSetNum("combatIntelLabel", "_x", MC.GetNum("combatIntelLabel._x") - AdjustXOffset); - //MC.ChildSetNum("combatIntelValue", "_x", MC.GetNum("combatIntelValue._x") - AdjustXOffset); - MC.ChildSetNum("unitName", "_x", MC.GetNum("unitName._x") - AdjustXOffset); - MC.ChildSetNum("descriptionTitle", "_x", MC.GetNum("descriptionTitle._x") - AdjustXOffset); - MC.ChildSetNum("descriptionBody", "_x", MC.GetNum("descriptionBody._x") - AdjustXOffset); - MC.ChildSetNum("descriptionDetail", "_x", MC.GetNum("descriptionDetail._x") - AdjustXOffset); - MC.ChildSetNum("descriptionIcon", "_x", MC.GetNum("descriptionIcon._x") - AdjustXOffset); - MC.ChildSetNum("costLabel", "_x", MC.GetNum("costLabel._x") - AdjustXOffset); - MC.ChildSetNum("costValue", "_x", MC.GetNum("costValue._x") - AdjustXOffset); - MC.ChildSetNum("apLabel", "_x", MC.GetNum("apLabel._x") - AdjustXOffset); - MC.ChildSetNum("abilityPathHeader", "_x", MC.GetNum("abilityPathHeader._x") - AdjustXOffset); - MC.ChildSetNum("pathLabel0", "_x", MC.GetNum("pathLabel0._x") - AdjustXOffset); - MC.ChildSetNum("pathLabel1", "_x", MC.GetNum("pathLabel1._x") - AdjustXOffset); - MC.ChildSetNum("pathLabel2", "_x", MC.GetNum("pathLabel2._x") - AdjustXOffset); - MC.ChildSetNum("pathLabel3", "_x", MC.GetNum("pathLabel3._x") - AdjustXOffset); - MC.ChildSetNum("rankColumn0", "_x", MC.GetNum("rankColumn0._x") - AdjustXOffset); - MC.ChildSetNum("rankColumn1", "_x", MC.GetNum("rankColumn1._x") - AdjustXOffset); - MC.ChildSetNum("rankColumn2", "_x", MC.GetNum("rankColumn2._x") - AdjustXOffset); - MC.ChildSetNum("rankColumn3", "_x", MC.GetNum("rankColumn3._x") - AdjustXOffset); - MC.ChildSetNum("rankColumn4", "_x", MC.GetNum("rankColumn4._x") - AdjustXOffset); - MC.ChildSetNum("rankColumn5", "_x", MC.GetNum("rankColumn5._x") - AdjustXOffset); - MC.ChildSetNum("rankColumn6", "_x", MC.GetNum("rankColumn6._x") - AdjustXOffset); - MC.ChildSetNum("rankColumn7", "_x", MC.GetNum("rankColumn6._x")); - MC.ChildSetNum("rankColumn7", "_y", MC.GetNum("rankColumn6._y")); + // KDM : Get the screen's location and width via Flash since they aren't updated in UnrealScript yet. + ScreenX = MC.GetNum("_x"); + ScreenXOffset = (!USE_SHORTER_PROMOTION_SCREEN) ? 50 : -10; + ScreenWidth = MC.GetNum("_width"); + + // KDM : Determine the width of our 8th rank column based on the distance between 2 rank columns + // which already exist. + RankColumnWidth = MC.GetNum("rankColumn6._x") - MC.GetNum("rankColumn5._x"); + + if (!USE_SHORTER_PROMOTION_SCREEN) + { + // KDM : NPSBD increases the width of the promotion screen; however, I don't think this is the 'normal' + // way to do things since : + // 1.] The screen, located within the Flash movie, is already over 1700 pixels and need not be wider. + // 2.] Widening a UIScreen seems to stretch the panels placed upon it. + // I remove this width change for my 'shorter' promotion screen, but will leave it in for the + // 'normal' promotion screen so its size and UI placement remain intact. + SetWidth(ScreenWidth + RankColumnWidth); + } + SetX(ScreenX + ScreenXOffset); + + // KDM : Increase the width of a number of background UI elements since we are adding an extra rank column. + MC.ChildSetNum("bg", "_width", MC.GetNum("bg._width") + RankColumnWidth); + MC.ChildSetNum("topDivider", "_width", MC.GetNum("topDivider._width") + RankColumnWidth); + MC.ChildSetNum("bottomDivider", "_width", MC.GetNum("bottomDivider._width") + RankColumnWidth); + MC.ChildSetNum("headerLines", "_width", MC.GetNum("headerLines._width") + RankColumnWidth); + MC.ChildSetNum("columnGradients", "_width", MC.GetNum("columnGradients._width") + RankColumnWidth); + + if (!USE_SHORTER_PROMOTION_SCREEN) + { + // KDM : The promotion screen, as a whole, is shifted to the right; therefore, a variety of panels + // are shifted left, back into place. + MC.ChildSetNum("topDivider", "_x", MC.GetNum("topDivider._x") - RankColumnWidth); + MC.ChildSetNum("bottomDivider", "_x", MC.GetNum("bottomDivider._x") - RankColumnWidth); + MC.ChildSetNum("headerLines", "_x", MC.GetNum("headerLines._x") - RankColumnWidth); + MC.ChildSetNum("columnGradients", "_x", MC.GetNum("columnGradients._x") - RankColumnWidth); + MC.ChildSetNum("factionLogoLarge", "_x", MC.GetNum("factionLogoLarge._x") - RankColumnWidth); + MC.ChildSetNum("factionLogo", "_x", MC.GetNum("factionLogo._x") - RankColumnWidth); + MC.ChildSetNum("classIcon", "_x", MC.GetNum("classIcon._x") - RankColumnWidth); + MC.ChildSetNum("rankIcon", "_x", MC.GetNum("rankIcon._x") - RankColumnWidth); + MC.ChildSetNum("factionName", "_x", MC.GetNum("factionName._x") - RankColumnWidth); + MC.ChildSetNum("abilityLabel", "_x", MC.GetNum("abilityLabel._x") - RankColumnWidth); + MC.ChildSetNum("unitName", "_x", MC.GetNum("unitName._x") - RankColumnWidth); + MC.ChildSetNum("descriptionTitle", "_x", MC.GetNum("descriptionTitle._x") - RankColumnWidth); + MC.ChildSetNum("descriptionBody", "_x", MC.GetNum("descriptionBody._x") - RankColumnWidth); + MC.ChildSetNum("descriptionDetail", "_x", MC.GetNum("descriptionDetail._x") - RankColumnWidth); + MC.ChildSetNum("descriptionIcon", "_x", MC.GetNum("descriptionIcon._x") - RankColumnWidth); + MC.ChildSetNum("costLabel", "_x", MC.GetNum("costLabel._x") - RankColumnWidth); + MC.ChildSetNum("costValue", "_x", MC.GetNum("costValue._x") - RankColumnWidth); + MC.ChildSetNum("apLabel", "_x", MC.GetNum("apLabel._x") - RankColumnWidth); + MC.ChildSetNum("abilityPathHeader", "_x", MC.GetNum("abilityPathHeader._x") - RankColumnWidth); + MC.ChildSetNum("pathLabel0", "_x", MC.GetNum("pathLabel0._x") - RankColumnWidth); + MC.ChildSetNum("pathLabel1", "_x", MC.GetNum("pathLabel1._x") - RankColumnWidth); + MC.ChildSetNum("pathLabel2", "_x", MC.GetNum("pathLabel2._x") - RankColumnWidth); + MC.ChildSetNum("pathLabel3", "_x", MC.GetNum("pathLabel3._x") - RankColumnWidth); + MC.ChildSetNum("rankColumn0", "_x", MC.GetNum("rankColumn0._x") - RankColumnWidth); + MC.ChildSetNum("rankColumn1", "_x", MC.GetNum("rankColumn1._x") - RankColumnWidth); + MC.ChildSetNum("rankColumn2", "_x", MC.GetNum("rankColumn2._x") - RankColumnWidth); + MC.ChildSetNum("rankColumn3", "_x", MC.GetNum("rankColumn3._x") - RankColumnWidth); + MC.ChildSetNum("rankColumn4", "_x", MC.GetNum("rankColumn4._x") - RankColumnWidth); + MC.ChildSetNum("rankColumn5", "_x", MC.GetNum("rankColumn5._x") - RankColumnWidth); + MC.ChildSetNum("rankColumn6", "_x", MC.GetNum("rankColumn6._x") - RankColumnWidth); + MC.ChildSetNum("rankColumn7", "_x", MC.GetNum("rankColumn6._x")); + } + else + { + // KDM : The background, 'bg', is a bit of an odd-ball since it doesn't seem to move with the rest of the + // panels when the screen X value is changed. Therefore, shift it over a bit so it fits nicely behind all of the + // other panels. + MC.ChildSetNum("bg", "_x", MC.GetNum("bg._x") + RankColumnWidth); + // KDM : Shift the soldier AP label and value to the top right corner of the background panel. + MC.ChildSetNum("soldierAPLabel", "_x", MC.GetNum("soldierAPLabel._x") + RankColumnWidth); + MC.ChildSetNum("soldierAPValue", "_x", MC.GetNum("soldierAPValue._x") + RankColumnWidth); + // KDM : Shift the XCom AP label and value so they are next to the soldier AP label and value. + MC.ChildSetNum("teamAPLabel", "_x", MC.GetNum("teamAPLabel._x") + RankColumnWidth); + MC.ChildSetNum("teamAPValue", "_x", MC.GetNum("teamAPValue._x") + RankColumnWidth); + // KDM : Shift the Combat Intelligence label and value so they are next to the XCom AP label and value. + MC.ChildSetNum("combatIntelLabel", "_x", MC.GetNum("combatIntelLabel._x") + RankColumnWidth); + MC.ChildSetNum("combatIntelValue", "_x", MC.GetNum("combatIntelValue._x") + RankColumnWidth); + // KDM : Shift the ability point label, cost label, and cost value to the bottom right corner of the background panel. + MC.ChildSetNum("apLabel", "_x", MC.GetNum("apLabel._x") + RankColumnWidth); + MC.ChildSetNum("costLabel", "_x", MC.GetNum("costLabel._x") + RankColumnWidth); + MC.ChildSetNum("costValue", "_x", MC.GetNum("costValue._x") + RankColumnWidth); + // KDM : Place the 8th rank column to the right of the 7th rank column. + MC.ChildSetNum("rankColumn7", "_x", MC.GetNum("rankColumn6._x") + RankColumnWidth); + // KDM : Increase the width of the soldier's name container; unitName is an XComScrollingTextField, + // within Flash, so get and set its width appropriately. + MC.ChildFunctionNum("unitName", "setWidth", MC.GetNum("unitName.maskWidth") + RankColumnWidth); + // KDM : Increase the width of the ability description container; descriptionBody is a textField, + // within Flash, so set its width appropriately. + MC.ChildSetNum("descriptionBody", "_width", MC.GetNum("descriptionBody._width") + RankColumnWidth); + } + MC.ChildSetNum("rankColumn7", "_y", MC.GetNum("rankColumn6._y")); } diff --git a/LongWarOfTheChosen/Src/NewPromotionScreenByDefault_Integrated/Classes/NPSBDP_UIArmory_PromotionHeroColumn.uc b/LongWarOfTheChosen/Src/NewPromotionScreenByDefault_Integrated/Classes/NPSBDP_UIArmory_PromotionHeroColumn.uc index aaee32646..107b1e866 100644 --- a/LongWarOfTheChosen/Src/NewPromotionScreenByDefault_Integrated/Classes/NPSBDP_UIArmory_PromotionHeroColumn.uc +++ b/LongWarOfTheChosen/Src/NewPromotionScreenByDefault_Integrated/Classes/NPSBDP_UIArmory_PromotionHeroColumn.uc @@ -1,6 +1,85 @@ class NPSBDP_UIArmory_PromotionHeroColumn extends UIArmory_PromotionHeroColumn; var int Offset; +var UIText RankLabelLine1, RankLabelLine2; + +function UIArmory_PromotionHeroColumn InitPromotionHeroColumn(int InitRank) +{ + super.InitPromotionHeroColumn(InitRank); + + // KDM : Create the UIText's which will display the rank labels. + RankLabelLine1 = Spawn(class'UIText', self); + RankLabelLine1.InitText('RankLabelLine1', ""); + RankLabelLine2 = Spawn(class'UIText', self); + RankLabelLine2.InitText('RankLabelLine2', ""); + + UpdateSizeAndPosition(); + + return self; +} + +function UpdateSizeAndPosition() +{ + // KDM : The rank icon. + MC.ChildSetNum("rankMC", "_x", 41); + MC.ChildSetNum("rankMC", "_y", -8); + + // KDM : The 'rank up' highlight. + MC.ChildSetNum("rankHighlight", "_x", 0); + MC.ChildSetNum("rankHighlight", "_y", -31); + + // KDM : Rank label line 1. + RankLabelLine1.SetPosition(2, 52); + RankLabelLine1.SetWidth(145); + + // KDM : Rank label line 2. + RankLabelLine2.SetPosition(2, 78); + RankLabelLine2.SetWidth(145); +} + +function AS_SetData(bool ShowHighlight, string HighlightText, string RankIcon, string RankLabel) +{ + MC.BeginFunctionOp("SetData"); + MC.QueueBoolean(ShowHighlight); + MC.QueueString(HighlightText); + MC.QueueString(RankIcon); + // KDM : We no longer want to set rankLabel, within Flash, since we will be dealing with + // multi-line rank labels by ourself. + MC.QueueString(""); + MC.EndOp(); + + SetRankLabel(RankLabel); +} + +function SetRankLabel(string RankLabel) +{ + local int i; + local string ConcatenatedString; + local array RankLabelComponents; + + RankLabelComponents = SplitString(RankLabel, " ", true); + if (RankLabelComponents.Length >= 1) + { + RankLabelLine1.SetHtmlText(class'UIUtilities_Text'.static.GetColoredText( + RankLabelComponents[0], eUIState_Normal, 24, "CENTER")); + + i = 1; + ConcatenatedString = ""; + // KDM : Normally, a rank label will consist of 1 or 2 words; if it consists of more, any word after + // the 1st will be concatenated with spaces and placed in RankLabelLine2. + while (i < RankLabelComponents.Length) + { + ConcatenatedString $= RankLabelComponents[i]; + if (i + 1 < RankLabelComponents.Length) + { + ConcatenatedString $= " "; + } + i++; + } + RankLabelLine2.SetHtmlText(class'UIUtilities_Text'.static.GetColoredText( + ConcatenatedString, eUIState_Normal, 24, "CENTER")); + } +} function OnAbilityInfoClicked(UIButton Button) { @@ -113,3 +192,4 @@ simulated function bool AttemptScroll(bool Up) { return NPSBDP_UIArmory_PromotionHero(Screen).AttemptScroll(Up); } +