Esempio n. 1
0
        static void Main(string[] args)
        {
            Lesson4 test = new Lesson4();

            test.SimpleOptionalNamedArgument("hello world!");
            test.SimpleOptionalNamedArgument(arg1: "", arg3: 10);
            test.SimpleOptionalNamedArgument("this works too!", "only arg 2 set.");
            test.SimpleOptionalNamedArgument("wow this is index, but 3rd argument is named.", arg3: 25);
        }
Esempio n. 2
0
 static int Eat(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 0);
         Lesson4.Eat();
         return(0);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
Esempio n. 3
0
 static int Move(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 1);
         Lesson4 obj = (Lesson4)ToLua.CheckObject <Lesson4>(L, 1);
         obj.Move();
         return(0);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
    //GameObject.FindGameObjectWithTag("Pickup").SetActive(false);


    void OnGUI()
    {
        GUI.Label(new Rect(10, 10, 200, 50), "Lessons collected: " + pickCount.ToString() + " /5");
        if (Lesson1.show)
        {
            Lesson1.lesson1_text(imgTexture);
        }
        if (Lesson1.plan)
        {
            Lesson1.LessonOnePlan(eighth, quarter, half, dotted_half, whole);
        }

        if (Lesson2.lesson2_show)
        {
            Lesson2.lesson2_text(imgTexture2);
        }

        if (Lesson2.lesson2_plan)
        {
            Lesson2.LessonTwoPlan(staff, treble, bass);
        }

        if (Lesson3.lesson3_show)
        {
            Lesson3.lesson3_text(imgTexture3);
        }

        if (Lesson3.lesson3_plan)
        {
            Lesson3.LessonThreePlan(A, B, C, D, E, F, G);
        }
        if (Lesson4.lesson4_show)
        {
            Lesson4.lesson4_text(imgTexture4);
        }

        if (Lesson4.lesson4_plan)
        {
            Lesson4.LessonFourPlan(clefA, clefB, clefC, clefD, clefE, clefF, clefG, clefMC);
        }
        if (Lesson5.lesson5_show)
        {
            Lesson5.lesson5_text(imgTexture5);
        }

        if (Lesson5.lesson5_plan)
        {
            Lesson5.LessonFivePlan(isecond, ithird, ifourth, ififth, isixth, iseventh, ioctave);
        }
    }
Esempio n. 5
0
 static int Speak(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 2);
         Lesson4 obj  = (Lesson4)ToLua.CheckObject <Lesson4>(L, 1);
         string  arg0 = ToLua.CheckString(L, 2);
         obj.Speak(arg0);
         return(0);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
Esempio n. 6
0
    static int get_name(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            Lesson4 obj = (Lesson4)o;
            string  ret = obj.name;
            LuaDLL.lua_pushstring(L, ret);
            return(1);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o, "attempt to index name on a nil value"));
        }
    }
Esempio n. 7
0
    static int set_name(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            Lesson4 obj  = (Lesson4)o;
            string  arg0 = ToLua.CheckString(L, 2);
            obj.name = arg0;
            return(0);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o, "attempt to index name on a nil value"));
        }
    }
        public void CreateCountingActions_ReturnListOfActions_EmptySet()
        {
            List <Action> actions = Lesson4.CreateCountingActions();

            actions[0]();
            Assert.AreEqual(Lesson4.outerActionCounter, 0);
            Assert.AreEqual(Lesson4.innerActionCounter, 0);
            actions[0]();
            Assert.AreEqual(Lesson4.outerActionCounter, 1);
            Assert.AreEqual(Lesson4.innerActionCounter, 1);
            actions[1]();
            Assert.AreEqual(Lesson4.outerActionCounter, 2);
            Assert.AreEqual(Lesson4.innerActionCounter, 0);
            actions[1]();
            Assert.AreEqual(Lesson4.outerActionCounter, 3);
            Assert.AreEqual(Lesson4.innerActionCounter, 1);
        }
        public void SimpleOptionalNamedArgument_TestAllDifferentWays_ThisMakesOptionialFlexible()
        {
            Lesson4 test      = new Lesson4();
            bool    didItFail = false;

            try
            {
                test.SimpleOptionalNamedArgument("hello world!");
                test.SimpleOptionalNamedArgument(arg1: "", arg3: 10);
                test.SimpleOptionalNamedArgument("this works too!", "only arg 2 set.");
                test.SimpleOptionalNamedArgument("wow this is index, but 3rd argument is named.", arg3: 25);
                didItFail = false;
            }
            finally
            {
                Assert.IsFalse(didItFail);
            }
        }
Esempio n. 10
0
    static int _CreateLesson4(IntPtr L)
    {
        try
        {
            int count = LuaDLL.lua_gettop(L);

            if (count == 0)
            {
                Lesson4 obj = new Lesson4();
                ToLua.PushObject(L, obj);
                return(1);
            }
            else
            {
                return(LuaDLL.luaL_throw(L, "invalid arguments to ctor method: Lesson4.New"));
            }
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e));
        }
    }
 void OnTriggerEnter(Collider other)
 {
     if (other.CompareTag("Pickup"))
     {
         other.gameObject.SetActive(false);
         pickCount += 1;
         PlayerMovement.MovementBool();
         Lesson1.showInventory();
     }
     else if (other.CompareTag("Pickup2"))
     {
         other.gameObject.SetActive(false);
         pickCount += 1;
         PlayerMovement.MovementBool();
         Lesson2.showInventory();
     }
     if (other.CompareTag("Pickup3"))
     {
         other.gameObject.SetActive(false);
         pickCount += 1;
         PlayerMovement.MovementBool();
         Lesson3.showInventory();
     }
     if (other.CompareTag("Pickup4"))
     {
         other.gameObject.SetActive(false);
         pickCount += 1;
         PlayerMovement.MovementBool();
         Lesson4.showInventory();
     }
     if (other.CompareTag("Pickup5"))
     {
         other.gameObject.SetActive(false);
         pickCount += 1;
         PlayerMovement.MovementBool();
         Lesson5.showInventory();
     }
 }
Esempio n. 12
0
 public static void Move(this Lesson4 obj)
 {
     Debug.Log(obj.name + "移动");
 }