void enterFrameCallback(LWF.Movie movie) { if (movie.currentFrame == movie.totalFrames || !movie.playing) { message += movie.GetFullName() + " is done \n"; lwf.rootMovie.DetachMovie(movie); } }
public static int _bind_getFullName(Lua.lua_State L) { if (Lua.lua_gettop(L) != 1 || Luna.get_uniqueid(L, 1) != 29625181) { Luna.printStack(L); Lua.luaL_error(L, "luna typecheck failed:getFullName(LWF.Movie self)"); } LWF.Movie self = Luna_LWF_Movie.check(L, 1); try { string ret = self.GetFullName(); Lua.lua_pushstring(L, ret); } catch (Exception e) { Lua.luaL_error(L, new Lua.CharPtr(e.ToString())); } return(1); }
public MovieEventHandlers GetMovieEventHandlers(Movie m) { if (m_movieEventHandlersByFullName != null) { string fullName = m.GetFullName(); if (fullName != null) { MovieEventHandlers handlers; if (m_movieEventHandlersByFullName.TryGetValue( fullName, out handlers)) { return(handlers); } } } int instId = m.instanceId; if (instId < 0 || instId >= m_instances.Length) { return(null); } return(m_movieEventHandlers[instId]); }
void DrawInspector(ObjectContainer container) { EditorGUI.indentLevel = container.hierarchy + 1; LWF.Object obj = container.obj; LWF.LWF lwf = obj.lwf; if (obj.type == Type.MOVIE) { LWF.Movie movie = (LWF.Movie)obj; string movieName = "Movie: " + (movie.name == null ? "(null)" : movie.name); if (!visibilities.ContainsKey(movie)) { visibilities[movie] = true; } visibilities[movie] = EditorGUILayout.Foldout(visibilities[movie], movieName); if (!visibilities[movie]) { return; } EditorGUI.indentLevel = container.hierarchy + 2; string fullName = movie.GetFullName(); if (fullName == null) { fullName = "(null)"; } EditorGUILayout.LabelField("Fullname:", fullName); EditorGUILayout.LabelField("Visible:", movie.visible.ToString()); EditorGUILayout.LabelField("Playing:", movie.playing.ToString()); EditorGUILayout.LabelField("Frame:", movie.currentFrame.ToString()); DrawInfo(container, movie); // TODO EditorGUILayout.Space(); foreach (KeyValuePair <int, ObjectContainer> kvp in container.objects) { DrawInspector(kvp.Value); } } else { EditorGUILayout.LabelField("Depth:", container.depth.ToString()); EditorGUI.indentLevel = container.hierarchy + 2; switch (obj.type) { case Type.BUTTON: LWF.Button button = (LWF.Button)obj; string buttonName = (button.name == null ? "(null)" : button.name); string buttonFullName = button.GetFullName(); if (buttonFullName == null) { buttonFullName = "(null)"; } EditorGUILayout.LabelField("Button:", buttonName); EditorGUI.indentLevel = container.hierarchy + 3; EditorGUILayout.LabelField("Fullname:", buttonFullName); DrawInfo(container, obj); // TODO break; case Type.GRAPHIC: EditorGUILayout.LabelField("Graphic:", ""); EditorGUI.indentLevel = container.hierarchy + 3; DrawInfo(container, obj); // TODO break; case Type.BITMAP: LWF.Bitmap bitmap = (LWF.Bitmap)obj; int tFId = lwf.data.bitmaps[bitmap.objectId].textureFragmentId; string textureName = (tFId == -1 ? "(null)" : lwf.data.textureFragments[tFId].filename); EditorGUILayout.LabelField("Bitmap:", textureName); EditorGUI.indentLevel = container.hierarchy + 3; DrawInfo(container, obj); // TODO break; case Type.BITMAPEX: LWF.BitmapEx bitmapEx = (LWF.BitmapEx)obj; int tFIdEx = lwf.data.bitmapExs[bitmapEx.objectId].textureFragmentId; string textureNameEx = (tFIdEx == -1 ? "(null)" : lwf.data.textureFragments[tFIdEx].filename); EditorGUILayout.LabelField("BitmapEx:", textureNameEx); EditorGUI.indentLevel = container.hierarchy + 3; DrawInfo(container, obj); // TODO break; case Type.TEXT: LWF.Text text = (LWF.Text)obj; string textName = lwf.data.strings[ lwf.data.texts[text.objectId].nameStringId]; EditorGUILayout.LabelField("Text:", textName); EditorGUI.indentLevel = container.hierarchy + 3; DrawInfo(container, obj); // TODO break; case Type.PARTICLE: EditorGUILayout.LabelField("Particle:", ""); EditorGUI.indentLevel = container.hierarchy + 3; DrawInfo(container, obj); // TODO break; case Type.PROGRAMOBJECT: LWF.ProgramObject pObject = (LWF.ProgramObject)obj; string pObjectName = lwf.data.strings[ lwf.data.programObjects[pObject.objectId].stringId]; EditorGUILayout.LabelField("ProgramObject:", pObjectName); EditorGUI.indentLevel = container.hierarchy + 3; DrawInfo(container, obj); // TODO break; } } }
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; }
public MovieEventHandlers GetMovieEventHandlers(Movie m) { if (m_movieEventHandlersByFullName != null) { string fullName = m.GetFullName(); if (fullName != null) { MovieEventHandlers handlers; if (m_movieEventHandlersByFullName.TryGetValue( fullName, out handlers)) { return handlers; } } } int instId = m.instanceId; if (instId < 0 || instId >= m_instances.Length) return null; return m_movieEventHandlers[instId]; }
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); }