Пример #1
0
        public void ActiveMenu(Menus typeMenu)
        {
            DesactiveMenu();

            MenuInterface menuInt      = null;
            GameObject    menuSelected = null;

            switch (typeMenu)
            {
            case Menus.MAIN_MENU:
                menuSelected = mainMenu;
                break;

            case Menus.CHOOSE_AGENT_MENU:
                menuSelected = chooseAgentMenu;
                break;

            case Menus.END_GAME_MENU:
                menuSelected = endGameMenu;
                break;
            }

            if (menuSelected != null)
            {
                menuSelected.SetActive(true);
                menuInt = menuSelected.GetComponent <MenuInterface>();

                menuInt.InitMenu();
            }
        }
Пример #2
0
    void Start()
    {
        menu           = GetComponent <MenuInterface>();
        txtDescription = transform.Find("Menu/TabDescription/Text").GetComponent <Text>();
        txtStats       = transform.Find("Menu/TabStats/Text").GetComponent <Text>();
        tabSpell       = transform.Find("Menu/TabSpell");
        align          = tabSpell.GetComponent <GridLayoutGroup>();


        txtDescription.text = "";
        foreach (SpellCaster cast in player.spells)
        {
            GameObject obj = Instantiate(menuSpellCasePrefab.gameObject, Vector3.zero, Quaternion.identity,
                                         tabSpell);
            if (obj)
            {
                MenuSpellCase spell;
                if (spell = obj.GetComponent <MenuSpellCase>())
                {
                    spell.LoadSpell(cast);
                    spell.locked = true;
                }
                MenuHoverEvent hover = obj.AddComponent <MenuHoverEvent>();
                hover.OnHoverEnterEvent += OnHoverEnter;
                hover.OnHoverExitEvent  += OnHoverExit;
            }
        }
        LayoutRebuilder.ForceRebuildLayoutImmediate(tabSpell.GetComponent <RectTransform>());
        align.enabled = false;
    }
Пример #3
0
        //Remove when rewritting menu
        private static void Interface_AddMenuButtons(Orig_AddMenuButtons orig, Main main, int selectedMenu, string[] buttonNames, float[] buttonScales, ref int offY, ref int spacing, ref int buttonIndex, ref int numButtons)
        {
            MenuHelper.AddButton(Language.GetTextValue("UI.Achievements"), delegate
            {
                Main.MenuUI.SetState(AchievementsMenu);
                Main.menuMode = 888;
            }, selectedMenu, buttonNames, ref buttonIndex, ref numButtons);                                                                                 //Achievements

            MenuHelper.AddButton(Language.GetTextValue("tModLoader.MenuMods"), MenuModes.Mods, selectedMenu, buttonNames, ref buttonIndex, ref numButtons); //Mods

            if (ModCompileHelper.DeveloperMode)
            {
                MenuHelper.AddButton("haha test menu used for tests hahaha", delegate                 //Language.GetTextValue("tModLoader.MenuModSources")
                {
                    //bool ret = (bool)ReflectionSystem.DeveloperModeReady.Invoke(null, new object[1]);
                    //Main.menuMode = ret ? (int)MenuModes.ModSources : (int)MenuModes.DeveloperModeHelp;
                    MenuInterface.SetState(LanguageSettings);
                    Main.menuMode = (int)MenuModes.LanguageSettings;
                }, selectedMenu, buttonNames, ref buttonIndex, ref numButtons);                                                                                             //Mod Sources

                MenuHelper.AddButton("Modding Tools", MenuModes.ModdingTools, selectedMenu, buttonNames, ref buttonIndex, ref numButtons);                                  //Modding Tools (note: very cringe because there isn't a back button)

                MenuHelper.AddButton(Language.GetTextValue("tModLoader.MenuModSources"), MenuModes.ModSources, selectedMenu, buttonNames, ref buttonIndex, ref numButtons); //Mod Sources
            }

            MenuHelper.AddButton(Language.GetTextValue("tModLoader.MenuModBrowser"), MenuModes.ModBrowser, selectedMenu, buttonNames, ref buttonIndex, ref numButtons); //Mod Browser

            offY = 220;                                                                                                                                                 //Y offset with all buttons. Higher lowers the buttons on screen

            for (int i = 0; i < numButtons; i++)
            {
                buttonScales[i] = 0.82f; //Button scale for all buttons
            }
            spacing = 45;                //The spacing between each button. Don't touch
        }
