/// <summary>
 /// Constructs a <code>TransferableProxy</code> given
 /// a specified <code>Transferable</code> object representing
 /// data transfer for a particular drag-n-drop operation and
 /// a <code>boolean</code> which indicates whether the
 /// drag-n-drop operation is local (within the same JVM).
 /// <para>
 /// </para>
 /// </summary>
 /// <param name="t"> the <code>Transferable</code> object </param>
 /// <param name="local"> <code>true</code>, if <code>t</code> represents
 ///        the result of local drag-n-drop operation </param>
 internal TransferableProxy(DropTargetContext outerInstance, Transferable t, bool local)
 {
     this.OuterInstance = outerInstance;
     Proxy        = new sun.awt.datatransfer.TransferableProxy(t, local);
     Transferable = t;
     IsLocal      = local;
 }
        static void Prefix(Transferable trad, Rect rect, ref float curX)
        {
            Pawn pawn = trad.AnyThing as Pawn;

            if (pawn != null && pawn.RaceProps.Animal)
            {
                if (Settings.Get().showLifeStage)
                {
                    Texture2D lifeStageIcon = pawn.ageTracker.CurLifeStageRace.GetIcon(pawn);
                    if (lifeStageIcon != null)
                    {
                        Rect rect2 = new Rect(curX - Resources.LifeStageIconWidth, (rect.height - Resources.LifeStageIconWidth) / 2f, Resources.LifeStageIconWidth, Resources.LifeStageIconWidth);
                        curX -= Resources.LifeStageIconWidth;
                        TooltipHandler.TipRegion(rect2, pawn.ageTracker.CurLifeStage.LabelCap);
                        GUI.DrawTexture(rect2, lifeStageIcon);
                    }
                }

                Texture2D genderIcon = pawn.gender.GetIcon();
                Rect      rect1      = new Rect(curX - Resources.GenderIconWidth, (rect.height - Resources.GenderIconWidth) / 2f, Resources.GenderIconWidth, Resources.GenderIconWidth);
                curX -= Resources.GenderIconWidth;
                TooltipHandler.TipRegion(rect1, pawn.GetGenderLabel().CapitalizeFirst());
                GUI.DrawTexture(rect1, genderIcon);
            }
        }
        private void DrawTradeableLabels(Rect rowRect, ThingEntry entry)
        {
            var trade = entry.tradeable;

            if (!trade.HasAnyThing)
            {
                return;
            }

            if (Mouse.IsOver(rowRect))
            {
                Widgets.DrawHighlight(rowRect);
            }

            var thingIconArea = new Rect(0f, 0f, 27f, 27f);

            Widgets.ThingIcon(thingIconArea, trade.AnyThing);
            Widgets.InfoCardButton(40f, 0f, trade.AnyThing);

            Text.Anchor   = TextAnchor.MiddleLeft;
            Text.WordWrap = false;
            var itemLabelArea = new Rect(80f, 0f, rowRect.width - 80f, rowRect.height);

            var itemLabel = trade.LabelCap;

            if (entry.animal)
            {
                itemLabel += " (" + entry.GenderString() + ")";
            }
            else if (entry.type.HasQuality() && itemLabel.IndexOf("(normal)", StringComparison.Ordinal) != -1)
            {
                itemLabel = itemLabel.Substring(0, itemLabel.IndexOf("(normal)", StringComparison.Ordinal));
            }

            Widgets.Label(itemLabelArea, itemLabel);

            Text.WordWrap = true;
            Transferable localTrad = trade;

            TooltipHandler.TipRegion(
                rowRect,
                new TipSignal(
                    () =>
            {
                if (!localTrad.HasAnyThing)
                {
                    return(string.Empty);
                }

                var text           = trade.LabelCap;
                var tipDescription = localTrad.TipDescription;
                if (!tipDescription.NullOrEmpty())
                {
                    text = text + ": " + tipDescription;
                }

                return(text);
            },
                    localTrad.GetHashCode()));
        }
Example #4
0
 public static void Prefix(Transferable trad, ref Color labelColor)
 {
     if (trad.HasAnyThing && trad.AnyThing.TryGetComp <CompRenamable>() is CompRenamable renamableComp)
     {
         labelColor = renamableComp.labelColour;
     }
 }
