• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# MenuButton类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中MenuButton的典型用法代码示例。如果您正苦于以下问题:C# MenuButton类的具体用法?C# MenuButton怎么用?C# MenuButton使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



MenuButton类属于命名空间,在下文中一共展示了MenuButton类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: DietySelected

    public void DietySelected(MenuButton pressed)
    {
        // Find the diety with the name stored in button text, make the sacrifice to them
        Diety[] dieties = WorldManager.instance.GetDieties();
        int selectedIdx = -1;
        for(int i = 0; i < dieties.Length; i++) {
            if(dieties[i].dietyName == pressed.text) {
                selectedIdx = i;
                break;
            }
        }

        // Found the diety, can make a sacrifice to them
        if(selectedIdx >= 0) {
            Inventory inventory = UI_base.GetOwner().GetInventory();
            if(inventory == null) {
                Debug.Log("ERROR! UI_DietyMenu::DietySelected() Failed to find player inventory!");
                return;
            }

            // Only make the actuall sacrifice if the item was actually found and removed from the inventory
            if(inventory.RemoveCraftingItem(itemName)) {
                dieties[selectedIdx].SacrificeMade(itemName);
            }
        }

        CloseMenu();
    }
开发者ID:tedmunds,项目名称:HunterGame,代码行数:28,代码来源:UI_DietyMenu.cs


示例2: SublimeWeaponComponentMenu

    private void SublimeWeaponComponentMenu(MenuButton buttonSender, WeaponHash weaponHash)
    {
        List<IMenuItem> componentButtons = new List<IMenuItem>();

        foreach (KeyValuePair<string, string> weaponComponent in weaponComponentItems)
        {
            int weaponComponentHash = Function.Call<int>(Hash.GET_HASH_KEY, weaponComponent.Key);
            bool canWeaponHaveComponent = Function.Call<bool>(Hash._CAN_WEAPON_HAVE_COMPONENT, (int) weaponHash, weaponComponentHash);
            if (canWeaponHaveComponent)
            {
                var componentActivateButton = new MenuButton(weaponComponent.Value);
                componentActivateButton.Activated += (sender, args) => WeaponFunctions.ChangeWeaponComponent(weaponHash, weaponComponent);
                componentButtons.Add(componentActivateButton);
            }
        }

        foreach (KeyValuePair<string, int> tintIndex in weaponTintIndexDict)
        {
            var tintActivateButton = new MenuButton(tintIndex.Key);
            tintActivateButton.Activated += (sender, args) => WeaponFunctions.ChangeWeaponTint(weaponHash, tintIndex.Value);
            componentButtons.Add(tintActivateButton);
        }

        WeaponComponentsMenu = new GTA.Menu(buttonSender.Caption, componentButtons.ToArray());
        DrawMenu(WeaponComponentsMenu);
    }
开发者ID:Colata,项目名称:Sublime,代码行数:26,代码来源:WeaponMenu.cs


示例3: OpenMenu

    public override void OpenMenu()
    {
        base.OpenMenu();

        // Build the options based on what the player currently has in their inventory
        options.Clear();

        Player player = UI_base.GetOwner();
        Inventory inv = player.GetInventory();
        if(inv == null) {
            Debug.Log("ERROR! UI_SacrificeMenu::OpenMenu() Failed to find player inventory!");
            return;
        }

        // Create an option button for each craftin item
        foreach(string item in inv.CraftingItems()) {
            int numOfItem = inv.GetNumOfCraftingItem(item);
            MenuButton btn = new MenuButton(item, SacrificeSelected);

            string itemEffect = WorldManager.instance.GetCraftingItemByName(item).effectText;

            btn.info = "x " + numOfItem + " : " + itemEffect;
            options.Add(btn);
        }
    }
开发者ID:tedmunds,项目名称:HunterGame,代码行数:25,代码来源:UI_SacrificeMenu.cs


示例4: Start

    // Use this for initialization
    void Start()
    {
        if (defaultButton != null) {
            defaultButtonComponent = (MenuButton) defaultButton.GetComponent("MenuButton");
        }
        else {
            Debug.LogWarning(gameObject.name + ": MenuController: defaultButton not set, menu will get confused unless set.");
        }

        // store the camera position
        foreach (Transform child in transform) {
            if (child.gameObject.name == "CameraPosition") {
                cameraPostion = child;
            }
        }

        if (cameraPostion == null) {
            Debug.LogWarning(gameObject.name + ": MenuController: no cameraPostion object set, please name a game object to 'CameraPosition' and the correct transform will be set");
        }

        // activate this menu if necessary
        if (activateMenuOnStart) {
            ActivateMenu();
        }
    }
