Ejemplo n.º 1
0
            public object Next()
            {
                MenuPosition menuPosition = MenuPositions.ElementAt(Position);

                Position++;
                return(menuPosition);
            }
Ejemplo n.º 2
0
        /// <summary>
        /// 取得選單
        /// </summary>
        /// <param name="position">The position.</param>
        /// <returns></returns>
        private CiResult <List <TreeWebViewModel> > GetMenu(MenuPosition position)
        {
            var result = new CiResult <List <TreeWebViewModel> >();

            try
            {
                var data = service.GetTrees(null, new ItemTreeFilter
                {
                    MenuPosition  = position,
                    ItemType      = ItemType.Category,
                    LangType      = ApplicationHelper.DefaultLanguage,
                    SelectEnabled = true,
                    EmptyContinue = (position == MenuPosition.Bottom)
                });

                result.Data      = TransModel(data);
                result.IsSuccess = true;
            }
            catch (Exception e)
            {
                result.Message = e.Message;
            }

            return(result);
        }
Ejemplo n.º 3
0
            public object Next()
            {
                MenuPosition menuPosition = MenuPositions[Position];

                Position++;
                return(menuPosition);
            }
Ejemplo n.º 4
0
 public MenuBouton(string Text, MenuPosition Position, MenuAction Action, int screenWidth, int screenHeight)
 {
     _screenWidth = screenWidth;
     _screenHeight = screenHeight;
     _Text = Text;
     _MenuPosition = Position;
     _MenuAction = Action;
 }
Ejemplo n.º 5
0
        public ActionResult Menu(MenuPosition position, string style = "")
        {
            var result = mainServie.GetMenuByCache(position);

            ViewBag.style = style;

            return(PartialView(ViewName("Item", "Menu_" + position.ToString()), result.Data));
        }
        public void AddContextMenuItem(Robot robot, string name, MenuPosition menuPosition)
        {
            string key = MenuItem.Prefix + name;

            if (_animators.ContainsKey(key))
            {
                var menuItem = new MenuItem(name, _animators[key]);
                robot.AddContextMenuItem(menuItem, menuPosition);
            }
        }
    public void GoToOptions()
    {
        // Get rid of all other buttons
        HideMainMenu();

        // Set the next camera position
        cameraPosition  = new Vector3(-8, -2, -5);
        currentPosition = MenuPosition.Options;

        elapsedZoomTime = 0.0f;
    }
Ejemplo n.º 8
0
 private static void WriteMenu(Iterator iterator)
 {
     while (iterator.HasNext())
     {
         MenuPosition menuPosition = (MenuPosition)iterator.Next();
         if (menuPosition != null)
         {
             Console.WriteLine($"{menuPosition.Name}, {menuPosition.Description}, {menuPosition.IsVege}, {menuPosition.Cost}");
         }
     }
 }
Ejemplo n.º 9
0
 public void AddMenuPosition(string name, string description, bool isVege, double cost)
 {
     if (items >= MAX_ITEMS)
     {
         Console.WriteLine("Menu is full");
     }
     else
     {
         MenuPositions[items] = new MenuPosition(name, description, isVege, cost);
         items++;
     }
 }
Ejemplo n.º 10
0
 public Menu(
     string title          = "MenuV",
     string subtitle       = "",
     MenuPosition position = MenuPosition.TopLeft,
     int red           = 0,
     int green         = 0,
     int blue          = 255,
     MenuSize size     = MenuSize.Size110,
     string texture    = "default",
     string dictionary = "menuv")
     : this(title, subtitle, position, Color.FromArgb(red, green, blue), size, texture, dictionary)
 {
 }
Ejemplo n.º 11
0
 public static String ResolvePosition(MenuPosition menuPosition)
 {
     switch (menuPosition)
     {
             case MenuPosition.FixedTop:
                 return "navbar-fixed-top";
             case MenuPosition.FixedBottom:
                 return "navbar-fixed-bottom";
             case MenuPosition.UnFixed:
                 return String.Empty;
     }
     return "navbar-fixed-top";
 }
Ejemplo n.º 12
0
        public static String ResolvePosition(MenuPosition menuPosition)
        {
            switch (menuPosition)
            {
            case MenuPosition.FixedTop:
                return("navbar-fixed-top");

            case MenuPosition.FixedBottom:
                return("navbar-fixed-bottom");

            case MenuPosition.UnFixed:
                return(String.Empty);
            }
            return("navbar-fixed-top");
        }
