// Instantly moves card into slot public static void MoveStackIntoSlot(ElementStackToken elementStack, RecipeSlot slot) { // Make sure slot and stack are valid and empty and we have a match // Abort with feedback if we don't if (!(Validator.Available(elementStack) && Validator.Available(slot) && StackMatchesSlot(elementStack, slot))) { SoundManager.PlaySfx("CardDragFail"); return; } // Remove glow so that it won't flicker when moved elementStack.ShowGlow(false, true); // Force stack to remember its last position elementStack.lastTablePos = new Vector2?(elementStack.RectTransform.anchoredPosition); if (elementStack.Quantity != 1) { IElementStack newStack = elementStack.SplitAllButNCardsToNewStack(elementStack.Quantity - 1, new Context(Context.ActionSource.PlayerDrag)); slot.AcceptStack(newStack, new Context(Context.ActionSource.PlayerDrag)); } else { slot.AcceptStack(elementStack, new Context(Context.ActionSource.PlayerDrag)); } }
private extern Hashtable GetHashtableForThisStack(IElementStack stack);
public static bool StackMatchesSlot(IElementStack elementStack, RecipeSlot slot) { return(slot.GetSlotMatchForStack(elementStack).MatchType == SlotMatchForAspectsType.Okay); }
public static float[] GetPosition(IElementStack element) { return(GetPosition(element.SaveLocationInfo)); }