Esempio n. 1
0
    public override void Update()
    {
        objName = "Object";
        if (obj.GetType() == typeof(Creature))
        {
            string firstName = AuroraEngine.Resources.GetString(((AuroraUTC)obj.template).FirstName);
            string lastName  = AuroraEngine.Resources.GetString(((AuroraUTC)obj.template).LastName);
            objName = firstName + (lastName != "" ? (" " + lastName) : "");
        }
        else if (obj.GetType() == typeof(Door))
        {
            objName = AuroraEngine.Resources.GetString(((AuroraUTD)obj.template).LocName);
        }
        else if (obj.GetType() == typeof(Placeable))
        {
            objName = AuroraEngine.Resources.GetString(((AuroraUTP)obj.template).LocName);

            // Check if the placeable is empty; if so, append " (Empty)" to the name
            if (((AuroraUTP)obj.template).ItemList.Count == 0)
            {
                objName += " (Empty)";
            }
        }

        left   = new SelectorList(this.width / 3, this.height * 2 / 3, options1);
        middle = new SelectorList(this.width / 3, this.height * 2 / 3, options2);
        right  = new SelectorList(this.width / 3, this.height * 2 / 3, options3);
    }
Esempio n. 2
0
		public static ISelector CreateList(params ISelector[] selectors)
		{
			SelectorList returnValue = new SelectorList();

			returnValue.AddRange(selectors);

			return returnValue;
		}
Esempio n. 3
0
        /*
         * (non-Javadoc)
         *
         * @see org.w3c.css.sac.DocumentHandler#endSelector(org.w3c.css.sac.SelectorList)
         */
        public virtual void endSelector(SelectorList selectors)
        {
            // if we are in a state within a selector, close brace
            if (selectorOpen)
            {
                styleSheet.Append('}');
                styleSheet.Append('\n');
            }

            // reset state
            selectorOpen = false;
        }
Esempio n. 4
0
        /*
         * (non-Javadoc)
         *
         * @see org.w3c.css.sac.DocumentHandler#startSelector(org.w3c.css.sac.SelectorList)
         */
        public virtual void  startSelector(SelectorList selectors)
        {
            // keep track of number of valid selectors from this rule
            int selectorCount = 0;

            // check each selector from this rule
            for (int i = 0; i < selectors.getLength(); i++)
            {
                ElementSelector selector = (ElementSelector)selectors.item(i);

                if (selector != null)
                {
                    string selectorName = selector.getLocalName();

                    // if the selector is valid, add to list
                    if (validator.isValidSelector(selectorName, selector, results))
                    {
                        if (selectorCount > 0)
                        {
                            styleSheet.Append(',');
                            styleSheet.Append(' ');
                        }
                        styleSheet.Append(selectorName);

                        selectorCount++;
                    }
                    else
                    {
                        if (tagName != null)
                        {
                            //ErrorMessage("The <b>" + HTMLEntityEncoder.htmlEntityEncode(tagName) + "</b> tag had a <b>style</b> selector that was invalid. The value of <u>" + HTMLEntityEncoder.htmlEntityEncode(selector.ToString()) + "</u> could not be processed for security reasons.");
                        }
                        else
                        {
                            //results.addErrorMessage("The <b>style</b> tag had a selector that was invalid. The value <u>" + HTMLEntityEncoder.htmlEntityEncode(selector.ToString()) + "</u> could not be processed for security reasons.");
                        }
                    }
                }
            }

            // if and only if there were selectors that were valid, append
            // appropriate open brace and set state to within selector
            if (selectorCount > 0)
            {
                styleSheet.Append(' ');
                styleSheet.Append('{');
                styleSheet.Append('\n');
                selectorOpen = true;
            }
        }
