第十阶段 stage 2(四):浏览器页(全局账本)、Web3 页签折行
This commit is contained in:
1 parent
e3e5ec2d6e
commit
a3e955ca59
17 files changed
+199
-6
No files matched your search
@@ -0,0 +1,37 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace Decentralized.Domain
|
||||
{
|
||||
/// <summary>浏览器里的一条链上转账:区块、天、转出方、转入方、币种、数额、手续费。</summary>
|
||||
public sealed class LedgerEntry
|
||||
{
|
||||
public long Block;
|
||||
public int Day;
|
||||
public string From, To, Asset;
|
||||
public double Amount, Fee;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 全局账本:只记真实发生的转账(玩家的转出和转入、矿机收益、出金),不生成 NPC 流水;最新的在前,超过 <see cref="Tuning.LedgerMax"/> 条丢最旧的。
|
||||
/// </summary>
|
||||
public sealed class Ledger
|
||||
{
|
||||
public List<LedgerEntry> Entries = new List<LedgerEntry>();
|
||||
|
||||
public void Add(LedgerEntry e)
|
||||
{
|
||||
if (e == null || e.Amount <= 0) return;
|
||||
Entries.Insert(0, e);
|
||||
if (Entries.Count > Tuning.LedgerMax) Entries.RemoveRange(Tuning.LedgerMax, Entries.Count - Tuning.LedgerMax);
|
||||
}
|
||||
|
||||
/// <summary>某个地址相关(转出或转入)的记录,最新的在前,最多 limit 条。address 为空时返回全部最近的。</summary>
|
||||
public List<LedgerEntry> Of(string address, int limit)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(address)) return Entries.Take(limit).ToList();
|
||||
return Entries.Where(e => ChainAddress.Same(e.From, address) || ChainAddress.Same(e.To, address)).Take(limit).ToList();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -61,6 +61,8 @@ namespace Decentralized.Domain
|
||||
public const double CraRugPerDepeg = 1;
|
||||
/// <summary>Poinbase 出金到钱包的确认动画:基础秒数,加每个确认的秒数(确认数同 PLEDGER 的 TxConfirm*)。</summary>
|
||||
public const double FundsBaseSecs = 1.2, FundsConfSecs = 0.6;
|
||||
/// <summary>浏览器账本最多保留的转账条数,一次最多显示的条数。</summary>
|
||||
public const int LedgerMax = 200, LedgerShow = 12;
|
||||
public const double CraSpiralWeekly = 0.03;
|
||||
public const int CraWarnLeadMin = 4, CraWarnLeadMax = 7;
|
||||
public static readonly double[] CraSpiralPath = { 0.85, 0.30, 0.02 };
|
||||
|
||||
@@ -244,6 +244,8 @@ namespace Decentralized.Domain
|
||||
["IntelBriefPrice"] = Tuning.IntelBriefPrice,
|
||||
["IntelFake"] = Tuning.IntelFake,
|
||||
["IntelRep"] = Tuning.IntelRep,
|
||||
["LedgerMax"] = Tuning.LedgerMax,
|
||||
["LedgerShow"] = Tuning.LedgerShow,
|
||||
["ManipBase"] = Tuning.ManipBase,
|
||||
["ManipFree"] = Tuning.ManipFree,
|
||||
["ManipFreezeDays"] = Tuning.ManipFreezeDays,
|
||||
|
||||
Reference in new issue
Block a user