// Use this for initialization void Start() { blockListener = Camera.main.GetComponent <BlockListener> (); gestureListener = Camera.main.GetComponent <GestureListener> (); Debug.Log("JumpBall - Start"); count = 0; }
/// <summary> /// Override method of ApplyExpandCollapse to perform language specific expand /// options. This method runs in a background thread to provided better /// interactivity. /// </summary> /// <param name="args">represents the instance of ApplyExpandCollapseArgs contains /// all necessary information related to each line</param> protected override void ApplyExpandCollapse(ApplyExpandCollapseArgs args) { bool createListener = false; if (args.LanguageBlocks == null) { return; } var selblocks = from blk in args.LanguageBlocks where ((!blk.IsRegex && args.ExpandInformation.Text.Trim().StartsWith(blk.BlockStart) || (blk.IsRegex && Regex.Match(args.ExpandInformation.Text, blk.BlockStart).Success))) select blk; if (selblocks.Count() > 0) { var block = selblocks.ElementAt(0); if (CheckCommentBlock(args.ExpandInformation)) { createListener = true; } if (createListener) { if (currentListener != null) { if (currentListener.BlockStart.StartsWith("class") && block.BlockStart.StartsWith("class")) { var parentLineItem = args.Source[currentListener.ParentLineNumber - 1]; parentLineItem.EndLine = args.Source.IndexOf(args.ExpandInformation) - 1; currentListener.EndLineNumber = parentLineItem.EndLine; lastBlockEndLine = parentLineItem.EndLine; } else { args.ExpandInformation.ParentLineNumber = currentListener.ParentLineNumber; args.ExpandInformation.StartLine = args.Source.IndexOf(args.ExpandInformation) + 2; if (blocksStack == null) { blocksStack = new Stack <BlockListener>(); } blocksStack.Push(currentListener); } } currentListener = new BlockListener() { BlockStart = block.BlockStart, BlockEnd = block.BlockEnd, IsPreprocessor = block.IsPreprocessor, ParentLineNumber = args.Source.IndexOf(args.ExpandInformation) + 1, IsRegex = block.IsRegex, CheckParentType = block.CheckParentType, ParentLexemType = block.ParentLexemType, LexemType = block.LexemType, ScopeLevel = block.ScopeLevel }; args.ExpandInformation.ContainsPreprocessor = block.IsPreprocessor; args.ExpandInformation.PreprocessorText = block.IsPreprocessor ? args.ExpandInformation.Text.Trim().Substring(block.BlockStart.Length).Trim() : string.Empty; args.ExpandInformation.ContainsLines = true; int tempInd = args.Source.IndexOf(args.ExpandInformation); args.ExpandInformation.StartLine = block.IsPreprocessor ? tempInd + 1 : tempInd + 2; } else if (currentListener != null) { args.ExpandInformation.ParentLineNumber = currentListener.ParentLineNumber; args.ExpandInformation.IsExpanded = true; args.ExpandInformation.ContainsLines = false; } else { args.ExpandInformation.ParentLineNumber = -1; args.ExpandInformation.IsExpanded = true; args.ExpandInformation.ContainsLines = false; } } else if (currentListener != null) { args.ExpandInformation.ContainsLines = false; args.ExpandInformation.ParentLineNumber = currentListener.ParentLineNumber; if (args.ExpandInformation.Text.Trim() == string.Empty) { var parentLineItem = args.Source[currentListener.ParentLineNumber - 1]; parentLineItem.EndLine = args.Source.IndexOf(args.ExpandInformation); currentListener.EndLineNumber = parentLineItem.EndLine; lastBlockEndLine = parentLineItem.EndLine; currentListener = null; if (blocksStack.Count > 0) { currentListener = blocksStack.Pop(); } } else if (currentListener.BlockEnd == null) { currentListener = null; if (blocksStack.Count > 0) { currentListener = blocksStack.Pop(); } } } else { args.ExpandInformation.ContainsLines = false; if (!args.ExpandInformation.IsExpanded) { args.ExpandInformation.IsExpanded = true; args.ExpandInformation.ToggleExpansion = true; } args.ExpandInformation.IsExpanded = true; args.ExpandInformation.ContainsLines = false; } if (args.Source.IndexOf(args.ExpandInformation) == args.Source.Count - 1) { if (currentListener != null) { var parentLineItem = args.Source[currentListener.ParentLineNumber - 1]; parentLineItem.EndLine = lastBlockEndLine; currentListener.EndLineNumber = parentLineItem.EndLine; } } }
/// <summary> /// Override method of ApplyExpandCollapse to perform any initialization before Expand collapse is applied /// interactivity. /// </summary> protected override void InitializeApplyExpandCollapse() { currentListener = null; }