Esempio n. 5
0
        /*
        * (non-Javadoc)
        *
        * @see org.w3c.css.sac.DocumentHandler#startSelector(org.w3c.css.sac.SelectorList)
        */
        public virtual void startSelector(SelectorList selectors)
        {
            // keep track of number of valid selectors from this rule
            int selectorCount = 0;

            // check each selector from this rule
            for (int i = 0; i < selectors.getLength(); i++)
            {
                ElementSelector selector = selectors.item(i) as ElementSelector;

                if (selector != null)
                {
                    string selectorName = selector.getLocalName();

                    // if the selector is valid, add to list
                    if (validator.isValidSelector(selectorName, selector, results))
                    {
                        if (selectorCount > 0)
                        {
                            styleSheet.Append(',');
                            styleSheet.Append(' ');
                        }
                        styleSheet.Append(selectorName);

                        selectorCount++;
                    }
                    else
                    {
                        if (tagName != null)
                        {
                            //ErrorMessage("The <b>" + HTMLEntityEncoder.htmlEntityEncode(tagName) + "</b> tag had a <b>style</b> selector that was invalid. The value of <u>" + HTMLEntityEncoder.htmlEntityEncode(selector.ToString()) + "</u> could not be processed for security reasons.");
                        }
                        else
                        {
                            //results.addErrorMessage("The <b>style</b> tag had a selector that was invalid. The value <u>" + HTMLEntityEncoder.htmlEntityEncode(selector.ToString()) + "</u> could not be processed for security reasons.");
                        }
                    }
                }
            }

            // if and only if there were selectors that were valid, append
            // appropriate open brace and set state to within selector
            if (selectorCount > 0)
            {
                styleSheet.Append(' ');
                styleSheet.Append('{');
                styleSheet.Append('\n');
                selectorOpen = true;
            }
        }
Esempio n. 6
0
        /*
        * (non-Javadoc)
        *
        * @see org.w3c.css.sac.DocumentHandler#endSelector(org.w3c.css.sac.SelectorList)
        */
        public virtual void endSelector(SelectorList selectors)
        {
            // if we are in a state within a selector, close brace
            if (selectorOpen)
            {
                styleSheet.Append('}');
                styleSheet.Append('\n');
            }

            // reset state
            selectorOpen = false;
        }
Esempio n. 7
0
 public IDisposable EnterScope(SelectorList selectors)
 {
     return(EnterScope(CurrentScope.CreateChildScope(selectors)));
 }
Esempio n. 8
0
            internal override Selector DoParse()
            {
                if (End)
                {
                    return(null);
                }
                var lst = new SelectorList();

                bool expectingNext = false;

                while (true)
                {
                    bool end = false;
                    switch (CurrentChar)
                    {
                    default:
                        var sel = DoParseOne();
                        if (sel == null)
                        {
                            // that's a warning
                            end = true;
                        }
                        else
                        {
                            lst.Selectors.Add(sel);
                        }
                        break;

                    case ';':
                    case '{':
                    case '}':
                    case ')':
                        // stoop
                        end = true;
                        break;
                    }

                    if (expectingNext && end)
                    {
                        // we've got a token after a ','
                        if (!End)
                        {
                            AddError(ErrorCode.UnexpectedToken, CurrentChar.ToString());
                        }
                    }

                    expectingNext = !End && CurrentChar == ',';
                    if (expectingNext)
                    {
                        Index++;
                    }

                    if (End || !expectingNext)
                    {
                        end = true;
                    }

                    if (end)
                    {
                        if (lst.Selectors.Count == 0)
                        {
                            return(null);
                        }
                        if (lst.Selectors.Count == 1)
                        {
                            return(lst.Selectors[0]);
                        }
                        return(lst);
                    }
                }
            }
