void ReleaseDesignerOutlets() { if (CustomDropdown != null) { CustomDropdown.Dispose(); CustomDropdown = null; } if (DelayDropdown != null) { DelayDropdown.Dispose(); DelayDropdown = null; } if (HighlightDropdown != null) { HighlightDropdown.Dispose(); HighlightDropdown = null; } if (FilterDropdown != null) { FilterDropdown.Dispose(); FilterDropdown = null; } }
public override void DidReceiveMemoryWarning() { base.DidReceiveMemoryWarning(); if (acmField != null) { if (acmField.InputView != null) { acmField.InputView.Dispose(); acmField.InputView = null; } if (acmField.InputAccessoryView != null) { acmField.InputAccessoryView.Dispose(); acmField.InputAccessoryView = null; } } foreach (var item in HighlightDropdown.ItemsSource) { ((NSObject)item).Dispose(); } foreach (var item in CustomDropdown.ItemsSource) { ((NSObject)item).Dispose(); } HighlightDropdown.RemoveFromSuperview(); CustomDropdown.RemoveFromSuperview(); FilterDropdown.RemoveFromSuperview(); ReleaseDesignerOutlets(); }
public void ShowFocusConfirmationDialog() { if (RobotsList.Dropdown.dropdownItems.Count == 0 || EndEffectorList.Dropdown.dropdownItems.Count == 0 || OrientationsList.Dropdown.dropdownItems.Count == 0) { Base.Notifications.Instance.ShowNotification("Failed to update orientation.", "Something is not selected"); return; } CustomDropdown robotsListDropdown = RobotsList.Dropdown; CustomDropdown endEffectorDropdown = EndEffectorList.Dropdown; CustomDropdown orientationDropdown = OrientationsList.Dropdown; if (endEffectorDropdown.dropdownItems.Count == 0) { FocusConfirmationDialog.EndEffectorId = ""; } else { FocusConfirmationDialog.EndEffectorId = endEffectorDropdown.selectedText.text; } FocusConfirmationDialog.RobotId = robotsListDropdown.selectedText.text; FocusConfirmationDialog.OrientationId = CurrentActionPoint.GetNamedOrientationByName(orientationDropdown.selectedText.text).Id; FocusConfirmationDialog.OrientationName = orientationDropdown.selectedText.text; FocusConfirmationDialog.UpdatePosition = UpdatePositionToggle.GetComponent <Toggle>().isOn; FocusConfirmationDialog.ActionPointId = CurrentActionPoint.Data.Id; FocusConfirmationDialog.ActionPointName = CurrentActionPoint.Data.Name; FocusConfirmationDialog.Init(); FocusConfirmationDialog.WindowManager.OpenWindow(); }
public void UpdateOrientations() { CustomDropdown orientationDropdown = OrientationsList.Dropdown; orientationDropdown.dropdownItems.Clear(); foreach (IO.Swagger.Model.NamedOrientation orientation in CurrentActionPoint.GetNamedOrientations()) { CustomDropdown.Item item = new CustomDropdown.Item { itemName = orientation.Name }; orientationDropdown.dropdownItems.Add(item); } if (orientationDropdown.dropdownItems.Count == 0) { OrientationsList.gameObject.SetActive(false); NoOrientation.gameObject.SetActive(true); UpdateOrientationBtn.interactable = false; } else { NoOrientation.gameObject.SetActive(false); OrientationsList.gameObject.SetActive(true); orientationDropdown.enabled = true; orientationDropdown.SetupDropdown(); UpdateOrientationBtn.interactable = true; } }
private void UpdateDropdown <T>( List <T> items, CustomDropdown dropdown, ItemNameDelegate <T> itemName, Sprite icon, OnSelectDelegate <T> onSelect, int selectedItemIndex) { List <CustomDropdown.Item> dropdownItems = new List <CustomDropdown.Item>(items.Count); for (int i = 0; i < items.Count; i++) { var currIndex = i; T currItem = (T)items[currIndex]; var onSelectEvent = new UnityEvent(); onSelectEvent.AddListener(() => { onSelect(currItem, currIndex); }); CustomDropdown.Item newItem = new CustomDropdown.Item() { itemName = itemName(currItem, currIndex), itemIcon = icon, OnItemSelection = onSelectEvent, }; dropdownItems.Add(newItem); } dropdown.dropdownItems = dropdownItems; dropdown.selectedItemIndex = selectedItemIndex < dropdownItems.Count ? selectedItemIndex : 0; dropdown.enabled = false; dropdown.enabled = true; }
public async void UpdateMenu() { CustomDropdown robotsListDropdown = RobotsList.Dropdown; robotsListDropdown.dropdownItems.Clear(); await RobotsList.gameObject.GetComponent <DropdownRobots>().Init((string x) => { }, false); ValidateFields(); }
public async void UpdateMenu() { ActionPointName.text = CurrentActionPoint.Data.Name; CustomDropdown positionRobotsListDropdown = PositionRobotsList.Dropdown; positionRobotsListDropdown.dropdownItems.Clear(); await PositionRobotsList.gameObject.GetComponent <DropdownRobots>().Init(OnRobotChanged, true); if (!SceneManager.Instance.SceneStarted || positionRobotsListDropdown.dropdownItems.Count == 0) { PositionRobotsList.gameObject.SetActive(false); PositionEndEffectorList.gameObject.SetActive(false); UpdatePositionUsingRobotBtn.interactable = false; AddOrientationUsingRobotButton.interactable = false; } else { PositionRobotsList.gameObject.SetActive(true); PositionEndEffectorList.gameObject.SetActive(true); UpdatePositionUsingRobotBtn.interactable = true; AddOrientationUsingRobotButton.interactable = true; OnRobotChanged((string)PositionRobotsList.GetValue()); } PositionExpertModeBlock.SetActive(GameManager.Instance.ExpertMode); PositionManualEdit.SetPosition(CurrentActionPoint.Data.Position); JointsRobotsList.Dropdown.dropdownItems.Clear(); await JointsRobotsList.gameObject.GetComponent <DropdownRobots>().Init(UpdateJointsDynamicList, false); if (JointsRobotsList.Dropdown.dropdownItems.Count > 0) { JointsRobotsList.gameObject.SetActive(true); JointsDynamicList.SetActive(true); UpdateJointsDynamicList((string)JointsRobotsList.GetValue()); } else { JointsRobotsList.gameObject.SetActive(false); JointsDynamicList.SetActive(false); } if (SceneManager.Instance.SceneStarted) { AddJointsButton.interactable = true; } else { AddJointsButton.interactable = false; } UpdateOrientationsDynamicList(); UpdateTooltips(); }
void DropdownValueChanged(CustomDropdown dropdown) { //Debug.Log("Dropdown Value Changed : " + dropdown.selectedItemIndex); //for (int i = 0; i < 5; ++i){ SelectedSensors[i] = false; } //SelectedSensors[dropdown.selectedItemIndex] = true; //if (dropdown.selectedItemIndex == 0) SelectedSensorIndex = 0; //else SelectedSensorIndex = dropdown.selectedItemIndex - 1; SelectedSensorIndex = dropdown.selectedItemIndex; onSensorChanged = true; }
public static void RegisterDropdownClickEvent(GameObject obj, object kLuaFunc) { CustomDropdown kComponent = obj.GetComponent <CustomDropdown>(); if (null == kComponent) { return; } kComponent.onClick = delegate(GameObject sender, BaseEventData kEvtData) { LuaPerformer.Call(kLuaFunc, sender, kEvtData); }; }
public async void UpdateMenu() { CustomDropdown robotsListDropdown = RobotsList.Dropdown; robotsListDropdown.dropdownItems.Clear(); await RobotsList.gameObject.GetComponent <DropdownRobots>().Init(OnRobotChanged, true); if (robotsListDropdown.dropdownItems.Count > 0) { OnRobotChanged((string)RobotsList.GetValue()); } ValidateFields(); }
public void FocusJoints() { CustomDropdown jointsDropdown = JointsList.Dropdown; if (jointsDropdown.dropdownItems.Count == 0) { Base.NotificationsModernUI.Instance.ShowNotification("Failed to update joints", ""); return; } try { Base.GameManager.Instance.UpdateActionPointJoints((string)RobotsList.GetValue(), CurrentActionPoint.GetJoints((string)JointsList.GetValue()).Name); Base.NotificationsModernUI.Instance.ShowNotification("Joints updated sucessfully", ""); } catch (Base.RequestFailedException ex) { Base.NotificationsModernUI.Instance.ShowNotification("Failed to update joints", ex.Message); } UpdateJoints((string)RobotsList.GetValue(), (string)JointsList.GetValue()); }
void ReleaseDesignerOutlets() { if (acmField != null) { acmField.Dispose(); acmField = null; } if (AutoCompleteMode != null) { AutoCompleteMode.Dispose(); AutoCompleteMode = null; } if (clearSwitch != null) { clearSwitch.Dispose(); clearSwitch = null; } if (CustomDropdown != null) { CustomDropdown.Dispose(); CustomDropdown = null; } if (FilterDropdown != null) { FilterDropdown.Dispose(); FilterDropdown = null; } if (HighlightDropdown != null) { HighlightDropdown.Dispose(); HighlightDropdown = null; } if (ShowClearButton != null) { ShowClearButton.Dispose(); ShowClearButton = null; } }
void DropdownValueChangedActivity(CustomDropdown dropdown) { //if (dropdown.selectedItemIndex == 0) SelectedSensorIndex = 0; //else SelectedActivityIndex = dropdown.selectedItemIndex - 1; //SelectedSensorIndex = dropdown.selectedItemIndex; SelectedActivityIndex = dropdown.selectedItemIndex; //Debug.Log("Dropdown 2 value change:"+dropdown.selectedItemIndex); //If LS or Drone, directly show run button. if (ActualActivityNumber == 8 || ActualActivityNumber == 9 || ActualActivityNumber == 10 || ActualActivityNumber == 11 || ActualActivityNumber == 12)//LS 8 9 10 11 Drone 11 12 { Debug.Log("LS Drone selected."); LSConfirmButton.SetActive(true); TagButton.SetActive(false); } else { TagButton.SetActive(true); LSConfirmButton.SetActive(false); } }
public void UpdateMenu() { ActionPointName.text = CurrentActionPoint.Data.Name; CustomDropdown robotsListDropdown = RobotsList.Dropdown; robotsListDropdown.dropdownItems.Clear(); RobotsList.gameObject.GetComponent <DropdownRobots>().Init(OnRobotChanged, false); if (robotsListDropdown.dropdownItems.Count == 0) { UpdatePositionBlock.SetActive(false); } else { OnRobotChanged((string)RobotsList.GetValue()); UpdatePositionBlock.SetActive(true); } UpdateOrientations(); }
public void FocusJoints() { CustomDropdown jointsDropdown = JointsList.Dropdown; if (jointsDropdown.dropdownItems.Count == 0) { Base.NotificationsModernUI.Instance.ShowNotification("Failed to update joints", ""); return; } try { preselectedJoints = name; string robotId = SceneManager.Instance.RobotNameToId((string)RobotsList.GetValue()); Base.GameManager.Instance.UpdateActionPointJoints(robotId, (string)JointsList.GetValue()); Base.NotificationsModernUI.Instance.ShowNotification("Joints updated sucessfully", ""); } catch (Exception ex) when(ex is Base.RequestFailedException || ex is ItemNotFoundException) { Base.NotificationsModernUI.Instance.ShowNotification("Failed to update joints", ex.Message); preselectedJoints = null; } }
public static void RegisterDropdownClickEvent(GameObject obj, object kLuaFunc) { CustomDropdown kComponent = obj.GetComponent <CustomDropdown>(); if (null == kComponent) { return; } kComponent.onClick = delegate(GameObject sender, BaseEventData kEvtData) { LuaFunction kFunc = kLuaFunc as LuaFunction; if (null != kFunc) { kFunc.Call(sender, kEvtData); } else { Log.W("Call Click Event Failed"); } }; }
public void UpdateJoints(string robot_id, string selectedJoints = null) { if (robot_id == null) { return; } CustomDropdown jointsDropdown = JointsList.Dropdown; JointsList.PutData(CurrentActionPoint.GetAllJoints(true, robot_id).Values.ToList(), selectedJoints, null); if (jointsDropdown.dropdownItems.Count > 0) { NoJoints.gameObject.SetActive(false); JointsList.gameObject.SetActive(true); UpdateJointsBtn.interactable = true; } else { JointsList.gameObject.SetActive(false); NoJoints.gameObject.SetActive(true); UpdateJointsBtn.interactable = false; } }
protected override void Initiate() { customDropdown = GetComponentInChildren <CustomDropdown>(); UpdateUI(); }