Exemplo n.º 1
0
        // Dictionary<DateTime, TimeObjHour> hours;



        public TimeObjDay(DateTime _dt, Transform parent, TimeObj _dictValue, bool cascade)
        {
            Transform _t = Transform.Instantiate(MessageMgr.Instance.day,
                                                 EtcMgr.getPosition(_dt),
                                                 EtcMgr.getRotationDay(_dt),
                                                 MessageMgr.Instance.gameRoot) as Transform;

            this.dt        = _dt;
            this.dictValue = _dictValue;
            dGo            = _t.gameObject;
            dictValue.Day  = dGo;
            dGo.SetActive(true);
            dictValue.isDay = true;
            dGo.name        = "D" + dt.Day;
            dHolderGo       = dGo.GetFirstChild();
            dHolderGo.layer = 11;
            dHolderB        = dGo.GetComponent <DayHolderBe>();
            dHolderB.setDateTime(_dt);
            dHolderB.Register(dictValue);

            if (cascade)
            {
                InflateMyHours(true);
            }
        }
Exemplo n.º 2
0
        DeflatePrior()
        {
            DateTime cloned = dt.AddMinutes(-1).Neuter();
            TimeObj  prior  = MakeTime.timeObjDictionary[cloned];

            prior.tom.DeflateMySeconds();
        }
Exemplo n.º 3
0
        //making a timeObj that manages this slice of time
        public TimeObj MakeTimeObj(DateTime dt)
        {
            TimeObj to = new TimeObj(dt, this);

            to.MakeFaces(dt);

            //if (dump)
            //{
            //    try
            //    {
            //        //   //// U.Log(dt.Dump());
            //        //if(dump) U.Log(

            //         //"\t M:" + minuteNumber + "/" + minuteParent.gameObject.name
            //         //+ "\t H:" + hourNumber + " / " + hourParent.gameObject.name

            //         //);
            //    }
            //    catch (Exception ex)
            //    {
            //        Debug.Log( ex.ToString() );
            //    }
            //}


            return(to);
        }
Exemplo n.º 4
0
        public TimeObjHour(DateTime _dt, Transform parent, TimeObj _dictValue, bool cascade)
        {
            // U.Log(" constructor " +_dictValue.m_Date.ToString()  );

            Transform _t = Transform.Instantiate(MessageMgr.Instance.hour,
                                                 EtcMgr.getPosition(_dt),
                                                 EtcMgr.getRotationHour(_dt),
                                                 parent) as Transform;

            dictValue        = _dictValue; // the TimeObj
            hGo              = _t.gameObject;
            dictValue.Hour   = hGo;
            dictValue.isHour = true;

            this.dt = _dt;

            hGo.name = "H" + dt.Hour;

            hHolderGo       = hGo.GetFirstChild();
            hHolderGo.layer = 10;
            hHolderB        = hGo.GetComponent <HourHolderBe>();
            hHolderB.setDateTime(_dt);
            hHolderB.Register(dictValue);

            if (cascade)
            {
                InflateMyMinutes(true);
            }
        }
Exemplo n.º 5
0
        DeflatePrior()
        {
            DateTime cloned = dt.AddHours(-1).Neuter();
            TimeObj  prior  = MakeTime.timeObjDictionary[cloned];

            prior.toh.DeflateMyMinutes();
        }
Exemplo n.º 6
0
        /// <summary>
        /// ////////////
        /// </summary>

        public static void runTests()
        {
            TimeObj to = new TimeObj(DateTime.Now);

            to.MakeMyDay(true);


            //U.aLevel(8);
            ToToToTo(U.pIsDay, U.aDump, U.aActDayDown);
        }
Exemplo n.º 7
0
        InflateSeconds(DateTime _dt, Transform _parent, TimeObj _dictValue)
        {
            seconds = new Dictionary <int, TimeObjSecond>(); //todo rid of this


            for (int i = 0; i < 60; ++i)
            {
                DateTime      ndt = _dt.AddSeconds(i);
                TimeObjSecond tos = new TimeObjSecond(ndt.Neuter(), mGo.transform, dictValue);
                tos.sGo.SetActive(true);
                seconds.Add(i, tos);
            }

            //speak to the new 60 seconds
            mGo.BroadcastMessage("ShowMe", this);
        }
Exemplo n.º 8
0
        InflateMinutes(DateTime _dt, Transform _parent, TimeObj _dictValue, bool cascade)
        {
            minutes = new Dictionary <int, TimeObjMinute>(); //todo rid of this


            for (int i = 0; i < 60; ++i)
            {
                DateTime      ndt = _dt.AddMinutes(i);
                TimeObjMinute tom = new TimeObjMinute(ndt.Neuter(), hGo.transform, dictValue, cascade);
                tom.mGo.SetActive(true);
                minutes.Add(i, tom);
            }

            //speak to the new 60 minutes
            hGo.BroadcastMessage("ShowMe", this);
        }
