コード例 #1
0
        public override void Activate(bool instancePreserved)
        {
            base.Activate(instancePreserved);

            myData = Storage.Get<PlayerData>("myPlayerData");
            TransitionAnimations = new List<UIElement>();

            categorySelected = false;
            gameSelected = false;
            itemSelected = false;

            BorderedView storeCategories = new BorderedView(new Vector2(672, 450), new Vector2(1536, 258));
            storeCategories.BorderWidth = 0;
            Label categories = new Label("Categories", new Vector2(rightXMiddle, 125));
            categories.Font = "gillsans";
            categories.Scale = 1.2f;
            Button skins = new SmallButton("Skins");
            skins.Position = new Vector2(rightXMiddle, 250);
            skins.TappedArgs.Arg = "skins";
            skins.Tapped += CategoryButton_Tapped;
            Button upgrades = new SmallButton("Upgrades");
            upgrades.Position = new Vector2(rightXMiddle, 370);
            upgrades.TappedArgs.Arg = "upgrades";
            upgrades.Tapped += CategoryButton_Tapped;
            storeCategories.Disabled = false;
            storeCategories.AddElement(categories, skins, upgrades);
            storeCategories.SetAnimationOffset(new Vector2(1000, 0), Helpers.EaseOutBounceAnimation, false); // set the animation to start 1000 pixels to the right
            storeCategories.UpdateAnimationPosition(0); // start the animation to move the elements out of screen
            TransitionAnimations.Add(storeCategories); // add it to the list of animated objects
            mainView.AddElement(storeCategories);

            BorderedView itemDetails = new BorderedView(new Vector2(672, 552), new Vector2(rightXMiddle, 780));
            itemDetails.BorderWidth = 0;

            itemName = new Label("", new Vector2(rightXMiddle, 580));
            itemName.Font = "gillsans";
            itemName.MaxSize(760);
            itemDescription = new Label("", new Vector2(rightXMiddle, 650));
            itemDescription.MaxSize(760);
            buyItem = new SmallButton("");
            buyItem.Position = new Vector2(1536, 745);
            buyItem.ButtonImage = "buyButton";
            buyItem.Tapped += BuyItem_Tapped;
            ClearItem();

            currentMoney = new Label("$" + myData.money, new Vector2(rightXMiddle, 870));
            currentMoney.Font = "gillsans";
            currentMoney.TextColor = Color.Yellow;
            Button back = new SmallButton("Back");
            back.Position = new Vector2(1536, 978);
            back.Tapped += backButton_Tapped;
            itemDetails.Disabled = false;
            itemDetails.AddElement(itemName, itemDescription, buyItem, currentMoney, back);
            itemDetails.SetAnimationOffset(new Vector2(1000, 0), Helpers.EaseOutBounceAnimation, false); // set the animation to start 1000 pixels to the right
            itemDetails.UpdateAnimationPosition(0); // start the animation to move the elements out of screen
            TransitionAnimations.Add(itemDetails); // add it to the list of animated objects
            mainView.AddElement(itemDetails);

            BorderedView storeLeft = new BorderedView(new Vector2(1152, 1300), new Vector2(leftXMiddle, 540));
            storeLeft.Disabled = false;
            itemView = new View(new Vector2(1152, 1300), new Vector2(leftXMiddle, 540));
            itemView.Disabled = false;
            itemViewLabel = new Label("Select a category at the right", new Vector2(leftXMiddle, leftYTop));
            itemViewLabel.Font = "gillsans";
            storeLeft.AddElement(itemViewLabel, itemView);
            storeLeft.SetAnimationOffset(new Vector2(-1500, 0), Helpers.EaseOutBounceAnimation, false); // set the animation to start 1500 pixels to the left
            storeLeft.UpdateAnimationPosition(0); // start the animation to move the elements out of screen
            TransitionAnimations.Add(storeLeft); // add it to the list of animated objects
            mainView.AddElement(storeLeft);
        }