Пример #1
0
        private IEnumerable <bool> ParseTagChange()
        {
            var match = TagChangeRegex.Match(this.parsing_log);

            if (!match.Success)
            {
                yield break;
            }

            var    entity_raw = match.Groups["entity"].Value;
            string entity_str;
            int    entityId = ParserUtilities.GetEntityIdFromRawString(this.game_state, entity_raw, out entity_str);

            if (entityId >= 0)
            {
                State.ReadOnlyEntity prev_entity = game_state.Entities.Items[entityId].Clone();
                this.game_state.ChangeTag(entityId, match.Groups["tag"].Value, match.Groups["value"].Value);
                EntityTagChanged(this, new EntityTagChangedEventArgs()
                {
                    prev    = prev_entity,
                    current = game_state.Entities.Items[entityId]
                });
            }
            else
            {
                game_state.ChangeTag(entity_str, match.Groups["tag"].Value, match.Groups["value"].Value);
            }

            yield return(true);
        }