示例#1
0
        private void RemoveOldAndImpossibleBusinesses()
        {
            // Получаем все доступные занятия без проверки дат.
            var objects           = Core.CoreController.BusinessManager.GetBusinesses(availableBusiness, true);
            var currentDate       = ConnectingAppManager.Date;
            var j                 = 0;
            var changedBusinesses = new List <string>();

            // Если все даты возможного проведения занятия < текущей, значит оно больше никогда не будет доступно.
            foreach (var i in objects)
            {
                var dates     = CalendarMenu.ParseDates(i.Condition);
                var canHappen = false;
                j = 0;

                while (!canHappen && j < dates.Count)
                {
                    canHappen = currentDate <= dates[j].Day * 10 + dates[j].Slot;
                    ++j;
                }

                if (!canHappen)
                {
                    availableBusiness.Remove(i.BusinessId);
                    impossibleBusinesses.Add(i.BusinessId);
                    changedBusinesses.Add(i.BusinessId);
                }
            }
            ChangedBusinesses?.Invoke(changedBusinesses);
        }
 public void PrepForScrubbing()
 {
     cM = scrubbingMenuGo.GetComponent <CalendarMenu>();
     // TODO: I think that the following line will add the same listener
     // to the callback every time we change to scrubbing. We should
     // fix this at some point.
     cM.DateUpdated.AddListener(HandleScrubbing);
     parent = new GameObject {
         name = "DataPoints"
     };
     parent.transform.position = Vector3.zero;
     parent.AddComponent <PointPositionHandlerDelete>();
 }