Esempio n. 1
0
        protected override void CompileNodes(Dictionary <TreeGumpNode, Action <Rectangle, int, TreeGumpNode> > list)
        {
            list.Clear();

            list["Transactions"]         = CompileTransactions;
            list["Transactions|Pending"] = CompileTransactions;
            list["Transactions|Claim"]   = CompileTransactions;

            var trans = _Admin ? Profile.Transactions.Values : Profile.Visible;

            foreach (var t in trans)
            {
                if (t.IsPending)
                {
                    list["Transactions|Pending|" + t.ID] = CompileTransaction;
                }
                else if (t.IsProcessed)
                {
                    list["Transactions|Claim|" + t.ID] = CompileTransaction;
                }

                TreeGumpNode n = t.FullPath;

                list["History|" + n.FullName] = CompileTransaction;

                foreach (var p in n.GetParents())
                {
                    list["History|" + p] = CompileTransactions;
                }
            }

            base.CompileNodes(list);
        }
Esempio n. 2
0
        private void CompilePlugin(Rectangle b, int i, TreeGumpNode n)
        {
            var cp = VitaNexCore.Plugins.FirstOrDefault(o => Insensitive.Equals(n.Name, o.Name));

            if (cp != null)
            {
                CompilePlugin(b.X, b.Y, b.Width, b.Height, cp);
            }
        }
Esempio n. 3
0
        private void CompileModule(Rectangle b, int i, TreeGumpNode n)
        {
            var cm = VitaNexCore.Modules.FirstOrDefault(o => Insensitive.Equals(n.Name, o.Name));

            if (cm != null)
            {
                CompileModule(b.X, b.Y, b.Width, b.Height, cm);
            }
        }
Esempio n. 4
0
        private void CompileService(Rectangle b, int i, TreeGumpNode n)
        {
            var cs = VitaNexCore.Services.FirstOrDefault(o => Insensitive.Equals(n.Name, o.Name));

            if (cs != null)
            {
                CompileService(b.X, b.Y, b.Width, b.Height, cs);
            }
        }
Esempio n. 5
0
 private void CompilePlugins(Rectangle b, int i, TreeGumpNode n)
 {
     CompileBuffer(
         2,
         b.X,
         b.Y,
         b.Width,
         b.Height,
         VitaNexCore.Plugins.Not(o => o is CoreServiceInfo || o is CoreModuleInfo));
 }
Esempio n. 6
0
        protected override void CompileEmptyNodeLayout(
            SuperGumpLayout layout,
            int x,
            int y,
            int w,
            int h,
            int index,
            TreeGumpNode node)
        {
            base.CompileEmptyNodeLayout(layout, x, y, w, h, index, node);

            layout.Add("node/page/" + index, () => CompileOverview(new Rectangle2D(x, y, w, h), index, node));
        }
Esempio n. 7
0
        protected override void CompileNodeLayout(
            SuperGumpLayout layout,
            int x,
            int y,
            int w,
            int h,
            int index,
            TreeGumpNode node)
        {
            base.CompileNodeLayout(layout, x, y, w, h, index, node);

            if (Nodes == null || !Nodes.ContainsKey(node))
            {
                CompileEmptyNodeLayout(layout, x, y, w, h, index, node);
            }
        }
Esempio n. 8
0
        protected virtual void AddFilterOptions(Rectangle b, int i, TreeGumpNode n)
        {
            var cols = (int)(b.Width / (b.Width / 3.0));
            var rows = (int)(b.Height / 30.0);

            var cellW = (int)(b.Width / (double)cols);
            var cellH = (int)(b.Height / (double)rows);

            var opts = Filter.Options.Where(o => Insensitive.Equals(o.Category, n.Name)).ToList();

            if (opts.Count == 0)
            {
                return;
            }

            i = -1;

            int c, x, r, y;

            for (r = 0; r < rows && opts.InBounds(i + 1); r++)
            {
                y = b.Y + (r * cellH);

                for (c = 0; c < cols && opts.InBounds(i + 1); c++)
                {
                    x = b.X + (c * cellW);

                    var o = opts[++i];

                    if (o.IsEmpty)
                    {
                        if (c == 0)
                        {
                            --c;
                            continue;
                        }

                        break;
                    }

                    AddOptionCell(x, y, cellW, cellH, o);
                }
            }

            opts.Free(true);
        }
