Пример #1
0
 public override void Deserialize(BinaryReader binaryReader)
 {
     base.Deserialize(binaryReader);
     clearFlags            = (CameraClearFlags)binaryReader.ReadInt32();
     cullingMask           = binaryReader.ReadInt32();
     orthographic          = binaryReader.ReadBoolean();
     orthographicSize      = binaryReader.ReadSingle();
     fieldOfView           = binaryReader.ReadSingle();
     usePhysicalProperties = binaryReader.ReadBoolean();
     focalLength           = binaryReader.ReadSingle();
     sensorType            = binaryReader.ReadInt32();
     gateFit                = (Camera.GateFitMode)binaryReader.ReadInt32();
     nearClipPlane          = binaryReader.ReadSingle();
     farClipPlane           = binaryReader.ReadSingle();
     depth                  = binaryReader.ReadSingle();
     renderingPath          = binaryReader.ReadInt32();
     useOcclusionCulling    = binaryReader.ReadBoolean();
     allowHDR               = binaryReader.ReadBoolean();
     allowMSAA              = binaryReader.ReadBoolean();
     allowDynamicResolution = binaryReader.ReadBoolean();
     targetEye              = binaryReader.ReadInt32();
     m_backgroundColor      = SerializerKun.DesirializeObject <ColorKun>(binaryReader);
     m_lensShift            = SerializerKun.DesirializeObject <Vector2Kun>(binaryReader);
     m_rect                 = SerializerKun.DesirializeObject <RectKun>(binaryReader);
 }
Пример #2
0
        /// <summary>
        /// Deserialize
        /// </summary>
        /// <param name="binaryReader">BinaryReader</param>
        public virtual void Deserialize(BinaryReader binaryReader)
        {
            m_currentResolutionWidth       = binaryReader.ReadInt32();
            m_currentResolutionHeight      = binaryReader.ReadInt32();
            m_currentResolutionRefreshRate = binaryReader.ReadInt32();
            m_width                          = binaryReader.ReadInt32();
            m_height                         = binaryReader.ReadInt32();
            m_sleepTimeout                   = binaryReader.ReadInt32();
            m_preferredRefreshRate           = binaryReader.ReadInt32();
            m_autorotateToLandscapeLeft      = binaryReader.ReadBoolean();
            m_autorotateToLandscapeRight     = binaryReader.ReadBoolean();
            m_autorotateToPortrait           = binaryReader.ReadBoolean();
            m_autorotateToPortraitUpsideDown = binaryReader.ReadBoolean();
            m_fullScreen                     = binaryReader.ReadBoolean();
#if UNITY_2019_1_OR_NEWER
            m_brightness = binaryReader.ReadSingle();
#endif
            m_dpi            = binaryReader.ReadSingle();
            m_fullScreenMode = (FullScreenMode)binaryReader.ReadInt32();
            m_orientation    = (ScreenOrientation)binaryReader.ReadInt32();
            m_safeArea       = SerializerKun.DesirializeObject <RectKun>(binaryReader);
#if UNITY_2019_1_OR_NEWER
            m_cutouts = SerializerKun.DesirializeObjects <RectKun>(binaryReader);
#endif
            m_resolutions = SerializerKun.DesirializeObjects <ResolutionKun>(binaryReader);
        }