Пример #4
0
        private void btnLogin_Click(object sender, EventArgs e)
        {
            string username = txtUsername.Text;
            string password = txtPassword.Text;

            var ad      = new AccountsData();
            var sd      = new StaffData();
            var message = new UserMessage();

            bool allInputsValid = ValidateInputs(username, password);        //check all users inputs are valid
            var  accountInfo    = ad.GetAccountPassword(username, password); //get account password from database
            bool passwordMatch  = accountInfo.Item1;                         //return if passwords matched between input and hashed stored password

            Int32.TryParse(accountInfo.Item2, out var staffId);              //get the staffs id that's trying to log in

            if (allInputsValid && passwordMatch)
            {
                //if everything's valid, get all that staffs information, store in a data structure
                var staff = sd.GetStaffInformation(staffId, username, password);
                //reset login data and hide login component
                SetupTextBoxes();
                Hide();
                //bring the logged in menu up, user is now logged in
                var menuInterface = new MenuInterface(staff, this);
                menuInterface.ShowDialog();
            }
            else if (allInputsValid)
            {
                message.Show("Your password does not match the password we have stored for your account.");
            }
        }
Пример #5
0
 private void OnTransitionStarted(MenuInterface ci)
 {
     if (Interactable)
     {
         Interactable = false;
         EventDispatcher.Broadcast(InteractableChanged, Interactable);
     }
 }
Пример #6
0
 public void SetCurrentInterface(MenuInterface ci)
 {
     if (!_transitioning && ci != CurrentInterface)
     {
         _transitioning = true;
         _target        = ci;
         EventDispatcher.Broadcast(TransitionStarted, CurrentInterface);
     }
 }
 private void Start()
 {
     opponent      = GetComponent <Opponent>();
     parallax      = GetComponent <Parallax>();
     lobby         = GetComponent <Lobby>();
     menuInterface = GetComponent <MenuInterface>();
     gameInterface = GetComponent <GameInterface>();
     cameraLook    = GetComponent <CameraLookAtPlayer>();
 }
