private static void SplashScreenCompleted() { Global.CurrentScreen.Children.Clear(); Global.CurrentScreen.Children.Add(_logoConsole); Global.CurrentScreen.Children.Add(_selectionScreen); _state = SadGuiState.Start; }
private static void Init() { _controller = new MogwaiController(); //SelectionScreen(); SplashScreen(); _state = SadGuiState.START; }
public override bool ProcessKeyboard(Keyboard state) { if (state.IsKeyReleased(Microsoft.Xna.Framework.Input.Keys.Enter)) { State = SadGuiState.SELECTION; return(true); } return(false); }
public PlayScreen(MogwaiController mogwaiController, int width, int height) : base(width, height) { borderSurface = new Basic(width + 2, height + 2, base.Font); borderSurface.DrawBox(new Rectangle(0, 0, borderSurface.Width, borderSurface.Height), new Cell(Color.DarkCyan, Color.Black), null, SurfaceBase.ConnectedLineThick); borderSurface.Position = new Point(-1, -1); Children.Add(borderSurface); State = SadGuiState.PLAY; }
private void DoAction(string actionStr) { switch (actionStr) { case "create": controller.NewMogwaiKeys(); LogInConsole("TASK", "created new mogwaikeys."); break; case "send": if (controller.HasMogwayKeys) { if (controller.SendMog()) { LogInConsole("DONE", $"sending mogs to address {controller.CurrentMogwayKeys.Address}."); } else { LogInConsole("FAIL", $"couldn't send mogs, see log file for more information."); } } break; case "bind": if (controller.HasMogwayKeys) { if (controller.BindMogwai()) { LogInConsole("DONE", $"binding mogwai on address {controller.CurrentMogwayKeys.Address}."); } else { LogInConsole("FAIL", $"couldn't bind mogwai, see log file for more information."); } } break; case "show": break; case "play": State = SadGuiState.PLAY; break; default: break; } // clear all taggs after actions controller.ClearTag(); }
private static void Init() { _controller = new MogwaiController(); if (!DEBUG) { SplashScreen(); _state = SadGuiState.Start; } else { _state = SadGuiState.Play; PlayScreen(); } }
private static SadGuiState Warning(string warning, bool terminate) { var dialog = new MogwaiDialog("Warning", warning, 40, 8); dialog.AddButton("ok"); dialog.Button.Click += (btn, args) => { _state = terminate ? SadGuiState.Quit : SadGuiState.Selection; dialog.Hide(); }; dialog.Show(true); return(SadGuiState.Action); }
private static SadGuiState Unlock() { var dialog = new MogwaiInputDialog("UnlockWallet", "wallet password?", 40, 8); dialog.AddButton("ok"); dialog.Button.Click += (btn, args) => { var password = dialog.Input.Text; _controller.UnlockWallet(password); _state = _controller.IsWalletUnlocked ? SadGuiState.Selection : SadGuiState.Fatalerror; dialog.Hide(); }; dialog.Show(true); return(SadGuiState.Action); }
private static SadGuiState CreateWallet() { var inputDialog = new MogwaiInputDialog("WalletCreation", "new wallet password?", 40, 8); inputDialog.AddButton("ok"); inputDialog.Button.Click += (btn, args) => { var password = inputDialog.Input?.Text; _controller.CreateWallet(password); _state = _controller.IsWalletCreated ? SadGuiState.Mnemoic : SadGuiState.Fatalerror; inputDialog.Hide(); }; inputDialog.Show(true); return(SadGuiState.Action); }
private static SadGuiState ShowMnemonic() { var mnemonicWords = _controller.WalletMnemonicWords; var size = mnemonicWords.Length.ToString(); var dialog = new MogwaiDialog("Show Mnemonic", "[c:g f:LimeGreen:Orange:" + size + "]" + mnemonicWords.ToUpper(), 40, 8); dialog.AddButton("memorized"); dialog.Button.Click += (btn, args) => { _state = SadGuiState.Selection; dialog.Hide(); }; dialog.Show(true); return(SadGuiState.Action); }
private static SadGuiState LoadBlocksAsync() { var dialog = new MogwaiProgressDialog("Loading", "caching all mogwai blocks.", 40, 8); dialog.AddButton("ok"); dialog.StartAsync(); dialog.Button.Click += (btn, args) => { if (dialog.IsComplete) { dialog.Hide(); _state = SadGuiState.Login; } }; dialog.Show(true); return(SadGuiState.Action); }
public void Init() { IsReady = true; Print(65, 0, $"Deposit:", Color.DarkCyan); Print(74, 0, $"[c:g f:LimeGreen:Orange:34]{controller.DepositAddress}"); controller.Refresh(1); State = SadGuiState.SELECTION; infoConsole.Cursor.NewLine(); infoConsole.Cursor.Print(new ColoredString(".:|Keyboard Commands|:.", Color.White, Color.Black)); infoConsole.Cursor.NewLine(); infoConsole.Cursor.NewLine(); InfoPrint(".C.", "create mogwai key"); InfoPrint(".S.", "send 5 mog to addr"); InfoPrint(".B.", "bind mogwai 1 mog"); InfoPrint(".P.", "play mogwai"); InfoPrint(".S.", "show mogwai"); InfoPrint(".L.", "log pub keys file"); InfoPrint(".T.", "tag for send multi"); }
private static SadGuiState Warning(string warning, bool terminate) { var dialog = new MogwaiDialog("Warning", warning, 40, 8); dialog.AddButon("ok"); dialog.button.Click += (btn, args) => { if (terminate) { _state = SadGuiState.QUIT; } else { _state = SadGuiState.SELECTION; } dialog.Hide(); }; dialog.Show(true); return(SadGuiState.ACTION); }
public void Init() { IsVisible = true; _controller.RefreshAll(1); Print(65, 0, "Deposit:", Color.DarkCyan); Print(74, 0, $"[c:g f:LimeGreen:Orange:34]{_controller.DepositAddress}"); State = SadGuiState.Selection; _infoConsole.Cursor.NewLine(); _infoConsole.Cursor.Print(new ColoredString(".:|Keyboard Commands|:.", Color.White, Color.Black)); _infoConsole.Cursor.NewLine(); _infoConsole.Cursor.NewLine(); InfoPrint(".C.", "create mogwai key"); InfoPrint(".S.", "send x mog to addr"); InfoPrint(".B.", "bind mogwai 1 mog"); InfoPrint(".W.", "(un)watch toggle"); InfoPrint(".P.", "play mogwai"); InfoPrint(".L.", "log pub keys file"); InfoPrint(".T.", "tag for send multi"); InfoPrint(".I.", "incr funds sent"); }
private static SadGuiState CreateWallet() { var inputDialog = new MogwaiInputDialog("WalletCreation", "new wallet password?", 40, 8); inputDialog.AddButon("ok"); inputDialog.button.Click += (btn, args) => { string password = inputDialog.input?.Text; _controller.CreateWallet(password); if (_controller.IsWalletCreated) { _state = SadGuiState.MNEMOIC; } else { _state = SadGuiState.FATALERROR; } inputDialog.Hide(); }; inputDialog.Show(true); return(SadGuiState.ACTION); }
private static SadGuiState Unlock() { var dialog = new MogwaiInputDialog("UnlockWallet", "wallet password?", 40, 8); dialog.AddButon("ok"); dialog.button.Click += (btn, args) => { string password = dialog.input.Text; _controller.UnlockWallet(password); if (_controller.IsWalletUnlocked) { _state = SadGuiState.SELECTION; } else { _state = SadGuiState.FATALERROR; } dialog.Hide(); }; dialog.Show(true); return(SadGuiState.ACTION); }
public override bool ProcessKeyboard(Keyboard state) { if (state.IsKeyReleased(Keys.Enter)) { State = SadGuiState.Selection; return(true); } if (Program.DEBUG) { if (state.IsKeyReleased(Keys.Q)) { _glyphIndex++; Print(_glyphX, _glyphY, $"[c:sg {_glyphIndex}:1] ", Color.DarkCyan); Print(_glyphX + 2, _glyphY, $"{_glyphIndex}", Color.Yellow); return(true); } if (state.IsKeyReleased(Keys.A)) { _glyphIndex--; Print(_glyphX, _glyphY, $"[c:sg {_glyphIndex}:1] ", Color.DarkCyan); Print(_glyphX + 2, _glyphY, $"{_glyphIndex}", Color.Yellow); return(true); } if (state.IsKeyReleased(Keys.Right)) { Print(_glyphX, _glyphY, $"[c:sg {_oldglyphIndex}:1] ", Color.DarkCyan); _glyphX++; _oldglyphIndex = GetGlyph(_glyphX, _glyphY); Print(_glyphX, _glyphY, $"[c:sg {_glyphIndex}:1] ", Color.DarkCyan); return(true); } if (state.IsKeyReleased(Keys.Left)) { Print(_glyphX, _glyphY, $"[c:sg {_oldglyphIndex}:1] ", Color.DarkCyan); _glyphX--; _oldglyphIndex = GetGlyph(_glyphX, _glyphY); Print(_glyphX, _glyphY, $"[c:sg {_glyphIndex}:1] ", Color.DarkCyan); return(true); } if (state.IsKeyReleased(Keys.Up)) { Print(_glyphX, _glyphY, $"[c:sg {_oldglyphIndex}:1] ", Color.DarkCyan); _glyphY--; _oldglyphIndex = GetGlyph(_glyphX, _glyphY); Print(_glyphX, _glyphY, $"[c:sg {_glyphIndex}:1] ", Color.DarkCyan); return(true); } if (state.IsKeyReleased(Keys.Down)) { Print(_glyphX, _glyphY, $"[c:sg {_oldglyphIndex}:1] ", Color.DarkCyan); _glyphY++; _oldglyphIndex = GetGlyph(_glyphX, _glyphY); Print(_glyphX, _glyphY, $"[c:sg {_glyphIndex}:1] ", Color.DarkCyan); return(true); } Print(0, 0, $"x:{_glyphX} y:{_glyphY} ind:{_glyphIndex}", Color.Cyan); } return(false); }
private void DoAction(string actionStr) { switch (actionStr) { case "create": _controller.NewMogwaiKeys(); LogInConsole("TASK", "created new mogwaikeys."); break; case "send": if (_controller.HasMogwayKeys) { if (_controller.SendMog(_transferFunds)) { LogInConsole("DONE", $"sending mogs to address {_controller.CurrentMogwaiKeys.Address}."); } else { LogInConsole("FAIL", "couldn\'t send mogs, see log file for more information."); } } break; case "bind": if (_controller.HasMogwayKeys) { if (_controller.BindMogwai()) { LogInConsole("DONE", $"binding mogwai on address {_controller.CurrentMogwaiKeys.Address}."); } else { LogInConsole("FAIL", "couldn\'t bind mogwai, see log file for more information."); } } break; case "watch": if (_controller.CurrentMogwaiKeys != null) { _controller.WatchToggle(); } else { LogInConsole("FAIL", "make sure to choosse a mogwai before trying to play."); } break; case "play": if (_controller.CurrentMogwaiKeys?.Mogwai != null && !_controller.CurrentMogwaiKeys.IsLocked) { State = SadGuiState.Play; } else { LogInConsole("FAIL", "make sure to choosse a mogwai before trying to play."); } break; case "evolve": if (_controller.CurrentMogwaiKeys?.Mogwai != null) { LogInConsole("DONE", $"auto evolving mogwai {_controller.CurrentMogwaiKeys.Mogwai.Name} now."); _controller.EvolveMogwai(); } else { LogInConsole("FAIL", "make sure to choosse a mogwai before trying to play."); } break; } // clear all taggs after actions _controller.ClearTag(); }
private static void Update(GameTime time) { // As an example, we'll use the F5 key to make the game full screen if (Global.KeyboardState.IsKeyReleased(Microsoft.Xna.Framework.Input.Keys.F5)) { Settings.ToggleFullScreen(); } else if (Global.KeyboardState.IsKeyReleased(Microsoft.Xna.Framework.Input.Keys.Escape)) { SadConsole.Game.Instance.Exit(); } //return; // Called each logic update. switch (_state) { case SadGuiState.START: _state = LoadBlocksAsync(); return; case SadGuiState.ACTION: return; case SadGuiState.LOGIN: if (!_controller.IsWalletCreated) { _state = CreateWallet(); } else { _state = Unlock(); } return; case SadGuiState.MNEMOIC: _state = ShowMnemoic(); break; case SadGuiState.SELECTION: if (_selectionScreen == null) { _playScreen = null; SelectionScreen(); _selectionScreen.Init(); break; } _selectionScreen.ProcessKeyboard(Global.KeyboardState); _state = _selectionScreen.GetState(); break; case SadGuiState.PLAY: if (_playScreen == null) { _selectionScreen = null; PlayScreen(); break; } _playScreen.ProcessKeyboard(Global.KeyboardState); _state = _playScreen.GetState(); break; case SadGuiState.FATALERROR: _state = Warning("A fatal error happend!", true); break; case SadGuiState.QUIT: SadConsole.Game.Instance.Exit(); break; } }
private static void Update(GameTime time) { // As an example, we'll use the F5 key to make the game full screen if (Global.KeyboardState.IsKeyReleased(Keys.F5)) { Settings.ToggleFullScreen(); } else if (Global.KeyboardState.IsKeyReleased(Keys.Escape)) { Game.Instance.Exit(); } //return; // Called each logic update. switch (_state) { case SadGuiState.Start: _state = LoadBlocksAsync(); return; case SadGuiState.Action: return; case SadGuiState.Login: _state = !_controller.IsWalletCreated ? CreateWallet() : Unlock(); return; case SadGuiState.Mnemoic: _state = ShowMnemonic(); break; case SadGuiState.Selection: if (_selectionScreen == null) { if (_playScreen != null) { _playScreen.IsVisible = false; } _playScreen = null; SelectionScreen(); break; } _selectionScreen.ProcessKeyboard(Global.KeyboardState); _state = _selectionScreen.GetState(); break; case SadGuiState.Play: if (_playScreen == null) { if (_selectionScreen != null) { _selectionScreen.IsVisible = false; } _selectionScreen = null; PlayScreen(); break; } _playScreen.ProcessKeyboard(Global.KeyboardState); _state = _playScreen.GetState(); break; case SadGuiState.Fatalerror: _state = Warning("A fatal error happend!", true); break; case SadGuiState.Quit: Game.Instance.Exit(); break; } }
public PlayScreen(MogwaiController mogwaiController, int width, int height) : base(width, height) { _controller = mogwaiController; var mogwaiKeys = _controller.CurrentMogwaiKeys ?? _controller.TestMogwaiKeys(); _mogwai = mogwaiKeys.Mogwai; _playScreenButtons = new Dictionary <string, MogwaiButton>(); var playStatsConsole = new PlayStatsConsole(_mogwai, 44, 22) { Position = new Point(0, 0) }; Children.Add(playStatsConsole); _welcome = new CustomWelcome(91, 22) { Position = new Point(46, 0) }; _adventureChoose = new CustomAdventureChoose(mogwaiController, 91, 22) { Position = new Point(46, 0) }; _shop = new CustomShop(_mogwai, 91, 22) { Position = new Point(46, 0) }; _adventure = new CustomAdventure(mogwaiController, mogwaiKeys, 91, 22) { Position = new Point(46, 0) }; _adventureStats = new CustomAdventureStats(_mogwai, 91, 22) { Position = new Point(46, 0) }; //var logFont = Global.LoadFont("Bakus8.font").GetFont(Font.FontSizes.One); _log = new ScrollingConsole(85, 13, 100, null) { Position = new Point(0, 25) }; Children.Add(_log); var playInfoConsole = new PlayInfoConsole(mogwaiController, mogwaiKeys, 49, 14) { Position = new Point(88, 24) }; Children.Add(playInfoConsole); _command1 = new TestControls(86, 1) { Position = new Point(0, 23) }; _command1.Fill(Color.Transparent, Color.Black, null); Children.Add(_command1); _command2 = new ControlsConsole(8, 2) { Position = new Point(40, 2) }; _command2.Fill(Color.Transparent, Color.DarkGray, null); playInfoConsole.Children.Add(_command2); State = SadGuiState.Play; SetCustomWindowState(PlayScreenState.Welcome); Init(); }