コード例 #1
0
    static int LoadScene(IntPtr L)
    {
        try
        {
            ToLua.CheckArgsCount(L, 2);
            FightParameter arg0      = (FightParameter)ToLua.CheckObject(L, 1, typeof(FightParameter));
            System.Action  arg1      = null;
            LuaTypes       funcType2 = LuaDLL.lua_type(L, 2);

            if (funcType2 != LuaTypes.LUA_TFUNCTION)
            {
                arg1 = (System.Action)ToLua.CheckObject(L, 2, typeof(System.Action));
            }
            else
            {
                LuaFunction func = ToLua.ToLuaFunction(L, 2);
                arg1 = DelegateFactory.CreateDelegate(typeof(System.Action), func) as System.Action;
            }

            int o = SceneChanger.LoadScene(arg0, arg1);
            LuaDLL.lua_pushinteger(L, o);
            return(1);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e));
        }
    }
コード例 #2
0
    /// <summary>
    /// TODO 切战斗类型选择场景, 测试用
    /// </summary>
    /// <returns></returns>
    public static int LoadChooseFight(Action callback = null)
    {
        FightParameter param = new FightParameter();

        param.QixiSquare = null;
        param.sceneID    = 99;
        //param.tuiguan_zhang = 1;
        //param.tuiguan_jie = 1;
        param.fightType = FightType.Tuiguan;

        param.Squares = new List <ArmySquareInfo>();
        return(LoadScene(param, callback));
    }
コード例 #3
0
    static int get_Music(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            FightParameter obj = (FightParameter)o;
            string         ret = obj.Music;
            LuaDLL.lua_pushstring(L, ret);
            return(1);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index Music on a nil value" : e.Message));
        }
    }
コード例 #4
0
    static int get_QixiSquare(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            FightParameter obj = (FightParameter)o;
            ArmySquareInfo ret = obj.QixiSquare;
            ToLua.PushObject(L, ret);
            return(1);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index QixiSquare on a nil value" : e.Message));
        }
    }
コード例 #5
0
    static int get_Squares(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            FightParameter obj = (FightParameter)o;
            System.Collections.Generic.List <ArmySquareInfo> ret = obj.Squares;
            ToLua.PushObject(L, ret);
            return(1);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index Squares on a nil value" : e.Message));
        }
    }
コード例 #6
0
    static int set_tuiguan_jie(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            FightParameter obj  = (FightParameter)o;
            int            arg0 = (int)LuaDLL.luaL_checknumber(L, 2);
            obj.tuiguan_jie = arg0;
            return(0);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index tuiguan_jie on a nil value" : e.Message));
        }
    }
コード例 #7
0
    static int set_fightType(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            FightParameter obj  = (FightParameter)o;
            FightType      arg0 = (FightType)ToLua.CheckObject(L, 2, typeof(FightType));
            obj.fightType = arg0;
            return(0);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index fightType on a nil value" : e.Message));
        }
    }
コード例 #8
0
    static int set_Music(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            FightParameter obj  = (FightParameter)o;
            string         arg0 = ToLua.CheckString(L, 2);
            obj.Music = arg0;
            return(0);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index Music on a nil value" : e.Message));
        }
    }
コード例 #9
0
    static int set_QixiSquare(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            FightParameter obj  = (FightParameter)o;
            ArmySquareInfo arg0 = (ArmySquareInfo)ToLua.CheckObject(L, 2, typeof(ArmySquareInfo));
            obj.QixiSquare = arg0;
            return(0);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index QixiSquare on a nil value" : e.Message));
        }
    }
コード例 #10
0
    static int set_Squares(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            FightParameter obj = (FightParameter)o;
            System.Collections.Generic.List <ArmySquareInfo> arg0 = (System.Collections.Generic.List <ArmySquareInfo>)ToLua.CheckObject(L, 2, typeof(System.Collections.Generic.List <ArmySquareInfo>));
            obj.Squares = arg0;
            return(0);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index Squares on a nil value" : e.Message));
        }
    }
コード例 #11
0
    static int get_tuiguan_jie(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            FightParameter obj = (FightParameter)o;
            int            ret = obj.tuiguan_jie;
            LuaDLL.lua_pushinteger(L, ret);
            return(1);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index tuiguan_jie on a nil value" : e.Message));
        }
    }
コード例 #12
0
    static int get_fightType(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            FightParameter obj = (FightParameter)o;
            FightType      ret = obj.fightType;
            ToLua.Push(L, ret);
            return(1);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index fightType on a nil value" : e.Message));
        }
    }
