コード例 #1
0
        public CustomAdventure(MogwaiController mogwaiController, MogwaiKeys mogwaiKeys, int width, int height) : base("Adventure", "", width, height)
        {
            _controller = mogwaiController;
            _mogwaiKeys = mogwaiKeys;
            _mogwai     = _mogwaiKeys.Mogwai;

            _adventureFont = Global.LoadFont("Phoebus16.font").GetFont(Font.FontSizes.One);

            //_mapConsole = new Console(75, 75) { Position = new Point(17, 2) };
            _mapConsole = new Console(100, 100)
            {
                Position  = new Point(-24, 0),
                Font      = _adventureFont,
                IsVisible = false
            };
            Children.Add(_mapConsole);

            _entityManager = new SadConsole.Entities.EntityManager {
                Parent = _mapConsole
            };

            _statsConsole = new MogwaiConsole("stats", "", 21, 6)
            {
                Position = new Point(70, 16)
            };
            _statsConsole.Fill(DefaultForeground, new Color(10, 10, 10, 230), null);
            Children.Add(_statsConsole);
        }
コード例 #2
0
        private Color GetColorStandard(MogwaiKeys mogwaiKeys, bool selected)
        {
            if (mogwaiKeys.IsUnwatched)
            {
                return(selected ? Color.WhiteSmoke : Color.DarkGray);
            }
            switch (mogwaiKeys.MogwaiKeysState)
            {
            case MogwaiKeysState.None:
                return(selected ? Color.WhiteSmoke : Color.DarkGray);

            case MogwaiKeysState.Wait:
                return(selected ? Color.WhiteSmoke : Color.DarkGray);

            case MogwaiKeysState.Ready:
                return(selected ? Color.Sienna : Color.SaddleBrown);

            case MogwaiKeysState.Create:
                return(selected ? Color.Gold : Color.DarkGoldenrod);

            case MogwaiKeysState.Bound:
                return(selected ? Color.Gold : Color.DarkGoldenrod);

            default:
                return(Color.MediumSeaGreen);
            }
        }
コード例 #3
0
        private Color GetMogwaiKeysStateColor(MogwaiKeys mogwaiKeys, bool selected)
        {
            if (mogwaiKeys.IsUnwatched)
            {
                return(selected ? Color.WhiteSmoke : Color.DarkGray);
            }
            switch (mogwaiKeys.MogwaiKeysState)
            {
            case MogwaiKeysState.None:
                return(selected ? Color.Red : Color.DarkRed);

            case MogwaiKeysState.Wait:
                return(selected ? Color.RoyalBlue : Color.SteelBlue);

            case MogwaiKeysState.Ready:
                return(selected ? Color.LimeGreen : Color.DarkGreen);

            case MogwaiKeysState.Create:
                return(selected ? Color.RoyalBlue : Color.SteelBlue);

            case MogwaiKeysState.Bound:
                return(selected ? Color.Gold : Color.DarkGoldenrod);

            default:
                return(Color.RoyalBlue);
            }
        }
