Ejemplo n.º 1
0
            public static void Postfix(ButtonMenuSideScreen __instance, GameObject new_target, List <ISidescreenButtonControl> ___targets)
            {
                if ((UnityEngine.Object)new_target == (UnityEngine.Object)null)
                {
                    Debug.LogError((object)"Invalid gameObject received");
                }
                else
                {
                    var buttonControl = new_target.GetComponent <ISidescreenButtonControl>();

                    if (buttonControl == null || !(buttonControl is Studyable))
                    {
                        return;
                    }
                    else if (((Studyable)buttonControl).Studied)
                    {
                        DestructibleWorkable destWorkable = ((Studyable)buttonControl).gameObject.GetComponent <DestructibleWorkable>();

                        if ((UnityEngine.Object)destWorkable == (UnityEngine.Object)null)
                        {
                            return;
                        }
                        else
                        {
                            ___targets = new List <ISidescreenButtonControl>();
                            ___targets.Add(destWorkable);
                            ___targets.AddRange(((Studyable)buttonControl).gameObject.GetComponents <DestructibleWorkable>());

                            Traverse.Create(__instance).Method("Refresh").GetValue();
                        }
                    }
                }
            }
Ejemplo n.º 2
0
            public static void Postfix(Geyser __instance)
            {
                if (__instance.GetType() != typeof(Geyser))
                {
                    DestructibleWorkable destWorkable = __instance.GetComponent <DestructibleWorkable>();

                    if ((UnityEngine.Object)destWorkable != (UnityEngine.Object)null)
                    {
                        UnityEngine.Object.Destroy(__instance.GetComponent <DestructibleWorkable>());
                    }

                    return;
                }
                else
                {
                    DestructibleWorkable destWorkable = __instance.FindOrAddComponent <DestructibleWorkable>();

                    int dTime = config.DeconstructTime;
                    if (dTime <= 0 || dTime > 10000)
                    {
                        LogManager.LogException("Deconstruct time is invalid (less than 0 or greater then 10000) in the config: " + dTime,
                                                new ArgumentException("DeconstructTime:" + dTime));
                    }
                    else if (dTime != 1800)
                    {
                        destWorkable.SetWorkTime(dTime);
                    }
                }
            }