예제 #1
0
    public void AddSchedule()
    {
        if (add_shDescription.text == "")
        {
            _controller.OnWarningMsg("수업 이름을 기입하세요.");
            return;
        }

        Schedule tmp = new Schedule();

        tmp.start1      = s1hour.GetData() + ":" + s1min.GetData();
        tmp.finish1     = f1hour.GetData() + ":" + f1min.GetData();
        tmp.day1        = day1.GetData();
        tmp.description = add_shDescription.text;

        if (isSecondSchOn)
        {
            tmp.start2  = s2hour.GetData() + ":" + s2min.GetData();
            tmp.finish2 = f2hour.GetData() + ":" + f2min.GetData();
            tmp.day2    = day2.GetData();
        }
        else
        {
            tmp.start2  = null;
            tmp.finish2 = null;
            tmp.day2    = null;
        }
        if (CheckIfCanbeAdded(tmp, -1) == null)
        {
            return;
        }



        string key = FirebaseMgr.Instance.AddSchedule(tmp);

        _controller._user.schedule_list.Add(key, tmp);
        AddSingleScheduleItem(tmp.start1, tmp.finish1, ++objIndex, tmp.description, tmp.day1, colorIndex);
        objToScheduleList.Add(objIndex, key);
        if (isSecondSchOn)
        {
            AddSingleScheduleItem(tmp.start2, tmp.finish2, ++objIndex, tmp.description, tmp.day2, colorIndex);
            objToScheduleList.Add(objIndex, key);
            AddSingleScheduleItem(tmp.start2, tmp.finish2, ++objIndex, tmp.description, tmp.day2, colorIndex);
            objToScheduleList.Add(objIndex, key);
        }

        isSecondSchOn = false;
        add_page.SetActive(false);
    }