开发者ID:uclagamelab,项目名称:Summer-Platformer,代码行数:26,代码来源:MenuController.cs


示例5: LoadContent

        public override void LoadContent()
        {
            // Set the mouse to be visible so the user can see the mouse to use the UI.
            ScreenManager.Game.IsMouseVisible = true;

            // Get the center of the screen (right under the Dark Havoc logo).
            centerOfScreen = new Vector2(ScreenManager.GraphicsDevice.Viewport.TitleSafeArea.Center.X, ScreenManager.GraphicsDevice.Viewport.TitleSafeArea.Center.Y + (Assets.darkHavocLogo.Height / 2) + 30);

            // Play Button initialization
            playGameButton = new MenuButton(centerOfScreen, "Play!");
            playGameButton.Selected += new EventHandler<EventArgs>(playGameButton_Selected);
            playGameButton.Position = new Vector2(centerOfScreen.X - (MenuButton.ButtonWidth * 2) - 25, centerOfScreen.Y);
            playGameButton.Initialize();

            // Options/Help button initialization
            optionsHelpButton = new MenuButton(centerOfScreen, "Options");
            optionsHelpButton.Selected += new EventHandler<EventArgs>(optionsHelpButton_Selected);
            optionsHelpButton.Position = new Vector2(centerOfScreen.X - (MenuButton.ButtonWidth / 2), centerOfScreen.Y);
            optionsHelpButton.Initialize();

#if WINDOWS
            // Exit button initialization
            exitButton = new MenuButton(centerOfScreen, "Exit Game");
            exitButton.Selected += new EventHandler<EventArgs>(exitButton_Selected);
            exitButton.Position = new Vector2(centerOfScreen.X + MenuButton.ButtonWidth + 25, centerOfScreen.Y);
            exitButton.Initialize();
#endif
        }
开发者ID:JoshuaKennedy,项目名称:DarkHavoc,代码行数:28,代码来源:MainMenuScreen_old.cs


示例6: OnSaveGameClick

    public void OnSaveGameClick()
    {
        SetAllActiveFalse();
        SaveGame.SetActive(true);

        ButtonClick = MenuButton.SAVEGAME;
    }
开发者ID:XvWenJun,项目名称:Retuer_6,代码行数:7,代码来源:MenuButtonClick.cs


示例7: GiveWeapon

 void GiveWeapon(MenuButton sender, KeyValuePair<WeaponHash, int> weapon)
 {
     {
         Game.Player.Character.Weapons.Give(weapon.Key, 120, true, true);
         UI.Notify("Weapon Given!", true);
     }
 }
开发者ID:Colata,项目名称:GTA-5-Mods,代码行数:7,代码来源:Weapons.cs


示例8: giveWeapon

 void giveWeapon(MenuButton sender, KeyValuePair<WeaponHash, int> weapon)
 {
     {
         Game.Player.Character.Weapons.Give(weapon.Key, 9999, true, true);
         UI.Notify("Item Action", true);
     }
 }
开发者ID:Colata,项目名称:GTA-5-Mods,代码行数:7,代码来源:subWeaponsList.cs


示例9: AddButton

 public override void AddButton( MenuButton button)
 {
     buttonList.Add(button);
     SetSpacing();
     for(int i=0; i<buttonList.Count; i++){
         buttonList[i].position = new Rect(border,spacing*(i)+border,buttonSize.width,buttonSize.height);
     }
 }
开发者ID:Arganato,项目名称:Unity_Tic-Tac-Tower,代码行数:8,代码来源:DoubleFrame.cs


示例10: OnButtonClicked

		protected override void OnButtonClicked(MenuButton code)
		{
			if (code == MenuButton.About)
			{
				aboutBox.IsActive = true;
				return;
			}
			base.OnButtonClicked(code);
		}
开发者ID:whztt07,项目名称:DeltaEngine,代码行数:9,代码来源:HomePage.cs


