Пример #1
0
        public void AssignmentMustWorkForRec15()
        {
            var t   = _.t(new B0(), new B1(), new B2(), new B3(), new B4(), new B5(), new B6(), new B7(), new B8(), new B9(), new B10(), new B11(), new B12(), new B13(), new B14());
            A0  a0  = t._1;
            A1  a1  = t._2;
            A2  a2  = t._3;
            A3  a3  = t._4;
            A4  a4  = t._5;
            A5  a5  = t._6;
            A6  a6  = t._7;
            A7  a7  = t._8;
            A8  a8  = t._9;
            A9  a9  = t._10;
            A10 a10 = t._11;
            A11 a11 = t._12;
            A12 a12 = t._13;
            A13 a13 = t._14;
            A14 a14 = t._15;

            Assert.NotNull(a0);
            Assert.NotNull(a1);
            Assert.NotNull(a2);
            Assert.NotNull(a3);
            Assert.NotNull(a4);
            Assert.NotNull(a5);
            Assert.NotNull(a6);
            Assert.NotNull(a7);
            Assert.NotNull(a8);
            Assert.NotNull(a9);
            Assert.NotNull(a10);
            Assert.NotNull(a11);
            Assert.NotNull(a12);
            Assert.NotNull(a13);
            Assert.NotNull(a14);
        }
Пример #2
0
    public void setRespFalse()
    {
        A1.SetActive(false);
        A2.SetActive(false);
        A3.SetActive(false);
        A4.SetActive(false);
        A5.SetActive(false);
        A6.SetActive(false);
        A7.SetActive(false);

        B1.SetActive(false);
        B2.SetActive(false);
        B3.SetActive(false);
        B4.SetActive(false);
        B5.SetActive(false);
        B6.SetActive(false);
        B7.SetActive(false);

        C1.SetActive(false);
        C2.SetActive(false);
        C3.SetActive(false);
        C4.SetActive(false);
        C5.SetActive(false);
        C6.SetActive(false);
        C7.SetActive(false);
    }
Пример #3
0
        private static int K3MStep(int[,] map)
        {
            int pixelsThinned            = 0,
                mapWidth                 = map.GetLength(0),
                mapHeight                = map.GetLength(1);
            List <(int x, int y)> border = new List <(int x, int y)>();

            for (int x = 0; x < mapWidth; x++)
            {
                for (int y = 0; y < mapHeight; y++)
                {
                    if (A0.Contains(PixelWeight(map, x, y)))
                    {
                        border.Add((x, y));
                    }
                }
            }
            foreach (var(x, y) in border)
            {
                if (map[x, y] != 0 && A1.Contains(PixelWeight(map, x, y)))
                {
                    map[x, y] = 0;
                    pixelsThinned++;
                }
            }
            foreach (var(x, y) in border)
            {
                if (map[x, y] != 0 && A2.Contains(PixelWeight(map, x, y)))
                {
                    map[x, y] = 0;
                    pixelsThinned++;
                }
            }
            foreach (var(x, y) in border)
            {
                if (map[x, y] != 0 && A3.Contains(PixelWeight(map, x, y)))
                {
                    map[x, y] = 0;
                    pixelsThinned++;
                }
            }
            foreach (var(x, y) in border)
            {
                if (map[x, y] != 0 && A4.Contains(PixelWeight(map, x, y)))
                {
                    map[x, y] = 0;
                    pixelsThinned++;
                }
            }
            foreach (var(x, y) in border)
            {
                if (map[x, y] != 0 && A5.Contains(PixelWeight(map, x, y)))
                {
                    map[x, y] = 0;
                    pixelsThinned++;
                }
            }

            return(pixelsThinned);
        }
Пример #4
0
	public static int foo () {
		A5 a5;

		/* Prevent a5 from being optimized away */
		a5 = new A5 ();
		a5.a1.a1.a1.a1.a1 = 5;

		return foo () + 1;
	}
Пример #5
0
    public static int foo()
    {
        A5 a5;

        /* Prevent a5 from being optimized away */
        a5 = new A5();
        a5.a1.a1.a1.a1.a1 = 5;

        return(foo() + 1);
    }
Пример #6
0
        public void Test_Nullable()
        {
            A5 a = Mapper.Map <B5, A5>(new B5());

            Assert.AreEqual(10, a.fld1.Value);
            Assert.IsNull(a.fld2);
            Assert.AreEqual(A5.En.value2, a.fld3.Value);
            Assert.AreEqual(A5.En.value3, a.fld4);
            Assert.AreEqual(13, a.fld5.Value);
            Assert.AreEqual(11, a.fld6.Value);
        }
Пример #7
0
        public void TestOrderTransitiveRunBefore()
        {
            var a = new A5();
            var b = new B5();
            var c = new C5();
            var s = new IBuildStep[] { b, a, c };

            var sorted = Builder.SortSteps(s);

            Assert.That(sorted, Is.EqualTo(new IBuildStep[] { a, b, c }));
        }
Пример #8
0
        public void Test_Nullable()
        {
            A5 a = Context.objMan.GetMapper <B5, A5>().Map(new B5());

            Assert.AreEqual(10, a.fld1.Value);
            Assert.IsNull(a.fld2);
            Assert.AreEqual(A5.En.value2, a.fld3.Value);
            Assert.AreEqual(A5.En.value3, a.fld4);
            Assert.AreEqual(13, a.fld5.Value);
            Assert.AreEqual(11, a.fld6.Value);
        }
