Inheritance: MonoBehaviour
Exemplo n.º 1
0
        public void TestTransformStampedMessage()
        {
            Assert.True(BuiltIns.GetMessageType <MyTransformStamped>() == MyTransformStamped.RosMessageType);
            Assert.True(BuiltIns.GetMd5Sum <MyTransformStamped>() == BuiltIns.GetMd5Sum <TransformStamped>());

            time             now  = time.Now();
            TransformStamped real = new TransformStamped()
            {
                Header       = new Header(1, now, "Frame"),
                ChildFrameId = "Abcd",
                Transform    = Transform.Identity
            };

            MyTransformStamped wrapped = new MyTransformStamped()
            {
                Header       = new Header(1, now, "Frame"),
                ChildFrameId = "Abcd",
                Transform    = Transform.Identity
            };

            byte[] messageBytes      = real.SerializeToArray();
            byte[] otherMessageBytes = wrapped.SerializeToArray();

            Assert.True(messageBytes.SequenceEqual(otherMessageBytes));

            var otherWrapped = wrapped.DeserializeFromArray(messageBytes);

            Assert.True(wrapped.Header == real.Header);
            Assert.True(wrapped.ChildFrameId == real.ChildFrameId);
            Assert.True(wrapped.Transform == real.Transform);
        }
Exemplo n.º 2
0
    // Update is called once per frame
    void Update()
    {
        transform.Rotate(grid.transform.position, turnRate * Time.deltaTime);
        timeToChange -= Time.deltaTime;

        if (timeToChange <= 0f)
        {
            if (t == time.Day)
            {
                t = time.Night;
                targetEmission = 1f;
            }
            else
            {
                t = time.Day;
                targetEmission = 0f;
            }
            timeToChange = dayLength;
        }

        if (emissionColour != targetEmission)
        {
            emissionColour = Mathf.Lerp(emissionColour, targetEmission, 0.5f);
            for (int i = 0; i < windowMaterial.Length; i++)
            {
                windowMaterial[i].SetColor("_EmissionColor", new Color(0.6f * emissionColour, 0.6f * emissionColour, 0.55f * emissionColour, emissionColour));
            }
        }
    }
Exemplo n.º 3
0
 // Use this for initialization
 void Start()
 {
     animator_t = this.GetComponent <Animator>();
     animator_p = Player.GetComponent <Animator>();
     t          = GameObject.Find("Text").GetComponent <time>();
     check      = false;
 }
 protected void Button3_Click(object sender, EventArgs e)
 {
     if (Page.IsValid)
     {
         if (DateTime.Parse(Calendar1.SelectedDate.ToString("yyyy-MM-dd")) <= DateTime.Parse(Calendar2.SelectedDate.ToString("yyyy-MM-dd")))
         {
             time myTime = new time();
             bool add    = myTime.AddTime(Convert.ToDateTime(Calendar1.SelectedDate.Date), Convert.ToDateTime(Calendar2.SelectedDate.Date));
             if (add)
             {
                 Button1.Text = Button2.Text = "";
                 Response.Write("<script>alert('时间设定成功')</script>");
                 Response.Write("<script>window.close();</script>");
             }
             else
             {
                 Response.Write("<script>alert('时间已经设定')</script>");
                 Response.Write("<script>window.close();</script>");
             }
         }
         else
         {
             Response.Write("<script>alert('考试起始日期和终止日期添加不正确或者不完全,请重新添加!')</script>");
             Button1.Text = Button2.Text = "";
         }
     }
 }
Exemplo n.º 5
0
        public void TestDynamicMessage()
        {
            const string definition =
                "uint32 seq\n" +
                "time stamp\n" +
                "string frame_id";

            DynamicMessage message =
                DynamicMessage.CreateFromDependencyString("iviz_test/Header", definition);

            Assert.True(message.Fields.Count == 3);

            Assert.True(message.Fields[0].TrySet((uint)1));
            Assert.False(message.Fields[0].TrySet(0)); // int, not uint
            Assert.False(message.Fields[0].TrySet("a"));

            time now = new time(DateTime.Now);

            Assert.True(message.Fields[1].TrySet(now));
            Assert.False(message.Fields[1].TrySet("a"));

            Assert.True(message.Fields[2].TrySet("map"));
            Assert.False(message.Fields[2].TrySet(0));

            var realHeader = new Header(1, now, "map");

            Assert.True(message.RosInstanceMd5Sum == Header.RosMd5Sum);
            Assert.True(message.RosMessageLength == realHeader.RosMessageLength);

            byte[] messageBytes      = message.SerializeToArray();
            byte[] otherMessageBytes = realHeader.SerializeToArray();

            Assert.True(messageBytes.SequenceEqual(otherMessageBytes));
        }
