Skip to content

Commit

Permalink
Merge branch 'dev' into refactor/ui-rewrite
Browse files Browse the repository at this point in the history
  • Loading branch information
thomotron committed Nov 5, 2022
2 parents 397c04e + 3ea3b32 commit 835e62d
Show file tree
Hide file tree
Showing 19 changed files with 162 additions and 101 deletions.
3 changes: 3 additions & 0 deletions .github/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,9 @@ The client project depends on several assemblies from RimWorld's data directory

All of these need to be present in the `GameDlls/` directory to build the client project. Either copy them in directly or make a symbolic link.

If building for multiple game versions, you can also create a directory for the version under `GameDlls/` and place that version's dependencies in there (e.g. `GameDlls/1.3/...`).
These will be preferred when building if they exist, otherwise the files in `GameDlls/` will be used.

If you only want to build the common projects and/or the server project, you can build the solution using the `TravisCI` build profile which does not require the game assemblies.

### Protobuf for Packet Compilation
Expand Down
2 changes: 1 addition & 1 deletion Client/About/About.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
A total rewrite of Longwelwind's Phi chat mod for RimWorld that allows players to chat and trade items with each other within the game.
</description>
<supportedVersions>
<li>1.2</li>
<li>1.3</li>
<li>1.4</li>
</supportedVersions>
<modDependencies>
<li>
Expand Down
9 changes: 5 additions & 4 deletions Client/Source/Client.cs
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ public bool ShowBlockedTrades
/// Queue of sounds to play on the next frame.
/// Necessary because sounds are only played on the main Unity thread.
/// </summary>
private Queue<SoundDef> soundQueue = new Queue<SoundDef>();
private List<SoundDef> soundQueue = new List<SoundDef>();
/// <summary>
/// Lock object to prevent race conditions when accessing soundQueue.
/// </summary>
Expand Down Expand Up @@ -429,7 +429,7 @@ public override void Initialize()
{
// Add a little tick noise to the sound queue
// (queue is necessary because sounds only play on the main Unity thread)
soundQueue.Enqueue(SoundDefOf.Tick_Tiny);
soundQueue.Add(SoundDefOf.Tick_Tiny);
}
}
};
Expand Down Expand Up @@ -620,10 +620,11 @@ public override void Update()
lock (soundQueueLock)
{
// Check if we have sounds to play
while (soundQueue.Count > 0)
while (soundQueue.Any())
{
// Dequeue and play a sound
soundQueue.Dequeue().PlayOneShotOnCamera();
SoundDef sound = soundQueue.Pop();
sound.PlayOneShotOnCamera();
}
}
}
Expand Down
43 changes: 27 additions & 16 deletions Client/Source/Client.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<GameVersion>$(Configuration.Split(" ")[1])</GameVersion>
<ProjectGuid>{EE778185-FDC1-401F-80ED-5FCA6166DD4D}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
Expand All @@ -12,7 +13,19 @@
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<Choose>
<When Condition="Exists('$(SolutionDir)\GameDlls\$(GameVersion)')">
<PropertyGroup>
<RimWorldDepDir>$(SolutionDir)\GameDlls\$(GameVersion)</RimWorldDepDir>
</PropertyGroup>
</When>
<Otherwise>
<PropertyGroup>
<RimWorldDepDir>$(SolutionDir)\GameDlls</RimWorldDepDir>
</PropertyGroup>
</Otherwise>
</Choose>
<PropertyGroup Condition=" $(Configuration.StartsWith('Debug')) And '$(Platform)' == 'AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
Expand All @@ -21,7 +34,7 @@
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PropertyGroup Condition=" $(Configuration.StartsWith('Release')) And '$(Platform)' == 'AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
Expand All @@ -37,16 +50,14 @@
</AssemblyOriginatorKeyFile>
</PropertyGroup>
<ItemGroup>
<Reference Include="0Harmony, Version=2.1.0.0, Culture=neutral, PublicKeyToken=null">
<HintPath>..\..\.nuget\Lib.Harmony.2.1.0\lib\net472\0Harmony.dll</HintPath>
<Private>True</Private>
<Reference Include="0Harmony, Version=2.2.2.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\.nuget\Lib.Harmony.2.2.2\lib\net472\0Harmony.dll</HintPath>
</Reference>
<Reference Include="Assembly-CSharp">
<HintPath>..\..\GameDlls\Assembly-CSharp.dll</HintPath>
<HintPath>$(RimWorldDepDir)\Assembly-CSharp.dll</HintPath>
</Reference>
<Reference Include="HugsLib, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null">
<HintPath>..\..\.nuget\UnlimitedHugs.Rimworld.HugsLib.9.0.0\lib\net472\HugsLib.dll</HintPath>
<Private>True</Private>
<Reference Include="HugsLib, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\.nuget\UnlimitedHugs.Rimworld.HugsLib.10.0.1\lib\net472\HugsLib.dll</HintPath>
</Reference>
<Reference Include="mscorlib" />
<Reference Include="System" />
Expand All @@ -57,16 +68,16 @@
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Xml" />
<Reference Include="UnityEngine">
<HintPath>..\..\GameDlls\UnityEngine.dll</HintPath>
<HintPath>$(RimWorldDepDir)\UnityEngine.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.CoreModule, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null">
<HintPath>..\..\GameDlls\UnityEngine.CoreModule.dll</HintPath>
<HintPath>$(RimWorldDepDir)\UnityEngine.CoreModule.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.IMGUIModule, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null">
<HintPath>..\..\GameDlls\UnityEngine.IMGUIModule.dll</HintPath>
<HintPath>$(RimWorldDepDir)\UnityEngine.IMGUIModule.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.TextRenderingModule, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null">
<HintPath>..\..\GameDlls\UnityEngine.TextRenderingModule.dll</HintPath>
<HintPath>$(RimWorldDepDir)\UnityEngine.TextRenderingModule.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
Expand Down Expand Up @@ -164,7 +175,7 @@
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Target Name="Clean">
<RemoveDir Directories="$(SolutionDir)\Client\Common\Assemblies\" />
<RemoveDir Directories="$(SolutionDir)\Client\1.3\Assemblies\" />
<RemoveDir Directories="$(SolutionDir)\Client\$(GameVersion)\Assemblies\" />
</Target>
<Target Name="AfterBuild">
<Copy SourceFiles="$(TargetDir)\LiteNetLib.dll" DestinationFiles="$(SolutionDir)\Client\Common\Assemblies\1-LiteNetLib.dll" />
Expand All @@ -175,6 +186,6 @@
<Copy SourceFiles="$(TargetDir)\UserManagement.dll" DestinationFiles="$(SolutionDir)\Client\Common\Assemblies\6-UserManagement.dll" />
<Copy SourceFiles="$(TargetDir)\Chat.dll" DestinationFiles="$(SolutionDir)\Client\Common\Assemblies\7-Chat.dll" />
<Copy SourceFiles="$(TargetDir)\Trading.dll" DestinationFiles="$(SolutionDir)\Client\Common\Assemblies\8-Trading.dll" />
<Copy SourceFiles="$(TargetDir)\PhinixClient.dll" DestinationFiles="$(SolutionDir)\Client\1.3\Assemblies\9-PhinixClient.dll" />
<Copy SourceFiles="$(TargetDir)\PhinixClient.dll" DestinationFiles="$(SolutionDir)\Client\$(GameVersion)\Assemblies\9-PhinixClient.dll" />
</Target>
</Project>
</Project>
6 changes: 6 additions & 0 deletions Client/Source/GUI/Compound Widgets/ItemStackRow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,9 @@ public ItemStackRow(StackedThings itemStack, bool interactive = false, bool alte
/// <inheritdoc />
public override void Draw(Rect container)
{
// Don't draw empty item stacks
if (itemStack is null || !itemStack.Things.Any()) return;

// Background
if (alternateBackground) Widgets.DrawHighlight(container);

Expand Down Expand Up @@ -265,6 +268,9 @@ public override void Draw(Rect container)
/// <inheritdoc />
public override float CalcHeight(float width)
{
// Don't draw empty item stacks
if (itemStack is null || !itemStack.Things.Any()) return 0;

// Get the text we will be calculating the height of
string text = itemStack.Things.First().Label.CapitalizeFirst();

Expand Down
5 changes: 3 additions & 2 deletions Client/Source/GUI/Containers/VerticalScrollContainer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,13 @@ internal class VerticalScrollContainer : Displayable
/// <summary>
/// Scroll position of the container.
/// </summary>
private Vector2 scrollPosition = Vector2.zero;
private Vector2 scrollPosition;

public VerticalScrollContainer(Displayable child, Action<Vector2> onScroll = null)
public VerticalScrollContainer(Displayable child, Action<Vector2> onScroll = null, Vector2 initialScrollPosition = default)
{
this.child = child;
this.onScroll = onScroll;
this.scrollPosition = initialScrollPosition;
}

/// <inheritdoc />
Expand Down
2 changes: 1 addition & 1 deletion Client/Source/GUI/Windows and panels/TradeWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -386,4 +386,4 @@ private void drawItemStackList(Rect inRect, List<StackedThings> stacks, ref Vect
Widgets.EndScrollView();
}
}
}
}
4 changes: 2 additions & 2 deletions Client/Source/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.8.1.0")]
[assembly: AssemblyFileVersion("0.8.1.0")]
[assembly: AssemblyVersion("0.8.3.0")]
[assembly: AssemblyFileVersion("0.8.3.0")]
4 changes: 2 additions & 2 deletions Client/Source/packages.config
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Lib.Harmony" version="2.1.0" targetFramework="net472" />
<package id="UnlimitedHugs.Rimworld.HugsLib" version="9.0.0" targetFramework="net472" />
<package id="Lib.Harmony" version="2.2.2" targetFramework="net472" />
<package id="UnlimitedHugs.Rimworld.HugsLib" version="10.0.1" targetFramework="net472" />
</packages>
7 changes: 4 additions & 3 deletions Client/versions.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
<loadFolders>
<v1.2>
<li>1.2</li>
</v1.2>
<v1.3>
<li>Common</li>
<li>1.3</li>
</1.3>
<v1.4>
<li>Common</li>
<li>1.4</li>
</1.4>
</loadFolders>
4 changes: 2 additions & 2 deletions Common/Authentication/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.8.1.0")]
[assembly: AssemblyFileVersion("0.8.1.0")]
[assembly: AssemblyVersion("0.8.3.0")]
[assembly: AssemblyFileVersion("0.8.3.0")]
4 changes: 2 additions & 2 deletions Common/Chat/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.8.1.0")]
[assembly: AssemblyFileVersion("0.8.1.0")]
[assembly: AssemblyVersion("0.8.3.0")]
[assembly: AssemblyFileVersion("0.8.3.0")]
4 changes: 2 additions & 2 deletions Common/Connections/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.8.1.0")]
[assembly: AssemblyFileVersion("0.8.1.0")]
[assembly: AssemblyVersion("0.8.3.0")]
[assembly: AssemblyFileVersion("0.8.3.0")]
4 changes: 2 additions & 2 deletions Common/Trading/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.8.1.0")]
[assembly: AssemblyFileVersion("0.8.1.0")]
[assembly: AssemblyVersion("0.8.3.0")]
[assembly: AssemblyFileVersion("0.8.3.0")]
4 changes: 2 additions & 2 deletions Common/UserManagement/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.8.1.0")]
[assembly: AssemblyFileVersion("0.8.1.0")]
[assembly: AssemblyVersion("0.8.3.0")]
[assembly: AssemblyFileVersion("0.8.3.0")]
4 changes: 2 additions & 2 deletions Common/Utils/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.8.1.0")]
[assembly: AssemblyFileVersion("0.8.1.0")]
[assembly: AssemblyVersion("0.8.3.0")]
[assembly: AssemblyFileVersion("0.8.3.0")]
Loading

0 comments on commit 835e62d

Please sign in to comment.