示例11: SublimeVehicleMenu

    private void SublimeVehicleMenu()
    {
        List<IMenuItem> vehicleMenuItems = new List<IMenuItem>();

        var buttonVehicleSpawnerMenu = new MenuButton("Vehicle Spawner Menu");
        buttonVehicleSpawnerMenu.Activated += (sender, args) => SublimeVehicleSpawnerMenu();
        vehicleMenuItems.Add(buttonVehicleSpawnerMenu);

        var buttonVehicleModKitMenu = new MenuButton("Vehicle Mod Menu");
        buttonVehicleModKitMenu.Activated += (sender, args) => SublimeVehicleModCategoriesMenu();
        vehicleMenuItems.Add(buttonVehicleModKitMenu);

        var toggleWarpInSpawned = new MenuToggle("Warp in Spawned Vehicle", "", VehicleFunctions.IsWarpInSpawnedVehicleEnabled);
        toggleWarpInSpawned.Changed += (sender, args) => VehicleFunctions.ToggleWarpInSpawnedVehicle();
        vehicleMenuItems.Add(toggleWarpInSpawned);

        var buttonFixVehicle = new MenuButton("Fix Vehicle");
        buttonFixVehicle.Activated += (sender, args) => VehicleFunctions.FixVehicle();
        vehicleMenuItems.Add(buttonFixVehicle);

        var toggleIndestructible = new MenuToggle("Indestructible", "", VehicleFunctions.IsVehicleIndestructible);
        toggleIndestructible.Changed += (sender, args) => VehicleFunctions.ToggleVehicleIndestructible();
        vehicleMenuItems.Add(toggleIndestructible);

        var toggleSeatBelt = new MenuToggle("Seat Belt", "", VehicleFunctions.IsSeatBeltEnabled);
        toggleSeatBelt.Changed += (sender, args) => VehicleFunctions.ToggleSeatBelt();
        vehicleMenuItems.Add(toggleSeatBelt);

        var toggleLockDoors = new MenuToggle("Lock Doors", "", VehicleFunctions.IsLockedDoorsEnabled);
        toggleLockDoors.Changed += (sender, args) => VehicleFunctions.ToggleLockDoors();
        vehicleMenuItems.Add(toggleLockDoors);

        var toggleNeverFallOffBike = new MenuToggle("Never Fall-Off Bike", "", VehicleFunctions.IsNeverFallOffBikeEnabled);
        toggleNeverFallOffBike.Changed += (sender, args) => VehicleFunctions.ToggleNeverFallOffBike();
        vehicleMenuItems.Add(toggleNeverFallOffBike);

        var toggleSpeedBoost = new MenuToggle("Speed Boost", "", VehicleFunctions.IsSpeedBoostEnabled);
        toggleSpeedBoost.Changed += (sender, args) => VehicleFunctions.ToggleSpeedBoost();
        vehicleMenuItems.Add(toggleSpeedBoost);

        var toggleVehicleJump = new MenuToggle("Vehicle Jump", "", VehicleFunctions.CanVehiclesJump);
        toggleVehicleJump.Changed += (sender, args) => VehicleFunctions.ToggleVehicleJump();
        vehicleMenuItems.Add(toggleVehicleJump);

        var enumVehicleWeaponAssets = new MenuEnumScroller("Vehicle Weapon", "", VehicleFunctions.VehicleWeaponAssetsDict.Keys.ToArray(), VehicleFunctions.VehicleWeaponAssetIndex);
        enumVehicleWeaponAssets.Changed += (sender, args) => VehicleFunctions.VehicleWeaponAssetIndex = enumVehicleWeaponAssets.Index;
        vehicleMenuItems.Add(enumVehicleWeaponAssets);

        var toggleVehicleWeapons = new MenuToggle("Vehicle Weapons", "", VehicleFunctions.IsVehicleWeaponsEnabled);
        toggleVehicleWeapons.Changed += (sender, args) => VehicleFunctions.ToggleVehicleWeapons();
        vehicleMenuItems.Add(toggleVehicleWeapons);

        VehicleMenu = new GTA.Menu("Vehicle Options", vehicleMenuItems.ToArray());
        DrawMenu(VehicleMenu);
    }
开发者ID:frodzet,项目名称:Sublime,代码行数:55,代码来源:VehicleMenu.cs


示例12: SublimeVehicleModWheelsMenu

    private void SublimeVehicleModWheelsMenu(Vehicle currentVehicle)
    {
        List<IMenuItem> wheelCategoriesList = new List<IMenuItem>();

        var buttonWheelType = new MenuButton("Wheel Type");
        buttonWheelType.Activated += (sender, args) => SublimeVehicleModWheelTypesMenu(currentVehicle);
        wheelCategoriesList.Add(buttonWheelType);

        var vehicleModWheelsMenu = new GTA.Menu("Wheels", wheelCategoriesList.ToArray());
        DrawMenu(vehicleModWheelsMenu);
    }
开发者ID:frodzet,项目名称:Sublime,代码行数:11,代码来源:VehicleModMenu.cs


示例13: LoadContent

        public override void LoadContent()
        {
            MenuButton menuButton = new MenuButton("Play");
            this.AddMenuItem(menuButton);
            menuButton.Selected += menuButton_Selected;

            MenuButton settingsButton = new MenuButton("Settings");
            this.AddMenuItem(settingsButton);
            settingsButton.Selected += settingsButton_Selected;
            base.LoadContent();
        }
开发者ID:kbo4sho,项目名称:MonogameStartingPoint,代码行数:11,代码来源:Start.cs