Пример #8
0
        public static void Main()
        {
            Console.WriteLine("Interface Menu, Press any key to Continue:");
            Console.ReadLine();

            MenuInterface interfaceMenu = new MenuInterface(2);

            interfaceMenu.MainMenu.Text                          = "Main";
            interfaceMenu.MainMenu.SubMenu[0]                    = new MenuItemInterface(2, 1);
            interfaceMenu.MainMenu.SubMenu[0].Text               = "Show Date/ Time";
            interfaceMenu.MainMenu.SubMenu[0].SubMenu[0]         = new MenuItemInterface(0, 2);
            interfaceMenu.MainMenu.SubMenu[0].SubMenu[0].Text    = "Show Time";
            interfaceMenu.MainMenu.SubMenu[0].SubMenu[0].Invoker = new Time();
            interfaceMenu.MainMenu.SubMenu[0].SubMenu[1]         = new MenuItemInterface(0, 2);
            interfaceMenu.MainMenu.SubMenu[0].SubMenu[1].Text    = "Show Date";
            interfaceMenu.MainMenu.SubMenu[0].SubMenu[1].Invoker = new Date();

            interfaceMenu.MainMenu.SubMenu[1]                    = new MenuItemInterface(2, 1);
            interfaceMenu.MainMenu.SubMenu[1].Text               = "Version/ Count digits";
            interfaceMenu.MainMenu.SubMenu[1].SubMenu[0]         = new MenuItemInterface(0, 2);
            interfaceMenu.MainMenu.SubMenu[1].SubMenu[0].Text    = "Version";
            interfaceMenu.MainMenu.SubMenu[1].SubMenu[0].Invoker = new Version();
            interfaceMenu.MainMenu.SubMenu[1].SubMenu[1]         = new MenuItemInterface(0, 2);
            interfaceMenu.MainMenu.SubMenu[1].SubMenu[1].Text    = "Count Digits";
            interfaceMenu.MainMenu.SubMenu[1].SubMenu[1].Invoker = new CountDig();
            interfaceMenu.Show();

            Console.Clear();
            Console.WriteLine("Delegate Menu, Press any key to Continue:");
            Console.ReadLine();

            MenuDelegate delegateMenu = new MenuDelegate(2);

            delegateMenu.MainMenu.Text                           = "Main";
            delegateMenu.MainMenu.SubMenu[0]                     = new MenuItemDelegate(2, 1);
            delegateMenu.MainMenu.SubMenu[0].Text                = "Show Date/ Time";
            delegateMenu.MainMenu.SubMenu[0].SubMenu[0]          = new MenuItemDelegate(0, 2);
            delegateMenu.MainMenu.SubMenu[0].SubMenu[0].Text     = "Show Time";
            delegateMenu.MainMenu.SubMenu[0].SubMenu[0].Choosed += Time.ShowTime;
            delegateMenu.MainMenu.SubMenu[0].SubMenu[1]          = new MenuItemDelegate(0, 2);
            delegateMenu.MainMenu.SubMenu[0].SubMenu[1].Text     = "Show Date";
            delegateMenu.MainMenu.SubMenu[0].SubMenu[1].Choosed += Date.ShowDate;

            delegateMenu.MainMenu.SubMenu[1]                     = new MenuItemDelegate(2, 1);
            delegateMenu.MainMenu.SubMenu[1].Text                = "Version/ Count digits";
            delegateMenu.MainMenu.SubMenu[1].SubMenu[0]          = new MenuItemDelegate(0, 2);
            delegateMenu.MainMenu.SubMenu[1].SubMenu[0].Text     = "Version";
            delegateMenu.MainMenu.SubMenu[1].SubMenu[0].Choosed += Version.PrintVersion;
            delegateMenu.MainMenu.SubMenu[1].SubMenu[1]          = new MenuItemDelegate(0, 2);
            delegateMenu.MainMenu.SubMenu[1].SubMenu[1].Text     = "Count Digits";
            delegateMenu.MainMenu.SubMenu[1].SubMenu[1].Choosed += CountDig.DigCount;
            delegateMenu.Show();

            Console.Clear();
            Console.WriteLine("Bye Bye");
        }
Пример #9
0
        public void ActivateMenu(Menu menuIndex)
        {
            int index = (int)menuIndex;

            DesactiveMenus();
            MenuInterface mi = menus[index].GetComponent <MenuInterface>();

            menus[index].SetActive(true);
            mi.InitMenu();
        }
Пример #10
0
        public void Initialize()
        {
            Models.Get <IGamestateModel>().StateChanged        += OnGamestateChanged;
            Models.Get <IShuttersModel>().ShutterTransitionEnd += OnShuttersTransitionEnd;

            CurrentInterface = MenuInterface.Login;
            _transitioning   = false;

            Models.Get <IGamestateModel>().SetState(Gamestate.MainMenu);
        }
Пример #11
0
    public void setMenu(string menu)
    {
        main.Deactivate();
        selectMenu.Deactivate();
        controls.Deactivate();
        settings.Deactivate();
        stage.Deactivate();;
        end.Deactivate();;
        play.Deactivate();
        switch (menu)
        {
        case "main":
            Debug.Log("set main");
            currentMenu = main;
            currentMenu.Activate();
            break;

        case "selectMenu":
            Debug.Log("set selectMenu");
            currentMenu = selectMenu;
            currentMenu.Activate();
            break;

        case "controls":
            Debug.Log("set controls");
            currentMenu = controls;
            currentMenu.Activate();
            break;

        case "settings":
            Debug.Log("set settings");
            currentMenu = settings;
            currentMenu.Activate();
            break;

        case "stage":
            Debug.Log("set stage");
            currentMenu = stage;
            currentMenu.Activate();
            break;

        case "play":
            Debug.Log("set play");
            currentMenu = play;
            currentMenu.Activate();
            break;

        case "end":
            Debug.Log("set end");
            currentMenu = end;
            currentMenu.Activate();
            break;
        }
    }