Пример #9
0
        static void Main(string[] args)
        {
            bool bien = false;                // variable para comprobar que la cadena es binaria
            // semilla enuciado : 1001000100011010001010110011110001001101010111100110111100001111
            string mensaje;
            string semilla = "1001000100011010001010110011110001001101010111100110111100001111";                      // semilla del enunciado

            Console.WriteLine("Se ha establecido la siguiente semilla para crear la secuencia cifrante: " + semilla); // mostramos la semilla

            BitArray sem_bit = new BitArray(1);                                                                       // creamos un array de bits que representan a la semilla

            sem_bit = convert_to_bool(sem_bit, semilla, 64);                                                          // dentro de el guardamos la cadena semilla convertida a Bitarray


            do                                                       // pedimos el mensaje, y nos aseguramos de que es binario

            {
                Console.WriteLine("Introduzca el mensaje a cifrar(binario): ");
                mensaje = Console.ReadLine();
                bien    = check_binary(mensaje);
            }while(bien == false);

            BitArray message = new BitArray(1);                             // creamos una variable BitArray donde se guardara el mensaje

            message = convert_to_bool(message, mensaje, mensaje.Length);    // lo convertimos en bitarray y lo guardamos

            A5 algoritmo = new A5(sem_bit, message);                        // creamos el objeto A5 que se encargara de crear todo

            Console.WriteLine("La cadena a cifrar es: ");                   // mostramos el mensaje a cifrar
            show_chipher(message);
            Console.WriteLine("");

            algoritmo.crear_cadena_cifrante();                              // llamamos a crear la cadena cifrante en base a la semilla
            algoritmo.cifrar();                                             // una vez creada la cadena cifrante ciframos el mensaje 1
            Console.WriteLine("");

            BitArray cifrado = algoritmo.get_cript();                       // obtenemos el mensaje cifrado y lo mostramos

            show_chipher(cifrado);
            Console.WriteLine("");

            algoritmo.descifrar();
            Console.WriteLine("La Cadena a descifrar es : ");
            show_chipher(cifrado);
            Console.WriteLine("");

            show_chipher(algoritmo.get_S());
            Console.WriteLine("");

            BitArray descifrado = algoritmo.get_decrypt();

            show_chipher(descifrado);
            Console.WriteLine("");
        }
Пример #10
0
        public void AssignmentMustWorkForRec23()
        {
            var t   = _.t(new B0(), new B1(), new B2(), new B3(), new B4(), new B5(), new B6(), new B7(), new B8(), new B9(), new B10(), new B11(), new B12(), new B13(), new B14(), new B15(), new B16(), new B17(), new B18(), new B19(), new B20(), new B21(), new B22());
            A0  a0  = t._1;
            A1  a1  = t._2;
            A2  a2  = t._3;
            A3  a3  = t._4;
            A4  a4  = t._5;
            A5  a5  = t._6;
            A6  a6  = t._7;
            A7  a7  = t._8;
            A8  a8  = t._9;
            A9  a9  = t._10;
            A10 a10 = t._11;
            A11 a11 = t._12;
            A12 a12 = t._13;
            A13 a13 = t._14;
            A14 a14 = t._15;
            A15 a15 = t._16;
            A16 a16 = t._17;
            A17 a17 = t._18;
            A18 a18 = t._19;
            A19 a19 = t._20;
            A20 a20 = t._21;
            A21 a21 = t._22;
            A22 a22 = t._23;

            Assert.NotNull(a0);
            Assert.NotNull(a1);
            Assert.NotNull(a2);
            Assert.NotNull(a3);
            Assert.NotNull(a4);
            Assert.NotNull(a5);
            Assert.NotNull(a6);
            Assert.NotNull(a7);
            Assert.NotNull(a8);
            Assert.NotNull(a9);
            Assert.NotNull(a10);
            Assert.NotNull(a11);
            Assert.NotNull(a12);
            Assert.NotNull(a13);
            Assert.NotNull(a14);
            Assert.NotNull(a15);
            Assert.NotNull(a16);
            Assert.NotNull(a17);
            Assert.NotNull(a18);
            Assert.NotNull(a19);
            Assert.NotNull(a20);
            Assert.NotNull(a21);
            Assert.NotNull(a22);
        }
Пример #11
0
 static void Main()
 {
     A1.Foo();
     A2.Foo();
     A3.Foo();
     A4.Foo();
     A5.Foo();
     A6.Foo();
     A7.Foo();
     A8.Foo();
     A9.Foo();
     A10.Foo();
     Console.WriteLine("<%END%>");
 }
Пример #12
0
        public void AssignmentMustWorkForRec6()
        {
            var t  = _.t(new B0(), new B1(), new B2(), new B3(), new B4(), new B5());
            A0  a0 = t._1;
            A1  a1 = t._2;
            A2  a2 = t._3;
            A3  a3 = t._4;
            A4  a4 = t._5;
            A5  a5 = t._6;

            Assert.NotNull(a0);
            Assert.NotNull(a1);
            Assert.NotNull(a2);
            Assert.NotNull(a3);
            Assert.NotNull(a4);
            Assert.NotNull(a5);
        }