示例14: Open

 public static void Open(MenuButton button)
 {
     GameObject prefab = Resources.Load<GameObject>("Prefabs/UIPrefabs/PauseMenu");
     GameObject g = Instantiate(prefab);
     RectTransform tf = g.transform as RectTransform;
     tf.SetParent(GameObject.Find("/Canvas").transform);
     panel = g.GetComponent<PauseMenu>();
     tf.sizeDelta = new Vector2();
     tf.position = new Vector3(tf.rect.width / 2, tf.rect.height / 2, 0);
     panel.Initialize(button);
     GameStatus.IsPausing = true;
 }
开发者ID:spi8823,项目名称:Sudenona,代码行数:12,代码来源:PauseMenu.cs


示例15: HandleClick

 private void HandleClick(MenuButton button)
 {
     switch (button) {
     case(MenuButton.NewGame):
         Application.LoadLevel ("LevelLoader");
         break;
     case(MenuButton.LoadGame):
         break;
     case(MenuButton.About):
         Application.Quit ();
         break;
     }
 }
开发者ID:Chickenbottom,项目名称:CSS385_PowerOverwhelming,代码行数:13,代码来源:Menu.cs


示例16: TutorialMiningLaserMenu

	public TutorialMiningLaserMenu(Rect area)
	{
		a = area;

		float xOff = a.width * 0.90f;
		float yOff = a.height * 0.95f;
		float btnWidth = a.width - xOff*1.01f;
		float btnHeight = a.height - yOff*1.001f;

		Rect btnrec = new Rect(a.x + xOff, a.y + yOff, btnWidth, btnHeight);
		pb = new MenuButton(btnrec, "buy", ButtonPressed);
		pb.SetDraw(true);

	}
开发者ID:LatexBotox,项目名称:SPACE,代码行数:14,代码来源:TutorialMiningLaserMenu.cs


示例17: SacrificeSelected

    public void SacrificeSelected(MenuButton pressed)
    {
        selectedItem = pressed.text;

        UI_DietyMenu dietySubMenu = (UI_DietyMenu)childMenu;

        // Sacrifice has been selected, not the player choosees which god to sacrfice to
        if(dietySubMenu != null) {
            dietySubMenu.SetSacrificeItem(selectedItem);
            dietySubMenu.OpenMenu();
        }

        CloseMenu();
    }
开发者ID:tedmunds,项目名称:HunterGame,代码行数:14,代码来源:UI_SacrificeMenu.cs


示例18: TutorialWeaponMenu

	public TutorialWeaponMenu(Rect area)
	{
		a = area;		
		tmlm = new TutorialMiningLaserMenu(new Rect(a.x + a.width, a.y, Screen.width - (a.x + a.width), a.height));
		tmlm.SetDraw(false);

		float xOff = 0.0f;
		float yOff = 0.0f;
		float btnWidth = a.width - 2*xOff;
		float btnHeight = 0.05f * a.height; 
		
		Rect btnrec = new Rect(a.x + xOff, a.y + yOff, btnWidth, btnHeight);  
		mlb = new MenuButton(btnrec, "mining laser", ButtonPressed);
		mlb.SetDraw(true);
	}
开发者ID:LatexBotox,项目名称:SPACE,代码行数:15,代码来源:TutorialWeaponMenu.cs


示例19: SublimeMainMenu

    private void SublimeMainMenu()
    {
        List<IMenuItem> mainMenuItems = new List<IMenuItem>();

        var buttonPlayer = new MenuButton("Player");
        buttonPlayer.Activated += (sender, args) => SublimePlayerMenu();
        mainMenuItems.Add(buttonPlayer);

        var buttonWeapon = new MenuButton("Weapon");
        buttonWeapon.Activated += (sender, args) => SublimeWeaponMenu();
        mainMenuItems.Add(buttonWeapon);

        MainMenu = new GTA.Menu("Sublime Mod", mainMenuItems.ToArray());
        DrawMenu(MainMenu);
    }
开发者ID:Colata,项目名称:Sublime,代码行数:15,代码来源:MainMenu.cs


示例20: OnButtonClicked

		protected void OnButtonClicked(MenuButton code)
		{
			switch (code)
			{
				case MenuButton.Home:
					ShowHome();
					break;
				case MenuButton.NewGame:
				case MenuButton.Retry:
					StartNewGame();
					break;
				case MenuButton.Exit:
					Exit();
					break;
			}
		}
开发者ID:whztt07,项目名称:DeltaEngine,代码行数:16,代码来源:Game.cs



注:本文中的MenuButton类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# MenuCommand类代码示例发布时间:2022-05-24
下一篇:
C# Menu类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap