Exemplo n.º 1
0
 /// <summary>
 /// 点击相应事件
 /// </summary>
 void OnButtoClick()
 {
     if (audioTime == -1)
     {
         object[] result = LuaManager.CallMethod("MusicMgr", "GetSoundAudioTime", AudioID);
         if (result.Length > 0)
         {
             audioTime = System.Convert.ToInt32(result[0]);
         }
     }
     if (Time.time * 1000 - playAudioTime >= audioTime)
     {
         LuaManager.CallMethod("MusicMgr", "PlaySoundAudio", AudioID);
         playAudioTime = (int)(Time.time * 1000);
     }
 }
Exemplo n.º 2
0
    public void PlatformToUnity(string paramjson)
    {
        Debug.Log("平台回调unity桥接器方法 paramjson = " + paramjson);
        // 解析json 转换为lua的table
        Dictionary <string, object> dict = MiniJSON.Json.Deserialize(paramjson) as Dictionary <string, object>;

        if (dict == null || dict.Count == 0)
        {
            Debug.LogErrorFormat("解析平台SDK传回的json:[{0}] 出错", paramjson);
            return;
        }
        var table = LuaManager.LuaEnv.NewTable();

        foreach (var item in dict)
        {
            table.Set(item.Key, item.Value);
        }
        // 传回到lua
        LuaManager.CallMethod("PlatformBridge", "CallBackFunc", table);
    }