Example #5
0
        /// <seealso cref="DoCountAdjustInterfaceInternal(Rect, Transferable, List{TransferableOneWay}, List{TransferableCountToTransferStoppingPoint}, int, int, int, bool, bool)"/>
        public static void DoCountAdjustInterface(Rect rect, Transferable trad, List <TransferableOneWay> pawns, int index, int min, int max, bool flash = false, List <TransferableCountToTransferStoppingPoint> extraStoppingPoints = null, bool readOnly = false)
        {
            var stoppingPoints = new List <TransferableCountToTransferStoppingPoint>();

            if (extraStoppingPoints != null)
            {
                stoppingPoints.AddRange(extraStoppingPoints);
            }
            for (int i = stoppingPoints.Count - 1; i >= 0; i--)
            {
                if (stoppingPoints[i].threshold != 0 && (stoppingPoints[i].threshold <= min || stoppingPoints[i].threshold >= max))
                {
                    stoppingPoints.RemoveAt(i);
                }
            }
            bool flag = false;

            for (int j = 0; j < stoppingPoints.Count; j++)
            {
                if (stoppingPoints[j].threshold == 0)
                {
                    flag = true;
                    break;
                }
            }
            if (!flag)
            {
                stoppingPoints.Add(new TransferableCountToTransferStoppingPoint(0, "0", "0"));
            }
            DoCountAdjustInterfaceInternal(rect, trad, pawns, stoppingPoints, index, min, max, flash, readOnly);
        }
 private int GetValueFor(Transferable t)
 {
     if (!t.AnyThing.TryGetQuality(out QualityCategory qc))
     {
         return(-1);
     }
     return((int)qc);
 }
        public override int Compare(Transferable lhs, Transferable rhs)
        {
            bool isFormCaravan /* form caravan only? */ = lhs is TransferableOneWay && rhs is TransferableOneWay;

            Func <Transferable, float> valueGetter = isFormCaravan
                ? (Transferable tr) => - tr.GetMaximumToTransfer() * tr.AnyThing.MarketValue
                : (Transferable tr) => tr.GetMinimumToTransfer() * tr.AnyThing.MarketValue;

            return(valueGetter(lhs).CompareTo(valueGetter(rhs))); // Descending
        }
