保存读取trigger状态

This commit is contained in:
liuyu 2024-09-05 13:05:31 +08:00
parent b0d1ac0edd
commit 0b6a393e81
4 changed files with 79 additions and 0 deletions

View File

@ -75,4 +75,22 @@ public class Check_JieXian : PermanentTriggerBase
base.CallScoreAction(true);
}
}
/// <summary>
/// ¶ÏÏßÖØÁ¬
/// </summary>
/// <returns></returns>
/// <exception cref="System.NotImplementedException"></exception>
public override string SaveCurrentTriggerStat()
{
return isChecked.ToString();
//throw new System.NotImplementedException();
}
public override void LoadCurrentTriggerStat(string triggerInfo)
{
if (triggerInfo != "")
isChecked = bool.Parse(triggerInfo);
//throw new System.NotImplementedException();
}
}

View File

@ -16,6 +16,7 @@ public class DeviceTrigger : PermanentTriggerBase
/// 点击回调
/// </summary>
public Action clickAction;
protected override void OnMDown()
{
base.OnMDown();
@ -39,4 +40,20 @@ public class DeviceTrigger : PermanentTriggerBase
_highlight.SetHighlighted(false);
}
}
/// <summary>
/// ²»ÐèÒª
/// </summary>
/// <param name="triggerInfo"></param>
/// <exception cref="NotImplementedException"></exception>
public override void LoadCurrentTriggerStat(string triggerInfo)
{
throw new NotImplementedException();
}
public override string SaveCurrentTriggerStat()
{
return "";
//throw new NotImplementedException();
}
}

View File

@ -1,7 +1,9 @@
using DG.Tweening;
using Newtonsoft.Json;
using System.Collections;
using System.Collections.Generic;
using Unity.VisualScripting.Antlr3.Runtime;
using UnityEditor.ShaderGraph.Serialization;
using UnityEngine;
/// <summary>
@ -202,4 +204,30 @@ public class Device_Cover : Device_Base
});
}
}
class tmp_DC
{
public bool isOpen;
public bool isCheckOK;
}
/// <summary>
/// ¶ÏÏßÖØÁ¬
/// </summary>
/// <returns></returns>
/// <exception cref="System.NotImplementedException"></exception>
public override string SaveCurrentTriggerStat()
{
tmp_DC tmp = new tmp_DC();
tmp.isOpen = isOpen;
tmp.isCheckOK = isCheckOK;
string info = JsonConvert.SerializeObject(tmp);
return info;
//throw new System.NotImplementedException();
}
public override void LoadCurrentTriggerStat(string triggerInfo)
{
//throw new System.NotImplementedException();
}
}

View File

@ -101,4 +101,20 @@ public class Tool_Base : PermanentTriggerBase
back?.Invoke();
});
}
/// <summary>
/// ²»ÐèÒª
/// </summary>
/// <returns></returns>
/// <exception cref="NotImplementedException"></exception>
public override string SaveCurrentTriggerStat()
{
return "";
//throw new NotImplementedException();
}
public override void LoadCurrentTriggerStat(string triggerInfo)
{
//throw new NotImplementedException();
}
}