Ejemplo n.º 1
0
 public Record()
 {
     this.messages     = new List <Message>();
     this.workerStats  = new WorkerStats();
     this.workingStats = new WorkingStats();
     this.earningStats = new EarningStats();
 }
Ejemplo n.º 2
0
        public void SetWorkingStats(TaiwuDate date, WorkingStats workingStats)
        {
            if (!this.history.ContainsKey(date))
            {
                this.history[date] = new Record(date);
            }

            this.history[date].workingStats = workingStats;
        }
Ejemplo n.º 3
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();
 }
Ejemplo n.º 4
0
        /// <summary>
        /// 计算指定地区的工作统计信息
        ///
        /// 综合工作指数 = SUM(缩放平移过的建筑工作效率 * 建筑优先级)
        /// 厢房效率不计入统计
        ///
        /// 由于必须在最开始执行,所以无法使用 prepared data
        /// </summary>
        /// <param name="partId"></param>
        /// <param name="placeId"></param>
        /// <returns></returns>
        private static WorkingStats GetWorkingStats(int partId, int placeId)
        {
            var stats = new WorkingStats();

            // 统计所有建筑的工作效率(厢房效率不计入统计)
            var buildings = DateFile.instance.homeBuildingsDate[partId][placeId];

            foreach (int buildingIndex in buildings.Keys)
            {
                if (!Original.BuildingNeedsWorker(partId, placeId, buildingIndex))
                {
                    continue;
                }

                if (Bedroom.IsBedroom(partId, placeId, buildingIndex))
                {
                    continue;
                }

                if (DateFile.instance.actorsWorkingDate.ContainsKey(partId) &&
                    DateFile.instance.actorsWorkingDate[partId].ContainsKey(placeId) &&
                    DateFile.instance.actorsWorkingDate[partId][placeId].ContainsKey(buildingIndex))
                {
                    int   workerId                = DateFile.instance.actorsWorkingDate[partId][placeId][buildingIndex];
                    int   workEffectiveness       = Original.GetWorkEffectiveness(partId, placeId, buildingIndex, workerId);
                    float scaledWorkEffectiveness = (workEffectiveness - 100f) / 100f;
                    float priority                = HumanResource.GetBuildingWorkingPriority(partId, placeId, buildingIndex, withAdjacentBedrooms: false);

                    ++stats.nProductiveBuildings;
                    stats.avgWorkEffectiveness += workEffectiveness / 200f;
                    stats.compositeWorkIndex   += scaledWorkEffectiveness * priority;
                }
            }

            if (stats.nProductiveBuildings > 0)
            {
                stats.avgWorkEffectiveness /= stats.nProductiveBuildings;
            }
            return(stats);
        }