Inheritance: MonoBehaviour
Ejemplo n.º 1
0
    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);
    }
Ejemplo n.º 2
0
 void GiveWeapon(MenuButton sender, KeyValuePair<WeaponHash, int> weapon)
 {
     {
         Game.Player.Character.Weapons.Give(weapon.Key, 120, true, true);
         UI.Notify("Weapon Given!", true);
     }
 }
Ejemplo n.º 3
0
    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();
    }
Ejemplo n.º 4
0
 void giveWeapon(MenuButton sender, KeyValuePair<WeaponHash, int> weapon)
 {
     {
         Game.Player.Character.Weapons.Give(weapon.Key, 9999, true, true);
         UI.Notify("Item Action", true);
     }
 }
Ejemplo n.º 5
0
    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);
        }
    }
Ejemplo n.º 6
0
        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
        }
Ejemplo n.º 7
0
    public void OnSaveGameClick()
    {
        SetAllActiveFalse();
        SaveGame.SetActive(true);

        ButtonClick = MenuButton.SAVEGAME;
    }
    // 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();
        }
    }
Ejemplo n.º 9
0
 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);
     }
 }
Ejemplo n.º 10
0
		protected override void OnButtonClicked(MenuButton code)
		{
			if (code == MenuButton.About)
			{
				aboutBox.IsActive = true;
				return;
			}
			base.OnButtonClicked(code);
		}
Ejemplo n.º 11
0
    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);
    }
Ejemplo n.º 12
0
        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();
        }
Ejemplo n.º 13
0
    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);
    }
Ejemplo n.º 14
0
 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;
 }
Ejemplo n.º 15
0
 private void HandleClick(MenuButton button)
 {
     switch (button) {
     case(MenuButton.NewGame):
         Application.LoadLevel ("LevelLoader");
         break;
     case(MenuButton.LoadGame):
         break;
     case(MenuButton.About):
         Application.Quit ();
         break;
     }
 }
Ejemplo n.º 16
0
	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);

	}
Ejemplo n.º 17
0
    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();
    }
Ejemplo n.º 18
0
    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);
    }
Ejemplo n.º 19
0
	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);
	}
Ejemplo n.º 20
0
        public override void LoadContent()
        {
            MenuToggleButton soundButton = new MenuToggleButton("Toggle Music");
            this.AddMenuItem(soundButton);
            soundButton.Selected += toggleButton_Selected;

            MenuToggleButton fxButton = new MenuToggleButton("Toggle Effects");
            this.AddMenuItem(fxButton);
            fxButton.Selected += toggleButton_Selected;

            MenuButton backButton = new MenuButton("Back");
            this.AddMenuItem(backButton);
            backButton.Selected += backButton_Selected;

            base.LoadContent();
        }
Ejemplo n.º 21
0
		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;
			}
		}
Ejemplo n.º 22
0
 private void Click(MenuButton button)
 {
     switch(button)
     {
         case MenuButton.Back:
             Close();
             break;
         case MenuButton.Retry:
             break;
         case MenuButton.Status:
             break;
         case MenuButton.Option:
             break;
         case MenuButton.Quit:
             break;
     }
 }
Ejemplo n.º 23
0
    void Start()
    {
        bottles = GameObject.Find("BottlesSpawner").GetComponent<BottlesSpawner>();
        buttonReleaseScript = GameObject.Find("ButtonRelease").GetComponent<ButtonReleased>();
        inGameUI = GameObject.Find("InGameUIManager").GetComponent<InGameUIManager>();
        menuButtonScript = GameObject.Find("UIPanel").GetComponent<MenuButton>();
        sm = GameObject.Find("SoundManager").GetComponent<SoundManager>();

        inGameUI.PF_Bottle = this.gameObject;

        if(!bottles.firstTimeBottleClicked && inGameUI.isLevel1)
        {
            inGameUI.Enable("5. CollectBottles");
            bottles.firstTimeBottleClicked = true;
        }

        //pbm.totalBottles++;
    }
