// Assign new held Item, then grab the item into our hand / controller public void GrabGrabbable(Grabbable item) { // We are trying to grab something else if (flyingGrabbable != null && item != flyingGrabbable) { return; } // Make sure we aren't flying an object at us still resetFlyingGrabbable(); // Drop whatever we were holding if (HeldGrabbable != null && HeldGrabbable) { Debug.Log("Try release:" + HeldGrabbable.name); TryRelease(); } // Assign new grabbable HeldGrabbable = item; // Just grabbed something, no longer fresh. FreshGrip = false; Debug.Log("Grabbb in grabber: " + item.name); // Let item know it's been grabbed item.GrabItem(this); Grab?.Invoke(new GrabbableEventArgs(item, this)); }
public GrabOptionsGump(Mobile m) : base(10, 10) { GrabOptions options = Grab.GetOptions(m); AddPage(1); AddBackground(0, 0, 330, 405, 9250); AddLabel(120, 15, LabelHue, "Grab Options"); AddImageTiled(15, 35, 300, 4, 9151); AddAlphaRegion(15, 45, 160, 20); AddLabel(15, 45, LabelHue, "Loot to Grab"); AddAlphaRegion(180, 45, 135, 20); AddLabel(180, 45, LabelHue, "Placement Container"); string[] types = Enum.GetNames(typeof(GrabFlag)); for (int i = 0, y = 75; i < types.Length; i++, y += 25) { GrabFlag flag = (GrabFlag)Enum.Parse(typeof(GrabFlag), types[i], true); AddCheck(15, y, 210, 211, options.GetFlag(flag), (i + 1)); AddLabel(40, y, LabelHue, types[i]); AddLabelCropped(185, y, 100, 20, LabelHue, Grab.GetContainerName(m, flag)); AddButton(295, y, 9762, 9763, (i + 1), GumpButtonType.Reply, 0); } AddButton(15, 370, 4020, 4022, 100, GumpButtonType.Reply, 0); AddLabel(50, 370, LabelHue, "Cancel"); AddButton(285, 370, 4023, 4025, 105, GumpButtonType.Reply, 0); AddLabel(190, 370, LabelHue, "Apply Changes"); }
public static void GrabWindow(Window window) { window.GrabFocus(); Grab.Add(window); Gdk.GrabStatus grabbed = Gdk.Pointer.Grab(window.GdkWindow, true, Gdk.EventMask.ButtonPressMask | Gdk.EventMask.ButtonReleaseMask | Gdk.EventMask.PointerMotionMask, null, null, CURRENT_TIME); if (grabbed == Gdk.GrabStatus.Success) { grabbed = Gdk.Keyboard.Grab(window.GdkWindow, true, CURRENT_TIME); if (grabbed != Gdk.GrabStatus.Success) { Grab.Remove(window); window.Destroy(); } } else { Grab.Remove(window); window.Destroy(); } }
public bool Interact(int x, int y, Interaction interaction) { if (pixels.Contains(new Point(x, y))) { switch (interaction) { case Interaction.Eye: Look?.Invoke(); break; case Interaction.Hand: Grab?.Invoke(); break; case Interaction.Mouth: Talk?.Invoke(); break; default: return(false); } } return(true); }
void GrabStart(CustomHand hand) { SetInteractibleVariable(hand); hand.SkeletonUpdate(); hand.grabType = CustomHand.GrabType.Select; Grab.Invoke(); }
// public void GrabStart(CustomHand hand) { // power steering stuff PowerSteeringActive = false; // SetInteractibleVariable(hand); hand.SkeletonUpdate(); hand.PivotUpdate(); Transform tempPoser = GetMyGrabPoserTransform(hand); Vector3 HandTolocalPos = transform.InverseTransformPoint(hand.PivotPoser.position); HandTolocalPos.z = 0; tempPoser.localPosition = HandTolocalPos; if (hand.handType == SteamVR_Input_Sources.LeftHand) { oldPosLeft = new Vector2(HandTolocalPos.x, HandTolocalPos.y); } else { if (hand.handType == SteamVR_Input_Sources.RightHand) { oldPosRight = new Vector2(HandTolocalPos.x, HandTolocalPos.y); } } ReversHand = Vector3.Angle(transform.forward, hand.PivotPoser.forward) < 90; Grab.Invoke(); }
public void interact() { Grab grabber = myPlayer.grabber; Inventory inventory = myPlayer.inventory; if (grabber.hasObject()) { grabber.dropObject(); } else { Vector3 point; GameObject nearest = getTarget(out point); if (nearest != null && !inventory.take(nearest)) { Label trgt; bool canInteract = hasInteractable(nearest, out trgt); if (canInteract) { InteractTrigger trig = new InteractTrigger(); trig.setPoint(point); trgt.sendTrigger(nearest, trig); } else { grabber.grabObject(nearest, point); } } } }
protected override bool OnButtonPressEvent(EventButton evnt) { if (evnt.Button != 1 || evnt.IsContextMenuButton()) { return(base.OnButtonPressEvent(evnt)); } if (IsOverIndicator(evnt.Y)) { parentStrip.GotoTask(parentStrip.SearchNextTask(GetHoverMode())); return(base.OnButtonPressEvent(evnt)); } var hoverTask = GetHoverTask(evnt.Y); if (hoverTask != null) { MoveToTask(hoverTask); } if (IsInsideBar(evnt.X, evnt.Y)) { Grab.Add(this); grabCenter = GetSliderCenter(); grabY = evnt.Y; } else { MovePosition(evnt.Y); } return(base.OnButtonPressEvent(evnt)); }
private void Awake() { rb = GetComponent <Rigidbody2D>(); anim = GetComponent <Animator>(); spriteRenderer = transform.GetChild(0).GetComponent <SpriteRenderer>(); grab = GetComponent <Grab>(); }
void ButtonPressEventHandler(object o, ButtonPressEventArgs a) { if (a.Event.Type != Gdk.EventType.ButtonPress) { return; } if (a.Event.Button == 1) { is_dragging = true; } HasFocus = true; Gdk.EventButton pos = a.Event; int new_selected = HitTest(pos.Y); int double_click_time = Settings.DoubleClickTime; if ((new_selected == Selected) && (a.Event.Time - last_click_time <= double_click_time)) { Selected = new_selected; Grab.Remove(this); if (ItemActivated != null) { ItemActivated(Selected); } } else { Selected = new_selected; } last_click_time = a.Event.Time; a.RetVal = true; }
private void OnContainerSelect(Mobile from, object target, object state) { if (target is Container) { Container cont = (Container)target; if (!cont.IsChildOf(from.Backpack) && cont != from.Backpack) { from.SendMessage("You may only drop grabbed loot into containers in your pack."); } else { GrabOptions options = Grab.GetOptions(from); GrabFlag containerFlag = Grab.ParseInt32((int)state); options.SetPlacementContainer(containerFlag, cont); from.SendMessage("You have selected a new container for '{0}'.", Enum.GetName(typeof(GrabFlag), containerFlag)); } } else { from.SendMessage("Loot can only be dropped into containers."); } from.SendGump(new GrabOptionsGump(from)); }
// Initialize player information void OnGameBegin(CharacterInfo player1, CharacterInfo player2, StageOptions stage) { p1 = player1; p2 = player2; // Get all of the moves' SkillTree handlers basic = GetComponent <Basic>(); basic.GetTree(p1, true); basic.GetTree(p2, false); handlers[Constants.BASIC] = basic.Resolve; strong = GetComponent <Strong>(); strong.GetTree(p1, true); strong.GetTree(p2, false); handlers[Constants.STRONG] = strong.Resolve; evade = GetComponent <Evade>(); evade.GetTree(p1, true); evade.GetTree(p2, false); handlers[Constants.EVADE] = evade.Resolve; grab = GetComponent <Grab>(); grab.GetTree(p1, true); grab.GetTree(p2, false); handlers[Constants.GRAB] = evade.Resolve; }
//Grab event callback void OnMADHGGrabEvent(Grab grab) { string logTime = getLogTime(); var grabStatus = grab.status; switch (grabStatus) { case Grab.GrabStatus.START: Debug.Log("HandGestureSample: DemoHandGesture: onGrab: START - Hand[" + grab.index + "] position[" + grab.x + ", " + grab.y + "] logTime : " + logTime); eventGrabStr = "GrabEvent: onGrab: START - Hand[" + grab.index + "] position[" + grab.x + ", " + grab.y + "] logTime : " + logTime + " \n"; break; case Grab.GrabStatus.HOLDING: Debug.Log("HandGestureSample: DemoHandGesture: onGrab: HOLDING - Hand[" + grab.index + "] position[" + grab.x + ", " + grab.y + "] different: [" + grab.dx + ", " + grab.dy + "] logTime : " + logTime); eventGrabStr = "GrabEvent: onGrab: HOLDING - Hand[" + grab.index + "] position[" + grab.x + ", " + grab.y + "] different: [" + grab.dx + ", " + grab.dy + "] logTime : " + logTime + " \n"; break; case Grab.GrabStatus.RELEASE: Debug.Log("HandGestureSample: DemoHandGesture: onGrab: RELEASE - Hand[" + grab.index + "] position[" + grab.x + ", " + grab.y + "] different: [" + grab.dx + ", " + grab.dy + "] logTime : " + logTime); eventGrabStr = "GrabEvent: onGrab: RELEASE - Hand[" + grab.index + "] position[" + grab.x + ", " + grab.y + "] different: [" + grab.dx + ", " + grab.dy + "] logTime : " + logTime + " \n"; break; case Grab.GrabStatus.CANCEL: Debug.Log("HandGestureSample: DemoHandGesture: onGrab: CANCEL - Hand[" + grab.index + "] position[" + grab.x + ", " + grab.y + "] different: [" + grab.dx + ", " + grab.dy + "] logTime : " + logTime); eventGrabStr = "GrabEvent: onGrab: CANCEL - Hand[" + grab.index + "] position[" + grab.x + ", " + grab.y + "] different: [" + grab.dx + ", " + grab.dy + "] logTime : " + logTime + " \n"; break; default: Debug.Log("HandGestureSample: DemoHandGesture: onGrab: OTHER DEFAULT CASE"); eventGrabStr = "GrabEvent: onGrab: onGrab: OTHER DEFAULT CASE logTime : " + logTime + " \n"; break; } }
static async void MainAsync(string[] args) { List <HtmlNode> articles = Grab.GrabArticles(); int articleNo = 0; foreach (HtmlNode a in articles) { articleNo++; Console.Write($"Beginning scrapping article {articleNo}. "); PostMessage post; try { Interpreter.Interpret(a, out post); var json = JsonConvert.SerializeObject(post, new IsoDateTimeConverter() { DateTimeFormat = "yyyy-MM-dd" }); Console.WriteLine($"Post article {articleNo} API result: "); Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine(await PostArticle.Post(json)); Console.ForegroundColor = ConsoleColor.White; Console.WriteLine("-------------------------------------------------------"); } catch (Exception ex) { logger.Error(ex); } } Console.ForegroundColor = ConsoleColor.Green; Console.WriteLine($"{articleNo} articles scrapped. Press any key to exit."); Console.ReadLine(); }
internal Grab(Grab next, long address, long limit, long nextPointer, MemoryAllocationTracker memoryTracker) { this.NextConflict = next; this.Address = address; this.Limit = limit; this.NextPointer = nextPointer; this.MemoryTracker = memoryTracker; }
// Use this for initialization void Start() { anim = GetComponent <Animator>(); rb = GetComponent <Rigidbody2D>(); enemHealth = FindObjectOfType <EnemyHealth>(); grabClass = FindObjectOfType <Grab>(); grounded = FindObjectOfType <GroundCheck>(); }
// Start is called before the first frame update void Start() { this.collision = GetComponent <Collision>(); this.grab = GetComponent <Grab>(); this.jumping = GetComponent <Jumping>(); this.rigidbody = GetComponent <Rigidbody2D>(); }
private void Awake() { rb = GetComponent <Rigidbody2D>(); anim = GetComponent <Animator>(); grab = GetComponent <Grab>(); groundLayer = LayerMask.GetMask("Ground"); remainingJumps = extraJumps; }
void ClearGrab() { if (IsInGrab()) { Grab.Remove(this); grabY = -1; } }
internal Grab(Grab next, long size, MemoryAllocationTracker memoryTracker) { this.NextConflict = next; this.Address = UnsafeUtil.allocateMemory(size, memoryTracker); this.Limit = Address + size; this.MemoryTracker = memoryTracker; NextPointer = Address; }
private static void GrabLoot(Mobile from, Container cont) { if (!from.Alive || cont == null) { return; } if (cont is Corpse && from == ((Corpse)cont).Owner) { Corpse corpse = (Corpse)cont; if (corpse.Killer == null || corpse.Killer is BaseCreature) { corpse.Open(from, true); } else { corpse.Open(from, false); } } else { bool fullPack = false; List <Item> items = new List <Item>(cont.Items); GrabOptions options = Grab.GetOptions(from); for (int i = 0; !fullPack && i < items.Count; i++) { Item item = items[i]; if (options.IsLootable(item)) { Container dropCont = options.GetPlacementContainer(Grab.ParseType(item)); if (dropCont == null || dropCont.Deleted || !dropCont.IsChildOf(from.Backpack)) { dropCont = from.Backpack; } if (!item.DropToItem(from, dropCont, new Point3D(-1, -1, 0))) { fullPack = true; } } } if (fullPack) { from.SendMessage("You grabbed as many of the items as you could. The rest remain {0}.", (cont is Corpse ? "on the corpse" : "in the container")); } else { from.SendMessage("You retrieve all of the items from the {0}.", (cont is Corpse ? "body" : "container")); } from.RevealingAction(); } }
static public void AddGrab(GameObject gameObject, ActionSequence sequence) { Grab action = new Grab(); action.source = gameObject; action.range = 2.0f; action.duration = 0.2f; QueuePop(sequence,3); sequence.actions.Add(action); }
Vector3 oldDir; //old hands rotation public void GrabStart(CustomHand hand) { SetInteractibleVariable(hand); hand.SkeletonUpdate(); GetMyGrabPoserTransform(hand).rotation = Quaternion.LookRotation(transform.forward, hand.PivotPoser.up); oldDir = transform.InverseTransformDirection(hand.PivotPoser.up); GetMyGrabPoserTransform(hand).transform.position = hand.PivotPoser.position; Grab.Invoke(); }
protected override void OnMapped() { base.OnMapped(); Gdk.Pointer.Grab(GdkWindow, true, Gdk.EventMask.ButtonPressMask | Gdk.EventMask.ButtonReleaseMask | Gdk.EventMask.PointerMotionMask | Gdk.EventMask.EnterNotifyMask | Gdk.EventMask.LeaveNotifyMask, null, null, Global.CurrentEventTime); Grab.Add(this); GrabBrokenEvent += delegate { Destroy(); }; }
protected override bool OnButtonPressEvent(EventButton evnt) { int px = (int)evnt.X - x_offset; int py = (int)evnt.Y - y_offset; if (px < 0) { px = 0; } if (px > width - 1) { px = width - 1; } if (py < 0) { py = 0; } if (py > height - 1) { py = height - 1; } //find the closest point float closest_x = MinX - 1; var distance = int.MaxValue; foreach (var point in points) { int cx = Project(point.Key, MinX, MaxX, width); if (Math.Abs(px - cx) < distance) { distance = Math.Abs(px - cx); closest_x = point.Key; } } Grab.Add(this); CursorType = CursorType.Tcross; switch (CurveType) { case CurveType.Linear: case CurveType.Spline: if (distance > min_distance) { //insert a new control point AddPoint((closest_x = Unproject(px, MinX, MaxX, width)), MaxY - Unproject(py, MinY, MaxY, height)); QueueDraw(); } grab_point = closest_x; break; case CurveType.Free: throw new NotImplementedException(); } return(true); }
protected virtual void OnGrabHit(int i, bool grab) { Grab?.Invoke(i, grab); if (CanResetOntrigger && Input.GrabLState && Input.GrabRState) { Reset(); } }
protected override bool OnButtonReleaseEvent(EventButton evnt) { Grab.Remove(this); //FIXME: remove inactive points CursorType = CursorType.Fleur; grab_point = null; return(true); }
private void OnTriggerEnter(Collider other) { if (other.name == "Trigger") { Grab c = grab.GetComponent <Grab>(); GameObject chicken = c.currchicken; Destroy(chicken); chickenDestroyed++; } }
public override void OnInspectorGUI() { DrawDefaultInspector(); Grab accessory = (Grab)target; if (GUILayout.Button("Force Equip")) { FindObjectOfType <Example>().EquipAccessoryWithForce(accessory); } }
public void LeaveDragMode(uint time) { if (DragInProgress) { Pointer.Ungrab(time); Grab.Remove(this); } MotionNotifyEvent -= new MotionNotifyEventHandler(OnMotionNotify); DragInProgress = false; }
public void Grab(Grab aGrabber) { grabber = aGrabber; myRigidbody.drag = 20; myRigidbody.collisionDetectionMode = CollisionDetectionMode.Continuous; force = 20 / myRigidbody.mass; if (force > 20) { force = 20; } }