Netcode Bootstrap
This commit is contained in:
@@ -0,0 +1,74 @@
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Text.RegularExpressions;
|
||||
using UnityEditor;
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
namespace Rukhanka.Editor
|
||||
{
|
||||
public class SymbolManager: IDisposable
|
||||
{
|
||||
protected List<string> symbols = new ();
|
||||
bool changed = false;
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
public void ToggleScriptSymbol(string ss, bool on)
|
||||
{
|
||||
if (on)
|
||||
AddScriptSymbol(ss);
|
||||
else
|
||||
RemoveScriptSymbol(ss);
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
public void RemoveScriptSymbol(string ss)
|
||||
{
|
||||
if (IsSymbolDefined(ss))
|
||||
{
|
||||
changed = true;
|
||||
symbols.Remove(ss);
|
||||
}
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
public void AddScriptSymbol(string ss)
|
||||
{
|
||||
if (!IsSymbolDefined(ss))
|
||||
{
|
||||
changed = true;
|
||||
symbols.Add(ss);
|
||||
}
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
public bool IsSymbolDefined(string ss)
|
||||
{
|
||||
return symbols.FindIndex(x => x == ss) >= 0;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
public bool HasChanges() => changed;
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
public virtual void ApplyChanges()
|
||||
{
|
||||
changed = false;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
ApplyChanges();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user