Ejemplo n.º 1
0
        public static void Prefix(Thing __instance, Graphic __result, ref Graphic ___graphicInt)
        {
            if (__instance != null)
            {
                Pawn pawn = __instance as Pawn;
                if (pawn != null)
                {
                    //    return;
                }

                CompColorableTwo colorableTwo = __instance.TryGetCompFast <CompColorableTwo>();
                if (colorableTwo != null)
                {
                    Color colorOne = colorableTwo.Color;
                    Color colorTwo = colorableTwo.ColorTwo;
                    CompColorableTwoFaction factionColorable = __instance.TryGetCompFast <CompColorableTwoFaction>();
                    if (factionColorable != null)
                    {
                        if (factionColorable.Active)
                        {
                            colorOne = factionColorable.Color;
                        }
                        if (factionColorable.ActiveTwo)
                        {
                            colorTwo = factionColorable.ColorTwo;
                        }
                    }
                    if (___graphicInt == null)
                    {
                        //    Log.Message(__instance.LabelCap + " CompColorableTwo Color: " + colorableTwo.Color+ " ColorTwo: " + colorableTwo.ColorTwo);
                        if (__instance.def.graphicData == null)
                        {
                            ___graphicInt = BaseContent.BadGraphic;
                        }
                        Graphic Graphic = __instance.def.graphicData.GraphicColoredFor(__instance);
                        if (Graphic != null)
                        {
                            //    Log.Message(__instance.LabelCap + " colouring graphic");
                            Graphic = Graphic.GetColoredVersion(ShaderTypeDefOf.CutoutComplex.Shader, colorOne, colorTwo);
                            bool flag = Graphic as Graphic_RandomRotated != null;
                            if (flag)
                            {
                                //    Log.Message(__instance.LabelCap + " setting graphic");
                                ___graphicInt = new Graphic_RandomRotated(Graphic, 35f);
                            }
                            else
                            {
                                ___graphicInt = Graphic;
                            }
                        }
                    }
                }
            }
        }
 public static void get_Graphic_CompAdvancedGraphic(Thing __instance, ref Graphic __result)
 {
     if (__instance != null)
     {
         CompAdvancedGraphic advancedWeaponGraphic = __instance.TryGetComp <CompAdvancedGraphic>();
         if (advancedWeaponGraphic != null)
         {
             //    Log.Message("adv graphic used");
             __result = new Graphic_RandomRotated(advancedWeaponGraphic.Graphic(__result), 35f);
         }
     }
 }
Ejemplo n.º 3
0
        public static Graphic GetGraphicRandomRotated(Thing thing, Graphic graphic, Type graphicClass, string path, Shader shader, Vector2 drawSize, Color color, Color colorTwo, GraphicData data, List <ShaderParameter> shaderParameters)
        {
            GraphicRequest graphicRequest = new GraphicRequest(graphicClass, path, shader, drawSize, color, colorTwo, data, 0, shaderParameters);

            graphicRequest.color    = (Color32)graphicRequest.color;
            graphicRequest.colorTwo = (Color32)graphicRequest.colorTwo;
            if (!GraphicDatabase.allGraphics.TryGetValue(graphicRequest, out Graphic value))
            {
                value = new Graphic_RandomRotated((graphic as Graphic_RandomRotated).subGraphic, thing.def.graphicData.onGroundRandomRotateAngle);
                value.Init(graphicRequest);
                GraphicDatabase.allGraphics.Add(graphicRequest, value);
            }
            return(value);
        }
Ejemplo n.º 4
0
 public static void Prefix(Thing __instance, Graphic __result, ref Graphic ___graphicInt)
 {
     if (__instance != null)
     {
         if (___graphicInt == null)
         {
             Graphic Graphic = __instance.def.graphicData?.Graphic;
             if (Graphic != null && Graphic is Graphic_RandomRotated R && R != null)
             {
                 Graphic innerGraphic          = AG_Thing_get_DefaultGraphic_CompAdvancedGraphic_Patch.subgraphic.GetValue(Graphic) as Graphic;
                 Graphic_SingleQuality quality = innerGraphic as Graphic_SingleQuality;
                 //    Graphic_SingleQuality quality = R.ExtractInnerGraphicFor(__instance) as Graphic_SingleQuality;
                 if (quality != null)
                 {
                     ___graphicInt = new Graphic_RandomRotated(quality.QualityGraphicFor(__instance), 35f);
                 }
                 else
                 {
                     Graphic_SingleRandomized randomized = innerGraphic as Graphic_SingleRandomized;
                     //    Graphic_SingleRandomized randomized = R.ExtractInnerGraphicFor(__instance) as Graphic_SingleRandomized;
                     if (randomized != null)
                     {
                         ___graphicInt = new Graphic_RandomRotated(randomized.RandomGraphicFor(__instance), 35f);
                     }
                     else
                     {
                         Graphic_AdvancedSingle advancedSingle = innerGraphic as Graphic_AdvancedSingle;
                         if (advancedSingle != null)
                         {
                             CompAdvancedGraphic advancedWeaponGraphic = __instance.TryGetComp <CompAdvancedGraphic>();
                             if (advancedWeaponGraphic != null)
                             {
                                 advancedWeaponGraphic._graphic = advancedSingle.SubGraphicFor(__instance);
                                 //    Log.Message(__instance.LabelShortCap + " subGraphic = " + subGraphic.GetType() + " " + advancedWeaponGraphic._graphic.path);
                                 ___graphicInt = new Graphic_RandomRotated(advancedWeaponGraphic._graphic, 35f);
                             }
                         }
                     }
                 }
             }
         }
     }
 }