public frmMain() { InitializeComponent(); _controler = new MachinaStateControler(); _mode = ScreenModes.Stateless; this.btnAdd.Tag = btnQuit.Tag = ScreenModes.Selection | ScreenModes.Stateless; this.btnValidate.Tag = btnCancel.Tag = ScreenModes.Addition | ScreenModes.Modification; this.btnDel.Tag = ScreenModes.Selection; this.btnQuit.Click += (object sender, EventArgs e) => { this.Close(); }; this.btnAdd.Click += (object sender, EventArgs e) => { _Mode = ScreenModes.Addition; }; this.btnValidate.Click += (object sender, EventArgs e) => { _validate(); }; this.btnCancel.Click += (object sender, EventArgs e) => { _setModeStatelessOrSelection(); }; this.btnDel.Click += (object sender, EventArgs e) => { _delete(); }; this.txtString.Tag = ScreenModes.Selection | ScreenModes.Addition | ScreenModes.Modification; this.txtString.GotFocus += (object sender, EventArgs e) => { if (_Mode != ScreenModes.Addition) _Mode = ScreenModes.Modification; }; _setModeStatelessOrSelection(); }
private void _validate() { if (_Mode == ScreenModes.Creation) { try { EmployeeController.Instance.addEmployee( this.txtSurname.Text, this.txtFirstname.Text, this.dtDOB.Value, this.dtEmployedAt.Value, (int)this.nudSalary.Value, (Service)this.lblServiceValue.Tag, (Employee)this.cmbChief.SelectedValue ); } catch (Exception ex) { if (ex.Message.ToLower().Contains("code")) { } else if (ex.Message.ToLower().Contains("label")) { } return; } } else { Employee updatingEmployee = _selectedEmployee; try { EmployeeController.Instance.updateEmployee( updatingEmployee, this.txtSurname.Text, this.txtFirstname.Text, this.dtDOB.Value, this.dtEmployedAt.Value, (int)this.nudSalary.Value, (Service)this.lblServiceValue.Tag, (Employee)this.cmbChief.SelectedValue); } catch (Exception ex) { MessageBox.Show(ex.Message); return; } } _Mode = ScreenModes.Selection; }
private void _setStatelessOrSelection() { if (EmployeeController.Instance.Employees.Count > 0) { _Mode = ScreenModes.Selection; } else _Mode = ScreenModes.Stateless; }
private void _validate() { this.ep.SetError(this.txtLabel, ""); if (_Mode == ScreenModes.Creation) { try { _selectedService = ServiceController.Instance.addService(this.txtCode.Text, this.txtLabel.Text); } catch (Exception ex) { if (ex.Message.ToLower().Contains("code")) { this.txtCode.Focus(); } else if (ex.Message.ToLower().Contains("label")) { this.txtLabel.Focus(); } this.ep.SetError(this.txtLabel, ex.Message); return; } this.lstService.Items.Insert(0, _selectedService); this.lstService.SelectedItem = _selectedService; } else { Service updatingService = _selectedService; try { ServiceController.Instance.updateService(updatingService, this.txtCode.Text, this.txtLabel.Text); } catch (Exception ex) { if (ex.Message.ToLower().Contains("code")) { this.txtCode.Focus(); } else if (ex.Message.ToLower().Contains("label")) { this.txtLabel.Focus(); } this.ep.SetError(this.txtLabel, ex.Message); return; } int pos = this.lstService.SelectedIndex; this.lstService.Items.RemoveAt(pos); this.lstService.Items.Insert(ServiceController.Instance.Services.BinarySearch(_selectedService), updatingService); this.lstService.SelectedItem = updatingService; } _Mode = ScreenModes.Selection; }
private void _setStatelessOrSelection() { if (ServiceController.Instance.Services.Count > 0) _Mode = ScreenModes.Selection; else _Mode = ScreenModes.Stateless; }
private void _setModeStatelessOrSelection() { if (this._controler.Strings.Count > 0) _Mode = ScreenModes.Selection; else _Mode = ScreenModes.Stateless; }
public static void LoadVideoCutScene(string VideoAssetName, bool LoopScene, int ResolutionX, int ResolutionY, ScreenModes ResolutionMode) { string VideoToLoad = Velotage3DGameEngine.EngineInfo.EngineInfo.GetGameDataFolder() + "Videos/" + VideoAssetName; int ResolutionXViewPort = 800; int ResolutionYViewPort = 600; if (File.Exists(VideoToLoad)) { switch (ResolutionMode) { case ScreenModes.fullscreen: { ResolutionXViewPort = Velotage3DGameEngine.VideoManager.SceneManagerController.GetPrimaryScreenXBound(); ResolutionYViewPort = Velotage3DGameEngine.VideoManager.SceneManagerController.GetPrimaryScreenYBound(); break; } case ScreenModes.windowed: { ResolutionXViewPort = ResolutionX; ResolutionYViewPort = ResolutionY; break; } case ScreenModes.windowless: { ResolutionXViewPort = ResolutionX; ResolutionYViewPort = ResolutionY; break; } default: { Velotage3DGameEngine.ExceptionManager.GetException.Exception(ExceptionManager.ErrorList.UknownVideoMode); break; } } } else { Velotage3DGameEngine.ExceptionManager.GetException.Exception(ExceptionManager.ErrorList.ErrorLoadingToRam); } }
public static void ReadVideoComponent(string VideoFile, bool loopscene, int ResX, int ResY, ScreenModes FormMode, Form FormName) { switch (FormMode) { case ScreenModes.fullscreen: break; case ScreenModes.windowed: break; case ScreenModes.windowless: break; default: ExceptionManager.GetException.Exception(ExceptionManager.ErrorList.UknownVideoMode); break; } FormName.FormBorderStyle = (FormBorderStyle)FormMode; FormName.Width = ResX; FormName.Height = ResY; FormName.Show(); }
private void OnGUI() { if (videoGlitches.Count == 0) { return; } if (effectNameStyle == null) { effectNameStyle = new GUIStyle(GUI.skin.textArea); effectNameStyle.alignment = TextAnchor.MiddleCenter; effectNameStyle.fontSize = 22; } if (boxStyle == null) { boxStyle = new GUIStyle(GUI.skin.box); boxStyle.normal.background = MakeTex(2, 2, new Color(0.5f, 0.5f, 0.5f, 0.5f)); boxStyle.focused.textColor = Color.red; } if (menuStyle == null) { menuStyle = new GUIStyle(GUI.skin.textArea); menuStyle.alignment = TextAnchor.MiddleCenter; menuStyle.fontSize = 22; } if (showEffectName == true && guiShow == false) { string effectName = EffectName(videoGlitches[guiSelection].GetType().ToString()); GUILayout.BeginArea(new Rect(Screen.width * 0.5f - 150.0f, 20.0f, 300.0f, 30.0f), effectName.ToUpper(), effectNameStyle); GUILayout.EndArea(); } if (guiShow == false) { return; } GUILayout.BeginHorizontal(boxStyle, GUILayout.Width(Screen.width)); { GUILayout.Space(guiMargen); if (GUILayout.Button("MENU", menuStyle, GUILayout.Width(80.0f)) == true) { menuOpen = !menuOpen; } GUILayout.FlexibleSpace(); if (GUILayout.Button("<<<", menuStyle) == true) { showCustomProperties = false; slideEffectTime = 0.0f; if (guiSelection > 0) { guiSelection--; } else { guiSelection = videoGlitches.Count - 1; } Event.current.Use(); } GUI.contentColor = Color.white; string effectName = EffectName(videoGlitches[guiSelection].GetType().ToString()); GUILayout.Label(effectName.ToUpper(), menuStyle, GUILayout.Width(325.0f)); if (GUILayout.Button(">>>", menuStyle) == true) { showCustomProperties = false; slideEffectTime = 0.0f; if (guiSelection < videoGlitches.Count - 1) { guiSelection++; } else { guiSelection = 0; } } GUILayout.FlexibleSpace(); if (musicClip != null && GUILayout.Button(@"MUTE", menuStyle) == true) { AudioListener.volume = 1.0f - AudioListener.volume; } if (fps < 24.0f) { GUI.contentColor = Color.yellow; } else if (fps < 15.0f) { GUI.contentColor = Color.red; } else { GUI.contentColor = Color.green; } GUILayout.Label(fps.ToString("000"), menuStyle, GUILayout.Width(50.0f)); GUI.contentColor = Color.white; GUILayout.Space(guiMargen); } GUILayout.EndHorizontal(); // Update for (int i = 0; i < videoGlitches.Count; ++i) { VideoGlitchBase imageEffect = videoGlitches[i]; if (guiSelection == i && imageEffect.enabled == false) { showCustomProperties = false; EnableEffect(imageEffect, true); } if (imageEffect.enabled == true && guiSelection != i) { imageEffect.enabled = false; } } if (menuOpen == true) { GUILayout.BeginVertical(boxStyle, GUILayout.Height(Screen.height), GUILayout.Width(guiWidth)); { GUILayout.Space(guiMargen); int newScreenMode = GUILayout.Toolbar((int)screenMode, new string[] { @"Full screen", @"Layers" }); if (newScreenMode != (int)screenMode) { screenMode = (ScreenModes)newScreenMode; videoGlitches[guiSelection].EffectMode = screenMode == ScreenModes.Fullscreen ? EffectModes.Screen : EffectModes.Layer; } GUILayout.Space(guiMargen); // Video Glitches. if (videoGlitches.Count > 0) { scrollPosition = GUILayout.BeginScrollView(scrollPosition, "box"); { int effectChanged = -1; // Draw. for (int i = 0; i < videoGlitches.Count; ++i) { VideoGlitchBase imageEffect = videoGlitches[i]; GUILayout.BeginVertical(imageEffect.enabled == true ? @"box" : string.Empty); { GUILayout.BeginHorizontal(); { bool enableChanged = GUILayout.Toggle(imageEffect.enabled, guiTab + EffectName(imageEffect.GetType().ToString())); if (enableChanged != imageEffect.enabled) { showCustomProperties = false; slideEffectTime = 0.0f; effectChanged = i; } if (CustomAttributesCount(imageEffect) > 0) { GUILayout.FlexibleSpace(); if (imageEffect.enabled == true && GUILayout.Button(showCustomProperties == true ? @"-" : @"+") == true) { slideEffectTime = 0.0f; showCustomProperties = !showCustomProperties; } } } GUILayout.EndHorizontal(); if (imageEffect.enabled == true && showCustomProperties == true) { DrawCustomAttributes(imageEffect); } } GUILayout.EndVertical(); GUILayout.Space(guiMargen * 0.5f); } // Update for (int i = 0; i < videoGlitches.Count; ++i) { VideoGlitchBase imageEffect = videoGlitches[i]; if (effectChanged == i) { EnableEffect(imageEffect, !imageEffect.enabled); if (imageEffect.enabled == true) { guiSelection = i; } } if (imageEffect.enabled == true && guiSelection != i) { imageEffect.enabled = false; } } } GUILayout.EndScrollView(); } else { GUILayout.Label("No 'Video Glitches' found."); } GUILayout.FlexibleSpace(); GUILayout.BeginVertical("box"); { GUILayout.Label("TAB - Hide/Show gui."); GUILayout.Label("PageUp/Down - Change effects."); } GUILayout.EndVertical(); GUILayout.Space(guiMargen); if (GUILayout.Button(@"Open Web") == true) { Application.OpenURL(@"http://www.ibuprogames.com/2015/07/02/video-glitches/"); } GUILayout.Space(guiMargen); } GUILayout.EndVertical(); } }