2018-10-27

var GLL = function(){

? ? ? ? this.isMided = false;

? ? ? ? this.position = new THREE.Vector3()

? ? ? ? this.objs = [];

? ? ? ? this.scale = {x:0,y:0,z:0}

? ? }

? ? var G__ = function(){

? ? ? ? this.isMided = false;

? ? ? ? this.position = new THREE.Vector3()

? ? ? ? this.objs = [];

? ? ? ? this.scale = {x:0,y:0,z:0}

? ? }

? ? function l_begin() {return new GLL();}

? ? function __begin() {return new G__();}

? ? function dsk(){

? ? ? ? return addDesk();

? ? }

? ? function bd(w){

? ? ? ? w = w || c.roomWidth/2

? ? ? ? var bd = hp.addBox(w, c.boardHeight, canRad*2,? 0, 0, 0, {move:true})

? ? ? ? arrTarget.push(bd);

? ? ? ? return? bd ;

? ? }

? ? function can(){

? ? ? ? return addCan()

? ? }

? ? o = function o(x){

? ? ? ? x = x || canWidth

? ? ? ? return {

? ? ? ? ? ? ? scale:{x:x},

? ? ? ? ? ? ? position:{? set:function(){}, copy:function(){}? },

? ? ? ? ? ? ? body:{

? ? ? ? ? ? ? ? position:{? set:function(){}, copy:function(){}? }

? ? ? ? ? ? ? }

? ? ? ? ? ? }

? ? }

? ? GLL.prototype.pu = G__.prototype.pu = function(){

? ? ? ? for (var i = 0; i < arguments.length; ++i){

? ? ? ? ? ? this.objs.push(arguments[i]);

? ? ? ? }

? ? }

? ? GLL.prototype.end = G__.prototype.end = function(baba){

? ? ? ? baba.objs.push(this)

? ? }

? ? GLL.prototype.movVec3 = G__.prototype.movVec3 = function(vec3){

? ? ? ? this.objs.forEach(item => {

? ? ? ? ? ? if (item.objs){//組對象

? ? ? ? ? ? ? ? item.movVec3(vec3)

? ? ? ? ? ? }

? ? ? ? ? ? else{

? ? ? ? ? ? ? ? item.body.position.x += vec3.x ;

? ? ? ? ? ? ? ? item.body.position.y += vec3.y ;

? ? ? ? ? ? ? ? item.body.position.z += vec3.z ;

? ? ? ? ? ? ? ? if (item.body.type === 2) {//static

? ? ? ? ? ? ? ? ? ? item.body.syncShapes();

? ? ? ? ? ? ? ? ? ? item.position.copy( item.body.position )

? ? ? ? ? ? ? ? }

? ? ? ? ? ? }

? ? ? ? })

? ? };

? ? GLL.prototype.movX = G__.prototype.movX = function(val){

? ? ? ? this.objs.forEach(item => {

? ? ? ? ? ? if (item.objs){//組對象

? ? ? ? ? ? ? ? item.movX(val)

? ? ? ? ? ? }

? ? ? ? ? ? else{

? ? ? ? ? ? ? ? item.body.position.x += val ;

? ? ? ? ? ? ? ? if (item.body.type === 2) {//static

? ? ? ? ? ? ? ? ? ? item.body.syncShapes();

? ? ? ? ? ? ? ? ? ? item.position.copy( item.body.position )

? ? ? ? ? ? ? ? }

? ? ? ? ? ? }

? ? ? ? })

? ? };

? ? GLL.prototype.posLeft = function(x, y, z){

? ? ? ? this.isMided = false;

? ? ? ? this.position.set(x,y,z)


? ? ? ? var topY = y;

? ? ? ? this.objs.forEach(item => {

? ? ? ? ? ? if (item.objs){//組對象

? ? ? ? ? ? ? ? if (item.isMided){

? ? ? ? ? ? ? ? ? ? var vec3 =? {x: x - item.position.x , y: topY - item.position.y, z: z - item.position.z}

? ? ? ? ? ? ? ? ? ? item.movVec3(vec3)

? ? ? ? ? ? ? ? }else

? ? ? ? ? ? ? ? ? ? item.posLeft(x, topY, z)


? ? ? ? ? ? }

? ? ? ? ? ? else{

? ? ? ? ? ? ? ? var posX = x + item.scale.x/2;

? ? ? ? ? ? ? ? var posY = topY + item.scale.y/2;

? ? ? ? ? ? ? ? item.body.position.set(posX, posY, z)

? ? ? ? ? ? ? ? if (item.body.type === 2) {//static

? ? ? ? ? ? ? ? ? ? item.body.syncShapes();

? ? ? ? ? ? ? ? ? ? item.position.set(posX, posY, z)

? ? ? ? ? ? ? ? }

? ? ? ? ? ? }

? ? ? ? ? ? topY += item.scale.y

? ? ? ? ? ? if (this.scale.x < item.scale.x) //找出最寬item

? ? ? ? ? ? ? ? this.scale.x = item.scale.x;

? ? ? ? });

? ? ? ? this.scale.y = topY - y;

? ? }

