コード例 #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);
            }
        }
コード例 #2
0
        DeflatePrior()
        {
            DateTime cloned = dt.AddMinutes(-1).Neuter();
            TimeObj  prior  = MakeTime.timeObjDictionary[cloned];

            prior.tom.DeflateMySeconds();
        }
コード例 #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);
        }
コード例 #4
0
ファイル: TimeObjHour.cs プロジェクト: basilbeltran/time
        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);
            }
        }
コード例 #5
0
        DeflatePrior()
        {
            DateTime cloned = dt.AddHours(-1).Neuter();
            TimeObj  prior  = MakeTime.timeObjDictionary[cloned];

            prior.toh.DeflateMyMinutes();
        }
コード例 #6
0
ファイル: MakeTime.cs プロジェクト: basilbeltran/time
        /// <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);
        }
コード例 #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);
        }
コード例 #8
0
ファイル: TimeObjHour.cs プロジェクト: basilbeltran/time
        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);
        }
コード例 #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);
        }
コード例 #10
0
ファイル: TimeObjSecond.cs プロジェクト: basilbeltran/time
        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);
        }
コード例 #11
0
ファイル: MakeTime.cs プロジェクト: basilbeltran/time
        //  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();
        }
コード例 #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);
        }
コード例 #13
0
 InflateSecond(DateTime _dt, Transform _parent, TimeObj _dictValue)
 {
     //The tos will add itself to the dict
     TimeObjSecond tos = new TimeObjSecond(_dt, _parent, _dictValue);
 }
コード例 #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);
 }
コード例 #15
0
ファイル: TimeObjHour.cs プロジェクト: basilbeltran/time
 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);
 }
コード例 #16
0
 public void Register(TimeObj to)
 {
     timeObject = to;
 }
コード例 #17
0
 public void Register(TimeObj to) {
     timeNode = to;
 }