Ejemplo n.º 1
0
 public static void Postfix(float x, float y, ThingDef thingDef)
 {
     if (Event.current.type == EventType.MouseUp && Event.current.button == 0)
     {
         if (!Mouse.IsOver(new Rect(x, y, 50f, 27f)))
         {
             return;
         }
         Event.current.Use();
         MainMod.SelectThisInStorage(thingDef, Find.CurrentMap);
     }
 }
Ejemplo n.º 2
0
        //TODO : Convert to transpiler
        public static void Postfix(ThingDef thingDef, int nestLevel, Listing_ResourceReadout __instance)
        {
            ModLogger l = MainMod.logger;

            if (Event.current.type == EventType.MouseUp && Event.current.button == 0)
            {
                try
                {
                    Traverse tr   = Traverse.Create(__instance);
                    Rect     rect = new Rect(0f, tr.Field("curY").GetValue <float>() - 24f, tr.Property("LabelWidth").GetValue <float>(), tr.Field("lineHeight").GetValue <float>())
                    {
                        xMin = tr.Method("XAtIndentLevel", new Type[] { typeof(int) }).GetValue <float>(nestLevel) + 18f
                    };
                    if (!Mouse.IsOver(rect))
                    {
                        return;
                    }
                }
                catch (Exception e) { l.ReportException(e); return; }
                Event.current.Use();
                MainMod.SelectThisInStorage(thingDef, Find.CurrentMap);
            }
        }