存档功能

This commit is contained in:
2025-01-08 11:41:20 +08:00
parent c67366664c
commit 43b99f98e7
49 changed files with 2498 additions and 5762 deletions
@@ -11,15 +11,17 @@ namespace AibisDream.FixSystem
private const string SocketObjName = "Socket";
private const string ModulePicName = "Module Pic";
public Transform socketPos;
// public Transform _indicatorPos;
private BodyModuleSystem _bodyModuleSystem;
private Material _highlightMaterial;
private Material _alarmMaterial;
private Material _originalMaterial; // 原材质
private Material _originalMaterial; // 原材质
private SpriteRenderer _targetSpriteRenderer; // 目标的 SpriteRenderer
#endregion
// 模块基本数据
@@ -31,38 +33,42 @@ namespace AibisDream.FixSystem
// 获取组件索引
InitReference();
}
private void InitReference()
{
socketPos = transform.Find(SocketObjName);
_bodyModuleSystem = transform.parent.parent.GetComponent<BodyModuleSystem>();
_targetSpriteRenderer=transform.Find("Module Pic").GetComponent<SpriteRenderer>();
_targetSpriteRenderer = transform.Find("Module Pic").GetComponent<SpriteRenderer>();
_originalMaterial = _targetSpriteRenderer.GetComponent<SpriteRenderer>().material;
_highlightMaterial = Resources.Load<Material>("Materials/HighlightMaterial");
_alarmMaterial=Resources.Load<Material>("Materials/AlarmMaterial");
_alarmMaterial = Resources.Load<Material>("Materials/AlarmMaterial");
}
#region
public bool IsAvailable()
{
return _available;
}
public void SetSocketAvailable(bool isAvailable)
{
_available=isAvailable;
_available = isAvailable;
}
public void PlugIn()
{
if(DialogController.Instance!=null)
// 然后触发Yarn节点
DialogController.Instance.StartDialogNode(_bodyModuleSystem.inHotErr ? "系统过热" : data.PlugInNodeName);
if (DialogController.Instance != null)
// 然后触发Yarn节点
DialogController.Instance.StartDialogNode(_bodyModuleSystem.inHotErr ? "系统过热" : data.PlugInNodeName);
}
public void PlugOut()
{
_bodyModuleSystem.oscilloscopeSystem.MessageBoxSetNull();
StartCoroutine(_bodyModuleSystem.oscilloscopeSystem.DisableDeepInButton());
// TODO 触发Yarn节点(似乎目前没有拔出对话?)
}
@@ -87,7 +93,7 @@ namespace AibisDream.FixSystem
newSocketPos.localPosition = newData.SocketPos;
// 数据同步
data = newData;
InitReference();
}
@@ -102,20 +108,23 @@ namespace AibisDream.FixSystem
ModulePic = modulePic.sprite,
ModulePos = transform.localPosition,
SocketPos = newSocketPos.localPosition,
cantStopRunning=data.cantStopRunning,
cantStopRunning = data.cantStopRunning,
};
}
#endregion
#region
public void Highlight(bool enable)
{
if (_targetSpriteRenderer != null && _highlightMaterial != null&&_targetSpriteRenderer.material!=_alarmMaterial)
if (_targetSpriteRenderer != null && _highlightMaterial != null &&
_targetSpriteRenderer.material != _alarmMaterial)
{
_targetSpriteRenderer.material = enable ? _highlightMaterial : _originalMaterial;
}
}
public void Alarm(bool enable)
{
if (_targetSpriteRenderer != null && _alarmMaterial != null)
@@ -123,6 +132,7 @@ namespace AibisDream.FixSystem
_targetSpriteRenderer.material = enable ? _alarmMaterial : _originalMaterial;
}
}
// public void HideModule(bool enable)
// {
// if (targetSpriteRenderer != null && highlightMaterial != null)
@@ -130,16 +140,16 @@ namespace AibisDream.FixSystem
// targetSpriteRenderer.material = enable ? highlightMaterial : originalMaterial;
// }
// }
#endregion
#endregion
}
[Serializable]
public struct BodyModuleData
{
public const string PlugInNodeTemplate = "{0}PlugIn";
public const string DeepInTemplate = "{0}DeepIn";
// ID
public string moduleName;
@@ -174,11 +184,5 @@ namespace AibisDream.FixSystem
get => socketPos.ToVector3();
set => socketPos = new SerializableVector3(value);
}
// [JsonIgnore]
// public Vector3 IndicatorPos
// {
// get => indicatorPos.ToVector3();
// set => indicatorPos = new SerializableVector3(value);
// }
}
}
@@ -70,8 +70,6 @@ namespace AibisDream.FixSystem
{
heatMapController = transform.Find("HeatMapController").GetComponent<HeatMapController>();
}
Debug.Log("Register");
FixSystemCenter.SystemDic.Register(this);
}
@@ -189,12 +187,12 @@ namespace AibisDream.FixSystem
#region
public override string[] GetDataKeyOptions()
public override string GetConfigPath()
{
return _keyOptions ??= ConfigUtil.Instance.GetFileNames(DataPath);
return DataPath;
}
public override void Load()
public override void LoadLevel()
{
if (string.IsNullOrEmpty(CurDataKey))
{
@@ -248,7 +246,7 @@ namespace AibisDream.FixSystem
BodyModules = newModules;
}
public override void Save()
public override void SaveLevel()
{
if (string.IsNullOrEmpty(CurDataKey)) return;
@@ -10,152 +10,176 @@ namespace AibisDream
private static OscilloscopeSystem OscilloscopeSystem => FixSystemCenter.SystemDic.Get<OscilloscopeSystem>();
private static PunchTapeSystem PunchTapeSystem => FixSystemCenter.SystemDic.Get<PunchTapeSystem>();
[YarnCommand("SetModuleState_CantStopRunning")]
public static void SetModuleState_CantStopRunning(string ModuleName,bool state)
public static void SetModuleState_CantStopRunning(string moduleName, bool state)
{
BodyModuleSystem.SetModuleState_CantStopRunning(ModuleName,state);
BodyModuleSystem.SetModuleState_CantStopRunning(moduleName, state);
}
[YarnCommand("ShowHeatMap")]
public static void ShowHeatMap()
{
BodyModuleSystem.ShowHeatMap();
}
[YarnCommand("HideHeatMap")]
[YarnCommand("HideHeatMap")]
public static void HideHeatMap()
{
BodyModuleSystem.HideHeatMap();
}
[YarnCommand("SetHeat")]
public static void SetHeat(int heatValue)
{
BodyModuleSystem.SetHeat(heatValue);
}
[YarnCommand("Temp_RemoveUF")]
public static void Temp_RemoveUF()
{
var _UFModule = BodyModuleSystem.FindBodyModuleByName("UF").gameObject;
if(_UFModule.activeInHierarchy)
var _UFModule = BodyModuleSystem.FindBodyModuleByName("UF").gameObject;
if (_UFModule.activeInHierarchy)
{
_UFModule.SetActive(false);
}
}
[YarnCommand("Temp_RemoveUFCover")]
public static void Temp_RemoveUFCover()
{
var _UFCover = BodyModuleSystem.FindBodyModuleByName("UF").transform.Find("Cover").gameObject;
if(_UFCover.activeInHierarchy)
var _UFCover = BodyModuleSystem.FindBodyModuleByName("UF").transform.Find("Cover").gameObject;
if (_UFCover.activeInHierarchy)
{
_UFCover.SetActive(false);
}
}
[YarnCommand("Temp_InstallUF")]
public static void Temp_InstallUF()
{
var _UFModule = BodyModuleSystem.FindBodyModuleByName("UF").gameObject;
if(!_UFModule.activeInHierarchy)
var _UFModule = BodyModuleSystem.FindBodyModuleByName("UF").gameObject;
if (!_UFModule.activeInHierarchy)
{
_UFModule.SetActive(true);
}
}
[YarnCommand("Temp_InstallUFCover")]
public static void Temp_InstallUFCover()
{
var _UFCover = BodyModuleSystem.FindBodyModuleByName("UF").transform.Find("Cover").gameObject;
if(!_UFCover.activeInHierarchy)
var _UFCover = BodyModuleSystem.FindBodyModuleByName("UF").transform.Find("Cover").gameObject;
if (!_UFCover.activeInHierarchy)
{
_UFCover.SetActive(true);
}
}
[YarnCommand("Temp_InstallChip")]
public static void Temp_InstallChip()
{
var _UFCover = BodyModuleSystem.FindBodyModuleByName("Color").transform.Find("Chip").gameObject;
if(!_UFCover.activeInHierarchy)
var _UFCover = BodyModuleSystem.FindBodyModuleByName("Color").transform.Find("Chip").gameObject;
if (!_UFCover.activeInHierarchy)
{
_UFCover.SetActive(true);
}
}
[YarnCommand("Temp_RemoveChip")]
public static void Temp_RemoveChip()
{
var _UFCover = BodyModuleSystem.FindBodyModuleByName("Color").transform.Find("Chip").gameObject;
if(_UFCover.activeInHierarchy)
var _UFCover = BodyModuleSystem.FindBodyModuleByName("Color").transform.Find("Chip").gameObject;
if (_UFCover.activeInHierarchy)
{
_UFCover.SetActive(false);
}
}
[YarnCommand("SetSocketAvailable")]
public static void SetSocketAvailable(string moduleName,bool isAvailable)
public static void SetSocketAvailable(string moduleName, bool isAvailable)
{
var targetModule = BodyModuleSystem.FindBodyModuleByName(moduleName);
var targetModule = BodyModuleSystem.FindBodyModuleByName(moduleName);
targetModule.SetSocketAvailable(isAvailable);
}
[YarnCommand("ModuleHightLight")]
public static void ModuleHightLight(string moduleName,bool enable)
public static void ModuleHightLight(string moduleName, bool enable)
{
var targetModule = BodyModuleSystem.FindBodyModuleByName(moduleName);
var targetModule = BodyModuleSystem.FindBodyModuleByName(moduleName);
targetModule.Highlight(enable);
}
[YarnCommand("ModuleAlarm")]
public static void ModuleAlarm(string moduleName,bool enable)
public static void ModuleAlarm(string moduleName, bool enable)
{
var targetModule = BodyModuleSystem.FindBodyModuleByName(moduleName);
var targetModule = BodyModuleSystem.FindBodyModuleByName(moduleName);
targetModule.Alarm(enable);
}
[YarnCommand("MessageBoxSetError")]
public static void MessageBoxSetError()
{
OscilloscopeSystem.MessageBoxSetError();
OscilloscopeSystem.MessageBoxSetError();
}
[YarnCommand("MessageBoxSetWarning")]
public static void MessageBoxSetWarning()
{
OscilloscopeSystem.MessageBoxSetWarning();
OscilloscopeSystem.MessageBoxSetWarning();
}
[YarnCommand("MessageBoxSetNormal")]
[YarnCommand("MessageBoxSetNormal")]
public static void MessageBoxSetNormal()
{
OscilloscopeSystem.MessageBoxSetNormal();
OscilloscopeSystem.MessageBoxSetNormal();
}
[YarnCommand("MessageBoxSetChecking")]
public static void MessageBoxSetChecking()
{
OscilloscopeSystem.MessageBoxSetChecking();
OscilloscopeSystem.MessageBoxSetChecking();
}
[YarnCommand("MessageBoxSetNull")]
public static void MessageBoxSetNull()
{
OscilloscopeSystem.MessageBoxSetNull();
OscilloscopeSystem.MessageBoxSetNull();
}
[YarnCommand("MessageBoxSetText")]
public static void MessageBoxSetText(string text)
{
OscilloscopeSystem.MessageBoxSetText(text);
OscilloscopeSystem.MessageBoxSetText(text);
}
[YarnCommand("EnableDeepInButton")]
public static void EnableDeepInButton()
{
OscilloscopeSystem.StartCoroutine(OscilloscopeSystem.EnableDeepInButton());
OscilloscopeSystem.StartCoroutine(OscilloscopeSystem.EnableDeepInButton());
}
[YarnCommand("DisableDeepInButton")]
public static void DisableDeepInButton()
{
OscilloscopeSystem.StartCoroutine(OscilloscopeSystem.DisableDeepInButton());
OscilloscopeSystem.StartCoroutine(OscilloscopeSystem.DisableDeepInButton());
}
[YarnCommand("PrintPunchTapes")]
public static IEnumerator PrintPunchTapes(int count)
{
yield return PunchTapeSystem.StartCoroutine(PunchTapeSystem.PrintPunchTapes(count));
}
[YarnCommand("HidePunchTapeGroup")]
public static IEnumerator HidePunchTapeGroup()
{
yield return PunchTapeSystem.StartCoroutine(PunchTapeSystem.Temp_HidePunchTapeGroup());
}
[YarnCommand("ShowPunchTapeGroup")]
public static void ShowPunchTapeGroup()
{
PunchTapeSystem.Temp_showPunchTapeGroup();
}
}
}
}