Ejemplo n.º 24
0
    public override void OpenMenu()
    {
        base.OpenMenu();

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

        Diety[] dieties = WorldManager.instance.GetDieties();
        for(int i = 0; i < dieties.Length; i++) {
            MenuButton btn = new MenuButton(dieties[i].dietyName, DietySelected);

            // Add some info about how it feels towards the item
            string reaction = dieties[i].GetReactionToItem(itemName);
            btn.info = reaction + itemName;

            options.Add(btn);
        }
    }
Ejemplo n.º 25
0
    public GameObject CreateButton(float xpos, float ypos, string texture, MenuButton.fnPtr handler)
    {
        GameObject b = GameObject.CreatePrimitive(PrimitiveType.Quad);
        b.renderer.material.mainTexture = Resources.Load<Texture2D>(texture);
        b.renderer.material.shader = Shader.Find("Unlit/Transparent");

        Camera cam = Camera.main;
        float pos = (cam.nearClipPlane + 1f);
        b.transform.position = cam.transform.position + cam.transform.forward * pos;
        float h = Mathf.Tan(cam.fov*Mathf.Deg2Rad*0.5f)*pos*2f;
        b.transform.localScale = new Vector3(h*cam.aspect*0.256f,h*0.13f,0f);
        b.transform.position += cam.transform.right*(xpos*0.5f*h*cam.aspect);
        b.transform.position += cam.transform.up*(ypos*0.5f*h*cam.aspect);
        b.transform.LookAt(b.transform.position+cam.transform.forward);
        MenuButton mb = b.AddComponent<MenuButton>();
        mb.OnClick = handler;
        return b;
    }
Ejemplo n.º 26
0
        public void Initialize(MenuButton button)
        {
            List<MenuButton> buttons = new List<MenuButton>();
            foreach(MenuButton b in Enum.GetValues(typeof(MenuButton)))
            {
                buttons.Add(b);
            }

            for(var i = 0;i < Enabled.Length;i++)
            {
                if ((button & buttons[i]) == buttons[i]) Enabled[i] = true;
            }

            SetButtons();

            nowIndex = 4;
            NextAndPrevious(1);
        }
Ejemplo n.º 27
0
        public void RebuildMainAndTitle()
        {
            Overworld oui = Overworld;

            oui.UIs.Remove(oui.GetUI <OuiTitleScreen>());
            Oui title = new OuiTitleScreen()
            {
                Visible = false
            };

            title.IsStart(oui, Overworld.StartMode.MainMenu);
            oui.Add(title);
            oui.UIs.Add(title);

            MenuButton selected = null;

            foreach (MenuButton button in buttons)
            {
                if (!button.Selected)
                {
                    continue;
                }
                selected = button;
                break;
            }

            CreateButtons();

            if (selected is MainMenuClimb)
            {
                foreach (MenuButton button in buttons)
                {
                    button.SetSelected(button is MainMenuClimb);
                }
            }
            else
            {
                string selectedLabel = (selected as MainMenuSmallButton)?.GetLabelName();
                foreach (MenuButton button in buttons)
                {
                    button.SetSelected((button as MainMenuSmallButton)?.GetLabelName() == selectedLabel);
                }
            }
        }
Ejemplo n.º 28
0
    private void SublimeVehicleModCategoriesMenu()
    {
        List<IMenuItem> vehicleModCategoriesList = new List<IMenuItem>();

        Vehicle currentVehicle = Game.Player.Character.CurrentVehicle;
        Function.Call(Hash.SET_VEHICLE_MOD_KIT, currentVehicle, 0);

        foreach (VehicleMod vehicleMod in Enum.GetValues(typeof(VehicleMod)))
        {
            int vehicleModCount = Function.Call<int>(Hash.GET_NUM_VEHICLE_MODS, currentVehicle, (int) vehicleMod);

            if (vehicleModCount != 0)
            {
                if (vehicleMod != VehicleMod.BackWheels && vehicleMod != VehicleMod.FrontWheels)
                {
                    var buttonModCategory = new MenuButton(vehicleMod.ToString());
                    //buttonModCategory.Activated += (sender, args) => SublimeVehicleModTypeMenu(currentVehicle);
                    vehicleModCategoriesList.Add(buttonModCategory);
                }
            }
        }

        var buttonRespray = new MenuButton("Respray");
        vehicleModCategoriesList.Add(buttonRespray);

        var buttonLights = new MenuButton("Lights");
        vehicleModCategoriesList.Add(buttonLights);

        var buttonPlates = new MenuButton("Plates");
        vehicleModCategoriesList.Add(buttonPlates);

        var buttonWindows = new MenuButton("Windows");
        vehicleModCategoriesList.Add(buttonWindows);

        var buttonWheels = new MenuButton("Wheels");
        buttonWheels.Activated += (sender, args) => SublimeVehicleModWheelsMenu(currentVehicle);
        vehicleModCategoriesList.Add(buttonWheels);

        var toggleTurbo = new MenuToggle("Turbo", "", true);
        vehicleModCategoriesList.Add(toggleTurbo);

        VehicleModCategoriesMenu = new GTA.Menu("Mod Categories", vehicleModCategoriesList.OrderBy(item => item.Caption).ToArray());
        DrawMenu(VehicleModCategoriesMenu);
    }
