Пример #1
0
 public Record()
 {
     this.messages     = new List <Message>();
     this.workerStats  = new WorkerStats();
     this.workingStats = new WorkingStats();
     this.earningStats = new EarningStats();
 }
Пример #2
0
        /// <summary>
        /// 记录收获详情文本(以及当月收获银钱)
        /// </summary>
        private static void RecordHarvestDetails()
        {
            var currDate = new TaiwuDate();
            var stats    = new EarningStats();

            string details = GetHarvestedResourcesDetails(ref stats);

            if (!string.IsNullOrEmpty(details))
            {
                MajordomoWindow.instance.AppendMessage(currDate, Message.IMPORTANCE_HIGH,
                                                       TaiwuCommon.SetColor(TaiwuCommon.COLOR_LIGHT_GRAY, "本月收获资源") + ":" + details);
            }

            details = GetHarvestedItemsDetails(ref stats);
            if (!string.IsNullOrEmpty(details))
            {
                MajordomoWindow.instance.AppendMessage(currDate, Message.IMPORTANCE_HIGH,
                                                       TaiwuCommon.SetColor(TaiwuCommon.COLOR_LIGHT_GRAY, "本月收获物品") + ":" + details);
            }

            details = GetHarvestedActorsDetails(ref stats);
            if (!string.IsNullOrEmpty(details))
            {
                MajordomoWindow.instance.AppendMessage(currDate, Message.IMPORTANCE_HIGH,
                                                       TaiwuCommon.SetColor(TaiwuCommon.COLOR_LIGHT_GRAY, "本月接纳新村民") + ":" + details);
            }

            MajordomoWindow.instance.SetEarningStats(currDate, stats);
        }
Пример #3
0
        private static string GetHarvestedItemsDetails(ref EarningStats stats)
        {
            string details = "";

            if (AutoHarvest.harvestedItems.Count == 0)
            {
                return(details);
            }

            foreach (var items in AutoHarvest.harvestedItems.Reverse())
            {
                int quality = items.Key;

                foreach (var item in items.Value)
                {
                    int    itemId         = item.Key;
                    int    quantity       = item.Value;
                    string name           = DateFile.instance.GetItemDate(itemId, 0, otherMassage: false);
                    string coloredName    = TaiwuCommon.SetColor(TaiwuCommon.COLOR_LOWEST_LEVEL + quality - 1, name);
                    string coloredQuntity = TaiwuCommon.SetColor(TaiwuCommon.COLOR_WHITE, quantity.ToString());
                    details += $"{coloredName} × {coloredQuntity}、";

                    int itemValue = int.Parse(DateFile.instance.GetItemDate(itemId, 904));
                    stats.gdp += itemValue * quantity;
                }
            }
            details = details.Substring(0, details.Length - 1) + "。";

            return(details);
        }
Пример #4
0
        public void SetEarningStats(TaiwuDate date, EarningStats earningStats)
        {
            if (!this.history.ContainsKey(date))
            {
                this.history[date] = new Record(date);
            }

            this.history[date].earningStats = earningStats;
        }
Пример #5
0
 public Record(TaiwuDate date)
 {
     this.messages = new List <Message>
     {
         new Message(Message.IMPORTANCE_HIGHEST, $"进入{date.ToString(richText: true)}。"),
     };
     this.workerStats  = new WorkerStats();
     this.workingStats = new WorkingStats();
     this.earningStats = new EarningStats();
 }
Пример #6
0
        private static string GetHarvestedActorsDetails(ref EarningStats stats)
        {
            string details = "";

            if (AutoHarvest.harvestedActors.Count == 0)
            {
                return(details);
            }

            foreach (var actorId in AutoHarvest.harvestedActors)
            {
                string name        = DateFile.instance.GetActorName(actorId);
                string coloredName = TaiwuCommon.SetColor(TaiwuCommon.COLOR_DARK_BROWN, name);
                details += coloredName + "、";
            }
            details = details.Substring(0, details.Length - 1) + "。";

            return(details);
        }
Пример #7
0
        private static string GetHarvestedResourcesDetails(ref EarningStats stats)
        {
            string details = "";

            if (AutoHarvest.harvestedResources.Count == 0)
            {
                return(details);
            }

            foreach (var entry in AutoHarvest.harvestedResources)
            {
                int    resourceIndex = entry.Key;
                int    quantity      = entry.Value;
                string name          = DateFile.instance.resourceDate[resourceIndex][1];
                details += TaiwuCommon.SetColor(TaiwuCommon.COLOR_YELLOW, name) + "\u00A0" +
                           TaiwuCommon.SetColor(TaiwuCommon.COLOR_WHITE, quantity.ToString()) + "、";

                switch (resourceIndex)
                {
                case ResourceMaintainer.RES_ID_MONEY:
                    stats.earnedMoney += quantity;
                    stats.gdp         += quantity;
                    break;

                case ResourceMaintainer.RES_ID_FAME:
                    stats.earnedFame += quantity;
                    stats.gdp        += Mathf.RoundToInt(quantity * ResourceMaintainer.EXCHANGE_RATE_FAME);
                    break;

                default:
                    stats.gdp += Mathf.RoundToInt(quantity * ResourceMaintainer.EXCHANGE_RATE_DEFAULT);
                    break;
                }
            }
            details = details.Substring(0, details.Length - 1) + "。";

            return(details);
        }