public void applyScreen()
{
if (ssParam.bEnabled[PKeySubCamera])
{
goSubCam.GetComponent<Camera>().rect = new Rect(ssParam.fValue[PKeySubCamera][PPropSubCameraPosX], ssParam.fValue[PKeySubCamera][PPropSubCameraPosY],
ssParam.fValue[PKeySubCamera][PPropSubCameraWidth], ssParam.fValue[PKeySubCamera][PPropSubCameraWidth]);
}
else
{
goSubCam.GetComponent<Camera>().rect = new Rect(0, 0, 1f, 1f);
}
if (!ssParam.bEnabled[PKeyAlwaysScreenOnMainCamera])
{
goSubScreen.transform.position = new Vector3(
ssParam.fValue[PKeyBSPos][PPropBSPosX],
ssParam.fValue[PKeyBSPos][PPropBSPosY],
ssParam.fValue[PKeyBSPos][PPropBSPosZ]);
goSubScreen.transform.eulerAngles = new Vector3(ssParam.fValue[PKeyBSAngle][PPropBSAngleX],
ssParam.fValue[PKeyBSAngle][PPropBSAngleY], ssParam.fValue[PKeyBSAngle][PPropBSAngleZ]);
}
var x = ssParam.fValue[PKeyBSSize][PPropBSSize];
var y = x * Screen.height / Screen.width;
goSubScreen.transform.localScale = new Vector3(x, y, goSubScreen.transform.localScale.z);
Color color = goSubScreen.GetComponent<Renderer>().material.color;
color.r = ssParam.fValue[PKeyBSColor][PPropBSColorRed] * ssParam.fValue[PKeyBSColor][PPropBSColorLuminance];
color.g = ssParam.fValue[PKeyBSColor][PPropBSColorGreen] * ssParam.fValue[PKeyBSColor][PPropBSColorLuminance];
color.b = ssParam.fValue[PKeyBSColor][PPropBSColorBlue] * ssParam.fValue[PKeyBSColor][PPropBSColorLuminance];
color.a = ssParam.fValue[PKeyBSColor][PPropBSColorAlpha];
goSubScreen.GetComponent<Renderer>().material.color = color;
float offsetLight = 1f;
if(isVR) {
offsetLight = 2f;
}
goSsLight.GetComponent<Light>().intensity = ssParam.fValue[PKeyBSColor][PPropScreenLightLuminance] * offsetLight;
if (ssParam.fValue[PKeyBSColor][PPropScreenLightLuminance] > 0)
{
GameMain.Instance.MainLight.GetComponent<Light>().cullingMask &= ~(1 << SubScreenLayer);
}
else
{
GameMain.Instance.MainLight.GetComponent<Light>().cullingMask |= (1 << SubScreenLayer);
}
color = goSubCam.GetComponent<Renderer>().material.color;
color.r = ssParam.fValue[PKeyCameraColor][PPropCameraColorRed] * ssParam.fValue[PKeyBSColor][PPropBSColorLuminance];
color.g = ssParam.fValue[PKeyCameraColor][PPropCameraColorGreen] * ssParam.fValue[PKeyBSColor][PPropBSColorLuminance];
color.b = ssParam.fValue[PKeyCameraColor][PPropCameraColorBlue] * ssParam.fValue[PKeyBSColor][PPropBSColorLuminance];
color.a = ssParam.fValue[PKeyCameraColor][PPropCameraColorAlpha];
goSubCam.GetComponent<Renderer>().material.color = color;
goSubCam.GetComponent<Camera>().fieldOfView = ssParam.fValue[PKeyCameraColor][PPropSubCameraFieldOfView];
if (ssParam.bEnabled[PKeyMainLight])
{
Light mainLight = GameMain.Instance.MainLight.GetComponent<Light>();
color = mainLight.color;
color.r = ssParam.fValue[PKeyMainLight][PPropMainLightColorRed] * ssParam.fValue[PKeyMainLight][PPropMainLightLuminance];
color.g = ssParam.fValue[PKeyMainLight][PPropMainLightColorGreen] * ssParam.fValue[PKeyMainLight][PPropMainLightLuminance];
color.b = ssParam.fValue[PKeyMainLight][PPropMainLightColorBlue] * ssParam.fValue[PKeyMainLight][PPropMainLightLuminance];
mainLight.color = color;
}
if (ssParam.bEnabled[PKeyEnable] && ssParam.bEnabled[PKeySubLight])
{
goSubLight.GetComponent<Light>().enabled = true;
goSubLight.GetComponent<Light>().spotAngle = ssParam.fValue[PKeySubLight][PPropSubLightRange];
color = goSubLight.GetComponent<Light>().color;
color.r = ssParam.fValue[PKeySubLight][PPropSubLightColorRed] * ssParam.fValue[PKeySubLight][PPropSubLightLuminance];
color.g = ssParam.fValue[PKeySubLight][PPropSubLightColorGreen] * ssParam.fValue[PKeySubLight][PPropSubLightLuminance];
color.b = ssParam.fValue[PKeySubLight][PPropSubLightColorBlue] * ssParam.fValue[PKeySubLight][PPropSubLightLuminance];
goSubLight.GetComponent<Light>().color = color;
}
else
{
goSubLight.GetComponent<Light>().enabled = false;
}
if (ssParam.bEnabled[PKeyEnable] && ssParam.bEnabled[PKeyScreenFilter])
{
SetRendererEnabled(goSsFrontFilter, true);
color = goSsFrontFilter.GetComponent<Renderer>().material.color;
color.r = ssParam.fValue[PKeyScreenFilter][PPropScreenFilterRed] * ssParam.fValue[PKeyScreenFilter][PPropScreenFilterLuminance];
color.g = ssParam.fValue[PKeyScreenFilter][PPropScreenFilterGreen] * ssParam.fValue[PKeyScreenFilter][PPropScreenFilterLuminance];
color.b = ssParam.fValue[PKeyScreenFilter][PPropScreenFilterBlue] * ssParam.fValue[PKeyScreenFilter][PPropScreenFilterLuminance];
color.a = ssParam.fValue[PKeyScreenFilter][PPropScreenFilterAlpha];
goSsFrontFilter.GetComponent<Renderer>().material.color = color;
}
else
{
SetRendererEnabled(goSsFrontFilter, false);
}
}