怎么用jside制作我的世界一键生成建筑手机版的一键生成js

当前位置:
我的世界一键生成妖怪JS视频
小编:fanfan时间: 16:48
  为大家带来我的世界Js一键生成妖怪介绍,所有妖怪介绍。里面还有coc哥布林、弓箭手、更有杂怪、石像魔等居然都成为我的世界小妖怪&&喜欢的朋友速速围观吧~
  各种妖怪各种大招,小伙伴们你们都了解了吗?希望对大家了解小怪有帮助!
分享到:更多
类型:休闲娱乐平台:PC,iOS,安卓
游戏大礼包手游开测表
火柴人联盟大礼包驯龙战机3D不删档测试特权礼包王者荣耀奢华大礼包魔龙勇士游戏园独家礼包战龙之刃安卓内测银币礼包皇图公测高级礼包
11-05公测10-29内测10-29内测10-29公测10-29内测10-28内测10-27内测10-26内测10-22内测10-22公测
攻略推荐本月最新
手游排行网游单机按住视频可进行拖动
嵌入分享:
&正在加载...
安装爱奇艺视频客户端,
马上开始为您下载本片
5秒后自动消失【 我的世界 精彩视频 】 我的世界pe 一键生成豪宅Js 生存必备
朋友圈都转疯了
正在努力加载中...→ → 我的世界手机版JS开发教程怎么制作gui
我的世界手机版JS开发教程怎么制作gui
作者:佚名来源:本站整理 9:40:12
小编为大家带来了《》手机版的一个技术教程,这次教大家如何制作JS的GUI,是不是有很多有想要制作JS的玩家不知道如何制作GUI,这里小编为大家带来了详细的教程,有兴趣的玩家都来看看吧。要学gui,请不要问变量是啥var ctx= com.mojang.minecraftpe.MainActivity.currentMainActivity.get()获取一个主界面,必须的ctx变量为一个主界面。有主界面就可以进入线程了(线程是一个加快js运行并操控gui的必须)ctx.runOnUiThread(newjava.lang.Runnable({run:function(){//线程内部}}}));然后就涉及到了显示gui的控件和布局var ppw=newandroid.widget.PopupWindow();//声明变量ppw为一个悬浮窗。可以理解为一个屏幕,可以显示东西varlayout=newandroid.widget.RelativeLayout(ctx);//声明变量layout为一个布局也就是一个排列东西的东西(默认为纵向)如果i是一个按钮那么iii如&图&三个按钮显示在布局里,这就是布局有了以上资源我们认识一下像素以及他们的设置不知哪位大大创造的自定义函数 像素functiondip2px(ctx,dips){return Math.ceil(dips*ctx.getResources().getDisplayMetrics().density);}dip2px(ctx,几像素 数字)---------------------------------------------------------dip2px(ctx,几像素 数字)调用方法GUI就是刚才的悬浮窗ppwGUI.setContentView()//设置GUI所展示的东西,()里填以后讲GUI.setWidth();//宽GUI.setHeight();//高上两个应该填dip2px(ctx,几像素)还有显示guiGUI.showAtLocation(ctx.getWindow().getDecorView(),android.view.Gravity.左右|android.view.Gravity.上下,横偏移,纵偏移);左右填LEFT是左 RIGHT是右,上下填TOP上或者BOTTOM下 大写横偏移就是如果左右填左就是离左多少距离,填右就是…纵偏移以此类推然后就进入我们的视图了视图就是andriod安卓提供的控件比如按钮,文本,拖动条等等先来按钮varbutton=newandroid.widget.Button(ctx);button.setText(&X&);button.setOnClickListener(newandroid.view.View.OnClickListener({onClick:function(viewarg){}}));layout.addView(button);别急我们来拆开分析var空格button=new空android.widget.Button(ctx);声明变量button是一个Button(按钮控件)button.setText(&x&)他的显示的文本是xbutton.setOnClickListener(newandroid.view.View.OnClickListener({onClick:function(viewarg){//点击按钮运行}}));layout.addView(button);在layout上增加button控件我们可以设置他GUI.setContentView()//设置GUI所展示的可以填button就是我们的按钮直接显示也可以 GUI.setContentView(layout)显示出布局都可以正确例子function dip2px(ctx,dips){return&Math.ceil(dips*ctx.getResources().getDisplayMetrics().density);}function newLevel(){var ctx= com.mojang.minecraftpe.MainActivity.currentMainActivity.get()ctx.runOnUiThread(new java.lang.Runnable({run:function(){try{var simpleGUI=new android.widget.PopupWindow()var layout=new android.widget.RelativeLayout(ctx);var button=new android.widget.Button(ctx)button.setText(&X&)button.setOnClickListener(new android.view.View.OnClickListener({onClick:function(viewarg){print(&点击&)}}))layout.addView(button)simpleGUI.setContentView(layout)simpleGUI.setWidth(70)simpleGUI.setHeight(70)simpleGUI.showAtLocation(ctx.getWindow().getDecorView(),android.view.Gravity.LEFT|android.view.Gravity.BOTTOM,0,0);}catch(err){print(&Error:&+err)}}}))}布局方向layout.setOrientation(1)竖向0为横向GUI.setFocusable(true)是不是点击gui以外的地方gui消失true是false不是在例子中我们用了simpleGUI作为gui显示基础&屏幕&,用layout显示了button按钮在simpleGUI上如此就成功了而如何消除gui尼???就用到了GUI.dismiss。注意GUI是我们比喻的&屏幕&而不是按钮神马的关于gui&屏幕&还有很多设置比如 GUI.setBackgroundDrawable(new android.graphics.drawable.ColorDrawable(android.graphics.Color.argb(127,0,0,0)))设置背景颜色等等回顾按钮&var空格button=new空android.widget.Button(ctx);声明变量button是一个Button(按钮控件)button.setText(&x&)他的显示的文本是xbutton.setOnClickListener(new android.view.View.OnClickListener({onClick:function(viewarg){//点击按钮运行}}));button.setTextColor(android.graphics.Color.rgb(1,1,1))设置字体颜色button.setBackgroundColor(android.graphics.Color.argb(127,251,251,251));背景颜色注color.rgb(,,)是调色分别填red(红) green(绿) blue(蓝)颜色color.argb(,,,)填透明,红,绿,蓝color.argb()和color.rgb()每个空可以填0到255调色var stitle=new android.widget.TextView(ctx)//把stitle赋值为TextView文本视图stitle.setTextColor(android.graphics.Color.rgb(255,255,255))//字体颜色,好像不能设置背景色stitle.setText(&文本&)//文本stitle.setTextSize(13)//字体大小layout.addView(stitle)//布局上增加var edit=new android.widget.EditText(ctx)//输入框edit.setTextColor(android.graphics.Color.rgb(1,1,1))//字体颜色edit.setHint(&请输入数字&)//提示edit.setInputType(android.text.InputType.TYPE_CLASS_NUMBER)//类型为数字不加这个为文本edit.setText(&0&)//设置字layout.addView(edit)//显示var check=new android.widget.CheckBox(ctx);check.setTextColor(android.graphics.Color.YELLOW);check.setText(&疾跑模式&);check.setChecked();//显是是否打对号填true,false或者一个布尔值变量check.setOnCheckedChangeListener(new poundButton.OnCheckedChangeListener(){onCheckedChanged:function(v, isChecked){//点击执行 isChecked是是否打对号布尔值&,变量=isChecked可以作为这个的开关check.setChecked()里面填这个变量可以做到一个变量当开关}});layout.addView(check);var ctx=com.mojang.minecraftpe.MainActivity.currentMainActivity.get()var layout=new android.widget.LinearLayout(ctx)try{var menu=new android.widget.PopupWindow(layout, dip2px(ctx,75), dip2px(ctx,30));menu.setFocusable(true)var layout=new android.widget.LinearLayout(ctx)layout.setOrientation(1)var button=new android.widget.Button(ctx);button.setText(&确定&);button.setOnClickListener(new android.view.View.OnClickListener({onClick:function(viewarg) {}}));layout.addView(button);var mlayout=makeMenu(ctx,layout)menu.setContentView(mlayout)menu.setWidth(ctx.getWindowManager().getDefaultDisplay().getWidth()/3.);menu.setHeight(ctx.getWindowManager().getDefaultDisplay().getHeight());menu.setBackgroundDrawable(new android.graphics.drawable.ColorDrawable(android.graphics.Color.argb(127,0,0,0)))menu.showAtLocation(ctx.getWindow().getDecorView(),android.view.Gravity.RIGHT | android.view.Gravity.TOP,0,0);}catch(err){toast(err)}function makeMenu(ctx,layout){&var mlayout=new android.widget.RelativeLayout(ctx)&var svParams=new android.widget.RelativeLayout.LayoutParams(android.widget.RelativeLayout.LayoutParams.FILL_PARENT,android.widget.RelativeLayout.LayoutParams.FILL_PARENT)&var scrollview=new android.widget.ScrollView(ctx)&var pad=dip2px(ctx,2)&scrollview.setPadding(pad,pad,pad,pad)&scrollview.setLayoutParams(svParams)&scrollview.addView(layout)&mlayout.addView(scrollview)&return mlayout&}菜单少了像素函数先看这个var ctx=com.mojang.minecraftpe.MainActivity.currentMainActivity.get()var layout=new android.widget.LinearLayout(ctx)try{var menu=new android.widget.PopupWindow(layout, dip2px(ctx,75), dip2px(ctx,30));menu.setFocusable(true)var layout=new android.widget.LinearLayout(ctx)layout.setOrientation(1)var button=new android.widget.Button(ctx);button.setText(&确定&);button.setOnClickListener(new android.view.View.OnClickListener({onClick:function(viewarg) {}}));layout.addView(button);var mlayout=makeMenu(ctx,layout)menu.setContentView(mlayout)menu.setWidth(ctx.getWindowManager().getDefaultDisplay().getWidth()/3.);menu.setHeight(ctx.getWindowManager().getDefaultDisplay().getHeight());menu.setBackgroundDrawable(new android.graphics.drawable.ColorDrawable(android.graphics.Color.argb(127,0,0,0)))menu.showAtLocation(ctx.getWindow().getDecorView(),android.view.Gravity.RIGHT | android.view.Gravity.TOP,0,0);}catch(err){toast(err)}大家能看懂吧 先看这个var menu=new android.widget.PopupWindow(layout, dip2px(ctx,75), dip2px(ctx,30));这个是我们比喻的&屏幕&function makeMenu(ctx,layout){&var mlayout=new android.widget.RelativeLayout(ctx)&var svParams=new android.widget.RelativeLayout.LayoutParams(android.widget.RelativeLayout.LayoutParams.FILL_PARENT,android.widget.RelativeLayout.LayoutParams.FILL_PARENT)&var scrollview=new android.widget.ScrollView(ctx)&var pad=dip2px(ctx,2)&scrollview.setPadding(pad,pad,pad,pad)&scrollview.setLayoutParams(svParams)&scrollview.addView(layout)&mlayout.addView(scrollview)&return mlayout&}↑哪位大大设置只要设置好布局layout后var 变量=makeMenu(ctx,layout/*布局变量*/)变量就好像加工过一样变成菜单然后显示这个变量就可以了大家不熟悉这个时候还是var ctx=com.mojang.minecraftpe.MainActivity.currentMainActivity.get()var layout=new android.widget.LinearLayout(ctx)try{var menu=new android.widget.PopupWindow(layout, dip2px(ctx,75), dip2px(ctx,30));menu.setFocusable(true)var layout=new android.widget.LinearLayout(ctx)layout.setOrientation(1)var button=new android.widget.Button(ctx);button.setText(&确定&);button.setOnClickListener(new android.view.View.OnClickListener({onClick:function(viewarg) {}}));layout.addView(button);布局添加地var mlayout=makeMenu(ctx,layout)menu.setContentView(mlayout)menu.setWidth(ctx.getWindowManager().getDefaultDisplay().getWidth()/3.);menu.setHeight(ctx.getWindowManager().getDefaultDisplay().getHeight());menu.setBackgroundDrawable(new android.graphics.drawable.ColorDrawable(android.graphics.Color.argb(127,0,0,0)))menu.showAtLocation(ctx.getWindow().getDecorView(),android.view.Gravity.RIGHT | android.view.Gravity.TOP,0,0);}catch(err){toast(err)}function makeMenu(ctx,layout){&var mlayout=new android.widget.RelativeLayout(ctx)&var svParams=new android.widget.RelativeLayout.LayoutParams(android.widget.RelativeLayout.LayoutParams.FILL_PARENT,android.widget.RelativeLayout.LayoutParams.FILL_PARENT)&var scrollview=new android.widget.ScrollView(ctx)&var pad=dip2px(ctx,2)&scrollview.setPadding(pad,pad,pad,pad)&scrollview.setLayoutParams(svParams)&scrollview.addView(layout)&mlayout.addView(scrollview)&return mlayout&}用这个比较好我们只要把他放到自定义函数中比如var 菜单=function(){上面的菜单}记得加上像素函数就可以了调用时 菜单() 就可以弹出菜单var seekbar=new android.widget.SeekBar(ctx)//定义拖动条seekbar.setMax(255)//拖动条长度seekbar.setProgress(0)//显示时拖动到什么地方//↓拖动时seekbar.setOnSeekBarChangeListener(new android.widget.SeekBar.OnSeekBarChangeListener({onProgressChanged:function(v){seekbar.getProgress()//获取拖动位置}}))layout.addView(seekbar)//显示还有选择框 var ll=new android.widget.Spinner(ctx)//定义var k=new android.widget.ArrayAdapter(ctx,android.R.layout.preference_category,new java.lang.String(&无,1&).split(&,&))//适配器ll.setOnItemSelectedListener(new android.widget.AdapterView.OnItemSelectedListener(){onItemSelected:function(w){ll.getSelectedItemId()//获取行数}})ll.setAdapter(k)//选择适配器layout.addView(ll)//显示对话框var dialog=new android.app.AlertDialog.Builder(ctx)dialog.setTitle(&xx&)//标题dialog.setMessage(&xx&)//内容dialog.setNegativeButton(&按钮&,new android.content.DialogInterface.OnClickListener(){onClick: function(dia,w){}})//增加一个按钮dialog.show()因为安卓控件都可以在layout布局上显示所以只要添加到布局就可以了比如var button=按钮控件button.xxxx(xxx)设定完layout.addView(button)就显示了然后用GUI&屏幕&显示它就可以了控件.setVisibility(数字)数字填0显示,填4不显示但占空间,填8完全不显示bar=new android.widget.ProgressBar()bar.setMax(最大)bar.setProgress(进度)}以上。
15-12-1415-12-1415-12-13
共0条相关评论
最新最热相关资源
安卓苹果应用推荐
类型:动作冒险大小:42.4M类型:益智休闲大小:5.4M类型:动作冒险大小:75.4M类型:益智休闲大小:8.1M类型:模拟经营大小:58.2M类型:模拟经营大小:4.2M
类型:休闲益智大小:4.1M类型:策略游戏大小:215M类型:动作游戏大小:79.6M类型:休闲益智大小:135M类型:动作游戏大小:48KB类型:动作游戏大小:144M

我要回帖

更多关于 我的世界一键生成mod 的文章

 

随机推荐