X-Git-Url: https://git.r.bdr.sh/rbdr/super-polarity/blobdiff_plain/6fceaa7b34f4d6efc497cda51679b37e530a61aa..d7a43ae2d3d4702bd199fa5d8ca84c7c6e78ed36:/SuperPolarityMac/NameChooserWidget.cs diff --git a/SuperPolarityMac/NameChooserWidget.cs b/SuperPolarityMac/NameChooserWidget.cs deleted file mode 100644 index ce7c149..0000000 --- a/SuperPolarityMac/NameChooserWidget.cs +++ /dev/null @@ -1,99 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; - -namespace SuperPolarity -{ - class NameChooserWidget : Widget - { - int CurrentIndex; - bool Lock; - int LockRate; - int CurrentTime; - - public NameChooserWidget(SuperPolarity game, Vector2 position) - : base(game, position) - { - AppendChild(new LetterChooseWidget(game, new Vector2(position.X, position.Y))); - AppendChild(new LetterChooseWidget(game, new Vector2(position.X + 32, position.Y))); - AppendChild(new LetterChooseWidget(game, new Vector2(position.X + 64, position.Y))); - CurrentIndex = 0; - Children[CurrentIndex].Activate(); - LockRate = 300; - CurrentTime = 0; - - InputController.Bind("moveX", HandleMovement); - } - - public override void Update(GameTime gameTime) - { - base.Update(gameTime); - - CurrentTime = CurrentTime + gameTime.ElapsedGameTime.Milliseconds; - if (CurrentTime > LockRate) - { - CurrentTime = 0; - Lock = false; - } - - foreach (LetterChooseWidget widget in Children) - { - widget.Update(gameTime); - } - } - - public void HandleMovement(float value) - { - if (value > 0.8 && !Lock) - { - Children[CurrentIndex].Deactivate(); - CurrentIndex = CurrentIndex + 1; - - if (CurrentIndex > Children.Count - 1) - { - CurrentIndex = 0; - } - - Lock = true; - } - - if (value < -0.8 && !Lock) - { - Children[CurrentIndex].Deactivate(); - CurrentIndex = CurrentIndex - 1; - - if (CurrentIndex < 0) - { - CurrentIndex = Children.Count - 1; - } - - Lock = true; - } - - Children[CurrentIndex].Activate(); - } - - public string Value() - { - var name = ""; - - foreach (LetterChooseWidget letter in Children) - { - name = name + letter.Value(); - } - - return name; - } - - public override void Draw(SpriteBatch spriteBatch) - { - foreach (LetterChooseWidget widget in Children) - { - widget.Draw(spriteBatch); - } - } - } -}