Exemplo n.º 1
0
        public MenuPageViewModel(IViewModelBaseModule baseModule, IMenuModule menuModule) : base(baseModule)
        {
            Title       = "MenuPage";
            _menuModule = menuModule;

            MenuList = new ObservableCollection <MenuItem>();

            Task.Run(async() =>
            {
                var user = await BaseModule.CacheEntity.GetObjectAsync <User>(AppSettings.IdAppUserCache);
                if (user != null)
                {
                    Email = user.Email;
                }
            });

            LoadMenu();
        }
Exemplo n.º 2
0
 public SelectShipCommand(IMenuModule m, string id)
 {
     menuModule = m;
     this.id    = id;
 }
Exemplo n.º 3
0
 public PlayCommand(IMenuModule m)
 {
     menuModule = m;
 }
Exemplo n.º 4
0
 public SelectDifficultyCommand(IMenuModule m, string id)
 {
     menuModule = m;
     this.id    = id;
 }
Exemplo n.º 5
0
 public MenuFactory(string dirPath, IMenuModule menuModule)
 {
     this.dirPath    = dirPath;
     this.menuModule = menuModule;
     menuElementFac  = new MenuElementFactory();
 }
Exemplo n.º 6
0
 public NavToCommand(IMenuModule m, string id, string parentId)
 {
     menuModule    = m;
     this.id       = id;
     this.parentId = parentId;
 }
Exemplo n.º 7
0
        public List <MenuElement> Create(JArray textBoxesObj, JArray buttonsObj, JArray colorsObj, IMenuModule menuModule, string parentId)
        {
            List <MenuElement> result = new List <MenuElement>();

            Color hoverColor  = Util.DeserializeKeyedColor(colorsObj, "hoverColor");
            Color fillColor   = Util.DeserializeKeyedColor(colorsObj, "fillColor");
            Color borderColor = Util.DeserializeKeyedColor(colorsObj, "borderColor");
            Color fontColor   = Util.DeserializeKeyedColor(colorsObj, "fontColor");

            foreach (JObject obj in textBoxesObj)
            {
                result.Add(CreateTextBox(obj, hoverColor, fillColor, borderColor, fontColor));
            }

            foreach (JObject obj in buttonsObj)
            {
                result.Add(CreateButton(obj, hoverColor, fillColor, borderColor, fontColor, menuModule, parentId));
            }

            return(result);
        }
Exemplo n.º 8
0
        /// <summary>
        /// built on runtime to allow the plaeyr to choose different data selections
        /// </summary>
        /// <returns></returns>
        public SelectButton CreateSelectButton(string id, string label, Rectangle bounds, SelectionType type, string payload, SelectionGroup parent, IMenuModule menuModule)
        {
            MenuCommandFactory menuCommandFac = new MenuCommandFactory(menuModule);
            ICommand           command;

            switch (type)
            {
            case SelectionType.Difficulty:
                command = new SelectDifficultyCommand(menuModule, payload);
                break;

            case SelectionType.Level:
                command = new SelectLevelCommand(menuModule, payload);
                break;

            case SelectionType.Ship:
                command = new SelectShipCommand(menuModule, payload);
                break;

            default:
                command = null;
                break;
            }
            Color hover  = Color.Orange;
            Color fill   = Color.Grey;
            Color border = Color.White;
            Color font   = Color.White;

            return(new SelectButton(id, command, bounds, hover, fill, border, font, payload, parent, type));
        }
Exemplo n.º 9
0
        public Button CreateButton(JObject buttonObj, Color hover, Color fill, Color border, Color font, IMenuModule menuModule, string parentId)
        {
            Rectangle bounds  = CreateElementBounds(buttonObj);
            string    text    = buttonObj.Value <string>("label");
            string    action  = buttonObj.Value <string>("action");
            string    payload = "";

            try { payload = buttonObj.Value <string>("payload"); } catch { }

            string id   = buttonObj.Value <string>("id");
            string type = buttonObj.Value <string>("type");

            //build command for button
            MenuCommandFactory menuCommandFac = new MenuCommandFactory(menuModule);
            ICommand           command        = menuCommandFac.Create(action, payload, parentId);

            switch (type.ToLower())
            {
            case "nonstick":
                return(new NonStickButton(id, command, bounds, hover, fill, border, font, text));

            default:
                return(new Button(id, command, bounds, hover, fill, border, font, text));
            }
        }
Exemplo n.º 10
0
 public MenuCommandFactory(IMenuModule m)
 {
     menuModule = m;
 }
Exemplo n.º 11
0
 public ExitMenuCommand(IMenuModule m)
 {
     menuModule = m;
 }