fix:1、修复bug
This commit is contained in:
@@ -9,7 +9,7 @@ namespace BallKingdomCrush
|
||||
#region Field
|
||||
|
||||
#if GAME_RELEASE
|
||||
public static bool IsEnabledEngineLog = true;
|
||||
public static bool IsEnabledEngineLog = false;
|
||||
#else
|
||||
public static bool IsEnabledEngineLog = true;
|
||||
#endif
|
||||
|
||||
@@ -1,148 +1,157 @@
|
||||
using FairyGUI;
|
||||
using UnityEngine;
|
||||
using UnityEngine.EventSystems;
|
||||
|
||||
namespace BallKingdomCrush
|
||||
{
|
||||
public sealed class CameraManager : BaseInterfaceManager<CameraManager>
|
||||
{
|
||||
public Transform mainCameraRoot;
|
||||
public GameObject mainCameraGo;
|
||||
public Camera mainCamera;
|
||||
|
||||
public Transform fguiCameraRoot;
|
||||
public GameObject fguiCameraGo;
|
||||
public Camera fguiCamera;
|
||||
|
||||
|
||||
public bool isEnabledWorldRaycast;
|
||||
public Physics2DRaycaster physics2DRaycaster;
|
||||
public PhysicsRaycaster physics3DRaycaster;
|
||||
|
||||
private bool isMainCameraShakeing;
|
||||
|
||||
#region Coordinate
|
||||
|
||||
public Vector2 WorldPosToFGUIPos(Vector3 worldPos)
|
||||
{
|
||||
Vector3 screenPos = mainCamera.WorldToScreenPoint(worldPos);
|
||||
|
||||
screenPos.y = ScreenConst.CurrResolution.y - screenPos.y;
|
||||
Vector2 pt = GRoot.inst.GlobalToLocal(screenPos);
|
||||
return pt;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Func
|
||||
|
||||
public void SetWorldRaycasterEnabled(bool enabled)
|
||||
{
|
||||
isEnabledWorldRaycast = enabled;
|
||||
if (physics2DRaycaster != null)
|
||||
{
|
||||
EventKit.Set2DRaycasterEnabled(physics2DRaycaster, isEnabledWorldRaycast);
|
||||
}
|
||||
|
||||
if (physics3DRaycaster != null)
|
||||
{
|
||||
EventKit.Set3DRaycasterEnabled(physics3DRaycaster, isEnabledWorldRaycast);
|
||||
}
|
||||
|
||||
AppDispatcher.Instance.Dispatch(AppMsg.WorldRaycast_EnableChange, isEnabledWorldRaycast);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Camera
|
||||
|
||||
public void CreateMainCamera()
|
||||
{
|
||||
if (mainCamera) return;
|
||||
|
||||
string name = "MainCamera";
|
||||
mainCameraGo = new GameObject(name);
|
||||
mainCameraGo.tag = name;
|
||||
mainCameraGo.layer = LayerMaskConst.Default;
|
||||
mainCameraGo.transform.localPosition = Vector3.zero;
|
||||
int cullingMask = LayerMask.GetMask(LayerMaskConst.Default_Name);
|
||||
mainCamera = CreateCamera(mainCameraGo, cullingMask: cullingMask);
|
||||
mainCamera.clearFlags = CameraClearFlags.SolidColor;
|
||||
|
||||
mainCamera.forceIntoRenderTexture = false;
|
||||
|
||||
GameObject root = new GameObject(name + "Root");
|
||||
root.transform.position = CameraConst.MainCameraPos;
|
||||
root.SetParent(AppObjConst.CameraGo);
|
||||
mainCameraGo.SetParent(root);
|
||||
mainCameraRoot = root.transform;
|
||||
|
||||
CameraAdaptive adaptiveCom = mainCamera.gameObject.AddComponent<CameraAdaptive>();
|
||||
adaptiveCom.DoAdaptive(isOrthographic: true, orthographicSize: ScreenConst.OrthographicSize_1280H);
|
||||
}
|
||||
|
||||
public void CreateFGUICamera()
|
||||
{
|
||||
if (fguiCamera) return;
|
||||
|
||||
StageCamera.CheckMainCamera();
|
||||
fguiCamera = StageCamera.main;
|
||||
fguiCamera.depth = CameraConst.UICameraDepth;
|
||||
|
||||
fguiCamera.forceIntoRenderTexture = false;
|
||||
fguiCameraGo = fguiCamera.gameObject;
|
||||
|
||||
GameObject root = new GameObject("FGUICameraRoot");
|
||||
root.transform.position = CameraConst.UICameraPos;
|
||||
root.SetParent(AppObjConst.CameraGo);
|
||||
fguiCameraGo.SetParent(root);
|
||||
fguiCameraRoot = root.transform;
|
||||
}
|
||||
|
||||
public Camera CreateCamera(GameObject cameraGo, int cullingMask)
|
||||
{
|
||||
Camera cameraCom = cameraGo.AddComponent<Camera>();
|
||||
cameraCom.clearFlags = CameraClearFlags.Depth;
|
||||
cameraCom.backgroundColor = Color.black;
|
||||
cameraCom.cullingMask = cullingMask;
|
||||
cameraCom.nearClipPlane = -30f;
|
||||
cameraCom.farClipPlane = 30f;
|
||||
cameraCom.rect = new Rect(0, 0, 1f, 1f);
|
||||
cameraCom.depth = CameraConst.MainDepth;
|
||||
cameraCom.renderingPath = RenderingPath.UsePlayerSettings;
|
||||
cameraCom.useOcclusionCulling = false;
|
||||
cameraCom.allowHDR = false;
|
||||
cameraCom.allowMSAA = false;
|
||||
cameraCom.orthographicSize = 9.6f;
|
||||
cameraCom.forceIntoRenderTexture = false;
|
||||
return cameraCom;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Mgr
|
||||
|
||||
public override void Init()
|
||||
{
|
||||
base.Init();
|
||||
InitCameraMgr();
|
||||
|
||||
CreateMainCamera();
|
||||
CreateFGUICamera();
|
||||
}
|
||||
|
||||
private void InitCameraMgr()
|
||||
{
|
||||
AppObjConst.CameraGo = new GameObject(AppObjConst.CameraGoName);
|
||||
AppObjConst.CameraGo.SetParent(AppObjConst.FrameGo);
|
||||
}
|
||||
|
||||
public override void Dispose()
|
||||
{
|
||||
base.Dispose();
|
||||
GeneralKit.Destroy(AppObjConst.CameraGo);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
using FairyGUI;
|
||||
using UnityEngine;
|
||||
using UnityEngine.EventSystems;
|
||||
|
||||
namespace BallKingdomCrush
|
||||
{
|
||||
public sealed class CameraManager : BaseInterfaceManager<CameraManager>
|
||||
{
|
||||
public Transform mainCameraRoot;
|
||||
public GameObject mainCameraGo;
|
||||
public Camera mainCamera;
|
||||
|
||||
public Transform fguiCameraRoot;
|
||||
public GameObject fguiCameraGo;
|
||||
public Camera fguiCamera;
|
||||
|
||||
|
||||
public bool isEnabledWorldRaycast;
|
||||
public Physics2DRaycaster physics2DRaycaster;
|
||||
public PhysicsRaycaster physics3DRaycaster;
|
||||
|
||||
private bool isMainCameraShakeing;
|
||||
|
||||
#region Coordinate
|
||||
|
||||
public Vector2 WorldPosToFGUIPos(Vector3 worldPos)
|
||||
{
|
||||
Vector3 screenPos = mainCamera.WorldToScreenPoint(worldPos);
|
||||
|
||||
screenPos.y = ScreenConst.CurrResolution.y - screenPos.y;
|
||||
Vector2 pt = GRoot.inst.GlobalToLocal(screenPos);
|
||||
return pt;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Func
|
||||
|
||||
public void SetWorldRaycasterEnabled(bool enabled)
|
||||
{
|
||||
isEnabledWorldRaycast = enabled;
|
||||
if (physics2DRaycaster != null)
|
||||
{
|
||||
EventKit.Set2DRaycasterEnabled(physics2DRaycaster, isEnabledWorldRaycast);
|
||||
}
|
||||
|
||||
if (physics3DRaycaster != null)
|
||||
{
|
||||
EventKit.Set3DRaycasterEnabled(physics3DRaycaster, isEnabledWorldRaycast);
|
||||
}
|
||||
|
||||
AppDispatcher.Instance.Dispatch(AppMsg.WorldRaycast_EnableChange, isEnabledWorldRaycast);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Camera
|
||||
|
||||
public void CreateMainCamera()
|
||||
{
|
||||
if (mainCamera) return;
|
||||
|
||||
string name = "MainCamera";
|
||||
mainCameraGo = new GameObject(name);
|
||||
mainCameraGo.tag = name;
|
||||
mainCameraGo.layer = LayerMaskConst.Default;
|
||||
mainCameraGo.transform.localPosition = Vector3.zero;
|
||||
int cullingMask = LayerMask.GetMask(LayerMaskConst.Default_Name);
|
||||
mainCamera = CreateCamera(mainCameraGo, cullingMask: cullingMask);
|
||||
mainCamera.clearFlags = CameraClearFlags.SolidColor;
|
||||
|
||||
mainCamera.forceIntoRenderTexture = false;
|
||||
|
||||
GameObject root = new GameObject(name + "Root");
|
||||
root.transform.position = CameraConst.MainCameraPos;
|
||||
root.SetParent(AppObjConst.CameraGo);
|
||||
mainCameraGo.SetParent(root);
|
||||
mainCameraRoot = root.transform;
|
||||
|
||||
CameraAdaptive adaptiveCom = mainCamera.gameObject.AddComponent<CameraAdaptive>();
|
||||
adaptiveCom.DoAdaptive(isOrthographic: true, orthographicSize: ScreenConst.OrthographicSize_1280H);
|
||||
}
|
||||
|
||||
public void CreateFGUICamera()
|
||||
{
|
||||
if (fguiCamera) return;
|
||||
|
||||
StageCamera.CheckMainCamera();
|
||||
fguiCamera = StageCamera.main;
|
||||
fguiCamera.depth = CameraConst.UICameraDepth;
|
||||
|
||||
fguiCamera.forceIntoRenderTexture = false;
|
||||
fguiCameraGo = fguiCamera.gameObject;
|
||||
|
||||
GameObject root = new GameObject("FGUICameraRoot");
|
||||
root.transform.position = CameraConst.UICameraPos;
|
||||
root.SetParent(AppObjConst.CameraGo);
|
||||
fguiCameraGo.SetParent(root);
|
||||
fguiCameraRoot = root.transform;
|
||||
}
|
||||
|
||||
public Camera CreateCamera(GameObject cameraGo, int cullingMask)
|
||||
{
|
||||
Camera cameraCom = cameraGo.AddComponent<Camera>();
|
||||
cameraCom.clearFlags = CameraClearFlags.Depth;
|
||||
cameraCom.backgroundColor = Color.black;
|
||||
cameraCom.cullingMask = cullingMask;
|
||||
cameraCom.nearClipPlane = -30f;
|
||||
cameraCom.farClipPlane = 30f;
|
||||
cameraCom.rect = new Rect(0, 0, 1f, 1f);
|
||||
cameraCom.depth = CameraConst.MainDepth;
|
||||
cameraCom.renderingPath = RenderingPath.UsePlayerSettings;
|
||||
cameraCom.useOcclusionCulling = false;
|
||||
cameraCom.allowHDR = false;
|
||||
cameraCom.allowMSAA = false;
|
||||
cameraCom.orthographicSize = 9.6f;
|
||||
cameraCom.forceIntoRenderTexture = false;
|
||||
return cameraCom;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Mgr
|
||||
|
||||
public override void Init()
|
||||
{
|
||||
base.Init();
|
||||
InitCameraMgr();
|
||||
|
||||
CreateMainCamera();
|
||||
CreateFGUICamera();
|
||||
}
|
||||
|
||||
private void InitCameraMgr()
|
||||
{
|
||||
AppObjConst.CameraGo = new GameObject(AppObjConst.CameraGoName);
|
||||
AppObjConst.CameraGo.SetParent(AppObjConst.FrameGo);
|
||||
}
|
||||
|
||||
public override void Dispose()
|
||||
{
|
||||
base.Dispose();
|
||||
GeneralKit.Destroy(AppObjConst.CameraGo);
|
||||
}
|
||||
|
||||
public void SetMainCameraBackgroundTransparent()
|
||||
{
|
||||
// if (mainCamera != null)
|
||||
// {
|
||||
// mainCamera.clearFlags = CameraClearFlags.SolidColor;
|
||||
// mainCamera.backgroundColor = new Color(0, 0, 0, 0);
|
||||
// }
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
+190
-190
@@ -1,191 +1,191 @@
|
||||
namespace BallKingdomCrush
|
||||
{
|
||||
using UnityEngine;
|
||||
using System.Collections;
|
||||
|
||||
public class SuperApplication : SApplication
|
||||
{
|
||||
private static SuperApplication m_instance;
|
||||
|
||||
public string attribution = "organic";
|
||||
|
||||
public static SuperApplication Instance
|
||||
{
|
||||
get
|
||||
{
|
||||
if (m_instance == null)
|
||||
{
|
||||
if (IsAppQuit)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
AppObjConst.ApplicationGo = new GameObject(AppObjConst.ApplicationGoName);
|
||||
AppObjConst.ApplicationGo.SetParent(AppObjConst.FrameGo);
|
||||
m_instance = AppObjConst.ApplicationGo.AddComponent<SuperApplication>();
|
||||
}
|
||||
|
||||
return m_instance;
|
||||
}
|
||||
}
|
||||
|
||||
public override void Init()
|
||||
{
|
||||
base.Init();
|
||||
if (!PlayerPrefsKit.HasKey(PrefsKeyConst.App_isNewInstall))
|
||||
{
|
||||
PlayerPrefsKit.WriteInt(PrefsKeyConst.App_isNewInstall, 1);
|
||||
}
|
||||
|
||||
AppDispatcher.Instance.AddListener(AppMsg.AppManagerRegister,
|
||||
(obj) => { AppManagerRegister.RegisterData(); });
|
||||
}
|
||||
|
||||
public override void Enable()
|
||||
{
|
||||
base.Enable();
|
||||
|
||||
InitPlugin();
|
||||
InitAppSetting();
|
||||
|
||||
ManagerRegister.Register();
|
||||
AppManagerRegister.Register();
|
||||
ManagerRegister.RegisterData();
|
||||
|
||||
ManagerOfManager.Instance.Init();
|
||||
ModuleManager.Instance.StartUpAllModule();
|
||||
|
||||
InitSettingMode();
|
||||
StartUpGameMain();
|
||||
}
|
||||
|
||||
private void OnDestroy()
|
||||
{
|
||||
m_instance = null;
|
||||
}
|
||||
|
||||
#region Enable
|
||||
|
||||
private void InitPlugin()
|
||||
{
|
||||
DOTweenHelper.Init();
|
||||
}
|
||||
|
||||
private void InitAppSetting()
|
||||
{
|
||||
if (!AppConst.UseInternalSetting) return;
|
||||
|
||||
Physics.autoSimulation = true;
|
||||
Physics.autoSyncTransforms = true;
|
||||
Physics2D.simulationMode = SimulationMode2D.Script;
|
||||
Physics2D.autoSyncTransforms = true;
|
||||
Debug.unityLogger.logEnabled = AppConst.IsEnabledEngineLog;
|
||||
Debug.unityLogger.filterLogType = AppConst.EnabledFilterLogType;
|
||||
Screen.sleepTimeout = AppConst.SleepTimeoutMode;
|
||||
Application.runInBackground = AppConst.IsRunInBG;
|
||||
QualitySettings.vSyncCount = 0;
|
||||
QualitySettings.lodBias = 1;
|
||||
QualitySettings.antiAliasing = AppConst.AntiAliasing;
|
||||
Application.targetFrameRate = AppConst.LowFrameRate;
|
||||
}
|
||||
|
||||
private void StartUpGameMain()
|
||||
{
|
||||
if (!IsRestart)
|
||||
{
|
||||
GameIManager.Instance.InitialMain();
|
||||
}
|
||||
else
|
||||
{
|
||||
GameIManager.Instance.EnterMain();
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Enable
|
||||
|
||||
#region SettingMode
|
||||
|
||||
private void InitSettingMode()
|
||||
{
|
||||
if (!AppConst.UseInternalSetting) return;
|
||||
InitResolutionMode();
|
||||
InitFrameRateMode();
|
||||
}
|
||||
|
||||
private bool isHDMode;
|
||||
private bool isHFRMode;
|
||||
|
||||
private void InitResolutionMode()
|
||||
{
|
||||
isHDMode = PlayerPrefsKit.ReadBool(PrefsKeyConst.Application_isHDMode, true);
|
||||
SetResolutionMode(isHDMode);
|
||||
}
|
||||
|
||||
private void InitFrameRateMode()
|
||||
{
|
||||
isHFRMode = PlayerPrefsKit.ReadBool(PrefsKeyConst.Application_isHFRMode, true);
|
||||
SetFrameRateMode(isHFRMode);
|
||||
}
|
||||
|
||||
private void SetResolutionMode(bool isHDMode)
|
||||
{
|
||||
if (isHDMode)
|
||||
{
|
||||
ScreenConst.CurrResolution.x = ScreenConst.RawResolution.x * AppConst.HDHighViewScale;
|
||||
ScreenConst.CurrResolution.y = ScreenConst.RawResolution.y * AppConst.HDHighViewScale;
|
||||
}
|
||||
else
|
||||
{
|
||||
ScreenConst.CurrResolution.x = ScreenConst.RawResolution.x * AppConst.HDLowViewScale;
|
||||
ScreenConst.CurrResolution.y = ScreenConst.RawResolution.y * AppConst.HDLowViewScale;
|
||||
}
|
||||
|
||||
SetScreenResolution(ScreenConst.CurrResolution.x, ScreenConst.CurrResolution.y, true);
|
||||
}
|
||||
|
||||
private void SetFrameRateMode(bool isHFRMode)
|
||||
{
|
||||
Application.targetFrameRate = isHFRMode ? AppConst.HighFrameRate : AppConst.LowFrameRate;
|
||||
|
||||
|
||||
QualitySettings.vSyncCount = 0;
|
||||
QualitySettings.lodBias = 1;
|
||||
}
|
||||
|
||||
private void SetScreenResolution(float width, float height, bool isFullScreen)
|
||||
{
|
||||
StartCoroutine(OnSetScreenResolution(width, height, isFullScreen));
|
||||
}
|
||||
|
||||
private IEnumerator OnSetScreenResolution(float width, float height, bool isFullScreen)
|
||||
{
|
||||
yield return YieldConst.WaitForEndOfFrame;
|
||||
var allCams = Camera.allCameras;
|
||||
if (allCams == null)
|
||||
{
|
||||
yield break;
|
||||
}
|
||||
|
||||
foreach (var cam in allCams)
|
||||
{
|
||||
cam.enabled = false;
|
||||
}
|
||||
|
||||
Screen.SetResolution((int)width, (int)height, isFullScreen);
|
||||
Screen.fullScreen = true;
|
||||
|
||||
yield return YieldConst.WaitForEndOfFrame;
|
||||
if (allCams == null)
|
||||
{
|
||||
yield break;
|
||||
}
|
||||
|
||||
foreach (var cam in allCams)
|
||||
{
|
||||
cam.enabled = true;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion SettingMode
|
||||
}
|
||||
namespace BallKingdomCrush
|
||||
{
|
||||
using UnityEngine;
|
||||
using System.Collections;
|
||||
|
||||
public class SuperApplication : SApplication
|
||||
{
|
||||
private static SuperApplication m_instance;
|
||||
|
||||
public string attribution = "organic";
|
||||
|
||||
public static SuperApplication Instance
|
||||
{
|
||||
get
|
||||
{
|
||||
if (m_instance == null)
|
||||
{
|
||||
if (IsAppQuit)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
AppObjConst.ApplicationGo = new GameObject(AppObjConst.ApplicationGoName);
|
||||
AppObjConst.ApplicationGo.SetParent(AppObjConst.FrameGo);
|
||||
m_instance = AppObjConst.ApplicationGo.AddComponent<SuperApplication>();
|
||||
}
|
||||
|
||||
return m_instance;
|
||||
}
|
||||
}
|
||||
|
||||
public override void Init()
|
||||
{
|
||||
base.Init();
|
||||
if (!PlayerPrefsKit.HasKey(PrefsKeyConst.App_isNewInstall))
|
||||
{
|
||||
PlayerPrefsKit.WriteInt(PrefsKeyConst.App_isNewInstall, 1);
|
||||
}
|
||||
|
||||
AppDispatcher.Instance.AddListener(AppMsg.AppManagerRegister,
|
||||
(obj) => { AppManagerRegister.RegisterData(); });
|
||||
}
|
||||
|
||||
public override void Enable()
|
||||
{
|
||||
base.Enable();
|
||||
|
||||
InitPlugin();
|
||||
InitAppSetting();
|
||||
|
||||
ManagerRegister.Register();
|
||||
AppManagerRegister.Register();
|
||||
ManagerRegister.RegisterData();
|
||||
|
||||
ManagerOfManager.Instance.Init();
|
||||
ModuleManager.Instance.StartUpAllModule();
|
||||
|
||||
InitSettingMode();
|
||||
StartUpGameMain();
|
||||
}
|
||||
|
||||
private void OnDestroy()
|
||||
{
|
||||
m_instance = null;
|
||||
}
|
||||
|
||||
#region Enable
|
||||
|
||||
private void InitPlugin()
|
||||
{
|
||||
DOTweenHelper.Init();
|
||||
}
|
||||
|
||||
private void InitAppSetting()
|
||||
{
|
||||
if (!AppConst.UseInternalSetting) return;
|
||||
|
||||
Physics.autoSimulation = true;
|
||||
Physics.autoSyncTransforms = true;
|
||||
Physics2D.simulationMode = SimulationMode2D.Script;
|
||||
Physics2D.autoSyncTransforms = true;
|
||||
Debug.unityLogger.logEnabled = AppConst.IsEnabledEngineLog;
|
||||
Debug.unityLogger.filterLogType = AppConst.EnabledFilterLogType;
|
||||
Screen.sleepTimeout = AppConst.SleepTimeoutMode;
|
||||
Application.runInBackground = AppConst.IsRunInBG;
|
||||
QualitySettings.vSyncCount = 0;
|
||||
QualitySettings.lodBias = 1;
|
||||
QualitySettings.antiAliasing = AppConst.AntiAliasing;
|
||||
Application.targetFrameRate = AppConst.LowFrameRate;
|
||||
}
|
||||
|
||||
private void StartUpGameMain()
|
||||
{
|
||||
if (!IsRestart)
|
||||
{
|
||||
GameIManager.Instance.InitialMain();
|
||||
}
|
||||
else
|
||||
{
|
||||
GameIManager.Instance.EnterMain();
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Enable
|
||||
|
||||
#region SettingMode
|
||||
|
||||
private void InitSettingMode()
|
||||
{
|
||||
if (!AppConst.UseInternalSetting) return;
|
||||
InitResolutionMode();
|
||||
InitFrameRateMode();
|
||||
}
|
||||
|
||||
private bool isHDMode;
|
||||
private bool isHFRMode;
|
||||
|
||||
private void InitResolutionMode()
|
||||
{
|
||||
isHDMode = PlayerPrefsKit.ReadBool(PrefsKeyConst.Application_isHDMode, true);
|
||||
SetResolutionMode(isHDMode);
|
||||
}
|
||||
|
||||
private void InitFrameRateMode()
|
||||
{
|
||||
isHFRMode = PlayerPrefsKit.ReadBool(PrefsKeyConst.Application_isHFRMode, true);
|
||||
SetFrameRateMode(isHFRMode);
|
||||
}
|
||||
|
||||
private void SetResolutionMode(bool isHDMode)
|
||||
{
|
||||
if (isHDMode)
|
||||
{
|
||||
ScreenConst.CurrResolution.x = ScreenConst.RawResolution.x * AppConst.HDHighViewScale;
|
||||
ScreenConst.CurrResolution.y = ScreenConst.RawResolution.y * AppConst.HDHighViewScale;
|
||||
}
|
||||
else
|
||||
{
|
||||
ScreenConst.CurrResolution.x = ScreenConst.RawResolution.x * AppConst.HDLowViewScale;
|
||||
ScreenConst.CurrResolution.y = ScreenConst.RawResolution.y * AppConst.HDLowViewScale;
|
||||
}
|
||||
|
||||
SetScreenResolution(ScreenConst.CurrResolution.x, ScreenConst.CurrResolution.y, true);
|
||||
}
|
||||
|
||||
private void SetFrameRateMode(bool isHFRMode)
|
||||
{
|
||||
Application.targetFrameRate = isHFRMode ? AppConst.HighFrameRate : AppConst.LowFrameRate;
|
||||
|
||||
|
||||
QualitySettings.vSyncCount = 0;
|
||||
QualitySettings.lodBias = 1;
|
||||
}
|
||||
|
||||
private void SetScreenResolution(float width, float height, bool isFullScreen)
|
||||
{
|
||||
StartCoroutine(OnSetScreenResolution(width, height, isFullScreen));
|
||||
}
|
||||
|
||||
private IEnumerator OnSetScreenResolution(float width, float height, bool isFullScreen)
|
||||
{
|
||||
yield return YieldConst.WaitForEndOfFrame;
|
||||
var allCams = Camera.allCameras;
|
||||
if (allCams == null)
|
||||
{
|
||||
yield break;
|
||||
}
|
||||
|
||||
foreach (var cam in allCams)
|
||||
{
|
||||
cam.enabled = false;
|
||||
}
|
||||
|
||||
Screen.SetResolution((int)width, (int)height, isFullScreen);
|
||||
Screen.fullScreen = true;
|
||||
|
||||
yield return YieldConst.WaitForEndOfFrame;
|
||||
if (allCams == null)
|
||||
{
|
||||
yield break;
|
||||
}
|
||||
|
||||
foreach (var cam in allCams)
|
||||
{
|
||||
cam.enabled = true;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion SettingMode
|
||||
}
|
||||
}
|
||||
@@ -44,7 +44,7 @@ namespace BallKingdomCrush
|
||||
TrackKit.TrackLoginFunnel(LoginFunnelEventType.LoadBegin); //加载开始打点
|
||||
|
||||
var loginModel = LoginKit.Instance.LoginModel;
|
||||
Log.Info("Config", $"服务器传过来的配置表:{loginModel.Setting}");
|
||||
Debug.Log($"服务器传过来的配置表:{loginModel.Setting}");
|
||||
ConfigLoader.Instance.Init(new ConfigInitOptions
|
||||
{
|
||||
Setting = loginModel.Setting,
|
||||
@@ -142,14 +142,18 @@ namespace BallKingdomCrush
|
||||
///
|
||||
/// </summary>
|
||||
/// <returns>true:非自然 false:自然</returns>
|
||||
public static bool IsOrganic()
|
||||
private static bool IsOrganic()
|
||||
{
|
||||
bool b = false;
|
||||
|
||||
if (GameHelper.IsGiftSwitch() && SuperApplication.Instance.attribution == "organic")
|
||||
if (GameHelper.IsGiftSwitch())
|
||||
{
|
||||
b = GetCommonConf().IsOrganic == 1;
|
||||
if (SuperApplication.Instance.attribution == "organic")
|
||||
{
|
||||
b = GetCommonConf().non == 1;
|
||||
}
|
||||
}
|
||||
// Debug.Log($"上传---------开关:{GetCommonConf().non}");
|
||||
|
||||
Debug.Log($"下载---------开关:{b}");
|
||||
return b;
|
||||
@@ -157,7 +161,7 @@ namespace BallKingdomCrush
|
||||
|
||||
public static string GetConfigResVersion()
|
||||
{
|
||||
return IsOrganic() ? GetCommonConf().ResVersion : GetCommonConf().ResVersion1;
|
||||
return IsOrganic() ? GetCommonConf().ResVersion1 : GetCommonConf().ResVersion;
|
||||
}
|
||||
|
||||
public static List<T> GetConfig<T>() where T : class
|
||||
@@ -167,7 +171,7 @@ namespace BallKingdomCrush
|
||||
|
||||
private static List<T> GetConfigWithOrganicFallback<T, TOrganic>() where T : class
|
||||
{
|
||||
if (!IsOrganic())
|
||||
if (IsOrganic())
|
||||
{
|
||||
var organicConfig = ConfigLoader.Instance.GetConfig<List<TOrganic>>();
|
||||
if (organicConfig != null)
|
||||
|
||||
Reference in New Issue
Block a user