Exemple #1
0
        protected override void LoadComplete()
        {
            base.LoadComplete();

            AddInternal(ratioContainer = new RatioAdjust
            {
                Children = new Drawable[]
                {
                    new Container
                    {
                        AlwaysReceiveInput = true,
                        RelativeSizeAxes   = Axes.Both,
                        Depth    = float.MinValue,
                        Children = new Drawable[]
                        {
                            Cursor = new MenuCursor(),
                            new TooltipContainer(Cursor)
                            {
                                Depth = -1
                            },
                        }
                    },
                }
            });
        }
Exemple #2
0
        protected override void LoadComplete()
        {
            base.LoadComplete();

            base.Content.Add(new RatioAdjust
            {
                Children = new Drawable[]
                {
                    Cursor = new MenuCursor(),
                    new OsuTooltipContainer(Cursor)
                    {
                        RelativeSizeAxes = Axes.Both,
                        Child            = content = new OsuContextMenuContainer
                        {
                            RelativeSizeAxes = Axes.Both,
                        },
                    }
                }
            });

            // TODO: This is temporary until we reimplement the local FPS display.
            // It's just to allow end-users to access the framework FPS display without knowing the shortcut key.
            fpsDisplayVisible = LocalConfig.GetBindable <bool>(OsuSetting.ShowFpsDisplay);
            fpsDisplayVisible.ValueChanged += val =>
            {
                FrameStatisticsMode = val ? FrameStatisticsMode.Minimal : FrameStatisticsMode.None;
            };
            fpsDisplayVisible.TriggerChange();
        }
Exemple #3
0
        protected override void LoadComplete()
        {
            base.LoadComplete();

            AddInternal(ratioContainer = new RatioAdjust
            {
                Children = new Drawable[]
                {
                    new Container
                    {
                        AlwaysReceiveInput = true,
                        RelativeSizeAxes   = Axes.Both,
                        Depth    = float.MinValue,
                        Children = new Drawable[]
                        {
                            Cursor = new MenuCursor(),
                            new TooltipContainer(Cursor)
                            {
                                Depth = -1
                            },
                        }
                    },
                }
            });

            // TODO: This is temporary until we reimplement the local FPS display.
            // It's just to allow end-users to access the framework FPS display without knowing the shortcut key.
            fpsDisplayVisible = LocalConfig.GetBindable <bool>(OsuConfig.ShowFpsDisplay);
            fpsDisplayVisible.ValueChanged += val =>
            {
                FrameStatisticsMode = val ? FrameStatisticsMode.Minimal : FrameStatisticsMode.None;
            };
            fpsDisplayVisible.TriggerChange();
        }
Exemple #4
0
    public void Start()
    {
        StateControllerInit(false);
        confirmWipe  = false;
        menuPosition = 0;
        controlsPos  = 0;
        ResetOptions(false);

        float x = -2.85f, topy = 0.15f;

        cursor  = GetMenuCursor(1, 4, null, x, topy - 0.6f, 0.0f, 0.3f, 0, 3);
        cursor2 = GetMenuCursor(1, 9, null, 1.9f, -0.8f, 0.0f, 0.2f, 0, 8);

        cursor3 = GetMenuCursor(2, 1, SpritePaths.RightArrows, 0.55f, 1.25f, 1.75f, 0.0f, 0, 0, 1, 2, 1.0f);
        cursor3.Rotate(-90.0f);
        cursor3.SetVisibility(false);

        cursor2Display = gameObject.AddComponent <OptionsSelector>();
        cursor2Display.Setup(1.1f, -0.6f, 0.2f);
        cursor2Display.SetVisibility(false);

        top                = GetXMLHead();
        side_options       = GetButton(x, topy + 0.3f, GetXmlValue(top, "options"), PD.mostCommonFont);
        side_controls      = GetButton(x, topy, GetXmlValue(top, "controls"), PD.mostCommonFont);
        side_accessibility = GetButton(x, topy - 0.3f, GetXmlValue(top, "accessibility"), PD.mostCommonFont);
        side_back          = GetButton(x, topy - 0.6f, GetXmlValue(top, "back"), PD.mostCommonFont);
        sidepanels         = new GameObject[][] { side_back, side_accessibility, side_controls, side_options };
        selectedIdx        = 3;

        CreateInfoPane(0.8f, 0.0f);
    }
