Beispiel #1
0
        public void SpawnLog()
        {
            float SpawnRange = 13;

            Instantiate(logPrefab, transform.position + new Vector3(Random.Range(-SpawnRange, SpawnRange), 0, Random.Range(-SpawnRange, SpawnRange)), transform.rotation);
            TreeUpdated?.Invoke();
        }
        /// <summary>
        /// Internal function to parse a new StyleSheet object
        /// </summary>
        private void ParseNewStyleSheet(ITextProvider textProvider, TokenList tokens)
        {
            ICssParser parser = _parserFactory.CreateParser();

            if (tokens == null)
            {
                ICssTokenizer tokenizer = parser.TokenizerFactory.CreateTokenizer();
                tokens = tokenizer.Tokenize(textProvider, 0, textProvider.Length, keepWhiteSpace: false);
            }

            using (CreateWriteLock())
            {
                Tokens     = tokens;
                StyleSheet = parser.Parse(textProvider, tokens, insertComments: true);
            }

            TreeUpdated?.Invoke(this, new CssTreeUpdateEventArgs(this));
        }
        private void FireOnItemsChanged(
            ParseItemList deletedItems,
            ParseItemList insertedItems,
            ParseItemList errorsChangedItems)
        {
#if DEBUG
            Debug.Assert(IsOwnerThread);

            for (int i = 0; i + 1 < insertedItems.Count; i++)
            {
                // Inserted items must not overlap (no need to add children as well as their parent)
                Debug.Assert(insertedItems[i].AfterEnd <= insertedItems[i + 1].Start);
            }
#endif

            if (IsMassiveChange(deletedItems, insertedItems))
            {
                TreeUpdated?.Invoke(this, new CssTreeUpdateEventArgs(this));
            }
            else
            {
                ItemsChanged?.Invoke(this, new CssItemsChangedEventArgs(deletedItems, insertedItems, errorsChangedItems));
            }
        }