public void CreateWindow() { Window = WindowManager.SpawnWindow(); Window.InitialTitle = Window.TitleText.text = Window.NonLocTitle = title; Window.MinSize.x = 670; Window.MinSize.y = 800; Window.name = "SIncLibMarketResearch"; Window.MainPanel.name = "SIncLibAMarketResearchPanel"; if (Window.name == "SIncLibMarketResearch") { Window.GetComponentsInChildren <Button>() .SingleOrDefault(x => x.name == "CloseButton") .onClick.AddListener(() => shown = false); } _softwareList = WindowManager.SpawnList(); SetupSoftwareColumnDefinition(_softwareList); _softwareList.Items.Clear(); _softwareList.Items.AddRange(GameSettings.Instance.MyCompany.Products); _softwareList.Initialize(); WindowManager.AddElementToWindow(_softwareList.gameObject, Window, new Rect(10, 40, -20, 200), new Rect(0, 0, 1, 0)); }
private void ShowInfo() { try { GUIWindow fWindow = GUIWindowManager.GetWindow(Utils.ActiveWindow); int FocusControlID = fWindow.GetFocusControlId(); int idx = -1; if (ControlIDPlays.Contains(FocusControlID)) { idx = ControlIDPlays.IndexOf(FocusControlID); } // // CurrentFacade.Facade = Utils.GetLatestsFacade(CurrentFacade.ControlID); if (CurrentFacade.Facade != null && CurrentFacade.Facade.Focus && CurrentFacade.Facade.SelectedListItem != null) { idx = CurrentFacade.Facade.SelectedListItem.ItemId - 1; } // if (idx >= 0) { string sHyp = "movieid:" + latestMovies[idx].Id; GUIWindowManager.ActivateWindow(96742, sHyp, false); } } catch (Exception ex) { logger.Error("ShowInfo: " + ex.ToString()); } }
public void OnGUI() { if (GUIWindow.DrawHeader("管理")) { GUILayout.BeginHorizontal(); { if (GUILayout.Button("保存配置", GUILayout.Width(90))) { SaveCf(); } if (GUILayout.Button("重置配置", GUILayout.Width(90))) { ResetCf(); } } GUILayout.EndHorizontal(); } foreach (var pathList in PathDic) { if (GUIWindow.DrawHeader(pathList.Key)) { OnGUIPathList(pathList.Value); } } }
public void RemoveFromLayout(GUIWindow w) { if (null != _mWindowLayout) { _mWindowLayout.Remove(w); } }
private void ShowInfo() { try { GUIWindow fWindow = GUIWindowManager.GetWindow(Utils.ActiveWindow); int FocusControlID = fWindow.GetFocusControlId(); int idx = -1; if (ControlIDPlays.Contains(FocusControlID)) { idx = ControlIDPlays.IndexOf(FocusControlID) + 1; } // // CurrentFacade.Facade = Utils.GetLatestsFacade(CurrentFacade.ControlID); if (CurrentFacade.Facade != null && CurrentFacade.Facade.Focus && CurrentFacade.Facade.SelectedListItem != null) { idx = CurrentFacade.Facade.SelectedListItem.ItemId; } // if (idx > 0) { IMDBMovie movie = (IMDBMovie)latestMyVideosForPlay[idx]; // Open video info screen GUIVideoInfo videoInfo = (GUIVideoInfo)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_VIDEO_INFO); videoInfo.Movie = movie; GUIWindowManager.ActivateWindow((int)GUIWindow.Window.WINDOW_VIDEO_INFO); } } catch (Exception ex) { logger.Error("ShowInfo: " + ex.ToString()); } }
public void CreateDoubleLayout(GUIWindow w1, GUIWindow w2, float duration, float delay) { List <GUIWindow> winList = Globals.Instance.MGUIManager.GetGUIWindowList(); // Close other coexsit windows winList.RemoveAll(delegate(GUIWindow w) { if (w == w1 || w == w2) { return(false); } if (w.IsVisible && _mCoexistNamePairList.Contains(w.GetType().Name)) { w.Close(); return(true); } return(false); } ); _mWindowLayout = new GUIWindowLayoutDouble(w1, w2, duration, delay); _mWindowLayout.Start(); }
public virtual void PageLoad(int ParentID) { CloseRoutedWindow(); _parentWindowID = ParentID; _parentWindow = GUIWindowManager.GetWindow(_parentWindowID); if (_parentWindow == null) { _parentWindowID = 0; return; } GUIWindowManager.IsSwitchingToNewWindow = true; lock (thisLock) { GUIWindowManager.RouteToWindow(GetID); GUIMessage msg = new GUIMessage(GUIMessage.MessageType.GUI_MSG_WINDOW_INIT, GetID, 0, 0, _parentWindowID, 0, null); OnMessage(msg); _running = true; } GUIWindowManager.IsSwitchingToNewWindow = false; while (IsAnimating(AnimationType.WindowOpen) && GUIGraphicsContext.CurrentState == GUIGraphicsContext.State.RUNNING) { GUIWindowManager.Process(); } }
public virtual void PageDestroy() { if (_running == false) { return; } GUIWindowManager.IsSwitchingToNewWindow = true; lock (thisLock) { GUIMessage msg = new GUIMessage(GUIMessage.MessageType.GUI_MSG_WINDOW_DEINIT, GetID, 0, 0, _parentWindowID, 0, null); OnMessage(msg); if (GUIWindowManager.RoutedWindow == GetID) { GUIWindowManager.UnRoute(); // only unroute if we still the routed window } _parentWindow = null; _running = false; } GUIWindowManager.IsSwitchingToNewWindow = false; while (IsAnimating(AnimationType.WindowClose) && GUIGraphicsContext.CurrentState == GUIGraphicsContext.State.RUNNING) { GUIWindowManager.Process(); } }
/// <summary> /// Close a previously opened UI window /// </summary> /// <param name="name"> The name of the UI window to be closed </param> public void Close(string name) { #if UNITY_EDITOR Debug.Log(LogUtility.MakeLogStringFormat("UI", IsInViewport(name) ? "Close " + name : name + " is not in viewport")); #endif if (IsInViewport(name)) { GUIWindow ui = uiWindowsOpened[name]; ui.OnClose(); Stack <string> s = new Stack <string>(); while (uiWindowStack.Peek().CompareTo(name) != 0) { s.Push(uiWindowStack.Pop()); } uiWindowStack.Pop(); while (s.Count > 0) { uiWindowStack.Push(s.Pop()); } Destroy(ui.gameObject); uiWindowsOpened.Remove(name); } }
/// <summary> /// Open a new UI window /// </summary> /// <param name="name"> The name of the UI window to be opened </param> /// <param name="mode"> The mode to be used to open the UI window </param> /// <param name="args"> Extra arguments passed to UIWindow.OnOpen() </param> /// <returns></returns> public GUIWindow Open(string name, UIMode mode = UIMode.DEFAULT, params object[] args) { #if UNITY_EDITOR Debug.Log(LogUtility.MakeLogStringFormat("UI", IsInViewport(name) ? name + " is already in viewport" : "Open " + name)); #endif if (IsInViewport(name)) { return(uiWindowsOpened[name]); } GUIWindow uiWindow = Instantiate(ResourceUtility.GetGUIPrefab <GUIWindow>(name), transform, false); uiWindow.transform.SetAsFirstSibling(); uiWindowsOpened.Add(name, uiWindow); uiWindow.OnOpen(args); if (mode != UIMode.PERMANENT) { uiWindowStack.Push(name); } return(uiWindow); }
public static void AddLabel(string text, Rect labelRect, GUIWindow window) { Text label = WindowManager.SpawnLabel(); label.text = text; WindowManager.AddElementToWindow(label.gameObject, window, labelRect, new Rect(0, 0, 0, 0)); }
public override void OnActivate() { bool firstTimeLaunch = !SettingsHandler.Has("firstTimeLaunch"); if (firstTimeLaunch) //if (true) { GUIWindow firstTimeWindow = WindowManager.SpawnWindow(); firstTimeWindow.Show(); firstTimeWindow.SetTitle("FirstTimeWindowTitle".LocDef("First time? Neat!")); firstTimeWindow.ShowCentered = true; firstTimeWindow.MinSize = new Vector2(Screen.width / 2 - 5f, 32 + 32 + 5 + 5 + 5); Text description = WindowManager.SpawnLabel(); description.text = GetSteamUsernameText(); Text description2 = WindowManager.SpawnLabel(); description2.text = "FirstTimeWindowDescription2".LocDef("The wiki also contains useful info on how to configure your server, set passwords on your server, and lots more! It also contains some useful infomation on how to debug/fix problems related to multiplayer."); Button openWikiButton = WindowManager.SpawnButton(); openWikiButton.GetComponentInChildren <Text>().text = "FirstTimeWindow_OpenWiki".LocDef("Open Wiki"); openWikiButton.onClick.AddListener(OpenWiki); Button closeWindowButton = WindowManager.SpawnButton(); closeWindowButton.GetComponentInChildren <Text>().text = "FirstTimeWindow_OK".LocDef("Ok"); closeWindowButton.onClick.AddListener(() => firstTimeWindow.gameObject.SetActive(false)); firstTimeWindow.SizeButton.SetActive(false); WindowManager.AddElementToWindow(description.gameObject, firstTimeWindow, new Rect(5, 15, (Screen.width / 2) - 15f, 32), Rect.zero); WindowManager.AddElementToWindow(openWikiButton.gameObject, firstTimeWindow, new Rect(5, (32 * 2) + 25, (Screen.width / 2) - 15f, 60f), Rect.zero); WindowManager.AddElementToWindow(closeWindowButton.gameObject, firstTimeWindow, new Rect(5, (32 * 2) + 90, (Screen.width / 2) - 15f, 60f), Rect.zero); WindowManager.AddElementToWindow(description2.gameObject, firstTimeWindow, new Rect(5, 42 + 5, (Screen.width / 2) - 15f, 32), Rect.zero); SettingsHandler.Set("firstTimeLaunch", false); } }
public void DoModal(int dwParentId) { //Log.Debug("TvMiniGuide: DoModal"); _parentWindowID = dwParentId; _parentWindow = GUIWindowManager.GetWindow(_parentWindowID); if (null == _parentWindow) { //Log.Debug("TvMiniGuide: parentwindow = null"); _parentWindowID = 0; return; } GUIWindowManager.IsSwitchingToNewWindow = true; GUIWindowManager.RouteToWindow(GetID); // activate this window... GUIMessage msg = new GUIMessage(GUIMessage.MessageType.GUI_MSG_WINDOW_INIT, GetID, 0, 0, -1, 0, null); OnMessage(msg); GUIWindowManager.IsSwitchingToNewWindow = false; _running = true; GUILayerManager.RegisterLayer(this, GUILayerManager.LayerType.Dialog); while (_running && GUIGraphicsContext.CurrentState == GUIGraphicsContext.State.RUNNING) { GUIWindowManager.Process(); } Close(); }
/// <summary> /// Do this modal /// </summary> /// <param name="dwParentId"></param> public void DoModal(int parentId) { _parentWindowID = parentId; _parentWindow = GUIWindowManager.GetWindow(_parentWindowID); if (null == _parentWindow) { _parentWindowID = 0; return; } GUIWindowManager.IsSwitchingToNewWindow = true; GUIWindowManager.RouteToWindow(GetID); // activate this window... GUIMessage msg = new GUIMessage(GUIMessage.MessageType.GUI_MSG_WINDOW_INIT, GetID, 0, 0, -1, 0, null); OnMessage(msg); GUIWindowManager.IsSwitchingToNewWindow = false; _running = true; GUILayerManager.RegisterLayer(this, GUILayerManager.LayerType.Dialog); while (_running && GUIGraphicsContext.CurrentState == GUIGraphicsContext.State.RUNNING) { GUIWindowManager.Process(); if (!GUIGraphicsContext.Vmr9Active) { Thread.Sleep(50); } } GUILayerManager.UnRegisterLayer(this); }
public UILabel(string text, Rect pos, GUIWindow parent, string name = "", bool isBold = false, uint fontsize = 0) : base(pos, parent) { Text label = WindowManager.SpawnLabel(); if (!isBold) { label.text = text; } else { label.text = "<b>" + text + "</b>"; } if (fontsize > 0) { label.fontSize = (int)fontsize; } if (string.IsNullOrEmpty(name)) { label.name = name; } Place(label.gameObject); obj = label; }
protected virtual void OnGUI() { GUIWindow.DrawSeparator(); if (ToolbarTitles.Length > 0 && BarToolsDic.Count == 0) { OnInit(); } if (ToolbarTitles.Length > 1) { GUILayout.BeginHorizontal(); { ToolbarIndex = GUILayout.Toolbar(ToolbarIndex, ToolbarTitles); } GUILayout.EndHorizontal(); GUIWindow.DrawSeparator(); } foreach (var bar in BarToolsDic) { if (bar.Key != ToolbarIndex) { continue; } for (int i = 0; i < bar.Value.Count; i++) { bar.Value[i].OnGUI(); } } }
internal bool PlayMovie(GUIWindow fWindow) { try { int FocusControlID = fWindow.GetFocusControlId(); if (ControlIDPlays.Contains(FocusControlID)) { PlayMovie(ControlIDPlays.IndexOf(FocusControlID) + 1); return(true); } // // CurrentFacade.Facade = Utils.GetLatestsFacade(CurrentFacade.ControlID); if (CurrentFacade.Facade != null && CurrentFacade.Facade.Focus && CurrentFacade.Facade.SelectedListItem != null) { PlayMovie(CurrentFacade.Facade.SelectedListItem.ItemId); return(true); } } catch (Exception ex) { logger.Error("Unable to play video! " + ex.ToString()); return(true); } return(false); }
public void ChangeWindow(string windowName) { if (windowName == "!close") { foreach (GUIWindow window in windows) { window.WinTransform.gameObject.SetActive(false); } return; } bool foundMatch = false; foreach (GUIWindow w in windows) { if (w.WindowName.ToLower() == windowName.ToLower()) { // Debug.Log("Showing window " + windowName); foundMatch = true; openWindow = w; // found the chosen window to open // close all other windows foreach (GUIWindow window in windows) { window.WinTransform.gameObject.SetActive(false); } w.WinTransform.gameObject.SetActive(true); break; } } if (!foundMatch) { throw new WindowNameNotFoundException($"Couldn't find window of name: {windowName}"); } }
public void DoModal(int dwParentId) { _parentWindowId = dwParentId; _parentWindow = GUIWindowManager.GetWindow(_parentWindowId); if (null == _parentWindow) { _parentWindowId = 0; return; } GUIWindowManager.IsSwitchingToNewWindow = true; GUIWindowManager.RouteToWindow(GetID); GUILayerManager.RegisterLayer(this, GUILayerManager.LayerType.Dialog); // active this window... (with its own OnPageLoad) PageLoad(); GUIWindowManager.IsSwitchingToNewWindow = false; _keyboard.IsVisible = true; _keyboard.Position = _keyboard.TextEntered.Length; while (_keyboard.IsVisible && GUIGraphicsContext.CurrentState == GUIGraphicsContext.State.RUNNING) { GUIWindowManager.Process(); } PageDestroy(); }
internal void InfoPictures() { try { GUIWindow fWindow = GUIWindowManager.GetWindow(Utils.ActiveWindow); int FocusControlID = fWindow.GetFocusControlId(); int idx = -1; if (ControlIDPlays.Contains(FocusControlID)) { idx = ControlIDPlays.IndexOf(FocusControlID) + 1; } // // CurrentFacade.Facade = Utils.GetLatestsFacade(CurrentFacade.ControlID); if (CurrentFacade.Facade != null && CurrentFacade.Facade.Focus && CurrentFacade.Facade.SelectedListItem != null) { idx = CurrentFacade.Facade.SelectedListItem.ItemId; } // if (idx > 0) { GUIDialogExif exifDialog = (GUIDialogExif)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_EXIF); // Needed to set GUIDialogExif exifDialog.Restore(); exifDialog = (GUIDialogExif)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_EXIF); exifDialog.FileName = latestPicturesFiles[idx].ToString(); exifDialog.DoModal(fWindow.GetID); exifDialog.Restore(); } } catch (Exception ex) { logger.Error("Unable to Info picture! " + ex.ToString()); } }
public static int Initialize() { try { Task.Run(() => { while (true) { if (IsBreakPushed()) { IsBreakEnabled = !IsBreakEnabled; Console.WriteLine($"Break mode: {IsBreakEnabled}."); Thread.Sleep(1000); Entities.Clear(); } } }); var guiThread = new Thread(() => { var window = new GUIWindow(); window.ShowDialog(); }); guiThread.SetApartmentState(ApartmentState.STA); guiThread.Start(); Task.Run(() => { while (true) { if (!IsBreakEnabled) { Support(); } } }); Task.Run(() => { while (true) { if (!IsBreakEnabled) { Targetting(); } } }); } catch (Exception e) { Console.WriteLine(e); } return(1); }
public static void SetGUIProperty(this GUIWindow window, string which, string value, bool isInternalMediaportal = false) { if (string.IsNullOrEmpty(value)) { value = " "; } GUIPropertyManager.SetProperty(window.GetPropertyName(which, isInternalMediaportal), value); }
public void OnGUI() { OnGUI_SelectAvaterType(); GUIWindow.DrawSeparator(); OnGUI_AvaterInfo(); }
public static GUIWindow LoadGUISetupAdditive(string setup) { GUIWindow newWindow = GameObject.Instantiate(Resources.Load <GameObject>("GUI/Setups/" + setup)).GetComponent <GUIWindow>(); newWindow.windowPath = setup; openWindows.Add(newWindow); return(openWindows[openWindows.Count - 1]); }
private void CreateModuleWindow(UiTreeNode node) { if (node == null || !(node.ContextObject is GUIModule)) { MessageBox.Show("请选择结点"); return; } WindowDlg dlg = new WindowDlg(); dlg.Text = "添加窗口信息"; foreach (TableInfo item in this.project.Database.Tables) { dlg.cmbEntity.Items.Add(item); } foreach (ViewInfo item in this.project.Database.Views) { dlg.cmbEntity.Items.Add(item); } dlg.cmbEntity.SelectedIndex = 0; if (dlg.ShowDialog() == DialogResult.OK) { GUIModule module = node.ContextObject as GUIModule; if (module == null) { return; } GUIWindow window = new GUIWindow(module); window.Caption = dlg.txtCaption.Text.Trim(); window.Name = dlg.txtName.Text.Trim(); window.Description = dlg.txtDescription.Text.Trim(); module.Windows.Add(window); EntityInfo entityInfo = null; TableInfo tableInfo = null; ViewInfo viewInfo = null; tableInfo = this.project.Database.Tables.Find(e => e.Name == dlg.cmbEntity.SelectedItem.ToString()); entityInfo = tableInfo; if (entityInfo != null) { entityInfo = (EntityInfo)((TableInfo)entityInfo).Clone(); //todo:window.MasterViews.Add(entityInfo); } else { viewInfo = this.project.Database.Views.Find(e => e.Name == dlg.cmbEntity.SelectedItem.ToString()); entityInfo = viewInfo; entityInfo = (EntityInfo)((ViewInfo)entityInfo).Clone(); //todo:window.Entities.Add(entityInfo); } BuildEntities(entityInfo); UiTreeNode windowNode = new UiTreeNode(window); node.Nodes.Add(windowNode); } }
public void Show(int dwParentId) { m_dwParentWindowID = dwParentId; m_pParentWindow = GUIWindowManager.GetWindow(m_dwParentWindowID); GUIMessage msg = new GUIMessage(GUIMessage.MessageType.GUI_MSG_GOTO_WINDOW, 0, 0, 0, GetID, 0, null); GUIWindowManager.SendThreadMessage(msg); }
static void createToolBox() { GUIEnvironment env = device.GUIEnvironment; GUIElement root = env.RootElement; // remove tool box if already there GUIElement e = root.GetElementFromID((int)guiID.DialogRootWindow, true); if (e != null) { e.Remove(); } // create the toolbox window GUIWindow w = env.AddWindow(new Recti(600, 45, 800, 480), false, "Toolset", null, (int)guiID.DialogRootWindow); // create tab control and tabs GUITabControl tab = env.AddTabControl(new Recti(2, 20, 800 - 602, 480 - 7), w, -1, true, true); GUITab t1 = tab.AddTab("Config"); // add some edit boxes and a button to tab one env.AddStaticText("Scale:", new Recti(10, 20, 60, 45), false, false, t1); env.AddStaticText("X:", new Recti(22, 48, 40, 66), false, false, t1); env.AddEditBox("1.0", new Recti(40, 46, 130, 66), true, t1, (int)guiID.XScale); env.AddStaticText("Y:", new Recti(22, 78, 40, 96), false, false, t1); env.AddEditBox("1.0", new Recti(40, 76, 130, 96), true, t1, (int)guiID.YScale); env.AddStaticText("Z:", new Recti(22, 108, 40, 126), false, false, t1); env.AddEditBox("1.0", new Recti(40, 106, 130, 126), true, t1, (int)guiID.ZScale); env.AddButton(new Recti(10, 134, 85, 165), t1, (int)guiID.ButtonSetScale, "Set"); // quick scale buttons env.AddButton(new Recti(65, 20, 95, 40), t1, (int)guiID.ButtonScaleMul10, "* 10"); env.AddButton(new Recti(100, 20, 130, 40), t1, (int)guiID.ButtonScaleDiv10, "* 0.1"); updateScaleInfo(model); // add transparency control env.AddStaticText("GUI Transparency Control:", new Recti(10, 200, 150, 225), true, false, t1); GUIScrollBar b = env.AddScrollBar(true, new Recti(10, 225, 150, 240), t1, (int)guiID.SkinTransparency); b.MaxValue = 255; b.Position = 255; // add framerate control env.AddStaticText("Framerate:", new Recti(10, 240, 150, 265), true, false, t1); b = env.AddScrollBar(true, new Recti(10, 265, 150, 280), t1, (int)guiID.SkinAnimationFPS); b.MaxValue = MaxFramerate; b.MinValue = -MaxFramerate; b.Position = DefaultFramerate; // bring irrlicht engine logo to front, because it now may be below the newly created toolbox root.BringToFront(root.GetElementFromID((int)guiID.Logo, true)); }
public static void CreateGameObjects(int column, GameObject[] gameObjects, GUIWindow window, bool isComboBox = false) { for (int i = 0; i < gameObjects.Length; i++) { GameObject item = gameObjects[i]; WindowManager.AddElementToWindow(item, window, new Rect(column, (i - (isComboBox ? 1 : 0)) * Constants.ELEMENT_HEIGHT + (isComboBox && i % 2 == 0 ? 16 : 0), Constants.ELEMENT_WIDTH, Constants.ELEMENT_HEIGHT), new Rect(0, 0, 0, 0)); } }
private static void CreateWindow() { Window = WindowManager.SpawnWindow(); Window.InitialTitle = Window.TitleText.text = Window.NonLocTitle = _title; Window.name = "EmployeeSkillChange"; Window.MainPanel.name = "EmployeeSkillChangePanel"; if (Window.name == "EmployeeSkillChange") { Window.GetComponentsInChildren <Button>() .SingleOrDefault(x => x.name == "CloseButton") .onClick.AddListener(() => Shown = false); } List <GameObject> roleToggles = new List <GameObject>(); List <GameObject> specializationToggles = new List <GameObject>(); Utils.AddLabel("Roles", new Rect(10, 5, 150, 32), Window); Utils.AddLabel("Specializations", new Rect(161, 5, 150, 32), Window); var rolesList = PropertyHelper.RolesList; foreach (var role in rolesList) { Utils.AddToggle(role.Key, PropertyHelper.GetProperty(rolesList, role.Key), a => PropertyHelper.SetProperty(rolesList, role.Key, !PropertyHelper.GetProperty(rolesList, role.Key)), roleToggles); } Utils.AddButton("Set Skills", TrainerBehaviour.SetSkillPerEmployee, roleToggles); var specializationsList = PropertyHelper.SpecializationsList; foreach (var specialization in specializationsList) { Utils.AddToggle(specialization.Key, PropertyHelper.GetProperty(specializationsList, specialization.Key), a => PropertyHelper.SetProperty(specializationsList, specialization.Key, !PropertyHelper.GetProperty(specializationsList, specialization.Key)), specializationToggles); } Utils.CreateGameObjects(Constants.FIRST_COLUMN, 1, roleToggles.ToArray(), Window); Utils.CreateGameObjects(Constants.SECOND_COLUMN, 1, specializationToggles.ToArray(), Window); int[] columnsCount = new int[] { roleToggles.Count(), specializationToggles.Count() }; Utils.SetWindowSize(columnsCount, Constants.X_EMPLOYEESKILLCHANGE_WINDOW, Constants.Y_EMPLOYEESKILLCHANGE_WINDOW_OFFSET, Window); }
public override bool OnMessage(GUIMessage message) { switch (message.Message) { case GUIMessage.MessageType.GUI_MSG_WINDOW_DEINIT: { GUIMessage msg = new GUIMessage(GUIMessage.MessageType.GUI_MSG_WINDOW_DEINIT, GetID, 0, 0, 0, 0, null); //g_application.m_guiWindowOSD.OnMessage(msg); // Send an init msg to the OSD GUIGraphicsContext.Save(); GUIGraphicsContext.Calibrating = false; // reset our screen resolution to what it was initially //GUIGraphicsContext.SetGUIResolution(g_stSettings.m_ScreenResolution); // Inform the player so we can update the resolution //if (g_application.m_pPlayer) // g_application.m_pPlayer.Update(); } break; case GUIMessage.MessageType.GUI_MSG_WINDOW_INIT: { base.OnMessage(message); m_iControl = (int)Controls.CONTROL_TOP_LEFT; m_iSpeed = 1; m_iCountU = 0; m_iCountD = 0; m_iCountL = 0; m_iCountR = 0; GUIGraphicsContext.Calibrating = true; // Inform the player so we can update the resolution // disable the UI calibration for our controls... GUIImage pControl = (GUIImage)GetControl((int)Controls.CONTROL_BOTTOM_RIGHT); if (null != pControl) { pControl.CalibrationEnabled = false; pControl = (GUIImage)GetControl((int)Controls.CONTROL_TOP_LEFT); pControl.CalibrationEnabled = false; pControl = (GUIImage)GetControl((int)Controls.CONTROL_SUBTITLES); pControl.CalibrationEnabled = false; pControl = (GUIImage)GetControl((int)Controls.CONTROL_PIXEL_RATIO); pControl.CalibrationEnabled = false; pControl = (GUIImage)GetControl((int)Controls.CONTROL_OSD); pControl.CalibrationEnabled = false; m_fPixelRatioBoxHeight = (float)pControl.Height; } GUIMessage msg = new GUIMessage(GUIMessage.MessageType.GUI_MSG_WINDOW_INIT, GetID, 0, 0, 0, 0, null); GUIWindow window = GUIWindowManager.GetWindow((int)Window.WINDOW_OSD); window.OnMessage(msg); // Send an init msg to the OSD return(true); } } return(base.OnMessage(message)); }
void OnWindow(int windowId) { if (visible) { //I'm sad that this might be obsolete once 1.1 hits, but hey, I need it for now... GUILayout.BeginHorizontal(GUILayout.Width(GUIWindowWidth)); if(GUILayout.Button("Options")) { Window = GUIWindow.OPTIONS; } else if (GUILayout.Button("Collision")) { Window = GUIWindow.COLLISION; } else if (GUILayout.Button("Resources")) { Window = GUIWindow.RESOURCE; } GUILayout.EndHorizontal(); ShowCurrentGUI(); GUI.DragWindow(); } }
static bool device_OnEvent(Event evnt) { if (evnt.Type == EventType.Mouse && evnt.Mouse.Type == MouseEventType.Move) { Vector2Di m = new Vector2Di(evnt.Mouse.X, evnt.Mouse.Y); Line3Df l = device.SceneManager.SceneCollisionManager.GetRayFromScreenCoordinates(m); Plane3Df p = new Plane3Df(new Vector3Df(0, 0, 0), new Vector3Df(100, 0, 0), new Vector3Df(0, 0, 100)); Vector3Df i; if (p.GetIntersectionWithLimitedLine(l.Start, l.End, out i)) { camera.Target = game.CenterOfTheBoard + new Vector3Df( (m.Y - device.VideoDriver.ScreenSize.Height / 2) / 100.0f, 0, (m.X - device.VideoDriver.ScreenSize.Width / 2) / 100.0f); i.Y += 25; // we want light to be a little bit above light.Position = i; } } if (window == null && evnt.Type == EventType.Mouse && (evnt.Mouse.Type == MouseEventType.LeftDown || evnt.Mouse.Type == MouseEventType.RightDown)) { text.Visible = false; // if user started to play - remove the gui text game.MouseClick(evnt.Mouse.X, evnt.Mouse.Y, evnt.Mouse.Type == MouseEventType.RightDown); if (game.StateOfTheGame != Game.State.Playing) { text.Visible = true; text.Text = game.StateOfTheGame == Game.State.Won ? TextWon : TextLost; } return true; } if (evnt.Type == EventType.Key && evnt.Key.PressedDown && evnt.Key.Key == KeyCode.Esc) { if (window != null) { window.Remove(); window = null; return true; } GUIEnvironment gui = device.GUIEnvironment; window = gui.AddWindow(new Recti(100, 100, 400, 400), true, "GAME MENU"); gui.AddButton(new Recti(20, 40, window.ClientRect.Width - 20, 60), window, 1510, "NEW GAME 5x5"); gui.AddButton(new Recti(20, 60, window.ClientRect.Width - 20, 80), window, 1520, "NEW GAME 10x10"); gui.AddButton(new Recti(20, 80, window.ClientRect.Width - 20, 100), window, 1530, "NEW GAME 15x15"); gui.AddButton(new Recti(20, 100, window.ClientRect.Width - 20, 120), window, 1540, "NEW GAME 20x20"); gui.AddCheckBox(optionShadows, new Recti(20, 140, window.ClientRect.Width - 20, 160), "SHOW REALTIME SHADOWS", window, 1710); gui.AddCheckBox(optionBackground, new Recti(20, 160, window.ClientRect.Width - 20, 180), "SHOW BACKGROUND", window, 1720); gui.AddCheckBox(optionFPS, new Recti(20, 180, window.ClientRect.Width - 20, 200), "SHOW FPS", window, 1730); gui.AddButton(new Recti(20, 260, window.ClientRect.Width - 20, 280), window, 1590, "EXIT GAME"); return true; } if (window != null && evnt.Type == EventType.GUI) { if (evnt.GUI.Caller == window && evnt.GUI.Type == GUIEventType.ElementClosed) { window.Remove(); window = null; return true; } if (evnt.GUI.Caller.ID == 1510 && evnt.GUI.Type == GUIEventType.ButtonClicked) { window.Remove(); window = null; game.NewGame(5, 5); setupCameraPositionAndTarget(); return true; } if (evnt.GUI.Caller.ID == 1520 && evnt.GUI.Type == GUIEventType.ButtonClicked) { window.Remove(); window = null; game.NewGame(10, 10); setupCameraPositionAndTarget(); return true; } if (evnt.GUI.Caller.ID == 1530 && evnt.GUI.Type == GUIEventType.ButtonClicked) { window.Remove(); window = null; game.NewGame(15, 15); setupCameraPositionAndTarget(); return true; } if (evnt.GUI.Caller.ID == 1540 && evnt.GUI.Type == GUIEventType.ButtonClicked) { window.Remove(); window = null; game.NewGame(20, 20); setupCameraPositionAndTarget(); return true; } if (evnt.GUI.Caller.ID == 1590 && evnt.GUI.Type == GUIEventType.ButtonClicked) { device.Close(); return true; } if (evnt.GUI.Caller.ID == 1710 && evnt.GUI.Type == GUIEventType.CheckBoxChanged) { optionShadows = (evnt.GUI.Caller as GUICheckBox).Checked; light.CastShadows = optionShadows; return true; } if (evnt.GUI.Caller.ID == 1720 && evnt.GUI.Type == GUIEventType.CheckBoxChanged) { optionBackground = (evnt.GUI.Caller as GUICheckBox).Checked; device.SceneManager.GetSceneNodeFromID(7777).Visible = optionBackground; return true; } if (evnt.GUI.Caller.ID == 1730 && evnt.GUI.Type == GUIEventType.CheckBoxChanged) { optionFPS = (evnt.GUI.Caller as GUICheckBox).Checked; return true; } } return false; }
//Updates all the setting classes variables from a DangerAlertGUI's textbox values. public void UpdateFromGui(DangerAlertGUI gui) { MasterToggle = gui.masterToggle; MasterVolume = gui.VolumeSlider; SoundToggle = gui.soundToggle; Window = gui.Window; GUIPosition = gui.GetPosition(); }