예제 #1
0
 public static void SetWorkId(ScheduleMgr.ScheduleTime workTime, int taskId, int slotId)
 {
     if (ScheduleCSVData.AllData.ContainsKey(taskId))
     {
         ScheduleCSVData.ScheduleBase scheduleBase = ScheduleCSVData.AllData[taskId];
         //int slotId = 0;
         //for (int i = 0; i < 40; i++)
         //{
         //    Maid scheduleSlot = GameMain.Instance.CharacterMgr.status.GetScheduleSlot(i);
         //    if (scheduleSlot != null && scheduleSlot == this.m_scheduleCtrl.SelectedMaid)
         //    {
         //        slotId = i;
         //    }
         //}
         ScheduleTaskCtrl.TaskType type = scheduleBase.type;
         if (type != ScheduleTaskCtrl.TaskType.Training && type != ScheduleTaskCtrl.TaskType.Work)
         {
             if (type == ScheduleTaskCtrl.TaskType.Yotogi)
             {
                 ScheduleMgrPatch.m_scheduleApi.SetNightWorkSlot_Safe(workTime, slotId, taskId);
             }
         }
         else
         {
             ScheduleMgrPatch.m_scheduleApi.SetNoonWorkSlot_Safe(workTime, slotId, taskId);
         }
     }
     if (!DailyMgr.IsLegacy)
     {
         GameMain.Instance.FacilityMgr.UpdateFacilityAssignedMaidData();
     }
     ScheduleAPI.MaidWorkIdErrorCheck(true);
 }
예제 #2
0
        /// <summary>
        /// 랜덤으로 커뮤니케이션 설정
        /// </summary>
        public static void SetRandomCommu(bool isDaytime)
        {
            List <Maid> list = ScheduleAPI.CanCommunicationMaids(isDaytime);

            if (list.Count > 0)
            {
                int i = UnityEngine.Random.Range(0, list.Count);
                if (isDaytime)
                {
                    foreach (Maid item in list)
                    {
                        item.status.noonCommu = false;
                    }
                    list[i].status.noonCommu = true;
                }
                else
                {
                    foreach (var item in list)
                    {
                        item.status.nightCommu = false;
                    }
                    list[i].status.nightCommu = true;
                }
                MyLog.LogMessage("ScheduleAPI.SetRandomCommu"
                                 , MyUtill.GetMaidFullName(list[i])
                                 , isDaytime
                                 );
            }
            else
            {
                MyLog.LogMessage("ScheduleAPI.SetRandomCommu count 0"
                                 , isDaytime
                                 );
            }
        }
예제 #3
0
 public static void SetFinal()
 {
     if (!DailyMgr.IsLegacy)
     {
         GameMain.Instance.FacilityMgr.UpdateFacilityAssignedMaidData();
     }
     ScheduleAPI.MaidWorkIdErrorCheck(true);
 }
예제 #4
0
        /// <summary>
        /// 분석용
        /// </summary>
        /// <param name="maid"></param>
        /// <param name="taskId"></param>
        /// <param name="time"></param>
        /// <returns>true 일경우 사용 불가</returns>
        public static bool CheckYotogi(Maid maid, int taskId, ScheduleMgr.ScheduleTime time)
        {
            bool flag = false;

            if (ScheduleCSVData.YotogiData.ContainsKey(taskId))
            {
                ScheduleCSVData.Yotogi yotogi = ScheduleCSVData.YotogiData[taskId];
                if (!flag && (yotogi.yotogiType == ScheduleCSVData.YotogiType.Vip || yotogi.yotogiType == ScheduleCSVData.YotogiType.VipCall))
                {
                    if (maid != null)
                    {
                        if (!ScheduleAPI.VisibleNightWork(taskId, maid, true))
                        {
                            flag = true;
                        }
                    }
                    else if (!ScheduleAPI.VisibleNightWork(taskId, null, true))
                    {
                        flag = true;
                    }
                }
                if (!flag && (yotogi.yotogiType == ScheduleCSVData.YotogiType.Vip || yotogi.yotogiType == ScheduleCSVData.YotogiType.VipCall))
                {
                    for (int i = 0; i < 40; i++)
                    {
                        Maid scheduleSlot = GameMain.Instance.CharacterMgr.status.GetScheduleSlot(i);
                        if (scheduleSlot != null && scheduleSlot != maid && (taskId == scheduleSlot.status.noonWorkId || taskId == scheduleSlot.status.nightWorkId))
                        {
                            flag = true;
                            break;
                        }
                    }
                }
                if (!flag && (yotogi.yotogiType == ScheduleCSVData.YotogiType.Vip || yotogi.yotogiType == ScheduleCSVData.YotogiType.VipCall || yotogi.yotogiType == ScheduleCSVData.YotogiType.Entertain || yotogi.yotogiType == ScheduleCSVData.YotogiType.Travel) && !ScheduleAPI.EnableNightWork(taskId, maid, true, true))
                {
                    flag = true;
                }
                if (flag)
                {
                    WorkIdReset(maid.status, time);
                }
            }
            else
            {
                WorkIdReset(maid.status, time);
            }
            return(flag);
        }
