static int OnJsonCallFunc(IntPtr L) { LuaScriptMgr.CheckArgsCount(L, 2); string arg0 = LuaScriptMgr.GetLuaString(L, 1); LuaFunction arg1 = LuaScriptMgr.GetLuaFunction(L, 2); LuaHelper.OnJsonCallFunc(arg0, arg1); return(0); }
static int OnClick(IntPtr L) { LuaScriptMgr.CheckArgsCount(L, 1); LuaFunction arg0 = LuaScriptMgr.GetLuaFunction(L, 1); UIEventListener.VoidDelegate o = LuaHelper.OnClick(arg0); LuaScriptMgr.Push(L, o); return(1); }
static int Action(IntPtr L) { LuaScriptMgr.CheckArgsCount(L, 1); LuaFunction arg0 = LuaScriptMgr.GetLuaFunction(L, 1); Action o = LuaHelper.Action(arg0); LuaScriptMgr.Push(L, o); return(1); }
static int GetType(IntPtr L) { LuaScriptMgr.CheckArgsCount(L, 1); string arg0 = LuaScriptMgr.GetLuaString(L, 1); Type o = LuaHelper.GetType(arg0); LuaScriptMgr.Push(L, o); return(1); }
static int LoadBundleGB(IntPtr L) { try { int count = LuaDLL.lua_gettop(L); if (count == 3 && TypeChecker.CheckTypes(L, 1, typeof(string), typeof(string), typeof(System.Action <UnityEngine.GameObject>))) { string arg0 = ToLua.ToString(L, 1); string arg1 = ToLua.ToString(L, 2); System.Action <UnityEngine.GameObject> arg2 = null; LuaTypes funcType3 = LuaDLL.lua_type(L, 3); if (funcType3 != LuaTypes.LUA_TFUNCTION) { arg2 = (System.Action <UnityEngine.GameObject>)ToLua.ToObject(L, 3); } else { LuaFunction func = ToLua.ToLuaFunction(L, 3); arg2 = DelegateFactory.CreateDelegate(typeof(System.Action <UnityEngine.GameObject>), func) as System.Action <UnityEngine.GameObject>; } LuaHelper.LoadBundleGB(arg0, arg1, arg2); return(0); } else if (count == 4 && TypeChecker.CheckTypes(L, 1, typeof(string), typeof(string), typeof(LuaInterface.LuaTable), typeof(System.Action <UnityEngine.GameObject>))) { string arg0 = ToLua.ToString(L, 1); string arg1 = ToLua.ToString(L, 2); LuaTable arg2 = ToLua.ToLuaTable(L, 3); System.Action <UnityEngine.GameObject> arg3 = null; LuaTypes funcType4 = LuaDLL.lua_type(L, 4); if (funcType4 != LuaTypes.LUA_TFUNCTION) { arg3 = (System.Action <UnityEngine.GameObject>)ToLua.ToObject(L, 4); } else { LuaFunction func = ToLua.ToLuaFunction(L, 4); arg3 = DelegateFactory.CreateDelegate(typeof(System.Action <UnityEngine.GameObject>), func) as System.Action <UnityEngine.GameObject>; } LuaHelper.LoadBundleGB(arg0, arg1, arg2, arg3); return(0); } else { return(LuaDLL.luaL_throw(L, "invalid arguments to method: LuaHelper.LoadBundleGB")); } } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
/// <summary> /// 加载依赖项目 /// </summary> /// <param name="req"></param> static protected int[] LoadDependencies(CRequest req) { string[] deps = assetBundleManifest.GetAllDependencies(req.assetBundleName); if (deps.Length == 0) { return(null); } string dep_url; string depAbName = ""; CRequest item; int[] hashs = new int[deps.Length]; int keyhash; for (int i = 0; i < deps.Length; i++) { depAbName = deps [i]; dep_url = RemapVariantName(depAbName); keyhash = LuaHelper.StringToHash(dep_url); hashs[i] = keyhash; if (CacheManager.Contains(keyhash)) { CountMananger.Add(keyhash); //引用数量加1 } else { item = LRequestPool.Get(); //new CRequest(dep_url); item.relativeUrl = dep_url; item.isShared = true; item.async = false; //依赖项目 string[] depds = assetBundleManifest.GetAllDependencies(item.assetBundleName); if (depds.Length > 0) { int[] hash1s = new int[depds.Length]; for (int i1 = 0; i1 < depds.Length; i1++) { depAbName = depds [i1]; dep_url = RemapVariantName(depAbName); keyhash = LuaHelper.StringToHash(dep_url); hash1s[i1] = keyhash; } item.allDependencies = hash1s; } #if HUGULA_LOADER_DEBUG Debug.LogFormat("<color=yellow> Req(assetname={0}) /r/n Begin LoadDependencies Req(assetname={1},url={2}) frameCount{3}</color>", req.assetBundleName, item.assetName, item.url, Time.frameCount); #endif item.isNormal = req.isNormal; item.uris = req.uris; AddReqToQueue(item); } } return(hashs); }
private Dictionary <int, int> _getWeaponClasses() { Dictionary <int, int> table = new Dictionary <int, int>(); var accIdPath = ProjectConfiguration.SyncAccId; for (int i = 0; i <= 30; i++) { table[i] = i; } if (_database.MetaGrf.GetData(ProjectConfiguration.SyncAccId) == null || _database.MetaGrf.GetData(ProjectConfiguration.SyncAccName) == null) { return(table); } var weaponPath = GrfPath.Combine(GrfPath.GetDirectoryName(accIdPath), "weapontable" + Path.GetExtension(accIdPath)); var weaponData = _database.MetaGrf.GetData(weaponPath); if (weaponData == null) { return(table); } var weaponTable = new LuaParser(weaponData, true, p => new Lub(p).Decompile(), EncodingService.DetectEncoding(weaponData), EncodingService.DisplayEncoding); var weaponIds = LuaHelper.GetLuaTable(weaponTable, "Weapon_IDs"); var weaponExpansionNameTable = LuaHelper.GetLuaTable(weaponTable, "Expansion_Weapon_IDs"); var ids = LuaHelper.SetIds(weaponIds, "Weapon_IDs"); foreach (var id in ids) { if (id.Value == 24) { continue; } if (id.Value <= 30) { table[id.Value] = id.Value; } else { string sval; if (weaponExpansionNameTable.TryGetValue("[" + id.Key + "]", out sval)) { int ival; if (ids.TryGetValue(sval, out ival)) { table[id.Value] = ival; } } } } return(table); }
static int OnHover(IntPtr L) { LuaScriptMgr.CheckArgsCount(L, 2); LuaFunction arg0 = LuaScriptMgr.GetLuaFunction(L, 1); int arg1 = (int)LuaScriptMgr.GetNumber(L, 2); UIEventListener.BoolDelegate o = LuaHelper.OnHover(arg0, arg1); LuaScriptMgr.Push(L, o); return(1); }
static int GetComponentsInChildren(IntPtr L) { LuaScriptMgr.CheckArgsCount(L, 2); GameObject arg0 = (GameObject)LuaScriptMgr.GetUnityObject(L, 1, typeof(GameObject)); string arg1 = LuaScriptMgr.GetLuaString(L, 2); Component[] o = LuaHelper.GetComponentsInChildren(arg0, arg1); LuaScriptMgr.PushArray(L, o); return(1); }
public void OnLoadingDone() { Destroy(gameObject); ProxyManager.GetInstance().Add(new LoginProxy()); UIManager.GetInstance().OpenUI("Login", (view) => { LuaHelper.CallFunctionWithSelf(view, "LoginView.Init"); }); }
static int callLuaFunc(IntPtr L) { LuaScriptMgr.CheckArgsCount(L, 3); LuaHelper obj = (LuaHelper)LuaScriptMgr.GetUnityObjectSelf(L, 1, "LuaHelper"); string arg0 = LuaScriptMgr.GetLuaString(L, 2); object arg1 = LuaScriptMgr.GetVarObject(L, 3); obj.callLuaFunc(arg0, arg1); return(0); }
public void AddCache(string typeName, ICache value) { if (!_caches.TryAdd(typeName, value)) { Logger.Warn($"添加{typeName}缓存失败!"); return; } LuaHelper.RegisterType(value.GetType()); }
static int GetComponent(IntPtr L) { LuaScriptMgr.CheckArgsCount(L, 2); GameObject arg0 = LuaScriptMgr.GetNetObject <GameObject>(L, 1); string arg1 = LuaScriptMgr.GetLuaString(L, 2); Component o = LuaHelper.GetComponent(arg0, arg1); LuaScriptMgr.Push(L, o); return(1); }
static int RegisterGameMsgHandler(IntPtr L) { LuaScriptMgr.CheckArgsCount(L, 3); uint arg0 = (uint)LuaScriptMgr.GetNumber(L, 1); LuaFunction arg1 = LuaScriptMgr.GetLuaFunction(L, 2); string arg2 = LuaScriptMgr.GetLuaString(L, 3); LuaHelper.RegisterGameMsgHandler(arg0, arg1, arg2); return(0); }
/// <summary> /// 停止语音播放 /// </summary> public void StopPlayYuyin() { LuaHelper.GetSoundManager().CloseSound(false); _phoneInput.StopPlayCurrentVoice(); if (_curClickYuYinGo != null) { //var animate = _curClickYuYinGo.GetComponentInParent<AnimateTexture>(); //if (animate != null) animate.start = false; } }
public string GetSpriteFromJob(ReadableTuple <int> tuple, PreviewHelper helper) { var name = LuaHelper.GetSpriteFromJob(helper.Grf, null, helper, helper.PreviewSprite, LuaHelper.ViewIdTypes.Npc); if (name.EndsWith(".gr2")) { return(name); } return(name + ".act"); }
private void OnReturnBtnClick() { _floatingBars.Clear(); GameObject.Destroy(_transform.gameObject); LuaBattleManager.instance.BattleEnd(); LuaHelper.GetLuaManager().DoFile("Scene/Loading"); Util.CallMethod("Loading", "LoadScene", "MainScene"); }
public static void loadPrefab(string assetBundleKey, string assetName, Action <UObject> callback, bool fullPath = false) { //Tools.Log("loadPrefab:" + assetBundleKey); if (callback == null) { callback = obj => { } } ; if (assetName == null) { assetName = getAssetNameByKey(assetBundleKey); } var objectCacheKey = getObjectCacheKey(assetBundleKey, assetName); ObjectRef resObject; if (OBJECT_CACHE.TryGetValue(objectCacheKey, out resObject)) { resObject.referencedCount++; callback.Invoke(resObject.obj); return; } //将callback挂载loadingRequest中,当加载完毕后再依次调用callback List <Action <UObject> > callbacks; if (loadingRequestCallbackList.TryGetValue(objectCacheKey, out callbacks)) { callbacks.Add(callback); return; } else { callbacks = new List <Action <UObject> >(); callbacks.Add(callback); loadingRequestCallbackList.Add(objectCacheKey, callbacks); } string assetBundleName; if (fullPath) { assetBundleName = assetBundleKey; } else { assetBundleName = getAssetBundleNameByKey(assetBundleKey); } LuaHelper.GetAssetBundleManager().LoadAsyncPrefab2(assetBundleName, assetName, obj => { onLoadPrefab(assetBundleName, objectCacheKey, obj); }); }
protected override void OnClosing(System.ComponentModel.CancelEventArgs e) { if (_oldPath1 != ProjectConfiguration.SyncMobId || _oldPath2 != ProjectConfiguration.SyncMobName) { LuaHelper.ReloadJobTable((_database).GetDb <int>(ServerDbs.Mobs), true); LuaHelper.ReloadJobTable((_database).GetDb <int>(ServerDbs.Mobs2), true); } base.OnClosing(e); }
public PlatoHelper(StardewModdingAPI.IModHelper helper) { ModHelper = helper; SharedData = new SharedDataHelper(this); Harmony = new HarmonyHelper(this); Content = new ContentHelper(this); UI = new UIHelper(this); Lua = new LuaHelper(this); Presets = new PresetHelper(this); Utilities = new BasicUtils(this); }
/// <summary> /// /// </summary> /// <param name="main"></param> private IEnumerator ReOpen(float seconds, string sceneName) { RemoveAllEvents(); yield return(new WaitForSeconds(seconds)); lua.luaState.Close(); yield return(new WaitForSeconds(seconds)); GameObject.Destroy(this.gameObject); LuaHelper.LoadScene(sceneName, false); }
public override void OnEntered(object param) { UIManager.GetInstance().OpenUI("MainUI", view => { LuaHelper.CallFunctionWithSelf(view, "MainUIView.Init"); }, view => { LuaHelper.CallFunctionWithSelf(view, "MainUIView.ShowCastleButton"); }, false); UIManager.GetInstance().OpenUI("MainResource", null, null, false); }
static int loadFromBundle(IntPtr L) { LuaScriptMgr.CheckArgsCount(L, 4); LuaHelper obj = (LuaHelper)LuaScriptMgr.GetUnityObjectSelf(L, 1, "LuaHelper"); string arg0 = LuaScriptMgr.GetLuaString(L, 2); string arg1 = LuaScriptMgr.GetLuaString(L, 3); string arg2 = LuaScriptMgr.GetLuaString(L, 4); obj.loadFromBundle(arg0, arg1, arg2); return(0); }
static int HpMpTweenShow(IntPtr L) { LuaScriptMgr.CheckArgsCount(L, 4); UIProgressBar arg0 = (UIProgressBar)LuaScriptMgr.GetUnityObject(L, 1, typeof(UIProgressBar)); float arg1 = (float)LuaScriptMgr.GetNumber(L, 2); float arg2 = (float)LuaScriptMgr.GetNumber(L, 3); float arg3 = (float)LuaScriptMgr.GetNumber(L, 4); LuaHelper.HpMpTweenShow(arg0, arg1, arg2, arg3); return(0); }
void DoBuffsIfNeeded() { foreach (string b in buffs) { if (LuaHelper.IsSpellCastable(b) && !LuaHelper.IsAuraActive(b)) { LuaHelper.CastSpellByName(b); Thread.Sleep(CoolDown.Global); } } }
/// <summary> /// Set Cache Data /// </summary> public void SetCacheData(AssetBundle assetBundle, string assetBundleName) { this.assetBundle = assetBundle; this.assetBundleKey = assetBundleName; this.isUnloaded = false; if (this.assetHashCode == 0 && !string.IsNullOrEmpty(assetBundleName)) { int hash = LuaHelper.StringToHash(assetBundleKey); this.assetHashCode = hash; }// Debug.LogWarningFormat("CacheData assetBundleName({0})'s hashcode is worng", assetBundleName); }
public static void StartHotfix() { if (Define.IsLua) { LuaHelper.StartHotfix(); } else { MonoHelper.StartHotfix(); } }
protected override void load() { subscribe(PluginShareHelper.DBPlugin_BroadCast_CheckTableNumberIsGreaterThan0, this); subscribe(MDT.Tools.Fix.Common.Utils.PluginShareHelper.BroadCastCheckFixNumberIsGreaterThan0, this); _dbContextMenuStrip = getObject(PluginShareHelper.DBPluginKey, PluginShareHelper.CmcSubPlugin) as ContextMenuStrip; fixCmcSubPlugin = getObject(MDT.Tools.Fix.Common.Utils.PluginShareHelper.FixPluginKey, MDT.Tools.Fix.Common.Utils.PluginShareHelper.CmsSubPlugin) as ContextMenuStrip; AddContextMenu(); ILuaEngine luaEngine = LuaHelper.CreateLuaEngine(); luaEngine.BindLuaFunctions(this); }
/// <summary> /// 播放语音 /// </summary> /// <param name="data"></param> private void PlayYuYin(GameObject go, string data, int voiceTime) { LuaHelper.GetSoundManager().CloseSound(true); _phoneInput.Play64String(data, voiceTime, () => { //var animate = go.GetComponentInParent<AnimateTexture>(); //if (animate != null) animate.start = false; Util.CallMethod("CHATLOGIC", "VoicePlayFinished"); LuaHelper.GetSoundManager().CloseSound(false); }); }
private void runButton_Click(object sender, EventArgs e) { textBox1.Text = ""; string ret = LuaHelper.DoScratchpadString(scintilla1.Text, LuaOutput); if (ret != null) { UpdateConsole(ret + Environment.NewLine); } }
public static int constructor(IntPtr l) { try { LuaHelper o; o=new LuaHelper(); pushValue(l,o); return 1; } catch(Exception e) { LuaDLL.luaL_error(l, e.ToString()); return 0; } }
public static int constructor(IntPtr l) { try { LuaHelper o; o=new LuaHelper(); pushValue(l,true); pushValue(l,o); return 2; } catch(Exception e) { return error(l,e); } }
static int _CreateLuaHelper(IntPtr L) { int count = LuaDLL.lua_gettop(L); if (count == 0) { LuaHelper obj = new LuaHelper(); LuaScriptMgr.PushObject(L, obj); return 1; } else { LuaDLL.luaL_error(L, "invalid arguments to method: LuaHelper.New"); } return 0; }