Skip to content
This repository has been archived by the owner on May 7, 2019. It is now read-only.

Commit

Permalink
Update
Browse files Browse the repository at this point in the history
  • Loading branch information
rexrainbow committed Jun 29, 2017
1 parent 6a9ffd3 commit f732134
Show file tree
Hide file tree
Showing 12 changed files with 130 additions and 130 deletions.
24 changes: 12 additions & 12 deletions behaviors/rex_bScenario/runtime.js
Original file line number Diff line number Diff line change
Expand Up @@ -515,7 +515,7 @@ cr.behaviors.rex_bScenario = function(runtime)

// variablies pool
this["Mem"] = {};
this.timer_save = null;
this.timerSave = null;

/**BEGIN-PREVIEWONLY**/
this.debugger_info = [];
Expand All @@ -542,7 +542,7 @@ cr.behaviors.rex_bScenario = function(runtime)
for (var k in this["Mem"])
delete this["Mem"][k];

this.timer_save = null;
this.timerSave = null;
};

ScenarioKlassProto.onDestroy = function ()
Expand Down Expand Up @@ -948,16 +948,16 @@ cr.behaviors.rex_bScenario = function(runtime)

ScenarioKlassProto.saveToJSON = function ()
{
var timer_save = null;
var timerSave = null;
if (this.timer != null)
{
timer_save = this.timer.saveToJSON();
timer_save["__cbargs"] = [this.timer._cb_name, this.timer._cb_params];
timerSave = this.timer.saveToJSON();
timerSave["__cbargs"] = [this.timer._cb_name, this.timer._cb_params];
}
return { "q": this.cmd_table.saveToJSON(),
"isrun": this.IsRunning,
"isp": this.is_pause,
"tim" : timer_save,
"tim" : timerSave,
"pa": this.pre_abs_time,
"off": this.offset,
"mem": this["Mem"],
Expand All @@ -969,7 +969,7 @@ cr.behaviors.rex_bScenario = function(runtime)
this.cmd_table.loadFromJSON(o["q"]);
this.IsRunning = o["isrun"];
this.is_pause = o["isp"];
this.timer_save = o["tim"];
this.timerSave = o["tim"];
this.pre_abs_time = o["pa"];
this.offset = o["off"];
this["Mem"] = o["mem"];
Expand All @@ -978,14 +978,14 @@ cr.behaviors.rex_bScenario = function(runtime)
};
ScenarioKlassProto.afterLoad = function ()
{
if (this.timer_save != null)
if (this.timerSave != null)
{
var timeline = this.plugin.type._timeline_get();
this.timer = timeline.LoadTimer(this.timer_save, on_timeout);
this.timer = timeline.LoadTimer(this.timerSave, on_timeout);
this.timer.plugin = this;
this.timer._cb_name = this.timer_save["__cbargs"][0];
this.timer._cb_params = this.timer_save["__cbargs"][1];
this.timer_save = null;
this.timer._cb_name = this.timerSave["__cbargs"][0];
this.timer._cb_params = this.timerSave["__cbargs"][1];
this.timerSave = null;
}
};

Expand Down
8 changes: 4 additions & 4 deletions behaviors/rex_cooldown/runtime.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ cr.behaviors.Rex_Cooldown = function(runtime)
this.is_request = false;
this.is_accept = false;
this.pre_is_at_cooldown = false;
this.timer_save = null;
this.timerSave = null;
this.is_custom_accept = false;
};

Expand Down Expand Up @@ -191,7 +191,7 @@ cr.behaviors.Rex_Cooldown = function(runtime)
this.cd_interval = o["t"];
this.is_accept = o["acc"];

this.timer_save = o["tim"];
this.timerSave = o["tim"];
this.type.timelineUid = o["tluid"];
};

Expand All @@ -205,11 +205,11 @@ cr.behaviors.Rex_Cooldown = function(runtime)
assert2(this.type.timeline, "Cooldown: Failed to find timeline object by UID");
}