Example #8
0
 private bool AddOneIfMassAllows(Dialog_FormCaravan window, Transferable transferable)
 {
     if (transferable.CanAdjustBy(1).Accepted&& window.MassUsage + transferable.ThingDef.BaseMass < window.MassCapacity)
     {
         transferable.AdjustBy(1);
         Traverse.Create(window).Field("massUsageDirty").SetValue(true);
         return(true);
     }
     return(false);
 }
        private int GetValueFor(Transferable t)
        {
            QualityCategory result = default(QualityCategory);

            if (!t.AnyThing.TryGetQuality(out result))
            {
                return(-1);
            }
            return((int)result);
        }
        static void TransferableAdjustTo(Transferable trad)
        {
            var session = MpTradeSession.current ??
                          (Multiplayer.Client != null ? Multiplayer.WorldComp.splitSession : null) ??
                          (ISessionWithTransferables)CaravanFormingProxy.drawing?.Session ??
                          TransporterLoadingProxy.drawing?.Session;

            if (session != null)
            {
                SyncTradeableCount.Watch(new MpTransferableReference(session, trad));
            }
        }
 private static TransferableCategory GetTransferableCategory(Transferable t)
 {
     if (t.ThingDef.category == ThingCategory.Pawn)
     {
         return(TransferableCategory.Pawn);
     }
     if ((!t.ThingDef.thingCategories.NullOrEmpty() && t.ThingDef.thingCategories.Contains(ThingCategoryDefOf.Medicine)) || (t.ThingDef.IsIngestible && !t.ThingDef.IsDrug && !t.ThingDef.IsCorpse) || (t.AnyThing.GetInnerIfMinified().def.IsBed&& t.AnyThing.GetInnerIfMinified().def.building.bed_caravansCanUse))
     {
         return(TransferableCategory.FoodAndMedicine);
     }
     return(TransferableCategory.Item);
 }
        /// <summary>
        /// Called from <code>DragSource</code>, this constructor creates a new
        /// <code>DragSourceContext</code> given the
        /// <code>DragSourceContextPeer</code> for this Drag, the
        /// <code>DragGestureEvent</code> that triggered the Drag, the initial
        /// <code>Cursor</code> to use for the Drag, an (optional)
        /// <code>Image</code> to display while the Drag is taking place, the offset
        /// of the <code>Image</code> origin from the hotspot at the instant of the
        /// triggering event, the <code>Transferable</code> subject data, and the
        /// <code>DragSourceListener</code> to use during the Drag and Drop
        /// operation.
        /// <br>
        /// If <code>DragSourceContextPeer</code> is <code>null</code>
        /// <code>NullPointerException</code> is thrown.
        /// <br>
        /// If <code>DragGestureEvent</code> is <code>null</code>
        /// <code>NullPointerException</code> is thrown.
        /// <br>
        /// If <code>Cursor</code> is <code>null</code> no exception is thrown and
        /// the default drag cursor behavior is activated for this drag operation.
        /// <br>
        /// If <code>Image</code> is <code>null</code> no exception is thrown.
        /// <br>
        /// If <code>Image</code> is not <code>null</code> and the offset is
        /// <code>null</code> <code>NullPointerException</code> is thrown.
        /// <br>
        /// If <code>Transferable</code> is <code>null</code>
        /// <code>NullPointerException</code> is thrown.
        /// <br>
        /// If <code>DragSourceListener</code> is <code>null</code> no exception
        /// is thrown.
        /// </summary>
        /// <param name="dscp">       the <code>DragSourceContextPeer</code> for this drag </param>
        /// <param name="trigger">    the triggering event </param>
        /// <param name="dragCursor">     the initial {@code Cursor} for this drag operation
        ///                       or {@code null} for the default cursor handling;
        ///                       see <a href="DragSourceContext.html#defaultCursor">class level documentation</a>
        ///                       for more details on the cursor handling mechanism during drag and drop </param>
        /// <param name="dragImage">  the <code>Image</code> to drag (or <code>null</code>) </param>
        /// <param name="offset">     the offset of the image origin from the hotspot at the
        ///                   instant of the triggering event </param>
        /// <param name="t">          the <code>Transferable</code> </param>
        /// <param name="dsl">        the <code>DragSourceListener</code>
        /// </param>
        /// <exception cref="IllegalArgumentException"> if the <code>Component</code> associated
        ///         with the trigger event is <code>null</code>. </exception>
        /// <exception cref="IllegalArgumentException"> if the <code>DragSource</code> for the
        ///         trigger event is <code>null</code>. </exception>
        /// <exception cref="IllegalArgumentException"> if the drag action for the
        ///         trigger event is <code>DnDConstants.ACTION_NONE</code>. </exception>
        /// <exception cref="IllegalArgumentException"> if the source actions for the
        ///         <code>DragGestureRecognizer</code> associated with the trigger
        ///         event are equal to <code>DnDConstants.ACTION_NONE</code>. </exception>
        /// <exception cref="NullPointerException"> if dscp, trigger, or t are null, or
        ///         if dragImage is non-null and offset is null </exception>
        public DragSourceContext(DragSourceContextPeer dscp, DragGestureEvent trigger, Cursor dragCursor, Image dragImage, Point offset, Transferable t, DragSourceListener dsl)
        {
            if (dscp == null)
            {
                throw new NullPointerException("DragSourceContextPeer");
            }

            if (trigger == null)
            {
                throw new NullPointerException("Trigger");
            }

            if (trigger.DragSource == null)
            {
                throw new IllegalArgumentException("DragSource");
            }

            if (trigger.Component == null)
            {
                throw new IllegalArgumentException("Component");
            }

            if (trigger.SourceAsDragGestureRecognizer.SourceActions == DnDConstants.ACTION_NONE)
            {
                throw new IllegalArgumentException("source actions");
            }

            if (trigger.DragAction == DnDConstants.ACTION_NONE)
            {
                throw new IllegalArgumentException("no drag action");
            }

            if (t == null)
            {
                throw new NullPointerException("Transferable");
            }

            if (dragImage != null && offset == null)
            {
                throw new NullPointerException("offset");
            }

            Peer = dscp;
            this.Trigger_Renamed  = trigger;
            Cursor_Renamed        = dragCursor;
            Transferable_Renamed  = t;
            Listener              = dsl;
            SourceActions_Renamed = trigger.SourceAsDragGestureRecognizer.SourceActions;

            UseCustomCursor = (dragCursor != null);

            UpdateCurrentCursor(trigger.DragAction, SourceActions, DEFAULT);
        }