Ejemplo n.º 13
0
        public BasePanelScript(Config config, string menuTitle, MenuFactory parentMenu = null) : base(config, menuTitle, parentMenu)
        {
            MenuPosition = Menu.Menu("Position", "position");
            PositionType = Menu.Item("Render type", new StringList("fixed", "absolute"));
            Movable      = MenuPosition.Item("Movable", false);

            PositionGlobalX = MenuPosition.Item("Global X", new Slider(0, 0, 2500));
            PositionGlobalY = MenuPosition.Item("Global Y", new Slider(0, 0, 2500));
            PositionLocalX  = MenuPosition.Item("Local X", new Slider(0, -50, 50));
            PositionLocalY  = MenuPosition.Item("Local Y", new Slider(0, -50, 50));

            LoadMovable(Config.Main.Context.Value.Input);
            PanelPos        = new Vector2(PositionGlobalX, PositionGlobalY);
            PanelTopBarSize = new Vector2(100, 16);
        }
Ejemplo n.º 14
0
        private void PrintButtonWithDir(MenuPosition position)
        {
            switch (position)
            {
            case MenuPosition.RightDown:
                for (int i = 0; i < menu.Count; i++)
                {
                    if (GUI.Button(new Rect(screenPos.x + 10, Screen.height - screenPos.y + i * 20, 50, 20), menu[i]))
                    {
                        ClickButton(menu[i]);
                    }
                }
                break;

            case MenuPosition.LeftDown:
                for (int i = 0; i < menu.Count; i++)
                {
                    if (GUI.Button(new Rect(screenPos.x - 60, Screen.height - screenPos.y + i * 20, 50, 20), menu[i]))
                    {
                        ClickButton(menu[i]);
                    }
                }
                break;

            case MenuPosition.RightUp:
                for (int i = 0; i < menu.Count; i++)
                {
                    if (GUI.Button(new Rect(screenPos.x + 10, Screen.height - screenPos.y - i * 20, 50, 20), menu[i]))
                    {
                        ClickButton(menu[i]);
                    }
                    ;
                }
                break;

            case MenuPosition.LeftUp:
                for (int i = 0; i < menu.Count; i++)
                {
                    if (GUI.Button(new Rect(screenPos.x - 60, Screen.height - screenPos.y - i * 20, 50, 20), menu[i]))
                    {
                        ClickButton(menu[i]);
                    }
                }
                break;
            }
        }
Ejemplo n.º 15
0
 public Menu(
     string title          = "MenuV",
     string subtitle       = "",
     MenuPosition position = MenuPosition.TopLeft,
     Color color           = new Color(),
     MenuSize size         = MenuSize.Size110,
     string texture        = "default",
     string dictionary     = "menuv")
 {
     this.IsOpen     = false;
     this.UUID       = Guid.NewGuid();
     this.Title      = title;
     this.Subtitle   = subtitle;
     this.Position   = position;
     this.Color      = color.IsNullOrDefault() ? Color.FromArgb(0, 0, 255) : color;
     this.Size       = size;
     this.Texture    = string.IsNullOrWhiteSpace(texture) ? "default" : texture;
     this.Dictionary = string.IsNullOrWhiteSpace(dictionary) ? "menuv" : dictionary;
 }
    public void GoToLevelSelect()
    {
        // Get rid of all other buttons
        HideMainMenu();

        // Show all the buttons
        foreach (Button button in levelButtons)
        {
            button.interactable = true;
        }

        EventSystem.current.SetSelectedGameObject(levelButtons[0].gameObject);

        // Set the next camera position
        cameraPosition  = new Vector3(0, 0, 10);
        currentPosition = MenuPosition.LevelSelect;

        elapsedZoomTime = 0.0f;
    }
Ejemplo n.º 17
0
        public void AddContextMenuItem(MenuItem item, MenuPosition position)
        {
            var offset = position switch
            {
                MenuPosition.Left => new Vector2(-100, 0),
                MenuPosition.TopLeft => new Vector2(-100, -100),
                MenuPosition.Top => new Vector2(0, -100),
                MenuPosition.TopRight => new Vector2(100, -100),
                MenuPosition.Center => new Vector2(0, 0),
                MenuPosition.Right => new Vector2(100, 0),
                MenuPosition.BottomLeft => new Vector2(-100, 100),
                MenuPosition.Bottom => new Vector2(0, 100),
                MenuPosition.BottomRight => new Vector2(100, 100),
                _ => throw new NotImplementedException(),
            };

            item.Animator.Position = Animator.Position + offset;
            item.Animator.Scale    = new Vector2(.75f, .75f);
            ContextMenu.AddItem(item, position);
        }
