Skip to content

Commit

Permalink
multiversus
Browse files Browse the repository at this point in the history
  • Loading branch information
TheNaeem committed Jul 29, 2022
1 parent ffedb2b commit f429e7c
Show file tree
Hide file tree
Showing 10 changed files with 182 additions and 18 deletions.
2 changes: 1 addition & 1 deletion FModel/Creator/Bases/FN/BaseCommunity.cs
Original file line number Diff line number Diff line change
Expand Up @@ -272,4 +272,4 @@ private void DrawUserFacingFlags(SKCanvas c, bool customOnly)
// draw
}
}
}
}
2 changes: 1 addition & 1 deletion FModel/Creator/Bases/FN/BaseIcon.cs
Original file line number Diff line number Diff line change
Expand Up @@ -281,4 +281,4 @@ private void DrawUserFacingFlags(SKCanvas c)
x += size;
}
}
}
}
122 changes: 122 additions & 0 deletions FModel/Creator/Bases/MV/BaseMultiversusIcon.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
using CUE4Parse.UE4.Assets.Exports;
using CUE4Parse.UE4.Assets.Exports.Material;
using CUE4Parse.UE4.Objects.Core.i18N;
using CUE4Parse.UE4.Objects.Core.Math;
using CUE4Parse.UE4.Objects.UObject;
using FModel.Creator.Bases.FN;
using SkiaSharp;

namespace FModel.Creator.Bases.MV;

public class BaseMultiversusIcon : BaseIcon
{
public BaseMultiversusIcon(UObject uObject, EIconStyle style) : base(uObject, style)
{
}

public override void ParseForInfo()
{
if (Object.TryGetValue<FLinearColor>(out var backgroundColor, "BackgroundColor"))
{
var bgColor = SKColor.Parse(backgroundColor.Hex);
Background = new[] { bgColor, bgColor };
}
else if (Object.TryGetValue<FName>(out var rarity, "Rarity"))
{
Background = GetRarityBackground(rarity.ToString());
Border = new[] { GetRarityBorder(rarity.ToString()) };
}

if (Object.TryGetValue<FLinearColor>(out var nameColor, "DisplayNameColor"))
{
Border = new[] { SKColor.Parse(nameColor.Hex) };
}

if (Object.TryGetValue<FSoftObjectPath>(out var rewardThumbnail, "RewardThumbnail"))
Preview = Utils.GetBitmap(rewardThumbnail);

else if (Object.TryGetValue<FSoftObjectPath>(out var portaitPtr, "CollectionsPortraitMaterial", "CharacterSelectPortraitMaterial")
&& portaitPtr.TryLoad<UMaterialInstanceConstant>(out var portait))
Preview = Utils.GetBitmap(portait);

else if (Object.TryGetValue<FSoftObjectPath[]>(out var skins, "Skins") &&
skins[0].TryLoad(out var defaultSkin) &&
defaultSkin.TryGetValue<FSoftObjectPath>(out var skinRewardThumb, "RewardThumbnail"))
Preview = Utils.GetBitmap(skinRewardThumb);

else if (Object.TryGetValue<FSoftObjectPath>(out var eogPortrait, "EOGPortrait"))
Preview = Utils.GetBitmap(eogPortrait);

if (Object.TryGetValue<FText>(out var displayName, "DisplayName"))
DisplayName = displayName.Text;

if (Object.TryGetValue<FText>(out var description, "Overview", "Bio"))
Description = description.Text;

if (Object.TryGetValue<FText>(out var property, "Property"))
ShortDescription = property.Text;

if (Object.TryGetValue<FName>(out var unlockLocation, "UnlockLocation"))
CosmeticSource = unlockLocation.ToString().Split("::")[1];
}

private static SKColor[] GetRarityBackground(string rarity)
{
string rarityName = rarity.Split("::")[1];

switch (rarityName) // the colors here are the base color and brighter color that the game uses for rarities from the "Rarity to Color" blueprint function
{
case "Common":
return new[]
{
SKColor.Parse(new FLinearColor(0.068478f, 0.651406f, 0.016807f, 1.000000f).Hex),
SKColor.Parse(new FLinearColor(0.081422f, 1.000000f, 0.000000f, 1.000000f).Hex)
};
case "Rare":
return new[]
{
SKColor.Parse(new FLinearColor(0.035911f, 0.394246f, 0.900000f, 1.000000f).Hex),
SKColor.Parse(new FLinearColor(0.033333f, 0.434207f, 1.000000f, 1.000000f).Hex)
};
case "Epic":
return new[]
{
SKColor.Parse(new FLinearColor(0.530391f, 0.060502f, 0.900000f, 1.000000f).Hex),
SKColor.Parse(new FLinearColor(0.579907f, 0.045833f, 1.000000f, 1.000000f).Hex)
};
case "Legendary":
return new[]
{
SKColor.Parse(new FLinearColor(1.000000f, 0.223228f, 0.002428f, 1.000000f).Hex),
SKColor.Parse(new FLinearColor(1.000000f, 0.479320f, 0.030713f, 1.000000f).Hex)
};
case "None":
default:
return new[]
{
SKColor.Parse(new FLinearColor(0.194618f, 0.651406f, 0.630757f, 1.000000f).Hex),
SKColor.Parse(new FLinearColor(0.273627f, 0.955208f, 0.914839f, 1.000000f).Hex)
};
}
}

private static SKColor GetRarityBorder(string rarity)
{
string rarityName = rarity.Split("::")[1];

switch (rarityName) // the colors here are the desaturated versions of the rarity colors
{
case "Common":
return SKColor.Parse(new FLinearColor(0.172713f, 0.651406f, 0.130281f, 1.000000f).Hex);
case "Rare":
return SKColor.Parse(new FLinearColor(0.198220f, 0.527026f, 0.991102f, 1.000000f).Hex);
case "Epic":
return SKColor.Parse(new FLinearColor(0.642017f, 0.198220f, 0.991102f, 1.000000f).Hex);
case "Legendary":
return SKColor.Parse(new FLinearColor(1.000000f, 0.328434f, 0.200000f, 1.000000f).Hex);
case "None":
default:
return SKColor.Parse(new FLinearColor(0.308843f, 0.571125f, 0.557810f, 1.000000f).Hex);
}
}
}
8 changes: 4 additions & 4 deletions FModel/Creator/Bases/UCreator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,13 @@ protected UCreator(UObject uObject, EIconStyle style)
protected readonly SKPaint DisplayNamePaint = new()
{
IsAntialias = true, FilterQuality = SKFilterQuality.High,
Typeface = Utils.Typefaces.DisplayName, TextSize = _NAME_TEXT_SIZE,
Typeface = Utils.Typefaces.DisplayName ?? Utils.Typefaces.Default, TextSize = _NAME_TEXT_SIZE,
Color = SKColors.White, TextAlign = SKTextAlign.Center
};
protected readonly SKPaint DescriptionPaint = new()
{
IsAntialias = true, FilterQuality = SKFilterQuality.High,
Typeface = Utils.Typefaces.Description, TextSize = 13,
Typeface = Utils.Typefaces.Description ?? Utils.Typefaces.Default, TextSize = 13,
Color = SKColors.White
};
protected readonly SKPaint ImagePaint = new()
Expand Down Expand Up @@ -214,7 +214,7 @@ protected void DrawToBottom(SKCanvas c, SKTextAlign side, string text)
switch (side)
{
case SKTextAlign.Left:
_shortDescriptionPaint.Typeface = Utils.Typefaces.Bottom ?? Utils.Typefaces.DisplayName;
_shortDescriptionPaint.Typeface = Utils.Typefaces.Bottom ?? Utils.Typefaces.DisplayName ?? Utils.Typefaces.Default;
var shaper = new CustomSKShaper(_shortDescriptionPaint.Typeface);
shaper.Shape(text, _shortDescriptionPaint);

Expand All @@ -226,4 +226,4 @@ protected void DrawToBottom(SKCanvas c, SKTextAlign side, string text)
break;
}
}
}
}
8 changes: 7 additions & 1 deletion FModel/Creator/CreatorPackage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using FModel.Creator.Bases;
using FModel.Creator.Bases.BB;
using FModel.Creator.Bases.FN;
using FModel.Creator.Bases.MV;
using FModel.Creator.Bases.SB;