Example #13
0
        /// <summary>
        /// Returns an object representing the current contents of this clipboard
        /// in the specified <code>DataFlavor</code>.
        /// The class of the object returned is defined by the representation
        /// class of <code>flavor</code>.
        /// </summary>
        /// <param name="flavor"> the requested <code>DataFlavor</code> for the contents
        /// </param>
        /// <returns> an object representing the current contents of this clipboard
        ///         in the specified <code>DataFlavor</code>
        /// </returns>
        /// <exception cref="NullPointerException"> if <code>flavor</code> is <code>null</code> </exception>
        /// <exception cref="IllegalStateException"> if this clipboard is currently unavailable </exception>
        /// <exception cref="UnsupportedFlavorException"> if the requested <code>DataFlavor</code>
        ///         is not available </exception>
        /// <exception cref="IOException"> if the data in the requested <code>DataFlavor</code>
        ///         can not be retrieved
        /// </exception>
        /// <seealso cref= DataFlavor#getRepresentationClass
        ///
        /// @since 1.5 </seealso>
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: public Object getData(DataFlavor flavor) throws UnsupportedFlavorException, java.io.IOException
        public virtual Object GetData(DataFlavor flavor)
        {
            if (flavor == null)
            {
                throw new NullPointerException("flavor");
            }

            Transferable cntnts = GetContents(null);

            if (cntnts == null)
            {
                throw new UnsupportedFlavorException(flavor);
            }
            return(cntnts.GetTransferData(flavor));
        }
Example #14
0
        /// <summary>
        /// Returns whether or not the current contents of this clipboard can be
        /// provided in the specified <code>DataFlavor</code>.
        /// </summary>
        /// <param name="flavor"> the requested <code>DataFlavor</code> for the contents
        /// </param>
        /// <returns> <code>true</code> if the current contents of this clipboard
        ///         can be provided in the specified <code>DataFlavor</code>;
        ///         <code>false</code> otherwise
        /// </returns>
        /// <exception cref="NullPointerException"> if <code>flavor</code> is <code>null</code> </exception>
        /// <exception cref="IllegalStateException"> if this clipboard is currently unavailable
        ///
        /// @since 1.5 </exception>
        public virtual bool IsDataFlavorAvailable(DataFlavor flavor)
        {
            if (flavor == null)
            {
                throw new NullPointerException("flavor");
            }

            Transferable cntnts = GetContents(null);

            if (cntnts == null)
            {
                return(false);
            }
            return(cntnts.IsDataFlavorSupported(flavor));
        }
Example #15
0
 public override int Compare(Transferable lhs, Transferable rhs)
 {
     if (!lhs.AnyThing.def.IsWeapon && !rhs.AnyThing.def.IsWeapon)
     {
         return(0);
     }
     if (lhs.AnyThing.def.IsWeapon && !rhs.AnyThing.def.IsWeapon)
     {
         return(-1);
     }
     if (!lhs.AnyThing.def.IsWeapon && rhs.AnyThing.def.IsWeapon)
     {
         return(1);
     }
     return(-GetDps(lhs.AnyThing).CompareTo(GetDps(rhs.AnyThing)));
 }
Example #16
0
 public override int Compare(Transferable lhs, Transferable rhs)
 {
     if (!lhs.AnyThing.def.IsApparel && !rhs.AnyThing.def.IsApparel)
     {
         return(0);
     }
     if (lhs.AnyThing.def.IsApparel && !rhs.AnyThing.def.IsApparel)
     {
         return(-1);
     }
     if (!lhs.AnyThing.def.IsApparel && rhs.AnyThing.def.IsApparel)
     {
         return(1);
     }
     return(-lhs.AnyThing.GetStatValue(StatDefOf.ArmorRating_Sharp).CompareTo(rhs.AnyThing.GetStatValue(StatDefOf.ArmorRating_Sharp)));
 }