Ejemplo n.º 18
0
        /// <summary>
        /// 取得選單 by cache
        /// </summary>
        /// <param name="position">The position.</param>
        /// <returns></returns>
        public CiResult <List <TreeWebViewModel> > GetMenuByCache(MenuPosition position)
        {
            var result      = new CiResult <List <TreeWebViewModel> >();
            var cacheHelper = new CacheHelper();
            var chacheName  = $"{ApplicationHelper.ClientID}_menu_{position.ToString()}";

            //get cache
            result.Data = cacheHelper.Get <List <TreeWebViewModel> >(chacheName);

            //set cache
            if (result.Data == null)
            {
                result = GetMenu(position);
                if (result.IsSuccess && !string.IsNullOrEmpty(chacheName))
                {
                    cacheHelper.Set(chacheName, result.Data, 72);
                }
            }

            return(result);
        }
Ejemplo n.º 19
0
        public static string ToText(this MenuPosition position)
        {
            if (position.IsNullOrDefault())
            {
                return("topleft");
            }

            switch (position)
            {
            case MenuPosition.TopLeft:
                return("topleft");

            case MenuPosition.TopCenter:
                return("topcenter");

            case MenuPosition.TopRight:
                return("topright");

            case MenuPosition.CenterLeft:
                return("centerleft");

            case MenuPosition.Center:
                return("center");

            case MenuPosition.CenterRight:
                return("centerright");

            case MenuPosition.BottomLeft:
                return("bottomleft");

            case MenuPosition.BottomCenter:
                return("bottomcenter");

            case MenuPosition.BottomRight:
                return("bottomright");
            }

            return("topleft");
        }
Ejemplo n.º 20
0
        public static IMenu CreateMenu(
            string title          = "MenuV",
            string subtitle       = "",
            MenuPosition position = MenuPosition.TopLeft,
            int red           = 0,
            int green         = 0,
            int blue          = 255,
            MenuSize size     = MenuSize.Size110,
            string texture    = "default",
            string dictionary = "menuv")
        {
            var menu = new Menu(title, subtitle, position, red, green, blue, size, texture, dictionary);

            if (Main.Menus.ContainsKey(menu.UUID))
            {
                Main.Menus[menu.UUID] = menu;
            }
            else
            {
                Main.Menus.Add(menu.UUID, menu);
            }

            return(menu);
        }
Ejemplo n.º 21
0
 public void GetContextMenuItem(MenuPosition position) => ContextMenu.GetItem(position);
Ejemplo n.º 22
0
 public static bool IsTop(this MenuPosition position)
 {
     return(position == MenuPosition.TopLeft ||
            position == MenuPosition.TopCenter ||
            position == MenuPosition.TopRight);
 }
Ejemplo n.º 23
0
 public static bool IsBottom(this MenuPosition position)
 {
     return(position == MenuPosition.BottomLeft ||
            position == MenuPosition.BottomCenter ||
            position == MenuPosition.BottomRight);
 }
Ejemplo n.º 24
0
        public CiResult <List <TreeWebViewModel> > Menu(MenuPosition position)
        {
            var result = mainServie.GetMenuByCache(position);

            return(result);
        }
Ejemplo n.º 25
0
 public MenuItem GetItem(MenuPosition position)
 {
     return(_items.TryGetValue(position, out var item) ? item : null);
 }
Ejemplo n.º 26
0
 public Menu SetPosition(MenuPosition position)
 {
     this.Component.Position = position;
     return(this);
 }
Ejemplo n.º 27
0
 public static MenuPosition CreateMenuPosition(int id)
 {
     MenuPosition menuPosition = new MenuPosition();
     menuPosition.ID = id;
     return menuPosition;
 }
Ejemplo n.º 28
0
 public static bool IsCenter(this MenuPosition position)
 {
     return(position == MenuPosition.TopCenter ||
            position == MenuPosition.MiddleCenter ||
            position == MenuPosition.BottomCenter);
 }
Ejemplo n.º 29
0
 public static bool IsLeft(this MenuPosition position)
 {
     return(position == MenuPosition.TopLeft ||
            position == MenuPosition.MiddleLeft ||
            position == MenuPosition.BottomLeft);
 }
Ejemplo n.º 30
0
 public static bool IsRight(this MenuPosition position)
 {
     return(position == MenuPosition.TopRight ||
            position == MenuPosition.MiddleRight ||
            position == MenuPosition.BottomRight);
 }
	public void GoToOptions()
	{
		// Get rid of all other buttons
		DisableAllButtons();

		// Show all the buttons
		foreach( Button button in optionsButtons )
			button.interactable = true;
		
		EventSystem.current.SetSelectedGameObject( optionsButtons[ 0 ].gameObject );
		
		// Set the next camera position
		cameraPosition = new Vector3( -320, 0, -120 );
		currentPosition = MenuPosition.Options;

		elapsedZoomTime = 0.0f;
	}