コード例 #4
0
ファイル: SelectionConsole.cs プロジェクト: darkfriend77/wom
        private void PrintRow(int index, MogwaiKeys mogwaiKeys, bool selected = false, bool tagged = false)
        {
            int aPos       = 4;
            int sPos       = 41;
            int fPos       = 50;
            int nPos       = 62;
            int rPos       = 76;
            int lPos       = 86;
            int gPos       = 95;
            var balance    = mogwaiKeys.Balance;
            var balanceStr = balance < 1000 ? balance.ToString("##0.0000").PadLeft(8) : "RICH".PadRight(8);
            var mogwai     = mogwaiKeys.Mogwai;
            var nameStr    = mogwai != null?mogwai.Name.PadRight(11) : "".PadRight(11, '.');

            var rateStr = mogwai != null?mogwai.Rating.ToString("#0.00").PadRight(7) : "".PadRight(7, '.');

            var levlStr = mogwai != null?mogwai.CurrentLevel.ToString("##0").PadRight(5) : "".PadRight(5, '.');

            var goldStr = mogwai != null?mogwai.Wealth.Gold.ToString("#####0.00").PadRight(10) : "".PadRight(10, '.');

            Print(3, index, !tagged ? " " : ">", !tagged ? Color.Black : Color.DeepSkyBlue);
            Print(1, index, !selected ? "  " : "=>", !selected ? Color.Black : Color.SpringGreen);

            Color standard = GetColorStandard(mogwaiKeys.MogwaiKeysState, selected);
            Color extState = GetMogwaiKeysStateColor(mogwaiKeys.MogwaiKeysState, selected);

            Print(aPos, index, mogwaiKeys.Address.PadRight(36), standard);
            Print(sPos, index, mogwaiKeys.MogwaiKeysState.ToString().PadRight(6), extState);
            Print(fPos, index, balanceStr, extState);
            Print(nPos, index, nameStr, standard);
            Print(rPos, index, rateStr, standard);
            Print(lPos, index, levlStr, standard);
            Print(gPos, index, goldStr, standard);
        }
コード例 #5
0
        public void BurnMogs()
        {
            var wallet = new MogwaiWallet("1234", "test.dat");

            MogwaiKeys mogwaiKeys0 = wallet.MogwaiKeyDict["MWG1HtzRAjZMxQDzeoFoHQbzDygGR13aWG"];

            Assert.Equal("MWG1HtzRAjZMxQDzeoFoHQbzDygGR13aWG", mogwaiKeys0.Address);

            MogwaiKeys mogwaiKeys1 = wallet.MogwaiKeyDict["MNtnWbBjUhRvNnd9YxM2mnxeLPNkxb4Fio"];

            Assert.Equal("MNtnWbBjUhRvNnd9YxM2mnxeLPNkxb4Fio", mogwaiKeys1.Address);

            var blockResponse0 = Blockchain.Instance.GetBalance("MWG1HtzRAjZMxQDzeoFoHQbzDygGR13aWG");

            Assert.Equal(8.99999m, blockResponse0);

            var blockResponse1 = Blockchain.Instance.GetBalance("MNtnWbBjUhRvNnd9YxM2mnxeLPNkxb4Fio");

            Assert.Equal(12.12344678m, blockResponse1);

            System.Collections.Generic.List <WoMWallet.Block.UnspentTx> unspentTxList = Blockchain.Instance.GetUnspent(6, 9999999, mogwaiKeys0.Address);
            var unspentAmount = unspentTxList.Sum(p => p.Amount);

            // create transaction
            NBitcoin.Transaction tx = mogwaiKeys0.CreateTransaction(unspentTxList, unspentAmount, new[] { mogwaiKeys1.Address }, 1.0m, 0.00001m);
            Assert.Equal("01000000019d0262999e5eacc32c2c6921e730d57a7e51938c2d3e22158979c72a7be318e3010000006a4730440220263c7d3955de95901f70fd66210a7ba095581e6261b3f71c1165d80583fe768b022062cd638398ba735d55dcaa17de225143997307c24e84b1a2be29bc4b7a73c61f012103007f99a5c4754d67c9fed1852ed451bec7371c1b0907b8488ee5aa6593b865c4ffffffff0200e1f505000000001976a914a477c1319360114de9f3ed88381cc4dfa9147f3288ac3000af2f000000001976a914f5440a1dd1ada4c5b4160b8c754f9148eb4a505388ac00000000", tx.ToHex());

            //var blockResponse = Blockchain.Instance.SendRawTransaction(tx.ToHex());
            //Assert.Equal("", blockResponse);
        }
コード例 #6
0
        public void WalletTestPersist()
        {
            var        wallet     = new MogwaiWallet("1234", "test.dat");
            MogwaiKeys mogwaiKeys = wallet.MogwaiKeyDict["MWG1HtzRAjZMxQDzeoFoHQbzDygGR13aWG"];

            Assert.Equal("MWG1HtzRAjZMxQDzeoFoHQbzDygGR13aWG", mogwaiKeys.Address);
            Assert.True(mogwaiKeys.HasMirrorAddress);
            Assert.Equal("MLTNLAojhmBHF3BMzG3RmzoQ1bnbnxxdeD", mogwaiKeys.MirrorAddress);
        }