Example #17
0
 public override int Compare(Transferable lhs, Transferable rhs)
 {
     if (!lhs.AnyThing.def.IsNutritionGivingIngestible && !rhs.AnyThing.def.IsNutritionGivingIngestible)
     {
         return(0);
     }
     if (lhs.AnyThing.def.IsNutritionGivingIngestible && !rhs.AnyThing.def.IsNutritionGivingIngestible)
     {
         return(-1);
     }
     if (!lhs.AnyThing.def.IsNutritionGivingIngestible && rhs.AnyThing.def.IsNutritionGivingIngestible)
     {
         return(1);
     }
     return(-GetNutritionPerMarketValue(lhs.AnyThing).CompareTo(GetNutritionPerMarketValue(rhs.AnyThing)));
 }
Example #18
0
        /// <summary>
        /// Sets the current contents of the clipboard to the specified
        /// transferable object and registers the specified clipboard owner
        /// as the owner of the new contents.
        /// <para>
        /// If there is an existing owner different from the argument
        /// <code>owner</code>, that owner is notified that it no longer
        /// holds ownership of the clipboard contents via an invocation
        /// of <code>ClipboardOwner.lostOwnership()</code> on that owner.
        /// An implementation of <code>setContents()</code> is free not
        /// to invoke <code>lostOwnership()</code> directly from this method.
        /// For example, <code>lostOwnership()</code> may be invoked later on
        /// a different thread. The same applies to <code>FlavorListener</code>s
        /// registered on this clipboard.
        /// </para>
        /// <para>
        /// The method throws <code>IllegalStateException</code> if the clipboard
        /// is currently unavailable. For example, on some platforms, the system
        /// clipboard is unavailable while it is accessed by another application.
        ///
        /// </para>
        /// </summary>
        /// <param name="contents"> the transferable object representing the
        ///                 clipboard content </param>
        /// <param name="owner"> the object which owns the clipboard content </param>
        /// <exception cref="IllegalStateException"> if the clipboard is currently unavailable </exception>
        /// <seealso cref= java.awt.Toolkit#getSystemClipboard </seealso>
        public virtual void SetContents(Transferable contents, ClipboardOwner owner)
        {
            lock (this)
            {
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final ClipboardOwner oldOwner = this.owner;
                ClipboardOwner oldOwner = this.Owner;
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final Transferable oldContents = this.contents;
                Transferable oldContents = this.Contents;

                this.Owner    = owner;
                this.Contents = contents;

                if (oldOwner != null && oldOwner != owner)
                {
                    EventQueue.InvokeLater(new RunnableAnonymousInnerClassHelper(this, oldOwner, oldContents));
                }
                FireFlavorsChanged();
            }
        }
        public static void Postfix(Transferable trad, Rect rect, ref float curX)
        {
            Pawn pawn = trad.AnyThing as Pawn;

            if (pawn != null)
            {
                var extension = pawn.def.GetModExtension <MechanoidExtension>();
                if (extension != null)
                {
                    if (pawn.IsCaravanRideable())
                    {
                        Rect rect2 = new Rect(curX - RideableIconWidth, (rect.height - RideableIconWidth) / 2f, RideableIconWidth, RideableIconWidth);
                        curX -= rect2.width;
                        GUI.DrawTexture(rect2, RideableIcon);
                        if (Mouse.IsOver(rect2))
                        {
                            TooltipHandler.TipRegion(rect2, GetIconTooltipText(pawn));
                        }
                    }
                }
            }
        }
		/// <summary>
		/// Invoked after data has been exported.
		/// </summary>
		protected void exportDone(JComponent @source, Transferable @data, int @action)
		{
		}
		/// <summary>
		/// Causes a transfer to a component from a clipboard or a
		/// DND drop operation.
		/// </summary>
		public bool importData(JComponent @comp, Transferable @t)
		{
			return default(bool);
		}
		/// <summary>
		/// Returns an object that establishes the look of a transfer.
		/// </summary>
		public Icon getVisualRepresentation(Transferable @t)
		{
			return default(Icon);
		}
        public MetadataBase metadata;                   // A field to cache this item's basic metadata, if requested.

        /// <summary>
        /// Constructor
        /// </summary>
        public CryptoItem()
        {
            supplyModel         = SupplyModel.FIXED;
            transferable        = Transferable.PERMANENT;
            transferFeeSettings = new TransferFeeSettings();
        }
        private string GetValueFor(Transferable t)
        {
            Thing anyThing = t.AnyThing;

            return(anyThing.GetInnerIfMinified().Stuff?.LabelAsStuff ?? "");
        }