Exemple #5
0
 /// <summary>
 /// Initialise class.
 /// </summary>
 private void Init()
 {
     // get selectable cursor class.
     if (cursor != null)
     {
         cursorClass = cursor.GetComponent <MenuCursor>();
     }
 }
 public void HidePlayer2()
 {
     Destroy(charSprite2);
     Destroy(charName2);
     Destroy(cursor2);
     charSprite2 = null;
     charName2   = null;
     cursor2     = null;
 }
Exemple #7
0
    void InstantiateMenuCursor()
    {
        MenuCursor c = gameObject.AddComponent <MenuCursor>();

        c.numColumns = 1;
        c.numRows    = capacity;
        c.onIndexChanged_Callback = CursorIndexChanged;

        _cursor = c;
    }
Exemple #8
0
    void CursorIndexChanged(MenuCursor sender, Index2 prevIdx, Index2 newIdx)
    {
        if (sender != _cursor)
        {
            return;
        }

        SetEntryViewsSelectedState(prevIdx.y, false);
        SetEntryViewsSelectedState(CursorIndex, true);
    }
Exemple #9
0
        public override void Update(GameTime gameTime)
        {
            UpdateTimeModifier();

            CurrentTheme?.Update();
            CurrentGameOver?.Update();

            UpdateProtoEffects();
            UpdateVisualEffects();

            foreach (var timer in Timers)
            {
                timer.Update();
            }
            Timers.RemoveAll(x => x.Slide >= 1);

            UpdateInput();

            var tickables = Manager.Tickable.GetTickables();

            foreach (var tickable in tickables.ToList())
            {
                tickable.Tick(this);
            }

            Vector2 worldPos = Vector2.Transform(new Vector2(InputState.MouseX, InputState.MouseY), Matrix.Invert(WorldTransform));
            int     tileX    = Util.FloorDiv((int)worldPos.X, 16);
            int     tileY    = Util.FloorDiv((int)worldPos.Y, 16);

            TileCursor = new Point(tileX, tileY);
            MenuCursor = Menu.GetMouseOver(InputState.MouseX, InputState.MouseY);
            if (MenuCursor != null)
            {
                TileCursor = null;
            }

            TooltipText = new TextBuilder(float.PositiveInfinity, float.PositiveInfinity);
            if (MenuCursor != null)
            {
                MenuCursor.GenerateTooltip(TooltipText);
            }
            else if (Map != null && TileCursor.HasValue)
            {
                MapTile tile = Map.GetTile(TileCursor.Value.X, TileCursor.Value.Y);
                if (tile != null)
                {
                    tile.AddTooltip(TooltipText);
                }
            }
            TooltipText.EndContainer();
            TooltipText.Finish();
        }
Exemple #10
0
        public async Task confirm(MeleeStates states, DolphinAsyncController controller)
        {
            Bitmap    portrait     = states.dolphinWindowCapturer.captureCPUTournamentPortrait();
            Character newCharacter = states.imageMatcher.findCharacterInTournament(portrait);

            controller.press(DolphinButton.A);
            MenuCursor menuCursor = new MenuCursor(controller, new Point(5, 5), currentCharacter.tournamentPosition);
            await menuCursor.moveTo(newCharacter.tournamentPosition);

            await controller.press(DolphinButton.A).then().press(DolphinPOVButton.RIGHT).then().press(DolphinButton.A).execute();

            // Ici le textMenuCursor !
            await controller.press(DolphinButton.B).then().press(DolphinPOVButton.LEFT).execute();
        }
Exemple #11
0
        protected override void LoadComplete()
        {
            base.LoadComplete();

            AddInternal(ratioContainer = new RatioAdjust
            {
                Children = new[]
                {
                    Cursor = new MenuCursor {
                        Depth = float.MinValue
                    }
                }
            });
        }
Exemple #12
0
    public void Setup(int mode, TextMesh infoHolder, MenuCursor lc, CharSelectController csc)
    {
        GetPersistData();
        top         = GetXMLHead();
        myMesh      = infoHolder;
        myMode      = mode;
        lobbyCursor = lc;
        myMesh.text = GetXmlValue(top, "connecting");
        parent      = csc;
        FontData f = PD.mostCommonFont.Clone();

        f.color     = Color.white;
        player1Rank = GetMeshText(new Vector3(-0.745f, 1.9f), SteamFriends.GetPersonaName(), f);
        SteamUserStats.RequestCurrentStats();
    }
