Beispiel #1
0
        // public void AddChangeListener(Action<int> action)
        // {
        //     _onChange += action;
        // }

        // public void RemoveChangeListener(Action<int> action)
        // {
        //     _onChange -= action;
        // }

        public void AnalyzeTaskProcessingData(TaskProcessData data)
        {
            List <float> ratios = new List <float>();

            foreach (var item in data.resources.MainCards)
            {
                int   sum   = CardsUtils.GetCardsSumByParam(item.Value, data.department.Designation.value);
                int   need  = data.task.Task.GetNeed(item.Key);
                float ratio = (float)sum / need;
                ratios.Add(Mathf.Abs(ratio - 1));
            }
            float diff = (ratios.Sum() - ratios.Count * _signChangingDiff) * -_changingRate;
            // int staffSum = CardsSystem.GetCardsValuesByParam(data.staff, data.department.Designation.value).Sum();
            // int eqSum = CardsSystem.GetCardsValuesByParam(data.equipment, data.department.Designation.value).Sum();
            // int staffNeed = data.task.TaskController.GetStaffNeed();
            // int eqNeed = data.task.TaskController.GetEquipmentNeed();

            // float staffRatio = (float)staffSum/staffNeed;
            // float eqRatio = (float)eqSum/eqNeed;
            // float diff = (Mathf.Abs(staffRatio - 1) + Mathf.Abs(eqRatio - 1) - 2 * _signChangingDiff) * -_changingRate;
            float tempValue = currentValue + diff;

            currentValue = Mathf.Clamp((int)Mathf.Round(tempValue), _minValue, maxValue);
            RaiseChangeEvent(currentValue);
        }
Beispiel #2
0
    private void UpdateSelectedSum(CardType type)
    {
        var cards = window.GetSelectedResources(type);
        int count = CardsUtils.GetCardsSumByParam(cards, _departmentParameter.value);

        window.SetSelectedCount(type, count);
    }
 public void ProcessTaskRecord(TaskProcessData pd)
 {
     _processTasksRecords.Add(pd);
     currentPeriodData.UpdateTasksTime(pd.resultingTime, pd.baseTime);
     foreach (var item in pd.resources.MainCards)
     {
         int sum = CardsUtils.GetCardsSumByParam(item.Value, DepartmentParameter) * pd.resultingTime;
         if (item.Value.Count > 0)
         {
             currentPeriodData.UpdateResourcesWorkingSum(item.Key, sum,
                                                         pd.task.Task.GetNeed(item.Key) * pd.resultingTime);
         }
     }
 }
Beispiel #4
0
    public void ProcessTaskExecutingData(TaskProcessData pd)
    {
        Init();
        controller.ProcessTaskRecord(pd);
        _indicators.ProcessData(pd);

        var resources = new Dictionary <CardType, int>();

        foreach (var item in pd.resources.MainCards)
        {
            resources[item.Key] = CardsUtils.GetCardsSumByParam(item.Value, designation.value);
        }
        _display.RecordTaskProcessData(pd, resources);
    }
Beispiel #5
0
 public void AddTaskProcessData(TaskProcessData pd) ///
 {
     _tasksData.Add(pd);
     _periodInfo.UpdateTasksTime(pd.resultingTime, pd.task.Task.Data.BaseTime);
     foreach (var item in pd.resources.MainCards)
     {
         int sum = CardsUtils.GetCardsSumByParam(item.Value, Designation.value) * pd.resultingTime;
         if (item.Value.Count > 0)
         {
             _periodInfo.UpdateResourcesWorkingSum(item.Key, sum,
                                                   pd.task.Task.GetNeed(item.Key) * pd.resultingTime);
         }
     }
     CalculateIndicators(pd);
 }