Example #25
0
 public void Notify_CountChanged(Transferable tr)
 {
     uiDirty = true;
 }
		/// <summary>
		/// Gets a Reader for a text flavor, decoded, if necessary, for the expected
		/// charset (encoding).
		/// </summary>
		public Reader getReaderForText(Transferable @transferable)
		{
			return default(Reader);
		}
Example #27
0
 public override int Compare(Transferable lhs, Transferable rhs)
 {
     return(-lhs.GetMaximumToTransfer().CompareTo(rhs.GetMaximumToTransfer())); // Descending
 }
 public override int Compare(Transferable lhs, Transferable rhs)
 {
     return(GetValueFor(lhs).CompareTo(GetValueFor(rhs)));
 }
 /// <summary>
 /// Creates a TransferableProxy to proxy for the specified
 /// Transferable.
 /// </summary>
 /// <param name="t"> the <tt>Transferable</tt> to be proxied </param>
 /// <param name="local"> <tt>true</tt> if <tt>t</tt> represents
 ///        the result of a local drag-n-drop operation. </param>
 /// <returns> the new <tt>TransferableProxy</tt> instance. </returns>
 protected internal virtual Transferable CreateTransferableProxy(Transferable t, bool local)
 {
     return(new TransferableProxy(this, t, local));
 }
