diff --git a/behaviors/rex_text_scrolling/runtime.js b/behaviors/rex_text_scrolling/runtime.js index 64fbb96c..36e2a793 100644 --- a/behaviors/rex_text_scrolling/runtime.js +++ b/behaviors/rex_text_scrolling/runtime.js @@ -56,7 +56,7 @@ cr.behaviors.Rex_text_scrolling = function(runtime) this.textObjType = this.getTextObjType(); this.SetTextFn = this.getSetTextFn(); - this.init_content_lines(); + this.initContentLines(); }; behinstProto.getTextObjType = function () @@ -100,7 +100,7 @@ cr.behaviors.Rex_text_scrolling = function(runtime) return setTextFn; }; - behinstProto.init_content_lines = function () + behinstProto.initContentLines = function () { var setTextFn; if ((this.textObjType === "Text") || (this.textObjType === "Spritefont2") || (this.textObjType === "SpriteFontPlus")) @@ -127,8 +127,8 @@ cr.behaviors.Rex_text_scrolling = function(runtime) behinstProto.redrawText = function () { - var size_changed = (this.lastwidth !== this.inst.width) || (this.lastheight !== this.inst.height); - if (size_changed || this.textChanged) + var isSizeChanged = (this.lastwidth !== this.inst.width) || (this.lastheight !== this.inst.height); + if (isSizeChanged || this.textChanged) { this.SetContent(); this.textChanged = false; @@ -149,13 +149,13 @@ cr.behaviors.Rex_text_scrolling = function(runtime) return Math.floor(this.getLastStartLineIndex() * percent); }; - behinstProto.line2percent = function (line_index) + behinstProto.line2percent = function (lineIndex) { - var percent = line_index/this.getLastStartLineIndex(); + var percent = lineIndex/this.getLastStartLineIndex(); return cr.clamp(percent, 0, 1); }; - behinstProto.copy_content_lines = function () + behinstProto.copyContentLines = function () { if ((this.textObjType === "Text") || (this.textObjType === "Spritefont2") || (this.textObjType === "SpriteFontPlus")) { @@ -232,13 +232,13 @@ cr.behaviors.Rex_text_scrolling = function(runtime) { // render all content var inst = this.inst; - this.SetText(this.content); // start from line 0 + this.setText(this.content); // start from line 0 var ctx = (this.runtime.enableWebGL)? this.getWebglCtx():this.runtime.ctx; inst.draw(ctx); // call this function to get lines // copy content in lines, or pensMgr - this.copy_content_lines(); + this.copyContentLines(); // get total lines count this.totalLinesCnt = this.getTotalLinesCount(); // calc visible lines count @@ -248,8 +248,8 @@ cr.behaviors.Rex_text_scrolling = function(runtime) this.visibleLines -= 1; // only show visible lines - this.SetText(""); // clean remain text - this.SetText(this.getVisibleText(this.startLineIndex)); + this.setText(""); // clean remain text + this.setText(this.getVisibleText(this.startLineIndex)); }; behinstProto.getLineHeight = function () @@ -267,7 +267,7 @@ cr.behaviors.Rex_text_scrolling = function(runtime) }; - behinstProto.SetText = function (content) + behinstProto.setText = function (content) { if (this.SetTextFn == null) return; @@ -362,7 +362,7 @@ cr.behaviors.Rex_text_scrolling = function(runtime) function Acts() {}; behaviorProto.acts = new Acts(); - var _param2string = function (param) + var param2string = function (param) { if (typeof param === "number") param = Math.round(param * 1e10) / 1e10; // round to nearest ten billionth - hides floating point errors @@ -371,7 +371,7 @@ cr.behaviors.Rex_text_scrolling = function(runtime) Acts.prototype.SetContent = function(param) { - this.content = _param2string(param); + this.content = param2string(param); this.startLineIndex = 0; this.SetContent(); }; @@ -381,49 +381,49 @@ cr.behaviors.Rex_text_scrolling = function(runtime) this.redrawText(); this.linePositionInPercent = cr.clamp(percent, 0, 1); var startLineIndex = this.perent2line(this.linePositionInPercent); - this.SetText(this.getVisibleText(startLineIndex)); + this.setText(this.getVisibleText(startLineIndex)); }; Acts.prototype.AppendContent = function(param) { - this.content += _param2string(param); + this.content += param2string(param); this.textChanged = true; }; - Acts.prototype.ScrollToLineIndex = function(line_index) + Acts.prototype.ScrollToLineIndex = function(lineIndex) { this.redrawText(); - this.SetText(this.getVisibleText(line_index)); + this.setText(this.getVisibleText(lineIndex)); }; Acts.prototype.NextLine = function() { this.redrawText(); - this.SetText(this.getVisibleText(this.startLineIndex+1)); + this.setText(this.getVisibleText(this.startLineIndex+1)); }; Acts.prototype.PreviousLine = function() { this.redrawText(); - this.SetText(this.getVisibleText(this.startLineIndex-1)); + this.setText(this.getVisibleText(this.startLineIndex-1)); }; Acts.prototype.NextPage = function() { this.redrawText(); - this.SetText(this.getVisibleText(this.startLineIndex+this.visibleLines)); + this.setText(this.getVisibleText(this.startLineIndex+this.visibleLines)); }; Acts.prototype.PreviousPage = function() { this.redrawText(); - this.SetText(this.getVisibleText(this.startLineIndex-this.visibleLines)); + this.setText(this.getVisibleText(this.startLineIndex-this.visibleLines)); }; Acts.prototype.ScrollToPageIndex = function(page_index) { this.redrawText(); - this.SetText(this.getVisibleText(page_index*this.visibleLines)); + this.setText(this.getVisibleText(page_index*this.visibleLines)); }; ////////////////////////////////////// diff --git a/plugins/rex_achievements/runtime.js b/plugins/rex_achievements/runtime.js index f6f5a867..14f33438 100644 --- a/plugins/rex_achievements/runtime.js +++ b/plugins/rex_achievements/runtime.js @@ -520,7 +520,7 @@ cr.plugins_.Rex_Achievements = function(runtime) return "(prop['"+prop_name+"']"+cond+")" } - AchievementKlassProto.CreateTestCode = function(prop_names, d, line_index) + AchievementKlassProto.CreateTestCode = function(prop_names, d, lineIndex) { this.name = d[1]; this.flag = false; @@ -546,7 +546,7 @@ cr.plugins_.Rex_Achievements = function(runtime) } catch(err) { - assert2(null, "Lookup plugin: parse line " + line_index + " failed."); + assert2(null, "Lookup plugin: parse line " + lineIndex + " failed."); } }; diff --git a/plugins/rex_gridCtrl/runtime.js b/plugins/rex_gridCtrl/runtime.js index 8676fd16..8f3946d1 100644 --- a/plugins/rex_gridCtrl/runtime.js +++ b/plugins/rex_gridCtrl/runtime.js @@ -175,7 +175,7 @@ cr.plugins_.Rex_GridCtrl = function(runtime) if (col_index < 0) col_index = 0; - var line_index = this.lines_mgr.XY2LineIndex(col_index, row_index); + var lineIndex = this.lines_mgr.XY2LineIndex(col_index, row_index); // end condition var bottom_bound = this.get_bottom_bound(); @@ -192,9 +192,9 @@ cr.plugins_.Rex_GridCtrl = function(runtime) // visible lines var line_tlx0=this.get_tlX(col_index), line_tlx=line_tlx0; var line_tly=this.get_tlY(row_index); - while ((line_tly < bottom_bound) && (line_index <= last_index)) + while ((line_tly < bottom_bound) && (lineIndex <= last_index)) { - if (this.lines_mgr.IsInRange(line_index)) + if (this.lines_mgr.IsInRange(lineIndex)) { if (this.visibleY_start === null) { @@ -213,19 +213,19 @@ cr.plugins_.Rex_GridCtrl = function(runtime) if (this.visibleX_end < col_index) this.visibleX_end = col_index; - this.visibleLineIndexes[line_index] = true; + this.visibleLineIndexes[lineIndex] = true; - line = this.lines_mgr.GetLine(line_index); + line = this.lines_mgr.GetLine(lineIndex); line.SetTLXY(line_tlx, line_tly); - if (this.pre_visibleLineIndexes.hasOwnProperty(line_index)) + if (this.pre_visibleLineIndexes.hasOwnProperty(lineIndex)) { line.PinInsts(); } else { // on line visible - this.show_line(line_index, line_tlx, line_tly); + this.show_line(lineIndex, line_tlx, line_tly); } } @@ -243,13 +243,13 @@ cr.plugins_.Rex_GridCtrl = function(runtime) row_index += 1; } - line_index = this.lines_mgr.XY2LineIndex(col_index, row_index); + lineIndex = this.lines_mgr.XY2LineIndex(col_index, row_index); } }; - instanceProto.show_line = function(line_index, tlx, tly) + instanceProto.show_line = function(lineIndex, tlx, tly) { - this.exp_CellIndex = line_index; + this.exp_CellIndex = lineIndex; if (this.is_vertical_scrolling) { @@ -278,13 +278,13 @@ cr.plugins_.Rex_GridCtrl = function(runtime) } }; - instanceProto.hide_line = function(line_index) + instanceProto.hide_line = function(lineIndex) { - this.exp_CellIndex = parseInt(line_index); + this.exp_CellIndex = parseInt(lineIndex); this.runtime.trigger(cr.plugins_.Rex_GridCtrl.prototype.cnds.OnCellInvisible, this); // destroy instances in the line - this.lines_mgr.DestroyPinedInsts(line_index); + this.lines_mgr.DestroyPinedInsts(lineIndex); }; instanceProto.get_tlX = function(col_index) @@ -417,13 +417,13 @@ cr.plugins_.Rex_GridCtrl = function(runtime) this.is_out_right_bound = is_out_right_bound; }; - instanceProto.is_visible = function(line_index) + instanceProto.is_visible = function(lineIndex) { if (this.visibleY_start == null) return false; - var row_index = this.lines_mgr.LineIndex2RowIndex(line_index); - var col_index = this.lines_mgr.LineIndex2ColIndex(line_index); + var row_index = this.lines_mgr.LineIndex2RowIndex(lineIndex); + var col_index = this.lines_mgr.LineIndex2ColIndex(lineIndex); return (row_index >= this.visibleY_start) && (row_index <= this.visibleY_end) && (col_index >= this.visibleX_start) && (col_index <= this.visibleX_end); }; @@ -470,34 +470,34 @@ cr.plugins_.Rex_GridCtrl = function(runtime) this.update_flag = true; }; - instanceProto.insert_cells = function (line_index, content) + instanceProto.insert_cells = function (lineIndex, content) { content = get_content(content); if (content === null) return; var cnt = content.length; - if (this.is_visible(line_index)) + if (this.is_visible(lineIndex)) { var i; for(i=0; i total_lines) - cnt = total_lines - line_index; + if ( (lineIndex + cnt) > total_lines) + cnt = total_lines - lineIndex; - if (this.is_visible(line_index)) + if (this.is_visible(lineIndex)) { var i; for(i=0; i= 0) && (line_index < this.GetLinesCount())); + return ((lineIndex >= 0) && (lineIndex < this.GetLinesCount())); }; LinesMgrKlassProto.GetNewLine = function() @@ -1382,61 +1382,61 @@ cr.plugins_.Rex_GridCtrl = function(runtime) return line; }; - LinesMgrKlassProto.GetLine = function(line_index, dont_create_line_inst) + LinesMgrKlassProto.GetLine = function(lineIndex, dont_create_line_inst) { - if ((line_index >= this.GetLinesCount()) || (line_index < 0)) + if ((lineIndex >= this.GetLinesCount()) || (lineIndex < 0)) return; - if ((this.lines[line_index] == null) && (!dont_create_line_inst)) + if ((this.lines[lineIndex] == null) && (!dont_create_line_inst)) { // TODO: allocate a line - this.lines[line_index] = this.GetNewLine(); + this.lines[lineIndex] = this.GetNewLine(); } - return this.lines[line_index]; + return this.lines[lineIndex]; }; - LinesMgrKlassProto.AddInstToLine = function(line_index, inst) + LinesMgrKlassProto.AddInstToLine = function(lineIndex, inst) { if (inst == null) return; - var line = this.GetLine(line_index); + var line = this.GetLine(lineIndex); if (line == null) return; line.AddInst(inst); }; - LinesMgrKlassProto.RemoveInstFromLine = function(line_index, uid) + LinesMgrKlassProto.RemoveInstFromLine = function(lineIndex, uid) { - var line = this.GetLine(line_index, true); + var line = this.GetLine(lineIndex, true); if (line == null) return; line.RemoveInst(uid); }; - LinesMgrKlassProto.LineHasInst = function(line_index, uid) + LinesMgrKlassProto.LineHasInst = function(lineIndex, uid) { - var line = this.GetLine(line_index, true); + var line = this.GetLine(lineIndex, true); if (line == null) return; return line.HasInst(uid); }; - LinesMgrKlassProto.DestroyPinedInsts = function(line_index) + LinesMgrKlassProto.DestroyPinedInsts = function(lineIndex) { - var line = this.GetLine(line_index, true); + var line = this.GetLine(lineIndex, true); if (line == null) return; line.DestroyPinedInsts(); }; - LinesMgrKlassProto.SetCustomData = function(line_index, k, v) + LinesMgrKlassProto.SetCustomData = function(lineIndex, k, v) { - if (line_index != null) // set custom data in a line + if (lineIndex != null) // set custom data in a line { - var line = this.GetLine(line_index); + var line = this.GetLine(lineIndex); if (line == null) return; @@ -1457,35 +1457,35 @@ cr.plugins_.Rex_GridCtrl = function(runtime) } }; - LinesMgrKlassProto.GetCustomData = function(line_index, k) + LinesMgrKlassProto.GetCustomData = function(lineIndex, k) { - var line = this.GetLine(line_index, true); + var line = this.GetLine(lineIndex, true); if (line == null) return; return line.GetCustomData(k); }; - LinesMgrKlassProto.InsertLines = function(line_index, content) + LinesMgrKlassProto.InsertLines = function(lineIndex, content) { var cnt = content.length; - if (line_index < 0) - line_index = 0; - else if (line_index > this.GetLinesCount()) - line_index = this.GetLinesCount(); + if (lineIndex < 0) + lineIndex = 0; + else if (lineIndex > this.GetLinesCount()) + lineIndex = this.GetLinesCount(); this.lines.length += cnt; var start = this.GetLinesCount() - 1; - var end = line_index + cnt; + var end = lineIndex + cnt; var i, insert_line, new_line; - for (i=start; i>=line_index; i--) + for (i=start; i>=lineIndex; i--) { if (i>=end) // shift line down this.lines[i] = this.lines[i-cnt]; else // empty space { - insert_line = content[i-line_index]; + insert_line = content[i-lineIndex]; if (insert_line == null) this.lines[i] = null; else @@ -1498,13 +1498,13 @@ cr.plugins_.Rex_GridCtrl = function(runtime) } }; - LinesMgrKlassProto.RemoveLines = function(line_index, cnt) + LinesMgrKlassProto.RemoveLines = function(lineIndex, cnt) { var i, line, removed_lines=[]; removed_lines.length = cnt; for (i=0; i= this.visible_start) && (line_index <= this.visible_end); + return (lineIndex >= this.visible_start) && (lineIndex <= this.visible_end); }; var NEWLINES = []; @@ -356,33 +356,33 @@ cr.plugins_.Rex_ListCtrl = function(runtime) this.update_flag = true; }; - instanceProto.insert_lines = function (line_index, content) + instanceProto.insert_lines = function (lineIndex, content) { content = get_content(content); if (content === null) return; var cnt = content.length; - if (this.is_visible(line_index)) + if (this.is_visible(lineIndex)) { var i; for(i=0; i total_lines) - cnt = total_lines - line_index; + if ( (lineIndex + cnt) > total_lines) + cnt = total_lines - lineIndex; - if (this.is_visible(line_index)) + if (this.is_visible(lineIndex)) { var i; for(i=0; i= 0) && (line_index < this.GetLinesCount())); + return ((lineIndex >= 0) && (lineIndex < this.GetLinesCount())); }; LinesMgrKlassProto.GetNewLine = function() @@ -1051,60 +1051,60 @@ cr.plugins_.Rex_ListCtrl = function(runtime) return line; }; - LinesMgrKlassProto.GetLine = function(line_index, dont_create_line_inst) + LinesMgrKlassProto.GetLine = function(lineIndex, dont_create_line_inst) { - if (!this.IsInRange(line_index)) + if (!this.IsInRange(lineIndex)) return; - if ((this.lines[line_index] == null) && (!dont_create_line_inst)) + if ((this.lines[lineIndex] == null) && (!dont_create_line_inst)) { - this.lines[line_index] = this.GetNewLine(); + this.lines[lineIndex] = this.GetNewLine(); } - return this.lines[line_index]; + return this.lines[lineIndex]; }; - LinesMgrKlassProto.AddInstToLine = function(line_index, inst) + LinesMgrKlassProto.AddInstToLine = function(lineIndex, inst) { if (inst == null) return; - var line = this.GetLine(line_index); + var line = this.GetLine(lineIndex); if (line == null) return; line.AddInst(inst); }; - LinesMgrKlassProto.RemoveInstFromLine = function(line_index, uid) + LinesMgrKlassProto.RemoveInstFromLine = function(lineIndex, uid) { - var line = this.GetLine(line_index, true); + var line = this.GetLine(lineIndex, true); if (line == null) return; line.RemoveInst(uid); }; - LinesMgrKlassProto.LineHasInst = function(line_index, uid) + LinesMgrKlassProto.LineHasInst = function(lineIndex, uid) { - var line = this.GetLine(line_index, true); + var line = this.GetLine(lineIndex, true); if (line == null) return; return line.HasInst(uid); }; - LinesMgrKlassProto.DestroyPinedInsts = function(line_index) + LinesMgrKlassProto.DestroyPinedInsts = function(lineIndex) { - var line = this.GetLine(line_index, true); + var line = this.GetLine(lineIndex, true); if (line == null) return; line.DestroyPinedInsts(); }; - LinesMgrKlassProto.SetCustomData = function(line_index, k, v) + LinesMgrKlassProto.SetCustomData = function(lineIndex, k, v) { - if (line_index != null) // set custom data in a line + if (lineIndex != null) // set custom data in a line { - var line = this.GetLine(line_index); + var line = this.GetLine(lineIndex); if (line == null) return; @@ -1125,35 +1125,35 @@ cr.plugins_.Rex_ListCtrl = function(runtime) } }; - LinesMgrKlassProto.GetCustomData = function(line_index, k) + LinesMgrKlassProto.GetCustomData = function(lineIndex, k) { - var line = this.GetLine(line_index, true); + var line = this.GetLine(lineIndex, true); if (line == null) return; return line.GetCustomData(k); }; - LinesMgrKlassProto.InsertLines = function(line_index, content) + LinesMgrKlassProto.InsertLines = function(lineIndex, content) { var cnt = content.length; - if (line_index < 0) - line_index = 0; - else if (line_index > this.GetLinesCount()) - line_index = this.GetLinesCount(); + if (lineIndex < 0) + lineIndex = 0; + else if (lineIndex > this.GetLinesCount()) + lineIndex = this.GetLinesCount(); this.lines.length += cnt; var start = this.GetLinesCount() - 1; - var end = line_index + cnt; + var end = lineIndex + cnt; var i, insert_line, new_line; - for (i=start; i>=line_index; i--) + for (i=start; i>=lineIndex; i--) { if (i>=end) // shift line down this.lines[i] = this.lines[i-cnt]; else // empty space { - insert_line = content[i-line_index]; + insert_line = content[i-lineIndex]; if (insert_line == null) this.lines[i] = null; else @@ -1168,13 +1168,13 @@ cr.plugins_.Rex_ListCtrl = function(runtime) this.totalLinesHeight = null; }; - LinesMgrKlassProto.RemoveLines = function(line_index, cnt) + LinesMgrKlassProto.RemoveLines = function(lineIndex, cnt) { var i, line, removed_lines=[]; removed_lines.length = cnt; for (i=0; i=0) && (line_index < total_ines_cnt); + is_valid_index = (lineIndex >=0) && (lineIndex < total_ines_cnt); if ((remain > 0) && is_valid_index) { - line_index += 1; + lineIndex += 1; } else if (remain === 0) - return line_index; + return lineIndex; else { if (isCeil) { - var line_index_save = line_index; - line_index += 1; - is_valid_index = (line_index >=0) && (line_index < total_ines_cnt); + var line_index_save = lineIndex; + lineIndex += 1; + is_valid_index = (lineIndex >=0) && (lineIndex < total_ines_cnt); if (!is_valid_index) - line_index = line_index_save; + lineIndex = line_index_save; } - return line_index; + return lineIndex; } } } diff --git a/plugins/rex_lookup/runtime.js b/plugins/rex_lookup/runtime.js index 6832b892..eb84a5e1 100644 --- a/plugins/rex_lookup/runtime.js +++ b/plugins/rex_lookup/runtime.js @@ -442,7 +442,7 @@ cr.plugins_.Rex_Lookup = function(runtime) return "(prop['"+prop_name+"']"+cond+")" } - TestKlassProto.CreateTestCode = function(prop_names, d, line_index) + TestKlassProto.CreateTestCode = function(prop_names, d, lineIndex) { var name = d[0]; var i, cnt=d.length; @@ -465,7 +465,7 @@ cr.plugins_.Rex_Lookup = function(runtime) } catch(err) { - assert2(null, "Lookup plugin: parse line " + line_index + " failed."); + assert2(null, "Lookup plugin: parse line " + lineIndex + " failed."); } return name; };