コード例 #1
0
 // Use this for initialization
 void Start()
 {
     time           = 0;
     timeEnum       = times.dusk;
     light          = nightlight;
     lastTransition = duskTime;
     RenderSettings.ambientLight = light;
 }
コード例 #2
0
ファイル: World.cs プロジェクト: NotYours180/Survival
	// Use this for initialization
	void Start () {
		
		time = 0;
		timeEnum = times.dusk;
		light = nightlight;
		lastTransition = duskTime;
		RenderSettings.ambientLight = light;
	}
コード例 #3
0
    // Update is called once per frame
    void Update()
    {
        time += Time.deltaTime;

        switch (timeEnum)
        {
        case times.dawn:
            if (time > dayTime)
            {
                light          = daylight;
                lastTransition = dayTime;
                timeEnum       = times.day;
            }
            else
            {
                TransitionLight(nightlight, daylight, dayTime);
            }
            break;

        case times.day:
            if (time > duskTime)
            {
                lastTransition = duskTime;
                timeEnum       = times.dusk;
            }
            break;

        case times.dusk:
            if (time > nightTime)
            {
                light          = nightlight;
                lastTransition = nightTime;
                timeEnum       = times.night;
                c.WorldEvent(WorldEvents.NightStarted);
                time = 0;
            }
            else
            {
                TransitionLight(daylight, nightlight, nightTime);
            }
            break;

        case times.night:
            if (time > dawnTime)
            {
                lastTransition = dawnTime;
                timeEnum       = times.dawn;
            }
            break;
        }
    }
        public string findNext(string from, string to, string start)
        {
            Console.WriteLine(start);
            Traveler t = findCity(from, to);

            if (t != null)
            {
                times time = findTime(t, to, start);
                if (time != null)
                {
                    return("{ depart: " + from + ", departureTime: " + time.Leave + ", arrive: " + to + ", arrivalTime: " + time.Arrive + " }");
                }
            }
            return("");
        }
コード例 #5
0
        //מקבל תז הורה
        public timesDTO GetTimeforMother(string id)
        {
            times timesList = timesDAL.GetTimesForMother(id);

            if (timesList == null)
            {
                return(new  timesDTO());
            }
            timesDTO t = new timesDTO();

            t.code       = timesList.code;
            t.code_class = timesList.code_class;
            t.from_hour  = timesList.from_hour;
            t.to_hour    = timesList.to_hour;
            return(t);
        }
コード例 #6
0
ファイル: World.cs プロジェクト: NotYours180/Survival
	// Update is called once per frame
	void Update () {
		time += Time.deltaTime;
		
		switch(timeEnum) {
			case times.dawn:
				if (time > dayTime) {
					light = daylight;
					lastTransition = dayTime;
					timeEnum = times.day;
				} else {
					TransitionLight(nightlight, daylight, dayTime);
				}
			break;
			case times.day:
				if (time > duskTime) {
					lastTransition = duskTime;
					timeEnum = times.dusk;
				}
			break;
			case times.dusk:
				if (time > nightTime) {
					light = nightlight;
					lastTransition = nightTime;
					timeEnum = times.night;
					c.WorldEvent(WorldEvents.NightStarted);
					time = 0;
				} else {
					TransitionLight(daylight, nightlight, nightTime);
				}
			break;
			case times.night:
				if (time > dawnTime) {
					lastTransition = dawnTime;
					timeEnum = times.dawn;
				}
			break;
		}
	}