Пример #3
0
        /// <summary>
        /// コンストラクタ
        /// </summary>
        /// <param name="component">Cameraオブジェクト</param>
        public CameraKun(Component component) : base(component)
        {
            componentKunType  = ComponentKunType.Camera;
            m_backgroundColor = new ColorKun();
            m_lensShift       = new Vector2Kun();
            m_rect            = new RectKun();

            var camera = component as Camera;

            if (camera != null)
            {
                enabled               = camera.enabled;
                clearFlags            = camera.clearFlags;
                backgroundColor       = camera.backgroundColor;
                cullingMask           = camera.cullingMask;
                orthographic          = camera.orthographic;
                orthographicSize      = camera.orthographicSize;
                fieldOfView           = camera.fieldOfView;
                usePhysicalProperties = camera.usePhysicalProperties;
                focalLength           = camera.focalLength;

                sensorType = System.Array.IndexOf(k_ApertureFormatValues, new Vector2((float)System.Math.Round(camera.sensorSize.x, 3), (float)System.Math.Round(camera.sensorSize.y, 3)));
                lensShift  = camera.lensShift;
                gateFit    = camera.gateFit;

                nearClipPlane          = camera.nearClipPlane;
                farClipPlane           = camera.farClipPlane;
                rect                   = camera.rect;
                depth                  = camera.depth;
                renderingPath          = (int)camera.renderingPath;
                useOcclusionCulling    = camera.useOcclusionCulling;
                allowHDR               = camera.allowHDR;
                allowMSAA              = camera.allowMSAA;
                allowDynamicResolution = camera.allowDynamicResolution;
                targetEye              = (int)camera.stereoTargetEye;
            }
        }
Пример #4
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="obj"></param>
        /// <returns></returns>
        public override bool Equals(object obj)
        {
            var other = obj as ScreenKun;

            if (other == null)
            {
                return(false);
            }
            if (!m_currentResolutionWidth.Equals(other.m_currentResolutionWidth))
            {
                return(false);
            }
            if (!m_currentResolutionHeight.Equals(other.m_currentResolutionHeight))
            {
                return(false);
            }
            if (!m_currentResolutionRefreshRate.Equals(other.m_currentResolutionRefreshRate))
            {
                return(false);
            }
            if (!m_width.Equals(other.m_width))
            {
                return(false);
            }
            if (!m_height.Equals(other.m_height))
            {
                return(false);
            }
            if (!m_sleepTimeout.Equals(other.m_sleepTimeout))
            {
                return(false);
            }
            if (!m_preferredRefreshRate.Equals(other.m_preferredRefreshRate))
            {
                return(false);
            }
            if (!m_autorotateToLandscapeLeft.Equals(other.m_autorotateToLandscapeLeft))
            {
                return(false);
            }
            if (!m_autorotateToLandscapeRight.Equals(other.m_autorotateToLandscapeRight))
            {
                return(false);
            }
            if (!m_autorotateToPortrait.Equals(other.m_autorotateToPortrait))
            {
                return(false);
            }
            if (!m_autorotateToPortraitUpsideDown.Equals(other.m_autorotateToPortraitUpsideDown))
            {
                return(false);
            }
            if (!m_fullScreen.Equals(other.m_fullScreen))
            {
                return(false);
            }
#if UNITY_2019_1_OR_NEWER
            if (!m_brightness.Equals(other.m_brightness))
            {
                return(false);
            }
#endif
            if (!m_dpi.Equals(other.m_dpi))
            {
                return(false);
            }
            if (!m_fullScreenMode.Equals(other.m_fullScreenMode))
            {
                return(false);
            }
            if (!m_orientation.Equals(other.m_orientation))
            {
                return(false);
            }
            if (!RectKun.Equals(m_safeArea, other.m_safeArea))
            {
                return(false);
            }
#if UNITY_2019_1_OR_NEWER
            if (m_cutouts != null)
            {
                if (other.m_cutouts == null)
                {
                    return(false);
                }
                if (m_cutouts.Length != other.m_cutouts.Length)
                {
                    return(false);
                }
                for (var i = 0; i < m_cutouts.Length; i++)
                {
                    if (!RectKun.Equals(m_cutouts[i], other.m_cutouts[i]))
                    {
                        return(false);
                    }
                }
            }
#endif
            if (m_resolutions != null)
            {
                if (other.m_resolutions == null)
                {
                    return(false);
                }
                if (m_resolutions.Length != other.m_resolutions.Length)
                {
                    return(false);
                }
                for (var i = 0; i < m_resolutions.Length; i++)
                {
                    if (!ResolutionKun.Equals(m_resolutions[i], other.m_resolutions[i]))
                    {
                        return(false);
                    }
                }
            }
            return(true);
        }