public virtual void OpenMenu(IUserInterface userInterface, MenuArgs args) { m_userInterface = userInterface; if (m_experienceMachine.CurrentExperience == ExperienceType.HOME && m_standaloneMenu != null) { m_standaloneMenu.SetActive(false); } m_menuItems.Clear(); Blocked = args.Block; Persist = args.Persist; m_onAction = args.OnAction; gameObject.SetActive(true); Populate(args.Items); if (m_uiEngine == null) { m_uiEngine = IOCCore.Resolve <IUIEngine>(); } if (m_okButton != null) { m_okButton.onClick.AddListener(() => m_uiEngine.CloseLastScreen()); } if (m_closeButton != null) { m_closeButton.onClick.AddListener(() => m_uiEngine.CloseLastScreen()); } }
public override void OpenMenu(IUserInterface userInterface, MenuArgs args) { m_userInterface = userInterface; m_microphoneDropdown.AddOptions(new List <string>(Microphone.devices)); ResetToPreviousSettings(); foreach (var item in m_toggles) { item.onValueChanged.AddListener((val) => ValueChange()); } foreach (var item in m_sliders) { item.onValueChanged.AddListener((val) => ValueChange()); } foreach (var item in m_dropDowns) { item.onValueChanged.AddListener((val) => ValueChange()); } m_ambienceVolume.onValueChanged.AddListener((val) => PreviewSound(val, AudioType.AMBIENCE)); m_musicVolume.onValueChanged.AddListener((val) => PreviewSound(val, AudioType.MUSIC)); m_sfxVolume.onValueChanged.AddListener((val) => PreviewSound(val, AudioType.SFX)); m_audioVolume.onValueChanged.AddListener((val) => PreviewSound(val, AudioType.VO)); m_desktopMode.interactable = !m_settings.SelectedPreferences.ForcedDesktopMode; m_accountTab.isOn = true; }
public void OnMethodChanged(object sender, MenuArgs e) { if (MethodChanged != null) { MessageBox.Show(sender + " : " + e.SelectedItem); } }
/// <summary> /// This event is passed to each registered menu and attached to the menu's back event handler /// </summary> /// <param name="sender">The menu that has been activated</param> /// <param name="e">A standard blank EventArgs</param> public void Back(MenuArgs args) { //Pop the stack Stack.Pop(); //If the stack is empty, meaning there are no more menus, exit the game if (Stack.Count == 0) { Game.Exit(); } else { //Run the exit transition if (args.activateExit) { transitionManager.runTransition(TransitionState.exit, args.identifier); } //Else if the menu is not a small menu, i.e. the background does not show behind it, run the intro transition if (args.activateIntro) { transitionManager.runTransition(TransitionState.revert, Stack.Peek()); } //If the game is not running, force update the input if (!isPlaying) { input.updateInput(); } } }
private void OpenLoginPage() { var usernameInput = new MenuItemInfo { Path = "Email", Text = "Emaiil", Command = "Email", Icon = null, Data = TMP_InputField.ContentType.Standard, CommandType = MenuCommandType.FORM_INPUT }; var passwordInput = new MenuItemInfo { Path = "Password", Text = "Password", Command = "Password", Icon = null, Data = TMP_InputField.ContentType.Password, CommandType = MenuCommandType.FORM_INPUT }; MenuItemInfo[] formItems = new MenuItemInfo[] { usernameInput, passwordInput }; MenuArgs args = new MenuArgs() { Items = new MenuItemInfo[] { }, OnAction = (inputs) => { m_uiEngine.DisplayProgress("Validating user..."); m_webInterface.UserLogin(inputs[0], inputs[1], (isNetworkError, message) => { Error error = new Error(); JsonData validateUserLoginResult = JsonMapper.ToObject(message); if (validateUserLoginResult["status"].ToString() == "200") { return; } error.ErrorCode = Error.E_NotFound; error.ErrorText = validateUserLoginResult["message"].ToString(); m_uiEngine.DisplayResult(error, false); }); } }; m_uiEngine.OpenLoginPage(args); }
public override IScreen OpenMenu(MenuArgs args) { if (m_permanentDesktopScreen != null) { return(m_permanentDesktopScreen); } var menu = Instantiate(m_mainMenuPrefab, m_screensRoot); menu.OpenMenu(this, args); m_menuOn = true; m_permanentDesktopScreen = menu; return(menu); }
protected virtual IScreen SpawnPage(IScreen screenPrefab, MenuArgs args) { m_pageRoot.gameObject.SetActive(true); var menu = Instantiate(screenPrefab.Gameobject, m_pageRoot).GetComponent <IScreen>(); if (menu is MenuScreen menuScreen) { menuScreen.OpenMenu(m_userInterface, args); } else if (menu is MessageScreen messageScreen && args is MessageArgs messageArgs) { messageScreen.Init(m_userInterface, messageArgs); } return(menu); }
public override void OpenMenu(IUserInterface userInterface, MenuArgs args) { m_userInterface = userInterface; Blocked = args.Block; Persist = args.Persist; foreach (var item in m_pages) { item.Close(); } m_toggleGroup.allowSwitchOff = true; base.OpenMenu(userInterface, args); m_toggleGroup.allowSwitchOff = m_allowSwitchOff; //var obj = Instantiate(m_menuItem, m_contentRoot, false); }
protected override ActionStatus Run(IGameAction gameAction, IScenarioContent content, MenuArgs args, out string error) { ScenarioAction action; if (!ParseAction <ScenarioAction>(gameAction, out action, out error)) { return(ActionStatus.Error); } // 重置变量为-1 ScenarioBlackboard.Set(args.menuName, -1); // 打开UI UIMenuPanel panel = UIManager.views.OpenView <UIMenuPanel>(UINames.k_UIMenuPanel, false); // 设置选项并传入选择后的处理方法 if (!panel.SetOptions(args.options, selected => { // 选择完成后的处理 // 关闭菜单UI UIManager.views.CloseView(UINames.k_UIMenuPanel); // 设置选择的按钮 ScenarioBlackboard.Set(args.menuName, selected); // 继续剧本 action.MenuDone(); })) { error = string.Format( "{0} ParseArgs error: set menu options error.", typeName); return(ActionStatus.Error); } error = null; return(ActionStatus.WaitMenuOption); }
public override bool ParseArgs(IScenarioContent content, ref MenuArgs args, out string error) { /// menu option /// option0 /// option1 /// ...; if (content.length < 3) { error = GetLengthErrorString(); return(false); } // 获取使用的变量 if (!RegexUtility.IsMatchVariable(content[1])) { error = GetMatchVariableErrorString(content[1]); return(false); } args.menuName = content[1]; TextInfoConfig config = TextInfoConfig.Get <TextInfoConfig>(); List <string> options = new List <string>(); int index = 2; while (index < content.length) { string line; if (content[index].StartsWith("\"")) { if (!ScenarioUtility.ParseContentString(content, ref index, out line, out error)) { return(false); } } else { // 可能是个变量 int id = -1; if (!ParseOrGetVarValue(content[index], ref id, out error)) { return(false); } TextInfo info = config[id]; if (info == null) { error = string.Format( "{0} ParseArgs error: text id `{1}` was not found.", typeName, content[index]); return(false); } line = info.text; index++; } options.Add(line); } args.options = options.ToArray(); error = null; return(true); }