public void ExecMovieCommand() { if (m_movieCommands.Count == 0) { return; } List <List <string> > deletes = new List <List <string> >(); foreach (KeyValuePair <List <string>, MovieCommand> kvp in m_movieCommands) { bool available = true; Movie movie = m_rootMovie; foreach (string name in kvp.Key) { movie = movie.SearchMovieInstance(name); if (movie == null) { available = false; break; } } if (available) { kvp.Value(movie); deletes.Add(kvp.Key); } } foreach (List <string> key in deletes) { m_movieCommands.Remove(key); } }
public Movie SearchMovieInstance(string instanceName) { if (instanceName.Contains(".")) { string[] names = instanceName.Split(new Char[] { '.' }); if (names[0] != m_data.strings[m_rootMovieStringId]) { return(null); } Movie m = m_rootMovie; for (int i = 1; i < names.Length; ++i) { m = m.SearchMovieInstance(names[i], false); if (m == null) { return(null); } } return(m); } int stringId = GetStringId(instanceName); if (stringId == -1) { return(rootMovie.SearchMovieInstance(instanceName, true)); } return(SearchMovieInstance(stringId)); }
public Button SearchButtonInstance(string instanceName) { if (instanceName.Contains(".")) { string[] names = instanceName.Split(new Char[] { '.' }); if (names[0] != m_data.strings[m_rootMovieStringId]) { return(null); } Movie m = m_rootMovie; for (int i = 1; i < names.Length; ++i) { if (i == names.Length - 1) { return(m.SearchButtonInstance(names[i], false)); } else { m = m.SearchMovieInstance(names[i], false); if (m == null) { return(null); } } } return(null); } return(SearchButtonInstance(GetStringId(instanceName))); }
public static int __index(Lua.lua_State L) { if (Lua.lua_gettop(L) == 2 && Luna.get_uniqueid(L, 1) == LunaTraits_LWF_Movie.uniqueID) { LWF.Movie o = Luna_LWF_Movie.check(L, 1); string name = Lua.lua_tostring(L, 2).ToString(); if (o.lwf.GetFieldLua(o, name)) { return(1); } LWF.Movie movie = o.SearchMovieInstance(name, false); if (movie != null) { Lua.lua_pop(L, 1); Luna_LWF_Movie.push(L, movie, false); return(1); } LWF.Button button = o.SearchButtonInstance(name, false); if (button != null) { Lua.lua_pop(L, 1); Luna_LWF_Button.push(L, button, false); return(1); } } { Lua.lua_CFunction fnc = null; if (LunaTraits_LWF_Movie.properties.TryGetValue(Lua.lua_tostring(L, 2).ToString(), out fnc)) { Lua.lua_pop(L, 1); // remove self return(fnc(L)); } } int mt = Lua.lua_getmetatable(L, 1); if (mt == 0) { Lua.luaL_error(L, "__index"); //end } Lua.lua_pushstring(L, Lua.lua_tostring(L, 2)); Lua.lua_rawget(L, -2); return(1); }