Esempio n. 9
0
        protected virtual void CompileOverview(Rectangle2D bounds, int index, TreeGumpNode node)
        {
            var info = new StringBuilder();

            info.AppendLine(
                "Welcome to the Donation Exchange, {0}!",
                User.RawName.WrapUOHtmlColor(User.GetNotorietyColor(), HtmlColor));
            info.AppendLine();
            info.AppendLine("Select a category on the left to browse your transactions.");
            info.AppendLine();
            info.AppendLine("MY EXCHANGE".WrapUOHtmlBold().WrapUOHtmlColor(Color.Gold, false));
            info.AppendLine();

            GetProfileOverview(info);

            AddHtml(
                bounds.X + 5,
                bounds.Y,
                bounds.Width - 5,
                bounds.Height,
                info.ToString().WrapUOHtmlColor(HtmlColor),
                false,
                true);
        }
Esempio n. 10
0
		protected virtual void CompileTransactions(Rectangle2D b, int index, TreeGumpNode node)
		{
			_Transactions.Clear();

			int i;

			switch (node.Name)
			{
				case "Pending":
				{
					_Transactions.AddRange(_Admin ? Profile.Pending : Profile.Visible.Where(t => t.IsPending));
					i = 2;
				}
					break;
				case "Claim":
				{
					_Transactions.AddRange(_Admin ? Profile.Processed : Profile.Visible.Where(t => t.IsProcessed));
					i = 1;
				}
					break;
				default:
				{
					_Transactions.AddRange(_Admin ? Profile.Transactions.Values : Profile.Visible);
					i = 0;
				}
					break;
			}

			_Transactions.Sort();

			_Indicies[i, 1] = _Transactions.Count;
			_Indicies[i, 0] = Math.Max(0, Math.Min(_Indicies[i, 1] - 1, _Indicies[i, 0]));

			var idx = 0;

			foreach (var t in _Transactions.Skip(_Indicies[i, 0]).Take(7))
			{
				var xx = b.X;
				var yy = b.Y + (idx++ * 50);

				AddRectangle(xx, yy, b.Width - 25, 45, Color.Black, t.IsProcessed ? Color.PaleGoldenrod : Color.Silver, 2);

				xx += 5;
				yy += 5;

				var label =
					String.Format("{0} ({1:#,0} {2})", t.ID, t.CreditTotal, AutoDonate.CMOptions.CurrencyName)
						  .WrapUOHtmlColor(HtmlColor, false);

				AddHtml(xx, yy, b.Width - 105, 40, label, false, false);

				xx = b.X + (b.Width - 85);

				label =
					String.Format("{0}{1:#,0.00} {2}", AutoDonate.CMOptions.MoneySymbol, t.Total, AutoDonate.CMOptions.MoneyAbbr)
						  .WrapUOHtmlColor(HtmlColor, false);

				AddHtml(xx, yy, 65, 40, label, false, false);
			}

			_Transactions.Clear();

			AddBackground(b.X + (b.Width - 25), b.Y, 28, 351, 2620);

			AddScrollbarV(
				b.X + (b.Width - 24),
				b.Y,
				_Indicies[i, 1],
				_Indicies[i, 0],
				p =>
				{
					--_Indicies[i, 0];
					Refresh(true);
				},
				n =>
				{
					++_Indicies[i, 0];
					Refresh(true);
				},
				new Rectangle2D(6, 42, 13, 267),
				new Rectangle2D(6, 10, 13, 28),
				new Rectangle2D(6, 313, 13, 28),
				Tuple.Create(10740, 10742),
				Tuple.Create(10701, 10702, 10700),
				Tuple.Create(10721, 10722, 10720));
		}
