kosmo111 Posted March 2, 2016 Share Posted March 2, 2016 I was wondering if anyone has played around with these systems at all? They seem to be how the 'fancier' displays are created within the game and are fairly well hidden to us in the unreal source code. A good example (and the one I happen to be interested in) is located in UIUtilities_Strategy.uc and pertains to the soldier ability summary list on the Armory screen.http://i.imgur.com/cVIsgTp.jpg I have taken a bit of code from various places to reconstruct how I believe the 'Soldier Abilities' list is populated as an example. Please note that this is pseudo code and will not compile as written, it is simply meant to show what is happening in a concise manner. local UIArmory Screen; // Assume is initialized properly for this example local XComGameState_Unit; // Assume is initialized properly for this example local string TmpStr; // Used when adding things to the UI // This sets the title of the ability list, in english to "Soldier Abilities' Screen.MC.FunctionString("setSummaryTitle", default.m_strAbilityListTitle); // This notifies UIMCController (the thing that interfaces with the flash UI) // that we are about to give it data about the AbilitySummaryList Screen.MC.BeginFunctionOp("setAbilitySummaryList"); // Pseudo-code to iterate over all abilities of a unit, just to show whats happening foreach AbilitiesToShow(AbilityTemplate) { // Adds this abilities icon to the list Screen.MC.QueueString(AbilityTemplate.IconImage); // Adds this abilities name to the list TmpStr = AbilityTemplate.LocFriendlyName != "" ? AbilityTemplate.LocFriendlyName : ("Missing 'LocFriendlyName' for '" $ AbilityTemplate.DataName $ "'"); Screen.MC.QueueString(TmpStr); // Adds this abilities description to the list TmpStr = AbilityTemplate.HasLongDescription() ? AbilityTemplate.GetMyLongDescription(, UnitState, CheckGameState) : ("Missing 'LocLongDescription' for " $ AbilityTemplate.DataName $ "'"); Screen.MC.QueueString(TmpStr); } // This notifies the UIMCController that we are done adding things to the AbilitySummaryList Screen.MC.EndOp(); My understanding of what is happening here is that somewhere not in unreal script a 'flash function' named setAbilitySummaryList exists and it takes a set of parameters in groups of three. Essentially, the Nth string is considered an icon, N+1 is considered a name and N+2 is considered a description-- then N is incremented by 3 until the list is exhausted. This allows them to build specialized UIs outside of unrealscript while still allowing the data to be easily and dynamically added/altered via scripts. Does anyone know if these flash functions can be created or added to existing screens? Or if there is any other way of interacting with them? Or at least getting the list of functions? Link to comment Share on other sites More sharing options...
tracktwo Posted March 2, 2016 Share Posted March 2, 2016 (edited) You can't directly add new actionscript to the existing flash, but there are alternatives. You can also extract the flash files from the gfx packages and view them to get the list of functions, and use either the MC utilities or raw scaleform calls (eg Invoke()) to call functions in the flash or get/set variables. You can find the gfx package from the ui class, but I haven't found a simple way to extract it yet. You can open the package in the unreal editor and see the SWF object in the content browser but exporting it won't give you a .SWF, unfortunately. What I did was open the gfx package in a hex editor, search for "GFX" and copy pasted the rest of the file from that point into a new file with a .SWF extension. That was enough to get JPEXS to read the file and decompile the actionscript. There may be a better way to do this. You can also build your own interfaces if you can author .SWF files, and manipulate objects from the existing flash through your own actionscript. See my thread on the XCOM EU mod talk forum for my adventures in getting this working for EW. The same techniques should apply. i believe the thread was titled "R&D flash modding" or something like that. Edit: here's the link. Not sure how useful it'll be for xcom2. http://forums.nexusmods.com/index.php?/topic/3020124-r-d-xcom-uiflash-modding/page-4&do=findComment&comment=27687815 Edited March 2, 2016 by tracktwo Link to comment Share on other sites More sharing options...
MachDelta Posted March 2, 2016 Share Posted March 2, 2016 (edited) Bah, TT beat me to it :) Edited March 2, 2016 by MachDelta Link to comment Share on other sites More sharing options...
kosmo111 Posted March 2, 2016 Author Share Posted March 2, 2016 Alright, thanks for the tips guys. I don't think I need to play with the flash to do what I want to do anyway-- it was more just a growing interest I had as I found more and more references to them as a possible alternative to trying to do it all by hand. Link to comment Share on other sites More sharing options...
bunnytrain Posted March 2, 2016 Share Posted March 2, 2016 You can get pretty far without going there. Take a look at how the Character Pool was implemented (I think it's UICharacterPool.uc) for an example of replicating some complex functionality using pretty much purely scriptable components. Link to comment Share on other sites More sharing options...
Recommended Posts