├── source_codes ├── out-dated │ └── placeholder └── AutoNightsToolBox.js ├── README.md └── src └── assets ├── fabs ├── fab-64x64.png ├── fab-128x128.png ├── fab-256x256.png └── fab-512x512.png ├── icons ├── icon-72x72.png ├── icon-96x96.png ├── icon-128x128.png ├── icon-144x144.png ├── icon-152x152.png ├── icon-192x192.png ├── icon-384x384.png └── icon-512x512.png └── imgs ├── alipay_qrcode.png └── wechat_qrcode.png /source_codes/out-dated/placeholder: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # AutonightsToolbox 2 | 自动方舟的工具版 3 | -------------------------------------------------------------------------------- /src/assets/fabs/fab-64x64.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ParticleG/AutonightsToolbox/HEAD/src/assets/fabs/fab-64x64.png -------------------------------------------------------------------------------- /src/assets/fabs/fab-128x128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ParticleG/AutonightsToolbox/HEAD/src/assets/fabs/fab-128x128.png -------------------------------------------------------------------------------- /src/assets/fabs/fab-256x256.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ParticleG/AutonightsToolbox/HEAD/src/assets/fabs/fab-256x256.png -------------------------------------------------------------------------------- /src/assets/fabs/fab-512x512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ParticleG/AutonightsToolbox/HEAD/src/assets/fabs/fab-512x512.png -------------------------------------------------------------------------------- /src/assets/icons/icon-72x72.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ParticleG/AutonightsToolbox/HEAD/src/assets/icons/icon-72x72.png -------------------------------------------------------------------------------- /src/assets/icons/icon-96x96.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ParticleG/AutonightsToolbox/HEAD/src/assets/icons/icon-96x96.png -------------------------------------------------------------------------------- /src/assets/icons/icon-128x128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ParticleG/AutonightsToolbox/HEAD/src/assets/icons/icon-128x128.png -------------------------------------------------------------------------------- /src/assets/icons/icon-144x144.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ParticleG/AutonightsToolbox/HEAD/src/assets/icons/icon-144x144.png -------------------------------------------------------------------------------- /src/assets/icons/icon-152x152.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ParticleG/AutonightsToolbox/HEAD/src/assets/icons/icon-152x152.png -------------------------------------------------------------------------------- /src/assets/icons/icon-192x192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ParticleG/AutonightsToolbox/HEAD/src/assets/icons/icon-192x192.png -------------------------------------------------------------------------------- /src/assets/icons/icon-384x384.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ParticleG/AutonightsToolbox/HEAD/src/assets/icons/icon-384x384.png -------------------------------------------------------------------------------- /src/assets/icons/icon-512x512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ParticleG/AutonightsToolbox/HEAD/src/assets/icons/icon-512x512.png -------------------------------------------------------------------------------- /src/assets/imgs/alipay_qrcode.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ParticleG/AutonightsToolbox/HEAD/src/assets/imgs/alipay_qrcode.png -------------------------------------------------------------------------------- /src/assets/imgs/wechat_qrcode.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ParticleG/AutonightsToolbox/HEAD/src/assets/imgs/wechat_qrcode.png -------------------------------------------------------------------------------- /source_codes/AutoNightsToolBox.js: -------------------------------------------------------------------------------- 1 | //version:1.0.0 2 | //platform version:7.0.4-1 3 | 4 | //程序初始化器 5 | initializer(); 6 | 7 | //导入安卓原生类 8 | importClass(java.lang.Runnable); 9 | importClass(android.animation.ObjectAnimator) 10 | importClass(android.animation.PropertyValuesHolder) 11 | importClass(android.animation.ValueAnimator) 12 | importClass(android.animation.AnimatorSet) 13 | importClass(android.view.animation.AccelerateInterpolator) 14 | importClass(android.view.animation.TranslateAnimation) 15 | importClass(android.animation.ObjectAnimator) 16 | importClass(android.animation.TimeInterpolator) 17 | importClass(android.os.Bundle) 18 | importClass(android.view.View) 19 | importClass(android.view.Window) 20 | importClass(android.view.animation.AccelerateDecelerateInterpolator) 21 | importClass(android.view.animation.AccelerateInterpolator) 22 | importClass(android.view.animation.AnticipateInterpolator) 23 | importClass(android.view.animation.AnticipateOvershootInterpolator) 24 | importClass(android.view.animation.BounceInterpolator) 25 | importClass(android.view.animation.CycleInterpolator) 26 | importClass(android.view.animation.DecelerateInterpolator) 27 | importClass(android.view.animation.LinearInterpolator) 28 | importClass(android.view.animation.OvershootInterpolator) 29 | importClass(android.view.animation.PathInterpolator) 30 | importClass(android.widget.Button) 31 | importClass(android.widget.ImageView) 32 | importClass(android.widget.TextView) 33 | 34 | //全局变量 35 | var LocalData = storages.create("AutoNightsToolBoxLocal"); 36 | var logo_switch = false;//悬浮窗的开启关闭检测 37 | var logo_buys = false;//开启和关闭时占用状态 防止多次点击触发 38 | var running_action;//正在运行的操作线程 39 | var running_floating_window;//正在运行的悬浮窗 40 | var time_0, time_1, time_3//定时器 点击退出悬浮窗时定时器关闭 41 | var x = 0,y = 0;//记录按键被按下时的触摸坐标 42 | var windowX, windowY; G_Y = 0//记录按键被按下时的悬浮窗位置 43 | var downTime; yd = false;//记录按键被按下的时间以便判断长按等动作 44 | 45 | //可修改参数 46 | var logo_ms = 200;//动画播放时间 47 | var DHK_ms = 200;//对话框动画播放时间 48 | var accent_color = LocalData.get("AccentColor");//强调色 49 | var alternative_color = "#BDBDBD"; //副色 50 | 51 | 52 | /** 53 | * 需要三个悬浮窗一起协作达到Auto.js悬浮窗效果 54 | * win 子菜单悬浮窗 处理子菜单选项点击事件 55 | * win_1 主悬浮按钮 56 | * win_2 悬浮按钮动画替身,只有在手指移动主按钮的时候才会被触发 57 | * 触发时,替身Y值会跟主按钮Y值绑定一起,手指弹起时代替主按钮显示跳动的小球动画 58 | */ 59 | var win = floaty.rawWindow( 60 | //子菜单悬浮窗 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | ) 92 | win.setTouchable(false);//设置子菜单不接收触摸消息 93 | 94 | var win_1 = floaty.rawWindow( 95 | //悬浮按钮 96 | 97 | 98 | 99 | 100 | ); 101 | win_1.setPosition(-21, device.height * 0.1)//悬浮按钮定位 102 | 103 | var win_2 = floaty.rawWindow( 104 | //悬浮按钮 弹性替身 105 | 106 | 107 | 108 | ); 109 | win_2.setTouchable(false);//设置弹性替身不接收触摸消息 110 | 111 | /** 112 | * 脚本广播事件 113 | */ 114 | var XY = [], XY1 = [], TT = [], TT1 = [], img_dp = {}, dpZ = 0, logo_right = 0, dpB = 0, dp_H = 0 115 | events.broadcast.on("定时器关闭", function (X) { clearInterval(X) }) 116 | events.broadcast.on("悬浮开关", function (X) { 117 | ui.run(function () { 118 | switch (X) { 119 | case true: 120 | win.id_logo.setVisibility(0) 121 | win.setTouchable(true); 122 | logo_switch = true 123 | break; 124 | case false: 125 | win.id_logo.setVisibility(4) 126 | win.setTouchable(false); 127 | logo_switch = false 128 | } 129 | }) 130 | 131 | }); 132 | 133 | events.broadcast.on("悬浮显示", function (X1) { 134 | ui.run(function () { 135 | win_2.logo.attr("alpha", "0"); 136 | win_1.logo.attr("alpha", "0.4"); 137 | }) 138 | }); 139 | 140 | var terid = setInterval(() => { //等待悬浮窗初始化 141 | //log("13") 142 | if (TT.length == 0 && win.logo.getY() > 0) {// 不知道界面初始化的事件 只能放到这里将就下了 143 | ui.run(function () { 144 | TT = [win.logo.getX(), win.logo.getY()], TT1 = [win.logo_1.getLeft(), win.logo_1.getTop()], anX = [], anY = []// 获取logo 绝对坐标 145 | XY = [ 146 | [win.id_0, TT[0] - win.id_0.getX(), TT[1] - win.id_0.getY()],// 获取子菜单 视图和子菜单与logo绝对坐标差值 147 | [win.id_1, TT[0] - win.id_1.getX(), TT[1] - win.id_1.getY()], 148 | [win.id_2, TT[0] - win.id_2.getX(), TT[1] - win.id_2.getY()], 149 | [win.id_3, TT[0] - win.id_3.getX(), TT[1] - win.id_3.getY()], 150 | [win.id_4, TT[0] - win.id_4.getX(), TT[1] - win.id_4.getY()]] 151 | //log("上下Y值差值:" + XY[0][2] + "DP值:" + (XY[0][2] / 83)) 152 | dpZ = XY[0][2] / 83 153 | dpB = dpZ * 22 154 | XY1 = [ 155 | [parseInt(dpZ * 41), TT1[0] - win.id_0.getLeft(), TT1[1] - win.id_0.getTop()], 156 | [parseInt(dpZ * -65), TT1[0] - win.id_1.getLeft(), TT1[1] - win.id_1.getTop()], 157 | [parseInt(dpZ * -106), TT1[0] - win.id_2.getLeft(), TT1[1] - win.id_2.getTop()], 158 | [parseInt(dpZ * -65), TT1[0] - win.id_3.getLeft(), TT1[1] - win.id_3.getTop()], 159 | [parseInt(dpZ * 41), TT1[0] - win.id_4.getLeft(), TT1[1] - win.id_4.getTop()]] 160 | img_dp.h_b = XY[0][2]//两个悬浮窗Y差值 161 | img_dp.w = parseInt(dpZ * 9)//计算logo左边隐藏时 X值 162 | img_dp.ww = parseInt(dpZ * (44 - 9))//计算logo右边隐藏时 X值 163 | logo_right = win.id_2.getX() - parseInt(dpZ * 22) 164 | win_1.setPosition(0 - img_dp.w, device.height * 0.1) 165 | win.id_logo.setVisibility(4) 166 | win.id_logo.attr("alpha", "1") 167 | events.broadcast.emit("定时器关闭", terid) 168 | }) 169 | 170 | } 171 | }, 100) 172 | time_0 = setInterval(() => { 173 | }, 1000) 174 | win_1.logo.setOnTouchListener(function (view, event) { 175 | if (logo_buys) { return false} 176 | //event.getAction()) 177 | switch (event.getAction()) { 178 | case event.ACTION_DOWN: 179 | x = event.getRawX(); 180 | y = event.getRawY(); 181 | windowX = win_1.getX(); 182 | windowY = win_1.getY(); 183 | downTime = new Date().getTime(); 184 | return true; 185 | case event.ACTION_MOVE: 186 | if (logo_switch) { return true; } 187 | if (!yd) {//如果移动的距离大于h值 则判断为移动 yd为真 188 | if (Math.abs(event.getRawY() - y) > 30 || Math.abs(event.getRawX() - x) > 30) { win_1.logo.attr("alpha", "1"); yd = true } 189 | } else {//移动手指时调整两个悬浮窗位置 190 | win_1.setPosition(windowX + (event.getRawX() - x),//悬浮按钮定位 191 | windowY + (event.getRawY() - y)); 192 | win_2.setPosition(0, windowY + (event.getRawY() - y));//弹性 替身定位(隐藏看不到的,松开手指才会出现) 193 | } 194 | return true; 195 | case event.ACTION_UP: //手指弹起 196 | //触摸时间小于 200毫秒 并且移动距离小于30 则判断为 点击 197 | if (logo_buys) { return false;}//如果在动画正在播放中则退出事件 无操作 198 | if (Math.abs(event.getRawY() - y) < 30 && Math.abs(event.getRawX() - x) < 30) { 199 | //toastLog("点击弹起") 200 | if (logo_switch) { 201 | logo_switch = false 202 | win_1.logo.attr("alpha", "0.4") 203 | } 204 | else 205 | { 206 | //log("左边") 207 | win.setPosition(windowX + (event.getRawX() - x), 208 | windowY + (event.getRawY() - y) - img_dp.h_b); 209 | win.id_logo.setVisibility(0) 210 | logo_switch = true 211 | win_1.logo.attr("alpha", "0.9") 212 | } 213 | animationCreator() 214 | } else if (!logo_switch) { 215 | //toastLog("移动弹起") 216 | G_Y = windowY + (event.getRawY() - y) 217 | win_1.logo.attr("alpha", "0.4") 218 | //toastLog("左边") 219 | animator = ObjectAnimator.ofFloat(win_2.logo, "translationX", windowX + (event.getRawX() - x), 0 - img_dp.w); 220 | mTimeInterpolator = new BounceInterpolator(); 221 | animator.setInterpolator(mTimeInterpolator); 222 | animator.setDuration(300); 223 | win_2.logo.attr("alpha", "0.4")//animationCreator 替身上场 224 | win_1.logo.attr("alpha", "0");//悬浮按钮隐藏 225 | win_1.setPosition(0 - img_dp.w, G_Y)//悬浮按钮移动到终点位置等待替身动画结束 226 | animator.start(); 227 | 228 | threads.start(function () {//动画的结束事件一直没有明白 只能拿线程代替了 229 | logo_buys = true 230 | sleep(logo_ms + 100) 231 | events.broadcast.emit("悬浮显示", 0) 232 | 233 | logo_buys = false 234 | }); 235 | } 236 | yd = false 237 | return true; 238 | } 239 | return true; 240 | }); 241 | 242 | win.fab_profile.on("click", () => { //禁用 243 | toastLog("Disabled") 244 | img_down(); 245 | }) 246 | win.fab_action_menu.on("click", () => { 247 | if(running_action == null){ 248 | img_down(); 249 | actionMenu(); 250 | }else{ 251 | toast("有悬浮窗正在运行,请先关闭悬浮窗!"); 252 | } 253 | }) 254 | 255 | win.fab_stop_action.on("click", () => { 256 | if(running_action == "Floaty"){ 257 | img_down(); 258 | toast("悬浮窗已关闭!"); 259 | running_floating_window.close(); 260 | device.cancelKeepingAwake(); 261 | running_action = null; 262 | } 263 | else 264 | { 265 | toast("没有悬浮窗口正在运行!"); 266 | } 267 | }) 268 | 269 | win.fab_settings_menu.on("click", () => { 270 | img_down(); 271 | settingsMenu(); 272 | }) 273 | 274 | win.fab_misc_menu.on("click", () => { 275 | img_down(); 276 | miscMenu(); 277 | }) 278 | 279 | function actionMenu() 280 | { 281 | let menu = ui.inflate( 282 | 283 | 284 | 285 | 286 | 287 | 288 |