bool Mouse_MouseMoved(MOIS.MouseEvent arg) { MouseState_NativePtr state = arg.state; if (arg.state.Z.rel != 0 && modChooserMenu.GetNumItems() != 0) { float newIndex = modChooserMenu.getSelectionIndex() - arg.state.Z.rel / Mogre.Math.Abs((float)arg.state.Z.rel); float finalIndex = OpenMB.Utilities.Helper.Clamp <float>(newIndex, 0.0f, (float)(modChooserMenu.GetNumItems() - 1)); modChooserMenu.SelectItem((uint)finalIndex); //modTitle.setCaption("modChooserMenu.getSelectedItem()"); modTitle.setCaption( LocateSystem.Instance.GetLocalizedString( "module_info_name", modChooserMenu.getSelectedItem(), modDisplayDataList[modChooserMenu.Items.IndexOf(modChooserMenu.getSelectedItem())].ID )); //modDescBox.setText(modDisplayDataList[modChooserMenu.Items.IndexOf(modChooserMenu.getSelectedItem())].Desc); modDescBox.setText( LocateSystem.Instance.GetLocalizedString( "module_info_desc", modDisplayDataList[modChooserMenu.Items.IndexOf(modChooserMenu.getSelectedItem())].Desc, modDisplayDataList[modChooserMenu.Items.IndexOf(modChooserMenu.getSelectedItem())].ID )); selectedModName = modChooserMenu.getSelectedItem(); } UIManager.Instance.InjectMouseMove(arg); return(true); }
public override void enter(ModData e = null) { sceneMgr = EngineManager.Instance.root.CreateSceneManager(Mogre.SceneType.ST_GENERIC, "ModChooserSceneMgr"); ColourValue cvAmbineLight = new ColourValue(0.7f, 0.7f, 0.7f); sceneMgr.AmbientLight = cvAmbineLight; camera = sceneMgr.CreateCamera("ModChooserCam"); camera.SetPosition(0, 25, -50); Mogre.Vector3 vectorCameraLookat = new Mogre.Vector3(0, 0, 0); camera.LookAt(vectorCameraLookat); camera.NearClipDistance = 1; camera.AspectRatio = EngineManager.Instance.viewport.ActualWidth / EngineManager.Instance.viewport.ActualHeight; EngineManager.Instance.viewport.Camera = camera; modDisplayDataList.Clear(); mods = ModManager.Instance.GetInstalledMods(); foreach (var pair in mods) { if (pair.Value.MetaData.DisplayInChooser) { ModDisplayData modDisplayData = new ModDisplayData(pair.Key); modDisplayData.Name = pair.Value.MetaData.Name; modDisplayData.Desc = pair.Value.MetaData.Description; modDisplayData.Thumb = pair.Value.MetaData.Thumb; modDisplayDataList.Add(modDisplayData); } } UIManager.Instance.DestroyAllWidgets(); modTitle = UIManager.Instance.CreateLabel(UIWidgetLocation.TL_CENTER, "ModTitle", "Mod Info"); modTitle.setCaption("Mod Info"); modDescBox = UIManager.Instance.CreateTextBox(UIWidgetLocation.TL_CENTER, "ModInfo", "Mod Info", 250, 208); modDescBox.setCaption("Mod Info"); modChooserMenu = UIManager.Instance.CreateThickSelectMenu(UIWidgetLocation.TL_CENTER, "SelMod", "Select Mod", 250, 10); modChooserMenu.setCaption("Select Mod"); modChooserMenu.SetItems(modDisplayDataList.Select(o => o.Name).ToList()); modSlider = UIManager.Instance.CreateThickSlider(UIWidgetLocation.TL_CENTER, "ModSlider", "Slider Mods", 250, 80, 0, 0, 0); modSlider.setCaption("Slider Mods"); if (modDisplayDataList.Count > 0) { modTitle.setCaption(modChooserMenu.getSelectedItem()); } UIManager.Instance.CreateSeparator(UIWidgetLocation.TL_RIGHT, "LogoSep"); var btnPlay = UIManager.Instance.CreateButton(UIWidgetLocation.TL_RIGHT, "Play", LocateSystem.Instance.GetLocalizedString(Localization.LocateFileType.GameString, "str_play"), 160); var btnMods = UIManager.Instance.CreateButton(UIWidgetLocation.TL_RIGHT, "Mods", LocateSystem.Instance.GetLocalizedString(Localization.LocateFileType.GameString, "str_mods"), 160); var btnQuit = UIManager.Instance.CreateButton(UIWidgetLocation.TL_RIGHT, "Quit", LocateSystem.Instance.GetLocalizedString(Localization.LocateFileType.GameString, "str_quit"), 160); btnPlay.OnClick += (o) => { string modID = modDisplayDataList.Where(a => a.Name == selectedModName).First().ID; EngineManager.Instance.loadingData = new LoadingData(LoadingType.LOADING_MOD, "Loading Mod...Please wait", modID, "MainMenu"); changeAppState(findByName("Loading")); }; btnMods.OnClick += (o) => { ScreenManager.Instance.ChangeScreen("ModBrowser"); }; btnQuit.OnClick += (o) => { isQuit = true; }; setupModMenu(); EngineManager.Instance.mouse.MouseMoved += Mouse_MouseMoved; EngineManager.Instance.mouse.MousePressed += Mouse_MousePressed; EngineManager.Instance.mouse.MouseReleased += Mouse_MouseReleased; EngineManager.Instance.root.FrameRenderingQueued += FrameRenderingQueued; }