public override GameObject GetGameObject() { // Instantiate prefabs GameObject prefab = GameObject.Instantiate(this.GameObject); GameObject posterPrefab = GameObject.Instantiate(this.posterMagnetObj); // Get objects GameObject posterRootModel = posterPrefab.FindChild("model"); GameObject magnetModel = posterRootModel.FindChild("poster_kitty"); MeshRenderer magnetRenderer = magnetModel.GetComponent <MeshRenderer>(); GameObject posterBgModel = posterRootModel.FindChild("poster_background"); MeshRenderer posterBgRenderer = posterBgModel.GetComponent <MeshRenderer>(); GameObject posterBgBisModel = posterRootModel.FindChild("poster_background_bis"); MeshRenderer posterBgBisRenderer = posterBgBisModel.GetComponent <MeshRenderer>(); GameObject posterBgPivotModel = posterRootModel.FindChild("poster_background_pivot"); MeshRenderer posterBgPivotRenderer = posterBgPivotModel.GetComponent <MeshRenderer>(); Shader marmosetUber = Shader.Find("MarmosetUBER"); // Update poster border shader, normal/emission maps, hide parts of the prefab if (magnetRenderer != null && magnetRenderer.materials != null) { foreach (Material tmpMat in magnetRenderer.materials) { tmpMat.shader = marmosetUber; if (string.Compare(tmpMat.name, "poster_magnet (Instance)", true, CultureInfo.InvariantCulture) == 0) { tmpMat.SetTexture("_BumpMap", normal); tmpMat.SetTexture("_Illum", illum); tmpMat.EnableKeyword("MARMO_NORMALMAP"); // Enable normal map tmpMat.EnableKeyword("MARMO_EMISSION"); // Enable emission map tmpMat.EnableKeyword("_ZWRITE_ON"); // Enable Z write } } } if (posterBgBisRenderer != null && posterBgBisRenderer.materials != null) { foreach (Material tmpMat in posterBgBisRenderer.materials) { tmpMat.shader = marmosetUber; } } if (posterBgPivotRenderer != null && posterBgPivotRenderer.materials != null) { foreach (Material tmpMat in posterBgPivotRenderer.materials) { tmpMat.shader = marmosetUber; } } // Adjust poster bg position and scale posterBgPivotModel.transform.localPosition = new Vector3(posterBgPivotModel.transform.localPosition.x - 0.0101f, posterBgPivotModel.transform.localPosition.y - 0.00053f, posterBgPivotModel.transform.localPosition.z); posterBgPivotModel.transform.localScale = new Vector3(posterBgPivotModel.transform.localScale.x * 0.741f, posterBgPivotModel.transform.localScale.y, posterBgPivotModel.transform.localScale.z * 1.396f); posterBgBisModel.transform.localPosition = new Vector3(posterBgBisModel.transform.localPosition.x - 0.00005f, posterBgBisModel.transform.localPosition.y + 0.0006f, posterBgBisModel.transform.localPosition.z); posterBgBisModel.transform.localScale = new Vector3(posterBgBisModel.transform.localScale.x, posterBgBisModel.transform.localScale.y, posterBgBisModel.transform.localScale.z * 1.035f); // Set poster relative position posterPrefab.transform.parent = prefab.transform; posterPrefab.transform.localPosition = new Vector3(-0.002f, 0.289f, 0f); posterPrefab.transform.localScale = new Vector3(22.5f, 30.5f, 30.5f); posterPrefab.transform.localEulerAngles = new Vector3(0.0f, 0.0f, 0.0f); posterPrefab.SetActive(true); magnetRenderer.enabled = false; posterBgRenderer.enabled = false; posterBgBisRenderer.enabled = false; posterBgPivotRenderer.enabled = false; // Get prefab sub models GameObject model = prefab.FindChild("mesh"); GameObject screen = prefab.FindChild("Screen"); GameObject trigger = prefab.FindChild("Trigger"); // Adjust position from wall (except for poster) foreach (Transform tr in prefab.transform) { if (!tr.name.StartsWith("poster_decorations", true, CultureInfo.InvariantCulture)) { tr.localPosition = new Vector3(tr.localPosition.x, tr.localPosition.y, tr.localPosition.z + 0.005f); } } // Update prefab name prefab.name = this.ClassID; // Modify tech tag var techTag = prefab.GetComponent <TechTag>(); techTag.type = this.TechType; // Modify prefab identifier var prefabId = prefab.GetComponent <PrefabIdentifier>(); prefabId.ClassId = this.ClassID; // Rotate model model.transform.localEulerAngles = new Vector3(model.transform.localEulerAngles.x, model.transform.localEulerAngles.y, model.transform.localEulerAngles.z + 90.0f); // Adjust frame position model = prefab.FindChild("mesh"); model.transform.localPosition = new Vector3(model.transform.localPosition.x, model.transform.localPosition.y, model.transform.localPosition.z + 0.0055f); // Update box collider size BoxCollider collider = trigger.GetComponent <BoxCollider>(); collider.size = new Vector3(collider.size.x - 0.5f, collider.size.y - 0.5f, collider.size.z); // Rotate box collider collider.size = new Vector3(collider.size.y, collider.size.x, collider.size.z); // Translate collider collider.center = new Vector3(collider.center.x + 0.15f, collider.center.y, collider.center.z); // Update sky appliers SkyApplier skyapplier = model.GetComponent <SkyApplier>(); SkyApplier[] sa1 = prefab.GetComponents <SkyApplier>(); SkyApplier[] sa2 = prefab.GetComponentsInChildren <SkyApplier>(); if (sa1 != null) { foreach (SkyApplier sa in sa1) { if (sa != skyapplier) { UnityEngine.Object.Destroy(sa); } } } if (sa2 != null) { foreach (SkyApplier sa in sa2) { if (sa != skyapplier) { UnityEngine.Object.Destroy(sa); } } } skyapplier.renderers = prefab.GetComponentsInChildren <Renderer>(); skyapplier.anchorSky = Skies.Auto; //skyapplier.updaterIndex = 0; // Update contructable var constructible = prefab.GetComponent <Constructable>(); constructible.techType = this.TechType; constructible.placeMinDistance = 0.4f; PictureFrame pf = prefab.GetComponent <PictureFrame>(); // Rotate PictureFrame pf.imageRenderer.transform.localScale = new Vector3(pf.imageRenderer.transform.localScale.y, pf.imageRenderer.transform.localScale.x, pf.imageRenderer.transform.localScale.z); // Move PictureFrame pf.imageRenderer.transform.localPosition = new Vector3(pf.imageRenderer.transform.localPosition.x, pf.imageRenderer.transform.localPosition.y, pf.imageRenderer.transform.localPosition.z + 0.0045f); // Update constructable bounds var constructableBounds = prefab.GetComponent <ConstructableBounds>(); constructableBounds.bounds.extents = new Vector3(constructableBounds.bounds.extents.x * 0.7f, constructableBounds.bounds.extents.y * 0.4f, constructableBounds.bounds.extents.z); // Rotate constructable bounds constructableBounds.bounds.extents = new Vector3(constructableBounds.bounds.extents.y, constructableBounds.bounds.extents.x, constructableBounds.bounds.extents.z); // Adjust frame scale foreach (Transform tr in prefab.transform) { if (tr.name.StartsWith("mesh", true, CultureInfo.InvariantCulture)) { tr.localScale = new Vector3(tr.localScale.x, tr.localScale.y, tr.localScale.z + 0.002f); break; } } // Get origin frame scale and angles Vector3 originFrameScale = Vector3.zero; Vector3 originFramePosition = Vector3.zero; Vector3 originFrameEulerAngles = Vector3.zero; foreach (Transform tr in prefab.transform) { if (tr.name.StartsWith("mesh", true, CultureInfo.InvariantCulture)) { originFrameScale = tr.localScale; originFramePosition = tr.localPosition; originFrameEulerAngles = tr.localEulerAngles; break; } } // Get origin poster position, origin poster model position and scale, and origin magnet scale Vector3 originPosterPosition = Vector3.zero; Vector3 originPosterModelPosition = Vector3.zero; Vector3 originPosterModelScale = Vector3.zero; Vector3 originMagnetScale = Vector3.zero; foreach (Transform tr in prefab.transform) { if (tr.name.StartsWith("poster_decorations", true, CultureInfo.InvariantCulture)) { originPosterPosition = tr.localPosition; foreach (Transform ch in tr) { if (ch.name.StartsWith("model", true, CultureInfo.InvariantCulture)) { originPosterModelPosition = ch.localPosition; originPosterModelScale = ch.localScale; foreach (Transform chb in ch) { if (chb.name.StartsWith("poster_kitty", true, CultureInfo.InvariantCulture)) { originMagnetScale = chb.localScale; break; } } break; } } break; } } // Get origin image scale, origin collider size and origin constructable bounds extents Vector3 originImageScale = pf.imageRenderer.transform.localScale; Vector3 originColliderSize = collider.size; Vector3 originConstructableBoundsExtents = constructableBounds.bounds.extents; // Add CustomPictureFrame controller CustomPictureFrameController cpfController = prefab.AddComponent <CustomPictureFrameController>(); // Store origin values inside CPF controller cpfController.OriginFrameScale = originFrameScale; cpfController.OriginFramePosition = originFramePosition; cpfController.OriginFrameEulerAngles = originFrameEulerAngles; cpfController.OriginImageScale = originImageScale; cpfController.OriginColliderSize = originColliderSize; cpfController.OriginConstructableBoundsExtents = originConstructableBoundsExtents; cpfController.OriginPosterPosition = originPosterPosition; cpfController.OriginPosterModelPosition = originPosterModelPosition; cpfController.OriginPosterModelScale = originPosterModelScale; cpfController.OriginMagnetScale = originMagnetScale; // Adjust PictureFrame rendering distance (displays full image quality if player is closer than 20m) pf.distance = 20.0f; return(prefab); }
public override GameObject GetPrefab() { GameObject prefab = GameObject.Instantiate(this.GameObject); GameObject posterPrefab = GameObject.Instantiate(this.posterMagnetObj); // Update poster border shader, normal/emission maps, hide parts of the prefab GameObject posterModel = posterPrefab.FindChild("model").FindChild("poster_kitty"); MeshRenderer posterRenderer = posterModel.GetComponent <MeshRenderer>(); Shader marmosetUber = Shader.Find("MarmosetUBER"); foreach (Material tmpMat in posterRenderer.materials) { tmpMat.shader = marmosetUber; if (tmpMat.name.CompareTo("poster_magnet (Instance)") == 0) { tmpMat.SetTexture("_BumpMap", normal); tmpMat.SetTexture("_Illum", illum); tmpMat.EnableKeyword("MARMO_NORMALMAP"); // Enable normal map tmpMat.EnableKeyword("MARMO_EMISSION"); // Enable emission map } } posterPrefab.transform.parent = prefab.transform; posterPrefab.transform.localPosition = new Vector3(0.0f, 0.27f, -0.002f); posterPrefab.transform.localScale = new Vector3(34.0f, 34.0f, 34.0f); posterPrefab.transform.localEulerAngles = new Vector3(0.0f, 0.0f, 0.0f); posterPrefab.SetActive(true); posterRenderer.enabled = false; // Get prefab sub models GameObject model = prefab.FindChild("mesh"); GameObject screen = prefab.FindChild("Screen"); GameObject trigger = prefab.FindChild("Trigger"); // Update prefab name prefab.name = this.ClassID; // Modify tech tag var techTag = prefab.GetComponent <TechTag>(); techTag.type = this.TechType; // Modify prefab identifier var prefabId = prefab.GetComponent <PrefabIdentifier>(); prefabId.ClassId = this.ClassID; // Rotate model originEulerAngles = model.transform.localEulerAngles; model.transform.localEulerAngles = new Vector3(model.transform.localEulerAngles.x, model.transform.localEulerAngles.y, model.transform.localEulerAngles.z + 90.0f); // Update box collider BoxCollider collider = trigger.GetComponent <BoxCollider>(); collider.size = new Vector3(collider.size.x - 0.15f, collider.size.y - 0.15f, collider.size.z); originColliderSize = collider.size; // Rotate collider collider.size = new Vector3(collider.size.y, collider.size.x, collider.size.z); // Update sky applier var skyapplier = model.GetComponent <SkyApplier>(); Renderer[] renderers = prefab.GetComponentsInChildren <Renderer>(); skyapplier.renderers = renderers; skyapplier.anchorSky = Skies.Auto; // Update contructable var constructible = prefab.GetComponent <Constructable>(); constructible.techType = this.TechType; // Rotate PictureFrame PictureFrame pf = prefab.GetComponent <PictureFrame>(); originImageRendererScale = pf.imageRenderer.transform.localScale; pf.imageRenderer.transform.localScale = new Vector3(pf.imageRenderer.transform.localScale.y, pf.imageRenderer.transform.localScale.x, pf.imageRenderer.transform.localScale.z); // Update constructable bounds var constructableBounds = prefab.GetComponent <ConstructableBounds>(); constructableBounds.bounds.extents = new Vector3(constructableBounds.bounds.extents.x * 0.85f, constructableBounds.bounds.extents.y * 0.85f, constructableBounds.bounds.extents.z); originConstructableBoundsExtents = constructableBounds.bounds.extents; constructableBounds.bounds.extents = new Vector3(constructableBounds.bounds.extents.y, constructableBounds.bounds.extents.x, constructableBounds.bounds.extents.z); // Add CustomPictureFrame controller CustomPictureFrameController cpfController = prefab.AddComponent <CustomPictureFrameController>(); cpfController.OriginEulerAngles = this.originEulerAngles; cpfController.OriginColliderSize = this.originColliderSize; cpfController.OriginImageRendererScale = this.originImageRendererScale; cpfController.OriginConstructableBoundsExtents = this.originConstructableBoundsExtents; return(prefab); }
public static bool OnHandClick_Prefix(PictureFrame __instance, HandTargetEventData eventData) { if (!__instance.enabled) { return(true); } // If current item is one of our Customizable Picture Frame. if (__instance.gameObject.name.StartsWith("CustomPictureFrame(Clone)", true, CultureInfo.InvariantCulture)) { // Minimum CustomPictureFrame size = normal size / minSizeRatio float minSizeRatio = 4.0f; CustomPictureFrameController cpfController = __instance.gameObject.GetComponent <CustomPictureFrameController>(); GameObject frame = __instance.gameObject.FindChild("mesh"); GameObject poster = __instance.gameObject.FindChild("poster_decorations(Clone)"); GameObject posterModel = poster.FindChild("model"); GameObject magnetModel = posterModel.FindChild("poster_kitty"); MeshRenderer magnetRenderer = magnetModel.GetComponent <MeshRenderer>(); GameObject bgBisModel = posterModel.FindChild("poster_background_bis"); MeshRenderer bgBisRenderer = bgBisModel.GetComponent <MeshRenderer>(); GameObject bgPivotModel = posterModel.FindChild("poster_background_pivot"); MeshRenderer bgPivotRenderer = bgPivotModel.GetComponent <MeshRenderer>(); if (Input.GetKey(KeyCode.R)) { GameObject pictureFrame = frame.FindChild("submarine_Picture_Frame"); MeshRenderer frameRenderer = pictureFrame.GetComponent <MeshRenderer>(); // Rotate frame if (cpfController.Flipped) { frame.transform.localEulerAngles = new Vector3(frame.transform.localEulerAngles.x, frame.transform.localEulerAngles.y, frame.transform.localEulerAngles.z + 90f); } else { frame.transform.localEulerAngles = new Vector3(frame.transform.localEulerAngles.x, frame.transform.localEulerAngles.y, frame.transform.localEulerAngles.z - 90f); } // Adjust poster style if (!frameRenderer.enabled) { bgBisRenderer.enabled = !bgBisRenderer.enabled; bgPivotRenderer.enabled = !bgPivotRenderer.enabled; // Adjust magnet pos if (bgPivotRenderer.enabled) { magnetModel.transform.localPosition = new Vector3(0f, -0.0115f, 0f); } else { magnetModel.transform.localPosition = new Vector3(0f, 0f, 0f); } } else { bgBisRenderer.enabled = false; bgPivotRenderer.enabled = false; } // Toogle flip cpfController.Flipped = !cpfController.Flipped; // Rotate collider GameObject trigger = __instance.gameObject.FindChild("Trigger"); BoxCollider collider = trigger.GetComponent <BoxCollider>(); collider.size = new Vector3(collider.size.y, collider.size.x, collider.size.z); // Rotate image __instance.imageRenderer.transform.localScale = new Vector3(__instance.imageRenderer.transform.localScale.y, __instance.imageRenderer.transform.localScale.x, __instance.imageRenderer.transform.localScale.z); // Rotate constructable bounds extents var constructableBounds = __instance.gameObject.GetComponent <ConstructableBounds>(); constructableBounds.bounds.extents = new Vector3(constructableBounds.bounds.extents.y, constructableBounds.bounds.extents.x, constructableBounds.bounds.extents.z); // Refresh picture PictureFrameEnumHelper.SetStateMethod.Invoke(__instance, new object[] { PictureFrameEnumHelper.ThumbnailEnumValue }); PictureFrameEnumHelper.SetStateMethod.Invoke(__instance, new object[] { PictureFrameEnumHelper.FullEnumValue }); return(false); } else if (Input.GetKey(KeyCode.F)) { // Get objects. GameObject pictureFrame = frame.FindChild("submarine_Picture_Frame"); GameObject frameButton = pictureFrame.FindChild("submarine_Picture_Frame_button"); MeshRenderer frameRenderer = pictureFrame.GetComponent <MeshRenderer>(); MeshRenderer buttonRenderer = frameButton.GetComponent <MeshRenderer>(); GameObject bgModel = posterModel.FindChild("poster_background"); MeshRenderer bgRenderer = bgModel.GetComponent <MeshRenderer>(); // Switch frame style. if (frameRenderer.enabled) // If we're in picture frame mode, switch to poster mode. { // Disable picture frame frameRenderer.enabled = false; buttonRenderer.enabled = false; // Enable poster magnet magnetRenderer.enabled = true; bgRenderer.enabled = false; // Enable bg bis bgBisRenderer.enabled = !cpfController.Flipped; bgPivotRenderer.enabled = cpfController.Flipped; // Adjust magnet pos. if (cpfController.Flipped) { magnetModel.transform.localPosition = new Vector3(0f, -0.0115f, 0f); } else { magnetModel.transform.localPosition = new Vector3(0f, 0f, 0f); } // Adjust image pos. __instance.imageRenderer.transform.localPosition = new Vector3(__instance.imageRenderer.transform.localPosition.x, __instance.imageRenderer.transform.localPosition.y, __instance.imageRenderer.transform.localPosition.z - 0.0045f); // Display message to user. ErrorMessage.AddDebug("Picture Frame: Poster mode enabled."); } else if (magnetRenderer.enabled) // Else if we're in poster mode, switch to plain image mode. { // Disable picture frame frameRenderer.enabled = false; buttonRenderer.enabled = false; // Disable poster magnet and poster bg magnetRenderer.enabled = false; bgRenderer.enabled = false; // Enable bg bis bgBisRenderer.enabled = !cpfController.Flipped; bgPivotRenderer.enabled = cpfController.Flipped; // Display message to user. ErrorMessage.AddDebug("Picture Frame: No frame mode enabled."); } else // Else if we're if plain image mode, switch to picture frame mode. { // Enable picture frame frameRenderer.enabled = true; buttonRenderer.enabled = true; // Disable poster magnet and poster bg magnetRenderer.enabled = false; bgRenderer.enabled = false; // Disable bg bis bgBisRenderer.enabled = false; bgPivotRenderer.enabled = false; // Adjust image pos __instance.imageRenderer.transform.localPosition = new Vector3(__instance.imageRenderer.transform.localPosition.x, __instance.imageRenderer.transform.localPosition.y, __instance.imageRenderer.transform.localPosition.z + 0.0045f); // Display message to user. ErrorMessage.AddDebug("Picture Frame: Picture frame mode enabled."); } return(false); } else if (Input.GetKey(KeyCode.E)) { // CustomPictureFrame scale ratio step float scaleRatio = 1.05f; if (frame.transform.localScale.x >= 3.0f) { // Set minimum size frame.transform.localScale = new Vector3(cpfController.OriginFrameScale.x * (1.0f / minSizeRatio), cpfController.OriginFrameScale.y * (1.0f / minSizeRatio), cpfController.OriginFrameScale.z); poster.transform.localPosition = new Vector3(cpfController.OriginPosterPosition.x * (1.0f / minSizeRatio), cpfController.OriginPosterPosition.y * (1.0f / minSizeRatio), cpfController.OriginPosterPosition.z); posterModel.transform.localPosition = new Vector3(cpfController.OriginPosterModelPosition.x * (1.0f / minSizeRatio), cpfController.OriginPosterModelPosition.y * (1.0f / minSizeRatio), cpfController.OriginPosterModelPosition.z); posterModel.transform.localScale = new Vector3(cpfController.OriginPosterModelScale.x * (1.0f / minSizeRatio), cpfController.OriginPosterModelScale.y * (1.0f / minSizeRatio), cpfController.OriginPosterModelScale.z); __instance.imageRenderer.transform.localScale = new Vector3(cpfController.OriginImageScale.x * (1.0f / minSizeRatio), cpfController.OriginImageScale.y * (1.0f / minSizeRatio), cpfController.OriginImageScale.z * (1.0f / minSizeRatio)); magnetModel.transform.localScale = new Vector3(cpfController.OriginMagnetScale.x, (cpfController.OriginMagnetScale.y * (1.0f / minSizeRatio)) + 0.1f, cpfController.OriginMagnetScale.z); frame.transform.localPosition = new Vector3(cpfController.OriginFramePosition.x, cpfController.OriginFramePosition.y, cpfController.OriginFramePosition.z + 0.0001f); if (cpfController.Flipped) { #if DEBUG_CUSTOM_PICTURE_FRAME Logger.Log("DEBUG: ENTERING FLIPPED"); Logger.Log("DEBUG: BG BIS IS " + (bgBisRenderer.enabled ? "ENABLED" : "DISABLED")); Logger.Log("DEBUG: BG PIVOT IS " + (bgPivotRenderer.enabled ? "ENABLED" : "DISABLED")); #endif // Rotate image __instance.imageRenderer.transform.localScale = new Vector3(__instance.imageRenderer.transform.localScale.y, __instance.imageRenderer.transform.localScale.x, __instance.imageRenderer.transform.localScale.z); } #if DEBUG_CUSTOM_PICTURE_FRAME else { Logger.Log("DEBUG: ENTERING NOT FLIPPED"); Logger.Log("DEBUG: BG BIS IS " + (bgBisRenderer.enabled ? "ENABLED" : "DISABLED")); Logger.Log("DEBUG: BG PIVOT IS " + (bgPivotRenderer.enabled ? "ENABLED" : "DISABLED")); } #endif } else { // Increase size frame.transform.localScale = new Vector3(frame.transform.localScale.x * scaleRatio, frame.transform.localScale.y * scaleRatio, frame.transform.localScale.z); // *= scaleRatio; poster.transform.localPosition = new Vector3(poster.transform.localPosition.x, poster.transform.localPosition.y * scaleRatio, poster.transform.localPosition.z); posterModel.transform.localPosition = new Vector3(posterModel.transform.localPosition.x, posterModel.transform.localPosition.y * scaleRatio, posterModel.transform.localPosition.z); posterModel.transform.localScale = new Vector3(posterModel.transform.localScale.x * scaleRatio, posterModel.transform.localScale.y * scaleRatio, posterModel.transform.localScale.z); // *= scaleRatio; __instance.imageRenderer.transform.localScale = new Vector3(__instance.imageRenderer.transform.localScale.x * scaleRatio, __instance.imageRenderer.transform.localScale.y * scaleRatio, __instance.imageRenderer.transform.localScale.z * scaleRatio); //*= scaleRatio; magnetModel.transform.localScale = new Vector3(magnetModel.transform.localScale.x, magnetModel.transform.localScale.y * scaleRatio, magnetModel.transform.localScale.z); frame.transform.localPosition = new Vector3(frame.transform.localPosition.x, frame.transform.localPosition.y, frame.transform.localPosition.z * 1.0f); } // Refresh picture PictureFrameEnumHelper.SetStateMethod.Invoke(__instance, new object[] { PictureFrameEnumHelper.ThumbnailEnumValue }); PictureFrameEnumHelper.SetStateMethod.Invoke(__instance, new object[] { PictureFrameEnumHelper.FullEnumValue }); return(false); } else if (Input.GetKey(KeyCode.G)) { PrefabIdentifier id = __instance.gameObject.GetComponent <PrefabIdentifier>(); if (id != null) { cpfController.RandomImage = !cpfController.RandomImage; ErrorMessage.AddDebug("Picture Frame: Random mode " + (cpfController.RandomImage ? "enabled." : "disabled.")); PictureFrameEnumHelper.SetStateMethod.Invoke(__instance, new object[] { PictureFrameEnumHelper.NoneEnumValue }); __instance.fileName = null; if (cpfController.RandomImage) { cpfController.SetRandomImage(id, __instance); } } return(false); } else if (Input.GetKey(KeyCode.T)) { PrefabIdentifier id = __instance.gameObject.GetComponent <PrefabIdentifier>(); if (id != null) { //cpfController.Slideshow = !cpfController.Slideshow; ErrorMessage.AddDebug("Picture Frame: Slideshow mode " + (cpfController.Slideshow ? "disabled." : "enabled.")); if (cpfController.Slideshow) { cpfController.Slideshow = false; } else { PictureFrameEnumHelper.SetStateMethod.Invoke(__instance, new object[] { PictureFrameEnumHelper.NoneEnumValue }); __instance.fileName = null; cpfController.StartSlideshow(id, __instance); } } return(false); } } return(true); }