Exemplo n.º 6
0
    protected void Button1_Click(object sender, EventArgs e)
    {
        monitor myMon = new monitor();
        time    Time  = new time();
        string  Time1 = Time.GetStartTime();
        string  Time2 = Time.GetEndTime();

        myMon.Initial();
        if (myMon.TeacherNum() == false | myMon.RoomNum() == false |
            myMon.CourseNum() == false | myMon.ClassNum() == false | Time1 == Time2)
        {
            Response.Write("<script>alert('监考信息添加不完全,请返回继续添加!')</script>");
        }
        else
        {
            bool Result = myMon.MakeMonitor();
            if (Result)
            {
                Response.Write("<script>alert('监考安排成功!')</script>");
            }
            else
            {
                Response.Write("<script>alert('监考安排失败,考试资源有限,安排任务无法在考试时间内安排成功!')</script>");
            }
        }
    }
Exemplo n.º 7
0
    //public GameObject gamover;



    void Awake()
    {
        curthealth = fulhealth;
        anim       = GetComponentInChildren <Animator> ();
        hb         = GetComponent <healthBarr>();
        timer      = GetComponentInChildren <time>();
    }
Exemplo n.º 8
0
    static void Main()
    {
        time t = new time();

        t.hour = 24;
        Console.WriteLine("Time in hours:" + t.hour);
    }
Exemplo n.º 9
0
 /// <summary> Explicit constructor. </summary>
 public LookupTransformGoal(string TargetFrame, string SourceFrame, time SourceTime, duration Timeout, time TargetTime, string FixedFrame, bool Advanced)
 {
     this.TargetFrame = TargetFrame;
     this.SourceFrame = SourceFrame;
     this.SourceTime  = SourceTime;
     this.Timeout     = Timeout;
     this.TargetTime  = TargetTime;
     this.FixedFrame  = FixedFrame;
     this.Advanced    = Advanced;
 }
Exemplo n.º 10
0
 /// <summary> Constructor with buffer. </summary>
 internal LookupTransformGoal(ref Buffer b)
 {
     TargetFrame = b.DeserializeString();
     SourceFrame = b.DeserializeString();
     SourceTime  = b.Deserialize <time>();
     Timeout     = b.Deserialize <duration>();
     TargetTime  = b.Deserialize <time>();
     FixedFrame  = b.DeserializeString();
     Advanced    = b.Deserialize <bool>();
 }