Ejemplo n.º 29
0
    public override void OpenMenu()
    {
        base.OpenMenu();

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

        Diety[] dieties = WorldManager.instance.GetDieties();
        for (int i = 0; i < dieties.Length; i++)
        {
            MenuButton btn = new MenuButton(dieties[i].dietyName, DietySelected);

            // Add some info about how it feels towards the item
            string reaction = dieties[i].GetReactionToItem(itemName);
            btn.info = reaction + itemName;

            options.Add(btn);
        }
    }
Ejemplo n.º 30
0
        public override bool Initialize()
        {
            ShooterTutorialGame.MouseVisibility = true;

            backgroundTexture   = _content.Load <Texture2D>("Graphics\\endMenu");
            backgroundRectangle = new Rectangle(0, 0,
                                                backgroundTexture.Width, _device.Viewport.Height);

            _spriteFont = _content.Load <SpriteFont>("Graphics\\gameFont");

            _menuButton = new MenuButton(_spriteFont);
            _menuButton.Initialize(MENU_BUTTON_TEXT, new Vector2(360,
                                                                 _device.Viewport.Height - _spriteFont.MeasureString(MENU_BUTTON_TEXT).Y - 10));

            //menuMusic = _content.Load<Song>("Sounds\\menuMusic");
            //MediaPlayer.Play(menuMusic);

            return(base.Initialize());
        }
Ejemplo n.º 31
0
        static public void Main()
        {
            //測試如何將1Campus的家長資料取得

            MenuButton menuButton = MotherForm.StartMenu["行動應用"];

            menuButton.Image            = Properties.Resources.agronomy_64;
            menuButton["家長使用查詢"].Click += delegate
            {
                ParentForm a = new ParentForm();
                a.ShowDialog();
            };

            menuButton["行動使用統計"].Click += delegate
            {
                ParentByStudent a = new ParentByStudent();
                a.ShowDialog();
            };
        }
Ejemplo n.º 32
0
    private void PopulateDynamicButtons()
    {
        // create "New" button
        GameObject newMenuButton = (GameObject)Instantiate(DisplayButtonPF, transform);
        MenuButton menuButton    = newMenuButton.GetComponent <MenuButton>();

        menuButton.isDisplayButton = true;

        // "PlacementView" will need to be a Display creation secquence
        menuButton.InitializeButtonProperties("Create", "New", "Display_Detail");
        newMenuButton.transform.parent = transform.GetComponentInChildren <GridLayoutGroup>().transform;
        menuButton.menuPanelObject     = gameObject;

        RObject createButton = new RObject();

        createButton.displayNumber = RealmManager.realmManager.realm.lastDisplayNumber + 1;
        createButton.name          = "Display " + (createButton.displayNumber).ToString();
        createButton.rObjectType   = RObject.RObjectType.Display;
        menuButton.rObject         = createButton;

        newMenuButton.GetComponentInChildren <Text>().gameObject.SetActive(false);
        newMenuButton.GetComponentInChildren <DisplayOverlay>().gameObject.SetActive(false);

        if (RealmManager.realmManager.realm.displays.Count > 0)
        {
            for (int i = 0; i < RealmManager.realmManager.realm.displays.Count; i++)
            {
                // Create new instances of our prefab until we've created as many as we specified
                RObject    display           = RealmManager.realmManager.realm.displays[i];
                GameObject newDisplayButton  = (GameObject)Instantiate(DisplayButtonPF, transform);
                MenuButton displayMenuButton = newDisplayButton.GetComponent <MenuButton>();

                displayMenuButton.rObject             = display;
                displayMenuButton.rObject.rObjectType = RObject.RObjectType.Display;
                displayMenuButton.isDisplayButton     = true;
                displayMenuButton.InitializeButtonProperties(display.name, display.imageName, display.name);

                newDisplayButton.transform.parent = transform.GetComponentInChildren <GridLayoutGroup>().transform;
                displayMenuButton.navTarget       = "Display_Detail";
                displayMenuButton.menuPanelObject = gameObject;
            }
        }
    }
