// EXECUTABLE: ---------------------------------------------------------------------------- public override bool InstantExecute(GameObject target, IAction[] actions, int index) { GameObject go = GameObject.Find("MiniMapCamera"); if (mapcanvas != null) { mapcanvas.SetActive(false); } if (go) { img = null; targetCamera = null; renderTexture = null; Destroy(go.gameObject); } if (usePlayer) { player = HookPlayer.Instance.Get <PlayerCharacter>(); } else { objecttransform = objectTransform.GetComponent <Transform>(); } fullscreen = mapManager.GetComponent <MapManager>(); fullscreen.miniMapshowing = true; fullscreen.fullMapshowing = false; fullscreen.switchCams(); if (renderTexture == null) { rt = (RectTransform)rawImage.transform; renderTexture = new RenderTexture((int)rt.rect.width, (int)rt.rect.height, 32); renderTexture.Create(); } if (img == null) { img = rawImage.gameObject.GetComponent <RawImage>(); img.texture = renderTexture; } if (targetCamera == null) { GameObject cameraMinimap = new GameObject(); targetCamera = cameraMinimap.AddComponent <Camera>(); targetCamera.enabled = false; targetCamera.cullingMask = this.cullingMask; targetCamera.useOcclusionCulling = occlusionCulling; targetCamera.allowHDR = true; targetCamera.allowMSAA = true; targetCamera.allowDynamicResolution = true; targetCamera.targetTexture = renderTexture; targetCamera.orthographic = true; targetCamera.orthographicSize = cameraSize; targetCamera.name = "MiniMapCamera"; if (usePlayer) { cameraMinimap.transform.parent = player.transform; targetCamera.transform.position = new Vector3(player.transform.position.x, player.transform.position.y + cameraDistance, player.transform.position.z); targetCamera.transform.LookAt(player.transform); } else { cameraMinimap.transform.parent = objecttransform; targetCamera.transform.position = new Vector3(objecttransform.position.x, objecttransform.position.y + cameraDistance, objecttransform.position.z); targetCamera.transform.LookAt(objecttransform); } targetCamera.transform.localRotation = Quaternion.Euler(90.0f, 0.0f, 0.0f); targetCamera.Render(); } RectTransform parentCanvas = mapPanel.GetComponentInParent <Canvas>().GetComponent <RectTransform>(); m_RectTransform = mapPanel.GetComponent <RectTransform>(); m_RectTransform.localScale += new Vector3(0, 0, 0); mmwidth = m_RectTransform.rect.width; if (resized == true) { m_RectTransform.localScale += new Vector3(resizeamount.GetValue(target), resizeamount.GetValue(target), 0); mmwidth = (m_RectTransform.rect.width * (resizeamount.GetValue(target) + 1)); } else { m_RectTransform.localScale += new Vector3(0, 0, 0); mmwidth = (m_RectTransform.rect.width * (0 + 1)); } switch (mapPosition) { case MAPPOSITION.BottomLeft: m_RectTransform.anchoredPosition = new Vector3(mmoffsetx, mmoffsety); fullscreen.minimapPosition = MapManager.MINIMAPPOSITION.BottomLeft; break; case MAPPOSITION.TopLeft: m_RectTransform.anchoredPosition = new Vector3(mmoffsetx, parentCanvas.rect.height - (mmwidth + mmoffsety)); fullscreen.minimapPosition = MapManager.MINIMAPPOSITION.TopLeft; break; case MAPPOSITION.TopRight: m_RectTransform.anchoredPosition = new Vector3(parentCanvas.rect.width - (mmwidth + mmoffsetx), parentCanvas.rect.height - (mmwidth + mmoffsety)); fullscreen.minimapPosition = MapManager.MINIMAPPOSITION.TopRight; break; case MAPPOSITION.BottomRight: m_RectTransform.anchoredPosition = new Vector3(parentCanvas.rect.width - (mmwidth + mmoffsetx), mmoffsety); fullscreen.minimapPosition = MapManager.MINIMAPPOSITION.BottomRight; break; } if (mapMarkers == true) { foreach (GameObject gameObj in Resources.FindObjectsOfTypeAll <GameObject>()) { if (gameObj.name == "MapMarkerImage") { gameObj.transform.localScale = new Vector3(markerSize, markerSize, markerSize); gameObj.SetActive(showMarkers); } } } if (rotating == false) { mapPanel.GetComponentInChildren <FrameRotate>().rotating = false; } else { mapPanel.GetComponentInChildren <FrameRotate>().rotating = true; } mapPanel.SetActive(true); return(true); }
// EXECUTABLE: ---------------------------------------------------------------------------- public override bool InstantExecute(GameObject target, IAction[] actions, int index) { GameObject go = GameObject.Find("MiniMapCamera"); if (go) { img = null; targetCamera = null; renderTexture = null; Destroy(go.gameObject); } player = HookPlayer.Instance.Get <PlayerCharacter>(); fullscreen = mapManager.GetComponent <MapManager>(); fullscreen.miniMapshowing = false; fullscreen.fullMapshowing = true; fullscreen.miniMapscrollWheel = zoomMap; fullscreen.miniMapscrollWheelSpeed = zoomSensitivity; fullscreen.miniMapmouseDrag = dragMap; fullscreen.miniMapDragButton = dragbutton; fullscreen.miniMapDragSpeed = dragspeed; fullscreen.switchCams(); if (renderTexture != null) { renderTexture.Release(); rt = (RectTransform)rawImage.transform; renderTexture = new RenderTexture((int)Screen.width, (int)Screen.height, 32); renderTexture.Create(); } if (img == null) { img = rawImage.gameObject.GetComponent <RawImage>(); img.texture = renderTexture; } m_RectTransform = mapPanel.GetComponent <RectTransform>(); m_RectTransform.localScale += new Vector3(0, 0, 0); mmwidth = m_RectTransform.rect.width; if (mapPanel != null) { mapPanel.SetActive(false); } if (targetCamera == null) { GameObject cameraMinimap = new GameObject(); if (lockMap == false) { cameraMinimap.transform.parent = player.transform; } targetCamera = cameraMinimap.AddComponent <Camera>(); targetCamera.enabled = true; targetCamera.allowHDR = false; targetCamera.cullingMask = this.cullingMask; targetCamera.useOcclusionCulling = occlusionCulling; targetCamera.allowHDR = false; targetCamera.allowMSAA = false; targetCamera.allowDynamicResolution = false; targetCamera.targetTexture = renderTexture; targetCamera.orthographic = true; targetCamera.orthographicSize = cameraSize; targetCamera.name = "MiniMapCamera"; targetCamera.transform.LookAt(player.transform); targetCamera.transform.localRotation = Quaternion.Euler(90.0f, 0.0f, 0.0f); targetCamera.transform.position = new Vector3(player.transform.position.x, player.transform.position.y + cameraDistance, player.transform.position.z); if (centerMap == true) { if (mapCenter != null) { targetCamera.transform.position = new Vector3(mapCenter.transform.position.x, mapCenter.transform.position.y + cameraDistance, mapCenter.transform.position.z); } } } if (mapMarkers == true) { foreach (GameObject gameObj in Resources.FindObjectsOfTypeAll <GameObject>()) { if (gameObj.name == "MapMarkerImage") { gameObj.transform.localScale = new Vector3(markerSize, markerSize, markerSize); gameObj.SetActive(showMarkers); } } } if ((overlay == true) && (mapcanvas != null)) { if (overlayMap == true) { mapcanvas.SetActive(true); Canvas canvas = mapcanvas.gameObject.GetComponent <Canvas>(); canvas.renderMode = RenderMode.ScreenSpaceCamera; canvas.worldCamera = targetCamera; canvas.planeDistance = planedistance; } else { mapcanvas.SetActive(false); } } return(true); }