Small changes
This commit is contained in:
@ -26,12 +26,12 @@ namespace CoopClient
|
|||||||
|
|
||||||
public static Settings MainSettings = Util.ReadSettings();
|
public static Settings MainSettings = Util.ReadSettings();
|
||||||
public static ObjectPool MainMenuPool = new ObjectPool();
|
public static ObjectPool MainMenuPool = new ObjectPool();
|
||||||
public static NativeMenu MainMenu = new NativeMenu("GTACoop:R", CurrentModVersion.Replace("_", "."))
|
public static NativeMenu MainMenu = new NativeMenu("GTACOOP:R", CurrentModVersion.Replace("_", "."))
|
||||||
{
|
{
|
||||||
UseMouse = false,
|
UseMouse = false,
|
||||||
Alignment = MainSettings.FlipMenu ? GTA.UI.Alignment.Right : GTA.UI.Alignment.Left
|
Alignment = MainSettings.FlipMenu ? GTA.UI.Alignment.Right : GTA.UI.Alignment.Left
|
||||||
};
|
};
|
||||||
public static NativeMenu MainSettingsMenu = new NativeMenu("GTACoop:R", "Settings", "Go to the settings")
|
public static NativeMenu MainSettingsMenu = new NativeMenu("GTACOOP:R", "Settings", "Go to the settings")
|
||||||
{
|
{
|
||||||
UseMouse = false,
|
UseMouse = false,
|
||||||
Alignment = MainSettings.FlipMenu ? GTA.UI.Alignment.Right : GTA.UI.Alignment.Left
|
Alignment = MainSettings.FlipMenu ? GTA.UI.Alignment.Right : GTA.UI.Alignment.Left
|
||||||
@ -82,7 +82,6 @@ namespace CoopClient
|
|||||||
serverIpItem.AltTitle = newServerIp;
|
serverIpItem.AltTitle = newServerIp;
|
||||||
MainMenuPool.RefreshAll();
|
MainMenuPool.RefreshAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
NativeItem serverConnectItem = new NativeItem("Connect");
|
NativeItem serverConnectItem = new NativeItem("Connect");
|
||||||
@ -98,11 +97,12 @@ namespace CoopClient
|
|||||||
};
|
};
|
||||||
shareNpcsItem.Enabled = false;
|
shareNpcsItem.Enabled = false;
|
||||||
|
|
||||||
NativeSliderItem streamedNpcsItem = new NativeSliderItem("Streamed Npcs", 20, MainSettings.StreamedNpc);
|
NativeSliderItem streamedNpcsItem = new NativeSliderItem(string.Format("Streamed Npcs ({0})", MainSettings.StreamedNpc), 20, MainSettings.StreamedNpc);
|
||||||
streamedNpcsItem.ValueChanged += (item, value) =>
|
streamedNpcsItem.ValueChanged += (item, value) =>
|
||||||
{
|
{
|
||||||
MainSettings.StreamedNpc = streamedNpcsItem.Value;
|
MainSettings.StreamedNpc = streamedNpcsItem.Value;
|
||||||
Util.SaveSettings();
|
Util.SaveSettings();
|
||||||
|
streamedNpcsItem.Title = string.Format("Streamed Npcs ({0})", MainSettings.StreamedNpc);
|
||||||
};
|
};
|
||||||
|
|
||||||
NativeCheckboxItem flipMenuItem = new NativeCheckboxItem("Flip menu", MainSettings.FlipMenu);
|
NativeCheckboxItem flipMenuItem = new NativeCheckboxItem("Flip menu", MainSettings.FlipMenu);
|
||||||
@ -115,7 +115,7 @@ namespace CoopClient
|
|||||||
Util.SaveSettings();
|
Util.SaveSettings();
|
||||||
};
|
};
|
||||||
|
|
||||||
NativeItem aboutItem = new NativeItem("About", "~g~GTACoop~s~:~b~R ~s~by ~o~EntenKoeniq")
|
NativeItem aboutItem = new NativeItem("About", "~g~GTACOOP~s~:~b~R ~s~by EntenKoeniq")
|
||||||
{
|
{
|
||||||
LeftBadge = new LemonUI.Elements.ScaledTexture("commonmenu", "shop_new_star")
|
LeftBadge = new LemonUI.Elements.ScaledTexture("commonmenu", "shop_new_star")
|
||||||
};
|
};
|
||||||
@ -262,7 +262,7 @@ namespace CoopClient
|
|||||||
DebugSyncPed = Players["DebugKey"];
|
DebugSyncPed = Players["DebugKey"];
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((Environment.TickCount - ArtificialLagCounter) < 42)
|
if ((Environment.TickCount - ArtificialLagCounter) < 247)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -298,6 +298,8 @@ namespace CoopClient
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
Vehicle veh = player.CurrentVehicle;
|
Vehicle veh = player.CurrentVehicle;
|
||||||
|
veh.Opacity = 75;
|
||||||
|
|
||||||
flags = Util.GetVehicleFlags(player, veh, FullDebugSync);
|
flags = Util.GetVehicleFlags(player, veh, FullDebugSync);
|
||||||
|
|
||||||
DebugSyncPed.VehicleModelHash = veh.Model.Hash;
|
DebugSyncPed.VehicleModelHash = veh.Model.Hash;
|
||||||
|
@ -67,10 +67,12 @@ namespace CoopServer
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
HttpClient httpClient = new();
|
||||||
|
|
||||||
IpInfo info;
|
IpInfo info;
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
using HttpClient httpClient = new();
|
|
||||||
string data = await httpClient.GetStringAsync("https://ipinfo.io/json");
|
string data = await httpClient.GetStringAsync("https://ipinfo.io/json");
|
||||||
|
|
||||||
info = JsonConvert.DeserializeObject<IpInfo>(data);
|
info = JsonConvert.DeserializeObject<IpInfo>(data);
|
||||||
@ -81,22 +83,21 @@ namespace CoopServer
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool responseError = false;
|
bool responseError = false;
|
||||||
HttpClient client = new();
|
|
||||||
|
|
||||||
while (!responseError)
|
while (!responseError)
|
||||||
{
|
{
|
||||||
string msg =
|
string msg =
|
||||||
"{ " +
|
"{ " +
|
||||||
"\"port\": \"" + Server.MainSettings.ServerPort + "\", " +
|
"\"port\": \"" + MainSettings.ServerPort + "\", " +
|
||||||
"\"name\": \"" + Server.MainSettings.ServerName + "\", " +
|
"\"name\": \"" + MainSettings.ServerName + "\", " +
|
||||||
"\"version\": \"" + Server.CurrentModVersion.Replace("_", ".") + "\", " +
|
"\"version\": \"" + CurrentModVersion.Replace("_", ".") + "\", " +
|
||||||
"\"players\": \"" + Server.MainNetServer.ConnectionsCount + "\", " +
|
"\"players\": \"" + MainNetServer.ConnectionsCount + "\", " +
|
||||||
"\"maxPlayers\": \"" + Server.MainSettings.MaxPlayers + "\", " +
|
"\"maxPlayers\": \"" + MainSettings.MaxPlayers + "\", " +
|
||||||
"\"allowlist\": \"" + Server.MainSettings.Allowlist + "\", " +
|
"\"allowlist\": \"" + MainSettings.Allowlist + "\", " +
|
||||||
"\"country\": \"" + info.Country + "\"" +
|
"\"country\": \"" + info.Country + "\"" +
|
||||||
" }";
|
" }";
|
||||||
|
|
||||||
HttpResponseMessage response = await client.PostAsync(Server.MainSettings.MasterServer, new StringContent(msg, Encoding.UTF8, "application/json"));
|
HttpResponseMessage response = await httpClient.PostAsync(MainSettings.MasterServer, new StringContent(msg, Encoding.UTF8, "application/json"));
|
||||||
|
|
||||||
string responseContent = await response.Content.ReadAsStringAsync();
|
string responseContent = await response.Content.ReadAsStringAsync();
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user