예제 #5
0
        public static void SetFacilityAllMaid(ScheduleMgr.ScheduleTime scheduleTime)
        {
            if (ScheduleMgrPatch.m_scheduleApi == null)
            {
                MyLog.LogMessage("SetSlotAllDel"
                                 , "스케줄 관리 접속 한번 필요"
                                 );
                return;
            }

            if (configEntryUtill["SetFacilityAllMaid", false])
            {
                MyLog.LogMessage(
                    "SetFacilityAllMaid1"
                    );
            }
            //List<KeyValuePair<int, ScheduleCSVData.Work>> works = ScheduleCSVData.WorkData.ToList();

            // 스케줄의 슬롯 정보
            // public Maid GetScheduleSlot(int slotNo)
            // if (string.IsNullOrEmpty(this.scheduleSlot[slotNo].maid_guid))
            ScheduleData[] scheduleDatas = GameMain.Instance.CharacterMgr.status.scheduleSlot;
            Maid           maid;

            // 사용 가능한 메이드 슬롯 목록
            List <int> slots = new();

            for (int i = 0; i < scheduleDatas.Length; i++)
            {
                if (scheduleDatas[i].maid_guid == string.Empty)
                {
                    continue;
                }
                slots.Add(i);
            }


            //var facilitys = GameMain.Instance.FacilityMgr.GetFacilityArray().Where(x=>x).ToList();
            var facilitys = GameMain.Instance.FacilityMgr.GetFacilityArray().ToList();

            if (configEntryUtill["SetFacilityAllMaid"])
            {
                MyLog.LogMessage(
                    "SetFacilityAllMaid3"
                    , scheduleDatas.Length
                    , slots.Count
                    , facilitys.Count
                    );
            }

            // 구현부
            Facility facility;

            FacilityDataTable.FacilityDefaultData defaultData;
            ScheduleCSVData.Work workData;

            while (facilitys.Count > 2)
            {
                int n2 = UnityEngine.Random.Range(2, facilitys.Count);
                if (facilitys[n2] == null)
                {
                    if (configEntryUtill["SetFacilityAllMaid"])
                    {
                        MyLog.LogMessage(
                            "SetFacilityAllMaid null"
                            , n2
                            );
                    }
                }
                else
                {
                    facility    = facilitys[n2];
                    defaultData = facility.defaultData;
                    workData    = defaultData.workData;

                    if (facility.minMaidCount <= slots.Count && workData.id != 0)
                    {
                        for (int k = 0; k < facility.minMaidCount; k++)
                        {
                            int n1 = UnityEngine.Random.Range(0, slots.Count);
                            try
                            {
                                maid = GameMain.Instance.CharacterMgr.status.GetScheduleSlot(slots[n1]);
                                if (configEntryUtill["SetFacilityAllMaid"])
                                {
                                    MyLog.LogMessage(
                                        "SetFacilityAllMaid4"
                                        , n2
                                        , n1
                                        , MyUtill.GetMaidFullName(maid)
                                        , facility.defaultName

                                        );
                                }

                                //if (ScheduleMgrPatch.m_scheduleApi != null)
                                ScheduleMgrPatch.m_scheduleApi.SetNoonWorkSlot_Safe(scheduleTime, slots[n1], workData.id);

                                facility.AllocationMaid(maid, scheduleTime);
                            }
                            catch (Exception e)
                            {
                                MyLog.LogWarning(
                                    "SetFacilityAllMaid4"
                                    , n2
                                    , e.ToString()
                                    );
                            }
                            slots.Remove(slots[n1]);
                        }
                        if (slots.Count == 0)
                        {
                            if (!DailyMgrPatch.IsLegacy)
                            {
                                GameMain.Instance.FacilityMgr.UpdateFacilityAssignedMaidData();
                            }
                            ScheduleAPI.MaidWorkIdErrorCheck(true);
                            return;
                        }
                    }
                }
                facilitys.RemoveAt(n2);
            }

            facility    = facilitys[1];
            defaultData = facility.defaultData;
            workData    = defaultData.workData;
            while (slots.Count > 0)
            {
                int n1 = 0;
                maid = GameMain.Instance.CharacterMgr.status.GetScheduleSlot(slots[n1]);

                //if (ScheduleMgrPatch.m_scheduleApi != null)
                ScheduleMgrPatch.m_scheduleApi.SetNoonWorkSlot_Safe(scheduleTime, slots[n1], workData.id);

                facility.AllocationMaid(maid, scheduleTime);

                slots.RemoveAt(n1);
            }

            if (!DailyMgrPatch.IsLegacy)
            {
                GameMain.Instance.FacilityMgr.UpdateFacilityAssignedMaidData();
            }
            ScheduleAPI.MaidWorkIdErrorCheck(true);
        }
예제 #6
0
 public ScheduleDTO GetScheduleByKey(int key)
 {
     return(ScheduleAPI.GetAsync(key));
 }
예제 #7
0
 public async Task <IEnumerable <ScheduleDTO> > GetAll()
 {
     return(await ScheduleAPI.GetAllAsync());
 }
예제 #8
0
 public async void Delete(int key)
 {
     await ScheduleAPI.DeleteAsync(key);
 }
예제 #9
0
 public async Task <bool> Add(ScheduleDTO sched)
 {
     return(await ScheduleAPI.SaveAsync(sched));
 }