コード例 #13
0
    ///// <summary>
    ///// 切到主场景
    ///// </summary>
    ///// <returns></returns>
    //public static int LoadMainBaseActors()
    //{
    //    //in FightParameter[,talkRecallClass,talkRecallFunc]
    //    //if (FightLoading) return 0;

    //    //var n = lua.GetTop();
    //    FightParameter param = new FightParameter();

    //    param.QixiSquare = null;
    //    param.sceneID = 1;
    //    //param.tuiguan_zhang = 1;
    //    //param.tuiguan_jie = 1;
    //    param.fightType = FightType.Tuiguan;

    //    param.Squares = new List<ArmySquareInfo>();

    //    // TODO 加载数据, 不应该放在这里, 测试
    //    //GlobalData.FightData.SetData(1, 1, 0, 1, 1, 0, 1);
    //    //GlobalData.FightData.IsSetData = true;
    //    //// 设置离线战斗标识
    //    //GlobalData.FightData.IsOnline = false;

    //    return LoadScene(param);
    //}

    /// <summary>
    /// 切战在线斗
    /// </summary>
    /// <returns></returns>
    public static int LoadFight(Action callback = null)
    {
        //in FightParameter[,talkRecallClass,talkRecallFunc]
        //if (FightLoading) return 0;

        //var n = lua.GetTop();
        FightParameter param = new FightParameter();

        param.QixiSquare = null;
        param.sceneID    = 1;
        //param.tuiguan_zhang = 1;
        //param.tuiguan_jie = 1;
        param.fightType = FightType.Tuiguan;

        // 发送并请求数据
        // 设置在线战斗标识
        //GlobalData.FightData.IsOnline = true;

        param.Squares = new List <ArmySquareInfo>();
        return(LoadScene(param, callback));
    }
コード例 #14
0
    static int _CreateFightParameter(IntPtr L)
    {
        try
        {
            int count = LuaDLL.lua_gettop(L);

            if (count == 0)
            {
                FightParameter obj = new FightParameter();
                ToLua.PushObject(L, obj);
                return(1);
            }
            else
            {
                return(LuaDLL.luaL_throw(L, "invalid arguments to ctor method: FightParameter.New"));
            }
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e));
        }
    }
コード例 #15
0
 /// <summary>
 /// 加载场景
 /// </summary>
 /// <param name="param">场景参数</param>
 /// <param name="callback">完成回调</param>
 /// <returns>加载状态</returns>
 public static int LoadScene(FightParameter param, Action callback)
 {
     CoroutineManage.Single.StartCoroutine(CoLoadScene(param, callback));
     return(0);
 }
コード例 #16
0
    /// <summary>
    /// 加载
    /// </summary>
    /// <param name="param">加载参数</param>
    /// <param name="callback">加载完成回调</param>
    /// <returns></returns>
    private static IEnumerator CoLoadScene(FightParameter param, Action callback)
    {
        ////显示战斗装载界面
        //wnd_prefight.Single.Show(Wnd.DefaultDuration);

        //停顿一段时间,等界面显示完全
        {
            float t = Wnd.DefaultDuration;
            while (t > 0)
            {
                yield return(null);

                t -= Time.deltaTime;
            }
        }


        //立即回收被隐藏的窗口
        WndManage.Single.DestroyHideWnds();

        //清理战场
        //DP_Battlefield.Single.Reset();

        //卸掉场景
        DP_Battlefield.Single.SwapScene(0, null, null);

        //立即垃圾回收
        //GC.Collect();
        Resources.UnloadUnusedAssets();

        ////装载资源包
        //List<string> dyPacks = AI_Single.Single.Battlefield.GeneratePackList();


        //装载场景
        bool loadDone = false;

        DP_Battlefield.Single.SwapScene(param.sceneID, null, () => loadDone = true);
        //DP_Battlefield.Single.LoadBase();
        while (!loadDone)
        {
            yield return(null);              //等待场景装载完成
        }
        //重新装载3D物体预置
        //DP_FightPrefabManage.ReLoad3DObjects();


        //隐藏loading
        //wnd_prefight.Single.Hide(Wnd.DefaultDuration);
        //BackgroundMusic = param.Music;


        if (callback != null)
        {
            callback();
        }

//        if (loadDone)
//        {
//            LuaFunction main = LuaClient.GetMainState().GetFunction("Onfs");
//            main.Call();
//            main.Dispose();
//            main = null;
//
//        }
    }