Пример #12
0
 //temp function for fast login when testing components during development
 public void TempStaffSetupFastLogin()
 {
     try
     {
         var staff = new StaffAccounts("Jesse", "Harasym", "admin", "admin123", "*****@*****.**", "Administrator",
                                       1,
                                       10);
         var cs = new MenuInterface(staff, this);
         cs.ShowDialog();
     }
     catch (Exception ex)
     {
         Console.WriteLine("Something went wrong with fast login " + ex);
     }
 }
Пример #13
0
        private void Main_DrawMenu(On.Terraria.Main.orig_DrawMenu orig, Main self, GameTime gameTime)
        {
            HookPreDrawMenu();

            if (MenuInterface?.CurrentState != null && lastUpdateUIGameTime != null)
            {
                MenuInterface.Draw(Main.spriteBatch, lastUpdateUIGameTime);
            }

            try
            {
                orig(self, gameTime);
            }
            catch (Exception) { }

            HookPostDrawMenu();
        }
Пример #14
0
    void Start()
    {
        menu        = GetComponent <MenuInterface>();
        description = transform.Find("Menu/TabDescription/Text").GetComponent <Text>();
        border      = transform.Find("Menu/TabDescription/Border").GetComponent <Image>();
        for (int i = 0; i < list.Count; ++i)
        {
            list[i].caseId = i;
            list[i].inv    = this;
            MenuHoverEvent hove = list[i].gameObject.AddComponent <MenuHoverEvent>();
            hove.OnHoverEnterEvent += OnHoverEnter;
            hove.OnHoverExitEvent  += OnHoverExit;
        }
        equip.inv = this;
        MenuHoverEvent hover = equip.gameObject.AddComponent <MenuHoverEvent>();

        hover.OnHoverEnterEvent += OnHoverEnter;
        hover.OnHoverExitEvent  += OnHoverExit;
    }
Пример #15
0
        public override void OnUpdate(GameTime gameTime)
        {
            if (Main.gameMenu)
            {
                if (previousMenuMode != Main.menuMode)
                {
                    HookOnMenuModeChange(previousMenuMode);
                }

                lastUpdateUIGameTime = gameTime;

                if (MenuInterface?.CurrentState != null)
                {
                    MenuInterface.Update(gameTime);
                }

                previousMenuMode = Main.menuMode;
            }
        }
Пример #16
0
        private IEnumerator Transition(MenuInterface targetInterface, float duration = 1f)
        {
            var lerp = 0f;
            var startScrollPosition  = Properties.ScrollView.horizontalNormalizedPosition;
            var targetScrollPosition = Properties.ScrollPositions[(int)targetInterface];

            while (lerp < 1)
            {
                var delta = (1 / (duration / Time.deltaTime));
                lerp = Mathf.Clamp(lerp + delta, 0, 1);
                var ease = Interpolation.EaseInOutQuad(lerp, 0, 1);

                var newPos = Mathf.Lerp(startScrollPosition, targetScrollPosition, ease);
                Properties.ScrollView.horizontalNormalizedPosition = newPos;

                yield return(null);
            }

            Presenter.AlertTransitionFinished();
        }
Пример #17
0
 public void AlertTransitionFinished()
 {
     CurrentInterface = _target;
     _transitioning   = false;
     EventDispatcher.Broadcast(TransitionFinished);
 }
Пример #18
0
 // Event listeners
 private void OnTransitionStarted(MenuInterface ci)
 {
     EventDispatcher.Broadcast(TransitionStarted, ci);
 }
Пример #19
0
 void Start()
 {
     menu = GetComponent <MenuInterface>();
     txt  = transform.Find("Menu/TxtInfo").GetComponent <Text>();
 }
Пример #20
0
 private void Awake()
 {
     _menu   = GetComponentInParent <MenuInterface>();
     _button = GetComponentInChildren <Button>();
     _button.onClick.AddListener(_menu.Hide);
 }
Пример #21
0
 public MenuScene()
 {
     Background = new Background();
     GUI        = new MenuInterface();
 }
Пример #22
0
 // Updating view
 private void OnTransitionStarted(MenuInterface ci)
 {
     StartCoroutine(Transition(ci, 0.5f));
 }