コード例 #7
0
        //פונקצית שיבוץ לתלמידה בודדת
        // אם יכול לשבץ מוסיף לאוסף השיבוץ ומחזיר אמת
        //אחרת מחזיר שקר
        bool Shibutz_stud(studens s)
        {
            //נשלוף את הבקשות של האמא
            //את השיבוצים של האחיות של התלמידה
            // את השעות הפנויות בכיתה שלה
            //וננסה לשבץ באופן שמתאים לכל הקריטריונים
            request r = s.parents.request.FirstOrDefault();

            if (r == null)
            {
                r           = new request();
                r.id_parent = s.id_parent;
                r.from_hour = s.classes.times.FirstOrDefault().from_hour;
                r.to_hour   = s.classes.times.FirstOrDefault().to_hour;
            }
            List <scheduling> lstSis   = lstscheduling.Where(ss => ss.studens.id_parent == s.id_parent).ToList();
            List <scheduling> lstClass = lstscheduling.Where(ss => ss.studens.code_class == s.code_class)
                                         .OrderBy(ss => ss.hour_).ToList();

            //לולאה שעוברת על כל השעות שבטווח הבקשה של האמא
            //ומנסה לשבץ
            //אם הצליחה מחזירה אמת
            for (TimeSpan h = r.from_hour; h < r.to_hour; h.Add(new TimeSpan(0, 15, 0)))
            {
                if (lstSis == null || lstSis.Where(ss => ss.hour_.Equals(h)).FirstOrDefault() == null)
                {
                    if (lstClass.Where(ss => ss.hour_.Equals(h)).ToList().Count < 2)
                    {    //שיבוץ בפועל
                        //והחזרת אמת
                        scheduling x = new scheduling();
                        x.code_class = s.code_class;
                        x.hour_      = h;
                        x.id_student = s.id;
                        lstscheduling.Add(x);
                        return(true);
                    }
                }
            }
            //אם לא הצליחה
            //לולאה שעוברת על כל הטווח של הכיתה
            //ומנסה לשבץ
            //!!!!!!!!!!!!!!!!!!!!!!!!!!חובה לשנות שישלוף את הזמנים של הכיתה
            times tt = new times();//global.PARENTS.times.Where(t => t.code_class == s.code_class);

            for (TimeSpan h = tt.from_hour; h < tt.to_hour; h.Add(new TimeSpan(0, 15, 0)))
            {
                if (lstClass.Where(ss => ss.hour_.Equals(h)).ToList().Count < 2)
                {
                    if (lstSis == null || lstSis.Where(ss => ss.hour_.Equals(h)).FirstOrDefault() == null)
                    {
                        {    //שיבוץ בפועל
                             //והחזרת אמת
                            scheduling x = new scheduling();
                            x.code_class = s.code_class;
                            x.hour_      = h;
                            x.id_student = s.id;
                            lstscheduling.Add(x);
                            return(true);
                        }
                    }
                }
            }
            //אם לא הצליחה יחזיר שקר
            return(false);
        }