Ejemplo n.º 32
0
 public void SetPosition(MenuPosition position)
 {
     this.Position = position;
 }
Ejemplo n.º 33
0
 public void AddItem(MenuItem item, MenuPosition position)
 {
     _items[position] = item;
 }
 public ExportPackageConextMenuItemAttribute(String key, MenuPosition relativePosition, String relativeMenuItemKey)
     : base(key, relativePosition, relativeMenuItemKey, AssetTypes.Package)
 {
 }
Ejemplo n.º 35
0
 public static bool IsMiddle(this MenuPosition position)
 {
     return(position == MenuPosition.MiddleLeft ||
            position == MenuPosition.MiddleCenter ||
            position == MenuPosition.MiddleRight);
 }
	public void GoToLevelSelect()
	{
		// Play the gate sound if it is closed
		if( currentPosition == MenuPosition.MainGate && soundManager ) 
		{
			soundManager.PlaySoundEffect( gateSound );
		}

		// Get rid of all other buttons
		DisableAllButtons();

		// Show all the buttons
		foreach( Button button in levelButtons )
			button.interactable = true;

		EventSystem.current.SetSelectedGameObject( levelButtons[ 0 ].gameObject );

		// Set the next camera position
		cameraPosition = new Vector3( 0, 0, 400 );

		// set the gate rotation
		gateRotationLeft = Quaternion.Euler( 0, -45, 0 );
		gateRotationRight = Quaternion.Euler( 0, 45, 0 );

		currentPosition = MenuPosition.LevelSelect;

		elapsedZoomTime = 0.0f;

		descriptionBox.transform.position = new Vector3( 0, -20, 700 );
	}
Ejemplo n.º 37
0
 public void AddToMenuPositions(MenuPosition menuPosition)
 {
     base.AddObject("MenuPositions", menuPosition);
 }
Ejemplo n.º 38
0
 public Menu SetPosition(MenuPosition position)
 {
     this.Component.Position = position;
     return this;
 }
	public void GoToModeSelect()
	{
		// Play the audio if from the correct screen
		if( currentPosition == MenuPosition.LevelSelect && soundManager ) 
		{
			soundManager.PlaySoundEffect( levelSound );
		}

		// Get rid of all other buttons
		DisableAllButtons();
		
		// Show all the buttons
		foreach( Button button in modeButtons )
			button.interactable = true;
		
		EventSystem.current.SetSelectedGameObject( modeButtons[ 0 ].gameObject );

		levelText.text = levelName;
		
		// Set the next camera position
		cameraPosition = new Vector3( 1500, 0, 400 );
		
		currentPosition = MenuPosition.ModeSelect;
		
		elapsedZoomTime = 0.0f;

		descriptionBox.transform.position = new Vector3( 1500, -20, 700 );
	}
 public ExportContextMenuItemAttribute(String key, MenuPosition relativePosition, String relativeMenuItemKey, String assetType)
     : base(key, relativePosition, relativeMenuItemKey)
 {
     this.AssetType = assetType;
     this.IsMainMenuItem = false;
 }
Ejemplo n.º 41
0
 public MenuItemInfo(String menuItemKey, MenuPosition relativePosition, String relativeMenuItemKey, MenuItemModel menuItem, Boolean shouldPrependSeparator)
 {
     this.MenuItemKey = menuItemKey;
     this.RelativePosition = relativePosition;
     this.RelativeMenuItemKey = relativeMenuItemKey;
     this.MenuItem = menuItem;
     this.ShouldPrependSeparator = shouldPrependSeparator;
 }
	public void GoToMainMenu()
	{
		// Get rid of all other buttons
		DisableAllButtons();

		// Show all the buttons
		foreach( Button button in mainButtons )
			button.interactable = true;

		EventSystem.current.SetSelectedGameObject( mainButtons[ 0 ].gameObject );

		// Set the next camera position
		cameraPosition = new Vector3( 0, 55, -305 );

		// set the gate rotation
		gateRotationLeft = Quaternion.Euler( 0, 0, 0 );
		gateRotationRight = Quaternion.Euler( 0, 0, 0 );

		currentPosition = MenuPosition.MainGate;
		
		elapsedZoomTime = 0.0f;
	}