猫史档案馆


[Box3]将文本打印为方块

用户:145a145a查看:4 回复:1 评论:4 创建时间:2023-05-12T17:29:05


//模拟145lab环境 vargetTypeof=function(input){ returnObject.prototype.toString.apply(input).slice(8,-1); } varendline="\n"; varCharacters={ "0":"zero", "1":"one", "2":"two", "3":"three", "4":"four", "5":"five", "6":"six", "7":"seven", "8":"eight", "9":"nine", "+":"add", "-":"subtract", "?":"question_mark", "!":"excla喵_mark", "=":"equal", "":"black", "&":"ampersand", "*":"asterisk", "@":"at", "\\":"backslash", "]":"bracket_close", "[":"bracket_open", "^":"caret", ":":"colon", ",":"comma", "$":"dollar", ">":"greater_than", "<":"less_than", "(":"paren_open", ")":"paren_close", "%":"percent", ".":"period", "#":"pound", "'":"quotation_mark", ";":"semicolon", "/":"slash", "~":"tilde", "":"air" } Array.prototype.replace=function(regexp,replacement){ returnthis.map(item=>{ if(getTypeof(item)==="String"){ returnitem.replace(regexp,replacement); }else{ returnitem; } }); } /** *打印任意由Asc2字符组成的文本 *@param{Box3Vector3}pos *@param{?Box3Vector3[2]}direction书写方向和换行方向 *@param{Array[]|String[]|String}image要打印的文本 */ voxels.print=function(pos,direction=[newBox3Vector3(0,0,1),newBox3Vector3(0,-1,0)],image){ letp1=newBox3Vector3().copy(pos); if(getTypeof(image)==="String"){ image=image.toUpperCase(); image=image.split(endline); for(constiofObject.keys(image)){ image[i]=image[i].split(""); for(constcofObject.keys(Characters)){ image[i]=image[i].replace(c,Characters[c]); } } } for(constiofimage){ letp2=newBox3Vector3().copy(p1); for(consteofi){ voxels.setVoxel(p2.x,p2.y,p2.z,e); p2.addEq(direction[0]); } p1.addEq(direction[1]); } } //示例 voxels.print(newBox3Vector3(136,20,72),void0,"helloworld!");


回复

上一页1 页 / 共 1下一页
145a145a

???!!!!!!!!啊啊啊啊啊我的排版呢5555555555555555555555555555555555555555555555nnnnnnnnnnnnnnnnnnnnnnnnaaaaaaaa 以下是带排版(?)内容   //模拟145lab环境 vargetTypeof=function(input){   returnObject.prototype.toString.apply(input).slice(8,-1); } varendline="\n"; varCharacters={   "0":"zero",   "1":"one",   "2":"two",   "3":"three",   "4":"four",   "5":"five",   "6":"six",   "7":"seven",   "8":"eight",   "9":"nine",   "+":"a喵",   "-":"subtract",   "?":"question_mark",   "!":"excla喵_mark",   "=":"equal",   "":"black",   "&":"ampersand",   "*":"asterisk",   "@":"at",   "\\":"backslash",   "]":"bracket_close",   "[":"bracket_open",   "^":"caret",   ":":"colon",   ",":"comma",   "$":"dollar",   ">":"greater_than",   "<":"less_than",   "(":"paren_open",   ")":"paren_close",   "%":"percent",   ".":"period",   "#":"pound",   "'":"quotation_mark",   ";":"semicolon",   "/":"slash",   "~":"tilde",   "":"air" } Array.prototype.replace=function(regexp,replacement){   returnthis.map(item=>{     if(getTypeof(item)==="String"){       returnitem.replace(regexp,replacement);     }else{       returnitem;     }   }); } /**  *打印任意由Asc2字符组成的文本  *@param{Box3Vector3}pos  *@param{?Box3Vector3[2]}direction书写方向和换行方向  *@param{Array[]|String[]|String}image要打印的文本  */ voxels.print=function(pos,direction=[newBox3Vector3(0,0,1),newBox3Vector3(0,-1,0)],image){   letp1=newBox3Vector3().copy(pos);   if(getTypeof(image)==="String"){     image=image.toUpperCase();     image=image.split(endline);     for(constiofObject.keys(image)){       image[i]=image[i].split("");       for(constcofObject.keys(Characters)){         image[i]=image[i].replace(c,Characters[c]);       }     }   }   for(constiofimage){     letp2=newBox3Vector3().copy(p1);     for(consteofi){       voxels.setVoxel(p2.x,p2.y,p2.z,e);       p2.a喵Eq(direction[0]);     }     p1.a喵Eq(direction[1]);   } } //示例 voxels.print(newBox3Vector3(136,20,72),void0,"helloworld!");

点赞0


评论