34 lines
925 B
C#
34 lines
925 B
C#
|
|
using BepInEx.Unity.IL2CPP.UnityEngine;
|
|
using MyBox;
|
|
using UnityEngine;
|
|
|
|
namespace AutoPriceUpdater;
|
|
public class Behaviour : MonoBehaviour
|
|
{
|
|
private static bool Once = false;
|
|
private void Start()
|
|
{
|
|
Plugin.Log.LogInfo("AutoPriceUpdater Behaviour started.");
|
|
int num = Singleton<IDManager>.Instance.Products.Count - Singleton<SaveManager>.Instance.Price.PricesSetByPlayer.Count;
|
|
if (num > 0)
|
|
{
|
|
Plugin.Log.LogWarning($"There are {num} products without player-set prices. Updating prices...");
|
|
Plugin.SetMissingPrices();
|
|
}
|
|
Plugin.UpdatePrice();
|
|
}
|
|
|
|
private void Update()
|
|
{
|
|
if(Input.GetKeyInt(Plugin.UpdateKey.Value) && !Once)
|
|
{
|
|
Plugin.UpdatePrice();
|
|
Once = true;
|
|
}
|
|
else if(!Input.GetKeyInt(Plugin.UpdateKey.Value) && Once)
|
|
{
|
|
Once = false;
|
|
}
|
|
}
|
|
} |