-
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.添加历史记录在Dialog计数器自动推进 3.Dialog新增设置文字大小API 4.引入jquery-ui库,用于复杂界面,(暂时没有使用) 5.Game.css重命名 6.FileSystem添加自定义更改换行判定符号功能,可以不用中文句号结尾,只需要设置新的判断符号即可(早晚得换成\n) 7.ImageEffect.js简化代码,改用for()现在必须手动设定图片效果的value 8.core.js代码清理,删除了一些废弃代码变量,更换注释格式 9.新增Dialog默认文字大小样式为25px,也可以手动更改 10.注释和删除调无用log -core.js中的计数器代码里面 11.新增文件夹-空游戏模板-tempz 12.test单元测试新增ImageEffect测试和json存入测试 note: eval("var x=4") 可用于执行字符串里面的js方法 json不能存函数,但可以存对象 读取存档后,同步函数的功能未实现
- Loading branch information
1 parent
0c4d1c7
commit d962686
Showing
33 changed files
with
33,616 additions
and
211 deletions.
There are no files selected for viewing
Binary file not shown.
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 |
---|---|---|
@@ -1,139 +1,154 @@ | ||
// NOTE: 游戏主逻辑文本 | ||
$(function() | ||
{ | ||
var Engine=new EasyAvg() | ||
var file=new FileSystem() | ||
//动画 | ||
var Anim=new AnimateEffect() | ||
|
||
var historyText=[] | ||
/*初始化图像特效模块*/ | ||
var Effect=new ImageEffect() | ||
alert("请先点击开始按钮来播放背景音乐,由于浏览器安全设置,不能自动播放,点击人物,也能开始播放音乐") | ||
function initUI() | ||
{ | ||
$("#end").click(function() | ||
{ | ||
changeScene("../index.html") | ||
}) | ||
$("#start").click(function() | ||
{ | ||
$("#bgm")[0].play() | ||
}) | ||
$("#end").click(function() | ||
{ | ||
changeScene("../index.html") | ||
}) | ||
$("#loadGame").click(function() | ||
{ | ||
changeScene("../save.html") | ||
|
||
}) | ||
/*历史记录*/ | ||
$("#clearCookie").click(function() | ||
{ | ||
$.removeCookie('runTimeIndex',{path:'/'}) | ||
}) | ||
$("#clearClicks").click(function() | ||
{ | ||
console.clear() | ||
console.warn("#清空计数器"); | ||
dialog.clearClicks() | ||
}) | ||
$("#history").click(function() | ||
{ | ||
// alert("历史记录!") | ||
$("div").toggle() | ||
$("#HistoryPanel").toggle() | ||
var h=localStorage.getItem("historyText") | ||
console.log("#读取历史文本"); | ||
// console.log(h.split("\n")) | ||
var 文本=h.split("\n") | ||
var len=h.split("\n").length | ||
|
||
}) | ||
$("#reload").click(function() | ||
{ | ||
location.reload() | ||
}) | ||
$("#hideDialog").click(function() | ||
{ | ||
dialog.toggle() | ||
}) | ||
$("#clearAll").click(function() | ||
{ | ||
file.clearAll() | ||
}) | ||
} | ||
initUI() | ||
/*逻辑代码*/ | ||
var Engine=new EasyAvg() | ||
// NOTE: 需要先创建背景 | ||
// Engine.showBgm() | ||
Engine.setBgmVolume(0.5) | ||
var bg=Engine.create_img("../img/bg.jpg","背景") | ||
var dialog=Engine.create_Dialog() | ||
var koyomi=Engine.create_img("../img/char.png","小夜美") | ||
// Engine.showBgm() | ||
Engine.setBgmVolume(0.5) | ||
|
||
koyomi.css("margin-left","500px") | ||
koyomi.css("margin-top","20px") | ||
koyomi.css("position","relative") | ||
koyomi.click(function() | ||
{ | ||
alert("点击了人物,开始播放音乐") | ||
$("#bgm")[0].play() | ||
// Effect.setImageEffect(bg,Effect.blur) | ||
// Effect.setImageEffectValue(koyomi,"60px") | ||
// Effect.clearAllEffect(koyomi) | ||
// alert("点击了人物,开始播放音乐") | ||
// $("#bgm")[0].play() | ||
//此方法不能放入函数列表,会被自动执行 | ||
koyomi.animate({right:'250px',opacity:'0.5'}) | ||
// koyomi.animate({opacity:'1'}) | ||
// Anim.setAnimate(koyomi,Anim.move_to_left) | ||
// Anim.setAnimate(koyomi,Anim.move_to_right) | ||
// koyomi.animate({right:'250px'}) | ||
}) | ||
var dialog=Engine.create_Dialog() | ||
// NOTE: 从文本文件读取剧情 | ||
var chapter1=file.load_Plot_Text("../chapter/1.txt") | ||
dialog.setContent(chapter1[0]) | ||
dialog.setDebugLog(true) | ||
//定义人物图片变化,定义bgm变化 | ||
// BUG: 这个地方有小bug 顺序问题, | ||
// dialog.setCustomActionAt(0,b) | ||
Engine.create_BackroundImg(bg) | ||
// dialog.changeImgAt(3,koyomi,"../img/k18.png") | ||
$("#hideDialog").click(function() | ||
{ | ||
dialog.toggle() | ||
}) | ||
/*-----自定义函数------*/ | ||
var effect=function() | ||
{ | ||
// alert("自定义事件1 背景模糊!") | ||
Effect.setImageEffect(bg,Effect.blur) | ||
Effect.setImageEffect(bg,Effect.blur,"20px") | ||
} | ||
var effect2=function() | ||
{ | ||
Effect.setImageEffect(bg,Effect.invert) | ||
Effect.setImageEffect(bg,Effect.invert,"100%") | ||
} | ||
var bright=function() | ||
{ | ||
Effect.setImageEffect(koyomi,Effect.bright) | ||
Effect.setImageEffect(koyomi,Effect.bright,"20%") | ||
} | ||
var gray=function() | ||
{ | ||
// Effect.clearAllEffect(koyomi) | ||
Effect.setImageEffect(koyomi,Effect.gray) | ||
Effect.setImageEffect(koyomi,Effect.gray,"100%") | ||
} | ||
var clear=function() | ||
{ | ||
Effect.clearAllEffect(bg) | ||
Effect.clearAllEffect(koyomi) | ||
} | ||
//事件 bug了 修好了 core.js计数器判断和执行方式推倒 重写 | ||
// dialog.changeBgmAt(1,"../bgm/i72008_momoiro_cherry.ogg") | ||
/*-------自定义函数----*/ | ||
// 设置文字大小 | ||
// dialog.setFontSize() | ||
// NOTE: 更换角色没有过度效果 过于突然 以后优化图像效果 | ||
/*--自定义函数绑定---*/ | ||
var s=function() | ||
{ | ||
Anim.setAnimate(koyomi,Anim.move_to_left) | ||
} | ||
dialog.changeImgAt(1,koyomi,"../img/k18.png") | ||
// dialog.setCustomActionAt(2,koyomi,koyomi.animate({right:'250px',opacity:'0.5'})) | ||
dialog.changeImgAt(2,koyomi,"../img/char.png") | ||
/*更换角色*/ | ||
// NOTE: 更换角色没有过度效果 过于突然 以后优化图像效果 | ||
dialog.changeImgAt(5,koyomi,"../img/c03.png") | ||
dialog.setCustomActionAt(14,effect) | ||
//反色 | ||
// //反色 | ||
dialog.changeImgAt(15,koyomi,"../img/k20.png") | ||
dialog.setCustomActionAt(15,effect2) | ||
dialog.changeBgmAt(15,"../bgm/i71009_asia.ogg") | ||
dialog.setCustomActionAt(17,bright) | ||
dialog.setCustomActionAt(18,gray) | ||
dialog.setCustomActionAt(19,clear) | ||
|
||
/*恢复原图*/ | ||
dialog.changeImgAt(20,koyomi,"../img/char.png") | ||
dialog.changeBgmAt(20,"../bgm/i71004_fresh.ogg") | ||
/*--自定义函数绑定---*/ | ||
|
||
//添加ui | ||
$("body").append(bg) | ||
$("body").append(koyomi) | ||
$("body").append(dialog) | ||
|
||
// NOTE: 绑定按钮code 存档 | ||
function bindingButtonAction(dialog) | ||
{ | ||
$("#clearCookie").click(function() | ||
{ | ||
$.removeCookie('runTimeIndex',{path:'/'}) | ||
}) | ||
$("#clearClicks").click(function() | ||
{ | ||
console.clear() | ||
console.warn("#清空计数器"); | ||
dialog.clearClicks() | ||
}) | ||
$("#reload").click(function() | ||
{ | ||
location.reload() | ||
}) | ||
$("#saveGame").click(function() | ||
{ | ||
console.warn("##存档!"); | ||
//在跳转存档页面之前,先暂存游戏运行状态执行到哪一个句子的index | ||
var index=dialog.getRuntimeIndex() | ||
console.warn("#运行状态"+index); | ||
$.cookie('runTimeIndex',index,{path:'/',secure:true}) | ||
//localStorage.setItem("test","test1ad3s1") | ||
//file.save("runTimeIndex",index) | ||
changeScene("../save.html") | ||
}) | ||
} | ||
bindingButtonAction(dialog) | ||
//从文本文件读取剧情 | ||
// 存档 | ||
$("#saveGame").click(function() | ||
{ | ||
console.warn("##存档!"); | ||
//在跳转存档页面之前,先暂存游戏运行状态执行到哪一个句子的index | ||
var index=dialog.getRuntimeIndex() | ||
console.warn("#运行状态"+index); | ||
$.cookie('runTimeIndex',index,{path:'/',secure:true}) | ||
// var todoObj=JSON.stringify({"todoActionIndex":todoActionIndexArray,"functions":functionsList}) | ||
// localStorage.setItem("todoData",todoObj) | ||
// changeScene("../save.html") | ||
}) | ||
|
||
// bindingButtonAction(dialog) | ||
}) |
This file was deleted.
Oops, something went wrong.
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,25 @@ | ||
.historyView | ||
{ | ||
border: solid; | ||
border-radius: 5px; | ||
background-color:#ACA772; | ||
transition: background-color 0.2s; | ||
margin-top:0px; | ||
} | ||
.historyView:hover | ||
{ | ||
background-color: white; | ||
} | ||
/* 列表 */ | ||
#HistoryPanel | ||
{ | ||
position: absolute; | ||
margin-top: 100px; | ||
margin-left: 200px; | ||
z-index:1 ; | ||
background-color:rgba(252,236,201,0.5) ; | ||
width:800px; | ||
height:600px; | ||
overflow:scroll; | ||
} | ||
/* @androids7 你重写的代码使用什么逻辑来写 */ |
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,28 @@ | ||
function AnimateEffect() | ||
{ | ||
console.log("#创建了动画模块"); | ||
var effects=["shake","move_to_left","move_to_right"] | ||
this.shake="shake" | ||
this.move_to_left="move_to_left" | ||
this.move_to_right="move_to_right" | ||
this.setAnimate=function(obj,effect) | ||
{ | ||
// for(var i=0;i<effects.length;i++) | ||
// { | ||
// if(effect==effects[i]) | ||
// { | ||
// obj.animate({effect:}) | ||
// } | ||
// } | ||
if(effect=="move_to_left") | ||
{ | ||
obj.animate({right:'250px'}) | ||
} | ||
if(effect=="move_to_right") | ||
{ | ||
obj.animate({left:'250px'}) | ||
} | ||
// obj.animate({right:'250px'}) | ||
} | ||
|
||
} |
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
Oops, something went wrong.