This commit is contained in:
@@ -23675,6 +23675,166 @@ cr.plugins_.Touch = function(runtime)
|
||||
}());
|
||||
;
|
||||
;
|
||||
cr.behaviors.Anchor = function(runtime)
|
||||
{
|
||||
this.runtime = runtime;
|
||||
};
|
||||
(function ()
|
||||
{
|
||||
var behaviorProto = cr.behaviors.Anchor.prototype;
|
||||
behaviorProto.Type = function(behavior, objtype)
|
||||
{
|
||||
this.behavior = behavior;
|
||||
this.objtype = objtype;
|
||||
this.runtime = behavior.runtime;
|
||||
};
|
||||
var behtypeProto = behaviorProto.Type.prototype;
|
||||
behtypeProto.onCreate = function()
|
||||
{
|
||||
};
|
||||
behaviorProto.Instance = function(type, inst)
|
||||
{
|
||||
this.type = type;
|
||||
this.behavior = type.behavior;
|
||||
this.inst = inst; // associated object instance to modify
|
||||
this.runtime = type.runtime;
|
||||
};
|
||||
var behinstProto = behaviorProto.Instance.prototype;
|
||||
behinstProto.onCreate = function()
|
||||
{
|
||||
this.anch_left = this.properties[0]; // 0 = left, 1 = right, 2 = none
|
||||
this.anch_top = this.properties[1]; // 0 = top, 1 = bottom, 2 = none
|
||||
this.anch_right = this.properties[2]; // 0 = none, 1 = right
|
||||
this.anch_bottom = this.properties[3]; // 0 = none, 1 = bottom
|
||||
this.inst.update_bbox();
|
||||
this.xleft = this.inst.bbox.left;
|
||||
this.ytop = this.inst.bbox.top;
|
||||
this.xright = this.runtime.original_width - this.inst.bbox.left;
|
||||
this.ybottom = this.runtime.original_height - this.inst.bbox.top;
|
||||
this.rdiff = this.runtime.original_width - this.inst.bbox.right;
|
||||
this.bdiff = this.runtime.original_height - this.inst.bbox.bottom;
|
||||
this.enabled = (this.properties[4] !== 0);
|
||||
};
|
||||
behinstProto.saveToJSON = function ()
|
||||
{
|
||||
return {
|
||||
"xleft": this.xleft,
|
||||
"ytop": this.ytop,
|
||||
"xright": this.xright,
|
||||
"ybottom": this.ybottom,
|
||||
"rdiff": this.rdiff,
|
||||
"bdiff": this.bdiff,
|
||||
"enabled": this.enabled
|
||||
};
|
||||
};
|
||||
behinstProto.loadFromJSON = function (o)
|
||||
{
|
||||
this.xleft = o["xleft"];
|
||||
this.ytop = o["ytop"];
|
||||
this.xright = o["xright"];
|
||||
this.ybottom = o["ybottom"];
|
||||
this.rdiff = o["rdiff"];
|
||||
this.bdiff = o["bdiff"];
|
||||
this.enabled = o["enabled"];
|
||||
};
|
||||
behinstProto.tick = function ()
|
||||
{
|
||||
if (!this.enabled)
|
||||
return;
|
||||
var n;
|
||||
var layer = this.inst.layer;
|
||||
var inst = this.inst;
|
||||
var bbox = this.inst.bbox;
|
||||
if (this.anch_left === 0)
|
||||
{
|
||||
inst.update_bbox();
|
||||
n = (layer.viewLeft + this.xleft) - bbox.left;
|
||||
if (n !== 0)
|
||||
{
|
||||
inst.x += n;
|
||||
inst.set_bbox_changed();
|
||||
}
|
||||
}
|
||||
else if (this.anch_left === 1)
|
||||
{
|
||||
inst.update_bbox();
|
||||
n = (layer.viewRight - this.xright) - bbox.left;
|
||||
if (n !== 0)
|
||||
{
|
||||
inst.x += n;
|
||||
inst.set_bbox_changed();
|
||||
}
|
||||
}
|
||||
if (this.anch_top === 0)
|
||||
{
|
||||
inst.update_bbox();
|
||||
n = (layer.viewTop + this.ytop) - bbox.top;
|
||||
if (n !== 0)
|
||||
{
|
||||
inst.y += n;
|
||||
inst.set_bbox_changed();
|
||||
}
|
||||
}
|
||||
else if (this.anch_top === 1)
|
||||
{
|
||||
inst.update_bbox();
|
||||
n = (layer.viewBottom - this.ybottom) - bbox.top;
|
||||
if (n !== 0)
|
||||
{
|
||||
inst.y += n;
|
||||
inst.set_bbox_changed();
|
||||
}
|
||||
}
|
||||
if (this.anch_right === 1)
|
||||
{
|
||||
inst.update_bbox();
|
||||
n = (layer.viewRight - this.rdiff) - bbox.right;
|
||||
if (n !== 0)
|
||||
{
|
||||
inst.width += n;
|
||||
if (inst.width < 0)
|
||||
inst.width = 0;
|
||||
inst.set_bbox_changed();
|
||||
}
|
||||
}
|
||||
if (this.anch_bottom === 1)
|
||||
{
|
||||
inst.update_bbox();
|
||||
n = (layer.viewBottom - this.bdiff) - bbox.bottom;
|
||||
if (n !== 0)
|
||||
{
|
||||
inst.height += n;
|
||||
if (inst.height < 0)
|
||||
inst.height = 0;
|
||||
inst.set_bbox_changed();
|
||||
}
|
||||
}
|
||||
};
|
||||
function Cnds() {};
|
||||
behaviorProto.cnds = new Cnds();
|
||||
function Acts() {};
|
||||
Acts.prototype.SetEnabled = function (e)
|
||||
{
|
||||
if (this.enabled && e === 0)
|
||||
this.enabled = false;
|
||||
else if (!this.enabled && e !== 0)
|
||||
{
|
||||
this.inst.update_bbox();
|
||||
this.xleft = this.inst.bbox.left;
|
||||
this.ytop = this.inst.bbox.top;
|
||||
this.xright = this.runtime.original_width - this.inst.bbox.left;
|
||||
this.ybottom = this.runtime.original_height - this.inst.bbox.top;
|
||||
this.rdiff = this.runtime.original_width - this.inst.bbox.right;
|
||||
this.bdiff = this.runtime.original_height - this.inst.bbox.bottom;
|
||||
this.enabled = true;
|
||||
}
|
||||
};
|
||||
behaviorProto.acts = new Acts();
|
||||
function Exps() {};
|
||||
behaviorProto.exps = new Exps();
|
||||
}());
|
||||
;
|
||||
;
|
||||
cr.behaviors.DragnDrop = function(runtime)
|
||||
{
|
||||
this.runtime = runtime;
|
||||
@@ -25071,18 +25231,20 @@ cr.getObjectRefTable = function () { return [
|
||||
cr.plugins_.Browser,
|
||||
cr.plugins_.Function,
|
||||
cr.plugins_.JSON,
|
||||
cr.plugins_.SpriteFontPlus,
|
||||
cr.plugins_.Sprite,
|
||||
cr.plugins_.SenaPlugin,
|
||||
cr.plugins_.Sprite,
|
||||
cr.plugins_.SpriteFontPlus,
|
||||
cr.plugins_.Touch,
|
||||
cr.behaviors.Fade,
|
||||
cr.behaviors.DragnDrop,
|
||||
cr.behaviors.Rex_MoveTo,
|
||||
cr.behaviors.Anchor,
|
||||
cr.behaviors.Sin,
|
||||
cr.behaviors.Pin,
|
||||
cr.system_object.prototype.cnds.OnLayoutStart,
|
||||
cr.plugins_.SenaPlugin.prototype.acts.Load,
|
||||
cr.system_object.prototype.acts.SetLayerVisible,
|
||||
cr.behaviors.Pin.prototype.acts.Pin,
|
||||
cr.plugins_.SenaPlugin.prototype.cnds.OnLoad,
|
||||
cr.plugins_.Browser.prototype.acts.ConsoleLog,
|
||||
cr.plugins_.SenaPlugin.prototype.exps.getGuide,
|
||||
@@ -25096,7 +25258,6 @@ cr.getObjectRefTable = function () { return [
|
||||
cr.plugins_.SenaPlugin.prototype.exps.getHintCount,
|
||||
cr.plugins_.Sprite.prototype.acts.Destroy,
|
||||
cr.system_object.prototype.acts.SetVar,
|
||||
cr.behaviors.Pin.prototype.acts.Pin,
|
||||
cr.plugins_.SpriteFontPlus.prototype.acts.SetText,
|
||||
cr.plugins_.SpriteFontPlus.prototype.acts.SetScale,
|
||||
cr.system_object.prototype.exps.clamp,
|
||||
@@ -25162,6 +25323,7 @@ cr.getObjectRefTable = function () { return [
|
||||
cr.behaviors.Rex_MoveTo.prototype.acts.SetTargetPosOnObject,
|
||||
cr.plugins_.Sprite.prototype.cnds.CompareFrame,
|
||||
cr.plugins_.Audio.prototype.acts.SetSilent,
|
||||
cr.plugins_.Sprite.prototype.acts.SetX,
|
||||
cr.behaviors.DragnDrop.prototype.cnds.OnDragStart,
|
||||
cr.plugins_.Sprite.prototype.cnds.CompareInstanceVar,
|
||||
cr.plugins_.Sprite.prototype.cnds.IsOverlapping,
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"version": 1772440274,
|
||||
"version": 1772512920,
|
||||
"fileList": [
|
||||
"data.js",
|
||||
"c2runtime.js",
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user