예제 #1
0
파일: LuaSoundOne.cs 프로젝트: fengqk/Art
public static int Play(IntPtr L)
{
SoundOne self = Funcs.GetObj(L,1) as SoundOne;
if(self == null)
{
	LuaStatic.traceback(L,"nullobj call");
	LuaDLL.lua_error(L); return 1;
}
System.Single param0 = default(System.Single);
param0 = (System.Single)LuaDLL.lua_tonumber(L,2);
System.Boolean param1 = default(System.Boolean);
param1 = LuaDLL.lua_toboolean(L,3);
LuaInterface.LUACALLBACKFUNC param2 = default(LuaInterface.LUACALLBACKFUNC);
if(LuaDLL.lua_isfunction(L,4))
{
 LuaDLL.lua_pushvalue(L,4);
 param2  = new LUACALLBACKFUNC( LuaDLL.luaL_ref(L,LuaIndexes.LUA_REGISTRYINDEX) );
}
 self.Play(
(System.Single)param0,
(System.Boolean)param1,
(LuaInterface.LUACALLBACKFUNC)param2
);
return 0;
}
예제 #2
0
	public void SetCallBack(LUACALLBACKFUNC cbref = null)
	{
		if (m_cbref != null)
		{
			LuaDLL.luaL_unref(wLua.L.L, LuaIndexes.LUA_REGISTRYINDEX, m_cbref.funcRef);
			m_cbref = null;
		}
		m_cbref = cbref;
	}
예제 #3
0
public static int SetCallBack(IntPtr L)
{
ECMonoEventBehavor self = Funcs.GetObj(L,1) as ECMonoEventBehavor;
if(self == null)
{
	LuaStatic.traceback(L,"nullobj call");
	LuaDLL.lua_error(L); return 1;
}
LuaInterface.LUACALLBACKFUNC param0 = default(LuaInterface.LUACALLBACKFUNC);
if(LuaDLL.lua_isfunction(L,2))
{
 LuaDLL.lua_pushvalue(L,2);
 param0  = new LUACALLBACKFUNC( LuaDLL.luaL_ref(L,LuaIndexes.LUA_REGISTRYINDEX) );
}
 self.SetCallBack(
(LuaInterface.LUACALLBACKFUNC)param0
);
return 0;
}
예제 #4
0
public static int MoveOnPath(IntPtr L)
{
CGCameraMove self = Funcs.GetObj(L,1) as CGCameraMove;
if(self == null)
{
	LuaStatic.traceback(L,"nullobj call");
	LuaDLL.lua_error(L); return 1;
}
System.String param0 = default(System.String);
param0 = LuaDLL.lua_tostring(L,2);
LuaInterface.LUACALLBACKFUNC param1 = default(LuaInterface.LUACALLBACKFUNC);
if(LuaDLL.lua_isfunction(L,3))
{
 LuaDLL.lua_pushvalue(L,3);
 param1  = new LUACALLBACKFUNC( LuaDLL.luaL_ref(L,LuaIndexes.LUA_REGISTRYINDEX) );
}
 self.MoveOnPath(
(System.String)param0,
(LuaInterface.LUACALLBACKFUNC)param1
);
return 0;
}
예제 #5
0
파일: SoundOne.cs 프로젝트: fengqk/Art
	protected void LifeEnd(bool isOver)
	{
		IsPlaying = false;
		if (m_OnLifeEnd != null)
		{
			m_OnLifeEnd(this,false);
		}
		m_audio.Stop();

		if (m_cbref != null && wLua.L != null)
		{
			LuaDLL.lua_rawgeti(wLua.L.L, LuaIndexes.LUA_REGISTRYINDEX, m_cbref.funcRef);
			LuaDLL.luaL_unref(wLua.L.L, LuaIndexes.LUA_REGISTRYINDEX, m_cbref.funcRef);
			LuaDLL.lua_pushboolean(wLua.L.L, isOver);
			wLua.L.Call(1);
			m_cbref = null;
		}
	}
예제 #6
0
파일: SoundOne.cs 프로젝트: fengqk/Art
	public void Play(float fadeTime, bool loop, LUACALLBACKFUNC cbref = null)
	{
		if (m_cbref != null)
		{
			LuaDLL.luaL_unref(wLua.L.L, LuaIndexes.LUA_REGISTRYINDEX, m_cbref.funcRef);
			m_cbref = null;
		}

		m_playing = true;
		m_loop = loop;
		m_audio.loop = m_loop;
		if (fadeTime > 0)
		{
			currentVolume = 0.0f;
			volumeSpeed = volume / fadeTime;
		}
		else
		{
			currentVolume = volume;
			volumeSpeed = 0.0f;
		}

		if (m_loop && cbref != null)
		{
			Debug.LogError("Loop sound should not be set over callback!");
			LuaDLL.luaL_unref(wLua.L.L, LuaIndexes.LUA_REGISTRYINDEX, cbref.funcRef);
			cbref = null;
		}
		m_cbref = cbref;
		PlayDo();
	}