Ejemplo n.º 33
0
    // Totally overried draing of window so the buttons can have pictures
    public override void DrawGUI()
    {
        if(childMenu != null) {
            childMenu.DrawGUI();
        }

        if(!bIsOpen) {
            return;
        }

        GUI.BeginGroup(panel);

        GUI.DrawTexture(new Rect(0.0f, 0.0f, panel.width, panel.height), panelBackground);

        GUI.Label(new Rect(10.0f, 15.0f, panel.width, panel.height), panelName);

        Rect buttonRect = new Rect(10.0f, 35.0f, buttonWidth, 25.0f);
        const float buttonOffset = 5.0f;

        MenuButton selectedButton = new MenuButton("", null);
        bool bMadeSelection = false;

        foreach(MenuButton buttonOption in options) {
            // Cache which button was pressed, because the handler may modiy the options list
            if(GUI.Button(buttonRect, buttonOption.text)) {
                selectedButton = buttonOption;
                bMadeSelection = true;
                break;
            }

            // Draw the description of the button next to it
            GUI.Label(new Rect(buttonRect.x + buttonRect.width + 25.0f, buttonRect.y, panel.width, panel.height), buttonOption.info);

            buttonRect.y += buttonRect.height + buttonOffset;
        }

        // If a selection is made, call the handler
        if(bMadeSelection) {
            selectedButton.handler(selectedButton);
        }

        GUI.EndGroup();
    }
Ejemplo n.º 34
0
        public NavigationControl()
        {
            back_button.Clicked += (o, e) => {
                if (web_view != null && web_view.CanGoBack)
                {
                    web_view.GoBack();
                }
            };

            forward_button.Clicked += (o, e) => {
                if (web_view != null && web_view.CanGoForward)
                {
                    web_view.GoForward();
                }
            };

            reload_button.Clicked += (o, e) => {
                if (web_view != null)
                {
                    web_view.Reload(!GtkUtilities.NoImportantModifiersAreSet());
                }
            };

            home_button.Clicked += (o, e) => {
                var handler = GoHomeEvent;
                if (handler != null)
                {
                    handler(this, EventArgs.Empty);
                }
            };

            shortcut_menu_button = new MenuButton(home_button, shortcut_menu, true);

            UpdateNavigation();

            PackStart(back_button, false, false, 0);
            PackStart(forward_button, false, false, 0);
            PackStart(reload_button, false, false, 5);
            PackStart(shortcut_menu_button, false, false, 0);

            ShowAll();
            ClearLinks();
        }
Ejemplo n.º 35
0
 public MultiWorldMenu(RandoMenuItem <string> multiworldBtn, RandoMenuItem <bool> multiworldReadyBtn,
                       GameObject urlLabel, InputField urlInput, GameObject nicknameLabel,
                       InputField nicknameInput, GameObject roomLabel, InputField roomInput,
                       GameObject readyPlayers, MenuButton rejoinBtn, MenuButton startMultiWorldBtn,
                       MenuButton startRandoBtn)
 {
     MultiWorldBtn      = multiworldBtn;
     MultiWorldReadyBtn = multiworldReadyBtn;
     URLLabel           = urlLabel;
     URLInput           = urlInput;
     NicknameLabel      = nicknameLabel;
     NicknameInput      = nicknameInput;
     RoomLabel          = roomLabel;
     RoomInput          = roomInput;
     ReadyPlayersLabel  = readyPlayers;
     RejoinBtn          = rejoinBtn;
     StartMultiWorldBtn = startMultiWorldBtn;
     StartRandoBtn      = startRandoBtn;
 }
