Ejemplo n.º 1
0
    private BackgroundPart CreatePart(BackgroundPartId partId)
    {
        BackgroundPart part = Instantiate(_partPrefab) as BackgroundPart;

        part.Init(partId, this.transform);

        return(part);
    }
 public void Initialize()
 {
     this.previewBG1        = null;
     this.previewBG1Fadeout = 0.0f;
     this.previewBG2        = null;
     this.previewBG2Fadeout = 0.0f;
     this.IsLoaded          = false;
 }
Ejemplo n.º 3
0
    private void InitSize()
    {
        //_size = new Vector2(Mathf.Abs(_partPrefab.Sprite.size.x * 3), Mathf.Abs(_partPrefab.Sprite.size.y * 3));
        BackgroundPart bg_first = _parts[0];
        BackgroundPart bg_last  = _parts[_parts.Count - 1];

        float x = bg_last.transform.position.x - bg_first.transform.position.x;
        float y = bg_last.transform.position.y - bg_first.transform.position.y;

        _size = new Vector2(Mathf.Abs(x), Mathf.Abs(y));
    }
        public LoadingScreen(MapOverview overview, TheGreatPaperGame Game)
        {
            this.Initialize();
            this.Game = Game;

            loading1       = new Rectangle(0, 356, 270, 178);
            loading2       = new Rectangle(0, 178, 270, 178);
            loading3       = new Rectangle(0, 0, 270, 178);
            currentloading = loading1;

            background           = new Rectangle(300, 0, 1024, 768);
            backgroundDst        = background;
            backgroundDst.X      = 0;
            backgroundDst.Y      = 0;
            backgroundDst.Width  = TGPAContext.Instance.ScreenWidth;
            backgroundDst.Height = TGPAContext.Instance.ScreenHeight;

            this.overview          = overview;
            this.previewBG1        = null;
            this.previewBG1Fadeout = 0.0f;
            this.previewBG2        = null;
            this.previewBG2Fadeout = 0.0f;
            this.IsLoaded          = false;
        }
        /// <summary>
        ///
        /// </summary>
        /// <param name="gameTime"></param>
        public void Update(GameTime gameTime)
        {
            if (this.previewBG1 == null)
            {
                if ((TGPAContext.Instance.Map != null) && (TGPAContext.Instance.Map.Ended == Map.EndMode.None))
                {
                    if (TGPAContext.Instance.Map.Background1.BackgroundSprites.Count > 0)
                    {
                        this.previewBG1 = TGPAContext.Instance.Map.Background1.BackgroundSprites[0];
                    }
                }
            }
            else
            {
                previewBG1Fadeout += 0.01f;
                if (previewBG1Fadeout > 1f)
                {
                    previewBG1Fadeout = 1f;

                    if (this.previewBG2 == null)
                    {
                        if (TGPAContext.Instance.Map.Background2.BackgroundSprites.Count > 0)
                        {
                            this.previewBG2 = TGPAContext.Instance.Map.Background2.BackgroundSprites[0];
                        }
                    }
                    else
                    {
                        previewBG2Fadeout += 0.01f;
                        if (previewBG2Fadeout > 1f)
                        {
                            previewBG2Fadeout = 1f;
                        }
                    }
                }
            }

            if (gameTime.TotalGameTime.TotalMilliseconds - frameTime > 500f)
            {
                frameTime = gameTime.TotalGameTime.TotalMilliseconds;

                if (currentloading == loading1)
                {
                    currentloading = loading2;
                }
                else if (currentloading == loading2)
                {
                    currentloading = loading3;
                }
                else if (currentloading == loading3)
                {
                    currentloading = loading1;
                }
            }

            if (TGPAContext.Instance.MapLoaded)
            {
                if (TGPAContext.Instance.InputManager.PlayerPressButtonConfirm(TGPAContext.Instance.Player1))
                {
                    TGPAContext.Instance.CurrentGameState = GameState.Game;
                }
            }

            this.IsLoaded = TGPAContext.Instance.MapLoaded;
        }