Comments (2)
我放在了预设下。实现通过预设获取xml,实现了xml的热更。
from behaviac.
我们是一般打包时 仍旧放在Resources下,
思路就是:重载 behaviac.FileManager、先去找热更目录有没有这个xml, 有就加载外部文件,没有就直接按原来方式去Resources目录加载。
根据 http://www.behaviac.com/tutorial_10_extent_filemanager/
重写了一个MyBehaviacFileManager
public class MyBehaviacFileManager : behaviac.FileManager
{
public override byte[] FileOpen(string filePath, string ext)
{
bool in_out = false; //这个有点鸡肋
//思路:检测热更目录下是否有对应文件,存在则优先读取, 否则仍旧读取Resources
int k0 = filePath.IndexOf("Resources");
if (k0 != -1)
{
//根据传过来的路径,计算出我们在热更目录下的相对路径。
string filePathInResources = filePath.Substring(k0);
string fileOutPath = filePathInResources + ext;
fileOutPath = fileOutPath.ToLower();
if (FileHelper.CheckResInPersistentData(fileOutPath)) //封装的 检查安卓、ios热更外部目录的函数
{
try
{
string file_name = FileHelper.GetResInPersistentDataPath(fileOutPath); //封装的检查安卓、ios热更外部目录的文件全路径函数
byte[] buffer = CUtility.GetBinaryFileBuffer(file_name); //文件读取成字节数组(安卓有些不一样,所以统一封装了一个接口)
in_out = true;
return buffer;
}
catch (System.Exception e)
{
Log.Error("LoadJsonFile ({0}) failed, error({1})", fileOutPath, e.ToString());
}
}
}
if (!in_out)
{
return base.FileOpen(filePath, ext); //外部xml等文件不存在,就走默认基类的加载
}
else
{
return null;
}
}
}
from behaviac.
Related Issues (20)
- 请问这个项目后期还会迭代更新吗 HOT 1
- linux C++加载行为树报错 [ 编译成功,运行报错 ] HOT 1
- 官网,文档网址挂了吗 HOT 3
- BehaviacDesigner还有在维护吗?我私底下优化了BehaviacDesigner的性能,打算看情况提PullRequest HOT 3
- 条件执行节点的动作子节点下返回running状态的问题
- 接口支持
- 导出的C#行为树代码尝试调用Agent的internal方法导致跨项目编译失败
- 官方访问不了 HOT 1
- 无符号64位和0比较编译不过
- 关于C#版本Agent实例的内存泄漏问题 HOT 3
- 官网彻底没了,是否有可能恢复? HOT 3
- 连接c++游戏 HOT 3
- debug 内存泄漏 连调 HOT 4
- 关于预编译头
- 行为节点无法使用“决定状态的函数”方式 HOT 1
- 最近打开的工作区,储存路径问题 HOT 1
- 在哪里可以找到一款能够连接到Behaviac进行C++可视化调试的小游戏? HOT 2
- 离线调试功能
- 我有个动作节点接收int类型参数,并定义了一个方法返回int,动作节点可以接收一个方法的返回值作为参数输入吗? HOT 1
- 双参数event的参数异常问题
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from behaviac.