Ejemplo n.º 36
0
            public void MouseUp(int y)
            {
                MenuControl ctrl = controls[ControlIndexFromPos(ref y)];

                if (ctrl is MenuButton)
                {
                    MenuButton button = (MenuButton)ctrl;
                    if (button.onclick != null)
                    {
                        button.onclick(button);
                    }
                    Hide();
                }
                else if (ctrl is MenuGroup)
                {
                    MenuGroup submenu = (MenuGroup)ctrl;
                    submenu.Show(new Point(bounds.Right, bounds.Top + y), backbufferSize);
                }
            }
Ejemplo n.º 37
0
        private static string GetTags(List <MenuButton> branch, int i, MenuButton button, string result)
        {
            if (branch[i + 1].Level > button.Level)
            {
                result += openUl;
            }
            else if (branch[i + 1].Level == button.Level)
            {
                result += closeLi;
            }
            else if (branch[i + 1].Level < button.Level)
            {
                var l = button.Level - branch[i + 1].Level;

                result += GetClosingTags(l);
                result += closeLi;
            }
            return(result);
        }
Ejemplo n.º 38
0
    public void Init()
    {
        menuButtonList = new List <MenuButton>();

        MenuButton[] mbs = this.GetComponentsInChildren <MenuButton>();

        foreach (MenuButton mb in mbs)
        {
            menuButtonList.Add(mb);
        }

        for (int i = 0; i < menuButtonList.Count; i++)
        {
            MenuButton mb       = menuButtonList[i];
            EMenuType  menuType = (EMenuType)i;
            mb.Init(menuType);
            mb.onButtonClicked += Mb_onButtonClicked;
        }
    }
Ejemplo n.º 39
0
        void OnMenuItemAdded(string pageLabel, SpawnMenuItem item)
        {
            ///////////////////////////
            /// Add a menu item button
            ///////////////////////////
            Transform  parent     = pageLabelScrollViewMap[pageLabel].transform.Find("Viewport/Content");
            MenuButton menuButton = Instantiate(MenuButtonPrefab, parent).GetComponent <MenuButton>();

            if (menuButton == null)
            {
                Debug.LogError("A MenuButtonPrefab was instantiated without the MenuButton component - no bueno");
                return;
            }

            // Link the menu button to a SpawnController method
            menuButton.onClick.AddListener(() => { spawnHandler.OnSpawnMenuButtonClicked(menuButton, item.ObjectInitData); });
            menuButton.Label      = item.Label;
            menuButton.Background = item.Icon;
        }
Ejemplo n.º 40
0
    private void PopulateDynamicButtons()
    {
        for (int i = 0; i < 5; i++)
        {
            GameObject newMenuButton = (GameObject)Instantiate(MenuButtonPF, transform);
            MenuButton menuButton    = newMenuButton.GetComponent <MenuButton>();

            switch (i)
            {
            case 0:
                menuButton.InitializeButtonProperties("Position", "Position", "Position_Display");
                break;

            case 1:
                menuButton.InitializeButtonProperties("Adjust", "Edit", "Adjust_Display");
                break;

            case 2:
                menuButton.InitializeButtonProperties("Image", "Image", "Image_Select");
                break;

            case 3:
                menuButton.InitializeButtonProperties("Details", "Details", "Display_Info");
                break;

            case 4:
                // Delete_Popup will have to trigger a popup to confirm, the "back" nav, and handle the delete function
                menuButton.InitializeButtonProperties("Delete", "Delete", "Delete_Popup");
                break;

            default:
                Debug.Log("Default called");
                break;
            }

            newMenuButton.transform.parent = transform.GetComponentInChildren <GridLayoutGroup>().transform;
            menuButton.menuPanelObject     = gameObject;
        }

        //We'll need to set the activeObject in the DisplaysView when the button is pressed. That's how we'll determine the title, too.
        //RObject display = RealmManager.realmManager.activeObject;
        //menuButton.rObject = display;
    }
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            Menu = new PackageManagerMenu();

            MenuButton = new MenuButton("icons/icon_more.png", new CGRect(0, 10, 20, 30));
            NavigationItem.RightBarButtonItem = MenuButton;

            Manager = Routing.PackageManager;

            // Create offline routing service connected to package manager
            Routing.Service = new PackageManagerRoutingService(Manager);

            Alert("This sample uses an online map, but downloads routing packages");

            nfloat y = UIApplication.SharedApplication.StatusBarFrame.Height + NavigationController.NavigationBar.Frame.Height;

            Menu.SetFrameWithNavigationBar(y);
        }
