Пример #1
0
 public Tab()
 {
     HitTestTarget = true;
     Gestures.Add(new ClickGesture(2, () => Closing?.Invoke()));
     Awoke += Awake;
     Components.Add(new UpdatableNodeBehavior());
 }
Пример #2
0
        /// <summary>
        /// Handles any addition or update to gesture items in the inventory.
        /// </summary>
        /// <param name="gesture">Gesture that was added or updated.</param>
        private void UpdateInventoryGesture(InventoryGesture gesture)
        {
            var client = RadegastInstance.GlobalInstance.Client;

            client.Assets.RequestAsset(gesture.AssetUUID, AssetType.Gesture, false, (_, asset) =>
            {
                var assetGesture = asset as AssetGesture;
                if (assetGesture == null)
                {
                    return;
                }

                if (!assetGesture.Decode())
                {
                    return;
                }

                if (!Gestures.ContainsKey(gesture.UUID))
                {
                    Gestures.Add(gesture.UUID, new GestureTrigger());
                }

                var existingGestureTrigger          = Gestures[gesture.UUID];
                existingGestureTrigger.TriggerLower = assetGesture.Trigger.ToLower();
                existingGestureTrigger.Replacement  = assetGesture.ReplaceWith;
                existingGestureTrigger.AssetID      = assetGesture.AssetID;
            });
        }
 public void AddGestures(List <Gesture> gestures)
 {
     foreach (Gesture gesture in gestures)
     {
         Gestures.Add(gesture);
         myMatcher.AddGesture(gesture);
         GestureCount++;
     }
 }
Пример #4
0
 protected override void Awake()
 {
     // On the current frame the button contents may not be loaded,
     // so delay its initialization until the next frame.
     SetState(InitialState());
     textPresentersFeeder = new TextPresentersFeeder(this);
     clickGesture         = new ClickGesture();
     Gestures.Add(clickGesture);
 }
Пример #5
0
 public PathArrowButton(Func <string, bool> openPath, string path = null) : base()
 {
     this.path      = path;
     this.openPath  = openPath;
     MinMaxHeight   = 20;
     Presenter      = new PathButtonPresenter();
     base.Presenter = Presenter;
     if (path == null)
     {
         Updating += (float delta) => {
             var prevState = State;
             if (Expanded)
             {
                 State = PathBarButtonState.Press;
             }
             else
             {
                 if (IsMouseOverThisOrDescendant())
                 {
                     if (WasClicked())
                     {
                         State = PathBarButtonState.Press;
                     }
                     else
                     {
                         State = PathBarButtonState.Hover;
                     }
                 }
                 else
                 {
                     State = PathBarButtonState.Normal;
                 }
             }
             if (prevState != State)
             {
                 Presenter.SetState(State);
             }
         };
     }
     Gestures.Add(new ClickGesture(0, FlipState));
     Layout         = new HBoxLayout();
     MinMaxSize     = new Vector2(11, 20);
     Nodes.Add(icon = new Image {
         LayoutCell = new LayoutCell {
             Alignment = new Alignment {
                 X = HAlignment.Center, Y = VAlignment.Center
             }
         },
         MinMaxSize = new Vector2(11, 6),
         Texture    = IconPool.GetTexture("Filesystem.PathSeparatorCollapsed")
     });
     Expanded = false;
 }
Пример #6
0
        public PathFolderButton(Func <string, bool> openPath, string path) : base()
        {
            Text           = GetName(path);
            Presenter      = new PathButtonPresenter();
            base.Presenter = Presenter;
            MinMaxHeight   = 20;
            MinMaxWidth    = FontPool.Instance.DefaultFont.MeasureTextLine(Text, Theme.Metrics.TextHeight, 0).X + 7;
            Clicked       += () => openPath(path);
#if WIN
            UpdateHandler showContextMenu = null;
            showContextMenu = delta => {
                Updating -= showContextMenu;
                SystemShellContextMenu.Instance.Show(path);
            };
            // TODO: Immediate showing context menu causes weird crash in GestureManager
            Gestures.Add(new ClickGesture(1, () => Updating += showContextMenu));
#endif // WIN
        }
Пример #7
0
        private void PopulateGestures()
        {
            //we will get another list of amazing guids which each contains a gesture, then we can let the gesture creator worry about that later
            //we are going to use the extention mygest for myomi gesture files
            var allGestures = FileHelper.GetAllFiles(Path.Combine("Profiles", this.ID.ToString()), ".mygest");

            //first we will populate the gestures
            foreach (var gesturePath in allGestures)
            {
                var gesture = new MyomiGesture(new Guid(gesturePath), this.ID);
                //this one is broken, we will skip this gesture
                if (gesture.ID == Guid.Empty)
                {
                    continue;
                }
                Gestures.Add(gesture);
                this._gestureCount++;
            }
        }
Пример #8
0
        /**
         * Add gesture name to database if it does not
         * already exist and returns its enumerated id.
         */
        public int AddGesture(string gname)
        {
            int i;

            for (i = 0; i < Gestures.Count; i++)
            {
                if (Gestures[i] == gname)
                {
                    return(i);
                }
            }

            // push gesture name into list and make room
            // for sample list in samples_by_gesture, which
            // will be populated later add sample is called
            Gestures.Add(gname);
            SamplesByGesture.Add(new List <Sample>());
            return(i);
        }
Пример #9
0
        /// <summary>
        /// Updates the keyboard and gamepad control states.
        /// </summary>
        public static void Update()
        {
            Gestures.Clear();

            // update the keyboard state
            previousKeyboardState = currentKeyboardState;
            currentKeyboardState  = Keyboard.GetState();

            // update the gamepad state
            previousGamePadState = currentGamePadState;
            currentGamePadState  = GamePad.GetState(PlayerIndex.One);

            // Update the touch state
            previousTouchState = currentTouchState;
            currentTouchState  = TouchPanel.GetState();


            while (TouchPanel.IsGestureAvailable)
            {
                var gesture = TouchPanel.ReadGesture();
                Gestures.Add(gesture);
            }
        }
Пример #10
0
 protected override void Awake()
 {
     Thumb?.Gestures.Add(dragGestureThumb = new DragGesture());
     Gestures.Add(dragGestureSlider       = new DragGesture());
     Gestures.Add(clickGesture            = new ClickGesture());
 }
 public void AddGesture(Gesture gesture)
 {
     Gestures.Add(gesture);
     myMatcher.AddGesture(gesture);
     GestureCount++;
 }
Пример #12
0
 /// <summary>
 /// Registriert eine Geste, verwendet dafür aber nicht das "GestureElement", sondern
 /// ein anderes, explizit angegebenes.
 /// </summary>
 /// <param name="identifier">Interner Bezeichner für die Geste</param>
 /// <param name="gesture">Die Geste selbst</param>
 /// <param name="callback">Die Methoden, die bei erkennen der Geste ausgeführt werden soll</param>
 /// <param name="element">Das UIELement für die Geste</param>
 public virtual void AddGesture(string identifier, UIElement element, GestureBase gesture,
                                GestureHandler.GestureCallbackHandler callback)
 {
     Gestures.Add(identifier,
                  Surface.GestureManager.AddGesture(element, gesture, callback));
 }
Пример #13
0
 public TabBar()
 {
     gesture = new DragGesture(direction: DragDirection.Horizontal);
     Gestures.Add(gesture);
     Tasks.Add(DragTabProcessor());
 }
Пример #14
0
 public Tab()
 {
     HitTestTarget = true;
     Gestures.Add(new ClickGesture(2, () => Closing?.Invoke()));
     Awoke += Awake;
 }