Jump to content

UI List Item Adding problem


Speed74

Recommended Posts

Hello, i'm quite new to Unrealscript, so sorry if i may don't understand everything.

 

Anyway, i wanted to add a new item to the UIList in the "UICustomize_Menu" Screen.

 

That works to 50%, because the button (the Item) gets added correctly, but it's invisible.

 

You can't see it, you can't click it, only what happens is, that the sounds of the mouseover and mouseclick are played correctly but nothing more.

 

I need to go into a submenu (like General info) and then back for the button to appear.

 

Anyone got an Idea how to fix this? Thanks in advance!

Link to comment
Share on other sites

Ah nearly forgot the code. Only Purpose is it to bring back the "Facial Hair" Button for Females too. That works to 50% like said.

class UIXMen extends UIScreenListener;

var UICustomize_Menu Menu;
var UI_Definitions defs;

var UIMechaListItem Item;

var int index;
var int counter;

event OnInit(UIScreen Screen)
{
	`log("-------------------Init---------------------");
	
	Menu = UICustomize_Menu(Screen);

	defs = new class'UI_Definitions';

	RefreshData();
}

event OnReceiveFocus(UIScreen Screen)
{
	`log("--------Received Focus!--------");
	Menu = UICustomize_Menu(Screen);
	RefreshData();
}

function RefreshData()
{
	local bool bIsObstructed;
	local EUIState ColorState;

	bIsObstructed = Menu.CustomizeManager.IsFacialHairDisabled();
	ColorState = (Menu.bIsSuperSoldier || bIsObstructed) ? eUIState_Disabled : eUIState_Normal;

	// Search our Listitem, if it exist, remove it from the ItemContainer
	If (Menu.List.HasItem(Item))
	{
		Menu.List.ItemContainer.RemoveChild(Item);
	}

	Menu.UpdateData(); // Update Menu Data to rebuild the interface

	if(!Menu.CustomizeManager.ShowMaleOnlyOptions()) // Check if we have a female
	{
		Item = Menu.GetListItem(Menu.List.ItemCount + 1); // create new Item
		index = Menu.List.GetItemIndex(Item); // get the Index of the item
		
		// Now we swap the item from the bottom to the 4th position, where the Facial hair button would also be located at Males
		for(counter=index; counter > 4; counter--)
		{
			Menu.List.ItemContainer.SwapChildren(counter, counter-1);
		}
	}

	// Set our items Data Values but , of course, only when the Item actually exists
	if (Menu.List.HasItem(Item))
	{
		Item.UpdateDataValue(class'UIUtilities_Text'.static.GetColoredText(Menu.m_strFacialHair, ColorState), Menu.CustomizeManager.FormatCategoryDisplay(eUICustomizeCat_FacialHair, ColorState, Menu.FontSize), Menu.CustomizeFacialHair);
		Item.SetDisabled(Menu.bIsSuperSoldier || bIsObstructed, Menu.bIsSuperSoldier ? Menu.m_strIsSuperSoldier : Menu.m_strRemoveHelmetOrLowerProp);
	}

	Menu.List.RealizeItems(); // Realize Items

}

defaultproperties
{
	ScreenClass = class'UICustomize_Menu';
}
Edited by Speed74
Link to comment
Share on other sites

Somehow the tagging you used does not work well, the lines are numbered and there are these huge white blocks. I recommend finding a mod which does something similar, downloading it, and looking at how it works. There is a uniform manager mod, a random nickname mod, and a few others that add buttons.

Link to comment
Share on other sites

Somehow the tagging you used does not work well, the lines are numbered and there are these huge white blocks. I recommend finding a mod which does something similar, downloading it, and looking at how it works. There is a uniform manager mod, a random nickname mod, and a few others that add buttons.

 

Fixed the tagging now.

 

And i did, but i really can't get the hang of it, i just don't get what i do wrong or what i miss...

Link to comment
Share on other sites

Among mods, there are complex ones and simple ones. If you try to pick apart a complex mod which happens to do what you want, it will be more difficult, with more blind alleys due to investigating some other feature besides the one you want. The three day zero DLC mods are still the most complex, by an order of magnitude. The mods I mentioned are much more focused and will be easier to pick apart.

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...