Ejemplo n.º 42
0
	public TutorialMenu (Rect area)
	{
		a = area;
		wm = new TutorialWeaponMenu(new Rect(a.width, 0, a.width, a.height));
		wm.SetDraw(false);

		float xOff = 0.0f;//0.15f * a.width;
		float yOff = 0.0f;//0.02f * a.height;
		float btnWidth = a.width - 2*xOff;
		float btnHeight = 0.05f * a.height; 

		Rect btnrec = new Rect(a.x + xOff, a.y + yOff, btnWidth, btnHeight);  

		weapBtn = new MenuButton(btnrec, "weapons", ButtonPressed);
		weapBtn.SetDraw(true);

		btnrec = new Rect(btnrec.x, btnrec.y + btnHeight + yOff, btnWidth, btnHeight);
		exitBtn = new MenuButton(btnrec, "exit", ButtonPressed);
		exitBtn.SetDraw(true);
	}
Ejemplo n.º 43
0
        public OptionsMenu(DrawWrapper Drawing, GraphicsDeviceManager Graphics, AudioWrapper Audio, InputHelper Input)
        {
            drawing = Drawing;
            audio = Audio;
            graphics = Graphics;
            input = Input;
            Quit = false;
            selectedButton = MenuButton.None;

            soundColor = audio.AudioIsEnabled ? Color.DarkGreen : Color.DarkRed;
            musicColor = audio.MusicIsEnabled ? Color.DarkGreen : Color.DarkRed;
            controllerColor = input.ControllerInUse ? Color.DarkGreen : Color.DarkRed;
            fullscreenColor = graphics.IsFullScreen ? Color.DarkGreen : Color.DarkRed;

            soundButton = new Rectangle((int)drawing.GUISize.X / 2 - 100, (int)drawing.GUISize.Y / 2 - 300, 200, 100);
            musicButton = new Rectangle((int)drawing.GUISize.X / 2 - 100, (int)drawing.GUISize.Y / 2 - 150, 200, 100);
            //controllerButton = new Rectangle((int)drawing.GUISize.X / 2 - 100, (int)drawing.GUISize.Y / 2 - 50, 200, 100);
            fullscreenButton = new Rectangle((int)drawing.GUISize.X / 2 - 100, (int)drawing.GUISize.Y / 2, 200, 100);
            quitButton = new Rectangle((int)drawing.GUISize.X / 2 - 100, (int)drawing.GUISize.Y / 2 + 150, 200, 100);
        }
Ejemplo n.º 44
0
        public ActionResult Edit(MenuButton button)
        {
            var dbButton = context.MenuButtons.FirstOrDefault(x => x.Id == button.Id);

            if (dbButton == null)
            {
                return(HttpNotFound());
            }
            if (ModelState.IsValid)
            {
                if (button.InformationSourceId == 0)
                {
                    button.InformationSourceId = null;
                }
                dbButton.Name = button.Name;
                dbButton.InformationSourceId = button.InformationSourceId;
                context.SaveChanges();
            }
            return(RedirectToAction("List"));
        }
Ejemplo n.º 45
0
        public RepeatActionButton(bool iconOnly)
        {
            box.Spacing        = 4;
            label.UseUnderline = true;
            image.IconSize     = (int)IconSize.Menu;

            box.PackStart(image, false, false, (uint)(iconOnly ? 4 : 0));
            if (!iconOnly)
            {
                box.PackStart(label, true, true, 0);
            }

            button = new MenuButton(box, actions.CreateMenu(), false);
            Add(button);

            actions.Changed += OnActionChanged;
            OnActionChanged(null, null);

            ShowAll();
        }