Exemplo n.º 1
0
    void Start()
    {
        formNavigator = GameObject.Find("FormNavigator").GetComponent <FormNavigator> ();
        copy          = CopyFormatter.AddWrongPronounsToString(EmailCopy.emailCopy);

        GetWidthMeasurements();
        GetWords();
        GenerateWords();
        Pronoun.OnPronounCaught += this.GenerateGrid;
    }
Exemplo n.º 2
0
        /// <summary>
        /// Parses a sub-formatter
        /// </summary>
        /// <param name="lexer">the lexer to read the tokens from</param>
        /// <param name="outputIndex">the index in the output record for the sub-formatter</param>
        /// <returns>the parsed <see cref="ISubFormatter"/></returns>
        private ISubFormatter ParseSubFormatter(Lexer lexer, ref int outputIndex)
        {
            var element = lexer.Parse();
            var column  = element.IndexOf(':');

            if (column != -1)
            {
                outputIndex = int.Parse(element.Substring(0, column)) - 1;
                element     = element.Substring(column + 1);
            }
            ISubFormatter subFormatter;
            Match         match;

            if ((match = StringConstantRegex.Match(element)).Success)
            {
                var constant = lexer.Parse();
                constant     = constant.Substring(1, constant.Length - 2);
                subFormatter = GetStringConstantFormatter(GetN(match), constant, outputIndex);
            }
            else if ((match = HexOfSpaceRegex.Match(element)).Success)
            {
                if (lexer.Current != null && lexer.Current.StartsWith("'"))
                {
                    subFormatter = GetHexConstantFormatter(GetN(match), lexer.Parse(), outputIndex);
                }
                else
                {
                    subFormatter = GetStringConstantFormatter(GetN(match), " ", outputIndex);
                }
            }
            else
            {
                var start  = int.Parse(element) - 1;
                var length = lexer.ParseInt();
                if (NumberFormats.Contains(lexer.Current))
                {
                    subFormatter = ParseEditFormatter(start, length, outputIndex, lexer);
                }
                else
                {
                    subFormatter = new CopyFormatter
                    {
                        InputIndex  = start,
                        Length      = length,
                        OutputIndex = outputIndex
                    };
                }
            }
            outputIndex += subFormatter.Length;

            return(subFormatter);
        }
Exemplo n.º 3
0
    private void GenerateSpeech()
    {
        List <string> formattedChatter = CopyFormatter.AddWrongPronounsToArray(SpeechCopy.chatter);

        for (int i = 0; i < formattedChatter.Count; i++)
        {
            GameObject speech = Instantiate(speechBubble);
            speech.transform.SetParent(gameObject.transform, false);
            speech.GetComponentInChildren <TMPro.TextMeshProUGUI> ().text = formattedChatter[i];
            SetHeightOfSpeechBubble(speech.transform);
            if (i % 2 == 0)
            {
                LeftAlignSpeechBubble(speech);
            }
        }
    }