-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
2.框架源码添加判断是否存在剧情文件对应的代码文件,如果不存在自定义js文件,不执行eval函数 3.预计下次将module源码文件夹合并到fullExample便于测试。 4.之后,框架源码将会与测试Demo绑定,单独复制出来用,可能需要改一下 执行到<end时的路径
- Loading branch information
1 parent
8e1c58a
commit d116cff
Showing
8 changed files
with
126 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
//整合一下 这个将会是新的剧情加载器 | ||
function IPlotLoader() | ||
{ // NOTE: 剧情加载器和脚本加载器应该由Dialog的clicks 驱动,只要返回数据到Dialog | ||
//默认章节位置 默认句子位置 增加I防止混淆变量名称 | ||
this.IchapterIndex=0 | ||
this.IlineIndex=0 | ||
var chapterPath="../chapter/" | ||
var scriptPath="../chapterScript/" | ||
// NOTE: 初始化的加载方法,用于开启新的游戏,从头开始读文件 | ||
this.load=function(str_url,func_url) | ||
{ | ||
//把剧情分词和函数分词存储一个数组 此时为二维数组,一次性return | ||
var final_obj={"plot_array":[],"func_array":[]}//剧情数组元素在前,函数数组元素在后 | ||
//改用ajax同步方法 //async:false为同步 获取文本 | ||
$.ajax({url:str_url,async:false,success:function(result) | ||
{ | ||
// alert(result) | ||
final_obj.plot_array=result.split("\n") | ||
}}) | ||
$.ajax({url:func_url,async:false,success:function(result) | ||
{ | ||
final_obj.func_array=result.split("\n") | ||
}}) | ||
//最后返回数据数组 | ||
return final_obj | ||
} | ||
// NOTE: 读取已经存在的存档 需要一个章节变量 一个index变量 | ||
this.load_from=function(chapterIndex,lineIndex) | ||
{//暂存 | ||
// NOTE: 逻辑是,在游戏的Init.js中(在玩家js之前,初始化的js) | ||
//1.如果获取到游戏数据,然后调用此方法,返回数据对象给Init.js, | ||
//2.Init.js再根据此对象,调用Dialog的setLoadContent方法,设置文本,同时同步更新Dialog内部计数器索引 | ||
//3.Dialog每次点击,就自动是新的数据 | ||
this.IchapterIndex=chapterIndex | ||
this.IlineIndex=lineIndex | ||
// NOTE: 新增两个参数,用于给Dialog设置指定位置的文本 | ||
var final_obj={ | ||
"plot_array":[], | ||
"func_array":[], | ||
"chapterIndex":chapterIndex, | ||
"lineIndex":lineIndex, | ||
} | ||
$.ajax({url:chapterPath+chapterIndex+".txt",async:false,success:function(result) | ||
{ | ||
final_obj.plot_array=result.split("\n") | ||
final_obj.chapterIndex=Number(chapterIndex) | ||
final_obj.lineIndex=Number(lineIndex) | ||
}}) | ||
$.ajax({url:scriptPath+"func"+chapterIndex+".js.txt",async:false,success:function(result) | ||
{ | ||
final_obj.func_array=result.split("\n") | ||
}}) | ||
return final_obj | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters