Skip to content

Commit

Permalink
src: performance update
Browse files Browse the repository at this point in the history
v0.2.4
  • Loading branch information
Maicarons committed Jun 10, 2024
1 parent f5a481a commit 17cefb9
Show file tree
Hide file tree
Showing 5 changed files with 436 additions and 411 deletions.
25 changes: 11 additions & 14 deletions Plugin.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using System;
using System.Collections.Generic;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using BepInEx;
Expand All @@ -10,7 +9,6 @@
using HarmonyLib;
using BepInEx.Configuration;
using RealAirplaneTag;
using Logger = BepInEx.Logging.Logger;
using Random = System.Random;


Expand All @@ -24,7 +22,7 @@ public class Plugin : BaseUnityPlugin
public const string GUID = MyPluginInfo.PLUGIN_GUID;
public const string PluginName = MyPluginInfo.PLUGIN_NAME;
public const string Version = MyPluginInfo.PLUGIN_VERSION;
private ConfigEntry<bool> Enabled;
public ConfigEntry<bool> Enabled;
ConfigFile config = new ConfigFile(Path.Combine(Paths.ConfigPath, $"{MyPluginInfo.PLUGIN_GUID}.cfg"), true);
private void Awake()
{
Expand Down Expand Up @@ -54,7 +52,7 @@ private void OnSceneLoaded(Scene scene, LoadSceneMode mode)
Logger.LogInfo($"Scene loaded: {scene.name}");
Logger.LogInfo("scene.path: "+scene.path);

if ((scene.name == "MapPlayer" || scene.name == "London" ) &&
if ((scene.name == "MapPlayer" || scene.name == "London" ||scene.name == "CreatorPlayer" ) &&
AircraftManager.Instance != null && Enabled.Value)
{
Logger.LogInfo("MapManager.mapName: "+MapManager.mapName);
Expand Down Expand Up @@ -105,6 +103,7 @@ void Start()
planeID.Add(m_Aircraft.GetInstanceID(), GetRandomTags());
info = planeID[m_Aircraft.GetInstanceID()];
inited = true;
m_Text.text = $"{info.CallSign} | {info.AirType} | {LevelToName(info.SizeOfPlane)} \n";
}

private PlaneTag GetRandomTags()
Expand All @@ -131,17 +130,15 @@ private PlaneTag GetRandomTags()

void Update()
{
if (!m_Aircraft)
//planeID.Remove(m_Aircraft.GetInstanceID());
if (!m_Aircraft) {
planeID.Remove(m_Aircraft.GetInstanceID());
Destroy(gameObject);

}
if (!inited || !m_Text)
{
return;
}

//var info = planeID[m_Aircraft.GetInstanceID()];
m_Text.text = $"{info.CallSign} | {info.AirType} | {LevelToName(info.SizeOfPlane)} \n";

}

private string LevelToName(int i)
Expand Down Expand Up @@ -180,7 +177,7 @@ private string LevelToName(int i)

public class GlobalSettings
{
public static Dictionary<string, Map> AllMaps = Map.FromJson(GetRes.GetFromRes(".res.map.json"));
public static Dictionary<string, string> FlightNo = JsonHelper.ConvertJsonToDictionaryFlightNo(GetRes.GetFromRes(".res.FlightNo.json"));
public static Dictionary<string, PlaneType> PlaneTypes = PlaneType.FromJson(GetRes.GetFromRes(".res.plane.json"));
public static readonly Dictionary<string, Map> AllMaps = Map.FromJson(GetRes.GetFromRes(".res.map.json"));
public static readonly Dictionary<string, string> FlightNo = JsonHelper.ConvertJsonToDictionaryFlightNo(GetRes.GetFromRes(".res.FlightNo.json"));
public static readonly Dictionary<string, PlaneType> PlaneTypes = PlaneType.FromJson(GetRes.GetFromRes(".res.plane.json"));
}
2 changes: 1 addition & 1 deletion RealAirplaneTag.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<TargetFramework>netstandard2.1</TargetFramework>
<AssemblyName>RealAirplaneTag</AssemblyName>
<Description>RealAirplaneTag</Description>
<Version>0.2.3</Version>
<Version>0.2.4</Version>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<LangVersion>latest</LangVersion>
<RestoreAdditionalProjectSources>
Expand Down
15 changes: 15 additions & 0 deletions res/FlightNo.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,19 @@
{


"F16":"F16",
"F22":"F22",
"C130":"C130",
"P3":"P3",









"CFE8472": "E190",
"SWR456": "BCS1",
"KLC985": "E190",
Expand Down
4 changes: 4 additions & 0 deletions res/map.json
Original file line number Diff line number Diff line change
Expand Up @@ -488,5 +488,9 @@
"BA8463",
"LG4592"
]
},
"AirWar_": {
"arrivals": ["C130", "P3"],
"departures": [ "F16", "F22"]
}
}
Loading

0 comments on commit 17cefb9

Please sign in to comment.