? ? G__.prototype.posLeft = function(x, y, z){

? ? ? ? this.isMided = false;

? ? ? ? this.position.set(x,y,z)


? ? ? ? var endX = x;

? ? ? ? this.objs.forEach(item => {

? ? ? ? ? ? if (item.objs){//組對象

? ? ? ? ? ? ? ? if (item.isMided){

? ? ? ? ? ? ? ? ? ? var vec3 =? {x: endX - item.position.x , y: y - item.position.y, z: z - item.position.z}

? ? ? ? ? ? ? ? ? ? item.movVec3(vec3)

? ? ? ? ? ? ? ? }else

? ? ? ? ? ? ? ? ? ? item.posLeft(endX, y, z)

? ? ? ? ? ? }

? ? ? ? ? ? else {

? ? ? ? ? ? ? ? var posX = endX + item.scale.x/2;

? ? ? ? ? ? ? ? var posY = y + item.scale.y/2;

? ? ? ? ? ? ? ? item.body.position.set(posX, posY, z)

? ? ? ? ? ? ? ? if (item.body.type === 2) {//static

? ? ? ? ? ? ? ? ? ? item.body.syncShapes();

? ? ? ? ? ? ? ? ? ? item.position.set(posX, posY, z)

? ? ? ? ? ? ? ? }

? ? ? ? ? ? }

? ? ? ? ? ? endX += item.scale.x

? ? ? ? ? ? if (this.scale.y < item.scale.y) //找出最高item

? ? ? ? ? ? ? ? this.scale.y = item.scale.y;

? ? ? ? });

? ? ? ? this.scale.x = endX - x;

? ? }

? ? GLL.prototype.posMid = function(){

? ? ? ? if (this.isMided)

? ? ? ? ? ? return;

? ? ? ? this.isMided = true;

? ? ? ? this.position.x -= this.scale.x/2

? ? ? ? this.objs.forEach(item => {

? ? ? ? ? ? var val = -item.scale.x/2;

? ? ? ? ? ? if (item.objs){//組對象

? ? ? ? ? ? ? ? item.movX(val)

? ? ? ? ? ? }

? ? ? ? ? ? else {

? ? ? ? ? ? ? ? item.body.position.x += val

? ? ? ? ? ? ? ? if (item.body.type === 2) {//static

? ? ? ? ? ? ? ? ? ? item.body.syncShapes();

? ? ? ? ? ? ? ? ? ? item.position.x = item.body.position.x

? ? ? ? ? ? ? ? }

? ? ? ? ? ? }

? ? ? ? })

? ? }

? ? G__.prototype.posMid = function(){

? ? ? ? if (this.isMided)

? ? ? ? ? ? return;

? ? ? ? this.isMided = true;

? ? ? ? this.position.x -= this.scale.x/2?

? ? ? ? var val = -this.scale.x/2

? ? ? ? this.objs.forEach(item => {

? ? ? ? ? ? if (item.objs){//組對象

? ? ? ? ? ? ? ? item.movX(val)

? ? ? ? ? ? }

? ? ? ? ? ? else {

? ? ? ? ? ? ? ? item.body.position.x +=? val;

? ? ? ? ? ? ? ? if (item.body.type === 2) {//static

? ? ? ? ? ? ? ? ? ? item.body.syncShapes();

? ? ? ? ? ? ? ? ? ? item.position.x = item.body.position.x

? ? ? ? ? ? ? ? }

? ? ? ? ? ? }

? ? ? ? })

? ? }

? ? G__.prototype.pos = GLL.prototype.pos = function(x, y, z){

? ? ? ? this.posLeft(x, y, z);

? ? ? ? this.posMid();

? ? }