コード例 #8
0
        public JsonResult getTimeSheet(string dateSelected)
        {
            string str = " to ";

            string[]         dates      = dateSelected.Split(str.ToCharArray());
            var              day1       = DateTime.Parse(dates[0]);
            var              timesheets = es.getTimeSheet(DateTime.Parse(dates[0]), User.Identity.Name);
            List <TimeInOut> timeinouts = new List <TimeInOut>();

            if (timesheets != null && timesheets.TimeInOuts != null)
            {
                timeinouts = timesheets.TimeInOuts.ToList();
            }
            ModelStack           mdl       = new ModelStack();
            TimeSheetModel       tsm       = new TimeSheetModel();
            TimeSheetItem        tItem     = new TimeSheetItem();
            List <TimeSheetItem> timeItems = new List <TimeSheetItem>();

            var svc = Session["svc"] == null?es.getServiceCodes() : (List <serviceCode>)Session["svc"];

            var plans = Session["plans"] == null?es.getPlans() : (List <planSection>)Session["plans"];

            Session["svc"]   = svc;
            Session["plans"] = plans;
            tsm.empName      = Session["username"] == null?es.getUsername(User.Identity.Name) : Session["username"].ToString();

            Session["username"] = tsm.empName;

            svc srv = new Models.svc();

            tsm.serviceCodes = new List <Models.svc>();
            tsm.PlanSections = new List <plan>();
            foreach (var item in svc)
            {
                srv.Id   = item.Id;
                srv.Name = item.Name;
                tsm.serviceCodes.Add(srv);
                srv = new Models.svc();
            }
            plan pln = new Models.plan();

            foreach (var item in plans)
            {
                pln.Id   = item.Id;
                pln.Name = item.Name;
                tsm.PlanSections.Add(pln);
                pln = new Models.plan();
            }
            if (timesheets == null)
            {
                tsm.Id         = 0;
                tsm.isViewOnly = false;
                tsm.isBackup   = null;
                tsm.isLiveIn   = null;
                tsm.startDate  = day1;
                tsm.items      = new List <TimeSheetItem>();
                for (int i = 0; i < 7; i++)
                {
                    tItem.Id      = 0;
                    tItem.dayDate = day1.ToShortDateString();
                    tItem.dayName = day1.ToString("dddd");
                    day1          = day1.AddDays(1);
                    tItem.dates   = dates;
                    tItem.times   = new List <times>();
                    tItem.times.Add(new times());
                    tsm.items.Add(tItem);
                    tItem = new TimeSheetItem();
                }
            }
            else
            {
                tsm.Id = timesheets.Id;

                if (timesheets.isDraft != null && timesheets.isDraft.Value == true)
                {
                    tsm.isViewOnly = false;
                    tsm.isDraft    = true;
                }
                else
                {
                    tsm.isViewOnly = true;
                    tsm.isDraft    = false;
                }
                if (timesheets.isBackup != null)
                {
                    tsm.isBackup = timesheets.isBackup.Value;
                }
                if (timesheets.isLiveIn != null)
                {
                    tsm.isLiveIn = timesheets.isLiveIn.Value;
                }
                if (timesheets.DayDate != null)
                {
                    tsm.startDate = timesheets.DayDate.Value;
                }
                tsm.items = new List <TimeSheetItem>();


                if (timesheets.fk_statusid == 3)
                {
                    tsm.isViewOnly = false;
                    for (int i = 0; i < 7; i++)
                    {
                        var items      = timeinouts.Where(x => x.dayDate.Value.Date.ToShortDateString() == day1.ToShortDateString()).ToList();
                        var dateditems = items.GroupBy(x => x.dayDate);
                        if (items.Count > 0)
                        {
                            foreach (var itemsvals in dateditems)
                            {
                                var itemvals = itemsvals.ToList();
                                var time2    = false;
                                foreach (var item in itemvals)
                                {
                                    if (time2 == false)
                                    {
                                        time2 = item.TimeIn2H1 != null;
                                    }
                                    tItem.Id      = item.Id;
                                    tItem.dayDate = item.dayDate.Value.Date.ToShortDateString();;
                                    tItem.dayName = item.dayDate.Value.ToString("dddd"); //config
                                    if (tsm.HasTime2 != true)
                                    {
                                        tsm.HasTime2 = item.TimeIn2H1 != null;
                                    }
                                    times timesitem = new times();
                                    if (item.fk_plansection != null)
                                    {
                                        timesitem.plansectionId = item.fk_plansection.Value;
                                    }
                                    if (item.isInAM != null)
                                    {
                                        timesitem.isAmIn = item.isInAM.Value.ToString().ToLower();
                                    }
                                    if (item.isOutAM != null)
                                    {
                                        timesitem.isAmOut = item.isOutAM.Value.ToString().ToLower();
                                    }
                                    if (item.fk_serviceCode != null)
                                    {
                                        timesitem.serviceCodeId = item.fk_serviceCode.Value;
                                    }
                                    //time.serviceCodes = svc;
                                    if (item.TimeInH1 != null)
                                    {
                                        timesitem.TimeInH1 = item.TimeInH1.ToString();
                                    }
                                    if (item.TimeInM1 != null)
                                    {
                                        timesitem.TimeInM1 = item.TimeInM1.ToString();
                                    }
                                    if (item.TimeOutH1 != null)
                                    {
                                        timesitem.TimeOutH1 = item.TimeOutH1.ToString();
                                    }
                                    if (item.TimeOutM1 != null)
                                    {
                                        timesitem.TimeOutM1 = item.TimeOutM1.ToString();
                                    }

                                    if (item.TimeIn2H1 != null)
                                    {
                                        if (item.TimeIn2H1 != null)
                                        {
                                            timesitem.TimeIn2H1 = item.TimeIn2H1.ToString();
                                        }
                                        if (item.TimeIn2M1 != null)
                                        {
                                            timesitem.TimeIn2M1 = item.TimeIn2M1.ToString();
                                        }
                                        if (item.TimeOut2H1 != null)
                                        {
                                            timesitem.TimeOut2H1 = item.TimeOut2H1.ToString();
                                        }
                                        if (item.TimeOut2M1 != null)
                                        {
                                            timesitem.TimeOut2M1 = item.TimeOut2M1.ToString();
                                        }
                                        if (item.isInAM2 != null)
                                        {
                                            timesitem.isAmIn2 = item.isInAM2.Value.ToString().ToLower();
                                        }
                                        if (item.isOutAM2 != null)
                                        {
                                            timesitem.isAmOut2 = item.isOutAM2.Value.ToString().ToLower();
                                        }
                                        timesitem.Time2 = true;
                                        tsm.HasTime2    = true;
                                    }
                                    else
                                    {
                                        timesitem.Time2 = time2;
                                    }
                                    tItem.dates = dates;
                                    if (tItem.times == null)
                                    {
                                        tItem.times = new List <times>();
                                    }
                                    tItem.times.Add(timesitem);
                                    // tItem.serviceCodeId = item.serviceCode.Id;
                                }
                                tsm.items.Add(tItem);

                                tItem = new TimeSheetItem();
                            }
                        }
                        else
                        {
                            tItem.Id      = 0;
                            tItem.dayDate = day1.ToShortDateString();

                            tItem.dayName = day1.ToString("dddd");
                            tItem.dates   = dates;
                            tItem.times   = new List <times>();
                            tItem.times.Add(new times());

                            tsm.items.Add(tItem);
                        }
                        day1  = day1.AddDays(1);
                        tItem = new TimeSheetItem();
                    }
                }

                else
                {
                    var items      = timeinouts;
                    var dateditems = items.GroupBy(x => x.dayDate);
                    foreach (var itemsvals in dateditems)
                    {
                        var itemvals = itemsvals.ToList();
                        var time2    = false;
                        foreach (var item in itemvals)
                        {
                            if (time2 == false)
                            {
                                time2 = item.TimeIn2H1 != null;
                            }
                            tItem.Id      = item.Id;
                            tItem.dayDate = item.dayDate.Value.Date.ToShortDateString();;
                            tItem.dayName = item.dayDate.Value.ToString("dddd"); //config
                            if (tsm.HasTime2 != true)
                            {
                                tsm.HasTime2 = item.TimeIn2H1 != null;
                            }
                            times timesitem = new times();
                            if (item.fk_plansection != null)
                            {
                                timesitem.plansectionId = item.fk_plansection.Value;
                            }
                            if (item.isInAM != null)
                            {
                                timesitem.isAmIn = item.isInAM.Value.ToString().ToLower();
                            }
                            if (item.isOutAM != null)
                            {
                                timesitem.isAmOut = item.isOutAM.Value.ToString().ToLower();
                            }
                            if (item.fk_serviceCode != null)
                            {
                                timesitem.serviceCodeId = item.fk_serviceCode.Value;
                            }
                            //time.serviceCodes = svc;
                            if (item.TimeInH1 != null)
                            {
                                timesitem.TimeInH1 = item.TimeInH1.ToString();
                            }
                            if (item.TimeInM1 != null)
                            {
                                timesitem.TimeInM1 = item.TimeInM1.ToString();
                            }
                            if (item.TimeOutH1 != null)
                            {
                                timesitem.TimeOutH1 = item.TimeOutH1.ToString();
                            }
                            if (item.TimeOutM1 != null)
                            {
                                timesitem.TimeOutM1 = item.TimeOutM1.ToString();
                            }

                            if (item.TimeIn2H1 != null)
                            {
                                if (item.TimeIn2H1 != null)
                                {
                                    timesitem.TimeIn2H1 = item.TimeIn2H1.ToString();
                                }
                                if (item.TimeIn2M1 != null)
                                {
                                    timesitem.TimeIn2M1 = item.TimeIn2M1.ToString();
                                }
                                if (item.TimeOut2H1 != null)
                                {
                                    timesitem.TimeOut2H1 = item.TimeOut2H1.ToString();
                                }
                                if (item.TimeOut2M1 != null)
                                {
                                    timesitem.TimeOut2M1 = item.TimeOut2M1.ToString();
                                }
                                if (item.isInAM2 != null)
                                {
                                    timesitem.isAmIn2 = item.isInAM2.Value.ToString().ToLower();
                                }
                                if (item.isOutAM2 != null)
                                {
                                    timesitem.isAmOut2 = item.isOutAM2.Value.ToString().ToLower();
                                }
                                timesitem.Time2 = true;
                                tsm.HasTime2    = true;
                            }
                            else
                            {
                                timesitem.Time2 = time2;
                            }

                            tItem.dates = dates;


                            if (tItem.times == null)
                            {
                                tItem.times = new List <times>();
                            }
                            tItem.times.Add(timesitem);
                            // tItem.serviceCodeId = item.serviceCode.Id;
                        }

                        if (time2 == true)
                        {
                            foreach (var item in tItem.times)
                            {
                                item.Time2 = true;
                            }
                        }

                        timeItems.Add(tItem);

                        tItem = new TimeSheetItem();
                    }
                    tsm.items = timeItems;
                }
            }
            mdl.model      = tsm;
            mdl.modelstack = new List <TimeSheetModel>();
            // mdl.modelstack.Add(tsm);
            return(Json(mdl));
        }
コード例 #9
0
ファイル: ReTry.cs プロジェクト: maikebing/Silkier
 return(RetryOnAny(times, action, efunc));
コード例 #10
0
 // trace.SetActive(true);
 trace.GetComponent <Trace>().Init(times, positions, rotations);