예제 #1
0
    private IEnumerator Start()
    {
        for (int i = 0; i < this.m_comicStrips.Count; i++)
        {
            ComicStrip comicStrip = this.m_comicStrips[i];
            float      x          = comicStrip.m_strip.GetComponent <UnmanagedSprite>().Size.x;
            this.m_startPos     = -10f * (float)Screen.width / (float)Screen.height + 0.5f * x + 4f * (float)Screen.width / (float)Screen.height;
            this.m_startPos_3_2 = -15f + 0.5f * x + 6f;
            comicStrip.m_strip.transform.position = new Vector3(this.m_startPos, 0f, (float)i);
            float num = 0f;
            this.m_comicStrips[i].m_strip.GetComponent <Renderer>().material.SetColor("_Color", new Color(1f, 1f, 1f, num));
            this.FadeChildren(num, this.m_comicStrips[i], false);
        }
        this.m_continueButton.SetActive(GameProgress.GetInt(Singleton <GameManager> .Instance.CurrentSceneName + "_played", 0, GameProgress.Location.Local, null) == 1);
        if (ScreenPlacement.IsAspectRatioNarrowerThan(4f, 3f))
        {
            this.m_continueButton.transform.Translate(-2.5f, 0f, 0f);
        }
        base.StartCoroutine(this.UpdateStrips());
        yield return(null);

        if (this.m_soundTrack && this.m_currentStrip == 0)
        {
            Singleton <AudioManager> .Instance.Spawn2dOneShotEffect(this.m_soundTrack);
        }
        for (int j = 0; j < this.m_currentStrip; j++)
        {
            this.m_time += this.GetComicPageTime(j);
        }
        yield break;
    }
예제 #2
0
 private void Start()
 {
     this.m_camera = base.GetComponent <Camera>();
     this.m_camera.orthographic = true;
     this.m_cameraLimits        = WPFMonoBehaviour.levelManager.CurrentCameraLimits;
     this.m_cameraMaxZoom       = Mathf.Min(Mathf.Min(this.m_cameraLimits.size.x, this.m_cameraLimits.size.y) / 2f, 20f);
     this.m_cameraMinZoom       = 7f;
     if (Singleton <BuildCustomizationLoader> .Instance.IsHDVersion)
     {
         if (ScreenPlacement.IsAspectRatioNarrowerThan(3f, 2f))
         {
             this.m_cameraMinZoom = 8.4f;
         }
         else
         {
             this.m_cameraMinZoom = 7.7f;
         }
     }
     this.m_camera.orthographicSize = this.m_cameraMinZoom;
     this.m_cameraPreview           = base.GetComponent <CameraPreview>();
     this.m_snapshotFX = base.GetComponent <SnapshotEffect>();
     if (this.m_cameraPreview == null && WPFMonoBehaviour.levelManager.GoalPosition != null)
     {
         this.m_cameraPreview = base.gameObject.AddComponent <CameraPreview>();
         CameraPreview.CameraControlPoint cameraControlPoint = new CameraPreview.CameraControlPoint();
         cameraControlPoint.position = WPFMonoBehaviour.levelManager.GoalPosition.transform.position + WPFMonoBehaviour.levelManager.PreviewOffset;
         cameraControlPoint.zoom     = WPFMonoBehaviour.levelManager.PreviewOffset.z / 2f;
         this.m_cameraPreview.ControlPoints.Add(cameraControlPoint);
         this.m_cameraPreview.ControlPoints.Add(cameraControlPoint);
         CameraPreview.CameraControlPoint cameraControlPoint2 = new CameraPreview.CameraControlPoint();
         cameraControlPoint2.position = new Vector2(this.m_cameraLimits.topLeft.x + this.m_cameraLimits.size.x / 2f, this.m_cameraLimits.topLeft.y - this.m_cameraLimits.size.y / 2f);
         cameraControlPoint2.zoom     = this.m_cameraMaxZoom;
         this.m_cameraPreview.ControlPoints.Add(cameraControlPoint2);
         CameraPreview.CameraControlPoint cameraControlPoint3 = new CameraPreview.CameraControlPoint();
         cameraControlPoint3.position = WPFMonoBehaviour.levelManager.StartingPosition + WPFMonoBehaviour.levelManager.ConstructionOffset;
         cameraControlPoint3.zoom     = WPFMonoBehaviour.levelManager.ConstructionOffset.z;
         this.m_cameraPreview.ControlPoints.Add(cameraControlPoint3);
         this.m_cameraPreview.ControlPoints.Add(cameraControlPoint3);
         this.m_cameraPreview.m_animationTime = WPFMonoBehaviour.levelManager.m_previewMoveTime;
         if (this.m_cameraPreview.m_animationTime < 1f)
         {
             this.m_cameraPreview.m_animationTime = 1f;
         }
     }
     if (this.m_cameraPreview != null)
     {
         WPFMonoBehaviour.levelManager.m_previewMoveTime = this.m_cameraPreview.m_animationTime;
     }
     this.m_cameraBuildZoom = this.m_cameraPreview.ControlPoints[this.m_cameraPreview.ControlPoints.Count - 1].zoom;
     base.gameObject.SetActive(true);
 }
