using System; using System.Collections; using System.Collections.Generic; using System.IO; using UnityEngine; public class CameraMain : MonoBehaviour { private int CurrentScreenWidth { get { return (int)((float)Screen.width); } } private int CurrentScreenHeight { get { return (int)((float)Screen.height); } } private int CurrentAntialias { get { return QualitySettings.antiAliasing; } set { QualitySettings.antiAliasing = value; } } private bool CurrentFullScreen { get { return Screen.fullScreen; } } public virtual bool IsBloomEnabled { get { return this.m_gcBloom.enabled; } } public virtual bool IsFallThrough { get { return this.m_bFallThrough; } } protected virtual void Awake() { this.m_nBackCullingMask = this.camera.cullingMask; this.back_screen_size_.width = this.CurrentScreenWidth; this.back_screen_size_.height = this.CurrentScreenHeight; this.back_antialias_ = this.CurrentAntialias; this.back_full_screen_ = this.CurrentFullScreen; this.m_UOCamera = base.GetComponent(); NDebug.Assert(this.m_UOCamera != null, "メインカメラにはOrbitCameraが必要です。"); this.m_gcBloom = base.GetComponent(); NDebug.Assert(this.m_gcBloom != null, "メインカメラにはBloomが必要です。"); this.m_gcBlur = base.GetComponent(); NDebug.Assert(this.m_gcBlur != null, "メインカメラにはBlurが必要です。"); this.m_gcVignett = base.GetComponent(); NDebug.Assert(this.m_gcVignett != null, "メインカメラにはVignettが必要です。"); NDebug.Assert(this.m_FadeTargetCamera != null, "メインカメラにはフェード対象が必要です。"); this.m_FadeMyCamera = base.GetComponent(); NDebug.Assert(this.m_FadeMyCamera != null, "メインカメラ自身にフェード用ScreenOverlayが必要です。"); this.m_fBloomDefIntensity = this.m_gcBloom.bloomIntensity; this.m_fDefaultFieldOfView = this.camera.fieldOfView; this.m_fNearClipPlane = this.camera.nearClipPlane; this.m_fFarClipPlane = this.camera.farClipPlane; } public virtual void Start() { base.StartCoroutine(this.OnCalcMaidDistance()); } protected virtual void OnEnable() { UICamera.fallThrough = base.gameObject; } protected virtual void OnDisable() { UICamera.fallThrough = null; } protected virtual void OnHover(bool isOver) { this.m_bFallThrough = isOver; } public void Blur(bool f_bBlur) { if (this.m_gcBlur != null) { this.m_gcBlur.enabled = f_bBlur; } } public void Vignett(bool f_bVignett) { if (this.m_gcVignett != null) { this.m_gcVignett.enabled = f_bVignett; } } public virtual void OnLevelWasLoaded(int level) { RenderSettings.fog = false; } public void SetChaseCamera(Maid f_maid, string f_strAttachBone, Vector3 f_vWorldOffset, bool f_fOnece, float f_fTime) { this.RemoveChaseCameraAll(); if (f_maid.body0 == null) { Debug.LogError("SetChaseCamera メイドのBodyがまだ読まれていません。"); return; } Transform transform = CMT.SearchObjName(f_maid.body0.m_trBones, f_strAttachBone, true); if (transform != null) { CameraChase cameraChase = transform.gameObject.AddComponent(); cameraChase.StartChase(f_fOnece, f_fTime, f_vWorldOffset); } } public void RemoveChaseCameraAll() { GameObject characterAll = GameMain.Instance.CharacterMgr.CharacterAll; if (characterAll != null) { CameraChase[] componentsInChildren = characterAll.GetComponentsInChildren(true); for (int i = 0; i < componentsInChildren.Length; i++) { UnityEngine.Object.Destroy(componentsInChildren[i]); } } } public virtual void SetCameraMask(CameraMain.CameraMask f_eMask, bool f_bVisible) { if (f_bVisible) { this.camera.cullingMask |= 1 << (int)f_eMask; } else { this.camera.cullingMask &= ~(1 << (int)f_eMask); } } public virtual void CameraMaskReset() { this.camera.cullingMask = this.m_nBackCullingMask; } public virtual void SetCameraType(CameraMain.CameraType f_eType) { this.m_UOCamera.enabled = (f_eType == CameraMain.CameraType.Target); this.m_eCamType = f_eType; } public virtual CameraMain.CameraType GetCameraType() { return this.m_eCamType; } public virtual void SetControl(bool f_bEnable) { this.m_UOCamera.mouseControl = f_bEnable; } public virtual bool GetControl() { return this.m_UOCamera.mouseControl; } public virtual void SetTargetPos(Vector3 f_vecWorldPos, bool f_bSelf = true) { if (this.m_UOCamera != null) { if (f_bSelf) { iTween.StopAndSkipToEnd(base.gameObject); } this.m_UOCamera.SetTargetPos(f_vecWorldPos); } } public virtual Vector3 GetTargetPos() { if (this.m_UOCamera.target != null) { return this.m_UOCamera.target.position; } return default(Vector3); } public virtual void SetDistance(float f_fDistance, bool f_bSelf = true) { if (f_bSelf) { iTween.StopAndSkipToEnd(base.gameObject); } this.m_UOCamera.SetDistance(f_fDistance); } public virtual float GetDistance() { return this.m_UOCamera.distance; } public virtual void SetAroundAngle(Vector2 f_vecAngle, bool f_bSelf = true) { if (f_bSelf) { iTween.StopAndSkipToEnd(base.gameObject); } this.m_UOCamera.SetAroundAngle(f_vecAngle); } public virtual Vector2 GetAroundAngle() { return this.m_UOCamera.GetAroundAngle(); } public virtual void SetTargetOffset(Vector3 f_vOffs, bool is_animation) { this.m_UOCamera.SetOffset(f_vOffs, is_animation); } public virtual void SetPos(Vector3 f_vecWorldPos) { iTween.StopAndSkipToEnd(base.gameObject); base.transform.position = f_vecWorldPos; } public virtual void SetRotation(Vector3 f_vecWorldRot) { iTween.StopAndSkipToEnd(base.gameObject); base.transform.rotation = Quaternion.Euler(f_vecWorldRot); } public virtual void SetRealHeadPos(Vector3 f_vecWorldPos, bool f_bYFromFloor = false) { this.SetPos(f_vecWorldPos); } public virtual void SetRealHeadRot(Vector3 f_vecWorldRot, bool f_bRotYOnly = true) { this.SetRotation(f_vecWorldRot); } protected virtual float GetYfromFloor(Vector3 f_vPos) { return f_vPos.y + this.GetFloorPos(f_vPos).y; } public virtual Vector3 GetFloorPos(Vector3 f_vPos) { this.m_rayVRHitFloor.origin = f_vPos; this.m_rayVRHitFloor.direction = Vector3.down; if (Physics.Raycast(this.m_rayVRHitFloor, out this.m_hitVRFloor, float.PositiveInfinity, 512)) { return this.m_hitVRFloor.point; } this.m_rayVRHitFloor.origin = new Vector3(f_vPos.x, 100f, f_vPos.z); this.m_rayVRHitFloor.direction = Vector3.down; if (Physics.Raycast(this.m_rayVRHitFloor, out this.m_hitVRFloor, float.PositiveInfinity, 512)) { return this.m_hitVRFloor.point; } f_vPos.y = 0f; return f_vPos; } public virtual Vector3 GetPos() { return base.transform.position; } public virtual void SetFootPos(Vector3 f_vecFootPos, CameraMain.STAND_SIT f_eState) { float y; if (f_eState == CameraMain.STAND_SIT.STAND) { y = GameMain.Instance.CMSystem.VRCameraHeightStandOffs; } else if (f_eState == CameraMain.STAND_SIT.SIT) { y = GameMain.Instance.CMSystem.VRCameraHeightSitOffs; } else { y = this.GetYfromFloor(this.GetRealHeadTransform().position); } this.SetPos(f_vecFootPos + new Vector3(0f, y, 0f)); } public virtual Transform GetBaseHeadTransform() { return base.transform; } public virtual Transform GetRealHeadTransform() { return base.transform; } public virtual float GetHeightStandAndSit(CameraMain.STAND_SIT f_eState) { if (f_eState == CameraMain.STAND_SIT.STAND) { return GameMain.Instance.CMSystem.VRCameraHeightStandOffs; } if (f_eState == CameraMain.STAND_SIT.SIT) { return GameMain.Instance.CMSystem.VRCameraHeightSitOffs; } return 0f; } public virtual void SetFromScriptOnTarget(Vector3 f_vCenter, float f_fRadius, Vector2 f_vRotate) { NDebug.Assert(this.m_eCamType == CameraMain.CameraType.Target, "カメラモードはターゲットでなくてはいけません。"); iTween.StopAndSkipToEnd(base.gameObject); this.SetTargetPos(f_vCenter, true); this.SetDistance(f_fRadius, true); this.SetAroundAngle(f_vRotate, true); this.m_vCenter = f_vCenter; this.m_fRadius = f_fRadius; this.m_vRotate = f_vRotate; } public virtual void StartAnimationTo(bool f_bStart, Vector3 f_vSCenter, float f_fSRadius, Vector2 f_vSRotate, Vector3 f_vCenter, float f_fRadius, Vector2 f_vRotate, float f_fTime, string f_strEaseType, bool f_bSkip, float f_fDelay) { iTween.StopAndSkipToEnd(base.gameObject); iTween.EaseType easeType; if (string.IsNullOrEmpty(f_strEaseType)) { easeType = iTween.EaseType.linear; } else { easeType = (iTween.EaseType)Enum.Parse(typeof(iTween.EaseType), f_strEaseType); } Vector3 vector; float num; Vector2 vector2; if (!f_bStart) { vector = this.GetTargetPos(); num = this.GetDistance(); vector2 = this.GetAroundAngle(); } else { vector = f_vSCenter; num = f_fSRadius; vector2 = f_vSRotate; } this.m_bMoveSkip = f_bSkip; if (this.m_bMoveSkip && GameMain.Instance.IsForceSkip()) { this.SetTargetPos(f_vCenter, true); this.SetDistance(f_fRadius, true); this.SetAroundAngle(f_vRotate, true); this.m_vCenter = f_vCenter; this.m_fRadius = f_fRadius; this.m_vRotate = f_vRotate; } else { iTween.ValueTo(base.gameObject, iTween.Hash(new object[] { "easetype", easeType, "from", vector, "to", f_vCenter, "time", f_fTime, "delay", f_fDelay, "onUpdate", "UpdateCamTgt", "onComplete", "CompleteCam" })); iTween.ValueTo(base.gameObject, iTween.Hash(new object[] { "easetype", easeType, "from", num, "to", f_fRadius, "time", f_fTime, "delay", f_fDelay, "onUpdate", "UpdateCamDistance", "onComplete", "CompleteCam" })); iTween.ValueTo(base.gameObject, iTween.Hash(new object[] { "easetype", easeType, "from", vector2, "to", f_vRotate, "time", f_fTime, "delay", f_fDelay, "onUpdate", "UpdateCamAngle", "onComplete", "CompleteCam" })); } } public virtual void UpdateCamTgt(Vector3 f_vValue) { this.SetTargetPos(f_vValue, false); this.m_vCenter = f_vValue; } public virtual void UpdateCamDistance(float f_vValue) { this.SetDistance(f_vValue, false); this.m_fRadius = f_vValue; } public virtual void UpdateCamAngle(Vector2 f_vAngle) { this.SetAroundAngle(f_vAngle, false); this.m_vRotate = f_vAngle; } public virtual void CompleteCam() { } public virtual void ResetFromScriptOnTarget() { NDebug.Assert(this.m_eCamType == CameraMain.CameraType.Target, "カメラモードはターゲットでなくてはいけません。"); iTween.StopAndSkipToEnd(base.gameObject); this.SetTargetPos(this.m_vCenter, true); this.SetDistance(this.m_fRadius, true); this.SetAroundAngle(this.m_vRotate, true); } public virtual void Reset(CameraMain.CameraType f_eType, bool f_bControl) { iTween.StopAndSkipToEnd(base.gameObject); base.transform.parent.transform.position = new Vector3(0f, 1.61f, 0f); this.CameraMaskReset(); this.SetCameraType(f_eType); this.SetControl(f_bControl); this.SetTargetOffset(Vector3.zero, true); this.Blur(false); this.Vignett(false); this.RemoveChaseCameraAll(); this.FadeInNoUI(0f, true); if (this.camera != null) { this.camera.fieldOfView = this.m_fDefaultFieldOfView; this.camera.nearClipPlane = this.m_fNearClipPlane; this.camera.farClipPlane = this.m_fFarClipPlane; } if (f_eType == CameraMain.CameraType.Target) { this.SetTargetPos(new Vector3(0f, 1.5f, 0f), true); if (this.m_UOCamera != null) { this.m_UOCamera.SetAroundAngle(new Vector2(180f, 10f)); this.m_UOCamera.SetDistance(2f); } } else if (f_eType == CameraMain.CameraType.Free) { this.SetPos(new Vector3(0f, 1.5f, 2f)); this.SetRotation(new Vector3(10f, -180f, 0f)); } } public bool IsFadeProcNoUI() { return this.m_eMyFadeState != CameraMain.FadeState.Non && this.m_eMyFadeState != CameraMain.FadeState.Out; } public virtual void FadeOutNoUI(float f_fTime = 0.5f, bool f_bSkipable = true) { this.m_fMyFadeSkipable = f_bSkipable; if (this.m_eMyFadeState == CameraMain.FadeState.Out || this.m_eMyFadeState == CameraMain.FadeState.ProcOut) { return; } if (this.m_eMyFadeState == CameraMain.FadeState.ProcIn) { base.StopCoroutine(this.m_MyFadeRoutineIn); } this.m_FadeMyCamera.enabled = true; this.m_FadeMyCamera.intensity = 1f; this.m_fMyFadeTime = f_fTime; if (this.m_fMyFadeSkipable) { this.m_fMyFadeTime *= GameMain.Instance.CMSystem.FadeSpeedRate; if (GameMain.Instance.IsForceSkip()) { this.m_fMyFadeTime = 0f; } } if (this.m_fMyFadeTime < 0.001f) { this.m_eMyFadeState = CameraMain.FadeState.Out; this.m_FadeMyCamera.intensity = 0f; } else { this.m_eMyFadeState = CameraMain.FadeState.ProcOut; base.StartCoroutine(this.m_MyFadeRoutineOut = this.CoMyFadeOut()); } } private IEnumerator CoMyFadeOut() { this.m_fMyFadeNow = 0f; yield return null; while ((this.m_fMyFadeNow += Time.deltaTime) < this.m_fMyFadeTime) { this.m_eMyFadeState = CameraMain.FadeState.ProcOut; this.m_FadeMyCamera.enabled = true; this.m_FadeMyCamera.intensity = 1f - this.m_fMyFadeNow / this.m_fMyFadeTime; if (this.m_fMyFadeSkipable && GameMain.Instance.IsForceSkip()) { break; } yield return null; } this.m_FadeMyCamera.enabled = true; this.m_FadeMyCamera.intensity = 0f; this.m_eMyFadeState = CameraMain.FadeState.Out; yield break; } public virtual void FadeInNoUI(float f_fTime = 0.5f, bool f_bSkipable = true) { this.m_fMyFadeSkipable = f_bSkipable; if (this.m_eMyFadeState == CameraMain.FadeState.Non || this.m_eMyFadeState == CameraMain.FadeState.ProcIn) { return; } if (this.m_eMyFadeState == CameraMain.FadeState.ProcOut) { base.StopCoroutine(this.m_MyFadeRoutineOut); } this.m_FadeMyCamera.enabled = true; this.m_FadeMyCamera.intensity = 0f; this.m_fMyFadeTime = f_fTime; if (this.m_fMyFadeSkipable) { this.m_fMyFadeTime *= GameMain.Instance.CMSystem.FadeSpeedRate; if (GameMain.Instance.IsForceSkip()) { this.m_fMyFadeTime = 0f; } } if (this.m_fMyFadeTime < 0.001f) { this.m_eMyFadeState = CameraMain.FadeState.Non; this.m_FadeMyCamera.enabled = false; this.m_FadeMyCamera.intensity = 1f; } else { this.m_eMyFadeState = CameraMain.FadeState.ProcIn; base.StartCoroutine(this.m_MyFadeRoutineIn = this.CoMyFadeIn()); } } private IEnumerator CoMyFadeIn() { this.m_fMyFadeNow = 0f; yield return null; while ((this.m_fMyFadeNow += Time.deltaTime) < this.m_fMyFadeTime) { this.m_eMyFadeState = CameraMain.FadeState.ProcIn; this.m_FadeMyCamera.enabled = true; this.m_FadeMyCamera.intensity = this.m_fMyFadeNow / this.m_fMyFadeTime; if (this.m_fMyFadeSkipable && GameMain.Instance.IsForceSkip()) { break; } yield return null; } this.m_FadeMyCamera.enabled = false; this.m_FadeMyCamera.intensity = 1f; this.m_eMyFadeState = CameraMain.FadeState.Non; yield break; } public bool IsFadeProc() { return this.m_eFadeState != CameraMain.FadeState.Non && this.m_eFadeState != CameraMain.FadeState.Out; } public bool IsFadeOut() { return this.m_eFadeState != CameraMain.FadeState.Non; } public CameraMain.FadeState GetFadeState() { return this.m_eFadeState; } public bool IsFadeStateNon() { return this.m_eFadeState == CameraMain.FadeState.Non; } public void FadeOut(float f_fTime = 0.5f, bool f_bUIEnable = false, CameraMain.dgOnCompleteFade f_dg = null, bool f_bSkipable = true, Color f_color = default(Color)) { this.m_fFadeSkipable = f_bSkipable; if (this.m_eFadeState == CameraMain.FadeState.Out || this.m_eFadeState == CameraMain.FadeState.ProcOut) { return; } this.m_fFadeColor = f_color; if (this.m_eFadeState == CameraMain.FadeState.ProcIn) { base.StopCoroutine(this.m_FadeRoutineIn); this.CompleteFadeIn(); } this.OnOverlayState(true); this.OnProcessFade(1f); this.m_fFadeTime = f_fTime; if (this.m_fFadeSkipable) { this.m_fFadeTime *= GameMain.Instance.CMSystem.FadeSpeedRate; if (GameMain.Instance.IsForceSkip()) { this.m_fFadeTime = 0f; } } UICamera.InputEnable = f_bUIEnable; if (f_dg != null) { this.m_dgOnCompleteFadeOut = (CameraMain.dgOnCompleteFade)Delegate.Combine(this.m_dgOnCompleteFadeOut, f_dg); } if (this.m_fFadeTime <= 0.001f) { this.CompleteFadeOut(); } else { this.m_eFadeState = CameraMain.FadeState.ProcOut; base.StartCoroutine(this.m_FadeRoutineOut = this.CoFadeOut()); } } private IEnumerator CoFadeOut() { this.m_fFadeNow = 0f; yield return null; while ((this.m_fFadeNow += Time.deltaTime) < this.m_fFadeTime) { this.m_eFadeState = CameraMain.FadeState.ProcOut; this.OnOverlayState(true); this.OnProcessFade(1f - this.m_fFadeNow / this.m_fFadeTime); if (this.m_fFadeSkipable && GameMain.Instance.IsForceSkip()) { break; } yield return null; } this.CompleteFadeOut(); yield break; } private void CompleteFadeOut() { this.OnOverlayState(true); this.OnProcessFade(0f); this.m_eFadeState = CameraMain.FadeState.Out; if (this.m_dgOnCompleteFadeOut != null && this.m_dgOnCompleteFadeOut.GetInvocationList() != null && this.m_dgOnCompleteFadeOut.GetInvocationList().Length != 0) { this.m_dgOnCompleteFadeOut(); this.m_dgOnCompleteFadeOut = new CameraMain.dgOnCompleteFade(this.Dummy); } } public void FadeIn(float f_fTime = 0.5f, bool f_bUIEnable = false, CameraMain.dgOnCompleteFade f_dg = null, bool f_bSkipable = true, bool f_bColorIsSameOut = true, Color f_color = default(Color)) { this.m_fFadeSkipable = f_bSkipable; if (this.m_eFadeState == CameraMain.FadeState.Non || this.m_eFadeState == CameraMain.FadeState.ProcIn) { return; } if (!f_bColorIsSameOut) { this.m_fFadeColor = f_color; } if (this.m_eFadeState == CameraMain.FadeState.ProcOut) { base.StopCoroutine(this.m_FadeRoutineOut); this.CompleteFadeOut(); } this.OnOverlayState(true); this.OnProcessFade(0f); this.m_fFadeTime = f_fTime; if (this.m_fFadeSkipable) { this.m_fFadeTime *= GameMain.Instance.CMSystem.FadeSpeedRate; if (GameMain.Instance.IsForceSkip()) { this.m_fFadeTime = 0f; } } UICamera.InputEnable = f_bUIEnable; if (f_dg != null) { this.m_dgOnCompleteFadeIn = (CameraMain.dgOnCompleteFade)Delegate.Combine(this.m_dgOnCompleteFadeIn, f_dg); } if (f_fTime <= 0.001f) { this.CompleteFadeIn(); } else { this.m_eFadeState = CameraMain.FadeState.ProcIn; base.StartCoroutine(this.m_FadeRoutineIn = this.CoFadeIn()); this.OnStartFadeIn(); } } private IEnumerator CoFadeIn() { this.m_fFadeNow = 0f; yield return null; while ((this.m_fFadeNow += Time.deltaTime) < this.m_fFadeTime) { this.m_eFadeState = CameraMain.FadeState.ProcIn; this.OnOverlayState(true); this.OnProcessFade(this.m_fFadeNow / this.m_fFadeTime); if (this.m_fFadeSkipable && GameMain.Instance.IsForceSkip()) { break; } yield return null; } this.CompleteFadeIn(); yield break; } private void CompleteFadeIn() { this.OnOverlayState(false); this.OnProcessFade(1f); this.m_eFadeState = CameraMain.FadeState.Non; if (this.m_dgOnCompleteFadeIn != null && this.m_dgOnCompleteFadeIn.GetInvocationList() != null && this.m_dgOnCompleteFadeIn.GetInvocationList().Length != 0) { this.m_dgOnCompleteFadeIn(); this.m_dgOnCompleteFadeIn = new CameraMain.dgOnCompleteFade(this.Dummy); } UICamera.InputEnable = true; } private void Dummy() { } protected virtual float GetFadeIntensity() { return this.m_FadeTargetCamera.intensity; } protected virtual void OnProcessFade(float f_fIntensity) { this.m_FadeTargetCamera.intensity = f_fIntensity; this.m_FadeTargetCamera.color = this.m_fFadeColor; } protected virtual void OnOverlayState(bool f_bEnable) { this.m_FadeTargetCamera.enabled = f_bEnable; } protected virtual void OnStartFadeIn() { } protected virtual IEnumerator OnCalcMaidDistance() { for (;;) { if (this.m_bCalcNearClip) { float fMin = 25f; for (int nM = 0; nM < GameMain.Instance.CharacterMgr.GetMaidCount(); nM++) { Maid maid = GameMain.Instance.CharacterMgr.GetMaid(nM); if (maid != null && maid.Visible && maid.body0.isLoadedBody) { float sqrMagnitude = (maid.body0.Pelvis.position - base.transform.position).sqrMagnitude; if (fMin > sqrMagnitude) { fMin = sqrMagnitude; } } yield return null; } if (fMin < 9f) { this.camera.nearClipPlane = 0.01f; } else { this.camera.nearClipPlane = 0.1f; } } yield return null; } yield break; } protected virtual void Update() { if (this.m_gcBloom != null) { bool enabled = this.m_gcBloom.enabled; this.m_gcBloom.enabled = GameMain.Instance.CMSystem.Bloom; this.m_gcBloom.bloomIntensity = this.m_fBloomDefIntensity * (float)GameMain.Instance.CMSystem.BloomValue * 0.01f; if (this.m_gcBloom.bloomIntensity <= 0.01f) { this.m_gcBloom.enabled = false; } else { this.m_gcBloom.enabled = true; } if (this.m_gcBloom.enabled != enabled) { GameMain.Instance.BroadcastMessage("OnChangeScreenSizeOrAA", SendMessageOptions.DontRequireReceiver); } } if (!this.changeing_ && (this.back_screen_size_.width != this.CurrentScreenWidth || this.back_screen_size_.height != this.CurrentScreenHeight || this.back_antialias_ != this.CurrentAntialias || this.back_full_screen_ != this.CurrentFullScreen)) { this.back_screen_size_.width = this.CurrentScreenWidth; this.back_screen_size_.height = this.CurrentScreenHeight; this.back_antialias_ = this.CurrentAntialias; this.back_full_screen_ = this.CurrentFullScreen; if (!GameMain.Instance.VRMode || GameMain.Instance.VRDummyMode) { GameMain.Instance.BroadcastMessage("OnChangeScreenSizeOrAA", SendMessageOptions.DontRequireReceiver); Screen.SetResolution(Screen.width, Screen.height, Screen.fullScreen); base.StartCoroutine(this.ResumeNguiRoot()); } } if ((Input.GetKey(KeyCode.LeftShift) || Input.GetKey(KeyCode.RightShift)) && (Input.GetKeyDown(KeyCode.S) || Input.GetKeyDown(KeyCode.SysReq)) && !this.screen_shot_normal_) { this.screen_shot_normal_ = true; base.StartCoroutine(this.SaveScreenShotNormal()); } if ((Input.GetKey(KeyCode.LeftAlt) || Input.GetKey(KeyCode.RightAlt)) && (Input.GetKeyDown(KeyCode.S) || Input.GetKeyDown(KeyCode.SysReq)) && !this.screen_shot_noui_) { this.screen_shot_noui_ = true; base.StartCoroutine(this.SaveScreenShotNoUI()); } if (GameMain.Instance.IsForceSkip() && this.m_bMoveSkip) { iTween.StopAndSkipToEnd(base.gameObject); } } private IEnumerator ResumeNguiRoot() { Debug.Log("ResumeNguiRoot Start"); this.changeing_ = true; this.CurrentAntialias = 0; yield return null; UILabel.OnFontTextureChanged(); this.CurrentAntialias = this.back_antialias_; Debug.Log("ResumeNguiRoot End"); this.changeing_ = false; yield break; } private void UIHide() { NDebug.Assert(!this.hide_ui_, "UIを表示した状態から非表示にして下さい。"); this.ui_cam_hide_list_.Clear(); UICamera[] array = NGUITools.FindActive(); foreach (UICamera uicamera in array) { Camera component = uicamera.GetComponent(); if (component.enabled) { UIRoot uiroot = NGUITools.FindInParents(uicamera.gameObject); if (!(uiroot == null)) { UIPanel component2 = uiroot.GetComponent(); if (!(component2 == null)) { if (0 > component2.name.ToLower().IndexOf("fix") && 0f < component2.alpha) { component2.alpha = 0f; this.ui_cam_hide_list_.Add(uicamera); } } } } } this.ui_hide_object_list_.Clear(); GameObject gameObject = GameObject.Find("WorldTransformAxisParent"); if (gameObject != null) { Transform transform = gameObject.transform; for (int j = 0; j < transform.childCount; j++) { if (transform.gameObject.activeSelf) { transform.gameObject.SetActive(true); this.ui_hide_object_list_.Add(transform.gameObject); } } gameObject.SetActive(false); } GizmoRender.UIVisible = false; this.hide_ui_ = true; } private void UIResume() { NDebug.Assert(this.hide_ui_, "UIを非表示にしてから表示して下さい。"); foreach (UICamera uicamera in this.ui_cam_hide_list_) { Camera component = uicamera.GetComponent(); UIRoot uiroot = NGUITools.FindInParents(uicamera.gameObject); if (!(uiroot == null)) { UIPanel component2 = uiroot.GetComponent(); if (component2 != null) { component2.alpha = 1f; } } } this.ui_cam_hide_list_.Clear(); for (int i = 0; i < this.ui_hide_object_list_.Count; i++) { this.ui_hide_object_list_[i].SetActive(true); } this.ui_hide_object_list_.Clear(); GizmoRender.UIVisible = true; this.hide_ui_ = false; } public void ScreenShot(bool f_bNoUI) { this.custom_screenshot_ = false; if (f_bNoUI) { base.StartCoroutine(this.SaveScreenShotNoUI()); } else { base.StartCoroutine(this.SaveScreenShotNormal()); } } public void ScreenShot(string file_path, int super_size, bool no_ui_mode) { this.custom_screenshot_ = true; this.custom_screenshot_save_file_path_ = file_path; this.custom_screenshot_super_size_ = super_size; if (no_ui_mode) { base.StartCoroutine(this.SaveScreenShotNoUI()); } else { base.StartCoroutine(this.SaveScreenShotNormal()); } } protected IEnumerator SaveScreenShotNormal() { yield return new WaitForEndOfFrame(); int super_size = this.ss_super_size_[(int)GameMain.Instance.CMSystem.ScreenShotSuperSize]; string file_path = this.GetTimeFileName(); if (this.custom_screenshot_) { file_path = this.custom_screenshot_save_file_path_; super_size = this.custom_screenshot_super_size_; } Application.CaptureScreenshot(file_path, super_size); yield return new WaitForEndOfFrame(); this.screen_shot_normal_ = false; yield break; } protected IEnumerator SaveScreenShotNoUI() { this.UIHide(); yield return new WaitForEndOfFrame(); int super_size = this.ss_super_size_[(int)GameMain.Instance.CMSystem.ScreenShotSuperSize]; string file_path = this.GetTimeFileName(); if (this.custom_screenshot_) { file_path = this.custom_screenshot_save_file_path_; super_size = this.custom_screenshot_super_size_; } Application.CaptureScreenshot(file_path, super_size); yield return new WaitForEndOfFrame(); this.UIResume(); this.screen_shot_noui_ = false; yield break; } private string GetTimeFileName() { string str = UTY.gameProjectPath + "\\"; string text = str + "ScreenShot"; if (!Directory.Exists(text)) { Directory.CreateDirectory(text); } return text + "\\img" + DateTime.Now.ToString("yyyyMMddHHmmss") + ".png"; } public Camera camera { get { if (this.camera_ == null) { this.camera_ = base.GetComponent(); } return this.camera_; } } private CameraMain.CameraType m_eCamType; protected int m_nBackCullingMask; protected UltimateOrbitCamera m_UOCamera; public FadeInAndFadeOutOnGUI m_FadeTargetCamera; private ScreenOverlay m_FadeMyCamera; private Bloom m_gcBloom; private Blur m_gcBlur; private Vignetting m_gcVignett; public bool m_bCalcNearClip = true; protected float m_fDefaultFieldOfView; protected float m_fNearClipPlane; protected float m_fFarClipPlane; protected bool m_bMoveSkip; protected float m_fBloomDefIntensity = 2.85f; protected Ray m_rayVRHitFloor = default(Ray); protected RaycastHit m_hitVRFloor = default(RaycastHit); protected bool m_bFallThrough; protected CameraMain.FadeState m_eMyFadeState; private bool m_fMyFadeSkipable; private float m_fMyFadeNow; private float m_fMyFadeTime; private IEnumerator m_MyFadeRoutineOut; private IEnumerator m_MyFadeRoutineIn; protected CameraMain.FadeState m_eFadeState; private bool m_fFadeSkipable; protected CameraMain.dgOnCompleteFade m_dgOnCompleteFadeOut; protected CameraMain.dgOnCompleteFade m_dgOnCompleteFadeIn; private float m_fFadeNow; private float m_fFadeTime; private IEnumerator m_FadeRoutineOut; private IEnumerator m_FadeRoutineIn; private Color m_fFadeColor = Color.black; private int[] ss_super_size_ = new int[] { 1, 2, 4 }; private int back_antialias_; private bool back_full_screen_; private bool changeing_; private CameraMain.TexSize back_screen_size_; protected bool screen_shot_noui_; protected bool screen_shot_normal_; private List ui_cam_hide_list_ = new List(); private List ui_hide_object_list_ = new List(); private bool hide_ui_; private Camera camera_; protected Vector3 m_vCenter = new Vector3(0f, 1.5f, 0f); protected float m_fRadius = 2f; protected Vector2 m_vRotate = new Vector2(180f, 10f); private bool custom_screenshot_; private string custom_screenshot_save_file_path_; private int custom_screenshot_super_size_; public enum CameraType { Target, Free } public enum CameraMask { Character = 10, BG = 20, OvrTouchLookObj = 19 } public enum STAND_SIT { NON, STAND, SIT } public enum FadeState { Non, ProcIn, ProcOut, Out } public delegate void dgOnCompleteFade(); private struct TexSize { public int width; public int height; } }