Пример #13
0
        public void SendPacket()
        {
            int checksum = 0;

            if (PacketNum++ > 999)
            {
                PacketNum = 0;
            }

            //get all the data in string form
            String num    = PacketNum.ToString("D3");
            String A0val  = A0.ReadRaw().ToString("D4");
            String A1val  = A1.ReadRaw().ToString("D4");
            String A2val  = A2.ReadRaw().ToString("D4");
            String A3val  = A3.ReadRaw().ToString("D4");
            String A4val  = A4.ReadRaw().ToString("D4");
            String A5val  = A5.ReadRaw().ToString("D4");
            char   D0val  = D0.Read() ? '1' : '0';
            char   D1val  = D1.Read() ? '1' : '0';
            char   D2val  = D2.Read() ? '1' : '0';
            char   D3val  = D3.Read() ? '1' : '0';
            char   D4val  = D4.Read() ? '1' : '0';
            char   D5val  = D5.Read() ? '1' : '0';
            char   D6val  = D6.Read() ? '1' : '0';
            char   D7val  = D7.Read() ? '1' : '0';
            char   Btnval = Btn.Read() ? '1' : '0';

            //concat the data
            String packet = num + A0val + A1val + A2val + A3val + A4val + A5val + Btnval + D0val + D1val + D2val + D3val + D4val + D5val + D6val + D7val;

            //compute checksum
            foreach (char digit in packet)
            {
                checksum += (digit);
            }
            checksum %= 1000;

            //append checksum and protocol frame stuff
            packet = "###" + packet + checksum + "\r\n";

            //convert to byte array for sending
            byte[] bytepacket = System.Text.Encoding.UTF8.GetBytes(packet);

            //send the packet
            _serial.Write(bytepacket, 0, bytepacket.Length);
        }
Пример #14
0
 public static void Foo()
 {
     if (foo_called)
     {
         return;
     }
     foo_called = true;
     Console.WriteLine("A3.Foo");
     X.N++;
     A1.Foo();
     A2.Foo();
     A4.Foo();
     A5.Foo();
     A6.Foo();
     A7.Foo();
     A8.Foo();
     A9.Foo();
     A10.Foo();
 }