コード例 #7
0
        public PlayInfoConsole(MogwaiController mogwaiController, MogwaiKeys mogwaiKeys, int width, int height) : base(width, height)
        {
            _controller = mogwaiController;
            _mogwaiKeys = mogwaiKeys;
            _mogwai     = mogwaiKeys.Mogwai;

            _borderSurface = new Basic(width + 2, height + 2, Font);
            _borderSurface.DrawBox(new Rectangle(0, 0, _borderSurface.Width, _borderSurface.Height),
                                   new Cell(Color.DarkCyan, Color.Black), null, ConnectedLineThick);
            _borderSurface.Position = new Point(-1, -1);
            Children.Add(_borderSurface);

            Init();
        }
コード例 #8
0
        public CustomAdventureChoose(MogwaiController mogwaiController, int width, int height) : base("Adventure", "select your adventure", width, height)
        {
            _controller = mogwaiController;
            MogwaiKeys mogwaiKeys = _controller.CurrentMogwaiKeys ?? _controller.TestMogwaiKeys();

            _mogwai = mogwaiKeys.Mogwai;

            _consoleList = new List <MogwaiChooseButton>();

            _currentAdventureType  = AdventureType.Dungeon;
            _currentDifficultyType = DifficultyType.Easy;
            _currentCost           = 0;

            Init();
        }
コード例 #9
0
        private void PrintRow(int index, MogwaiKeys mogwaiKeys, bool selected = false, bool tagged = false)
        {
            var aPos       = 4;
            var sPos       = 41;
            var fPos       = 50;
            var nPos       = 62;
            var rPos       = 76;
            var lPos       = 86;
            var gPos       = 94;
            var pPos       = 106;
            var balance    = mogwaiKeys.Balance;
            var balanceStr = balance < 1000 ? balance.ToString("##0.0000").PadLeft(8) : "RICH".PadRight(8);
            var mogwai     = mogwaiKeys.Mogwai;
            var nameStr    = mogwai != null?mogwai.Name.PadRight(11) : "".PadRight(11, '.');

            var rateStr = mogwai != null?mogwai.Rating.ToString("#0.00").PadRight(7) : "".PadRight(7, '.');

            var levlStr = mogwai != null?mogwai.CurrentLevel.ToString("##0").PadRight(4) : "".PadRight(4, '.');

            var goldStr = mogwai != null?mogwai.Wealth.Gold.ToString("#####0.00").PadRight(9) : "".PadRight(9, '.');

            var progStr = mogwai != null ? ((double)mogwai.CurrentShift.Index / mogwai.Shifts.Count).ToString("##0%").PadRight(4) : "".PadRight(4, '.');

            Print(3, index, !tagged ? " " : ">", !tagged ? Color.Black : Color.DeepSkyBlue);
            Print(1, index, !selected ? "  " : "=>", !selected ? Color.Black : Color.SpringGreen);

            var standard = GetColorStandard(mogwaiKeys, selected);
            var extState = GetMogwaiKeysStateColor(mogwaiKeys, selected);

            Print(aPos, index, mogwaiKeys.Address.PadRight(36), standard);
            Print(sPos, index, mogwaiKeys.MogwaiKeysState.ToString().PadRight(6), extState);
            Print(fPos, index, balanceStr, extState);
            Print(nPos, index, nameStr, standard);
            Print(rPos, index, rateStr, standard);
            Print(lPos, index, levlStr, standard);
            Print(gPos, index, goldStr, standard);
            Print(pPos, index, progStr, standard);
        }
コード例 #10
0
        public PlayScreen(MogwaiController mogwaiController, int width, int height) : base(width, height)
        {
            _controller = mogwaiController;
            MogwaiKeys 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();
        }