Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rewrite of UIArmory_MainMenu to facilitate DLC/Mods adding elements into the ArmoryList #47

Closed
3 tasks
robojumper opened this issue Sep 26, 2017 · 2 comments
Labels
enhancement needs-docs Needs documentation

Comments

@Musashi1584
Copy link
Contributor

Anyone working on this yet? I could use that right now.

Musashi1584 added a commit to Musashi1584/X2WOTCCommunityHighlander that referenced this issue Nov 9, 2017
Musashi1584 added a commit to Musashi1584/X2WOTCCommunityHighlander that referenced this issue Nov 9, 2017
Musashi1584 added a commit to Musashi1584/X2WOTCCommunityHighlander that referenced this issue Nov 10, 2017
Musashi1584 added a commit to Musashi1584/X2WOTCCommunityHighlander that referenced this issue Nov 10, 2017
Musashi1584 added a commit to Musashi1584/X2WOTCCommunityHighlander that referenced this issue Nov 10, 2017
…ontroller compatible with self contained callbacks
Musashi1584 added a commit to Musashi1584/X2WOTCCommunityHighlander that referenced this issue Nov 10, 2017
Musashi1584 added a commit to Musashi1584/X2WOTCCommunityHighlander that referenced this issue Nov 10, 2017
Musashi1584 added a commit to Musashi1584/X2WOTCCommunityHighlander that referenced this issue Nov 10, 2017
@Musashi1584
Copy link
Contributor

Example how to use the event to add an item to the main menu

class X2EventListener_StatUI_MainMenu extends X2EventListener;

static function array<X2DataTemplate> CreateTemplates()
{
	local array<X2DataTemplate> Templates;

	Templates.AddItem(CreateMainMenuListenerTemplate());

	return Templates;
}

static function CHEventListenerTemplate CreateMainMenuListenerTemplate()
{
	local CHEventListenerTemplate Template;

	`CREATE_X2TEMPLATE(class'CHEventListenerTemplate', Template, 'StealthOverhaulOnTacticalBeginPlay');

	Template.RegisterInTactical = false;
	Template.RegisterInStrategy = true;

	Template.AddCHEvent('OnArmoryMainMenuUpdate', OnArmoryMainMenuUpdate, ELD_Immediate);
	`LOG("Register Event OnArmoryMainMenuUpdate",, 'RPG');

	return Template;
}


static function EventListenerReturn OnArmoryMainMenuUpdate(Object EventData, Object EventSource, XComGameState GameState, Name Event, Object CallbackData)
{
	local UIList List;
	local UIArmory_MainMenu MainMenu;
	local UIListItemString StatUIButton;

	`LOG(GetFuncName(),, 'RPG');
	
	List = UIList(EventData);
	MainMenu = UIArmory_MainMenu(EventSource);

	StatUIButton = MainMenu.Spawn(class'UIListItemString', List.ItemContainer).InitListItem(class'UIBarMemorial_Details'.default.m_strSoldierStats);
	StatUIButton.MCName = 'ArmoryMainMenu_StatUIButton';
	StatUIButton.ButtonBG.OnClickedDelegate = OnSoldierStats;
	List.MoveItemToBottom(FindDismissListItem(List));

	return ELR_NoInterrupt;
}


simulated function OnSoldierStats(UIButton kButton)
{
	local UIArmory_MainMenu MainMenu;
	local XComHQPresentationLayer HQPres;
	local UIScreen_StatUI StatScreen;

	MainMenu = UIArmory_MainMenu(kButton.GetParent(class'UIArmory_MainMenu', true));

	HQPres = XComHQPresentationLayer(MainMenu.Movie.Pres);

	if( HQPres == none )
		return;

	if (`SCREENSTACK.IsNotInStack(class'UIScreen_StatUI'))
	{
		//StatScreen = UIScreen_StatUI(HQPres.ScreenStack.Push(HQPres.Spawn(class'UIScreen_StatUI', HQPres), HQPres.Get3DMovie()));
		StatScreen = UIScreen_StatUI(HQPres.ScreenStack.Push(HQPres.Spawn(class'UIScreen_StatUI', HQPres)));
		StatScreen.InitArmory(MainMenu.GetUnitRef());
	}

	`XSTRATEGYSOUNDMGR.PlaySoundEvent("Play_MenuSelect");
}

simulated static function UIListItemString FindDismissListItem(UIList List)
{
	return UIListItemString(List.GetChildByName('ArmoryMainMenu_DismissButton', false));
}

Musashi1584 added a commit to Musashi1584/X2WOTCCommunityHighlander that referenced this issue Nov 10, 2017
MalucoMarinero pushed a commit that referenced this issue Nov 12, 2017
…nMenu Rewrite

* Issue #47 Initial add of UIArmory_MainMenu
* Issue #47 Ports LW2 UIArmory_MainMenu rewrite to WotC
* Issue #47 Initial add of UIListItemString
* Issue #47 Initial add of UIButton
* Issue #47 Make UIListItemString->UIButton keyboard / controller compatible with self contained callbacks
* Issue #47 Initial add of UINavigator
* Issue #47 Initial add of UIPanel
* Issue #47 UIPanel swaps controls in navigator to ensure controller/keyboard nav stays in sync
* Update CHANGELOG.md
* Issue #47 Fix double click and wrong issue ids
@robojumper robojumper added the needs-docs Needs documentation label Jan 18, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement needs-docs Needs documentation
Projects
None yet
Development

No branches or pull requests

3 participants