我们创建了 Fontainebleau 演示来说明摄影photogrammetry流程和 LayeredLit 着色器的使用。
您最多选择25个主题 主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
 
 
 
 

65 行
2.3 KiB

using NaughtyAttributes;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace GameplayIngredients.Logic
{
public class SaveDataSwitchOnIntLogic : LogicBase
{
public GameSaveManager.Location SaveLocation = GameSaveManager.Location.System;
public string Key = "SomeKey";
[NonNullCheck]
public Callable[] DefaultCaseToCall;
[ReorderableList, NonNullCheck]
public Callable[] CasesToCall;
public override void Execute(GameObject instigator = null)
{
var gsm = Manager.Get<GameSaveManager>();
if (gsm.HasInt(Key, SaveLocation))
{
int value = gsm.GetInt(Key, SaveLocation);
if(value > 0 && value < CasesToCall.Length)
{
if (CasesToCall[value] != null)
Callable.Call(CasesToCall[value], instigator);
else
{
Debug.LogWarning($"[SaveDataSwitchOnIntLogic] {gameObject.name} : Callable at index #{Key} was null, using default case.");
CallDefault(instigator);
}
}
else
{
Debug.LogWarning($"[SaveDataSwitchOnIntLogic] {gameObject.name} : Callable at index #{Key} was out of range, using default case.");
CallDefault(instigator);
}
}
else
{
Debug.LogWarning($"[SaveDataSwitchOnIntLogic] {gameObject.name} : Could not Find {Key} in {SaveLocation} Save, using default case.");
CallDefault(instigator);
}
}
void CallDefault(GameObject instigator)
{
if(DefaultCaseToCall != null)
{
Callable.Call(DefaultCaseToCall, instigator);
}
else
{
Debug.LogWarning($"[SaveDataSwitchOnIntLogic] {gameObject.name} : Did not set a default callable, aborting.");
}
}
void WarnNotExist(string name, GameSaveManager.ValueType type, GameSaveManager.Location location)
{
Debug.LogWarning(string.Format("Save Data Logic: Trying to get {0} value to non existent {1} data in {2} save.", type, name, location));
}
}
}