87 lines
No EOL
2.7 KiB
C#
87 lines
No EOL
2.7 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using UnityEngine;
|
|
using TMPro;
|
|
using UnityEngine.UI;
|
|
using BepInEx.Configuration;
|
|
|
|
|
|
/*
|
|
namespace ScarletMansion {
|
|
public class MainMenuUpdate : MonoBehaviour {
|
|
|
|
public static readonly string mainMessage = "The Scarlet Devil Mansion mod has updated the default values used in the config. Please click the button below to apply the new values. If this mod is part of a mod pack, it's probably best to ignore this and use the values set by the mod pack.\n\nThis window will not appear again, but the default values can still be found in the config.";
|
|
public static readonly string version1Message = "These new values and many internal changes to the dungeon's generation were made to reduce load times by about 80% on average.";
|
|
|
|
public const int version = 2;
|
|
public static readonly string savePath = "LCGeneralSaveData";
|
|
public static readonly string prefsKey = "SDM_MainMenu";
|
|
|
|
[Header("References")]
|
|
public Canvas canvas;
|
|
public TextMeshProUGUI textMesh;
|
|
public Button denyButton;
|
|
public Button acceptButton;
|
|
|
|
public ChangeList mainMenuChanges = new ChangeList(
|
|
"MainMenu",
|
|
new ChangeInt ( PluginConfig.dunGenWidthBase ) ,
|
|
new ChangeInt ( PluginConfig.dunGenLengthBase ) ,
|
|
new ChangeFloat ( PluginConfig.dunGenWidthMultiFactor ) ,
|
|
new ChangeFloat ( PluginConfig.dunGenLengthMultiFactor ) ,
|
|
new ChangeInt ( PluginConfig.hallwayLightsWeight ) ,
|
|
new ChangeInt ( PluginConfig.ceilingLightsWeight )
|
|
);
|
|
|
|
public void Start(){
|
|
//ForceVersionChange(1);
|
|
|
|
var hasShown = GetLastVersion() >= version;
|
|
if (hasShown) {
|
|
Plugin.logger.LogInfo("Already seen update. Deny");
|
|
return;
|
|
}
|
|
|
|
if (!mainMenuChanges.RequiresUpdate()) {
|
|
Plugin.logger.LogInfo("Values already up to date. Deny");
|
|
UpdateLastVersion();
|
|
return;
|
|
}
|
|
|
|
canvas.enabled = true;
|
|
textMesh.text = mainMessage + "\n\n" + version1Message + "\n\n" + mainMenuChanges.ToString();
|
|
denyButton.onClick.RemoveAllListeners();
|
|
denyButton.onClick.AddListener(CloseWindow);
|
|
|
|
acceptButton.onClick.RemoveAllListeners();
|
|
acceptButton.onClick.AddListener(UpdateChanges);
|
|
}
|
|
|
|
public int GetLastVersion(){
|
|
return ES3.Load<int>(prefsKey, savePath, 0);
|
|
}
|
|
|
|
public void ForceVersionChange(int v){
|
|
ES3.Save<int>(prefsKey, v, savePath);
|
|
}
|
|
|
|
public void UpdateLastVersion(){
|
|
ForceVersionChange(version);
|
|
}
|
|
|
|
public void UpdateChanges(){
|
|
mainMenuChanges.UpdateChanges();
|
|
CloseWindow();
|
|
}
|
|
|
|
public void CloseWindow(){
|
|
canvas.enabled = false;
|
|
UpdateLastVersion();
|
|
}
|
|
|
|
}
|
|
}
|
|
*/ |