fix SounManager

This commit is contained in:
Lev 2024-08-18 12:47:13 +03:00
parent 3ec0069f75
commit a69f133d0a
2 changed files with 14 additions and 4 deletions

View file

@ -54,7 +54,8 @@ namespace ZoFo.GameCore.GameManagers.NetworkManager
public static IPAddress GetIp() public static IPAddress GetIp()
{ {
string hostName = Dns.GetHostName(); // Retrive the Name of HOST string hostName = Dns.GetHostName(); // Retrive the Name of HOST
string myIP = Dns.GetHostByName(hostName).AddressList[1].ToString();// Get the IP var ipList =Dns.GetHostByName(hostName).AddressList;
string myIP = ipList[ipList.Count()-1].ToString();// Get the IP
return IPAddress.Parse(myIP); return IPAddress.Parse(myIP);
} }

View file

@ -9,6 +9,7 @@ using System.Linq;
using Newtonsoft.Json; using Newtonsoft.Json;
using Microsoft.Xna.Framework.Media; using Microsoft.Xna.Framework.Media;
using System.Runtime.InteropServices;
namespace ZoFo.GameCore.GameManagers namespace ZoFo.GameCore.GameManagers
{ {
@ -22,8 +23,16 @@ namespace ZoFo.GameCore.GameManagers
{ {
//List<string> sounds = AppManager.Instance.Content.Load<List<string>>("sounds/"); //List<string> sounds = AppManager.Instance.Content.Load<List<string>>("sounds/");
var k = Directory.GetFiles(Directory.GetCurrentDirectory() + "//Content//sounds").Where(x => x.EndsWith("xnb")); string a = Path.Combine("Content", "sounds");
if (k.Count() > 0) string[] k;
if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
{
k = Directory.GetFiles(Path.Combine("bin", "Debug", "net8.0", "Content", "sounds")).Where(x => x.EndsWith("xnb")).ToArray();
}
else{
k = Directory.GetFiles(Path.Combine(Directory.GetCurrentDirectory(), "Content", "sounds")).Where(x => x.EndsWith("xnb")).ToArray();
}
if (k.Length > 0)
{ {
string[] soundFiles = k.Select(x => x.Split("\\").Last().Split("/").Last().Replace(".xnb", "")).ToArray();// папка со звуками там где exe string[] soundFiles = k.Select(x => x.Split("\\").Last().Split("/").Last().Replace(".xnb", "")).ToArray();// папка со звуками там где exe