(f0d812055) v0.9.9.0

This commit is contained in:
Joonas Rikkonen
2020-04-23 19:19:37 +03:00
parent b647059b93
commit ac37a3b0e4
391 changed files with 15054 additions and 5420 deletions
@@ -1,6 +1,8 @@
using System;
using Microsoft.Xna.Framework;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
#if USE_STEAM
namespace Barotrauma.Steam
@@ -19,6 +21,8 @@ namespace Barotrauma.Steam
public const string MetadataFileName = "filelist.xml";
public const string CopyIndicatorFileName = ".copying";
private static readonly Dictionary<string, int> tagCommonness = new Dictionary<string, int>()
{
{ "submarine", 10 },
@@ -45,7 +49,7 @@ namespace Barotrauma.Steam
private static bool isInitialized;
public static bool IsInitialized => isInitialized;
public static void Initialize()
{
InitializeProjectSpecific();
@@ -70,27 +74,28 @@ namespace Barotrauma.Steam
return Steamworks.SteamClient.Name;
}
public static void OverlayCustomURL(string url)
{
if (!isInitialized || !Steamworks.SteamClient.IsValid)
{
return;
}
Steamworks.SteamFriends.OpenWebOverlay(url);
}
public static bool UnlockAchievement(string achievementName)
public static bool OverlayCustomURL(string url)
{
if (!isInitialized || !Steamworks.SteamClient.IsValid)
{
return false;
}
DebugConsole.Log("Unlocked achievement \"" + achievementName + "\"");
Steamworks.SteamFriends.OpenWebOverlay(url);
return true;
}
public static bool UnlockAchievement(string achievementIdentifier)
{
if (!isInitialized || !Steamworks.SteamClient.IsValid)
{
return false;
}
DebugConsole.Log("Unlocked achievement \"" + achievementIdentifier + "\"");
var achievements = Steamworks.SteamUserStats.Achievements.ToList();
int achIndex = achievements.FindIndex(ach => ach.Name == achievementName);
int achIndex = achievements.FindIndex(ach => ach.Identifier == achievementIdentifier);
bool unlocked = achIndex >= 0 ? achievements[achIndex].Trigger() : false;
if (!unlocked)
{
@@ -99,7 +104,7 @@ namespace Barotrauma.Steam
//(discovered[whateverbiomewasentered], kill[withwhateveritem], kill[somemonster] etc) so that we can add
//some types of new achievements without the need for client-side changes.
#if DEBUG
DebugConsole.NewMessage("Failed to unlock achievement \"" + achievementName + "\".");
DebugConsole.NewMessage("Failed to unlock achievement \"" + achievementIdentifier + "\".");
#endif
}