예제 #3
0
    private float GetComicPageTime(int index)
    {
        float x   = this.m_comicStrips[index].m_strip.GetComponent <UnmanagedSprite>().Size.x;
        float num = -0.15f * x;

        if (ScreenPlacement.IsAspectRatioNarrowerThan(4f, 3f))
        {
            num -= 2.5f;
        }
        float num2 = (this.m_startPos - num) / (this.m_startPos_3_2 - num);
        float num3 = num2 * this.m_comicStrips[index].m_speed;
        float num4 = Mathf.Abs(this.m_startPos - num) / num3;
        float num5 = 2f * (1f / this.m_comicStrips[index].m_fadingSpeed);

        return(num4 + num5);
    }
예제 #4
0
    private IEnumerator UpdateStrips()
    {
        float alpha = 0f;

        while (this.m_currentStrip < this.m_comicStrips.Count)
        {
            float comicWidth  = this.m_comicStrips[this.m_currentStrip].m_strip.GetComponent <UnmanagedSprite>().Size.x;
            float endPos      = -0.15f * comicWidth;
            float speedFactor = (this.m_startPos - endPos) / (this.m_startPos_3_2 - endPos);
            if (ScreenPlacement.IsAspectRatioNarrowerThan(4f, 3f))
            {
                endPos -= 2.5f;
            }
            if (this.m_comicStrips[this.m_currentStrip].m_strip.transform.position.x <= endPos)
            {
                this.m_comicStrips[this.m_currentStrip].m_strip.transform.position = new Vector3(endPos, 0f);
                if (this.m_currentStrip < this.m_comicStrips.Count - 1)
                {
                    while (alpha > 0f)
                    {
                        alpha -= Time.deltaTime * this.m_comicStrips[this.m_currentStrip].m_fadingSpeed;
                        this.m_comicStrips[this.m_currentStrip].m_strip.GetComponent <Renderer>().material.SetColor("_Color", new Color(1f, 1f, 1f, alpha));
                        this.FadeChildren(alpha, this.m_comicStrips[this.m_currentStrip], false);
                        yield return(new WaitForEndOfFrame());
                    }
                    UnityEngine.Object.Destroy(this.m_comicStrips[this.m_currentStrip].m_strip);
                }
                this.m_comicStrips[this.m_currentStrip] = null;
                this.m_currentStrip++;
            }
            else
            {
                while (alpha < 1f)
                {
                    alpha += Time.deltaTime * this.m_comicStrips[this.m_currentStrip].m_fadingSpeed;
                    this.m_comicStrips[this.m_currentStrip].m_strip.GetComponent <Renderer>().material.SetColor("_Color", new Color(1f, 1f, 1f, alpha));
                    this.FadeChildren(alpha, this.m_comicStrips[this.m_currentStrip], true);
                    yield return(new WaitForEndOfFrame());
                }
                this.m_comicStrips[this.m_currentStrip].m_strip.transform.position -= Vector3.right * speedFactor * this.m_comicStrips[this.m_currentStrip].m_speed * Time.deltaTime;
                yield return(new WaitForEndOfFrame());
            }
        }
        this.m_continueButton.SetActive(true);
        yield break;
    }