namespace FModel.Creator;
Expand Down Expand Up @@ -173,6 +174,11 @@ public bool TryConstructCreator(out UCreator creator)
case "PlaylistUserOptionCollisionProfileEnum":
creator = new BaseUserControl(_object, _style);
return true;
// Multiversus
case "CharacterData":
case "SkinData":
creator = new BaseMultiversusIcon(_object, _style);
return true;
// Battle Breakers
case "WExpGenericAccountItemDefinition":
case "WExpGearAccountItemDefinition":
Expand Down Expand Up @@ -248,4 +254,4 @@ public void Dispose()
{
_object = null;
}
}
}
27 changes: 25 additions & 2 deletions FModel/Creator/Typefaces.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;
using System.IO;
using System.Windows;
using CUE4Parse.UE4.Versions;
Expand Down Expand Up @@ -41,6 +41,11 @@ public class Typefaces
private const string _BURBANK_SMALL_BLACK = "burbanksmall-black";
private const string _BURBANK_SMALL_BOLD = "burbanksmall-bold";

// Multiversus
private const string _MULTIVERSUS_BASE_PATH = "/Game/Panda_Main/UI/Fonts/";
private const string _MONTSERRAT_BOLD = "Montserrat/Montserrat-Bold";
private const string _VCCARDINAL_CONDENSED_BOLDITALIC_ITALIC = "VCCardinal/VCCardinalCondensed-BoldItalic";

// Spellbreak
private const string _SPELLBREAK_BASE_PATH = "/Game/UI/Fonts/";
private const string _MONTSERRAT_SEMIBOLD = "Montserrat-Semibold";
Expand Down Expand Up @@ -264,6 +269,24 @@ public Typefaces(CUE4ParseViewModel viewModel)
}
else Description = Default;

