public void ComeIn()
 {
     if (this.state == ChooseSystemState.OUTSIDE)
     {
         this.state = ChooseSystemState.COMMING_IN;
         float delta = insidePosition - this.waitList.Canvas.Bound.Position.X;
         this.moveVelocity = delta / this.moveDuration;
         this.moveTime = this.moveDuration;
     }
 }
        public override void Initialize()
        {
            this.waitList = new PvZChooseList(this.Game, ButtonWidth, ButtonHeight, ButtonPadding,
                this.uiManager);
            this.chosenList = new PvZChooseList(this.Game, ButtonWidth, ButtonHeight, ButtonPadding,
                this.uiManager);
            this.waitList.Canvas.Bound.Position = new Vector2(outsidePosition, 150);
            this.waitList.Canvas.Bound.Size = new Vector2(480, 200);
            this.waitList.Canvas.Content.Position = new Vector2(20, 40);
            this.waitList.Canvas.Content.Size = new Vector2(430, 150);
            this.waitList.Background = SCSServices.Instance.ResourceManager.GetResource<ISprite>("ChoosePlant");

            this.chosenList.Canvas.Bound.Position = new Vector2(outsidePosition, 400);
            this.chosenList.Canvas.Bound.Size = new Vector2(460, 70);
            this.chosenList.Canvas.Content.Position = new Vector2(90, 5);
            this.chosenList.Canvas.Content.Size = new Vector2(440, 56);
            this.chosenList.Background = SCSServices.Instance.ResourceManager.GetResource<ISprite>("BuyPlant");

            foreach (var buttonF in this.buttonFB)
            {
                var chButton = buttonF.Value.CreateChooseButton(this.Game);
                chButton.OnTap += this.OnChooseButtonInWaitListTapped;
                this.waitList.AddChooseButton(chButton);
            }
            this.waitList.ReArrange();

            this.uiManager.Add(this.waitList);
            this.uiManager.Add(this.chosenList);

            this.readyButton = new Button(this.Game, SCSServices.Instance.SpriteBatch,
                SCSServices.Instance.ResourceManager.GetResource<Texture2D>("Ready"),
                SCSServices.Instance.ResourceManager.GetResource<Texture2D>("ReadyOver"));
            readyButton.IsOverlay = true;
            readyButton.FitSizeByImage();
            readyButton.Canvas.Bound.Position = new Vector2(outsidePosition + readyButtonMargin, 360f);
            readyButton.OnTouched += this.OnReadyButtonTouched;
            this.uiManager.Add(readyButton);

            this.state = ChooseSystemState.OUTSIDE;

            base.Initialize();
        }
        public override void Update(GameTime gameTime)
        {
            switch (this.state)
            {
                case ChooseSystemState.COMMING_IN:
                    float velRate = this.moveVelocity * (float)gameTime.ElapsedGameTime.TotalSeconds;
                    this.waitList.Canvas.Bound.Position.X += velRate;
                    this.chosenList.Canvas.Bound.Position.X += velRate;
                    this.readyButton.Canvas.Bound.Position.X += velRate;
                    this.waitList.ReArrange();
                    this.chosenList.ReArrange();
                    this.moveTime -= (float)gameTime.ElapsedGameTime.TotalSeconds;

                    if (this.moveTime < 0)
                    {
                        this.state = ChooseSystemState.INSIDE;
                        this.waitList.Canvas.Bound.Position.X = insidePosition;
                        this.chosenList.Canvas.Bound.Position.X = insidePosition;
                        this.readyButton.Canvas.Bound.Position.X = insidePosition + readyButtonMargin;
                        this.waitList.ReArrange();
                        this.chosenList.ReArrange();
                    }
                    break;
                case ChooseSystemState.COMMING_OUT:
                    velRate = this.moveVelocity * (float)gameTime.ElapsedGameTime.TotalSeconds;
                    this.waitList.Canvas.Bound.Position.X += velRate;
                    this.readyButton.Canvas.Bound.Position.X += velRate;
                    this.waitList.ReArrange();
                    this.moveTime -= (float)gameTime.ElapsedGameTime.TotalSeconds;

                    if (this.moveTime < 0)
                    {
                        this.state = ChooseSystemState.OUTSIDE;
                        this.waitList.Canvas.Bound.Position.X = outsidePosition;
                        this.readyButton.Canvas.Bound.Position.X = outsidePosition + readyButtonMargin;
                        this.waitList.ReArrange();

                        if (this.OnCameOut != null)
                        {
                            this.OnCameOut(this);
                        }
                    }
                    break;
                default:
                    break;
            }
            base.Update(gameTime);
        }