Ejemplo n.º 1
0
 private void UpdateDatas()
 {
     Datas = UpdateDataFunc();
     listControl.RemoveAllFromList();
     foreach (KeyValuePair <string, T> pair in Datas)
     {
         listControl.AddToList(pair.Key);
     }
 }
Ejemplo n.º 2
0
        public override void Update(GameTime gameTime, bool isInForeground)
        {
            base.Update(gameTime, isInForeground);

            if (!isInForeground)
            {
                return;
            }

            panel.Update(gameTime);

            if (toRightButton.IsPressed() && spriteLib.SelectedItem != null)
            {
                spriteSelected.AddToList(spriteLib.SelectedItem);
                UpdateAnimation();
            }
            if (toLeftButton.IsPressed() && spriteSelected.SelectedItem != null)
            {
                spriteSelected.RemoveFromList(spriteSelected.SelectedIndex);
                UpdateAnimation();
            }
            if (toUpButton.IsPressed() && spriteSelected.SelectedItem != null && spriteSelected.SelectedIndex > 0)
            {
                List <string> items = spriteSelected.Items;
                int           index = spriteSelected.SelectedIndex;
                items.RemoveAt(index);
                items.Insert(index - 1, spriteSelected.SelectedItem);
                spriteSelected.RemoveAllFromList();
                foreach (string s in items)
                {
                    spriteSelected.AddToList(s);
                }
            }
            if (toDownButton.IsPressed() && spriteSelected.SelectedItem != null && spriteSelected.SelectedIndex < spriteSelected.Items.Count - 1)
            {
                List <string> items = spriteSelected.Items;
                int           index = spriteSelected.SelectedIndex;
                items.RemoveAt(index);
                items.Insert(index + 1, spriteSelected.SelectedItem);
                spriteSelected.RemoveAllFromList();
                foreach (string s in items)
                {
                    spriteSelected.AddToList(s);
                }
            }
            float frameTime = animCurrentlyBuilding.FrameTime;

            float.TryParse(frameTimeTextBox.Text, out frameTime);
            animCurrentlyBuilding.FrameTime    = frameTime;
            animCurrentlyBuilding.SpriteEffect = (SpriteEffects)Enum.Parse(typeof(SpriteEffects), effectButton.List[effectButton.CurrentIndex]);

            if (addAnimationButton.IsPressed() && animCurrentlyBuilding.FrameCount > 0 && !String.IsNullOrWhiteSpace(addSpriteText.Text))
            {
                Resources.Add(addSpriteText.Text, animCurrentlyBuilding);
                animCurrentlyBuilding = new Animation(Resources, new string[] { }, 1, true);
                UpdateAnimation();
            }

            if (submitButton.IsPressed())
            {
                IsSubmitted = true;
                Manager.CloseScreen();
                return;
            }
        }