Пример #15
0
        private void B2_Click(object sender, EventArgs e)
        {
            Client = new TcpClient();
            IPEndPoint ip_end = new IPEndPoint(IPAddress.Parse(A3.Text), int.Parse(A4.Text));

            try
            {
                Client.Connect(ip_end);
                if (Client.Connected)
                {
                    A5.AppendText("เชื่อมต่อเเล้ว \n");
                    Stw           = new StreamWriter(Client.GetStream());
                    str           = new StreamReader(Client.GetStream());
                    Stw.AutoFlush = true;
                    backgroundWorker1.RunWorkerAsync();
                    backgroundWorker2.WorkerSupportsCancellation = true;
                }
            }catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Пример #16
0
        public void AssignmentMustWorkForRec9()
        {
            var t  = _.t(new B0(), new B1(), new B2(), new B3(), new B4(), new B5(), new B6(), new B7(), new B8());
            A0  a0 = t._1;
            A1  a1 = t._2;
            A2  a2 = t._3;
            A3  a3 = t._4;
            A4  a4 = t._5;
            A5  a5 = t._6;
            A6  a6 = t._7;
            A7  a7 = t._8;
            A8  a8 = t._9;

            Assert.NotNull(a0);
            Assert.NotNull(a1);
            Assert.NotNull(a2);
            Assert.NotNull(a3);
            Assert.NotNull(a4);
            Assert.NotNull(a5);
            Assert.NotNull(a6);
            Assert.NotNull(a7);
            Assert.NotNull(a8);
        }
Пример #17
0
        static void Main(string[] args)
        {
            //A1就是類別名稱,Happy就是類別的方法
            //就像是我們裝好電腦之後,就可以做開機的動作,new就是裝好這台電腦
            A1 _PC = new A1();
            //然後我們就是做開機動作,
            string _Happy=_PC.Happy();

            //-----------------------------------------------

            A2 _PC2 = new A2("龍魂GE60"); //可以在裝好電腦時,為他取名,這樣大家才會知道是哪台,當然建構式可以多個

            string _strPC2 = _PC2.Happy();

            //A3 方法重載
            A2 _PC3 = new A2();
            string _strPC3 = _PC3.Happy("自爽");

            //--------------------------------------------------

            //A4 屬性與修飾子
            A4 _PC4 = new A4();
            _PC4.ReStartNum = 5;
            Console.WriteLine(_PC4.ReStart());

            //A5 封裝,剛才都是在使用封裝的
            //假設現在A5是NB,他也一樣會有ReStart
            A5 _NB = new A5();
            _NB.ReStartNum = 5;
            Console.WriteLine(_NB.ReStart());

            //A9 介面
            //抽象類別可以給初一些成員的實現,抽象類別的抽象成員可被子類別部分實現
            //介面的成員需要實現類別完全實現,一個類別只能繼承一個抽象類別,但可以實現多個介面等
            //第一類別是對物件的抽象;抽象類別是對類別的抽象;介面是對行為的抽象
            //第二如果行為跨越不同類別的物件,可使用介面;對於一些相似的類別物件,用繼承抽象類別
            //舉例 貓 狗都是動物,所以它們去繼承動物這抽象類別
            //但悟空和超人都會飛,但是悟空會變身,神話的悟空也會變身,所以此時可以用介面來完成
            //第三,抽象類別是從子類別中發現了公共的東西,泛化出父類別,然後子類別繼承父類別
            //,而介面是根本不知子類別的存在,方法如何實現還不確認,預先定義
            //例如在寫程式時候,是先寫了貓類別後,在寫出狗類別,最後發現有相同類似的,就泛化出動物類別,
            //不可能只有貓類別時候就想到動物類別
            //而介面是一同思考,定義一些項目,但不知道會有什麼動物,要如何實現,能做的就是是先定義這些比賽項目的行為介面
            //抽象類別是自底而上抽象類別的,而介面則是自頂而下設定的
            //(從狗貓衍伸出動物)(從項目延伸出不知那些動物會來參加預先定義好項目)

            A9_Interface _A9 = new A9_Interface("測試介面");

            IA9_Interface _A9_2 = new A9_Interface("測試介面2");
            Console.WriteLine(_A9.ChangeThing("第一個"));
            Console.WriteLine(_A9_2.ChangeThing("第二個"));

            //A10 泛型
            IList<Animal> arrayAnimal = new List<Animal>();
            arrayAnimal.Add(new Cat_Extend("tt"));
            arrayAnimal.Add(new Dog_Extend("tt2"));
            arrayAnimal.Add(new Cat_Extend("tt3"));
            Console.WriteLine(arrayAnimal.Count.ToString());

            //A11 泛型

            cat_deleget _cat = new cat_deleget("T");
            mouse_deleget _mo1 = new mouse_deleget("Ja");
            mouse_deleget _mo2 = new mouse_deleget("Jb");

            //表示將Mouse的Run方法透過實體化委託給CatShoutEventHandler登記到Cat的事件CatShout當中,+=是為了加進去add_CatShout的意思
            _cat.CatShout += new cat_deleget.CatShoutEventHandler(_mo1.Run);
            _cat.CatShout += new cat_deleget.CatShoutEventHandler(_mo2.Run);
            _cat.Shout();

            cat_deleget2 _cat2 = new cat_deleget2("T");
            mouse_deleget2 _mo21 = new mouse_deleget2("Ja");
            mouse_deleget2 _mo22 = new mouse_deleget2("Jb");
            _cat2.CatShout += new cat_deleget2.CatShoutEventHandler(_mo21.Run);
            _cat2.CatShout += new cat_deleget2.CatShoutEventHandler(_mo22.Run);
            _cat2.Shout();

            //A12-yieldreturn
            yieldreturn _yield = new yieldreturn();
            var _return = _yield.returnACD();
            string _strreturn = "";
            foreach (var item in _return)
            {
                _strreturn += item;
            }
            Console.WriteLine(_strreturn);

            Console.Read();
        }
Пример #18
0
        private void towerChange(Tower tower)
        {
            A1.Invoke((Action) delegate { A1.Visible = false; });
            A2.Invoke((Action) delegate { A2.Visible = false; });
            A3.Invoke((Action) delegate { A3.Visible = false; });
            A4.Invoke((Action) delegate { A4.Visible = false; });
            A5.Invoke((Action) delegate { A5.Visible = false; });
            A6.Invoke((Action) delegate { A6.Visible = false; });
            B1.Invoke((Action) delegate { B1.Visible = false; });
            B2.Invoke((Action) delegate { B2.Visible = false; });
            B3.Invoke((Action) delegate { B3.Visible = false; });
            B4.Invoke((Action) delegate { B4.Visible = false; });
            B5.Invoke((Action) delegate { B5.Visible = false; });
            B6.Invoke((Action) delegate { B6.Visible = false; });
            C1.Invoke((Action) delegate { C1.Visible = false; });
            C2.Invoke((Action) delegate { C2.Visible = false; });
            C3.Invoke((Action) delegate { C3.Visible = false; });
            C4.Invoke((Action) delegate { C4.Visible = false; });
            C5.Invoke((Action) delegate { C5.Visible = false; });
            C6.Invoke((Action) delegate { C6.Visible = false; });



            if (tower.A[0] != 0)
            {
                A1.Invoke((Action) delegate { A1.Text = (tower.A[0] + ""); });
                A1.Invoke((Action) delegate { A1.Visible = true; });
            }

            if (tower.A[1] != 0)
            {
                A2.Invoke((Action) delegate { A2.Text = (tower.A[1] + ""); });
                A2.Invoke((Action) delegate { A2.Visible = true; });
            }

            if (tower.A[2] != 0)
            {
                A3.Invoke((Action) delegate { A3.Text = (tower.A[2] + ""); });
                A3.Invoke((Action) delegate { A3.Visible = true; });
            }
            if (tower.A[3] != 0)
            {
                A4.Invoke((Action) delegate { A4.Text = (tower.A[3] + ""); });
                A4.Invoke((Action) delegate { A4.Visible = true; });
            }
            if (tower.A[4] != 0)
            {
                A5.Invoke((Action) delegate { A5.Text = (tower.A[4] + ""); });
                A5.Invoke((Action) delegate { A5.Visible = true; });
            }
            if (tower.A[5] != 0)
            {
                A6.Invoke((Action) delegate { A6.Text = (tower.A[5] + ""); });
                A6.Invoke((Action) delegate { A6.Visible = true; });
            }


            if (tower.B[0] != 0)
            {
                B1.Invoke((Action) delegate { B1.Text = (tower.B[0] + ""); });
                B1.Invoke((Action) delegate { B1.Visible = true; });
            }

            if (tower.B[1] != 0)
            {
                B2.Invoke((Action) delegate { B2.Text = (tower.B[1] + ""); });
                B2.Invoke((Action) delegate { B2.Visible = true; });
            }

            if (tower.B[2] != 0)
            {
                B3.Invoke((Action) delegate { B3.Text = (tower.B[2] + ""); });
                B3.Invoke((Action) delegate { B3.Visible = true; });
            }
            if (tower.B[3] != 0)
            {
                B4.Invoke((Action) delegate { B4.Text = (tower.B[3] + ""); });
                B4.Invoke((Action) delegate { B4.Visible = true; });
            }
            if (tower.B[4] != 0)
            {
                B5.Invoke((Action) delegate { B5.Text = (tower.B[4] + ""); });
                B5.Invoke((Action) delegate { B5.Visible = true; });
            }
            if (tower.B[5] != 0)
            {
                B6.Invoke((Action) delegate { B6.Text = (tower.B[5] + ""); });
                B6.Invoke((Action) delegate { B6.Visible = true; });
            }


            if (tower.C[0] != 0)
            {
                C1.Invoke((Action) delegate { C1.Text = (tower.C[0] + ""); });
                C1.Invoke((Action) delegate { C1.Visible = true; });
            }

            if (tower.C[1] != 0)
            {
                C2.Invoke((Action) delegate { C2.Text = (tower.C[1] + ""); });
                C2.Invoke((Action) delegate { C2.Visible = true; });
            }

            if (tower.C[2] != 0)
            {
                C3.Invoke((Action) delegate { C3.Text = (tower.C[2] + ""); });
                C3.Invoke((Action) delegate { C3.Visible = true; });
            }
            if (tower.C[3] != 0)
            {
                C4.Invoke((Action) delegate { C4.Text = (tower.C[3] + ""); });
                C4.Invoke((Action) delegate { C4.Visible = true; });
            }
            if (tower.C[4] != 0)
            {
                C5.Invoke((Action) delegate { C5.Text = (tower.C[4] + ""); });
                C5.Invoke((Action) delegate { C5.Visible = true; });
            }
            if (tower.C[5] != 0)
            {
                C6.Invoke((Action) delegate { C6.Text = (tower.C[5] + ""); });
                C6.Invoke((Action) delegate { C6.Visible = true; });
            }
        }
Пример #19
0
    // Use this for initialization
    void Start()
    {
        PlayerIcon.GetComponent <SpriteRenderer>().enabled = true;
        A1.GetComponent <SpriteRenderer>().enabled         = false;
        A2.GetComponent <SpriteRenderer>().enabled         = false;
        A3.GetComponent <SpriteRenderer>().enabled         = false;
        A4.GetComponent <SpriteRenderer>().enabled         = false;
        A5.GetComponent <SpriteRenderer>().enabled         = false;
        A6.GetComponent <SpriteRenderer>().enabled         = false;
        A7.GetComponent <SpriteRenderer>().enabled         = false;
        A8.GetComponent <SpriteRenderer>().enabled         = false;
        A9.GetComponent <SpriteRenderer>().enabled         = false;
        A10.GetComponent <SpriteRenderer>().enabled        = false;
        A11.GetComponent <SpriteRenderer>().enabled        = false;
        B1.GetComponent <SpriteRenderer>().enabled         = false;
        B2.GetComponent <SpriteRenderer>().enabled         = false;
        B3.GetComponent <SpriteRenderer>().enabled         = false;
        B4.GetComponent <SpriteRenderer>().enabled         = false;
        B5.GetComponent <SpriteRenderer>().enabled         = false;
        B6.GetComponent <SpriteRenderer>().enabled         = false;
        B7.GetComponent <SpriteRenderer>().enabled         = false;
        B8.GetComponent <SpriteRenderer>().enabled         = false;
        B9.GetComponent <SpriteRenderer>().enabled         = false;
        B10.GetComponent <SpriteRenderer>().enabled        = false;
        B11.GetComponent <SpriteRenderer>().enabled        = false;
        C1.GetComponent <SpriteRenderer>().enabled         = false;
        C2.GetComponent <SpriteRenderer>().enabled         = false;
        C3.GetComponent <SpriteRenderer>().enabled         = false;
        C4.GetComponent <SpriteRenderer>().enabled         = false;
        C5.GetComponent <SpriteRenderer>().enabled         = false;
        C6.GetComponent <SpriteRenderer>().enabled         = false;
        C7.GetComponent <SpriteRenderer>().enabled         = false;
        C8.GetComponent <SpriteRenderer>().enabled         = false;
        C9.GetComponent <SpriteRenderer>().enabled         = false;
        C10.GetComponent <SpriteRenderer>().enabled        = false;
        C11.GetComponent <SpriteRenderer>().enabled        = false;
        D1.GetComponent <SpriteRenderer>().enabled         = false;
        D2.GetComponent <SpriteRenderer>().enabled         = false;
        D3.GetComponent <SpriteRenderer>().enabled         = false;
        D4.GetComponent <SpriteRenderer>().enabled         = false;
        D5.GetComponent <SpriteRenderer>().enabled         = false;
        D6.GetComponent <SpriteRenderer>().enabled         = false;
        D7.GetComponent <SpriteRenderer>().enabled         = false;
        D8.GetComponent <SpriteRenderer>().enabled         = false;
        D9.GetComponent <SpriteRenderer>().enabled         = false;
        D10.GetComponent <SpriteRenderer>().enabled        = false;
        D11.GetComponent <SpriteRenderer>().enabled        = false;
        E1.GetComponent <SpriteRenderer>().enabled         = false;
        E2.GetComponent <SpriteRenderer>().enabled         = false;
        E3.GetComponent <SpriteRenderer>().enabled         = false;
        E4.GetComponent <SpriteRenderer>().enabled         = false;
        E5.GetComponent <SpriteRenderer>().enabled         = false;
        E6.GetComponent <SpriteRenderer>().enabled         = false;
        E7.GetComponent <SpriteRenderer>().enabled         = false;
        E8.GetComponent <SpriteRenderer>().enabled         = false;
        E9.GetComponent <SpriteRenderer>().enabled         = false;
        E10.GetComponent <SpriteRenderer>().enabled        = false;
        E11.GetComponent <SpriteRenderer>().enabled        = false;
        F1.GetComponent <SpriteRenderer>().enabled         = false;
        F2.GetComponent <SpriteRenderer>().enabled         = false;
        F3.GetComponent <SpriteRenderer>().enabled         = false;
        F4.GetComponent <SpriteRenderer>().enabled         = false;
        F5.GetComponent <SpriteRenderer>().enabled         = false;
        F6.GetComponent <SpriteRenderer>().enabled         = false;
        F7.GetComponent <SpriteRenderer>().enabled         = false;
        F8.GetComponent <SpriteRenderer>().enabled         = false;
        F9.GetComponent <SpriteRenderer>().enabled         = false;
        F10.GetComponent <SpriteRenderer>().enabled        = false;
        F11.GetComponent <SpriteRenderer>().enabled        = false;
        G1.GetComponent <SpriteRenderer>().enabled         = false;
        G2.GetComponent <SpriteRenderer>().enabled         = false;
        G3.GetComponent <SpriteRenderer>().enabled         = false;
        G4.GetComponent <SpriteRenderer>().enabled         = false;
        G5.GetComponent <SpriteRenderer>().enabled         = false;
        G6.GetComponent <SpriteRenderer>().enabled         = false;
        G7.GetComponent <SpriteRenderer>().enabled         = false;
        G8.GetComponent <SpriteRenderer>().enabled         = false;
        G9.GetComponent <SpriteRenderer>().enabled         = false;
        G10.GetComponent <SpriteRenderer>().enabled        = false;
        G11.GetComponent <SpriteRenderer>().enabled        = false;
        H1.GetComponent <SpriteRenderer>().enabled         = false;
        H2.GetComponent <SpriteRenderer>().enabled         = false;
        H3.GetComponent <SpriteRenderer>().enabled         = false;
        H4.GetComponent <SpriteRenderer>().enabled         = false;
        H5.GetComponent <SpriteRenderer>().enabled         = false;
        H6.GetComponent <SpriteRenderer>().enabled         = false;
        H7.GetComponent <SpriteRenderer>().enabled         = false;
        H8.GetComponent <SpriteRenderer>().enabled         = false;
        H9.GetComponent <SpriteRenderer>().enabled         = false;
        H10.GetComponent <SpriteRenderer>().enabled        = false;
        H11.GetComponent <SpriteRenderer>().enabled        = false;
        I1.GetComponent <SpriteRenderer>().enabled         = false;
        I2.GetComponent <SpriteRenderer>().enabled         = false;
        I3.GetComponent <SpriteRenderer>().enabled         = false;
        I4.GetComponent <SpriteRenderer>().enabled         = false;
        I5.GetComponent <SpriteRenderer>().enabled         = false;
        I6.GetComponent <SpriteRenderer>().enabled         = false;
        I7.GetComponent <SpriteRenderer>().enabled         = false;
        I8.GetComponent <SpriteRenderer>().enabled         = false;
        I9.GetComponent <SpriteRenderer>().enabled         = false;
        I10.GetComponent <SpriteRenderer>().enabled        = false;
        I11.GetComponent <SpriteRenderer>().enabled        = false;
        J1.GetComponent <SpriteRenderer>().enabled         = false;
        J2.GetComponent <SpriteRenderer>().enabled         = false;
        J3.GetComponent <SpriteRenderer>().enabled         = false;
        J4.GetComponent <SpriteRenderer>().enabled         = false;
        J5.GetComponent <SpriteRenderer>().enabled         = false;
        J6.GetComponent <SpriteRenderer>().enabled         = false;
        J7.GetComponent <SpriteRenderer>().enabled         = false;
        J8.GetComponent <SpriteRenderer>().enabled         = false;
        J9.GetComponent <SpriteRenderer>().enabled         = false;
        J10.GetComponent <SpriteRenderer>().enabled        = false;
        J11.GetComponent <SpriteRenderer>().enabled        = false;
        K1.GetComponent <SpriteRenderer>().enabled         = false;
        K2.GetComponent <SpriteRenderer>().enabled         = false;
        K3.GetComponent <SpriteRenderer>().enabled         = false;
        K4.GetComponent <SpriteRenderer>().enabled         = false;
        K5.GetComponent <SpriteRenderer>().enabled         = false;
        K6.GetComponent <SpriteRenderer>().enabled         = false;
        K7.GetComponent <SpriteRenderer>().enabled         = false;
        K8.GetComponent <SpriteRenderer>().enabled         = false;
        K9.GetComponent <SpriteRenderer>().enabled         = false;
        K10.GetComponent <SpriteRenderer>().enabled        = false;
        K11.GetComponent <SpriteRenderer>().enabled        = false;
        float ratio = Screen.width / Screen.height;

        if (ratio < 2)
        {
            int screenx = 543;
            int screeny = 653;
        }
        else
        {
            int screenx = 743;
            int screeny = 853;
        }
    }
Пример #20
0
    public static int Main()
    {
        A  a  = null;
        A2 a2 = null;
        A3 a3 = null;
        A4 a4 = null;
        A5 a5 = null;
        A6 a6 = null;

        if (-a != -5)
        {
            return(1);
        }
        if (-a2 != -3)
        {
            return(2);
        }
        if (-a3 != -1)
        {
            return(3);
        }
        if (-a4 != -7)
        {
            return(4);
        }
        if (-a5 != -8)
        {
            return(5);
        }
        if (-a6 != -2)
        {
            return(6);
        }

        if (~a != -6)
        {
            return(10);
        }
        if (~a2 != -4)
        {
            return(11);
        }
        if (~a3 != -2)
        {
            return(12);
        }
        if (~a4 != 4294967289)
        {
            return(13);
        }
        if (~a5 != -9)
        {
            return(14);
        }
        if (~a6 != -3)
        {
            return(15);
        }

        MyDecimal d = new MyDecimal();

        if (-d != -42)
        {
            return(20);
        }

        E e = E.Value;

        if (~e != (E)4294967271)
        {
            return(21);
        }

        uint dp = 0;

        dp = +dp;

        Console.WriteLine("OK");
        return(0);
    }
Пример #21
0
 public A4()
 {
     A5 = new A5();
 }
Пример #22
0
    void Update()
    {
        if (respondio && waith < 200)
        {
            waith++;
        }
        else
        {
            waith     = 0;
            respondio = false;
        }
        if (planet > 8)
        {
            planet = 1;
        }
        if (A.getAns() && !respondio)
        {
            Debug.Log("A!!!");
            Respuesta = "A";
            isItCorrect();
            respondio = true;
        }
        else if (B.getAns() && !respondio)
        {
            Debug.Log("B¡!!");
            Respuesta = "B";
            isItCorrect();
            respondio = true;
        }
        else if (C.getAns() && !respondio)
        {
            Debug.Log("C¡!!");
            Respuesta = "C";
            isItCorrect();
            respondio = true;
        }

        // preguntas Mercurio
        if (planet == Mer)
        {
            setRespFalse();
            A1.SetActive(true);
            B1.SetActive(true);
            C1.SetActive(true);

            CurrentPos = Mercurio;
            timmer     = 0;

            //saludar
            if (!Boolwait && saludar)
            {
                setAudFalse();
                AuHola.SetActive(true);
                saludar = false;
                Wait(1.2f);
            }
            else if (!Boolwait && pista != 1)
            {
                setAudFalse();
                Au1Pr.SetActive(true);

                //pista
                pista = pista * -1;
                Wait(15);
            }
            if (!Boolwait && pista == 1)
            {
                setAudFalse();
                Au1Pi.SetActive(true);
                pista = pista * -1;
                Wait(8);
            }
            //esperar
        }

        if (planet == Ven)
        {
            setRespFalse();
            A2.SetActive(true);
            B2.SetActive(true);
            C2.SetActive(true);
            CurrentPos = Venus;
            timmer     = 0;

            if (!Boolwait && pista2 != 1)
            {
                //pregunta
                pista2 = pista2 * -1;
                setAudFalse();
                Au2Pr.SetActive(true);
                Wait(12);
            }
            if (!Boolwait && pista2 == 1)
            {
                //pista
                pista2 = pista2 * -1;
                setAudFalse();
                Au2Pi.SetActive(true);
                Wait(10);
            }
        }
        if (planet == Tie)
        {
            setRespFalse();
            A3.SetActive(true);
            B3.SetActive(true);
            C3.SetActive(true);
            CurrentPos = Tierra;
            timmer     = 0;

            if (!Boolwait && pista3 != 1)
            {
                //pregunta
                pista3 = pista3 * -1;
                setAudFalse();
                Au3Pr.SetActive(true);
                Wait(12);
            }
            if (!Boolwait && pista3 == 1)
            {
                //pista
                pista3 = pista3 * -1;
                setAudFalse();
                Au3Pi.SetActive(true);
                Wait(10);
            }
        }
        if (planet == Mar)
        {
            setRespFalse();
            A4.SetActive(true);
            B4.SetActive(true);
            C4.SetActive(true);
            CurrentPos = Marte;
            timmer     = 0;

            if (!Boolwait && pista4 != 1)
            {
                //pregunta
                pista4 = pista4 * -1;
                setAudFalse();
                Au4Pr.SetActive(true);
                Wait(12);
            }
            if (!Boolwait && pista4 == 1)
            {
                //pista
                pista4 = pista4 * -1;
                setAudFalse();
                Au4Pi.SetActive(true);
                Wait(10);
            }
        }
        if (planet == Jup)
        {
            setRespFalse();
            A5.SetActive(true);
            B5.SetActive(true);
            C5.SetActive(true);
            CurrentPos = Jupiter;
            timmer     = 0;

            if (!Boolwait && pista5 != 1)
            {
                //pregunta
                pista5 = pista5 * -1;
                setAudFalse();
                Au5Pr.SetActive(true);
                Wait(12);
            }
            if (!Boolwait && pista5 == 1)
            {
                //pista
                pista5 = pista5 * -1;
                setAudFalse();
                Au5Pi.SetActive(true);
                Wait(10);
            }
        }
        if (planet == Sat)
        {
            setRespFalse();
            A6.SetActive(true);
            B6.SetActive(true);
            C6.SetActive(true);
            CurrentPos = Saturno;
            timmer     = 0;

            if (!Boolwait && pista6 != 1)
            {
                //pregunta
                pista6 = pista6 * -1;
                setAudFalse();
                Au6Pr.SetActive(true);
                Wait(12);
            }
            if (!Boolwait && pista6 == 1)
            {
                //pista
                pista6 = pista6 * -1;
                setAudFalse();
                Au6Pi.SetActive(true);
                Wait(10);
            }
        }
        if (planet == Nep)
        {
            setRespFalse();
            A7.SetActive(true);
            B7.SetActive(true);
            C7.SetActive(true);
            CurrentPos = Neptuno;
            timmer     = 0;

            if (!Boolwait && pista7 != 1)
            {
                //pregunta
                pista7 = pista7 * -1;
                setAudFalse();
                Au7Pr.SetActive(true);
                Wait(12);
            }
            if (!Boolwait && pista7 == 1)
            {
                //pista
                pista7 = pista7 * -1;
                setAudFalse();
                Au7Pi.SetActive(true);
                Wait(10);
            }
        }
        if (planet == Ura)
        {
            waitTime = waitTime + tres;
            tres     = 0;
            ganaste.SetActive(true);
            gano       = true;
            CurrentPos = Urano;
            timmer     = 0;

            if (!Boolwait && pista8 != 1)
            {
                //pregunta
                pista8 = pista8 * -1;
                setAudFalse();
                Au8Pr.SetActive(true);
                Wait(4);
            }
            if (!Boolwait && pista8 == 1)
            {
                //pista
                pista8 = pista8 * -1;
                setAudFalse();
                Au8Pi.SetActive(true);
                Wait(4);
            }
        }
        ShoulIWait();
        if (!Boolwait && gano)
        {
            SceneManager.LoadScene("Menu");
        }
        transform.localPosition = Vector3.Lerp(transform.localPosition, CurrentPos.position, 0.1f);
        transform.localRotation = Quaternion.Slerp(transform.localRotation, CurrentPos.rotation, 0.1f);
    }
Пример #23
0
 static A3()
 {
     Console.WriteLine("A3.cctor");
     X.N++;
     A5.Foo();
 }
Пример #24
0
        static void Main(string[] args)
        {
            //A1就是類別名稱,Happy就是類別的方法
            //就像是我們裝好電腦之後,就可以做開機的動作,new就是裝好這台電腦
            A1 _PC = new A1();
            //然後我們就是做開機動作,
            string _Happy = _PC.Happy();


            //-----------------------------------------------

            A2 _PC2 = new A2("龍魂GE60"); //可以在裝好電腦時,為他取名,這樣大家才會知道是哪台,當然建構式可以多個

            string _strPC2 = _PC2.Happy();

            //A3 方法重載
            A2     _PC3    = new A2();
            string _strPC3 = _PC3.Happy("自爽");

            //--------------------------------------------------

            //A4 屬性與修飾子
            A4 _PC4 = new A4();

            _PC4.ReStartNum = 5;
            Console.WriteLine(_PC4.ReStart());


            //A5 封裝,剛才都是在使用封裝的
            //假設現在A5是NB,他也一樣會有ReStart
            A5 _NB = new A5();

            _NB.ReStartNum = 5;
            Console.WriteLine(_NB.ReStart());


            //A9 介面
            //抽象類別可以給初一些成員的實現,抽象類別的抽象成員可被子類別部分實現
            //介面的成員需要實現類別完全實現,一個類別只能繼承一個抽象類別,但可以實現多個介面等
            //第一類別是對物件的抽象;抽象類別是對類別的抽象;介面是對行為的抽象
            //第二如果行為跨越不同類別的物件,可使用介面;對於一些相似的類別物件,用繼承抽象類別
            //舉例 貓 狗都是動物,所以它們去繼承動物這抽象類別
            //但悟空和超人都會飛,但是悟空會變身,神話的悟空也會變身,所以此時可以用介面來完成
            //第三,抽象類別是從子類別中發現了公共的東西,泛化出父類別,然後子類別繼承父類別
            //,而介面是根本不知子類別的存在,方法如何實現還不確認,預先定義
            //例如在寫程式時候,是先寫了貓類別後,在寫出狗類別,最後發現有相同類似的,就泛化出動物類別,
            //不可能只有貓類別時候就想到動物類別
            //而介面是一同思考,定義一些項目,但不知道會有什麼動物,要如何實現,能做的就是是先定義這些比賽項目的行為介面
            //抽象類別是自底而上抽象類別的,而介面則是自頂而下設定的
            //(從狗貓衍伸出動物)(從項目延伸出不知那些動物會來參加預先定義好項目)

            A9_Interface _A9 = new A9_Interface("測試介面");

            IA9_Interface _A9_2 = new A9_Interface("測試介面2");

            Console.WriteLine(_A9.ChangeThing("第一個"));
            Console.WriteLine(_A9_2.ChangeThing("第二個"));

            //A10 泛型
            IList <Animal> arrayAnimal = new List <Animal>();

            arrayAnimal.Add(new Cat_Extend("tt"));
            arrayAnimal.Add(new Dog_Extend("tt2"));
            arrayAnimal.Add(new Cat_Extend("tt3"));
            Console.WriteLine(arrayAnimal.Count.ToString());

            //A11 泛型

            cat_deleget   _cat = new cat_deleget("T");
            mouse_deleget _mo1 = new mouse_deleget("Ja");
            mouse_deleget _mo2 = new mouse_deleget("Jb");

            //表示將Mouse的Run方法透過實體化委託給CatShoutEventHandler登記到Cat的事件CatShout當中,+=是為了加進去add_CatShout的意思
            _cat.CatShout += new cat_deleget.CatShoutEventHandler(_mo1.Run);
            _cat.CatShout += new cat_deleget.CatShoutEventHandler(_mo2.Run);
            _cat.Shout();

            cat_deleget2   _cat2 = new cat_deleget2("T");
            mouse_deleget2 _mo21 = new mouse_deleget2("Ja");
            mouse_deleget2 _mo22 = new mouse_deleget2("Jb");

            _cat2.CatShout += new cat_deleget2.CatShoutEventHandler(_mo21.Run);
            _cat2.CatShout += new cat_deleget2.CatShoutEventHandler(_mo22.Run);
            _cat2.Shout();



            //A12-yieldreturn
            yieldreturn _yield     = new yieldreturn();
            var         _return    = _yield.returnACD();
            string      _strreturn = "";

            foreach (var item in _return)
            {
                _strreturn += item;
            }
            Console.WriteLine(_strreturn);

            Console.Read();
        }