Exemplo n.º 9
0
        InflateHours(DateTime _dt, Transform _parent, TimeObj _dictValue, bool cascade)
        {
            hours = new Dictionary <int, TimeObjHour>(); //todo rid of this
            //hours = new Dictionary<DateTime, TimeObjHour>(); //todo rid of this


            for (int i = 0; i < 24; ++i)
            {
                DateTime    ndt = DateTime.Today.AddHours(i);
                TimeObjHour toh = new TimeObjHour(ndt.Neuter(), dGo.transform, dictValue, cascade);
                toh.hGo.SetActive(true);
                //hours.Add(ndt, toh);
                hours.Add(i, toh);
            }

            //speak to the new 24 hours
            dGo.BroadcastMessage("ShowMe", this);
        }
Exemplo n.º 10
0
        public TimeObjSecond(DateTime dt, Transform parent, TimeObj _dictValue)
        {
            Transform _t = Transform.Instantiate(MessageMgr.Instance.second,
                                                 EtcMgr.getPosition(dt),
                                                 EtcMgr.getRotationSeconds(dt),
                                                 parent) as Transform;

            dictValue          = _dictValue;
            dictValue.Second   = sGo;
            dictValue.isSecond = true;

            sGo      = _t.gameObject;
            sGo.name = "S" + dt.Second;
            sGo.GetFirstChild().layer = 8;



            sHolderGo = sGo.GetFirstChild();
            sHolderB  = sGo.GetComponent <SecondHolderBe>();
            sHolderB.setDateTime(dt);
        }
Exemplo n.º 11
0
        //  IEnumerator FillTimeObjDictionary(DateTime start, DateTime end)
        public void FillTimeObjDictionary(DateTime start, DateTime end)
        {
            timer = Stopwatch.StartNew();
            DateTime then = DateTime.Now;

            U.Log("Filling ...  " + Math.Floor(TMsingleton.ElapsedFunc(start, end).TotalSeconds));


            while (timeObjDictionary.Count < TMsingleton.ElapsedFunc(start, end).TotalSeconds)
            {
                TimeObj tos = tof.MakeTimeObj(lastProcessedStamp);

                //Neuter flatens the Ticks to make dt == dt comparison faster
                timeObjDictionary.Add(lastProcessedStamp.Neuter(), tos);

                if (first)
                {
                    first = false;
                }

                lastProcessedStamp = lastProcessedStamp.AddSeconds(1);
            }
            allSecs  = timeObjDictionary.Values;
            allDates = timeObjDictionary.Keys;

            timer.Stop();
            DateTime now = DateTime.Now;

            U.Log("Timing ...  " + (now - then).Seconds);

            U.Log("FillTimeObjDictionary w " + allSecs.Count
                  + " in " + timer.Elapsed.Seconds.ToString());



            //configGameObjects();
            //runTests();
            ToToToTo(U.pIsDay, U.aDump, U.aActDayDown);
            U.ActivateHoursUp();
        }
Exemplo n.º 12
0
        // Class knows how to populate seconds but will wait
        public TimeObjMinute(DateTime _dt, Transform parent, TimeObj _dictValue, bool cascade)
        {
            Transform _t = Transform.Instantiate(MessageMgr.Instance.minute,
                                                 EtcMgr.getPosition(_dt),
                                                 EtcMgr.getRotationMinute(_dt),
                                                 parent) as Transform;

            dictValue          = _dictValue; // the TimeObj
            mGo                = _t.gameObject;
            dictValue.Minute   = mGo;
            dictValue.isMinute = true;

            this.dt = _dt;

            mGo.name = "M" + dt.Minute;

            mHolderGo       = mGo.GetFirstChild();
            mHolderGo.layer = 9;
            mHolderB        = mGo.GetComponent <MinuteHolderBe>();
            mHolderB.setDateTime(_dt);
            mHolderB.Register(dictValue);
        }
Exemplo n.º 13
0
 InflateSecond(DateTime _dt, Transform _parent, TimeObj _dictValue)
 {
     //The tos will add itself to the dict
     TimeObjSecond tos = new TimeObjSecond(_dt, _parent, _dictValue);
 }
Exemplo n.º 14
0
 InflateHour(DateTime _dt, Transform _parent, TimeObj _dictValue)
 {
     //The toh should add itself to the dict, MakeTime will have to stop doing that
     TimeObjHour toh = new TimeObjHour(_dt, _parent, _dictValue, false);
 }
Exemplo n.º 15
0
 InflateMinute(DateTime _dt, Transform _parent, TimeObj _dictValue)
 {
     //The tom should add itself to the dict, MakeTime will have to stop doing that
     TimeObjMinute tom = new TimeObjMinute(_dt, _parent, _dictValue, false);
 }
Exemplo n.º 16
0
 public void Register(TimeObj to)
 {
     timeObject = to;
 }
Exemplo n.º 17
0
 public void Register(TimeObj to) {
     timeNode = to;
 }