public partial class Form1 : Form { private void button1_Click(object sender, EventArgs e) { switch (new Random().Next(3)) { case 0: label1.Text = "1"; pictureBox1.Image = WindowsFormsApplication1.Properties.Resources._1; break; case 1: label1.Text = "2"; pictureBox1.Image = WindowsFormsApplication1.Properties.Resources._2; break; case 2: label1.Text = "3"; pictureBox1.Image = WindowsFormsApplication1.Properties.Resources._3; break; } } }
using UnityEngine;using System.Collections;using UnityEngine.UI;using System;public class t : MonoBehaviour { public Text tg; public Text tt; TimeSpan w ; public void Start() { w = new TimeSpan (0, 2, 1); Run (); } // Use this for initialization public void Stop() { CancelInvoke (); } public void Run() { w = w.Subtract (new TimeSpan (0, 0, 1)); tg.text = w.Minutes + ":" + w.Seconds; Invoke("Run",1); } // Update is called once per frame void Update () { tt.text = DateTime.Now.ToString ("hh/MM/ss"); }}