guiskj
Knight
I have three questions regarding the GauntletUI in Character Creation:
1 - How are you supposed to add Layers to those screens?? I am trying to add some extra functionality to the FaceGenBody.xml window but so far no luck.
Behaviour class:
Layer and ViewModel classes
GauntletUI
2. How can I detect when screens change so I know when to add my layer? I have tried looking into `Game.Current.EventManager.RegisterEvent`, `CampaignEvents` and `ScreenManager` but nothing fits the bill.
I would really prefer not to have to resort to Harmony patches to change those screens since we had a whole Dev Diary that talked about how awesome and easy it was to mod game screens with GauntletUI...
Thanks in advance for any help.
1 - How are you supposed to add Layers to those screens?? I am trying to add some extra functionality to the FaceGenBody.xml window but so far no luck.
Behaviour class:
C#:
public class CharacterGenPresetBehavior : CampaignBehaviorBase
{
private GauntletLayer _layer;
public override void RegisterEvents()
{
CampaignEvents.OnNewGameCreatedEvent.AddNonSerializedListener(this, OnNewGameCreated);
}
private void OnNewGameCreated(CampaignGameStarter starter)
{
_layer = new CharacterGenPresetLayer(10000);
ScreenManager.TopScreen.AddLayer(_layer);
}
public override void SyncData(IDataStore dataStore) { }
}
C#:
public class CharacterGenPresetLayer : GauntletLayer
{
public CharacterGenPresetLayer(int localOrder, string categoryId = "GauntletLayer") : base(localOrder, categoryId)
{
var viewModel = new CharacterGenPresetViewModel();
LoadMovie("CharacterGenPreset", viewModel);
Utils.Logger.Log("CharacterGenPresetViewModel Created");
}
}
class CharacterGenPresetViewModel : ViewModel
{
[DataSourceProperty]
public string TestingCharGenPresetText{ get => "Testing"; }
public override void RefreshValues()
{
base.RefreshValues();
Utils.Logger.Log("CharacterGenPresetViewModel Refresh");
}
}
XML:
<?xml version="1.0" encoding="utf-8" ?>
<Prefab>
<Constants />
<VisualDefinitions>
</VisualDefinitions>
<Window>
<Widget DoNotAcceptEvents="true" WidthSizePolicy="StretchToParent" HeightSizePolicy="StretchToParent">
<Children>
<TextWidget WidthSizePolicy="CoverChildren" HeightSizePolicy="CoverChildren" HorizontalAlignment="Center" VerticalAlignment="Center" Brush="FaceGen.Property.Text" Text="@TestingCharGenPresetText" ClipContents="false"/>
</Children>
</Widget>
</Window>
</Prefab>
2. How can I detect when screens change so I know when to add my layer? I have tried looking into `Game.Current.EventManager.RegisterEvent`, `CampaignEvents` and `ScreenManager` but nothing fits the bill.
I would really prefer not to have to resort to Harmony patches to change those screens since we had a whole Dev Diary that talked about how awesome and easy it was to mod game screens with GauntletUI...
Thanks in advance for any help.