-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsceneControl.js
More file actions
126 lines (105 loc) · 2.97 KB
/
sceneControl.js
File metadata and controls
126 lines (105 loc) · 2.97 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
// ----------------------------------------------------------------------
// GameTask
class sceneControl extends GameTask {
constructor(id){
super(id);
let io, stf, waitc;
let keyon;
//let runstep;
const keywait = 100; //0.10s
this.init = function(g){
//create
}
this.pre = function(g){
io = g.task.read("io");
this.moveEffect = new moveEffect(g);
this.moveEffect.setDrawIndex(160, 0);
this.monsHpView = new monsHpView(g);
this.monsHpView.setDrawIndex(160, -8);
//let mode = document.getElementById("lang").checked;
const r = new GameManager(g);// ,mode? "jp":"en");
g.rogue = r;
const wName = ["0:MAIN_BG","1:MAIN","2:MAIN_FG","3:STATUS",
"4:EQUIP","5:MESSAGE","6:WINDOW","7:COMMENT","8:ENTITY"];
for (let i in wName){
//g.console[i].printw(`console:${wName[i]}`);
//g.console[i].insertln();
}
stf = false;
waitc = 60;
this.runstep = 0;
keyon = g.time();
this.setCameraPos = function(x, y){
io.camera.x = x*8;
io.camera.y = y*16;
};
this.setCameraEnable = function(flg){
io.camera.enable = flg;
};
}
this.step = function(g){
waitc++;
if (!stf && (waitc > 60)){//90
stf = true;
//g.console[2].insertln();
io.debugview = false;
io.overlapview = false;
for (let i=0; i<=6; i++){
//g.console[i].insertln();
//g.console[i].printw(`rouge.start()`);
}
//g.console[3].clear();
//
g.rogue.main();
}else{
if ((waitc%10)==0 && !stf){
io.debugview = true;
io.overlapview = true;
//g.console[2].insertln();
//g.console[2].printw(`start-wait:${10-Math.floor(waitc/9)}`);
//g.console[3].insertln();
for (let i=0; i<=6; i++)
g.console[i].printw("rogue progress wait" + "..........".substring(0,Math.floor(waitc/9)));
}
}
if (stf){
if (keyon < g.time()){
const keys = io.input.keylist;
if (keys.length > 0){
const fl = (keys.includes("ControlLeft") || keys.includes("ControlRight") ||
keys.includes("ShiftLeft") || keys.includes("ShiftRight") ||
keys.includes("Home") || keys.includes("End") ||
keys.includes("PageUp") || keys.includes("PageDown") ||
keys.includes("CapsLock") || keys.includes("Space"));
if (keys.length > (fl?1:0)) {
g.rogue.scenestep();
this.runstep++;
}
if (!g.rogue.playing){
if (keys.includes("Space"))
g.rogue.playing = true;
}
keyon = g.time() + keywait;
//if (fl) keyon += keywait*2;
}
}else{
//no input
if (!g.rogue.haste && this.runstep%2 == 0){
g.rogue.scenestep();
this.runstep++;
}
}
}
}
this.draw = function(g){
if (io.debugview)
g.font["small"].putchr(`STEP:${this.runstep} ${this.runstep%2==0?"haste":"normal"}`, 840, 8);
this.monsHpView.draw(g);
this.moveEffect.step();
this.moveEffect.step();
this.moveEffect.step();
this.moveEffect.draw(g);
//console draw io
}
}
}