if (this.timer_save == null)
if (this.timerSave == null)
this.timer = null;
else
{
this.timer = this.type.timeline.LoadTimer(this.timer_save, on_timeout);
this.timer = this.type.timeline.LoadTimer(this.timerSave, on_timeout);
this.timer.plugin = this;
}
this.timers_save = null;
Expand Down
28 changes: 14 additions & 14 deletions behaviors/rex_duration/runtime.js
Original file line number Diff line number Diff line change
Expand Up @@ -249,16 +249,16 @@ cr.behaviors.Rex_Duration = function(runtime)
behinstProto.saveToJSON = function ()
{
var tims_save = {};
var name, timer, timer_save;
var name, timer, timerSave;
for (name in this.timers)
{
timer = this.timers[name];
timer_save = timer.saveToJSON();
timer_save["_dt"] = timer._duration_time;
timer_save["_it"] = timer._interval_time;
timer_save["_drt"] = timer._duration_remain_time;
timer_save["_iss"] = timer.run_start;
tims_save[name] = timer_save;
timerSave = timer.saveToJSON();
timerSave["_dt"] = timer._duration_time;
timerSave["_it"] = timer._interval_time;
timerSave["_drt"] = timer._duration_remain_time;
timerSave["_iss"] = timer.run_start;
tims_save[name] = timerSave;

}
return { "tims": tims_save,
Expand Down Expand Up @@ -287,18 +287,18 @@ cr.behaviors.Rex_Duration = function(runtime)
this.timers = {};
else
{
var name, timer, timer_save;
var name, timer, timerSave;
for (name in this.timers_save)
{
timer_save = this.timers_save[name];
timerSave = this.timers_save[name];
timer = this.create_timer(name);

timer._duration_time = timer_save["_dt"];
timer._interval_time = timer_save["_it"];
timer._duration_remain_time = timer_save["_drt"];
timer.run_start = timer_save["_iss"];
timer._duration_time = timerSave["_dt"];
timer._interval_time = timerSave["_it"];
timer._duration_remain_time = timerSave["_drt"];
timer.run_start = timerSave["_iss"];

timer.loadFromJSON(timer_save);
timer.loadFromJSON(timerSave);
timer.afterLoad();
}
}
Expand Down
96 changes: 48 additions & 48 deletions behaviors/rex_text_typing/runtime.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,13 +67,13 @@ cr.behaviors.Rex_text_typing = function(runtime)
behinstProto.onCreate = function()
{
this.isLineBreak = (this.properties[0] === 1);
this.typing_timer = null;
this.typing_speed = 0;
this.typing_index = 0;
this.typingTimer = null;
this.typingspeed = 0;
this.typingIndex = 0;
this.content = "";
this.typing_content = null;
this.raw_text_length = 0;
this.timer_save = null;
this.typingContent = null;
this.rawTextLength = 0;
this.timerSave = null;
this.textObjType = this.getTextObjType();
this.SetTextFn = this.get_SetText_Fn(this.textObjType);
};
Expand Down Expand Up @@ -131,8 +131,8 @@ cr.behaviors.Rex_text_typing = function(runtime)

behinstProto.typing_timer_remove = function ()
{
if (this.typing_timer != null)
this.typing_timer.Remove();
if (this.typingTimer != null)
this.typingTimer.Remove();
};

behinstProto.tick = function ()
Expand Down Expand Up @@ -180,7 +180,7 @@ cr.behaviors.Rex_text_typing = function(runtime)

behinstProto._get_timer = function ()
{
var timer = this.typing_timer;
var timer = this.typingTimer;
if (timer == null)
{
var timeline = this.type._timeline_get();
Expand All @@ -198,22 +198,22 @@ cr.behaviors.Rex_text_typing = function(runtime)
text = this.lineBreakContent(text);
}

this.raw_text_length = this.get_rawTextLength(text);
this.rawTextLength = this.get_rawTextLength(text);
if (speed != 0)
{
if (start_index == null)
start_index = 1;

this.typing_timer = this._get_timer();
this.typing_content = text;
this.typing_speed = speed;
this.typing_index = start_index;
this.typing_timer.Start(0);
this.typingTimer = this._get_timer();
this.typingContent = text;
this.typingspeed = speed;
this.typingIndex = start_index;
this.typingTimer.Start(0);
}
else
{
this.typing_index = this.raw_text_length;
this.SetText(text, 0, this.typing_index);
this.typingIndex = this.rawTextLength;
this.SetText(text, 0, this.typingIndex);
this.runtime.trigger(cr.behaviors.Rex_text_typing.prototype.cnds.OnTypingCompleted, this.inst);
}
};
Expand All @@ -226,22 +226,22 @@ cr.behaviors.Rex_text_typing = function(runtime)

behinstProto.text_typing_handler = function()
{
this.SetText(this.typing_content, 0, this.typing_index);
this.SetText(this.typingContent, 0, this.typingIndex);
this.runtime.trigger(cr.behaviors.Rex_text_typing.prototype.cnds.OnTextTyping, this.inst);
this.typing_index += 1;
if (this.typing_index <= this.raw_text_length)
this.typing_timer.Restart(this.typing_speed);
this.typingIndex += 1;
if (this.typingIndex <= this.rawTextLength)
this.typingTimer.Restart(this.typingspeed);
else
{
this.typing_index = this.raw_text_length;
this.typing_content = null;
this.typingIndex = this.rawTextLength;
this.typingContent = null;
this.runtime.trigger(cr.behaviors.Rex_text_typing.prototype.cnds.OnTypingCompleted, this.inst);
}
};

behinstProto.is_typing = function ()
{
return (this.typing_timer)? this.typing_timer.IsActive():false;
return (this.typingTimer)? this.typingTimer.IsActive():false;
};


Expand Down Expand Up @@ -319,23 +319,23 @@ cr.behaviors.Rex_text_typing = function(runtime)
behinstProto.saveToJSON = function ()
{
return { "c": this.content,
"tc": this.typing_content,
"spd" : this.typing_speed,
"i" : this.typing_index,
"tc": this.typingContent,
"spd" : this.typingspeed,
"i" : this.typingIndex,

"tim": (this.typing_timer != null)? this.typing_timer.saveToJSON() : null,
"tim": (this.typingTimer != null)? this.typingTimer.saveToJSON() : null,
"tluid": (this.type.timeline != null)? this.type.timeline.uid: (-1)
};
};

behinstProto.loadFromJSON = function (o)
{
this.content = o["c"];
this.typing_content = o["tc"];
this.typing_speed = o["spd"];
this.typing_index = o["i"];
this.typingContent = o["tc"];
this.typingspeed = o["spd"];
this.typingIndex = o["i"];

this.timer_save = o["tim"];
this.timerSave = o["tim"];
this.type.timelineUid = o["tluid"];
};

Expand All @@ -349,12 +349,12 @@ cr.behaviors.Rex_text_typing = function(runtime)
assert2(this.type.timeline, "Timer: Failed to find timeline object by UID");
}

if (this.timer_save == null)
this.typing_timer = null;
if (this.timerSave == null)
this.typingTimer = null;
else
{
this.typing_timer = this.type.timeline.LoadTimer(this.timer_save, on_timeout);
this.typing_timer.plugin = this;
this.typingTimer = this.type.timeline.LoadTimer(this.timerSave, on_timeout);
this.typingTimer.plugin = this;
}
this.timers_save = null;
};
Expand Down Expand Up @@ -403,12 +403,12 @@ cr.behaviors.Rex_text_typing = function(runtime)

