原创 AssetBundle-簡介

AssetBundle是Unity的一種資源加載使用方式。可以把特定的一些資源打包到一個AssetBundle裏,這些資源包含模型、貼圖、預設體、聲音、甚至整個場景等。特性:AssetBundle資源保持着相互依賴的關係;另外也可

原创 xlua-lua腳本中訪問C#API

using System.Collections; using System.Collections.Generic; using UnityEngine; using XLua; /* * Author:W */ publi

原创 xlua-C#訪問lua全局函數

using System.Collections; using System.Collections.Generic; using UnityEngine; using XLua; /* * Author:W * C#訪問Lu

原创 遊戲熱更新方案

熱更新方案:遊戲已經上線運行,當出現Bug、或者修改、增加某個功能時,不需要玩家重新到應用商下載安裝安裝包,就可以更新遊戲內容。 優點:1、不用浪費大流量重新下載整個安裝包;2、不需要通過應用商店再審覈,加快更新時間;3、不

原创 xlua-C#訪問lua中的全局變量

using System.Collections; using System.Collections.Generic; using UnityEngine; using XLua; /* * Author:W * C#訪問Lu

原创 lua-迭代器

--迭代器:在Lua中常使用函數來描述迭代器,每次調用該函數返回集合的下一個元素。迭代函數、狀態常量、控制變量3部分組成 arr1={"z","b"} for k,v in pairs(arr1) do print(k,v)

原创 lua-元表

--元表:可以實現對2個table的操作,也可以實現改變table的行爲,每個行爲關聯對應的元方法 --setmetatable(table,metatable):爲table設置元表 --getmetatable(table):

原创 lua-面向對象

--面向對象 --lua中類可以通過table【屬性】+function【方法】+metetable【繼承,不推薦用,只模擬最基本的對象大部分時間夠用了】模擬實現 --基類 Shape = {area = 0} --基類方法

原创 lua-數據庫操作

--數據庫操作 --Lua 數據庫的操作庫:LuaSQL。開源的,支持的數據庫有:ODBC, ADO, Oracle, MySQL, SQLite 和 PostgreSQL。 --LuaSQL 可以使用 LuaRocks 來安裝可

原创 lua-表

---table表:是一種數據結構,可以當做數組、字典來用;另外,也用來解決模塊、包、對象的相關問題 table1 = {} print("table的類型:",type(table1)) --移除引用,lua垃圾回收會釋放內存

原创 xlua-以txt文本格式加載lua文件運行

using System.Collections; using System.Collections.Generic; using UnityEngine; using XLua; /* * Author:W * 以txt文本

原创 xlua-C#訪問lua中的table

using System.Collections; using System.Collections.Generic; using UnityEngine; using XLua; /* * Author:W * C#訪問Lu

原创 xlua-使用xlua內置的加載器加載lua文件

using System.Collections; using System.Collections.Generic; using UnityEngine; using XLua; /* * Author:W * 使用x

原创 xlua-使用自定義的lua文件加載器加載lua

using System.Collections; using System.Collections.Generic; using UnityEngine; using XLua; using System.IO; /* * A

原创 lua-I/O

--文件I/O:分簡單模式與完全模式。簡單模式在做一些簡單的文件操作時較爲合適。但是在進行一些高級的文件操作的時候,簡單模式就顯得力不從心。例如同時讀取多個文件這樣的操作,使用完全模式則較爲合適。 --file = io.ope