Esempio n. 11
0
 private void CompileModules(Rectangle b, int i, TreeGumpNode n)
 {
     CompileBuffer(1, b.X, b.Y, b.Width, b.Height, VitaNexCore.Modules);
 }
Esempio n. 12
0
 private void CompileServices(Rectangle b, int i, TreeGumpNode n)
 {
     CompileBuffer(0, b.X, b.Y, b.Width, b.Height, VitaNexCore.Services);
 }
Esempio n. 13
0
 protected void RenderPanel(Rectangle2D panel, int index, TreeGumpNode node)
 {
     if (SelectedFile != null)
     {
         RenderFilePanel(panel, index, node);
     }
     else
     {
         RenderDirectoryPanel(panel, index, node);
     }
 }
Esempio n. 14
0
        private string GetPath(TreeGumpNode node)
        {
            if (RootDirectory.Parent != null)
            {
                return
                    Path.Combine(RootDirectory.Parent.FullName, node.FullName.Replace(TreeGumpNode.Separator, IOUtility.PathSeparator))
                        .Trim(IOUtility.PathSeparator);
            }

            return
                Path.Combine(RootDirectory.FullName, node.FullName.Replace(TreeGumpNode.Separator, IOUtility.PathSeparator))
                    .Trim(IOUtility.PathSeparator);
        }
Esempio n. 15
0
        // 310 x 350
        protected virtual void RenderDirectoryPanel(Rectangle2D panel, int index, TreeGumpNode node)
        {
            var x = panel.X + 20;
            var y = panel.Y + 20;

            var w = panel.Width - 40;
            var h = panel.Height - 20;

            var xx = x;
            var yy = y;

            var subIndex = 0;

            var xMax = w / 65;
            var yMax = h / 110;

            var max = xMax * yMax;

            var range =
                Enumerable.Empty<FileSystemInfo>()
                          .Union(SelectedDirectory.EnumerateDirectories().OrderByNatural(d => d.Name))
                          .Union(SelectedDirectory.EnumerateFiles().OrderByNatural(f => f.Name));

            foreach (var info in range.Take(max))
            {
                // 65 x 110
                if (info is DirectoryInfo)
                {
                    var dir = (DirectoryInfo)info;

                    // 56 x 80
                    AddButton(xx, yy, 9810, 9810, b => SelectDirectory(dir)); // 56 x 50
                    AddHtml(xx, yy + 50, 56, 40, info.Name.WrapUOHtmlCenter(), true, false); // 56 x 40
                }
                else if (info is FileInfo)
                {
                    var file = (FileInfo)info;

                    // 56 x 80
                    AddButton(xx + 5, yy, 2234, 2234, b => SelectFile(file)); // 46 x 50
                    AddHtml(xx, yy + 50, 56, 40, info.Name.WrapUOHtmlCenter(), true, false); // 56 x 40
                }

                if (++subIndex % xMax == 0)
                {
                    xx = x;
                    yy += 110;
                }
                else
                {
                    xx += 65;
                }
            }
        }
Esempio n. 16
0
 // 310 x 350
 protected virtual void RenderFilePanel(Rectangle2D panel, int index, TreeGumpNode node)
 {
 }
