Beispiel #1
0
 /// <summary>
 /// 开始游戏
 /// </summary>
 public void BtnStartGame()
 {
     againRect.gameObject.SetActive(true);
     Destroy(startRect.gameObject);
     againBtn.gameObject.SetActive(false);
     FunctionTeris.getInstance().BeginGame();
 }
Beispiel #2
0
 /// <summary>
 /// 返回本类的对象
 /// </summary>
 /// <returns></returns>
 public static FunctionTeris getInstance()
 {
     if (functionTeris == null)
     {
         functionTeris = new FunctionTeris();
     }
     return(functionTeris);
 }
Beispiel #3
0
 /// <summary>
 /// 再次游戏
 /// </summary>
 public void BtnAgainGame()
 {
     fTime   = 0.0f;
     iMinute = 0;
     iSecond = 0;
     againBtn.gameObject.SetActive(false);
     FunctionTeris.getInstance().BeginGame();
 }
 static int DealGameFunction(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 1);
         FunctionTeris obj = (FunctionTeris)ToLua.CheckObject <FunctionTeris>(L, 1);
         obj.DealGameFunction();
         return(0);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
 static int getInstance(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 0);
         FunctionTeris o = FunctionTeris.getInstance();
         ToLua.PushObject(L, o);
         return(1);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
 static int InitGame(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 3);
         FunctionTeris          obj  = (FunctionTeris)ToLua.CheckObject <FunctionTeris>(L, 1);
         UnityEngine.Transform  arg0 = (UnityEngine.Transform)ToLua.CheckObject <UnityEngine.Transform>(L, 2);
         UnityEngine.GameObject arg1 = (UnityEngine.GameObject)ToLua.CheckObject(L, 3, typeof(UnityEngine.GameObject));
         obj.InitGame(arg0, arg1);
         return(0);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
    static int set_isGameStop(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            FunctionTeris obj  = (FunctionTeris)o;
            bool          arg0 = LuaDLL.luaL_checkboolean(L, 2);
            obj.isGameStop = arg0;
            return(0);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o, "attempt to index isGameStop on a nil value"));
        }
    }
    static int set_iScore(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            FunctionTeris obj  = (FunctionTeris)o;
            int           arg0 = (int)LuaDLL.luaL_checknumber(L, 2);
            obj.iScore = arg0;
            return(0);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o, "attempt to index iScore on a nil value"));
        }
    }
    static int set_SmallGridBG(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            FunctionTeris obj = (FunctionTeris)o;
            SquareSprite[,] arg0 = (SquareSprite[, ])ToLua.CheckObject(L, 2, typeof(SquareSprite[, ]));
            obj.SmallGridBG      = arg0;
            return(0);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o, "attempt to index SmallGridBG on a nil value"));
        }
    }
    static int get_iScore(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            FunctionTeris obj = (FunctionTeris)o;
            int           ret = obj.iScore;
            LuaDLL.lua_pushinteger(L, ret);
            return(1);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o, "attempt to index iScore on a nil value"));
        }
    }
    static int get_isGameStop(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            FunctionTeris obj = (FunctionTeris)o;
            bool          ret = obj.isGameStop;
            LuaDLL.lua_pushboolean(L, ret);
            return(1);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o, "attempt to index isGameStop on a nil value"));
        }
    }
    static int get_SmallGridBG(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            FunctionTeris obj = (FunctionTeris)o;
            SquareSprite[,] ret = obj.SmallGridBG;
            ToLua.Push(L, ret);
            return(1);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o, "attempt to index SmallGridBG on a nil value"));
        }
    }
    static int _CreateFunctionTeris(IntPtr L)
    {
        try
        {
            int count = LuaDLL.lua_gettop(L);

            if (count == 0)
            {
                FunctionTeris obj = new FunctionTeris();
                ToLua.PushObject(L, obj);
                return(1);
            }
            else
            {
                return(LuaDLL.luaL_throw(L, "invalid arguments to ctor method: FunctionTeris.New"));
            }
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e));
        }
    }
Beispiel #14
0
 // Update is called once per frame
 void Update()
 {
     FunctionTeris.getInstance().DealGameFunction();
     if (FunctionTeris.getInstance().isGameStop)
     {
         if (!againBtn.gameObject.activeSelf)
         {
             againBtn.gameObject.SetActive(true);
         }
     }
     else
     {
         fTime  += Time.fixedDeltaTime;
         iSecond = (int)fTime;
         if (iSecond == 60)
         {
             iMinute++;
             iSecond = 0;
             fTime  -= 60;
         }
         socre.text = "Score: " + FunctionTeris.getInstance().iScore;
         time.text  = "Time: " + iMinute + "m " + iSecond + "s";
     }
 }
Beispiel #15
0
 // Use this for initialization
 void Start()
 {
     FunctionTeris.getInstance().InitGame(againRect, goPrefab);
 }