示例#1
0
    private void OnEnable()
    {
        StageContainer container = this.transform.parent.gameObject.GetComponent <StageContainer>();

        if (!container.points.Contains(this.transform))
        {
            container.points.Add(this.transform);
        }

        if (colorChanger)
        {
            //print("COLOR CHANGER");
            for (int i = 0; i < sprite.Length; i++)
            {
                Color c = color.color;
                c.a             = sprite[i].color.a;
                sprite[i].color = c;
            }
            centerSprite.enabled = true;
        }
        else
        {
            centerSprite.enabled = false;
        }
    }
        private void ParseElement(string name)
        {
            StageElement stageElement = new StageElement(name);

            if (this._curRoot != null)
            {
                this._curRoot.Add(stageElement);
            }
            this._curRoot = stageElement;
            while (this._idx < this._length)
            {
                char chr = this._s[this._idx];
                if (chr > ' ')
                {
                    if (chr == ',')
                    {
                        goto Label0;
                    }
                    if (chr == '}')
                    {
                        this._curRoot = this._curRoot.parent ?? this._curRoot;
                        return;
                    }
                }
                else
                {
                    switch (chr)
                    {
                    case '\t':
                    case '\n':
                    case '\f':
                    case '\r':
                    {
                        goto Label0;
                    }

                    case '\v':
                    {
                        break;
                    }

                    default:
                    {
                        if (chr == ' ')
                        {
                            goto Label0;
                        }
                        break;
                    }
                    }
                }
                this.ParseItem();
Label0:
                this._idx++;
            }
        }
 public StageElement Parse(string json)
 {
     this._s          = json;
     this._length     = json.Length;
     this._b.position = 0;
     this._curRoot    = null;
     this._idx        = 0;
     while (this._idx < this._length)
     {
         if (this._s[this._idx] == '{')
         {
             this._idx++;
             this.ParseElement(null);
         }
         this._idx++;
     }
     return(this._curRoot as StageElement);
 }
示例#4
0
        private EventElement CreateEventGUI(VisualElement root, EventRow @event)
        {
            var eventElem = new EventElement {
                text = @event.Id
            };

            var stagesContainer = new StagesContainer();

            eventElem.Content.Add(new InvokeTypeElement {
                value = @event.InvokeType.ToKeyword()
            });
            eventElem.Content.Add(stagesContainer);

            foreach (var stage in @event.Stages)
            {
                var stageContainer = new StageContainer();
                stagesContainer.Add(stageContainer);

                stageContainer.Add(new StageElement {
                    value = $"{stage.Index}"
                });

                if (stage.MaxConstraint >= 0)
                {
                    stageContainer.Add(new StageElement {
                        value = $"<{stage.MaxConstraint}>"
                    });
                }

                var commandContainer = new CommandContainer();
                stageContainer.Add(commandContainer);

                foreach (var command in stage.Commands)
                {
                    commandContainer.Add(new CommandElement {
                        value = command.Id
                    });
                }
            }

            root.Add(eventElem);
            return(eventElem);
        }
示例#5
0
        private void ParseElement(string name)
        {
            var el = new StageElement(name);

            if (_curRoot != null)
            {
                _curRoot.Add(el);
            }

            _curRoot = el;

            for (; _idx < _length; _idx++)
            {
                var c = _s[_idx];
                switch (c)
                {
                case ',':
                case ' ':
                case '\t':
                case '\n':
                case '\r':
                case '\f':
                {
                    /* Skip white space and item separator */
                    break;
                }

                case '}':
                {
                    _curRoot = _curRoot.parent ?? _curRoot;
                    return;
                }

                default:
                {
                    ParseItem();
                    break;
                }
                }
            }
        }
示例#6
0
        private void ParseList(string name)
        {
            var l = new StageList(name);

            _curRoot.Add(l);

            _curRoot = l;

            for (; _idx < _length; _idx++)
            {
                var c = _s[_idx];
                switch (c)
                {
                case ',':
                case ' ':
                case '\t':
                case '\n':
                case '\r':
                case '\f':
                {
                    /* Skip white space and item separator */
                    break;
                }

                case ']':
                {
                    _curRoot = _curRoot.parent ?? _curRoot;
                    return;
                }

                default:
                {
                    ParseItemType(null, false);
                    break;
                }
                }
            }
        }
示例#7
0
        public StageElement Parse(string json)
        {
            _s          = json;
            _b.position = 0;
            _curRoot    = null;
            _length     = json != null ? json.Length : 0;

            for (_idx = 0; _idx < _length; _idx++)
            {
                var c = _s[_idx];
                switch (c)
                {
                case '{':
                {
                    _idx++;
                    ParseElement(null);
                    break;
                }
                }
            }

            return(_curRoot as StageElement);
        }