Esempio n. 17
0
        protected virtual void CompileTransactions(Rectangle b, int index, TreeGumpNode node)
        {
            _Transactions.Clear();

            int idx;

            var trans = _Admin ? Profile.Transactions.Values : Profile.Visible;

            switch (node.Name)
            {
            case "Transactions":
                idx = 0;
                break;

            case "Claim":
            {
                trans = trans.Where(t => t.IsProcessed);

                idx = 1;
            }
            break;

            case "Pending":
            {
                trans = trans.Where(t => t.IsPending);

                idx = 2;
            }
            break;

            default:
            {
                switch (node.Depth)
                {
                default:                                 // History
                    idx = 3;
                    break;

                case 1:                                 // Year
                {
                    var y = Utility.ToInt32(node.Name);

                    trans = trans.Where(t => t.Time.Value.Year == y);

                    idx = 4;
                }
                break;

                case 2:                                 // Month
                {
                    var y = Utility.ToInt32(node.Parent.Name);
                    var m = (Months)Enum.Parse(typeof(Months), node.Name);

                    trans = trans.Where(t => t.Time.Value.Year == y);
                    trans = trans.Where(t => t.Time.Value.GetMonth() == m);

                    idx = 5;
                }
                break;
                }
            }
            break;
            }

            _Transactions.AddRange(trans);
            _Transactions.Sort();

            _Indicies[idx, 1] = _Transactions.Count;
            _Indicies[idx, 0] = Math.Max(0, Math.Min(_Indicies[idx, 1] - 1, _Indicies[idx, 0]));

            _Transactions.TrimStart(_Indicies[idx, 0]);
            _Transactions.TrimEndTo((b.Height / 24) - 1);

            // ID | Date | Recipient | Value | Credit | State
            var cols = new[] { -1, -1, -1, 80, 80, 80 };

            AddTable(b.X, b.Y, b.Width - 25, b.Height, true, cols, _Transactions, 24, Color.Empty, 0, RenderTransaction);

            _Transactions.Clear();

            AddBackground(b.X + (b.Width - 25), b.Y, 28, b.Height, SupportsUltimaStore ? 40000 : 9260);

            AddScrollbarV(
                b.X + (b.Width - 24),
                b.Y,
                b.Height,
                _Indicies[idx, 1],
                _Indicies[idx, 0],
                p =>
            {
                --_Indicies[idx, 0];
                Refresh(true);
            },
                n =>
            {
                ++_Indicies[idx, 0];
                Refresh(true);
            });
        }
Esempio n. 18
0
        protected override void OnSelected(int index, TreeGumpNode node)
        {
            var path = GetPath(node);

            if (Directory.Exists(path))
            {
                SelectedDirectory = new DirectoryInfo(path);
            }

            SelectedFile = null;

            base.OnSelected(index, node);
        }
Esempio n. 19
0
		protected override void CompileNodeLayout(
			SuperGumpLayout layout,
			int x,
			int y,
			int w,
			int h,
			int index,
			TreeGumpNode node)
		{
			base.CompileNodeLayout(layout, x, y, w, h, index, node);

			if (Nodes == null || !Nodes.ContainsKey(node))
			{
				CompileEmptyNodeLayout(layout, x, y, w, h, index, node);
			}
		}
Esempio n. 20
0
 private void CompileOverview(Rectangle b, int i, TreeGumpNode n)
 {
     CompileOverview(b.X, b.Y, b.Width, b.Height);
 }
Esempio n. 21
0
        protected virtual void CompileTransactions(Rectangle2D b, int index, TreeGumpNode node)
        {
            _Transactions.Clear();

            int i;

            switch (node.Name)
            {
            case "Pending":
            {
                _Transactions.AddRange(_Admin ? Profile.Pending : Profile.Visible.Where(t => t.IsPending));
                i = 2;
            }
            break;

            case "Claim":
            {
                _Transactions.AddRange(_Admin ? Profile.Processed : Profile.Visible.Where(t => t.IsProcessed));
                i = 1;
            }
            break;

            default:
            {
                _Transactions.AddRange(_Admin ? Profile.Transactions.Values : Profile.Visible);
                i = 0;
            }
            break;
            }

            _Transactions.Sort();

            _Indicies[i, 1] = _Transactions.Count;
            _Indicies[i, 0] = Math.Max(0, Math.Min(_Indicies[i, 1] - 1, _Indicies[i, 0]));

            var idx = 0;

            foreach (var t in _Transactions.Skip(_Indicies[i, 0]).Take(7))
            {
                var xx = b.X;
                var yy = b.Y + (idx++ *50);

                AddRectangle(xx, yy, b.Width - 25, 45, Color.Black, t.IsProcessed ? Color.PaleGoldenrod : Color.Silver, 2);

                xx += 5;
                yy += 5;

                var label =
                    String.Format("{0} ({1:#,0} {2})", t.ID, t.CreditTotal, AutoDonate.CMOptions.CurrencyName)
                    .WrapUOHtmlColor(HtmlColor, false);

                AddHtml(xx, yy, b.Width - 105, 40, label, false, false);

                xx = b.X + (b.Width - 85);

                label =
                    String.Format("{0}{1:#,0.00} {2}", AutoDonate.CMOptions.MoneySymbol, t.Total, AutoDonate.CMOptions.MoneyAbbr)
                    .WrapUOHtmlColor(HtmlColor, false);

                AddHtml(xx, yy, 65, 40, label, false, false);
            }

            _Transactions.Clear();

            AddBackground(b.X + (b.Width - 25), b.Y, 28, 351, 2620);

            AddScrollbarV(
                b.X + (b.Width - 24),
                b.Y,
                _Indicies[i, 1],
                _Indicies[i, 0],
                p =>
            {
                --_Indicies[i, 0];
                Refresh(true);
            },
                n =>
            {
                ++_Indicies[i, 0];
                Refresh(true);
            },
                new Rectangle2D(6, 42, 13, 267),
                new Rectangle2D(6, 10, 13, 28),
                new Rectangle2D(6, 313, 13, 28),
                Tuple.Create(10740, 10742),
                Tuple.Create(10701, 10702, 10700),
                Tuple.Create(10721, 10722, 10720));
        }
