public void OnFingerDown(LeanFinger finger)
        {
            // Does the prefab exist?
            if (partPrefab != null)
            {
                // Get the RaycastResults under this finger's current position
                var results = LeanTouch.RaycastGui(finger.ScreenPosition);

                if (results.Count > 0)
                {
                    // Is this finger over this UI element?
                    if (results[0].gameObject == gameObject)
                    {
                        // Spawn prefab
                        var partInstance = Instantiate(partPrefab);

                        // Position
                        partInstance.transform.position = ScreenDepth.Convert(finger.ScreenPosition, Camera, gameObject);

                        Contraption currentContraption = ContraptionsManager.instance.GetCurrentContraption();

                        currentContraption.AddPart(partInstance.GetComponent <Part>());

                        LeanSelectable.DeselectAll();

                        // Select
                        partInstance.GetComponent <LeanSelectable>().Select(finger);
                    }
                }
            }
        }
Beispiel #2
0
        private void HandleFingerDown(LeanFinger finger)
        {
            if (Select != null)
            {
                if (RequireNoSelectables == true && LeanSelectable.IsSelectedCount > 0)
                {
                    return;
                }

                if (DeselectAllAtStart == true)
                {
                    LeanSelectable.DeselectAll();
                }

                if (RequireInitialSelection == true)
                {
                    waitingForSelection = true;

                    Select.SelectScreenPosition(finger);

                    waitingForSelection = false;
                }
                else
                {
                    LeanFingerData.FindOrCreate(ref fingerDatas, finger);

                    Select.SelectScreenPosition(finger);
                }
            }
        }
 public void DeselectAll()
 {
     LeanSelectable.DeselectAll();
     if (OnAllDeselection != null)
     {
         OnAllDeselection();
     }
 }
Beispiel #4
0
 public void DeselectAll()
 {
     LeanSelectable.DeselectAll();
 }