GlueViewOfficialPlugins.Scripting.ScriptParsingPlugin.IsStateVariable C# (CSharp) Method

IsStateVariable() private method

private IsStateVariable ( string value, ElementRuntime elementRuntime ) : bool
value string
elementRuntime FlatRedBall.Glue.ElementRuntime
return bool
        private bool IsStateVariable(string value, ElementRuntime elementRuntime)
        {
            if(value == "CurrentState")
            {
                return true;

            }

            IElement element = elementRuntime.AssociatedIElement;

            if(element != null && value != null && value.StartsWith("Current") && value.EndsWith("State"))
            {
                string possibleCategory = value.Substring("Current".Length);
                possibleCategory = possibleCategory.Substring(0, possibleCategory.Length - "State".Length);

                return element.GetStateCategoryRecursively(possibleCategory) != null;

            }
            return false;
        }