break;
}
case FGame.Multiversus:
{
if (viewModel.Provider.TrySaveAsset(_MULTIVERSUS_BASE_PATH + _VCCARDINAL_CONDENSED_BOLDITALIC_ITALIC + _EXT, out data))
{
var m = new MemoryStream(data) { Position = 0 };
DisplayName = SKTypeface.FromStream(m);
}
else DisplayName = Default;

if (viewModel.Provider.TrySaveAsset(_MULTIVERSUS_BASE_PATH + _MONTSERRAT_BOLD + _EXT, out data))
{
var m = new MemoryStream(data) { Position = 0 };
Description = SKTypeface.FromStream(m);
}
else Description = Default;

break;
}
}
Expand All @@ -275,4 +298,4 @@ public SKTypeface OnTheFly(string path)
var m = new MemoryStream(data) { Position = 0 };
return SKTypeface.FromStream(m);
}
}
}
3 changes: 2 additions & 1 deletion FModel/Creator/Utils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ public static SKBitmap GetBitmap(UMaterialInstanceConstant material)
switch (textureParameter.ParameterInfo.Name.Text)
{
case "MainTex":
case "Texture":
case "TextureA":
case "TextureB":
case "OfferImage":
Expand Down Expand Up @@ -391,4 +392,4 @@ public static List<string> SplitLines(string text, SKPaint paint, float maxWidth

return ret;
}
}
}
8 changes: 5 additions & 3 deletions FModel/Enums.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System.ComponentModel;
using System.ComponentModel;

namespace FModel;

Expand Down Expand Up @@ -91,7 +91,9 @@ public enum FGame
[Description("GTA: The Trilogy - Definitive Edition")]
Gameface,
[Description("Sea of Thieves")]
Athena
Athena,
[Description("Multiversus")]
Multiversus
}

public enum ELoadingMode
Expand Down Expand Up @@ -138,4 +140,4 @@ public enum EIconStyle
Cataba,
// [Description("Community")]
// CommunityMade
}
}
2 changes: 1 addition & 1 deletion FModel/FModel.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<IsPackable>false</IsPackable>
<IsPublishable>true</IsPublishable>
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
<PublishSingleFile Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">true</PublishSingleFile>
<PublishSingleFile Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">false</PublishSingleFile>
<IncludeNativeLibrariesForSelfExtract>true</IncludeNativeLibrariesForSelfExtract>
<StartupObject>FModel.App</StartupObject>
</PropertyGroup>
Expand Down
18 changes: 14 additions & 4 deletions FModel/Settings/UserSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,8 @@ public bool SaveMorphTargets
{FGame.TslGame, Constants._NO_PRESET_TRIGGER},
{FGame.PortalWars, Constants._NO_PRESET_TRIGGER},
{FGame.Gameface, Constants._NO_PRESET_TRIGGER},
{FGame.Athena, Constants._NO_PRESET_TRIGGER}
{FGame.Athena, Constants._NO_PRESET_TRIGGER},
{FGame.Multiversus, Constants._NO_PRESET_TRIGGER}
};
public IDictionary<FGame, string> Presets
{
Expand Down Expand Up @@ -314,7 +315,8 @@ public IDictionary<FGame, string> Presets
{FGame.TslGame, EGame.GAME_PlayerUnknownsBattlegrounds},
{FGame.PortalWars, EGame.GAME_UE4_LATEST},
{FGame.Gameface, EGame.GAME_GTATheTrilogyDefinitiveEdition},
{FGame.Athena, EGame.GAME_SeaOfThieves}
{FGame.Athena, EGame.GAME_SeaOfThieves},
{FGame.Multiversus, EGame.GAME_UE4_LATEST}
};
public IDictionary<FGame, EGame> OverridedGame
{
Expand Down Expand Up @@ -342,7 +344,8 @@ public IDictionary<FGame, EGame> OverridedGame
{FGame.TslGame, null},
{FGame.PortalWars, null},
{FGame.Gameface, null},
{FGame.Athena, null}
{FGame.Athena, null},
{FGame.Multiversus, null}
};
public IDictionary<FGame, List<FCustomVersion>> OverridedCustomVersions
{
Expand Down Expand Up @@ -370,7 +373,8 @@ public IDictionary<FGame, List<FCustomVersion>> OverridedCustomVersions
{FGame.TslGame, null},
{FGame.PortalWars, null},
{FGame.Gameface, null},
{FGame.Athena, null}
{FGame.Athena, null},
{FGame.Multiversus, null}
};
public IDictionary<FGame, Dictionary<string, bool>> OverridedOptions
{
Expand Down Expand Up @@ -435,6 +439,12 @@ public IDictionary<FGame, Dictionary<string, bool>> OverridedOptions
new("Strings", "g3/Content/Localization/")
}
},
{
FGame.Multiversus, new List<CustomDirectory>()
{
new("Characters", "MultiVersus/Content/Panda_Main/Characters/")
}
},
{FGame.StateOfDecay2, new List<CustomDirectory>()},
{FGame.Prospect, new List<CustomDirectory>()},
{FGame.Indiana, new List<CustomDirectory>()},
Expand Down

0 comments on commit f429e7c

Please sign in to comment.