Esempio n. 9
0
        public async Task <IViewComponentResult> InvokeAsync(string idForm)
        {
            var user = await _userHandler.GetUserAsync(HttpContext.User);

            List <string> partIds = await _userHandler.GetAllowPartsForView(user, idForm);

            MtdFilter filter = await _context.MtdFilter.FirstOrDefaultAsync(x => x.IdUser == user.Id && x.MtdForm == idForm);

            var query = _context.MtdFormPartField.Include(m => m.MtdFormPartNavigation)
                        .Where(x => x.MtdFormPartNavigation.MtdForm == idForm & x.Active & partIds.Contains(x.MtdFormPart))
                        .OrderBy(x => x.MtdFormPartNavigation.Sequence).ThenBy(x => x.Sequence);

            IList <MtdFormPartField> mtdFields;

            if (filter != null)
            {
                List <string> fieldIds = await _context.MtdFilterField.Where(x => x.MtdFilter == filter.Id)
                                         .Select(x => x.MtdFormPartField).ToListAsync();

                mtdFields = await query.Where(x => !fieldIds.Contains(x.Id)).ToListAsync();
            }
            else
            {
                mtdFields = await query.ToListAsync();
            }

            IList <MtdSysTerm> mtdSysTerms = await _context.MtdSysTerm.ToListAsync();

            List <SelectorList> storeList = new List <SelectorList>();

            foreach (var field in mtdFields.Where(x => x.MtdSysType == 11).ToList())
            {
                string idFormForList = await _context.MtdFormList.Where(x => x.Id == field.Id).Select(x => x.MtdForm).FirstOrDefaultAsync();

                MtdFormPartField fieldForList = await _context.MtdFormPartField.Include(m => m.MtdFormPartNavigation)
                                                .Where(x => x.MtdFormPartNavigation.MtdForm == idFormForList & x.MtdSysType == 1)
                                                .OrderBy(o => o.MtdFormPartNavigation.Sequence).ThenBy(o => o.Sequence).FirstOrDefaultAsync();

                if (idFormForList != null)
                {
                    List <SelecorStore> selecorStores = await _context.MtdStoreStack
                                                        .Include(x => x.MtdStoreStackText).Where(x => x.MtdFormPartField == fieldForList.Id)
                                                        .Select(x => new SelecorStore {
                        IdStore = x.MtdStore, Result = x.MtdStoreStackText.Register
                    })
                                                        .OrderBy(x => x.Result)
                                                        .ToListAsync();

                    SelectorList selectorList = new SelectorList
                    {
                        FieldAim = field,
                        FieldOut = fieldForList,
                        Store    = selecorStores
                    };

                    storeList.Add(selectorList);
                }
            }

            IList <MtdFilterScript> scripts = await _context.MtdFilterScript.Where(x => x.MtdFilter == filter.Id && x.Apply == 0).ToListAsync();

            SelectorModelView selector = new SelectorModelView()
            {
                IdForm            = idForm,
                MtdFormPartFields = mtdFields,
                MtdSysTerms       = mtdSysTerms,
                StoreList         = storeList,
                MtdFilterScripts  = scripts
            };

            return(View("Default", selector));
        }
Esempio n. 10
0
        public override void LoadUI()
        {
            _optionsPanel = new Panel(
                new UIDimension()
            {
                WidthMode  = UIDimensionModes.Fixed,
                X          = -48,
                Width      = 96,
                HeightMode = UIDimensionModes.Stretch,
            }
                )
            {
                Anchor = AnchorPoints.TopRight,
            };


            _fileSelector = new SelectorList(
                _optionsPanel,
                new UIDimension()
            {
                WidthMode  = UIDimensionModes.Stretch,
                Left       = 4,
                Right      = 4,
                HeightMode = UIDimensionModes.Fixed,
                Y          = 40,
                Height     = 72,
            }
                )
            {
                Anchor = AnchorPoints.TopMiddle,
            };

            var loadButton = new TextButton(
                _optionsPanel,
                new UIDimension()
            {
                WidthMode  = UIDimensionModes.Stretch,
                Left       = 4,
                Right      = 4,
                HeightMode = UIDimensionModes.Fixed,
                Y          = 82,
                Height     = 13,
            },
                "Load Map",
                Color.Blue
                )
            {
                OnClick = (e) =>
                {
                    if (_fileSelector.Selected.HasValue)
                    {
                        var file = _files[_fileSelector.Selected.Value.Value];
                        DebugConsole.WriteLine($"Loading level: {file}");
                        LevelManager.LoadLevel(file);
                    }
                }
            };

            LoadLevelFiles();

            _fileNameInputBox = new InputBox(
                _optionsPanel,
                new UIDimension()
            {
                WidthMode  = UIDimensionModes.Stretch,
                Left       = 4,
                Right      = 4,
                HeightMode = UIDimensionModes.Fixed,
                Y          = 108,
                Height     = 13,
            }
                );
            var saveButton = new TextButton(
                _optionsPanel,
                new UIDimension()
            {
                WidthMode  = UIDimensionModes.Stretch,
                Left       = 4,
                Right      = 4,
                HeightMode = UIDimensionModes.Fixed,
                Y          = 121,
                Height     = 13,
            },
                "Save Map",
                Color.Blue
                )
            {
                OnClick = (e) =>
                {
                    LevelManager.SaveLevel(_fileNameInputBox.Value);
                    LoadLevelFiles();
                }
            };


            UIManager.AddElement(_optionsPanel);
        }