本文整理汇总了C#中LWF.Movie类的典型用法代码示例。如果您正苦于以下问题:C# Movie类的具体用法?C# Movie怎么用?C# Movie使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Movie类属于LWF命名空间,在下文中一共展示了Movie类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SyncMatrix
public static void SyncMatrix(Movie movie)
{
int matrixId = movie.matrixId;
float scaleX = 1;
float scaleY = 1;
float rotation = 0;
Matrix matrix;
if ((matrixId & (int)Constant.MATRIX_FLAG) == 0) {
Translate translate = movie.lwf.data.translates[matrixId];
matrix = new Matrix(scaleX, scaleY,
0, 0, translate.translateX, translate.translateY);
} else {
matrixId &= ~(int)Constant.MATRIX_FLAG_MASK;
matrix = movie.lwf.data.matrices[matrixId];
bool md = GetMatrixDeterminant(matrix);
scaleX = (float)Math.Sqrt(
matrix.scaleX * matrix.scaleX + matrix.skew1 * matrix.skew1);
if (md)
scaleX = -scaleX;
scaleY = (float)Math.Sqrt(
matrix.scaleY * matrix.scaleY + matrix.skew0 * matrix.skew0);
if (md)
rotation = (float)Math.Atan2(matrix.skew1, -matrix.scaleX);
else
rotation = (float)Math.Atan2(matrix.skew1, matrix.scaleX);
rotation = rotation / (float)Math.PI * 180.0f;
}
movie.SetMatrix(matrix, scaleX, scaleY, rotation);
}
示例2: Graphic
public Graphic(LWF lwf, Movie parent, int objId)
: base(lwf, parent, Format.Object.Type.GRAPHIC, objId)
{
Format.Graphic data = lwf.data.graphics[objId];
int n = data.graphicObjects;
m_displayList = new Object[n];
Format.GraphicObject[] graphicObjects = lwf.data.graphicObjects;
for (int i = 0; i < n; ++i) {
Format.GraphicObject gobj =
graphicObjects[data.graphicObjectId + i];
Object obj = null;
int graphicObjectId = gobj.graphicObjectId;
// Ignore error
if (graphicObjectId == -1)
continue;
switch ((Type)gobj.graphicObjectType) {
case Type.BITMAP:
obj = new Bitmap(lwf, parent, graphicObjectId);
break;
case Type.BITMAPEX:
obj = new BitmapEx(lwf, parent, graphicObjectId);
break;
case Type.TEXT:
obj = new Text(lwf, parent, graphicObjectId);
break;
}
m_displayList[i] = obj;
}
}
示例3: ProgramObject
public ProgramObject(LWF lwf, Movie parent, int objId)
: base(lwf, parent, Format.Object.Type.PROGRAMOBJECT, objId)
{
Format.ProgramObject data = lwf.data.programObjects[objId];
m_dataMatrixId = data.matrixId;
ProgramObjectConstructor ctor = lwf.GetProgramObjectConstructor(objId);
if (ctor != null)
m_renderer = ctor(this, objId, data.width, data.height);
}
示例4: Object
public Object(LWF lwf, Movie parent, Type type, int objId)
{
m_lwf = lwf;
m_parent = parent;
m_type = type;
m_objectId = objId;
m_matrix = new Matrix();
m_colorTransform = new ColorTransform();
m_execCount = 0;
}
示例5: GetY
public static float GetY(Movie movie)
{
int matrixId = movie.matrixId;
if ((matrixId & (int)Constant.MATRIX_FLAG) == 0) {
Translate translate = movie.lwf.data.translates[matrixId];
return translate.translateY;
} else {
matrixId &= ~(int)Constant.MATRIX_FLAG_MASK;
Matrix matrix = movie.lwf.data.matrices[matrixId];
return matrix.translateY;
}
}
示例6: SearchFrame
public int SearchFrame(Movie movie, int stringId)
{
if (stringId < 0 || stringId >= m_data.strings.Length)
return -1;
int frameNo;
Dictionary<int, int> labelMap = m_data.labelMap[movie.objectId];
if (labelMap.TryGetValue(stringId, out frameNo))
return frameNo + 1;
else
return -1;
}
示例7: Object
public Object(LWF lwf, Movie parent, Type type, int objId)
{
m_lwf = lwf;
m_parent = parent;
m_type = type;
m_objectId = objId;
m_matrixId = -1;
m_colorTransformId = -1;
m_matrixIdChanged = true;
m_colorTransformIdChanged = true;
m_matrix = new Matrix(0, 0, 0, 0, 0, 0);
m_colorTransform = new ColorTransform(0, 0, 0, 0);
m_execCount = 0;
m_updated = false;
}
示例8: Button
public Button(LWF lwf, Movie parent, int objId, int instId)
: base(lwf, parent, Format.Object.Type.BUTTON, objId, instId)
{
m_invert = new Matrix();
m_hitX = Int32.MinValue;
m_hitY = Int32.MinValue;
if (objId >= 0) {
m_data = lwf.data.buttons[objId];
m_dataMatrixId = m_data.matrixId;
}
m_handler = lwf.GetButtonEventHandlers(this);
if (m_handler != null && m_handler.load != null)
m_handler.load(this);
}
示例9: Button
public Button(LWF lwf, Movie parent, int objId, int instId,
int matrixId = -1, int colorTransformId = -1)
: base(lwf, parent, Format.Object.Type.BUTTON, objId, instId)
{
m_matrixId = matrixId;
m_colorTransformId = colorTransformId;
m_invert = new Matrix();
m_hitX = Int32.MinValue;
m_hitY = Int32.MinValue;
if (objId >= 0) {
m_data = lwf.data.buttons[objId];
m_dataMatrixId = m_data.matrixId;
}
m_handler = lwf.GetButtonEventHandlers(this);
if (m_handler != null)
m_handler.Call(EventType.LOAD, this);
}
示例10: IObject
public IObject(LWF lwf,
Movie parent, Type type, int objId, int instId)
: base(lwf, parent, type, objId)
{
m_prevInstance = null;
m_nextInstance = null;
m_linkInstance = null;
m_instanceId =
(instId >= lwf.data.instanceNames.Length) ? -1 : (int)instId;
if (m_instanceId >= 0) {
int stringId = lwf.GetInstanceNameStringId(m_instanceId);
m_name = stringId == -1 ? null : lwf.data.strings[stringId];
IObject head = m_lwf.GetInstance(m_instanceId);
if (head != null)
head.m_prevInstance = this;
m_nextInstance = head;
m_lwf.SetInstance(m_instanceId, this);
}
}
示例11: AddEventHandlerLua
public int AddEventHandlerLua(Movie movie = null, Button button = null)
{
if (luaState==null)
return 0;
Lua.lua_State l = (Lua.lua_State)luaState;
string ev;
int luaHandlerId;
int handlerId;
/* 1: LWF_LWF instance */
/* 2: string */
/* 3: function */
ev = Lua.lua_tostring(l, 2).ToString();
Lua.lua_getglobal(l, "LWF");
/* -1: LWF */
if (!Lua.lua_istable(l, -1)) {
Lua.lua_pop(l, 1);
/* 0 */
goto error;
}
Lua.lua_getfield(l, -1, "Instances");
/* -2: LWF */
/* -1: LWF.Instances */
Lua.lua_remove(l, -2);
/* -1: LWF.Instances */
if (!Lua.lua_istable(l, -1)) {
Lua.lua_pop(l, 1);
/* 0 */
goto error;
}
Lua.lua_getfield(l, -1, instanceIdString);
/* -2: LWF.Instances */
/* -1: LWF.Instances.<instanceId> */
Lua.lua_remove(l, -2);
/* -1: LWF.Instances.<instanceId> */
if (!Lua.lua_istable(l, -1)) {
Lua.lua_pop(l, 1);
/* 0 */
goto error;
}
Lua.lua_getfield(l, -1, "Handlers");
/* -2: LWF.Instances.<instanceId> */
/* -1: LWF.Instances.<instanceId>.Handlers */
Lua.lua_remove(l, -2);
/* -1: LWF.Instances.<instanceId>.Handlers */
if (!Lua.lua_istable(l, -1)) {
Lua.lua_pop(l, 1);
/* 0 */
goto error;
}
Lua.lua_pushvalue(l, 3);
/* -2: LWF.Instances.<instanceId>.Handlers */
/* -1: function */
luaHandlerId = GetEventOffset();
Lua.lua_setfield(l, -2, luaHandlerId.ToString());
/* LWF.Instances.<instanceId>.Handlers.<luaHandlerId> = function */
/* -1: LWF.Instances.<instanceId>.Handlers */
Lua.lua_pop(l, 1);
/* 0 */
if (movie != null) {
if (string.IsNullOrEmpty(ev) || MovieEvents.ContainsKey(ev)) {
/* Movie event */
handlerId = movie.AddEventHandler(ev, (Movie m) => {
Lua.lua_State _l = (Lua.lua_State)m.lwf.luaState;
if (!m.lwf.PushHandlerLua(luaHandlerId))
return;
/* -1: function */
Luna_LWF_Movie.push(_l, m, false);
/* -2: function */
/* -1: Movie */
if (Lua.lua_pcall(_l, 1, 0, 0)!=0)
Lua.lua_pop(_l, 1);
});
} else {
handlerId = movie.AddEventHandler(ev, () => {
Lua.lua_State _l = (Lua.lua_State)movie.lwf.luaState;
if (!movie.lwf.PushHandlerLua(luaHandlerId))
return;
/* -1: function */
/* User defined event */
Lua.lua_createtable(_l, 0, 2);
/* -2: function */
/* -1: table */
Lua.lua_pushstring(_l, ev);
/* -3: function */
/* -2: table */
/* -1: string(type) */
Lua.lua_setfield(_l, -2, "type");
/* -2: function */
/* -1: table */
if (Lua.lua_istable(_l, 2)) {
Lua.lua_getfield(_l, 2, "param");
/* -3: function */
/* -2: table */
/* -1: param */
//.........这里部分代码省略.........
示例12: SetFieldLua
public bool SetFieldLua(Movie movie, string key)
{
if (luaState==null)
return false;
Lua.lua_State l = (Lua.lua_State)luaState;
/* 1: LWF_Movie instance */
/* 2: key */
/* 3: value */
if (Lua.lua_isstring(l, 3)!=0 && movie.SearchText(key)) {
movie.lwf.SetText(
movie.GetFullName() + "." + key, Lua.lua_tostring(l, 3).ToString());
}
Lua.lua_getglobal(l, "LWF");
/* -1: LWF.Instances */
if (!Lua.lua_istable(l, -1)) {
Lua.lua_pop(l, 1);
/* 0 */
return false;
}
Lua.lua_getfield(l, -1, "Instances");
/* -2: LWF */
/* -1: LWF.Instances */
Lua.lua_remove(l, -2);
/* -1: LWF.Instances */
if (!Lua.lua_istable(l, -1)) {
Lua.lua_pop(l, 1);
/* 0 */
return false;
}
Lua.lua_getfield(l, -1, instanceIdString);
/* -2: LWF.Instances */
/* -1: LWF.Instances.<instanceId> */
Lua.lua_remove(l, -2);
/* -1: LWF.Instances.<instanceId> */
if (!Lua.lua_istable(l, -1)) {
Lua.lua_pop(l, 1);
/* 0 */
return false;
}
Lua.lua_getfield(l, -1, "Movies");
/* -2: LWF.Instances.<instanceId> */
/* -1: LWF.Instances.<instanceId>.Movies */
Lua.lua_remove(l, -2);
/* -1: LWF.Instances.<instanceId>.Movies */
if (!Lua.lua_istable(l, -1)) {
Lua.lua_pop(l, 1);
return false;
}
string s = movie.iObjectId.ToString();
Lua.lua_getfield(l, -1, s);
/* -2: LWF.Instances.<instanceId>.Movies */
/* -1: LWF.Instances.<instanceId>.Movies.<iObjectId> */
if (!Lua.lua_istable(l, -1)) {
Lua.lua_pop(l, 1);
/* -1: LWF.Instances.<instanceId>.Movies */
Lua.lua_newtable(l);
/* -2: LWF.Instances.<instanceId>.Movies */
/* -1: table */
Lua.lua_pushvalue(l, -1);
/* -3: LWF.Instances.<instanceId>.Movies */
/* -2: table */
/* -1: table */
Lua.lua_setfield(l, -3, s);
/* -2: LWF.Instances.<instanceId>.Movies */
/* -1: table LWF.Instances.<instanceId>.Movies.<iObjectId> */
}
Lua.lua_pushvalue(l, 3);
/* -2: LWF.Instances.<instanceId>.Movies.<iObjectId> */
/* -1: value */
Lua.lua_setfield(l, -2, key);
/* -1: LWF.Instances.<instanceId>.Movies.<iObjectId> */
Lua.lua_pop(l, 1);
/* 0 */
return true;
}
示例13: GetTextLua
public string GetTextLua(Movie movie, string textName)
{
if (luaState==null)
return "";
Lua.lua_State l = (Lua.lua_State)luaState;
if (!GetFieldLua(movie, textName) || Lua.lua_isstring(l, -1)==0) {
/* -1: nil or not text */
Lua.lua_pop(l, 1);
return "";
}
/* -1: text */
string text = Lua.lua_tostring(l, -1).ToString();
Lua.lua_pop(l, 1);
/* 0 */
return text;
}
示例14: DestroyMovieLua
public void DestroyMovieLua(Movie movie)
{
if (luaState==null)
return;
Lua.lua_State l = (Lua.lua_State)luaState;
Lua.lua_getglobal(l, "LWF");
/* -1: LWF */
if (!Lua.lua_istable(l, -1)) {
Lua.lua_pop(l, 1);
/* 0 */
return;
}
Lua.lua_getfield(l, -1, "Script");
/* -2: LWF */
/* -1: LWF.Script */
Lua.lua_remove(l, -2);
/* -1: LWF.Script */
if (!Lua.lua_istable(l, -1)) {
Lua.lua_pop(l, 1);
/* 0 */
return;
}
Lua.lua_getfield(l, -1, name);
/* -2: LWF.Script */
/* -1: LWF.Script.<name> */
Lua.lua_remove(l, -2);
/* -1: LWF.Script.<name> */
if (!Lua.lua_istable(l, -1)) {
Lua.lua_pop(l, 1);
/* 0 */
return;
}
Lua.lua_getfield(l, -1, "Destroy");
/* -2: LWF.Script.<name> */
/* -1: LWF.Script.<name>.Destroy */
Lua.lua_remove(l, -2);
/* -1: LWF.Script.<name>.Destroy */
if (Lua.lua_isfunction(l, -1)) {
Luna_LWF_LWF.push(l, this, false);
/* -2: LWF.Script.<name>.Destroy */
/* -1: LWF instance */
if (Lua.lua_pcall(l, 1, 0, 0) != 0)
Lua.lua_pop(l, 1);
/* 0 */
}
Lua.lua_getglobal(l, "LWF");
/* -1: LWF */
if (!Lua.lua_istable(l, -1)) {
Lua.lua_pop(l, 1);
/* 0 */
return;
}
Lua.lua_getfield(l, -1, "Instances");
/* -2: LWF */
/* -1: LWF.Instances */
Lua.lua_remove(l, -2);
/* -1: LWF.Instances */
if (!Lua.lua_istable(l, -1)) {
Lua.lua_pop(l, 1);
/* 0 */
return;
}
Lua.lua_getfield(l, -1, instanceIdString);
/* -2: LWF.Instances */
/* -1: LWF.Instances.<instanceId> */
Lua.lua_remove(l, -2);
/* -1: LWF.Instances.<instanceId> */
if (!Lua.lua_istable(l, -1)) {
Lua.lua_pop(l, 1);
/* 0 */
return;
}
Lua.lua_getfield(l, -1, "Movies");
/* -2: LWF.Instances.<instanceId> */
/* -1: LWF.Instances.<instanceId>.Movies */
Lua.lua_remove(l, -2);
/* -1: LWF.Instances.<instanceId>.Movies */
if (!Lua.lua_istable(l, -1)) {
Lua.lua_pop(l, 1);
/* 0 */
return;
}
Lua.lua_pushnil(l);
/* -2: LWF.Instances.<instanceId>.Movies */
/* -1: nil */
Lua.lua_setfield(l, -2, movie.iObjectId.ToString());
/* LWF.Instances.<instanceId>.Movies.<iObjectId> = nil */
/* -1: LWF.Instances.<instanceId>.Movies */
Lua.lua_pop(l, 1);
/* 0 */
Luna_LWF_Movie.Destroy(l, movie);
return;
}
示例15: GetFieldLua
public bool GetFieldLua(Movie movie, string key)
{
if (luaState==null)
return false;
Lua.lua_State l = (Lua.lua_State)luaState;
/* 1: LWF_Movie instance */
/* 2: key */
Lua.lua_getglobal(l, "LWF");
/* -1: LWF.Instances */
if (!Lua.lua_istable(l, -1)) {
Lua.lua_pop(l, 1);
/* 0 */
return false;
}
Lua.lua_getfield(l, -1, "Instances");
/* -2: LWF */
/* -1: LWF.Instances */
Lua.lua_remove(l, -2);
/* -1: LWF.Instances */
if (!Lua.lua_istable(l, -1)) {
Lua.lua_pop(l, 1);
/* 0 */
return false;
}
Lua.lua_getfield(l, -1, instanceIdString);
/* -2: LWF.Instances */
/* -1: LWF.Instances.<instanceId> */
Lua.lua_remove(l, -2);
/* -1: LWF.Instances.<instanceId> */
if (!Lua.lua_istable(l, -1)) {
Lua.lua_pop(l, 1);
/* 0 */
return false;
}
Lua.lua_getfield(l, -1, "Movies");
/* -2: LWF.Instances.<instanceId> */
/* -1: LWF.Instances.<instanceId>.Movies */
Lua.lua_remove(l, -2);
/* -1: LWF.Instances.<instanceId>.Movies */
if (!Lua.lua_istable(l, -1)) {
Lua.lua_pop(l, 1);
/* 0 */
return false;
}
Lua.lua_getfield(l, -1, movie.iObjectId.ToString());
/* -2: LWF.Instances.<instanceId>.Movies */
/* -1: LWF.Instances.<instanceId>.Movies.<iObjectId> */
Lua.lua_remove(l, -2);
/* -1: LWF.Instances.<instanceId>.Movies.<iObjectId> */
if (!Lua.lua_istable(l, -1)) {
Lua.lua_pop(l, 1);
/* 0 */
return false;
}
/* -1: LWF.Instances.<instanceId>.Movies.<iObjectId> */
Lua.lua_getfield(l, -1, key);
/* -2: LWF.Instances.<instanceId>.Movies.<iObjectId> */
/* -1: value */
Lua.lua_remove(l, -2);
/* -1: value */
if (Lua.lua_isnil(l, -1)) {
Lua.lua_pop(l, 1);
/* 0 */
return false;
}
return true;
}