Exemple #13
0
        public OptionsMenu()
        {
            _crosshair  = new MenuCursor();
            _background = new Background();

            _titles = new FontRender("Titles");
            _titles.LoadContent("titlescreen");
            _titles.Location = new Vector2(150, _fontY);
            _titles.Shadow   = true;


            _container = new UIContainer("OptionsMenu");

            int startYPosition = 600;

            _soundEffectsOnOff = new CheckBox("SoundEffectsOnOff", new SoundEffectsOnOffHandler())
            {
                Width            = 500,
                Height           = 70,
                Location         = new Vector2(700, startYPosition),
                Text             = "Sound Effects On/Off",
                DrawWindowChrome = true,
                ControlTexture   = "ButtonBackground"
            };

            ((CheckBox)_soundEffectsOnOff).Checked = SoundEffectPlayer.PlaySoundEffects;

            startYPosition += 80;

            _backToMainMenu = new Button("ExitToMainMenu", new ExitToMainMenuButtonHandler())
            {
                Width            = 500,
                Height           = 70,
                Location         = new Vector2(700, startYPosition),
                Text             = "<-- Exit to Main Menu",
                DrawWindowChrome = true,
                ControlTexture   = "ButtonBackground"
            };


            _container.AddControl(_soundEffectsOnOff);
            _container.AddControl(_backToMainMenu);

            _scene.AddSpriteToLayer(RenderLayerEnum.LAYER1, _background);
            _scene.AddSpriteToLayer(RenderLayerEnum.LAYER2, _titles);
            _scene.AddSpriteToLayer(RenderLayerEnum.LAYER5, _crosshair);
            _scene.AddSpriteToLayer(RenderLayerEnum.LAYER4, _container);
        }
Exemple #14
0
    protected MenuCursor GetMenuCursor(int w, int h, string sprite, float px, float py, float dx, float dy, int initX, int initY, int p = 1, int frame = -1, float dtweenchange = -1, string sortLayer = "")
    {
        GameObject g = new GameObject("Menu CursorContainer " + p);
        MenuCursor c = g.AddComponent <MenuCursor>();

        c.SetPD(PD);
        c.player = p;
        c.SetController(p == 1?PD.controller:PD.controller2, PD.GetKeyBindings(p - 1));
        c.setWidthAndHeight(w, h);
        c.Setup(th);
        c.SetupMenu(sprite, px, py, dx, dy, initX, initY, frame, dtweenchange);
        if (sortLayer != "")
        {
            c.cursor.renderer.sortingLayerName = sortLayer;
        }
        return(c);
    }
Exemple #15
0
    void OnCursorIndexChanged(MenuCursor sender, Index2 prevIdx, Index2 newIdx)
    {
        if (sender != _menuCursor)
        {
            return;
        }

        // Reposition the cursor view
        GameObject itemSlot = _activeItemSlots[newIdx.y, newIdx.x];

        _cursorView.transform.position = itemSlot.transform.position;

        // Notify our delegate
        if (onCursorIndexChanged_Callback != null)
        {
            onCursorIndexChanged_Callback(this);
        }
    }