Esempio n. 22
0
		protected virtual void CompileOverview(Rectangle2D bounds, int index, TreeGumpNode node)
		{
			var info = new StringBuilder();

			info.AppendLine(
				"Welcome to the Donation Exchange, {0}!",
				User.RawName.WrapUOHtmlColor(User.GetNotorietyColor(), HtmlColor));
			info.AppendLine();
			info.AppendLine("Select a category on the left to browse your transactions.");
			info.AppendLine();
			info.AppendLine("MY EXCHANGE".WrapUOHtmlBold().WrapUOHtmlColor(Color.Gold, false));
			info.AppendLine();

			GetProfileOverview(info);

			AddHtml(
				bounds.X + 5,
				bounds.Y,
				bounds.Width - 5,
				bounds.Height,
				info.ToString().WrapUOHtmlColor(HtmlColor),
				false,
				true);
		}
Esempio n. 23
0
		protected override void CompileEmptyNodeLayout(
			SuperGumpLayout layout,
			int x,
			int y,
			int w,
			int h,
			int index,
			TreeGumpNode node)
		{
			base.CompileEmptyNodeLayout(layout, x, y, w, h, index, node);

			layout.Add("node/page/" + index, () => CompileOverview(new Rectangle2D(x, y, w, h), index, node));
		}
Esempio n. 24
0
        protected virtual void CompileTransaction(Rectangle2D b, int index, TreeGumpNode node)
        {
            var trans = Profile[node.Name];

            if (trans == null)
            {
                CompileOverview(b, index, node);
                return;
            }

            var cpHeight = _Admin ? 60 : 30;

            var html = new StringBuilder();

            GetTransactionOverview(trans, html, true, true, true);

            AddHtml(
                b.X + 5,
                b.Y,
                b.Width - 5,
                b.Height - cpHeight,
                html.ToString().WrapUOHtmlColor(Color.White, false),
                false,
                true);

            var bw = b.Width;
            var bh = cpHeight;

            if (_Admin)
            {
                bh /= 2;
            }

            switch (trans.State)
            {
            case TransactionState.Voided:
            {
                AddHtmlButton(
                    b.X,
                    b.Y + (b.Height - bh),
                    bw,
                    bh,
                    o => OnVoidedTransaction(trans),
                    "[VOIDED]",
                    Color.OrangeRed,
                    Color.Black,
                    Color.OrangeRed,
                    2);
            }
            break;

            case TransactionState.Pending:
            {
                AddHtmlButton(
                    b.X,
                    b.Y + (b.Height - bh),
                    bw,
                    bh,
                    o => OnPendingTransaction(trans),
                    "[PENDING]",
                    Color.Yellow,
                    Color.Black,
                    Color.Yellow,
                    2);
            }
            break;

            case TransactionState.Processed:
            {
                AddHtmlButton(
                    b.X,
                    b.Y + (b.Height - bh),
                    bw,
                    bh,
                    o => OnClaimTransaction(trans),
                    "[CLAIM]",
                    Color.SkyBlue,
                    Color.Black,
                    Color.SkyBlue,
                    2);
            }
            break;

            case TransactionState.Claimed:
            {
                AddHtmlButton(
                    b.X,
                    b.Y + (b.Height - bh),
                    bw,
                    bh,
                    o => OnClaimedTransaction(trans),
                    "[CLAIMED]",
                    Color.LawnGreen,
                    Color.Black,
                    Color.LawnGreen,
                    2);
            }
            break;
            }

            if (_Admin)
            {
                bw /= 2;

                AddHtmlButton(
                    b.X,
                    b.Y + (b.Height - (bh * 2)),
                    bw,
                    bh,
                    o => OnTransactionEdit(trans),
                    "[EDIT]",
                    Color.Gold,
                    Color.Black,
                    Color.Gold,
                    2);

                AddHtmlButton(
                    b.X + bw,
                    b.Y + (b.Height - (bh * 2)),
                    bw,
                    bh,
                    o => OnTransactionTransfer(trans),
                    "[TRANSFER]",
                    Color.Gold,
                    Color.Black,
                    Color.Gold,
                    2);
            }
        }
