Browse Source

Grouped static members together

master
Christopher 8 years ago
parent
commit
9f5c726699
  1. 8
      Assets/Fungus/Scripts/Components/Flowchart.cs
  2. 14
      Assets/Fungus/Scripts/Components/Localization.cs
  3. 6
      Assets/Fungus/Scripts/Components/MenuDialog.cs
  4. 26
      Assets/Fungus/Scripts/Components/PortraitController.cs
  5. 94
      Assets/Fungus/Scripts/Utils/ConversationManager.cs
  6. 12
      Assets/Fungus/Scripts/VariableTypes/AnimatorVariable.cs
  7. 10
      Assets/Fungus/Scripts/VariableTypes/AudioSourceVariable.cs

8
Assets/Fungus/Scripts/Components/Flowchart.cs

@ -92,6 +92,10 @@ namespace Fungus
[Tooltip("The ExecuteLua command adds a global Lua variable with this name bound to the flowchart prior to executing.")]
[SerializeField] protected string luaBindingName = "flowchart";
protected static bool eventSystemPresent;
protected StringSubstituter stringSubstituer;
/// <summary>
/// Cached list of flowchart objects in the scene for fast lookup.
/// </summary>
@ -110,10 +114,6 @@ namespace Fungus
}
}
protected static bool eventSystemPresent;
protected StringSubstituter stringSubstituer;
#if UNITY_5_4_OR_NEWER
protected virtual void Awake()
{

14
Assets/Fungus/Scripts/Components/Localization.cs

@ -17,13 +17,6 @@ namespace Fungus
/// </summary>
public class Localization : MonoBehaviour, ILocalization, ISubstitutionHandler
{
[Tooltip("Language to use at startup, usually defined by a two letter language code (e.g DE = German)")]
[SerializeField] protected string activeLanguage = "";
protected static Dictionary<string, string> localizedStrings = new Dictionary<string, string>();
protected Dictionary<string, ILocalizable> localizeableObjects = new Dictionary<string, ILocalizable>();
/// <summary>
/// Temp storage for a single item of standard text and its localizations.
/// </summary>
@ -34,13 +27,20 @@ namespace Fungus
public Dictionary<string, string> localizedStrings = new Dictionary<string, string>();
}
[Tooltip("Language to use at startup, usually defined by a two letter language code (e.g DE = German)")]
[SerializeField] protected string activeLanguage = "";
[Tooltip("CSV file containing localization data which can be easily edited in a spreadsheet tool")]
[SerializeField] protected TextAsset localizationFile;
protected Dictionary<string, ILocalizable> localizeableObjects = new Dictionary<string, ILocalizable>();
protected string notificationText = "";
protected bool initialized;
protected static Dictionary<string, string> localizedStrings = new Dictionary<string, string>();
#if UNITY_5_4_OR_NEWER
protected virtual void Awake()
{

6
Assets/Fungus/Scripts/Components/MenuDialog.cs

@ -12,9 +12,6 @@ namespace Fungus
{
public class MenuDialog : MonoBehaviour, IMenuDialog
{
// Currently active Menu Dialog used to display Menu options
public static IMenuDialog activeMenuDialog;
[Tooltip("Automatically select the first interactable button when the menu is shown.")]
[SerializeField] protected bool autoSelectFirstButton = false;
@ -22,6 +19,9 @@ namespace Fungus
protected Slider cachedSlider;
// Currently active Menu Dialog used to display Menu options
public static IMenuDialog activeMenuDialog;
public static IMenuDialog GetMenuDialog()
{
if (activeMenuDialog == null)

26
Assets/Fungus/Scripts/Components/PortraitController.cs

@ -19,6 +19,19 @@ namespace Fungus
protected Stage stage;
public static void SetRectTransform(RectTransform oldRectTransform, RectTransform newRectTransform)
{
oldRectTransform.eulerAngles = newRectTransform.eulerAngles;
oldRectTransform.position = newRectTransform.position;
oldRectTransform.rotation = newRectTransform.rotation;
oldRectTransform.anchoredPosition = newRectTransform.anchoredPosition;
oldRectTransform.sizeDelta = newRectTransform.sizeDelta;
oldRectTransform.anchorMax = newRectTransform.anchorMax;
oldRectTransform.anchorMin = newRectTransform.anchorMin;
oldRectTransform.pivot = newRectTransform.pivot;
oldRectTransform.localScale = newRectTransform.localScale;
}
protected virtual void Awake()
{
stage = GetComponentInParent<Stage>();
@ -207,19 +220,6 @@ namespace Fungus
}
}
public static void SetRectTransform(RectTransform oldRectTransform, RectTransform newRectTransform)
{
oldRectTransform.eulerAngles = newRectTransform.eulerAngles;
oldRectTransform.position = newRectTransform.position;
oldRectTransform.rotation = newRectTransform.rotation;
oldRectTransform.anchoredPosition = newRectTransform.anchoredPosition;
oldRectTransform.sizeDelta = newRectTransform.sizeDelta;
oldRectTransform.anchorMax = newRectTransform.anchorMax;
oldRectTransform.anchorMin = newRectTransform.anchorMin;
oldRectTransform.pivot = newRectTransform.pivot;
oldRectTransform.localScale = newRectTransform.localScale;
}
protected virtual void DoMoveTween(Character character, RectTransform fromPosition, RectTransform toPosition, float moveDuration, Boolean waitUntilFinished)
{
PortraitOptions options = new PortraitOptions(true);

94
Assets/Fungus/Scripts/Utils/ConversationManager.cs

@ -23,6 +23,53 @@ namespace Fungus
protected bool exitSayWait;
/// <summary>
/// Splits the string passed in by the delimiters passed in.
/// Quoted sections are not split, and all tokens have whitespace
/// trimmed from the start and end.
protected static string[] Split(string stringToSplit)
{
var results = new List<string>();
bool inQuote = false;
var currentToken = new StringBuilder();
for (int index = 0; index < stringToSplit.Length; ++index)
{
char currentCharacter = stringToSplit[index];
if (currentCharacter == '"')
{
// When we see a ", we need to decide whether we are
// at the start or send of a quoted section...
inQuote = !inQuote;
}
else if (char.IsWhiteSpace(currentCharacter) && !inQuote)
{
// We've come to the end of a token, so we find the token,
// trim it and add it to the collection of results...
string result = currentToken.ToString().Trim( new [] { ' ', '\n', '\t', '\"'} );
if (result != "") results.Add(result);
// We start a new token...
currentToken = new StringBuilder();
}
else
{
// We've got a 'normal' character, so we add it to
// the curent token...
currentToken.Append(currentCharacter);
}
}
// We've come to the end of the string, so we add the last token...
string lastResult = currentToken.ToString().Trim();
if (lastResult != "")
{
results.Add(lastResult);
}
return results.ToArray();
}
protected ISayDialog GetSayDialog(Character character)
{
ISayDialog sayDialog = null;
@ -208,53 +255,6 @@ namespace Fungus
return item;
}
/// <summary>
/// Splits the string passed in by the delimiters passed in.
/// Quoted sections are not split, and all tokens have whitespace
/// trimmed from the start and end.
protected static string[] Split(string stringToSplit)
{
var results = new List<string>();
bool inQuote = false;
var currentToken = new StringBuilder();
for (int index = 0; index < stringToSplit.Length; ++index)
{
char currentCharacter = stringToSplit[index];
if (currentCharacter == '"')
{
// When we see a ", we need to decide whether we are
// at the start or send of a quoted section...
inQuote = !inQuote;
}
else if (char.IsWhiteSpace(currentCharacter) && !inQuote)
{
// We've come to the end of a token, so we find the token,
// trim it and add it to the collection of results...
string result = currentToken.ToString().Trim( new [] { ' ', '\n', '\t', '\"'} );
if (result != "") results.Add(result);
// We start a new token...
currentToken = new StringBuilder();
}
else
{
// We've got a 'normal' character, so we add it to
// the curent token...
currentToken.Append(currentCharacter);
}
}
// We've come to the end of the string, so we add the last token...
string lastResult = currentToken.ToString().Trim();
if (lastResult != "")
{
results.Add(lastResult);
}
return results.ToArray();
}
#region IConversationManager
public void PopulateCharacterCache()

12
Assets/Fungus/Scripts/VariableTypes/AnimatorVariable.cs

@ -27,17 +27,17 @@ namespace Fungus
[SerializeField]
public Animator animatorVal;
public AnimatorData(Animator v)
{
animatorVal = v;
animatorRef = null;
}
public static implicit operator Animator(AnimatorData animatorData)
{
return animatorData.Value;
}
public AnimatorData(Animator v)
{
animatorVal = v;
animatorRef = null;
}
public Animator Value
{
get { return (animatorRef == null) ? animatorVal : animatorRef.Value; }

10
Assets/Fungus/Scripts/VariableTypes/AudioSourceVariable.cs

@ -27,16 +27,16 @@ namespace Fungus
[SerializeField]
public AudioSource audioSourceVal;
public static implicit operator AudioSource(AudioSourceData audioSourceData)
{
return audioSourceData.Value;
}
public AudioSourceData(AudioSource v)
{
audioSourceVal = v;
audioSourceRef = null;
}
public static implicit operator AudioSource(AudioSourceData audioSourceData)
{
return audioSourceData.Value;
}
public AudioSource Value
{

Loading…
Cancel
Save