protected Base(ControlTypes type, Bind bind, SecurityDefinition security) { this.Type = type; this.Bind = bind; this.Security = security; }
private void AssignValue(string ValueToSet, ControlTypes ControlToAssign) { EnsureChildControls(); string[] strSplit = null; switch (ControlToAssign) { case ControlTypes.Date: if (ValueToSet == "") { txtMonth.Text = ""; txtDay.Text = ""; txtYear.Text = ""; } else { strSplit = ValueToSet.Split(Convert.ToChar(SLASH)); if (strSplit[0].Length == 1) { txtMonth.Text = "0" + strSplit[0]; } else { txtMonth.Text = strSplit[0]; } if (strSplit[1].Length == 1) { txtDay.Text = "0" + strSplit[1]; } else { txtDay.Text = strSplit[1]; } txtYear.Text = strSplit[2]; } break; case ControlTypes.PhoneNumber: if (ValueToSet == "") { txtArea.Text = ""; txtExchange.Text = ""; txtPhone.Text = ""; } else { strSplit = ValueToSet.Split(Convert.ToChar(EIPHEN)); txtArea.Text = strSplit[0]; txtExchange.Text = strSplit[1]; txtPhone.Text = strSplit[2]; } break; case ControlTypes.Zip: if (ValueToSet == "") { txtZip.Text = ""; txtCode.Text = ""; } else { strSplit = ValueToSet.Split(Convert.ToChar(EIPHEN)); txtZip.Text = strSplit[0]; txtCode.Text = strSplit[1]; } break; case ControlTypes.Email: if (ValueToSet == "") { txtEmail.Text = ""; } else { txtEmail.Text = ValueToSet; } break; case ControlTypes.Time: if (ValueToSet == "") { txtHour.Text = ""; txtMinute.Text = ""; cbTime.SelectedIndex = 0; } else { strSplit = ValueToSet.Split(Convert.ToChar(COLON)); if (txtHour != null) { txtHour.Text = strSplit[0]; txtMinute.Text = strSplit[1].Split(' ')[0]; if (strSplit[1].Split(' ')[1] == "AM") { cbTime.SelectedIndex = 0; } else if (strSplit[1].Split(' ')[1] == "PM") { cbTime.SelectedIndex = 1; } } } break; case ControlTypes.SSN: if (ValueToSet == "") { txtssnArea.Text = ""; txtGroup.Text = ""; txtSerial.Text = ""; } else { strSplit = ValueToSet.Split(Convert.ToChar(EIPHEN)); txtssnArea.Text = strSplit[0]; txtGroup.Text = strSplit[1]; txtSerial.Text = strSplit[2]; } break; } }
public virtual bool DetectInputFor(ControlTypes type) { return(false); }
private static void Lock(bool activate, ControlTypes Ctrl) { if (HighLogic.LoadedSceneIsEditor) { if (activate) { EditorLogic.fetch.Lock(true, true, true, "EditorLock" + MOD); } else { EditorLogic.fetch.Unlock ("EditorLock" + MOD); } } if (activate) { InputLockManager.SetControlLock (Ctrl, "Lock" + MOD); } else { InputLockManager.RemoveControlLock ("Lock" + MOD); } if (InputLockManager.GetControlLock ("Lock" + MOD) != ControlTypes.None) { InputLockManager.RemoveControlLock ("Lock" + MOD); } if (InputLockManager.GetControlLock ("EditorLock" + MOD) != ControlTypes.None) { InputLockManager.RemoveControlLock ("EditorLock" + MOD); } }
public static extern bool IsUnlocked(ControlTypes controlType);
/// <summary> /// Locks a set of controls. /// </summary> /// <param name="locks">Which controls to lock. You can OR several ControlTypes together to lock several types of controls at once.</param> /// <param name="lockID">A unique string ID that you will pass to RemoveControlLock to unlock these controls.</param> /// <returns>?</returns> public static extern ControlTypes SetControlLock(ControlTypes locks, string lockID);
public override bool DetectInputFor(ControlTypes type) { return(true); }
private static HtmlBuilder SwitchField( this HtmlBuilder hb, Column column, Permissions.ColumnPermissionTypes columnPermissionType, string controlId, string fieldCss, string labelCss, string controlContainerCss, string controlCss, ControlTypes controlType, string value, Dictionary <string, ControlData> optionCollection, bool preview) { var required = column.Required || (column.ValidateRequired ?? false); if (preview) { required = false; column.ValidateNumber = false; column.ValidateDate = false; column.ValidateEmail = false; column.ValidateEqualTo = null; column.ValidateMaxLength = 0; } switch (columnPermissionType) { case Permissions.ColumnPermissionTypes.Read: switch (controlType) { case ControlTypes.CheckBox: return(hb.FieldCheckBox( fieldId: controlId + "Field", controlId: controlId, fieldCss: fieldCss, labelCss: labelCss, controlContainerCss: controlContainerCss, controlCss: controlCss, labelText: column.LabelText, _checked: value.ToBool(), disabled: true)); default: return(hb.FieldText( fieldId: controlId + "Field", controlId: controlId, fieldCss: fieldCss, labelCss: labelCss, controlContainerCss: controlContainerCss, controlCss: controlCss, labelText: column.LabelText, text: column.HasChoices() && optionCollection.ContainsKey(value) ? optionCollection[value].Text : value)); } case Permissions.ColumnPermissionTypes.Update: switch (controlType) { case ControlTypes.DropDown: return(hb.FieldDropDown( fieldId: controlId + "Field", controlId: controlId, fieldCss: fieldCss, labelCss: labelCss, controlContainerCss: controlContainerCss, controlCss: controlCss + (required ? " always-send" : string.Empty) + (column.UseSearch == true ? " search" : string.Empty), labelText: column.LabelText, optionCollection: optionCollection, selectedValue: value, insertBlank: !required && column.UseSearch != true, column: column)); case ControlTypes.Text: return(hb.FieldText( fieldId: controlId + "Field", controlId: controlId, fieldCss: fieldCss, labelCss: labelCss, controlContainerCss: controlContainerCss, controlCss: controlCss, labelText: column.LabelText, text: value)); case ControlTypes.TextBoxMultiLine: return(hb.FieldTextBox( textType: HtmlTypes.TextTypes.MultiLine, fieldId: controlId + "Field", controlId: controlId, fieldCss: fieldCss, labelCss: labelCss, controlContainerCss: controlContainerCss, controlCss: controlCss, labelText: column.LabelText, text: value, validateRequired: required, validateNumber: column.ValidateNumber ?? false, validateDate: column.ValidateDate ?? false, validateEmail: column.ValidateEmail ?? false, validateEqualTo: column.ValidateEqualTo, validateMaxLength: column.ValidateMaxLength ?? 0)); case ControlTypes.MarkDown: return(hb.FieldMarkDown( fieldId: controlId + "Field", controlId: controlId, fieldCss: fieldCss, labelCss: labelCss, controlContainerCss: controlContainerCss, controlCss: controlCss, labelText: column.LabelText, text: value, placeholder: column.LabelText, readOnly: column.EditorReadOnly.ToBool(), validateRequired: required, preview: preview)); case ControlTypes.TextBox: return(hb.FieldTextBox( textType: column.Hash ? HtmlTypes.TextTypes.Password : HtmlTypes.TextTypes.Normal, fieldId: controlId + "Field", controlId: controlId, fieldCss: fieldCss, labelCss: labelCss, controlContainerCss: controlContainerCss, controlCss: controlCss, labelText: column.LabelText, text: value, validateRequired: required, validateNumber: column.ValidateNumber ?? false, validateDate: column.ValidateDate ?? false, validateEmail: column.ValidateEmail ?? false, validateEqualTo: column.ValidateEqualTo, validateMaxLength: column.ValidateMaxLength ?? 0)); case ControlTypes.TextBoxNumeric: return(hb.FieldTextBox( textType: HtmlTypes.TextTypes.Normal, fieldId: controlId + "Field", controlId: controlId, fieldCss: fieldCss, labelCss: labelCss, controlContainerCss: controlContainerCss, controlCss: controlCss, labelText: column.LabelText, text: value, unit: column.Unit, validateRequired: required, validateNumber: column.ValidateNumber ?? false, validateMinNumber: !preview ? column.MinNumber() : 0, validateMaxNumber: !preview ? column.MaxNumber() : 0, validateDate: column.ValidateDate ?? false, validateEmail: column.ValidateEmail ?? false, validateEqualTo: column.ValidateEqualTo, validateMaxLength: column.ValidateMaxLength ?? 0)); case ControlTypes.TextBoxDateTime: return(hb.FieldTextBox( textType: HtmlTypes.TextTypes.DateTime, fieldId: controlId + "Field", controlId: controlId, fieldCss: fieldCss, labelCss: labelCss, controlContainerCss: controlContainerCss, controlCss: controlCss, labelText: column.LabelText, text: value, format: column.DateTimeFormat(), timepiker: column.DateTimepicker(), validateRequired: required, validateNumber: column.ValidateNumber ?? false, validateDate: column.ValidateDate ?? false, validateEmail: column.ValidateEmail ?? false, validateEqualTo: column.ValidateEqualTo, validateMaxLength: column.ValidateMaxLength ?? 0)); case ControlTypes.CheckBox: return(hb.FieldCheckBox( fieldId: controlId + "Field", controlId: controlId, fieldCss: fieldCss, labelCss: labelCss, controlContainerCss: controlContainerCss, controlCss: controlCss, labelText: column.LabelText, _checked: value.ToBool(), disabled: column.EditorReadOnly.ToBool())); case ControlTypes.Slider: return(hb.FieldSlider( fieldId: controlId + "Field", controlId: controlId, fieldCss: fieldCss, labelCss: labelCss, controlContainerCss: controlContainerCss, controlCss: controlCss, labelText: column.LabelText, value: value.ToDecimal(), min: column.Min.ToDecimal(), max: column.Max.ToDecimal(), step: column.Step.ToDecimal(), unit: column.Unit)); case ControlTypes.Spinner: return(hb.FieldSpinner( fieldId: controlId + "Field", controlId: controlId, fieldCss: fieldCss, labelCss: labelCss, controlContainerCss: controlContainerCss, controlCss: controlCss, labelText: column.LabelText, value: value.ToDecimal(), min: column.Min.ToDecimal(), max: column.Max.ToDecimal(), step: column.Step.ToDecimal(), width: 50, unit: column.Unit)); default: return(hb); } default: return(hb); } }
public InputControl this[ControlTypes control] { get { return(_inputs[control]); } }
private static bool InspectControlType(ControlTypes ctrlType) { Console.WriteLine("Hello You choose to end this program.Do you really want to close? :" + ctrlType.ToString()); Console.ReadLine(); return(true); }
public IBase Select(string controlId) { if (string.IsNullOrEmpty(controlId)) { return(new Unknown()); } XPathNavigator xPathControlNav = this._XPathNavigator.SelectSingleNode($"/Controls/Control[@id='{controlId}']"); if (xPathControlNav == null) { return(new Unknown()); } ControlTypes type = ControlManager.ReadType(xPathControlNav.Clone()); if (type == ControlTypes.Unknown) { return(new Unknown()); } Bind bind = ControlManager.ReadBind(xPathControlNav.Clone()); SecurityDefinition security = ControlManager.ReadSecurityDefinition(xPathControlNav.Clone()); switch (type) { case ControlTypes.ConditionalStatement: return(new ConditionalStatement(bind, security)); case ControlTypes.DataList: return(new DataList(bind, security)); case ControlTypes.VariableBlock: return(new VariableBlock(bind, security)); case ControlTypes.Button: return(new Button(bind, security, ControlManager.ReadValue(xPathControlNav.Clone(), "text"), ControlManager.ReadUpdates(xPathControlNav.Clone()), ControlManager.ReadAttributes(xPathControlNav.Clone()))); case ControlTypes.Checkbox: return(new Checkbox(bind, security, ControlManager.ReadValue(xPathControlNav.Clone(), "text"), ControlManager.ReadUpdates(xPathControlNav.Clone()), ControlManager.ReadAttributes(xPathControlNav.Clone()))); case ControlTypes.RadioButton: return(new RadioButton(bind, security, ControlManager.ReadValue(xPathControlNav.Clone(), "text"), ControlManager.ReadUpdates(xPathControlNav.Clone()), ControlManager.ReadAttributes(xPathControlNav.Clone()))); case ControlTypes.ImageButton: return(new ImageButton(bind, security, ControlManager.ReadValue(xPathControlNav.Clone(), "source"), ControlManager.ReadUpdates(xPathControlNav.Clone()), ControlManager.ReadAttributes(xPathControlNav.Clone()))); case ControlTypes.LinkButton: return(new LinkButton(bind, security, ControlManager.ReadValue(xPathControlNav.Clone(), "text"), ControlManager.ReadValue(xPathControlNav.Clone(), "url"), ControlManager.ReadUpdates(xPathControlNav.Clone()), ControlManager.ReadAttributes(xPathControlNav.Clone()))); case ControlTypes.Textbox: return(new Textbox(bind, security, ControlManager.ReadValue(xPathControlNav.Clone(), "text"), ControlManager.ReadValue(xPathControlNav.Clone(), "defaultbuttonid"), ControlManager.ReadUpdates(xPathControlNav.Clone()), ControlManager.ReadAttributes(xPathControlNav.Clone()))); case ControlTypes.Password: return(new Password(bind, security, ControlManager.ReadValue(xPathControlNav.Clone(), "text"), ControlManager.ReadValue(xPathControlNav.Clone(), "defaultbuttonid"), ControlManager.ReadUpdates(xPathControlNav.Clone()), ControlManager.ReadAttributes(xPathControlNav.Clone()))); case ControlTypes.Textarea: return(new Textarea(bind, security, ControlManager.ReadValue(xPathControlNav.Clone(), "content"), ControlManager.ReadAttributes(xPathControlNav.Clone()))); } return(new Unknown()); }
void SetState(FishingState newState) { Debug.Log("set fishing state to " + newState); // Remove any looping clips loopingClipName = null; // Enable/disable stuff if (newState == FishingState.StartFishing) { // Set control locks ControlTypes locks = ControlTypes.All ^ ControlTypes.QUICKLOAD; InputLockManager.SetControlLock(locks, "Fishing"); // Hide navball navballToggled = NavBallToggle.Instance.panel.expanded; if (navballToggled) { NavBallToggle.Instance.panel.Collapse(); } } // Undo what we did else if (newState == FishingState.NotFishing) { // Clear the locks InputLockManager.RemoveControlLock("Fishing"); // Restore navball if (navballToggled && NavBallToggle.Instance != null) { NavBallToggle.Instance.panel.Expand(); } // Remove the fishing pole Destroy(fishingPole); if (evaVessel != null) { // Set the animation back to the idle one KerbalEVA eva = evaVessel.GetComponent <KerbalEVA>(); animation.Stop(); animation.Play(eva.Animations.idle.animationName); // Update the fishing module record ModuleFishing mFishing = evaVessel.GetComponent <ModuleFishing>(); if (mFishing != null) { mFishing.fishRecord = fishingData.BiggestFish(evaVessel.mainBody); mFishing.fishCount = fishingData.FishCount(evaVessel.mainBody); } } } // Calculate the camera start position if (newState == FishingState.StartFishing) { Vector3 cameraRelPos = FlightCamera.fetch.transform.position - evaVessel.transform.position; Vector3 projection = Vector3.ProjectOnPlane(cameraRelPos, evaVessel.transform.up); startAngle = (float)Math.Acos(Vector3.Dot(projection.normalized, evaVessel.transform.forward)); startHeight = Vector3.Dot(cameraRelPos, evaVessel.transform.up); double x = Vector3.Dot(cameraRelPos, evaVessel.transform.right); double y = Vector3.Dot(cameraRelPos, evaVessel.transform.forward); startDist = (float)Math.Sqrt(x * x + y * y); cameraZoomTime = defaultCameraZoomTime; if (Math.Abs(startAngle - cameraAngle) / minAngularVelocity < cameraZoomTime) { cameraZoomTime = Math.Abs(startAngle - cameraAngle) / minAngularVelocity; } if (cameraZoomTime != defaultCameraZoomTime && Math.Abs(startHeight - cameraHeight) / maxZoomVelocity > cameraZoomTime) { cameraZoomTime = Math.Min(defaultCameraZoomTime, Math.Abs(startHeight - cameraHeight) / maxZoomVelocity); } if (cameraZoomTime != defaultCameraZoomTime && Math.Abs(startDist - cameraDist) / maxZoomVelocity > cameraZoomTime) { cameraZoomTime = Math.Min(defaultCameraZoomTime, Math.Abs(startDist - cameraDist) / maxZoomVelocity); } } // Play the idle animation if (newState == FishingState.Idle) { KerbalEVA eva = evaVessel.GetComponent <KerbalEVA>(); animation.Stop(); animation.Play(eva.Animations.idle.animationName); } // Play the casting animation else if (newState == FishingState.Casting) { // Set the casting animation animation.Stop(); animation.Play("fishingCasting"); // Start at the zero distance when casting bobDistance = 0.0f; } // Reeling animation else if (newState == FishingState.Reeling) { // Set the casting animation loopingClipStart = Time.time; loopingClipTime = 4.0f; loopingClipName = "fishingReeling"; animation.Stop(); } // Hooked animation else if (newState == FishingState.Hooked) { animation.Stop(); } else if (newState == FishingState.Caught) { animation.Stop(); animation.Play("fishingCaught"); } // Decide if a fish will be caught on this cast, and when if (newState == FishingState.Reeling) { double catchChance = (SportsScenario.Instance.failedAttempts + 1) / 5.0; if (catchChance >= 1.0 || rand.NextDouble() < catchChance) { fishHookDistance = (float)rand.NextDouble() * 0.55f + 0.25f; } else { fishHookDistance = -1.0f; } } // Center the rod when we hook a fish if (newState == FishingState.Hooked) { rodPosition = 0.5f; rodLeeway = 0.0f; fishHookDistance = -1.0f; } // Caught a fish, record it if (newState == FishingState.Caught) { fishingData.CaughtFish(evaVessel.mainBody, currentFish); fishingData.IncreaseSkill(caughtSkillIncrease); } stateStartTime = Time.fixedTime; lCtrlTime = rCtrlTime = 0.0; fishingState = newState; }
private void drawTextArea(IRCChatWindow parent) { GUILayout.BeginVertical(); GUILayout.TextField(topic ?? "", (bufferWidth > 0) ? new GUILayoutOption[] { GUILayout.ExpandWidth(false), GUILayout.Width(bufferWidth), GUILayout.MaxWidth(bufferWidth) } : new GUILayoutOption[] { GUILayout.ExpandWidth(false), GUILayout.Width(10), GUILayout.MaxWidth(10) }); drawBuffer(); GUILayout.BeginHorizontal(); GUILayout.Label(config.nick, GUILayout.ExpandWidth(false)); if (Event.current.type == EventType.Repaint) { nicknameWidth = GUILayoutUtility.GetLastRect().width; } GUI.SetNextControlName(INPUT_CONTROL_NAME); inputText = GUILayout.TextField(inputText, ((bufferWidth > 0) && (nicknameWidth > 0)) ? new GUILayoutOption[] { GUILayout.ExpandWidth(false), GUILayout.Width(bufferWidth - nicknameWidth - GUI.skin.label.margin.right), GUILayout.MaxWidth(bufferWidth - nicknameWidth - GUI.skin.label.margin.right) } : new GUILayoutOption[] { GUILayout.ExpandWidth(false), GUILayout.Width(10), GUILayout.MaxWidth(10) }); if (Event.current.type == EventType.Repaint) { inputTextRect = GUILayoutUtility.GetLastRect(); inputTextRectValid = true; } if (inputTextRectValid && inputTextRect.Contains(Event.current.mousePosition)) { // mouse is within the input text box if (inputLocks != ControlTypes.All) { inputLocks = InputLockManager.SetControlLock("kspirc"); } if (textInputNeedsSelectionClearing == true) { TextEditor te = (TextEditor)GUIUtility.GetStateObject(typeof(TextEditor), GUIUtility.keyboardControl); if (te != null) { string selection = te.SelectedText; te.MoveTextEnd(); te.SelectNone(); textInputNeedsSelectionClearing = false; } } if (GUI.GetNameOfFocusedControl() != ChannelGUI.INPUT_CONTROL_NAME) { GUI.FocusControl(INPUT_CONTROL_NAME); textInputNeedsSelectionClearing = true; } } else if (inputLocks == ControlTypes.All) { InputLockManager.RemoveControlLock("kspirc"); inputLocks = ControlTypes.None; } GUILayout.EndHorizontal(); GUILayout.EndVertical(); }
public Player Create(PlayerTypes playerType, ControlTypes controlType) { return(new Assassin(playerType, controlType) as Player); }
public InputControl this[ControlTypes i] { get { return null; } }
public InputControl this[ControlTypes i] { get { return(null); } }
static AutomationIdentifierConstants() { if (OSVersionHelper.IsOsWindows10RS2OrGreater) { LastSupportedProperty = Properties.Size; LastSupportedEvent = Events.Changes; LastSupportedPattern = Patterns.CustomNavigation; LastSupportedTextAttribute = TextAttributes.SayAsInterpretAs; LastSupportedControlType = ControlTypes.AppBar; } else if (OSVersionHelper.IsOsWindows10RS1OrGreater) { LastSupportedProperty = Properties.FullDescription; LastSupportedEvent = Events.Changes; LastSupportedPattern = Patterns.CustomNavigation; LastSupportedTextAttribute = TextAttributes.CaretBidiMode; LastSupportedControlType = ControlTypes.AppBar; } else if (OSVersionHelper.IsOsWindows10TH2OrGreater) { LastSupportedProperty = Properties.LocalizedLandmarkType; LastSupportedEvent = Events.TextEdit_ConversionTargetChanged; LastSupportedPattern = Patterns.CustomNavigation; LastSupportedTextAttribute = TextAttributes.CaretBidiMode; LastSupportedControlType = ControlTypes.AppBar; } else if (OSVersionHelper.IsOsWindows10OrGreater) { LastSupportedProperty = Properties.AnnotationObjects; LastSupportedEvent = Events.TextEdit_ConversionTargetChanged; LastSupportedPattern = Patterns.CustomNavigation; LastSupportedTextAttribute = TextAttributes.CaretBidiMode; LastSupportedControlType = ControlTypes.AppBar; } else if (OSVersionHelper.IsOsWindows8Point1OrGreater) { LastSupportedProperty = Properties.IsPeripheral; LastSupportedEvent = Events.TextEdit_ConversionTargetChanged; LastSupportedPattern = Patterns.TextEdit; LastSupportedTextAttribute = TextAttributes.CaretBidiMode; LastSupportedControlType = ControlTypes.AppBar; } else if (OSVersionHelper.IsOsWindows8OrGreater) { LastSupportedProperty = Properties.FlowsFrom; LastSupportedEvent = Events.DropTarget_Dropped; LastSupportedPattern = Patterns.DropTarget; LastSupportedTextAttribute = TextAttributes.CaretBidiMode; LastSupportedControlType = ControlTypes.SemanticZoom; } else if (OSVersionHelper.IsOsWindows7OrGreater || (OSVersionHelper.IsOsWindowsVistaOrGreater && UiaCoreTypesApi.SupportsWin7Identifiers())) { LastSupportedProperty = Properties.IsSynchronizedInputPatternAvailable; LastSupportedEvent = Events.InputDiscarded; LastSupportedPattern = Patterns.SynchronizedInput; LastSupportedTextAttribute = TextAttributes.UnderlineStyle; LastSupportedControlType = ControlTypes.Separator; } else { LastSupportedProperty = Properties.TransformCanRotate; LastSupportedEvent = Events.Window_WindowClosed; LastSupportedPattern = Patterns.ScrollItem; LastSupportedTextAttribute = TextAttributes.UnderlineStyle; LastSupportedControlType = ControlTypes.Separator; } }
public static extern bool IsUnlocked(ControlTypes controlType, ControlTypes refMask);
public InputControl this[ControlTypes control] { get { return _inputs[control]; } }
private static void Lock(bool activate, ControlTypes Ctrl = ControlTypes.None) { if (HighLogic.LoadedSceneIsEditor) { if (activate) { EditorLogic.fetch.Lock (true, true, true, "Lock" + QuickScroll.MOD); } else { EditorLogic.fetch.Unlock ("Lock" + QuickScroll.MOD); } } if (!activate) { InputLockManager.RemoveControlLock ("Lock" + QuickScroll.MOD); } }