Example #1
0
        private void RefreshDisplayData()
        {
            if (refeshOnce || (BuildingData.lastBuildingID != WorldInfoPanel.GetCurrentInstanceID().Building))
            {
                if (isVisible)
                {
                    BuildingData.lastBuildingID = WorldInfoPanel.GetCurrentInstanceID().Building;
                    Building buildingData           = Singleton <BuildingManager> .instance.m_buildings.m_buffer[BuildingData.lastBuildingID];
                    int      aliveWorkCount         = 0;
                    int      totalWorkCount         = 0;
                    Citizen.BehaviourData behaviour = default;
                    RealCityCommonBuildingAI.InitDelegate();
                    RealCityCommonBuildingAI.GetWorkBehaviour((PlayerBuildingAI)buildingData.Info.m_buildingAI, BuildingData.lastBuildingID, ref buildingData, ref behaviour, ref aliveWorkCount, ref totalWorkCount);
                    int allWorkCount = RealCityResidentAI.TotalWorkCount(BuildingData.lastBuildingID, buildingData, true, false);
                    maintainFeeTips.text = Localization.Get("MAINTAIN_FEE_TIPS");
                    workerStatus.text    = Localization.Get("LOCAL_WORKERS_DIV_TOTAL_WORKERS") + totalWorkCount.ToString() + "/" + allWorkCount.ToString();

                    if (buildingData.Info.m_buildingAI is MarketAI)
                    {
                        fishAmount.text = Localization.Get("MATERIAL_BUFFER") + "/" + Localization.Get("PRODUCTION_BUFFER") + ":" + buildingData.m_customBuffer1.ToString() + "/" + buildingData.m_customBuffer2.ToString();
                        int aliveVisitCount = 0;
                        int totalVisitCount = 0;
                        RealCityMarketAI.InitDelegate();
                        RealCityMarketAI.GetVisitBehaviour((MarketAI)(buildingData.Info.m_buildingAI), BuildingData.lastBuildingID, ref buildingData, ref behaviour, ref aliveVisitCount, ref totalVisitCount);
                        var amount = buildingData.m_customBuffer2 / MainDataStore.maxGoodPurchase - totalVisitCount + aliveVisitCount;
                        fishVisitor.text = string.Format("FORDEBUG" + " [{0}/{1}/{2}]", aliveVisitCount, totalVisitCount, amount);
                    }
                    refeshOnce = false;
                }
                else
                {
                    Hide();
                }
            }
        }
Example #2
0
        public static void ProcessZeroWorker(ushort buildingID, ref Building data)
        {
            if (data.m_flags.IsFlagSet(Building.Flags.Completed))
            {
                int aliveWorkCount = 0;
                int totalWorkCount = 0;
                Citizen.BehaviourData behaviour = default;
                RealCityCommonBuildingAI.InitDelegate();
                RealCityCommonBuildingAI.GetWorkBehaviour((PlayerBuildingAI)data.Info.m_buildingAI, buildingID, ref data, ref behaviour, ref aliveWorkCount, ref totalWorkCount);
                int allWorkCount;
                if (RealCityEconomyExtension.Can16timesUpdate(buildingID))
                {
                    allWorkCount = RealCityResidentAI.TotalWorkCount(buildingID, data, true, true);
                }
                else
                {
                    allWorkCount = RealCityResidentAI.TotalWorkCount(buildingID, data, true, false);
                }

                if (RealCityEconomyExtension.Can16timesUpdate(buildingID))
                {
                    if (totalWorkCount == 0 && allWorkCount != 0)
                    {
                        int budget = Singleton <EconomyManager> .instance.GetBudget(data.Info.m_class);

                        int   education3Salary = Math.Max((int)((budget * MainDataStore.govermentEducation3SalaryFixed) / 100), (int)(MainDataStore.govermentSalary * 0.8f));
                        float num1             = education3Salary * allWorkCount;
                        Singleton <EconomyManager> .instance.FetchResource((EconomyManager.Resource) 16, (int)num1, data.Info.m_class);

                        MainDataStore.outsideTouristMoney += (num1 * MainDataStore.outsideTouristSalaryProfitRatio);
                    }
                }
            }
        }