Exemplo n.º 11
0
        private void dgvWorklist_SelectionChanged(object sender, EventArgs e)
        {
            try
            {
                if (((DataGridView)sender).SelectedRows.Count > 0)
                {
                    tbDNI.Text =
                        ((DataGridView)sender).SelectedRows[0].Cells["Patient ID"].Value.ToString();
                    tbNombre.Text =
                        ((DataGridView)sender).SelectedRows[0].Cells["Patient Name"].Value.ToString();

                    fecha birthdateValue = new fecha(((DataGridView)sender).SelectedRows[0].Cells["Patient BirthDate"].Value.ToString());
                    dtNacimiento.Value = new DateTime(birthdateValue.year, birthdateValue.month, birthdateValue.day);

                    if (((DataGridView)sender).SelectedRows[0].Cells["Patient Sex"].Value.ToString() == "M")
                    {
                        rbMasculino.Checked = true;
                    }
                    else if (((DataGridView)sender).SelectedRows[0].Cells["Patient Sex"].Value.ToString() == "F")
                    {
                        rbFemenino.Checked = true;
                    }
                    else
                    {
                        rbNSNC.Checked = true;
                    }

                    tbPeso.Text =
                        ((DataGridView)sender).SelectedRows[0].Cells["Patient Weight"].Value.ToString();
                    tbAccessionNumber.Text =
                        ((DataGridView)sender).SelectedRows[0].Cells["Accession Number"].Value.ToString();
                    tbModalidad.Text =
                        ((DataGridView)sender).SelectedRows[0].Cells["Modality"].Value.ToString();

                    System.Diagnostics.Debug.WriteLine(((DataGridView)sender).SelectedRows[0].Cells["Fecha"].Value.ToString());

                    fecha fechaStudy = new fecha(((DataGridView)sender).SelectedRows[0].Cells["Fecha"].Value.ToString());
                    dtFecha.Value = new DateTime(fechaStudy.year, fechaStudy.month, fechaStudy.day);

                    time studyTime = new time(((DataGridView)sender).SelectedRows[0].Cells["Time"].Value.ToString());
                    nHora.Value    = studyTime.hour;
                    nMinutos.Value = studyTime.minutes;

                    //tbMedico.Text =
                    //    ((DataGridView)sender).SelectedRows[0].Cells["Physician Reading Study"].Value.ToString();
                    tbReferente.Text =
                        ((DataGridView)sender).SelectedRows[0].Cells["Referring Physician"].Value.ToString();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Ocurrió el siguiente error al copiar los datos del Worklist a los campos locales:\n" + ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
        }
Exemplo n.º 12
0
        public void SystemTime(DateTime newTime)
        {
            newTime = newTime.ToUniversalTime();
            time setTime = new time();
            setTime.Year = (short)newTime.Year;
            setTime.Month = (short)newTime.Month;
            setTime.DayOfWeek = (short)newTime.DayOfWeek;
            setTime.Day = (short)newTime.Day;
            setTime.Hour = (short)newTime.Hour;
            setTime.Minute = (short)newTime.Minute;
            setTime.Second = (short)newTime.Second;

            SetSystemTime(ref setTime);
        }
Exemplo n.º 13
0
        static void Main(string[] args)
        {
            DateTime currenttime = DateTime.Now;
            time     t           = new time(currenttime);

            t.display();
            int thehour;
            int theminute;
            int thesecond;

            t.gettime(out thehour, out theminute, out thesecond);
            Console.WriteLine("current time : {0}:{1}:{2}", thehour, theminute, thesecond);
            Console.ReadLine();
        }
Exemplo n.º 14
0
    static void Main()                              //入口方法
    {
        System.Console.WindowHeight = 2;            //设置控制台高度
        System.Console.WindowWidth  = 45;           //设置控制台宽度
        time t = new time();                        //创建time对象

        while (true)                                //开始while循环
        {
            System.Threading.Thread.Sleep(100);     //线程挂起100毫秒
            System.Console.Title = t.ToString();    //在控制台标题处显示当前时间
            System.Console.Clear();                 //清空控制台信息
            System.Console.WriteLine(t.ToString()); //输出当前时间
        }
    }
Exemplo n.º 15
0
        public void TestInteractiveMarkerMessage()
        {
            Assert.True(BuiltIns.GetMessageType(typeof(MyInteractiveMarker)) == MyInteractiveMarker.RosMessageType);
            Console.WriteLine(MyInteractiveMarker.RosDefinition);
            Assert.True(
                BuiltIns.GetMd5Sum(typeof(MyInteractiveMarker)) == BuiltIns.GetMd5Sum(typeof(InteractiveMarker)));

            time now  = time.Now();
            var  real = new InteractiveMarker()
            {
                Pose        = Pose.Identity,
                Name        = "Abcd",
                Description = "Efgh",
                MenuEntries = new MenuEntry[] { new(), new() },
Exemplo n.º 16
0
            internal static bool CheckTzInfoBeforeCompare(time self, time other) {
                if (self._tz != other._tz) {
                    timedelta offset1 = self.utcoffset();
                    timedelta offset2 = other.utcoffset();

                    if ((offset1 == null && offset2 != null) || (offset1 != null && offset2 == null))
                        throw PythonOps.TypeError("can't compare offset-naive and offset-aware times");

                    return false;
                } else {
                    return true; // has the same TzInfo, Utcoffset will be skipped
                }
            }
Exemplo n.º 17
0
 public static object combine(date date, time time) {
     return new datetime(date.year, date.month, date.day, time.hour, time.minute, time.second, time.microsecond, time.tzinfo);
 }
Exemplo n.º 18
0
 //constructor
 public LocPoint(int degreeNS, 
                 float minuteNS,
                 int degreeEW,
                 float minuteEW,
                 char NSIndicator,
                 char EWIndicator,
                 int initElevation,
                 time locTime,
                 double InitDistancedHiked)
 {
     degreeNorthSouth = degreeNS;
     minuteNorthSouth = minuteNS;
     degreeEastWest = degreeEW;
     minuteEastWest = minuteEW;
     northSouth = NSIndicator;
     eastWest = EWIndicator;
     elevation = initElevation;
     capTime = locTime;
     distancedHiked = InitDistancedHiked;
 }
 string displaymonth(int month, time display)
 {
     switch (month)
     {
         case 1:
             if (display == time.Future)
             {
                 int num = 10;
                 return "\\red " + num + ".jpg";
             }
             else if (display == time.Present)
             {
                 int num = 10;
                 return "\\green " + num + ".jpg";
             }
             else if (display == time.Past)
             {
                 int num = 10;
                 return "\\amber " + num + ".jpg";
             }
             break;
         case 2:
             if (display == time.Future)
             {
                 int num = 11;
                 return "\\red " + num + ".jpg";
             }
             else if (display == time.Present)
             {
                 int num = 11;
                 return "\\green " + num + ".jpg";
             }
             else if (display == time.Past)
             {
                 int num = 11;
                 return "\\amber " + num + ".jpg";
             }
             break;
         case 3:
             if (display == time.Future)
             {
                 int num = 12;
                 return "\\red " + num + ".jpg";
             }
             else if (display == time.Present)
             {
                 int num = 12;
                 return "\\green " + num + ".jpg";
             }
             else if (display == time.Past)
             {
                 int num = 12;
                 return "\\amber " + num + ".jpg";
             }
             break;
         case 4:
             if (display == time.Future)
             {
                 int num = 13;
                 return "\\red " + num + ".jpg";
             }
             else if (display == time.Present)
             {
                 int num = 13;
                 return "\\green " + num + ".jpg";
             }
             else if (display == time.Past)
             {
                 int num = 13;
                 return "\\amber " + num + ".jpg";
             }
             break;
         case 5:
             if (display == time.Future)
             {
                 int num = 14;
                 return "\\red " + num + ".jpg";
             }
             else if (display == time.Present)
             {
                 int num = 14;
                 return "\\green " + num + ".jpg";
             }
             else if (display == time.Past)
             {
                 int num = 14;
                 return "\\amber " + num + ".jpg";
             }
             break;
         case 6:
             if (display == time.Future)
             {
                 int num = 15;
                 return "\\red " + num + ".jpg";
             }
             else if (display == time.Present)
             {
                 int num = 15;
                 return "\\green " + num + ".jpg";
             }
             else if (display == time.Past)
             {
                 int num = 15;
                 return "\\amber " + num + ".jpg";
             }
             break;
         case 7:
             if (display == time.Future)
             {
                 int num = 16;
                 return "\\red " + num + ".jpg";
             }
             else if (display == time.Present)
             {
                 int num = 16;
                 return "\\green " + num + ".jpg";
             }
             else if (display == time.Past)
             {
                 int num = 16;
                 return "\\amber " + num + ".jpg";
             }
             break;
         case 8:
             if (display == time.Future)
             {
                 int num = 17;
                 return "\\red " + num + ".jpg";
             }
             else if (display == time.Present)
             {
                 int num = 17;
                 return "\\green " + num + ".jpg";
             }
             else if (display == time.Past)
             {
                 int num = 17;
                 return "\\amber " + num + ".jpg";
             }
             break;
         case 9:
             if (display == time.Future)
             {
                 int num = 18;
                 return "\\red " + num + ".jpg";
             }
             else if (display == time.Present)
             {
                 int num = 18;
                 return "\\green " + num + ".jpg";
             }
             else if (display == time.Past)
             {
                 int num = 18;
                 return "\\amber " + num + ".jpg";
             }
             break;
         case 10:
             if (display == time.Future)
             {
                 int num = 19;
                 return "\\red " + num + ".jpg";
             }
             else if (display == time.Present)
             {
                 int num = 19;
                 return "\\green " + num + ".jpg";
             }
             else if (display == time.Past)
             {
                 int num = 19;
                 return "\\amber " + num + ".jpg";
             }
             break;
         case 11:
             if (display == time.Future)
             {
                 int num = 20;
                 return "\\red " + num + ".jpg";
             }
             else if (display == time.Present)
             {
                 int num = 20;
                 return "\\green " + num + ".jpg";
             }
             else if (display == time.Past)
             {
                 int num = 20;
                 return "\\amber " + num + ".jpg";
             }
             break;
         case 12:
             if (display == time.Future)
             {
                 int num = 21;
                 return "\\red " + num + ".jpg";
             }
             else if (display == time.Present)
             {
                 int num = 21;
                 return "\\green " + num + ".jpg";
             }
             else if (display == time.Past)
             {
                 int num = 21;
                 return "\\amber " + num + ".jpg";
             }
             break;
     }
     return "nothing";
 }
 string displaymunber(int number1, time display)
 {
     switch (number1)
     {
         case 0:
             if (display == time.Future)
             {
                 int num = 0;
                 return "\\red " + num + ".jpg";
             }
             else if (display == time.Present)
             {
                 int num = 0;
                 return "\\green " + num + ".jpg";
             }
             else if (display == time.Past)
             {
                 int num = 0;
                 return "\\amber " + num + ".jpg";
             }
             break;
         case 1:
             if (display == time.Future)
             {
                 int num = 1;
                 return "\\red " + num + ".jpg";
             }
             else if (display == time.Present)
             {
                 int num = 1;
                 return "\\green " + num + ".jpg";
             }
             else if (display == time.Past)
             {
                 int num = 1;
                 return "\\amber " + num + ".jpg";
             }
             break;
         case 2:
             if (display == time.Future)
             {
                 int num = 2;
                 return "\\red " + num + ".jpg";
             }
             else if (display == time.Present)
             {
                 int num = 2;
                 return "\\green " + num + ".jpg";
             }
             else if (display == time.Past)
             {
                 int num = 2;
                 return "\\amber " + num + ".jpg";
             }
             break;
         case 3:
             if (display == time.Future)
             {
                 int num = 3;
                 return "\\red " + num + ".jpg";
             }
             else if (display == time.Present)
             {
                 int num = 3;
                 return "\\green " + num + ".jpg";
             }
             else if (display == time.Past)
             {
                 int num = 3;
                 return "\\amber " + num + ".jpg";
             }
             break;
         case 4:
             if (display == time.Future)
             {
                 int num = 4;
                 return "\\red " + num + ".jpg";
             }
             else if (display == time.Present)
             {
                 int num = 4;
                 return "\\green " + num + ".jpg";
             }
             else if (display == time.Past)
             {
                 int num = 4;
                 return "\\amber " + num + ".jpg";
             }
             break;
         case 5:
             if (display == time.Future)
             {
                 int num = 5;
                 return "\\red " + num + ".jpg";
             }
             else if (display == time.Present)
             {
                 int num = 5;
                 return "\\green " + num + ".jpg";
             }
             else if (display == time.Past)
             {
                 int num = 5;
                 return "\\amber " + num + ".jpg";
             }
             break;
         case 6:
             if (display == time.Future)
             {
                 int num = 6;
                 return "\\red " + num + ".jpg";
             }
             else if (display == time.Present)
             {
                 int num = 6;
                 return "\\green " + num + ".jpg";
             }
             else if (display == time.Past)
             {
                 int num = 6;
                 return "\\amber " + num + ".jpg";
             }
             break;
         case 7:
             if (display == time.Future)
             {
                 int num = 7;
                 return "\\red " + num + ".jpg";
             }
             else if (display == time.Present)
             {
                 int num = 7;
                 return "\\green " + num + ".jpg";
             }
             else if (display == time.Past)
             {
                 int num = 7;
                 return "\\amber " + num + ".jpg";
             }
             break;
         case 8:
             if (display == time.Future)
             {
                 int num = 8;
                 return "\\red " + num + ".jpg";
             }
             else if (display == time.Present)
             {
                 int num = 8;
                 return "\\green " + num + ".jpg";
             }
             else if (display == time.Past)
             {
                 int num = 8;
                 return "\\amber " + num + ".jpg";
             }
             break;
         case 9:
             if (display == time.Future)
             {
                 int num = 9;
                 return "\\red " + num + ".jpg";
             }
             else if (display == time.Present)
             {
                 int num = 9;
                 return "\\green " + num + ".jpg";
             }
             else if (display == time.Past)
             {
                 int num = 9;
                 return "\\amber " + num + ".jpg";
             }
             break;
     }
     return "nothing";
 }
Exemplo n.º 21
0
 static extern bool SetSystemTime(ref time newTime);
Exemplo n.º 22
-30
 // supported operations
 private static time Add(time date, timedelta delta) {
     return new time(date._timeSpan.Add(delta.TimeSpanWithDaysAndSeconds), delta._microseconds + date._lostMicroseconds, date._tz);
 }