// Select signal (starts dragging, shows rename field) void SelectSignal(ChipSignal signalToDrag) { // Dragging selectedSignals.Clear(); for (int i = 0; i < signals.Count; i++) { if (signals[i] == signalToDrag || ChipSignal.InSameGroup(signals[i], signalToDrag)) { selectedSignals.Add(signals[i]); } } bool isGroup = selectedSignals.Count > 1; isDragging = true; var wireType = Pin.WireType.Simple; if (selectedSignals[0] is InputSignal) { var signal = selectedSignals[0]; var pin = signal.outputPins[0]; wireType = pin.wireType; } if (selectedSignals[0] is OutputSignal) { var signal = selectedSignals[0]; var pin = signal.inputPins[0]; wireType = pin.wireType; } dragMouseStartY = InputHelper.MouseWorldPos.y; if (selectedSignals.Count % 2 == 0) { int indexA = Mathf.Max(0, selectedSignals.Count / 2 - 1); int indexB = selectedSignals.Count / 2; dragHandleStartY = (selectedSignals[indexA].transform.position.y + selectedSignals[indexB].transform.position.y) / 2f; } else { dragHandleStartY = selectedSignals[selectedSignals.Count / 2].transform.position.y; } // Enable UI: propertiesUI.gameObject.SetActive(true); propertiesUI.sizeDelta = new Vector2(propertiesUI.sizeDelta.x, (isGroup) ? propertiesHeightMinMax.y : propertiesHeightMinMax.x); nameField.text = selectedSignals[0].signalName; nameField.Select(); nameField.caretPosition = nameField.text.Length; twosComplementToggle.gameObject.SetActive(isGroup); twosComplementToggle.isOn = selectedSignals[0].useTwosComplement; modeDropdown.gameObject.SetActive(!isGroup); deleteButton.interactable = ChipSaver.IsSignalSafeToDelete(currentEditorName, signalToDrag.signalName); UpdateUIProperties(); modeDropdown.SetValueWithoutNotify((int)wireType); UpdateUIProperties(); }
/// <summary> /// Add items to the speaker mode settings dropdown and set the default /// </summary> protected void SetUpDisplayModeDropdown() { if (displayModeDropdown) { bool isFullScreen = VideoHelper.isFullscreen(); int selected = isFullScreen ? 1 : 0; List <TMPro.TMP_Dropdown.OptionData> displayDropdownOptions = new List <TMPro.TMP_Dropdown.OptionData>(); displayDropdownOptions.Add(new TMPro.TMP_Dropdown.OptionData("Windowed")); displayDropdownOptions.Add(new TMPro.TMP_Dropdown.OptionData("Fullscreen")); TMPro.TMP_Dropdown dropdown = displayModeDropdown.GetComponent <TMPro.TMP_Dropdown>(); dropdown.options = displayDropdownOptions; dropdown.SetValueWithoutNotify(selected); } }
static int SetValueWithoutNotify(IntPtr L) { try { ToLua.CheckArgsCount(L, 2); TMPro.TMP_Dropdown obj = (TMPro.TMP_Dropdown)ToLua.CheckObject <TMPro.TMP_Dropdown>(L, 1); int arg0 = (int)LuaDLL.luaL_checknumber(L, 2); obj.SetValueWithoutNotify(arg0); return(0); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
/// <summary> /// Add items to the quality settings dropdown and set the default /// </summary> protected void SetUpQualitySettingsDropdown() { if (qualitySettingsDropdown) { qualitySettings = VideoHelper.GetQualityLevels(); int current = VideoHelper.GetCurrentQualityLevel(); List <TMPro.TMP_Dropdown.OptionData> qualityDropdownOptions = new List <TMPro.TMP_Dropdown.OptionData>(); for (int i = 0; i < qualitySettings.Length; i++) { qualityDropdownOptions.Add(new TMPro.TMP_Dropdown.OptionData(qualitySettings[i])); } TMPro.TMP_Dropdown dropdown = qualitySettingsDropdown.GetComponent <TMPro.TMP_Dropdown>(); dropdown.options = qualityDropdownOptions; dropdown.SetValueWithoutNotify(current); } }
private void TestInputUpdate() { List <SquareList.SquareListOptions> l = new List <SquareList.SquareListOptions>(); for (int i = 0; i < smc.stateMachineData.inputs.Count; i++) { l.Add(new SquareList.SquareListOptions(smc.stateMachineData.InputToString(smc.stateMachineData.inputs[i]), i)); } testInputList.SetButtons(l, TestInputListButton); // Highlight if (smc.CurrentInput != -1 && testing && l.Count > 0) { Color c; if (testError) { c = Appdata.errorColor; } else { c = Appdata.highlightColor; } testInputList.buttons[smc.CurrentInput].GetComponentInChildren <UnityEngine.UI.Image>().color = c; } // Add Input Options testInputAddButton.ClearOptions(); // Only not yet added input smc.stateMachineData.inputsData .ForEach(x => testInputAddButton.options.Add(new TMPro.TMP_Dropdown.OptionData(x.name))); // Unity Sucks testInputAddButton.options.Add(new TMPro.TMP_Dropdown.OptionData("Dummy")); testInputAddButton.SetValueWithoutNotify(testInputAddButton.options.Count - 1); testInputAddButton.options.RemoveAt(testInputAddButton.options.Count - 1); if (testing) { testInputList.buttons.ForEach(x => x.GetComponentInChildren <UnityEngine.UI.Button>().enabled = false); ((RectTransform)testInputList.transform).offsetMax = new Vector2(0f, 150f); testInputAddButton.gameObject.SetActive(false); } else { ((RectTransform)testInputList.transform).offsetMax = new Vector2(-150f, 150f); testInputAddButton.gameObject.SetActive(true); } }
/// <summary> /// Add items to the speaker mode settings dropdown and set the default /// </summary> protected void SetUpSpeakerModesDropdown() { if (speakerModesDropdown) { speakerModes = AudioHelper.GetAudioSpeakerModes(); AudioSpeakerMode current = AudioHelper.GetCurrentSpeakerMode(); int selected = 0; List <TMPro.TMP_Dropdown.OptionData> speakerDropdownOptions = new List <TMPro.TMP_Dropdown.OptionData>(); for (int i = 0; i < speakerModes.Count; i++) { speakerDropdownOptions.Add(new TMPro.TMP_Dropdown.OptionData(speakerModes[i].Key)); if (speakerModes[i].Value == current) { selected = i; } } TMPro.TMP_Dropdown dropdown = speakerModesDropdown.GetComponent <TMPro.TMP_Dropdown>(); dropdown.options = speakerDropdownOptions; dropdown.SetValueWithoutNotify(selected); } }
/// <summary> /// Add items to the anti aliasing settings dropdown and set the default /// </summary> protected void SetUpAntiAliasingDropdown() { if (antiAliasingDropdown) { antiAliasingLevels = VideoHelper.GetAntiAliasingLevels(); int current = VideoHelper.GetCurrentAntiAliasingLevel(); int selected = 0; List <TMPro.TMP_Dropdown.OptionData> antiAliasingOptions = new List <TMPro.TMP_Dropdown.OptionData>(); for (int i = 0; i < antiAliasingLevels.Length; i++) { antiAliasingOptions.Add(new TMPro.TMP_Dropdown.OptionData(antiAliasingLevels[i].ToString() + "x")); if (antiAliasingLevels[i] == current) { selected = i; } } TMPro.TMP_Dropdown dropdown = antiAliasingDropdown.GetComponent <TMPro.TMP_Dropdown>(); dropdown.options = antiAliasingOptions; dropdown.SetValueWithoutNotify(current); } }
private void TransitionPopupUpdate() { List <SquareList.SquareListOptions> l = new List <SquareList.SquareListOptions>(); foreach (StateMachineData.Transition item in editedTransition) { l.Add(new SquareList.SquareListOptions(smc.stateMachineData.InputToString(item.input), item)); } l.Sort((x, y) => ((StateMachineData.Transition)x.obj).input - ((StateMachineData.Transition)y.obj).input); transfromList.SetButtons(l, TransitionEditListButton); // Add Input Options transitionAddButton.ClearOptions(); // Only not yet added input smc.stateMachineData.inputsData .FindAll(x => !editedTransition.Exists(y => y.input == x.id)) .ForEach(x => transitionAddButton.options.Add(new TMPro.TMP_Dropdown.OptionData(x.name))); // Unity Sucks transitionAddButton.options.Add(new TMPro.TMP_Dropdown.OptionData("Dummy")); transitionAddButton.SetValueWithoutNotify(transitionAddButton.options.Count - 1); transitionAddButton.options.RemoveAt(transitionAddButton.options.Count - 1); }
public void DeleteCurrentMonth() { dropDownSortedList.Remove(dropdown.captionText.text); ResetDropdown(); dropdown.SetValueWithoutNotify(0); }
// Start is called before the first frame update void Start() { _controller = GetComponent <PreMaid.RemoteController.PreMaidControllerSPUP>(); List <TMP_Dropdown.OptionData> serialPortNamesList = new List <TMP_Dropdown.OptionData>(); var portNames = SerialPortUtility.SerialPortUtilityPro.GetConnectedDeviceList(SerialPortUtility.SerialPortUtilityPro.OpenSystem.BluetoothSSP); if (portNames != null) { foreach (var VARIABLE in portNames) { TMP_Dropdown.OptionData optionData = new TMP_Dropdown.OptionData(VARIABLE.SerialNumber); serialPortNamesList.Add(optionData); Debug.Log(VARIABLE); } _serialPortsDropdown.ClearOptions(); _serialPortsDropdown.AddOptions(serialPortNamesList); } else { // Android実機でのデバッグ用 serialPortNamesList.Add(new TMP_Dropdown.OptionData("RNBT-4FFA")); serialPortNamesList.Add(new TMP_Dropdown.OptionData("RNBT-50D6")); serialPortNamesList.Add(new TMP_Dropdown.OptionData("RNBT-9C50")); serialPortNamesList.Add(new TMP_Dropdown.OptionData("RNBT-94F6")); _serialPortsDropdown.ClearOptions(); _serialPortsDropdown.AddOptions(serialPortNamesList); _serialPortsDropdown.SetValueWithoutNotify(0); } // 上半身だけを操作対象とする _controller.jointMask = (uint)(PreMaidControllerSPUP.JointMask.UpperBody); // 関節速度制限 ModelJoint.SetAllJointsMaxSpeed(90f); //対象のAnimatorにBoneにHumanoidModelJoint.csのアタッチ漏れがあるかもしれない //なので、一旦全部検索して、見つからなかったサーボ情報はspineに全部動的にアタッチする Transform spineBone = target.GetBoneTransform(HumanBodyBones.Spine); //仮でspineにでも付けておこう if (target != null) { var joints = target.GetComponentsInChildren <HumanoidModelJoint>(); foreach (PreMaidServo.ServoPosition item in Enum.GetValues(typeof(PreMaidServo.ServoPosition))) { if (Array.FindIndex(joints, joint => joint.TargetServo == item) == -1) { var jointScript = spineBone.gameObject.AddComponent <HumanoidModelJoint>(); jointScript.TargetServo = item; } } // 手首だけは最高速度を高くしておく var modeljoints = target.GetComponentsInChildren <ModelJoint>(); foreach (ModelJoint j in modeljoints) { if (j.ServoID == "15" || j.ServoID == "17") { j.maxSpeed = 180f; } } } _joints = target.GetComponentsInChildren <HumanoidModelJoint>(); }