Exemplo n.º 1
0
        public static void Init(GraphicsDeviceManager graphics)
        {
            _graphics = graphics;
            // here to insert Names of Planets
            List <string> planetNames = new List <string> {
                "Planet 1", "Planet 2", "Planet 3"
            };

            indexOfSelectedPlanet = (planetNames.Count) / 2;

            // set Planet-Buttons
            planetButtons = new AnimatedButton[planetNames.Count];
            foreach (string planetName in planetNames)
            {
                index = planetNames.IndexOf(planetName);
                planetButtons[index] = new AnimatedButton(planetName, worldTextures[index], planetButtonAnimations[index], worldScale, 200 + index * 300, 300, false);
            }
            planetButtons[indexOfSelectedPlanet].isFocused = true;
            bool test = planetButtons[indexOfSelectedPlanet].isFocused;

            // Set Button Back
            back = new Button("Back", btnDefaultTexture, btnHoverTexture, 0.4f, 800, 20);

            // Set previous Keyboard State
            _prevKeyState = Keyboard.GetState();
        }
Exemplo n.º 2
0
 static public int OnPointerDown(IntPtr l)
 {
     try {
                     #if DEBUG
         var    method     = System.Reflection.MethodBase.GetCurrentMethod();
         string methodName = GetMethodName(method);
                     #if UNITY_5_5_OR_NEWER
         UnityEngine.Profiling.Profiler.BeginSample(methodName);
                     #else
         Profiler.BeginSample(methodName);
                     #endif
                     #endif
         AnimatedButton self = (AnimatedButton)checkSelf(l);
         UnityEngine.EventSystems.PointerEventData a1;
         checkType(l, 2, out a1);
         self.OnPointerDown(a1);
         pushValue(l, true);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
             #if DEBUG
     finally {
                     #if UNITY_5_5_OR_NEWER
         UnityEngine.Profiling.Profiler.EndSample();
                     #else
         Profiler.EndSample();
                     #endif
     }
             #endif
 }
Exemplo n.º 3
0
 static public int get_onClick(IntPtr l)
 {
     try {
                     #if DEBUG
         var    method     = System.Reflection.MethodBase.GetCurrentMethod();
         string methodName = GetMethodName(method);
                     #if UNITY_5_5_OR_NEWER
         UnityEngine.Profiling.Profiler.BeginSample(methodName);
                     #else
         Profiler.BeginSample(methodName);
                     #endif
                     #endif
         AnimatedButton self = (AnimatedButton)checkSelf(l);
         pushValue(l, true);
         pushValue(l, self.onClick);
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
             #if DEBUG
     finally {
                     #if UNITY_5_5_OR_NEWER
         UnityEngine.Profiling.Profiler.EndSample();
                     #else
         Profiler.EndSample();
                     #endif
     }
             #endif
 }
Exemplo n.º 4
0
        public static void Activate(ActionTypes.ActionType actionType, BattleEngine battleEngine)
        {
            Character currentCharacter = battleEngine.Characters[TurnSystem.CurrentCharIndex];

            ActionGrid.Children.Clear();

            List <Action> actions = currentCharacter.CharacterStats.Actions
                                    .Where(action => action.ActionType == actionType).ToList();
            List <AnimatedButtonController> animatedButtonControllers = new List <AnimatedButtonController>();

            ActionGrid.Width = actions.Count * 40;
            int left = 0;

            actions.ForEach(action =>
            {
                AnimatedButton animatedButton = new AnimatedButton
                {
                    Width = 40,
                    HorizontalAlignment = HorizontalAlignment.Left,
                    Margin       = new Thickness(left, 0, 0, 0),
                    Button       = { Width = 40 },
                    Action       = action,
                    BattleEngine = battleEngine
                };
                animatedButton.Button.PreviewMouseDown += InitiateFight;
                animatedButtonControllers.Add(new AnimatedButtonController(action.Icon, animatedButton,
                                                                           action.ActionType, battleEngine));
                ActionGrid.Children.Add(animatedButton);
                left += 40;
            });
        }
Exemplo n.º 5
0
 static public int set_interactable(IntPtr l)
 {
     try {
                     #if DEBUG
         var    method     = System.Reflection.MethodBase.GetCurrentMethod();
         string methodName = GetMethodName(method);
                     #if UNITY_5_5_OR_NEWER
         UnityEngine.Profiling.Profiler.BeginSample(methodName);
                     #else
         Profiler.BeginSample(methodName);
                     #endif
                     #endif
         AnimatedButton self = (AnimatedButton)checkSelf(l);
         System.Boolean v;
         checkType(l, 2, out v);
         self.interactable = v;
         pushValue(l, true);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
             #if DEBUG
     finally {
                     #if UNITY_5_5_OR_NEWER
         UnityEngine.Profiling.Profiler.EndSample();
                     #else
         Profiler.EndSample();
                     #endif
     }
             #endif
 }
Exemplo n.º 6
0
        private void DrawBackground(SpriteBatch batch)
        {
            Rectangle FULL_SCREEN = new Rectangle(0, 0, ScreenUtils.ScreenWidth,
                                                  ScreenUtils.ScreenHeight);

            float alpha;



            try
            {
                AnimatedButton referenceButton = lastButtonPressed == null ? buttons[buttons.Length - 1] : lastButtonPressed;
                alpha =
                    (float)(ScreenUtils.ScreenWidth - referenceButton.x)
                    / (float)ScreenUtils.ScreenWidth;
            }
            catch (System.Exception)
            {
                alpha = 1.0f;
            }

            alpha = 1.0f;

            Color color = new Color(alpha, alpha, alpha, alpha);

            batch.Draw(background, FULL_SCREEN, color);
        }
Exemplo n.º 7
0
        public void OnLoadContentEvent(MPP.core2d.GameScreenManager.LoadContentEventArgs eventArgs)
        {
            background = ScreenUtils.GetTexture("mainMenuBackground");

            buttons = new core2d.AnimatedButton[2];

            buttons[0] = new AnimatedButton(MenuScreen.START_A_NEW_GAME_BUTTON_LABEL);
            SetNewGameButtonLabel();


            buttons[1] = new AnimatedButton(MenuScreen.SOUND_SETTINGS_BUTTON_LABEL);
            SetSoundButtonLabel();

            /*
             * buttons[2] = new AnimatedButton(MenuScreen.HELP_BUTTON_LABEL);
             * buttons[2].SetLabel(Constans.MENU_SELECTED_BUTTON_BACKGROUND_COLOR, Constans.MENU_NON_SELECTED_BUTTON_BACKGROUND_COLOR, Constans.MENU_NON_SELECTED_BUTTON_BACKGROUND_COLOR,
             *  Constans.MENU_NON_ACTIVE_TEXT_COLOR, Constans.MENU_FONT_NAME,
             *  ResourceManager.Instance.GetString(ResourceManager.StringKey.HELP),
             *  Constans.STANDARD_BUTTON_WIDTH, Constans.STANDARD_BUTTON_HEIGHT);
             */
            for (int i = 0; i < buttons.Length; i++)
            {
                buttons[i].ButtonPressedListener    += this.OnButtonPressed;
                buttons[i].ButtonTransitionListener += this.OnButtonTransition;
                transitionButtonCountdown            = 0;
            }
        }
Exemplo n.º 8
0
    private void Awake()
    {
        MainMenu.isGameHallExitOpened = false;
        this.shopButton = GameObject.Find("MainShopButton");
        this.m_crossPromotionOverlay = UnityEngine.Object.Instantiate <GameObject>(this.m_crossPromotionOverlay);
        this.m_crossPromotionOverlay.SetActive(false);
        if (this.m_settingsPopup != null)
        {
            this.m_settingsPopup.SetActive(false);
        }
        if (Singleton <BuildCustomizationLoader> .Instance.IAPEnabled)
        {
            if (GameProgress.GetSandboxUnlocked("S-F"))
            {
                this.m_iapButton.SetActive(false);
            }
        }
        else
        {
            this.m_iapButton.SetActive(false);
        }
        AnimatedButton animatedButton = this.cakeRaceButton;

        animatedButton.OnOpenAnimationEvent = (Action <Spine.Event>)Delegate.Combine(animatedButton.OnOpenAnimationEvent, new Action <Spine.Event>(this.OnCakeRaceUnlockAnimationEvent));
        HatchManager.onLoginSuccess         = (Action)Delegate.Combine(HatchManager.onLoginSuccess, new Action(this.HideLockScreen));
        HatchManager.onLoginFailed          = (Action)Delegate.Combine(HatchManager.onLoginFailed, new Action(this.HideLockScreen));
        HatchManager.onLogout = (Action)Delegate.Combine(HatchManager.onLogout, new Action(this.LoggedOut));
    }
        public CraftingInformationPage(int x, int y, int width, int height, Color BackgroundColor, CraftingRecipeButton ItemToDisplay, ref IList <Item> Inventory, ref IList <Item> OutputInventory, bool IsPlayerInventory, Machine Machine) : base(x, y, width, height, false)
        {
            this.backgroundColor     = BackgroundColor;
            this.infoButton          = ItemToDisplay;
            this.itemDisplayLocation = new Vector2(this.xPositionOnScreen + (this.width / 2) - 32, this.yPositionOnScreen + (128));
            this.inventory           = Inventory;
            this.isPlayerInventory   = IsPlayerInventory;

            this.requiredItems = new Dictionary <ItemDisplayButton, int>();
            for (int i = 0; i < this.infoButton.recipe.ingredients.Count; i++)
            {
                ItemDisplayButton b = new ItemDisplayButton(this.infoButton.recipe.ingredients.ElementAt(i).item, null, new Vector2(this.xPositionOnScreen + 64 + this.width, this.yPositionOnScreen + (i * 64) + 128), new Rectangle(0, 0, 64, 64), 2f, true, Color.White);
                this.requiredItems.Add(b, this.infoButton.recipe.ingredients.ElementAt(i).requiredAmount);
            }
            this.craftingButton = new AnimatedButton(new StardustCore.Animations.AnimatedSprite("CraftingButton", new Vector2(this.xPositionOnScreen + this.width / 2 - 96, this.getCraftingButtonHeight()), new StardustCore.Animations.AnimationManager(TextureManager.GetExtendedTexture(ModCore.Manifest, "CraftingMenu", "CraftButton"), new StardustCore.Animations.Animation(0, 0, 48, 16)), Color.White), new Rectangle(0, 0, 48, 16), 4f);

            if (OutputInventory == null)
            {
                this.outputInventory = this.inventory;
            }
            if (this.infoButton.recipe.statCost != null)
            {
                if (this.infoButton.recipe.statCost.gold > 0)
                {
                    this.goldButton = new AnimatedButton(new StardustCore.Animations.AnimatedSprite("GoldButton", this.getMoneyRequiredOffset(), new StardustCore.Animations.AnimationManager(TextureManager.GetExtendedTexture(ModCore.Manifest, "CraftingMenu", "GoldButton"), new StardustCore.Animations.Animation(0, 0, 16, 16)), Color.White), new Rectangle(0, 0, 16, 16), 2f);
                }
            }
            this.outputInventory = OutputInventory;
            this.machine         = Machine;
        }
Exemplo n.º 10
0
 private void ControlManagerOnFocusChanged(object sender, EventArgs e)
 {
     if (sender is AnimatedButton)
     {
         AnimatedButton button = sender as AnimatedButton;
         button.Reset();
     }
 }
Exemplo n.º 11
0
 private void OnButtonMovedIn(AnimatedButton button)
 {
     if (transitionState == TransitionState.MOVING_IN)
     {
         transitionState = TransitionState.ON_SCREEN;
         OnScreenTransition(new TransitionCompletedEventArgs());
     }
 }
Exemplo n.º 12
0
        private static void InitiateFight(object sender, MouseButtonEventArgs e)
        {
            Button         button         = sender as Button;
            Grid           grid           = button?.Parent as Grid;
            AnimatedButton animatedButton = grid?.Parent as AnimatedButton;

            animatedButton?.BattleEngine.Fight(null, animatedButton.Action);
            animatedButton?.BattleEngine.SelectChar(animatedButton.BattleEngine.SelectedCharacter);
        }
Exemplo n.º 13
0
        private void ChangeTeamAction(object sender)
        {
            AnimatedButton b = (AnimatedButton)sender;

            b.Disable();
            b.OnDisabled = (a) => { b.Enable(); };

            ServerInformationHandler.ChangeTeam();
        }
Exemplo n.º 14
0
 public AnimatedButtonController(ButtonStatesImages buttonStatesImages, AnimatedButton animatedButton, ActionTypes.ActionType actionType, BattleEngine battleEngine)
 {
     this.ButtonStatesImages   = buttonStatesImages;
     this.AnimatedButton       = animatedButton;
     this.ActionType           = actionType;
     AnimatedButton.ActionType = actionType;
     this.BattleEngine         = battleEngine;
     SetImageSourcesForAnimatedButton();
 }
Exemplo n.º 15
0
        public void OnButtonTransition(AnimatedButton button)
        {
            transitionButtonCountdown--;

            if (transitionButtonCountdown == 0)
            {
                OnScreenTransition(new TransitionCompletedEventArgs());
            }
        }
Exemplo n.º 16
0
        private void OnButtonPressed(AnimatedButton button)
        {
            startBattleButton.x = -1000;
            GameState.Instance.CurrentGameState = GameState.State.DURING_GAMEPLAY;
            if (GameState.Instance.IsEnemyAlive == null)
            {
                SaveEnemyState();
            }

            GameState.Instance.IsGameInProgress = true;
        }
 public InventoryTransferMenu(int x, int y, int width, int height, IList <Item> OtherItems, int OtherCapacity, int OtherRows = 6, int OtherCollumns = 6) : base(x, y, width, height, true)
 {
     this.playerInventory   = new InventoryMenu(x, y, width, height, 6, 6, true, Game1.player.Items, Game1.player.MaxItems, Color.SandyBrown);
     this.otherItems        = OtherItems;
     this.otherInventory    = new InventoryMenu(this.playerInventory.xPositionOnScreen + this.playerInventory.width + 128, y, width, height, OtherRows, OtherCollumns, true, this.otherItems, OtherCapacity, Color.SandyBrown);
     this.isPlayerInventory = true;
     this.currentMode       = CurrentMode.TransferItems;
     this.transferButton    = new AnimatedButton(new StardustCore.Animations.AnimatedSprite("Transfer Button", new Vector2(this.playerInventory.xPositionOnScreen + this.playerInventory.width + 64, this.playerInventory.yPositionOnScreen + (this.playerInventory.height * .3f)), new AnimationManager(TextureManager.GetExtendedTexture(ModCore.Manifest, "InventoryMenu", "ItemTransferButton"), new Animation(0, 0, 32, 32)), Color.White), new Rectangle(0, 0, 32, 32), 2f);
     this.trashButton       = new AnimatedButton(new StardustCore.Animations.AnimatedSprite("Trash Button", new Vector2(this.playerInventory.xPositionOnScreen + this.playerInventory.width + 64, this.playerInventory.yPositionOnScreen + (this.playerInventory.height * .3f) + 96), new AnimationManager(TextureManager.GetExtendedTexture(ModCore.Manifest, "InventoryMenu", "TrashButton"), new Animation(0, 0, 32, 32)), Color.White), new Rectangle(0, 0, 32, 32), 2f);
     this.trashedItem       = new ItemDisplayButton(null, new StardustCore.Animations.AnimatedSprite("ItemBackground", new Vector2(this.playerInventory.xPositionOnScreen + this.playerInventory.width + 64, this.playerInventory.yPositionOnScreen + (this.playerInventory.height * .3f) + 180), new AnimationManager(TextureManager.GetExtendedTexture(ModCore.Manifest, "InventoryMenu", "ItemBackground"), new Animation(0, 0, 32, 32)), Color.White), new Vector2(this.playerInventory.xPositionOnScreen + this.playerInventory.width + 64, this.playerInventory.yPositionOnScreen + (this.playerInventory.height * .3f) + 180), new Rectangle(0, 0, 32, 32), 2f, true, Color.White);
 }
        /// <summary>
        /// Initialize the buttons for the menu.
        /// </summary>
        private void initializeButtons()
        {
            this.leftButton  = new AnimatedButton(new StardustCore.Animations.AnimatedSprite("Left Button", new Vector2(this.xPositionOnScreen, this.yPositionOnScreen), new StardustCore.Animations.AnimationManager(TextureManager.GetExtendedTexture(ModCore.Manifest, "InventoryMenu", "PreviousPageButton"), new StardustCore.Animations.Animation(0, 0, 32, 32)), Color.White), new Rectangle(0, 0, 32, 32), 2f);
            this.rightButton = new AnimatedButton(new StardustCore.Animations.AnimatedSprite("Right Button", new Vector2(this.xPositionOnScreen + this.width, this.yPositionOnScreen), new StardustCore.Animations.AnimationManager(TextureManager.GetExtendedTexture(ModCore.Manifest, "InventoryMenu", "NextPageButton"), new StardustCore.Animations.Animation(0, 0, 32, 32)), Color.White), new Rectangle(0, 0, 32, 32), 2f);

            this.searchBox        = new TextBox((Texture2D)null, (Texture2D)null, Game1.dialogueFont, Game1.textColor);
            this.searchBox.X      = this.xPositionOnScreen + this.width + 96;
            this.searchBox.Y      = this.yPositionOnScreen;
            this.searchBox.Width  = 256;
            this.searchBox.Height = 192;
            Game1.keyboardDispatcher.Subscriber = (IKeyboardSubscriber)this.searchBox;
            this.searchBox.Selected             = false;
        }
Exemplo n.º 19
0
        public void addInMenuTab(string Name, AnimatedButton Button, IClickableMenuExtended Menu, bool DefaultTab = false)
        {
            int count = this.menuPages.Count;

            Vector2 newPos = new Vector2(208 + (24 * 2) * (count + 1), this.yPositionOnScreen + (80));

            Button.Position = newPos;
            this.menuPages.Add(Name, new KeyValuePair <AnimatedButton, IClickableMenuExtended>(Button, Menu));

            if (DefaultTab)
            {
                this.currentTab = Name;
            }
        }
Exemplo n.º 20
0
 public void addInCraftingTab(string TabName, AnimatedButton TabSprite, bool IsDefaultTab)
 {
     if (this.craftingMenuTabs.ContainsKey(TabName))
     {
         throw new Exception("A tab with the same name already exists!");
     }
     else
     {
         this.craftingMenuTabs.Add(TabName, TabSprite);
     }
     if (IsDefaultTab)
     {
         this.defaultTab = TabName;
     }
 }
Exemplo n.º 21
0
        private void OnLoadContentEvent(GameScreenManager.LoadContentEventArgs eventArgs)
        {
            fadeOutOverlay = ScreenUtils.GetTexture("fadeout_overlay");
            font           = ScreenUtils.GetFont("GameOverFont");

            mainMenuButton = new AnimatedButton("mainMenuButton");
            mainMenuButton.SetLabel(Constans.MENU_SELECTED_BUTTON_BACKGROUND_COLOR, Constans.MENU_NON_SELECTED_BUTTON_BACKGROUND_COLOR, Constans.MENU_NON_SELECTED_BUTTON_BACKGROUND_COLOR,
                                    Constans.MENU_NON_ACTIVE_TEXT_COLOR, Constans.MENU_FONT_NAME,
                                    ResourceManager.Instance.GetString(ResourceManager.StringKey.MAIN_MENU_BUTTON_LABEL),
                                    Constans.STANDARD_BUTTON_WIDTH, Constans.STANDARD_BUTTON_HEIGHT);
            mainMenuButton.ButtonPressedListener += OnButtonPressed;
            mainMenuButton.x = 0;
            mainMenuButton.y = ScreenUtils.ScreenHeight - Constans.STANDARD_BUTTON_HEIGHT - Constans.STANDARD_BUTTON_HEIGHT / 10;

            background = ScreenUtils.GetTexture("gameOverBackground");
        }
Exemplo n.º 22
0
    void Start()
    {
        _button         = transform.parent.Find("MenuButton").GetComponent <AnimatedButton>();
        _gameController = GameObject.Find("GameController").GetComponent <GameController>();

        _text        = transform.GetChild(0).GetComponent <TextMeshProUGUI>();
        _othersTexts = new TextMeshProUGUI[2];

        _othersTexts[0] = gameObject.name == "Play"
                            ? transform.parent.Find("Options").GetChild(0).GetComponent <TextMeshProUGUI>()
                            : transform.parent.Find("Play").GetChild(0).GetComponent <TextMeshProUGUI>();

        _othersTexts[1] = gameObject.name == "Exit"
                            ? transform.parent.Find("Options").GetChild(0).GetComponent <TextMeshProUGUI>()
                            : transform.parent.Find("Exit").GetChild(0).GetComponent <TextMeshProUGUI>();
    }
        /// <summary>
        /// Adds in a new tab for the crafting recipe menu.
        /// </summary>
        /// <param name="name"></param>
        /// <param name="Button"></param>
        public void addInCraftingPageTab(string name, AnimatedButton Button)
        {
            int count = this.CraftingTabs.Count;

            if (this.CraftingTabs.ContainsKey(name))
            {
                return;
            }
            else
            {
                Vector2 newPos = new Vector2(100 + (48), (this.yPositionOnScreen + 24) + ((24 * 4) * (count + 1)));
                ModCore.log("newPos: " + newPos.ToString());
                Button.Position = newPos;
                this.CraftingTabs.Add(name, Button);
                this.craftingItemsToDisplay.Add(name, new List <CraftingRecipeButton>());
            }
        }
Exemplo n.º 24
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);
            TextureManager.Load("Player");
            TextureManager.Load("Shield");
            Animation a  = new Animation("BasicAnimatedButton1x3", 0.6f, 1, 3, true);
            Texture2D t2 = TextureManager.Load("BasicButtonHover");

            button             = new AnimatedButton(new Vector2(graphics.PreferredBackBufferWidth / 2, graphics.PreferredBackBufferHeight / 2), a, t2);
            camera             = new Camera(GraphicsDevice.Viewport, new Vector2(graphics.PreferredBackBufferWidth / 2, graphics.PreferredBackBufferHeight / 2));
            camera.Focus       = player;
            camera.MaxDistance = 100f;
            camera.Debug       = true;
            button.OnClick    += (() => button.Position += new Vector2(30, 0));
            // TODO: use this.Content to load your game content here
        }
Exemplo n.º 25
0
    void SelectGameObject(GameObject target)
    {
        if (selectedGameObject != null)
        {
            Animator[]      animators       = selectedGameObject.GetComponentsInChildren <Animator>();
            ButtonAnimation buttonAnimation = selectedGameObject.GetComponent <ButtonAnimation>();
            for (int i = 0; i < animators.Length; i++)
            {
                animators[i].SetTrigger("exit");
            }
            if (buttonAnimation != null)
            {
                buttonAnimation.ChangeState(ButtonAnimation.state.Idle);
            }
        }

        if (highlightClip != null)
        {
            AudioInstance.PlayClipAtPoint(highlightClip, Vector3.zero);
        }

        selectedGameObject = target;
        if (target != null)
        {
            rt.SetParent(target.transform);
            rt.anchoredPosition = Vector2.zero;

            AnimatedButton animatedButton = selectedGameObject.GetComponent <AnimatedButton>();
            if (animatedButton != null)
            {
                animatedButton.Select();
            }
            else if (target.GetComponent <IPointerClickHandler>() != null)
            {
                Animator[] animators = target.GetComponentsInChildren <Animator>();
                for (int i = 0; i < animators.Length; i++)
                {
                    animators[i].SetTrigger("enter");
                }
            }
        }
        else
        {
            transform.position = new Vector2(-5000, -5000);
        }
    }
Exemplo n.º 26
0
        public ServerSelection()
        {
            ServerInformationHandler.RequestServerList();

            Background = new Sprite(@"Interface/InGame/Scene/ServerList/Background",
                                    position: Parameter.ScreenCenter,
                                    layerDepth: DepthParameter.Background,
                                    shouldCopyAsset: false);

            //Must change exit door position on gamelist as well
            exitDoor = AnimatedButtonBuilder.BuildButton(
                AnimatedButtonType.ExitDoor,
                Parameter.ScreenCenter + new Vector2(-330, 265),
                (sender) =>
            {
                SceneHandler.Instance.CloseGame();
            });

            serverButtonList = new List <ServerButton>();

            ServerInformationBroker.Instance.ActionCallbackDictionary.AddOrReplace(NetworkObjectParameters.GameServerPlayerAccessRequest, ChangeScene);
        }
Exemplo n.º 27
0
        public void AddBottomAnimatedButtonsToScene()
        {
            //Left Side
            int i = 0;

            Vector2 basePosition = Parameter.ScreenCenter - new Vector2(360, -265);
            Vector2 offset       = new Vector2(72, 0);

            animatedButtonList.Add(AnimatedButtonBuilder.BuildButton(AnimatedButtonType.ExitDoor, basePosition + offset * i++, ExitDoorAction));
            animatedButtonList.Add(AnimatedButtonBuilder.BuildButton(AnimatedButtonType.Buddy, basePosition + offset * i++, ExitDoorAction));
            animatedButtonList.Add(AnimatedButtonBuilder.BuildButton(AnimatedButtonType.Options, basePosition + offset * i++, OptionsAction));

            /*
             * basePosition += new Vector2(0, -55);
             * i = 0;
             *
             * animatedButtonList.Add(AnimatedButtonBuilder.BuildButton(AnimatedButtonType.ExitDoor, basePosition + offset * i++, ExitDoorAction));
             * animatedButtonList.Add(AnimatedButtonBuilder.BuildButton(AnimatedButtonType.ExitDoor, basePosition + offset * i++, ExitDoorAction));
             * animatedButtonList.Add(AnimatedButtonBuilder.BuildButton(AnimatedButtonType.ExitDoor, basePosition + offset * i++, ExitDoorAction));*/

            //Right Side - Left
            basePosition = Parameter.ScreenCenter - new Vector2(129, -265);
            animatedButtonList.Add(cashChargeButton = AnimatedButtonBuilder.BuildButton(AnimatedButtonType.CashCharge, basePosition, ExitDoorAction));

            //Right Side - Right
            offset       = new Vector2(62, 0);
            basePosition = Parameter.ScreenCenter - new Vector2(-370, -265) - 2 * offset;
            i            = 0;

            animatedButtonList.Add(tryButton  = AnimatedButtonBuilder.BuildButton(AnimatedButtonType.Try, basePosition + offset * i++, TryButtonAction));
            animatedButtonList.Add(buyButton  = AnimatedButtonBuilder.BuildButton(AnimatedButtonType.Buy, basePosition + offset * i++, BuyButtonAction));
            animatedButtonList.Add(giftButton = AnimatedButtonBuilder.BuildButton(AnimatedButtonType.Gift, basePosition + offset * i++, ExitDoorAction));

            animatedButtonList.Add(filterLeftButton = AnimatedButtonBuilder.BuildButton(AnimatedButtonType.LeftArrow,
                                                                                        Parameter.ScreenCenter - new Vector2(-141 + 40 + 30, -245), (o) => { UpdateFilter(searchFilter.AvatarCategory, searchFilter.CurrentPage - 1); }));
            animatedButtonList.Add(filterRightButton = AnimatedButtonBuilder.BuildButton(AnimatedButtonType.RightArrow,
                                                                                         Parameter.ScreenCenter - new Vector2(-141 - 40, -245), (o) => { UpdateFilter(searchFilter.AvatarCategory, searchFilter.CurrentPage + 1); }));
        }
Exemplo n.º 28
0
        public void AddFilterAnimatedButtonsToScene()
        {
            Vector2 position = Parameter.ScreenCenter - new Vector2(130, 250);
            Vector2 offset   = new Vector2(45, 0);
            int     i        = 0;

            filterButtonList.Add(filterHatButton = AnimatedButtonBuilder.BuildButton(AnimatedButtonType.Hat,
                                                                                     position + offset * i++, (o) => { FilterButtonAction(o, AvatarCategory.Hat); }));
            filterButtonList.Add(filterBodyButton = AnimatedButtonBuilder.BuildButton(AnimatedButtonType.Body,
                                                                                      position + offset * i++, (o) => { FilterButtonAction(o, AvatarCategory.Body); }));
            filterButtonList.Add(filterGogglesButton = AnimatedButtonBuilder.BuildButton(AnimatedButtonType.Goggles,
                                                                                         position + offset * i++, (o) => { FilterButtonAction(o, AvatarCategory.Goggles); }));
            filterButtonList.Add(filterFlagButton = AnimatedButtonBuilder.BuildButton(AnimatedButtonType.Flag,
                                                                                      position + offset * i++, (o) => { FilterButtonAction(o, AvatarCategory.Flag); }));
            filterButtonList.Add(filterExItemButton = AnimatedButtonBuilder.BuildButton(AnimatedButtonType.ExItem,
                                                                                        position + offset * i++, (o) => { FilterButtonAction(o, AvatarCategory.ExItem); }));
            filterButtonList.Add(filterPetButton = AnimatedButtonBuilder.BuildButton(AnimatedButtonType.Pet,
                                                                                     position + offset * i++, (o) => { FilterButtonAction(o, AvatarCategory.Pet); }));
            filterButtonList.Add(filterMiscButton = AnimatedButtonBuilder.BuildButton(AnimatedButtonType.Necklace,
                                                                                      position + offset * i++, (o) => { FilterButtonAction(o, AvatarCategory.Misc); }));
            filterButtonList.Add(filterExtraButton = AnimatedButtonBuilder.BuildButton(AnimatedButtonType.Ring,
                                                                                       position + offset * i++, (o) => { FilterButtonAction(o, AvatarCategory.Extra); }));
        }
Exemplo n.º 29
0
        public void OnButtonPressed(AnimatedButton button)
        {
            lastButtonPressed = button;

            if (button.Name.Equals(MenuScreen.SOUND_SETTINGS_BUTTON_LABEL))
            {
                SoundPlayer.Instance.IsSoundEnabled = !SoundPlayer.Instance.IsSoundEnabled;
                SetSoundButtonLabel();
            }
            else if (button.Name.Equals(MenuScreen.HELP_BUTTON_LABEL))
            {
                // NOP
            }
            else if (button.Name.Equals(MenuScreen.START_A_NEW_GAME_BUTTON_LABEL))
            {
                GameScreenManager.Instance.MoveToScreen(BattleScreen.ID);
                BattleScreen.shouldBeRestarted = true;
            }
            else
            {
                throw new NotSupportedException("Button " + button.Name + " not implemented");
            }
        }
        public MachineSummaryMenu(int x, int y, int width, int height, Color BackgroundColor, CustomObject SourceObject, int RequiredEnergyPer10Min) : base(x, y, width, height, false)
        {
            this.objectSource    = SourceObject;
            this.backgroundColor = BackgroundColor;
            this.energyTexture   = new Texture2D(Game1.graphics.GraphicsDevice, 1, 1);
            this.energyMeterColorSwap();

            this.timeDisplayLocation             = new Vector2(this.xPositionOnScreen + (this.width * .1f), this.yPositionOnScreen + (this.height * .25f));
            this.energyRequiredDisplayLocation   = this.timeDisplayLocation + new Vector2(0, 64);
            this.storageRemainingDisplayLocation = this.energyRequiredDisplayLocation + new Vector2(0, 64);
            this.fluidDisplayLocation            = this.storageRemainingDisplayLocation + new Vector2(0, 64);

            this.energyPosition      = new Vector2(this.xPositionOnScreen + this.width - 128, this.yPositionOnScreen + this.height - 72 * 4);
            this.batteryBackground   = new AnimatedButton(new StardustCore.Animations.AnimatedSprite("BatteryFrame", this.energyPosition, new StardustCore.Animations.AnimationManager(TextureManager.GetExtendedTexture(ModCore.Manifest, "Menus.EnergyMenu", "BatteryFrame"), new StardustCore.Animations.Animation(0, 0, 32, 64)), Color.White), new Rectangle(0, 0, 32, 64), 4f);
            this.battergyEnergyGuage = new AnimatedButton(new StardustCore.Animations.AnimatedSprite("BatteryEnergyGuage", this.energyPosition, new StardustCore.Animations.AnimationManager(TextureManager.GetExtendedTexture(ModCore.Manifest, "Menus.EnergyMenu", "BatteryEnergyGuage"), new StardustCore.Animations.Animation(0, 0, 32, 64)), Color.White), new Rectangle(0, 0, 32, 64), 4f);

            this.itemDisplayOffset    = ObjectUtilities.GetDimensionOffsetFromItem(this.objectSource);
            this.clockSprite          = new AnimatedButton(new StardustCore.Animations.AnimatedSprite("Time Remaining", this.timeDisplayLocation, new StardustCore.Animations.AnimationManager(TextureManager.GetExtendedTexture(ModCore.Manifest, "Menus", "Clock"), new StardustCore.Animations.Animation(0, 0, 18, 18)), Color.White), new Rectangle(0, 0, 18, 18), 2f);
            this.energyRequiredButton = new AnimatedButton(new StardustCore.Animations.AnimatedSprite("Energy Required", this.energyRequiredDisplayLocation, new StardustCore.Animations.AnimationManager(TextureManager.GetExtendedTexture(ModCore.Manifest, "Menus.EnergyMenu", "LightningBolt"), new StardustCore.Animations.Animation(0, 0, 16, 16)), Color.White), new Rectangle(0, 0, 16, 16), 2f);
            this.storageButton        = new AnimatedButton(new StardustCore.Animations.AnimatedSprite("Storage Remaining", this.storageRemainingDisplayLocation, new StardustCore.Animations.AnimationManager(TextureManager.GetExtendedTexture(ModCore.Manifest, "Menus", "Chest"), new StardustCore.Animations.Animation(0, 0, 16, 32)), Color.White), new Rectangle(0, 0, 16, 32), 1f);


            if (this.objectSource.GetFluidManager().inputTank1.capacity > 0)
            {
                this.inputFluidTank1Button = new AnimatedButton(new StardustCore.Animations.AnimatedSprite("Input 1 fluid:", this.fluidDisplayLocation, new StardustCore.Animations.AnimationManager(TextureManager.GetExtendedTexture(ModCore.Manifest, "Menus.EnergyMenu", this.objectSource.info.fluidManager.inputTank1.fluid != null ? "DropletColored" : "DropletOutline"), new StardustCore.Animations.Animation(0, 0, 16, 16)), this.objectSource.info.fluidManager.inputTank1.fluid != null ? this.objectSource.info.fluidManager.inputTank1.fluid.color : Color.White), new Rectangle(0, 0, 16, 16), 2f);
            }
            if (this.objectSource.GetFluidManager().inputTank2.capacity > 0)
            {
                this.inputFluidTank2Button = new AnimatedButton(new StardustCore.Animations.AnimatedSprite("Input 2 fluid:", this.fluidDisplayLocation + new Vector2(0, 64), new StardustCore.Animations.AnimationManager(TextureManager.GetExtendedTexture(ModCore.Manifest, "Menus.EnergyMenu", this.objectSource.info.fluidManager.inputTank2.fluid != null ? "DropletColored" : "DropletOutline"), new StardustCore.Animations.Animation(0, 0, 16, 16)), this.objectSource.info.fluidManager.inputTank2.fluid != null ? this.objectSource.info.fluidManager.inputTank2.fluid.color : Color.White), new Rectangle(0, 0, 16, 16), 2f);
            }
            //ModCore.log(this.objectSource.info.fluidManager.outputTank.fluid != null ? "Color of fluid:" + this.objectSource.info.fluidManager.outputTank.fluid.color.ToString() : "Color is null!");
            if (this.objectSource.GetFluidManager().outputTank.capacity > 0)
            {
                this.outputFluidTankButton = new AnimatedButton(new StardustCore.Animations.AnimatedSprite("Output fluid:", this.fluidDisplayLocation + new Vector2(0, 128), new StardustCore.Animations.AnimationManager(TextureManager.GetExtendedTexture(ModCore.Manifest, "Menus.EnergyMenu", this.objectSource.info.fluidManager.outputTank.fluid != null ? "DropletColored" : "DropletOutline"), new StardustCore.Animations.Animation(0, 0, 16, 16)), this.objectSource.info.fluidManager.outputTank.fluid != null ? this.objectSource.info.fluidManager.outputTank.fluid.color : Color.White), new Rectangle(0, 0, 16, 16), 2f);
            }
            this.requiredEnergyPer10Min = RequiredEnergyPer10Min;
        }