Example #30
0
        public static void DoCountAdjustInterfaceForSilver(Rect rect, Transferable trad, int _, int min, int max, bool flash)
        {
            rect = rect.Rounded();
            Rect rect2 = new Rect(rect.center.x - 45f, rect.center.y - 12.5f, 90f, 25f).Rounded();

            if (flash)
            {
                GUI.DrawTexture(rect2, TransferableUIUtility.FlashTex);
            }

            bool num = trad is TransferableOneWay transferableOneWay && transferableOneWay.HasAnyThing && transferableOneWay.AnyThing is Pawn && transferableOneWay.MaxCount == 1;

            if (num)
            {
                bool flag    = trad.CountToTransfer != 0;
                bool checkOn = flag;
                Widgets.Checkbox(rect2.position, ref checkOn);
                if (checkOn != flag)
                {
                    if (checkOn)
                    {
                        trad.AdjustTo(trad.GetMaximumToTransfer());
                    }
                    else
                    {
                        trad.AdjustTo(trad.GetMinimumToTransfer());
                    }
                }
            }
            else
            {
                Rect rect3 = rect2.ContractedBy(2f);
                rect3.xMax -= 15f;
                rect3.xMin += 16f;
                int    val    = trad.CountToTransfer;
                string buffer = trad.EditBuffer;
                Widgets.TextFieldNumeric(rect3, ref val, ref buffer, min, max);
                trad.AdjustTo(val);
                trad.EditBuffer = buffer;
            }

            Text.Anchor = TextAnchor.UpperLeft;
            GUI.color   = Color.white;
            if (!num)
            {
                int  num2  = (trad.PositiveCountDirection == TransferablePositiveCountDirection.Source) ? 1 : (-1);
                int  num3  = GenUI.CurrentAdjustmentMultiplier();
                bool flag2 = trad.GetRange() == 1;
                if (trad.CanAdjustBy(num2 * num3).Accepted)
                {
                    Rect rect4 = new Rect(rect2.x - 30f, rect.y, 30f, rect.height);
                    if (flag2)
                    {
                        rect4.x     -= rect4.width;
                        rect4.width += rect4.width;
                    }
                    if (Widgets.ButtonText(rect4, "<"))
                    {
                        trad.AdjustBy(num2 * num3);
                        SoundDefOf.Tick_High.PlayOneShotOnCamera();
                    }
                    if (!flag2)
                    {
                        string label = "<<";
                        int?   num4  = null;
                        rect4.x -= rect4.width;
                        if (Widgets.ButtonText(rect4, label))
                        {
                            if (num4.HasValue)
                            {
                                trad.AdjustTo(num4.Value);
                            }
                            else if (num2 == 1)
                            {
                                trad.AdjustTo(trad.GetMaximumToTransfer());
                            }
                            else
                            {
                                trad.AdjustTo(trad.GetMinimumToTransfer());
                            }
                            SoundDefOf.Tick_High.PlayOneShotOnCamera();
                        }
                    }
                }
                if (trad.CanAdjustBy(-num2 * num3).Accepted)
                {
                    Rect rect5 = new Rect(rect2.xMax, rect.y, 30f, rect.height);
                    if (flag2)
                    {
                        rect5.width += rect5.width;
                    }
                    if (Widgets.ButtonText(rect5, ">"))
                    {
                        trad.AdjustBy(-num2 * num3);
                        SoundDefOf.Tick_Low.PlayOneShotOnCamera();
                    }
                    if (!flag2)
                    {
                        string label2 = ">>";
                        int?   num5   = null;
                        rect5.x += rect5.width;
                        if (Widgets.ButtonText(rect5, label2))
                        {
                            if (num5.HasValue)
                            {
                                trad.AdjustTo(num5.Value);
                            }
                            else if (num2 == 1)
                            {
                                trad.AdjustTo(trad.GetMinimumToTransfer());
                            }
                            else
                            {
                                trad.AdjustTo(trad.GetMaximumToTransfer());
                            }
                            SoundDefOf.Tick_Low.PlayOneShotOnCamera();
                        }
                    }
                }
            }

            if (trad.CountToTransfer != 0)
            {
                Rect position = new Rect(rect2.x + rect2.width / 2f - (float)(TradeArrow.width / 2), rect2.y + rect2.height / 2f - (float)(TradeArrow.height / 2), TradeArrow.width, TradeArrow.height);
                TransferablePositiveCountDirection positiveCountDirection = trad.PositiveCountDirection;
                if ((positiveCountDirection == TransferablePositiveCountDirection.Source && trad.CountToTransfer > 0) || (positiveCountDirection == TransferablePositiveCountDirection.Destination && trad.CountToTransfer < 0))
                {
                    position.x     += position.width;
                    position.width *= -1f;
                }
                GUI.DrawTexture(position, TradeArrow);
            }
        }
 public override int Compare(Transferable lhs, Transferable rhs)
 {
     return((lhs.AnyThing.MarketValue / lhs.AnyThing.GetStatValue(StatDefOf.Mass))
            .CompareTo(rhs.AnyThing.MarketValue / rhs.AnyThing.GetStatValue(StatDefOf.Mass)));
 }
Example #32
0
		/// <summary>
		/// Sets the current contents of the clipboard to the specified
		/// transferable object and registers the specified clipboard owner
		/// as the owner of the new contents.
		/// </summary>
		public void setContents(Transferable @contents, ClipboardOwner @owner)
		{
		}
 /// <summary>
 /// Gets a Reader for a text flavor, decoded, if necessary, for the expected
 /// charset (encoding).
 /// </summary>
 public Reader getReaderForText(Transferable @transferable)
 {
     return(default(Reader));
 }
 public override int Compare(Transferable lhs, Transferable rhs)
 {
     return(lhs.Label.CompareTo(rhs.Label));
 }
 public override int Compare(Transferable lhs, Transferable rhs)
 {
     return(0);
 }
		/// <summary>
		/// Called when associated with the <code>DropTargetContextPeer</code>.
		/// </summary>
		//public void addNotify(java.awt.dnd.peer.DropTargetContextPeer @dtcp)
		//{
		//}

		/// <summary>
		/// Creates a TransferableProxy to proxy for the specified
		/// Transferable.
		/// </summary>
		public Transferable createTransferableProxy(Transferable @t, bool @local)
		{
			return default(Transferable);
		}