Acts.prototype.SetTypingSpeed = function(speed)
{
if (this.typing_speed === speed)
if (this.typingspeed === speed)
return;


this.typing_speed = speed;
var timer = this.typing_timer;
this.typingspeed = speed;
var timer = this.typingTimer;
if (timer == null)
return;

Expand All @@ -430,28 +430,28 @@ cr.behaviors.Rex_text_typing = function(runtime)

Acts.prototype.AppendText = function(param)
{
var start_index = this.raw_text_length;
var start_index = this.rawTextLength;
if (typeof param === "number")
param = Math.round(param * 1e10) / 1e10; // round to nearest ten billionth - hides floating point errors
this.content += param.toString();
if (!this.is_typing())
this.start_typing(this.content, this.typing_speed, start_index);
this.start_typing(this.content, this.typingspeed, start_index);
};

Acts.prototype.Pause = function ()
{
if (this.typing_timer == null)
if (this.typingTimer == null)
return;

this.typing_timer.Suspend();
this.typingTimer.Suspend();
};

Acts.prototype.Resume = function ()
{
if (this.typing_timer == null)
if (this.typingTimer == null)
return;

this.typing_timer.Resume();
this.typingTimer.Resume();
};
//////////////////////////////////////
// Expressions
Expand All @@ -460,12 +460,12 @@ cr.behaviors.Rex_text_typing = function(runtime)

Exps.prototype.TypingSpeed = function (ret)
{
ret.set_float( this.typing_speed );
ret.set_float( this.typingspeed );
};

Exps.prototype.TypingIndex = function (ret)
{
ret.set_float( this.typing_index -1 );
ret.set_float( this.typingIndex -1 );
};

Exps.prototype.Content = function (ret)
Expand All @@ -475,6 +475,6 @@ cr.behaviors.Rex_text_typing = function(runtime)

Exps.prototype.LastTypingCharacter = function (ret)
{
ret.set_string( this.content.charAt(this.typing_index-1) );
ret.set_string( this.content.charAt(this.typingIndex-1) );
};
}());
Loading

0 comments on commit f732134

Please sign in to comment.