|
@@ -16,11 +16,17 @@ namespace CM3D2.ToukaScreenShot.Plugin
|
|
|
[PluginFilter("COM3D2x64")]
|
|
|
public class ToukaScreenShot : PluginBase
|
|
|
{
|
|
|
- private readonly bool[] bLayerMask = new bool[32];
|
|
|
-
|
|
|
+ private readonly HashSet<int> defaultVisibleLayers = new HashSet<int>
|
|
|
+ {
|
|
|
+ 0,
|
|
|
+ 1,
|
|
|
+ 10
|
|
|
+ };
|
|
|
+
|
|
|
private readonly FieldInfo fBloom =
|
|
|
typeof(CameraMain).GetField("m_gcBloom", BindingFlags.Instance | BindingFlags.NonPublic);
|
|
|
|
|
|
+ private int layerMask = 0;
|
|
|
private bool altKey;
|
|
|
private bool bgActiveBack = true;
|
|
|
private Color bgColorBack = Color.black;
|
|
@@ -36,20 +42,13 @@ namespace CM3D2.ToukaScreenShot.Plugin
|
|
|
private int maskBack;
|
|
|
private bool noConfigFlg;
|
|
|
private bool shiftKey;
|
|
|
- private IniFile sPreferences;
|
|
|
private string triggerKey = "s";
|
|
|
|
|
|
private void Start()
|
|
|
{
|
|
|
- sPreferences = Preferences;
|
|
|
- var defaultVisibleLayers = new HashSet<int>
|
|
|
- {
|
|
|
- 0,
|
|
|
- 1,
|
|
|
- 10
|
|
|
- };
|
|
|
- for (var i = 0; i < bLayerMask.Length; i++)
|
|
|
- bLayerMask[i] = GetValueIni("Visible", $"Layer{i}", defaultVisibleLayers.Contains(i));
|
|
|
+ for (var i = 0; i < sizeof(int) * 8; i++)
|
|
|
+ if (GetValueIni("Visible", $"Layer{i}", defaultVisibleLayers.Contains(i)))
|
|
|
+ layerMask |= 1 << i;
|
|
|
|
|
|
folderName = GetValueIni("File", "Folder", "ScreenShot");
|
|
|
fileNameHead = GetValueIni("File", "Head", "img");
|
|
@@ -80,7 +79,7 @@ namespace CM3D2.ToukaScreenShot.Plugin
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- var iniKey = sPreferences[section][key];
|
|
|
+ var iniKey = Preferences[section][key];
|
|
|
if (iniKey != null && !string.IsNullOrEmpty(iniKey.Value) &&
|
|
|
TryParse(iniKey.Value, out var result)) return result;
|
|
|
iniKey.Value = Convert.ToString(@default, CultureInfo.InvariantCulture);
|
|
@@ -205,12 +204,7 @@ namespace CM3D2.ToukaScreenShot.Plugin
|
|
|
|
|
|
private void SetCameraMask()
|
|
|
{
|
|
|
- var num = 0;
|
|
|
- for (var i = 0; i < bLayerMask.Length; i++)
|
|
|
- if (bLayerMask[i])
|
|
|
- num += 1 << i;
|
|
|
-
|
|
|
- mainCamera.cullingMask = num;
|
|
|
+ mainCamera.cullingMask = layerMask;
|
|
|
if (!bgVisible) GameMain.Instance.BgMgr.current_bg_object.SetActive(false);
|
|
|
if (!bloomOff) return;
|
|
|
var bloom = (Bloom) fBloom.GetValue(GameMain.Instance.MainCamera);
|