?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
  • 序言:七十年代末狂芋,一起剝皮案震驚了整個濱河市,隨后出現(xiàn)的幾起案子弃锐,更是在濱河造成了極大的恐慌洛退,老刑警劉巖,帶你破解...
    沈念sama閱讀 216,692評論 6 501
  • 序言:濱河連續(xù)發(fā)生了三起死亡事件署照,死亡現(xiàn)場離奇詭異功戚,居然都是意外死亡缨该,警方通過查閱死者的電腦和手機别凤,發(fā)現(xiàn)死者居然都...
    沈念sama閱讀 92,482評論 3 392
  • 文/潘曉璐 我一進店門饰序,熙熙樓的掌柜王于貴愁眉苦臉地迎上來,“玉大人规哪,你說我怎么就攤上這事求豫。” “怎么了诉稍?”我有些...
    開封第一講書人閱讀 162,995評論 0 353
  • 文/不壞的土叔 我叫張陵蝠嘉,是天一觀的道長。 經(jīng)常有香客問我杯巨,道長蚤告,這世上最難降的妖魔是什么? 我笑而不...
    開封第一講書人閱讀 58,223評論 1 292
  • 正文 為了忘掉前任服爷,我火速辦了婚禮罩缴,結(jié)果婚禮上,老公的妹妹穿的比我還像新娘层扶。我一直安慰自己,他們只是感情好烙荷,可當(dāng)我...
    茶點故事閱讀 67,245評論 6 388
  • 文/花漫 我一把揭開白布镜会。 她就那樣靜靜地躺著,像睡著了一般终抽。 火紅的嫁衣襯著肌膚如雪戳表。 梳的紋絲不亂的頭發(fā)上,一...
    開封第一講書人閱讀 51,208評論 1 299
  • 那天昼伴,我揣著相機與錄音匾旭,去河邊找鬼。 笑死圃郊,一個胖子當(dāng)著我的面吹牛价涝,可吹牛的內(nèi)容都是我干的。 我是一名探鬼主播持舆,決...
    沈念sama閱讀 40,091評論 3 418
  • 文/蒼蘭香墨 我猛地睜開眼色瘩,長吁一口氣:“原來是場噩夢啊……” “哼伪窖!你這毒婦竟也來了?” 一聲冷哼從身側(cè)響起居兆,我...
    開封第一講書人閱讀 38,929評論 0 274
  • 序言:老撾萬榮一對情侶失蹤覆山,失蹤者是張志新(化名)和其女友劉穎,沒想到半個月后泥栖,有當(dāng)?shù)厝嗽跇淞掷锇l(fā)現(xiàn)了一具尸體簇宽,經(jīng)...
    沈念sama閱讀 45,346評論 1 311
  • 正文 獨居荒郊野嶺守林人離奇死亡,尸身上長有42處帶血的膿包…… 初始之章·張勛 以下內(nèi)容為張勛視角 年9月15日...
    茶點故事閱讀 37,570評論 2 333
  • 正文 我和宋清朗相戀三年吧享,在試婚紗的時候發(fā)現(xiàn)自己被綠了魏割。 大學(xué)時的朋友給我發(fā)了我未婚夫和他白月光在一起吃飯的照片。...
    茶點故事閱讀 39,739評論 1 348
  • 序言:一個原本活蹦亂跳的男人離奇死亡耙蔑,死狀恐怖见妒,靈堂內(nèi)的尸體忽然破棺而出,到底是詐尸還是另有隱情甸陌,我是刑警寧澤须揣,帶...
    沈念sama閱讀 35,437評論 5 344
  • 正文 年R本政府宣布,位于F島的核電站钱豁,受9級特大地震影響耻卡,放射性物質(zhì)發(fā)生泄漏。R本人自食惡果不足惜牲尺,卻給世界環(huán)境...
    茶點故事閱讀 41,037評論 3 326
  • 文/蒙蒙 一卵酪、第九天 我趴在偏房一處隱蔽的房頂上張望。 院中可真熱鬧谤碳,春花似錦溃卡、人聲如沸。這莊子的主人今日做“春日...
    開封第一講書人閱讀 31,677評論 0 22
  • 文/蒼蘭香墨 我抬頭看了看天上的太陽。三九已至搓茬,卻和暖如春犹赖,著一層夾襖步出監(jiān)牢的瞬間,已是汗流浹背卷仑。 一陣腳步聲響...
    開封第一講書人閱讀 32,833評論 1 269
  • 我被黑心中介騙來泰國打工峻村, 沒想到剛下飛機就差點兒被人妖公主榨干…… 1. 我叫王不留,地道東北人锡凝。 一個月前我還...
    沈念sama閱讀 47,760評論 2 369
  • 正文 我出身青樓粘昨,卻偏偏與公主長得像,于是被迫代替她去往敵國和親。 傳聞我的和親對象是個殘疾皇子雾棺,可洞房花燭夜當(dāng)晚...
    茶點故事閱讀 44,647評論 2 354

推薦閱讀更多精彩內(nèi)容