Exemple #16
0
    void CursorIndexChanged(MenuCursor sender, Index2 prevIdx, Index2 newIdx)
    {
        if (sender != _cursor)
        {
            return;
        }

        SelectButton(CursorIndex);

        // Reposition the cursor view
        _cursorView.transform.SetY(_selectedBtn.transform.position.y);
        //_cursorView.transform.SetLocalY(_selectedBtn.transform.localPosition.y);

        // Notify our delegate
        if (onCursorIndexChanged_Callback != null)
        {
            onCursorIndexChanged_Callback(this);
        }
    }
    private void SetupBackgrounds()
    {
        bg1 = GetGameObject(new Vector3(-2.25f, 0.5f), "Background 1", Resources.Load <Sprite> (SpritePaths.DefaultBG), false, "BG0");
        bg1.transform.localScale /= 2.5f;
        originalRect              = bg1.GetComponent <SpriteRenderer>().sprite.rect;
        UpdateBackground(true);
        bg2 = GetGameObject(new Vector3(2.25f, 0.5f), "Background 2", Resources.Load <Sprite> (SpritePaths.DefaultBG), false, "BG0");
        bg2.transform.localScale /= 2.5f;
        UpdateBackground(false);
        GetGameObject(Vector3.zero, "Background Cover", Resources.Load <Sprite>(SpritePaths.BGBlackFadeCharSel), false, "BG1");

        onlineBackground = GetGameObject(new Vector3(2f, 0f), "Lobby Cover", Resources.Load <Sprite>(SpritePaths.BGBlackFadeCharSel), false, "BG1");

        lobbyCursor = GetMenuCursor(1, 9, SpritePaths.RightArrows, 2f, 0.253f, 0f, 0.195f, 0, 8, 1, 0);
        lobbyCursor.HalfSize();
        lobbyCursor.SetVisibility(false);

        onlineBackground.SetActive(PD.gameType == PersistData.GT.Online);
    }
    private void FullInitP2Select()
    {
        int    completionPercent = PD.GetSaveData().CalculateGameCompletionPercent();
        string crPath            = SpritePaths.CharSelCursors;
        int    crNum             = 10;

        if (completionPercent == 100)
        {
            crPath = SpritePaths.CharSelCursorsAll;
            crNum  = 12;
        }
        else if (completionPercent >= 50)
        {
            crPath = SpritePaths.CharSelCursorsWhite;
            crNum  = 11;
        }
        cursor2 = GetMenuCursor(crNum, 1, crPath, initX, -0.99f, dX, 0.0f, 1, 0, 2, 1, 0.2f);
        InitPlayer2Select();
        UpdateBackground(false);
    }
    void loadSettings(bool applySettings)
    {
        cursor = GameObject.FindObjectOfType <MenuCursor>();

        settings = SettingsManager.loadSettings();
        Debug.Log("Loading settings");

        if (settings == null)
        {
            settings = SettingsManager.defaultSettings();
            Debug.Log("Loading default settings");
        }

        for (int i = 0; i < MenuList.settingsOptions.Length; i++)
        {
            options[i].text = MenuList.settingsOptions[i].optionsName[settings[i]];

            if (applySettings)
            {
                SettingsManager.applySettings(i, settings[i]);
            }
        }
    }
Exemple #20
0
        public MainMenu()
        {
            _crosshair  = new MenuCursor();
            _background = new Background();

            MusicPlayer.LoadMusic("banjo");

            _fontY  = -200;
            _titles = new FontRender("Titles");
            _titles.LoadContent("titlescreen");
            _titles.Location = new Vector2(150, _fontY);
            _titles.Shadow   = true;


            _container = new UIContainer("MainMenu");

            int startYPosition = 450;

            _playGameButton = new Button("PlayGameButton", new NewGameButtonHandler())
            {
                Width            = 500,
                Height           = 70,
                Location         = new Vector2(700, startYPosition),
                Text             = "Play Duck Attack",
                DrawWindowChrome = true,
                ControlTexture   = "ButtonBackground"
            };

            startYPosition += 80;

            _optionsButton = new Button("OptionsGameButton", new OptionsButtonHandler())
            {
                Width            = 500,
                Height           = 70,
                Location         = new Vector2(700, startYPosition),
                Text             = "Options",
                DrawWindowChrome = true,
                ControlTexture   = "ButtonBackground"
            };

            startYPosition += 80;

            _exitButton = new Button("ExitGameButton", new ExitButtonHandler())
            {
                Width            = 500,
                Height           = 70,
                Location         = new Vector2(700, startYPosition),
                Text             = "Exit Game",
                DrawWindowChrome = true,
                ControlTexture   = "ButtonBackground"
            };

            _container.AddControl(_playGameButton);
            _container.AddControl(_optionsButton);
            _container.AddControl(_exitButton);

            _scene.AddSpriteToLayer(RenderLayerEnum.LAYER1, _background);
            _scene.AddSpriteToLayer(RenderLayerEnum.LAYER2, _titles);
            _scene.AddSpriteToLayer(RenderLayerEnum.LAYER5, _crosshair);
            _scene.AddSpriteToLayer(RenderLayerEnum.LAYER4, _container);

            MusicPlayer.Play("banjo");
            MusicPlayer.Looped = true;
        }
Exemple #21
0
 public override void OnDeselect(BaseEventData eventData)
 {
     base.OnDeselect(eventData);
     // Call methods when the UI element is deselected
     MenuCursor.DeselectCursor();
 }
Exemple #22
0
 public override void OnSelect(BaseEventData eventData)
 {
     base.OnSelect(eventData);
     // Call methods when the UI element is selected
     MenuCursor.SelectCursor(this.gameObject.GetComponent <RectTransform>());
 }
Exemple #23
0
 void Awake()
 {
     rt                 = GetComponent <RectTransform>();
     _instance          = this;
     transform.position = new Vector2(-5000, -5000);
 }