Esempio n. 25
0
		protected virtual void CompileTransaction(Rectangle2D b, int index, TreeGumpNode node)
		{
			var trans = Profile[node.Name];

			if (trans == null)
			{
				CompileOverview(b, index, node);
				return;
			}

			var cpHeight = _Admin ? 60 : 30;

			var html = new StringBuilder();

			GetTransactionOverview(trans, html, true, true, true);

			AddHtml(
				b.X + 5,
				b.Y,
				b.Width - 5,
				b.Height - cpHeight,
				html.ToString().WrapUOHtmlColor(Color.White, false),
				false,
				true);

			var bw = b.Width;
			var bh = cpHeight;

			if (_Admin)
			{
				bh /= 2;
			}

			switch (trans.State)
			{
				case TransactionState.Voided:
				{
					AddHtmlButton(
						b.X,
						b.Y + (b.Height - bh),
						bw,
						bh,
						o => OnVoidedTransaction(trans),
						"[VOIDED]",
						Color.OrangeRed,
						Color.Black,
						Color.OrangeRed,
						2);
				}
					break;
				case TransactionState.Pending:
				{
					AddHtmlButton(
						b.X,
						b.Y + (b.Height - bh),
						bw,
						bh,
						o => OnPendingTransaction(trans),
						"[PENDING]",
						Color.Yellow,
						Color.Black,
						Color.Yellow,
						2);
				}
					break;
				case TransactionState.Processed:
				{
					AddHtmlButton(
						b.X,
						b.Y + (b.Height - bh),
						bw,
						bh,
						o => OnClaimTransaction(trans),
						"[CLAIM]",
						Color.SkyBlue,
						Color.Black,
						Color.SkyBlue,
						2);
				}
					break;
				case TransactionState.Claimed:
				{
					AddHtmlButton(
						b.X,
						b.Y + (b.Height - bh),
						bw,
						bh,
						o => OnClaimedTransaction(trans),
						"[CLAIMED]",
						Color.LawnGreen,
						Color.Black,
						Color.LawnGreen,
						2);
				}
					break;
			}

			if (_Admin)
			{
				bw /= 2;

				AddHtmlButton(
					b.X,
					b.Y + (b.Height - (bh * 2)),
					bw,
					bh,
					o => OnTransactionEdit(trans),
					"[EDIT]",
					Color.Gold,
					Color.Black,
					Color.Gold,
					2);

				AddHtmlButton(
					b.X + bw,
					b.Y + (b.Height - (bh * 2)),
					bw,
					bh,
					o => OnTransactionTransfer(trans),
					"[TRANSFER]",
					Color.Gold,
					Color.Black,
					Color.Gold,
					2);
			}
		}