baseDir = gg.FILES_DIR .. "/我真没想重生啊配置" zipPath = gg.FILES_DIR .. "/我真没想重生啊.zip" filesDir = gg.FILES_DIR .. "/" if io.open(baseDir .. "/5d0b465b6585a1561019995.bin") == nil then gg.toast("第一次打开,正在下载资源配置") gg.alert("第一次打开,正在下载资源配置") file.download("https://image.rlyun.fun/down.php/da782df80acadadfcdb8af1fcaaeec8a.zip", zipPath) gg.alert("资源下载完成正在解压") file.unzip(zipPath, filesDir) os.remove(zipPath) gg.alert("资源解压完成") end info = { example_version = '1.0.3', name = '故辞', appid = '101538', appkey = '70alaDy4LgEa8YDA', rc4key = 'fkmL3UoULi0YVDLl', version = '1.0', mi_type = '3' } rlyunyz = getrlyunyz(info) gg.setVisible(false) luajava.setFloatingWindowHide(true) import "android.widget.LinearLayout" import "android.widget.TextView" import "android.widget.EditText" import "android.widget.FrameLayout" import "android.widget.ScrollView" import "android.widget.CheckBox" import "android.widget.ImageView" import "android.graphics.drawable.GradientDrawable" import "android.view.WindowManager" import "android.graphics.PixelFormat" import "android.os.Build" import "android.view.View" import "android.view.Gravity" import "android.view.inputmethod.EditorInfo" import "android.view.animation.AccelerateInterpolator" import "android.view.animation.DecelerateInterpolator" import "android.graphics.Matrix" import "android.view.MotionEvent" import "android.text.method.TransformationMethod" import "android.graphics.Rect" window = context:getSystemService("window") density = context:getResources():getDisplayMetrics().density Typeface = luajava.bindClass("android.graphics.Typeface") defaultBold = Typeface.DEFAULT_BOLD ImageViewClass = luajava.bindClass("android.widget.ImageView") HandlerClass = luajava.bindClass("android.os.Handler") LooperClass = luajava.bindClass("android.os.Looper") mainHandler = luajava.newInstance("android.os.Handler", LooperClass:getMainLooper()) customTypeface = Typeface:createFromFile(baseDir .. "/5d0b465b6585a1561019995.bin") interpDecel12 = luajava.newInstance("android.view.animation.DecelerateInterpolator", 1.2) interpDecel15 = luajava.newInstance("android.view.animation.DecelerateInterpolator", 1.5) interpDecel18 = luajava.newInstance("android.view.animation.DecelerateInterpolator", 1.8) interpDecel20 = luajava.newInstance("android.view.animation.DecelerateInterpolator", 2.0) interpDecel25 = luajava.newInstance("android.view.animation.DecelerateInterpolator", 2.5) interpAccel20 = luajava.newInstance("android.view.animation.AccelerateInterpolator", 2.0) easeOutCubic = interpDecel15 easeInOutCubic = interpDecel12 easeOutBack = interpDecel25 easeInBack = interpAccel20 easeOutQuart = interpDecel20 宽度 = 400 高度 = 270 function getBg(corner, color) local gd = luajava.newInstance('android.graphics.drawable.GradientDrawable') gd:setShape(0) if corner > 0 and corner < 12 then corner = 12 end gd:setCornerRadius(corner * density) gd:setColor(color) return gd end function getRadiiBg(color, lt, rt, rb, lb) local gd = luajava.newInstance('android.graphics.drawable.GradientDrawable') gd:setShape(0) gd:setColor(color) local r = 16 * density local lt2 = lt and r or 0 local rt2 = rt and r or 0 local rb2 = rb and r or 0 local lb2 = lb and r or 0 gd:setCornerRadii({lt2, lt2, rt2, rt2, rb2, rb2, lb2, lb2}) return gd end function startQPopAnim(view, onEnd) view:setAlpha(0) view:setScaleX(0.4) view:setScaleY(0.4) view:setTranslationY(40 * density) view:animate() :alpha(1) :scaleX(1.1) :scaleY(1.1) :translationY(0) :setDuration(350) :setInterpolator(interpDecel18) :withEndAction(toRun(function() view:animate() :scaleX(1) :scaleY(1) :setDuration(200) :setInterpolator(interpDecel15) :withEndAction(toRun(function() if onEnd then onEnd() end end)) :start() end)) :start() end function endQPopAnim(view, onEnd) view:animate():cancel() view:animate() :scaleX(1.05) :scaleY(1.05) :setDuration(80) :setInterpolator(interpDecel15) :withEndAction(toRun(function() view:animate() :alpha(0) :scaleX(0.5) :scaleY(0.5) :translationY(30 * density) :setDuration(280) :setInterpolator(interpAccel20) :withEndAction(toRun(function() if onEnd then onEnd() end end)) :start() end)) :start() end function btnPressAnim(v, scale) scale = scale or 0.96 v:animate():cancel() v:animate() :scaleX(scale) :scaleY(scale) :setDuration(120) :setInterpolator(easeOutCubic) :start() end function btnReleaseAnim(v) v:animate():cancel() v:animate() :scaleX(1) :scaleY(1) :setDuration(250) :setInterpolator(easeOutBack) :start() end function animateTextColor(view, fromColor, toColor, duration) view:setTextColor(toColor) end function smoothShake(v, onEnd) local d = density v:animate():cancel() local function step(endX, dur, interp, next) v:animate() :translationX(endX) :setDuration(dur) :setInterpolator(interp) :withEndAction(toRun(next)) :start() end step( 9 * d, 55, easeOutCubic, function() step(-7 * d, 55, easeInOutCubic, function() step( 5 * d, 55, easeInOutCubic, function() step(-3.5 * d, 50, easeInOutCubic, function() step( 2 * d, 45, easeInOutCubic, function() step(-1 * d, 40, easeInOutCubic, function() step(0, 35, easeOutCubic, function() if onEnd then onEnd() end end) end) end) end) end) end) end) end function loadImg(v, path, mult) mult = mult or 1.2 local ok, d = pcall(function() return luajava.getBitmapDrawable(path) end) if not ok or not d then return end v:setImageDrawable(d) v:setScaleType(ImageViewClass.ScaleType.MATRIX) v:post(function() local dr = v:getDrawable() if not dr then return end local dw, dh = dr:getIntrinsicWidth(), dr:getIntrinsicHeight() local vw, vh = v:getWidth(), v:getHeight() if vw == 0 or vh == 0 or dw == 0 or dh == 0 then return end local s = math.max(vw / dw, vh / dh) * mult local m = luajava.newInstance("android.graphics.Matrix") m:setScale(s, s) m:postTranslate((vw - dw * s) / 2, (vh - dh * s) / 2) v:setImageMatrix(m) end) end local inputBorderBg = getBg(4, 0xFFFFFFFF) inputBorderBg:setStroke(1 * density, 0xFFD0D0D0) local noLineBg = getBg(0, 0x00FFFFFF) local labelBg = getBg(8, 0xFFFFFFFF) local cursorBg = getBg(50, 0xFF333333) local noticeLineBg = getBg(0, 0xFFE8E8E8) local innerHeight, frameHeight = 38, 45 local labelMarginTop, labelMarginLeft = 16, 8 local floatTransY, floatTransX = -17, -5 local leftBg = getRadiiBg(0xFFFFFFFF, true, false, false, true) local rightBg = getRadiiBg(0xFFFFFFFF, false, true, true, false) hanshu = function(v, event) local Action = event:getAction() if Action == MotionEvent.ACTION_DOWN then RawX = event:getRawX() RawY = event:getRawY() x = mainLayoutParams.x y = mainLayoutParams.y elseif Action == MotionEvent.ACTION_MOVE then local newX = x + (event:getRawX() - RawX) local newY = y + (event:getRawY() - RawY) local metrics = context:getResources():getDisplayMetrics() local screenW = metrics.widthPixels local screenH = metrics.heightPixels if newX < 0 then newX = 0 end if newX > screenW - mainLayoutParams.width then newX = screenW - mainLayoutParams.width end if newY < 0 then newY = 0 end if newY > screenH - mainLayoutParams.height then newY = screenH - mainLayoutParams.height end mainLayoutParams.x = newX mainLayoutParams.y = newY window:updateViewLayout(floatWindow, mainLayoutParams) end return false end iconTouch = function(v, event) local action = event:getAction() if action == MotionEvent.ACTION_DOWN then iconRawX = event:getRawX() iconRawY = event:getRawY() iconStartX = mainLayoutParams.x iconStartY = mainLayoutParams.y iconStartTime = os.clock() * 1000 iconIsDragging = false return true elseif action == MotionEvent.ACTION_MOVE then local dx = math.abs(event:getRawX() - iconRawX) local dy = math.abs(event:getRawY() - iconRawY) if not iconIsDragging and (dx > 8 * density or dy > 8 * density) then iconIsDragging = true end if iconIsDragging then mainLayoutParams.x = iconStartX + (event:getRawX() - iconRawX) mainLayoutParams.y = iconStartY + (event:getRawY() - iconRawY) if mainLayoutParams.x < 0 then mainLayoutParams.x = 0 end if mainLayoutParams.y < 0 then mainLayoutParams.y = 0 end window:updateViewLayout(floatWindow, mainLayoutParams) end return true elseif action == MotionEvent.ACTION_UP or action == MotionEvent.ACTION_CANCEL then if not iconIsDragging then local elapsed = os.clock() * 1000 - iconStartTime if elapsed < 250 then 隐藏() end end return true end return false end local view = luajava.loadlayout({ LinearLayout, layout_width = "match_parent", layout_height = "match_parent", orientation = "horizontal", { FrameLayout, id = "leftPanel", layout_width = "0dp", layout_height = "match_parent", layout_weight = 1, background = leftBg, { ImageView, id = "rightImage", layout_width = "match_parent", layout_height = "match_parent", alpha = 0, }, { LinearLayout, id = "loginForm", orientation = "vertical", layout_width = "match_parent", layout_height = "match_parent", paddingLeft = "20dp", paddingTop = "20dp", paddingBottom = "20dp", paddingRight = "8dp", { LinearLayout, layout_width = "match_parent", layout_height = "wrap_content", orientation = "horizontal", gravity = 16, { TextView, id = "titleText", text = "登录", textSize = "18sp", textColor = 0xFF333333, textStyle = "bold", shadowColor = 0x33000000, shadowDx = 1, shadowDy = 1, shadowRadius = 2, layout_width = "wrap_content", layout_height = "wrap_content", }, { View, layout_width = "0dp", layout_weight = 1, layout_height = "1dp", }, { TextView, id = "quickLoginBtn", text = "快速登录", textSize = "12sp", textColor = 0xFF007AFF, textStyle = "bold", shadowColor = 0x33000000, shadowDx = 1, shadowDy = 1, shadowRadius = 2, layout_width = "wrap_content", layout_height = "26dp", gravity = 17, paddingLeft = "10dp", paddingRight = "10dp", background = luajava.newInstance('android.graphics.drawable.GradientDrawable'), }, }, { TextView, id = "subText", text = "尊敬的用户您好", textSize = "12sp", textColor = 0xFF999999, textStyle = "bold", shadowColor = 0x33000000, shadowDx = 1, shadowDy = 1, shadowRadius = 2, layout_width = "wrap_content", layout_height = "wrap_content", layout_marginTop = "2dp", }, { FrameLayout, layout_width = "match_parent", layout_height = frameHeight .. "dp", layout_marginTop = "8dp", { LinearLayout, id = "inputContainer", layout_width = "match_parent", layout_height = innerHeight .. "dp", background = inputBorderBg, paddingLeft = "6dp", paddingRight = "6dp", { FrameLayout, layout_width = "0dp", layout_weight = 1, layout_height = "match_parent", { EditText, id = "inputBox", layout_width = "match_parent", layout_height = "match_parent", background = noLineBg, textSize = "14sp", textColor = 0xFF333333, textStyle = "bold", shadowColor = 0x33000000, shadowDx = 1, shadowDy = 1, shadowRadius = 2, singleLine = true, inputType = 0x00000081, paddingLeft = "8dp", }, { View, id = "cursorView", layout_width = "1.5dp", layout_height = "15dp", layout_marginLeft = "8dp", background = cursorBg, }, }, { TextView, id = "pasteBtn", text = "粘贴", textSize = "12sp", textColor = 0xFF007AFF, textStyle = "bold", shadowColor = 0x33000000, shadowDx = 1, shadowDy = 1, shadowRadius = 2, layout_width = "wrap_content", layout_height = "match_parent", gravity = 16, paddingLeft = "10dp", paddingRight = "4dp", }, }, { TextView, id = "floatLabel", text = "请输入卡密", textSize = "14sp", textColor = 0xFF999999, textStyle = "bold", shadowColor = 0x33000000, shadowDx = 1, shadowDy = 1, shadowRadius = 2, layout_width = "wrap_content", layout_height = "wrap_content", layout_marginTop = labelMarginTop .. "dp", layout_marginLeft = labelMarginLeft .. "dp", background = labelBg, paddingLeft = "4dp", paddingRight = "4dp", }, }, { LinearLayout, layout_width = "match_parent", layout_height = "8dp", }, { TextView, id = "loginBtn", text = "登 录", textSize = "14sp", textColor = 0xFFFFFFFF, textStyle = "bold", shadowColor = 0x33000000, shadowDx = 1, shadowDy = 1, shadowRadius = 2, layout_width = "match_parent", layout_height = "36dp", background = luajava.newInstance('android.graphics.drawable.GradientDrawable'), }, { View, layout_width = "match_parent", layout_height = "0.5dp", background = noticeLineBg, layout_marginTop = "14dp", }, { LinearLayout, id = "noticeBar", layout_width = "match_parent", layout_height = "30dp", orientation = "horizontal", gravity = 16, layout_marginTop = "8dp", visibility = View.GONE, { TextView, id = "noticeDot", text = "●", textSize = "8sp", textColor = 0xFFFF6B35, layout_width = "wrap_content", layout_height = "wrap_content", layout_marginLeft = "8dp", layout_marginRight = "4dp", }, { TextView, id = "noticeBarText", text = "有新内容 点击查看", textSize = "11sp", textColor = 0xFFFF6B35, textStyle = "bold", shadowColor = 0x22000000, shadowDx = 1, shadowDy = 1, shadowRadius = 2, layout_width = "wrap_content", layout_height = "wrap_content", }, { View, layout_width = "0dp", layout_weight = 1, layout_height = "1dp", }, { TextView, id = "noticeArrow", text = "›", textSize = "14sp", textColor = 0xFFFF6B35, textStyle = "bold", layout_width = "wrap_content", layout_height = "wrap_content", layout_marginRight = "8dp", }, }, { LinearLayout, id = "agreementBar", layout_width = "match_parent", layout_height = "30dp", orientation = "horizontal", gravity = 16, layout_marginTop = "6dp", visibility = View.GONE, { TextView, id = "agreementDot", text = "●", textSize = "8sp", textColor = 0xFF007AFF, layout_width = "wrap_content", layout_height = "wrap_content", layout_marginLeft = "8dp", layout_marginRight = "4dp", }, { TextView, id = "agreementBarText", text = "使用协议 点击阅读并同意", textSize = "11sp", textColor = 0xFF007AFF, textStyle = "bold", shadowColor = 0x22000000, shadowDx = 1, shadowDy = 1, shadowRadius = 2, layout_width = "wrap_content", layout_height = "wrap_content", }, { View, layout_width = "0dp", layout_weight = 1, layout_height = "1dp", }, { TextView, id = "agreementArrow", text = "›", textSize = "14sp", textColor = 0xFF007AFF, textStyle = "bold", layout_width = "wrap_content", layout_height = "wrap_content", layout_marginRight = "8dp", }, }, { LinearLayout, id = "countBar", layout_width = "match_parent", layout_height = "30dp", orientation = "horizontal", gravity = 16, layout_marginTop = "6dp", visibility = View.GONE, { TextView, id = "countDot", text = "●", textSize = "8sp", textColor = 0xFF34C759, layout_width = "wrap_content", layout_height = "wrap_content", layout_marginLeft = "8dp", layout_marginRight = "4dp", }, { TextView, id = "countBarText", text = "全网启动次数加载中...", textSize = "11sp", textColor = 0xFF34C759, textStyle = "bold", shadowColor = 0x22000000, shadowDx = 1, shadowDy = 1, shadowRadius = 2, layout_width = "wrap_content", layout_height = "wrap_content", }, { View, layout_width = "0dp", layout_weight = 1, layout_height = "1dp", }, { TextView, id = "countRefresh", text = "↻", textSize = "14sp", textColor = 0xFF34C759, textStyle = "bold", layout_width = "wrap_content", layout_height = "wrap_content", layout_marginRight = "8dp", }, }, }, { TextView, id = "errorText", text = "", textSize = "11sp", textColor = 0xFFFF4444, textStyle = "bold", layout_width = "wrap_content", layout_height = "wrap_content", layout_marginBottom = "8dp", alpha = 0, }, { LinearLayout, id = "kamiErrorPage", layout_width = "match_parent", layout_height = "match_parent", orientation = "vertical", gravity = 17, background = leftBg, paddingLeft = "20dp", paddingRight = "20dp", paddingTop = "20dp", paddingBottom = "20dp", visibility = View.GONE, { TextView, id = "kamiErrorTitle", text = "卡密不存在", textSize = "16sp", textColor = 0xFF333333, textStyle = "bold", shadowColor = 0x33000000, shadowDx = 1, shadowDy = 1, shadowRadius = 2, layout_width = "wrap_content", layout_height = "wrap_content", }, { TextView, id = "kamiErrorSub", text = "验证未通过,请确认后重试", textSize = "12sp", textColor = 0xFF999999, textStyle = "bold", shadowColor = 0x33000000, shadowDx = 1, shadowDy = 1, shadowRadius = 2, layout_width = "wrap_content", layout_height = "wrap_content", layout_marginTop = "4dp", }, { View, layout_width = "match_parent", layout_height = "14dp", }, { TextView, id = "kamiBackBtn", text = "返 回", textSize = "14sp", textColor = 0xFFFFFFFF, textStyle = "bold", shadowColor = 0x33000000, shadowDx = 1, shadowDy = 1, shadowRadius = 2, layout_width = "match_parent", layout_height = "36dp", background = luajava.newInstance('android.graphics.drawable.GradientDrawable'), }, { View, layout_width = "match_parent", layout_height = "8dp", }, { TextView, id = "kamiExitBtn", text = "退 出", textSize = "14sp", textColor = 0xFF999999, textStyle = "bold", shadowColor = 0x33000000, shadowDx = 1, shadowDy = 1, shadowRadius = 2, layout_width = "match_parent", layout_height = "36dp", background = luajava.newInstance('android.graphics.drawable.GradientDrawable'), }, }, { LinearLayout, id = "noticePage", layout_width = "match_parent", layout_height = "match_parent", orientation = "vertical", gravity = 17, background = leftBg, paddingLeft = "20dp", paddingRight = "20dp", paddingTop = "20dp", paddingBottom = "20dp", visibility = View.GONE, { TextView, id = "noticePageTitle", text = "云端公告", textSize = "16sp", textColor = 0xFF333333, textStyle = "bold", shadowColor = 0x33000000, shadowDx = 1, shadowDy = 1, shadowRadius = 2, layout_width = "wrap_content", layout_height = "wrap_content", }, { View, layout_width = "match_parent", layout_height = "10dp", }, { ScrollView, layout_width = "match_parent", layout_height = "130dp", { TextView, id = "noticePageContent", textSize = "12sp", textColor = 0xFF666666, textStyle = "bold", shadowColor = 0x22000000, shadowDx = 1, shadowDy = 1, shadowRadius = 2, layout_width = "match_parent", layout_height = "wrap_content", text = "", }, }, { View, layout_width = "match_parent", layout_height = "16dp", }, { TextView, id = "noticeBackBtn", text = "返 回", textSize = "14sp", textColor = 0xFFFFFFFF, textStyle = "bold", shadowColor = 0x33000000, shadowDx = 1, shadowDy = 1, shadowRadius = 2, layout_width = "match_parent", layout_height = "36dp", background = luajava.newInstance('android.graphics.drawable.GradientDrawable'), }, }, { LinearLayout, id = "agreementPage", layout_width = "match_parent", layout_height = "match_parent", orientation = "vertical", gravity = 17, background = leftBg, paddingLeft = "20dp", paddingRight = "8dp", paddingTop = "20dp", paddingBottom = "20dp", visibility = View.GONE, { TextView, id = "agreementTitle", text = "使用协议", textSize = "16sp", textColor = 0xFF333333, textStyle = "bold", shadowColor = 0x33000000, shadowDx = 1, shadowDy = 1, shadowRadius = 2, layout_width = "wrap_content", layout_height = "wrap_content", }, { TextView, text = "请仔细阅读以下内容", textSize = "9sp", textColor = 0xFFBBBBBB, layout_width = "wrap_content", layout_height = "wrap_content", layout_marginTop = "4dp", }, { View, layout_width = "match_parent", layout_height = "8dp", }, { ScrollView, id = "agreementScroll", layout_width = "match_parent", layout_height = "0dp", layout_weight = 1, fadeScrollbars = false, scrollbars = "vertical", { TextView, id = "agreementContent", textSize = "11sp", textColor = 0xFF555555, layout_width = "match_parent", layout_height = "wrap_content", text = "", lineSpacingExtra = "3dp", }, }, { View, layout_width = "match_parent", layout_height = "8dp", }, { TextView, id = "agreementHint", text = "请向下滑动阅读完整协议", textSize = "10sp", textColor = 0xFFAAAAAA, textStyle = "bold", gravity = 17, layout_width = "match_parent", layout_height = "wrap_content", }, { View, layout_width = "match_parent", layout_height = "6dp", }, { TextView, id = "agreementAgreeBtn", text = "请向下滑动阅读完整协议", textSize = "13sp", textColor = 0xFFFFFFFF, textStyle = "bold", shadowColor = 0x33000000, shadowDx = 1, shadowDy = 1, shadowRadius = 2, layout_width = "match_parent", layout_height = "36dp", background = luajava.newInstance('android.graphics.drawable.GradientDrawable'), }, { TextView, id = "agreementExitBtn", text = "不同意,退出", textSize = "11sp", textColor = 0xFF999999, layout_width = "wrap_content", layout_height = "wrap_content", layout_marginTop = "8dp", }, }, }, { FrameLayout, id = "rightPanel", layout_width = "0dp", layout_weight = 1, layout_height = "match_parent", background = rightBg, { ImageView, id = "finalImage", layout_width = "match_parent", layout_height = "match_parent", alpha = 0, }, { LinearLayout, id = "successView", orientation = "vertical", layout_width = "match_parent", layout_height = "match_parent", alpha = 0, { TextView, id = "successText", text = "卡密验证成功", textSize = "16sp", textColor = 0xFF333333, textStyle = "bold", shadowColor = 0x33000000, shadowDx = 1, shadowDy = 1, shadowRadius = 2, layout_width = "wrap_content", layout_height = "wrap_content", }, }, { ImageView, id = "leftImage", layout_width = "match_parent", layout_height = "match_parent", }, }, }) titleText:setGravity(3) subText:setGravity(3) local inputContainerLp = inputContainer:getLayoutParams() local inputContainerNewLp = luajava.newInstance("android.widget.FrameLayout$LayoutParams", inputContainerLp.width, inputContainerLp.height) inputContainerNewLp.gravity = 80 inputContainer:setLayoutParams(inputContainerNewLp) inputContainer:setGravity(16) inputBox:setGravity(16) pasteBtn:setTypeface(customTypeface) pasteBtn:setGravity(16) pasteBtn:setOnClickListener(luajava.createProxy("android.view.View$OnClickListener", { onClick = function(v) pcall(function() local text = nil pcall(function() local clipboard = context:getSystemService("clipboard") if clipboard then local clip = clipboard:getPrimaryClip() if clip and clip:getItemCount() > 0 then local item = clip:getItemAt(0) if item then local t = item:getText() if t then text = tostring(t) end end end end end) if not text or #text == 0 then pcall(function() local Context = luajava.bindClass("android.content.Context") local clipboard = context:getSystemService(Context.CLIPBOARD_SERVICE) if clipboard then local clip = clipboard:getPrimaryClip() if clip and clip:getItemCount() > 0 then local item = clip:getItemAt(0) if item then local t = item:getText() if t then text = tostring(t) end end end end end) end if not text or #text == 0 then pcall(function() local clipboard = context:getSystemService("clipboard") if clipboard then local clip = clipboard:getPrimaryClip() if clip and clip:getItemCount() > 0 then local t = clip:getItemAt(0):coerceToText(context) if t then text = tostring(t) end end end end) end if text and #text > 0 then inputBox:setText(text) pcall(function() inputBox:setSelection(text:len()) end) pcall(function() inputBox:setSelection(inputBox:getText():length()) end) else gg.toast("请给APP粘贴权限") end end) end })) local cursorLp = cursorView:getLayoutParams() local cursorNewLp = luajava.newInstance("android.widget.FrameLayout$LayoutParams", cursorLp.width, cursorLp.height) cursorNewLp.gravity = 19 cursorNewLp:setMargins(math.floor(8 * density + 0.5), 0, 0, 0) cursorView:setLayoutParams(cursorNewLp) local floatLabelLp = floatLabel:getLayoutParams() local floatLabelNewLp = luajava.newInstance("android.widget.FrameLayout$LayoutParams", floatLabelLp.width, floatLabelLp.height) floatLabelNewLp.gravity = 51 floatLabelNewLp:setMargins(math.floor(labelMarginLeft * density + 0.5), math.floor(labelMarginTop * density + 0.5), 0, 0) floatLabel:setLayoutParams(floatLabelNewLp) loginBtn:setGravity(17) local errorLp = errorText:getLayoutParams() local errorNewLp = luajava.newInstance("android.widget.FrameLayout$LayoutParams", errorLp.width, errorLp.height) errorNewLp.gravity = 81 errorNewLp:setMargins(0, 0, 0, math.floor(8 * density + 0.5)) errorText:setLayoutParams(errorNewLp) successView:setGravity(17) successText:setGravity(17) if Build.VERSION.SDK_INT >= 21 then leftPanel:setClipToOutline(true) rightPanel:setClipToOutline(true) end local loginBg = getBg(4, 0xFF007AFF) local loginBgDown = getBg(4, 0xFF0051D5) loginBtn:setBackground(loginBg) loginBtn:setOnTouchListener(luajava.createProxy("android.view.View$OnTouchListener", { onTouch = function(v, event) local a = event:getAction() if a == MotionEvent.ACTION_DOWN then v:setBackground(loginBgDown) btnPressAnim(v, 0.95) elseif a == MotionEvent.ACTION_UP or a == MotionEvent.ACTION_CANCEL then v:setBackground(loginBg) btnReleaseAnim(v) end return false end })) local quickLoginBg = getBg(12, 0xFFEBF4FF) local quickLoginBgDown = getBg(12, 0xFFD0E6FF) quickLoginBtn:setBackground(quickLoginBg) quickLoginBtn:setTypeface(customTypeface) quickLoginBtn:setClickable(true) quickLoginBtn:setFocusable(true) function doQuickLogin() if not isAgreementAccepted() then showAgreementDirect() gg.toast("请先阅读并同意使用协议") return end local saved = loadSavedKami() if not saved or saved == "" then gg.toast("暂无保存的卡密") return end if KMUI and KMUI._running then KMUI._pendingKami = saved gg.toast("正在快速登录...") else inputBox:setText(saved) doLogin() inputBox:setText("") gg.toast("正在快速登录...") end end quickLoginBtn:setOnTouchListener(luajava.createProxy("android.view.View$OnTouchListener", { onTouch = function(v, event) local a = event:getAction() if a == MotionEvent.ACTION_DOWN then v:setBackground(quickLoginBgDown) btnPressAnim(v, 0.92) elseif a == MotionEvent.ACTION_UP then v:setBackground(quickLoginBg) btnReleaseAnim(v) pcall(doQuickLogin) elseif a == MotionEvent.ACTION_CANCEL then v:setBackground(quickLoginBg) btnReleaseAnim(v) end return true end })) local function initQuickLoginBtn() local saved = loadSavedKami() if saved and saved ~= "" then quickLoginBtn:setVisibility(View.VISIBLE) else quickLoginBtn:setVisibility(View.GONE) end end loadImg(leftImage, baseDir .. "/萧容鱼向左", 1.2) loadImg(rightImage, baseDir .. "/萧容鱼向右", 1.2) inputBox:setCursorVisible(true) cursorView:setVisibility(View.GONE) local asteriskTransform = luajava.createProxy("android.text.method.TransformationMethod", { getTransformation = function(source, view) if source == nil then return nil end local n = source:length() if n == 0 then return source end local sb = luajava.newInstance("java.lang.StringBuilder") for i = 1, n do sb:append("*") end return sb:toString() end, onFocusChanged = function(view, sourceText, focused, direction, previouslyFocusedRect) end }) inputBox:setTransformationMethod(asteriskTransform) titleText:setTypeface(defaultBold) subText:setTypeface(defaultBold) inputBox:setTypeface(defaultBold) floatLabel:setTypeface(defaultBold) successText:setTypeface(defaultBold) loginBtn:setTypeface(customTypeface) kamiErrorTitle:setTypeface(defaultBold) kamiErrorSub:setTypeface(defaultBold) kamiErrorTitle:setGravity(17) kamiErrorSub:setGravity(17) kamiBackBtn:setTypeface(customTypeface) kamiBackBtn:setGravity(17) kamiExitBtn:setTypeface(customTypeface) kamiExitBtn:setGravity(17) local backBtnBg = getBg(4, 0xFF007AFF) local backBtnBgDown = getBg(4, 0xFF0051D5) kamiBackBtn:setBackground(backBtnBg) local exitBtnBg = getBg(4, 0xFFFFFFFF) exitBtnBg:setStroke(1 * density, 0xFFD0D0D0) local exitBtnBgDown = getBg(4, 0xFFF5F5F5) exitBtnBgDown:setStroke(1 * density, 0xFFD0D0D0) kamiExitBtn:setBackground(exitBtnBg) kamiBackBtn:setOnTouchListener(luajava.createProxy("android.view.View$OnTouchListener", { onTouch = function(v, event) local a = event:getAction() if a == MotionEvent.ACTION_DOWN then v:setBackground(backBtnBgDown) btnPressAnim(v, 0.95) elseif a == MotionEvent.ACTION_UP or a == MotionEvent.ACTION_CANCEL then v:setBackground(backBtnBg) btnReleaseAnim(v) end return false end })) kamiExitBtn:setOnTouchListener(luajava.createProxy("android.view.View$OnTouchListener", { onTouch = function(v, event) local a = event:getAction() if a == MotionEvent.ACTION_DOWN then v:setBackground(exitBtnBgDown) btnPressAnim(v, 0.95) elseif a == MotionEvent.ACTION_UP or a == MotionEvent.ACTION_CANCEL then v:setBackground(exitBtnBg) btnReleaseAnim(v) end return false end })) kamiBackBtn:setOnClickListener(luajava.createProxy("android.view.View$OnClickListener", { onClick = function(v) backToLogin() end })) kamiExitBtn:setOnClickListener(luajava.createProxy("android.view.View$OnClickListener", { onClick = function(v) os.exit(0) end })) noticePageTitle:setTypeface(defaultBold) noticePageContent:setTypeface(defaultBold) noticeBackBtn:setTypeface(defaultBold) noticeBackBtn:setGravity(17) noticeBarText:setTypeface(defaultBold) local noticeBarBgDrawable = getBg(6, 0xFFFFF8F0) noticeBarBgDrawable:setStroke(1 * density, 0xFFFFE4CC) noticeBar:setBackground(noticeBarBgDrawable) local noticeBackBtnBg = getBg(4, 0xFF007AFF) local noticeBackBtnBgDown = getBg(4, 0xFF0051D5) noticeBackBtn:setBackground(noticeBackBtnBg) noticeBackBtn:setOnTouchListener(luajava.createProxy("android.view.View$OnTouchListener", { onTouch = function(v, event) local a = event:getAction() if a == MotionEvent.ACTION_DOWN then v:setBackground(noticeBackBtnBgDown) btnPressAnim(v, 0.95) elseif a == MotionEvent.ACTION_UP or a == MotionEvent.ACTION_CANCEL then v:setBackground(noticeBackBtnBg) btnReleaseAnim(v) end return false end })) noticeBackBtn:setOnClickListener(luajava.createProxy("android.view.View$OnClickListener", { onClick = function(v) hideNoticePage() end })) noticeBar:setOnClickListener(luajava.createProxy("android.view.View$OnClickListener", { onClick = function(v) showNoticePage() end })) agreementTitle:setTypeface(defaultBold) agreementAgreeBtn:setTypeface(defaultBold) agreementAgreeBtn:setGravity(17) agreementBarText:setTypeface(defaultBold) agreementHint:setTypeface(defaultBold) local agreementBarBgDrawable = getBg(6, 0xFFF0F6FF) agreementBarBgDrawable:setStroke(1 * density, 0xFFCCE0FF) agreementBar:setBackground(agreementBarBgDrawable) countBarText:setTypeface(defaultBold) local countBarBgDrawable = getBg(6, 0xFFF0FFF5) countBarBgDrawable:setStroke(1 * density, 0xFFCCEBD8) countBar:setBackground(countBarBgDrawable) local countBarBgDown = getBg(6, 0xFFE0F5EC) countBarBgDown:setStroke(1 * density, 0xFFB8DCC8) countBar:setOnTouchListener(luajava.createProxy("android.view.View$OnTouchListener", { onTouch = function(v, event) local a = event:getAction() if a == MotionEvent.ACTION_DOWN then v:setBackground(countBarBgDown) btnPressAnim(v, 0.97) elseif a == MotionEvent.ACTION_UP or a == MotionEvent.ACTION_CANCEL then v:setBackground(countBarBgDrawable) btnReleaseAnim(v) end return false end })) countBar:setOnClickListener(luajava.createProxy("android.view.View$OnClickListener", { onClick = function(v) refreshGlobalCount() end })) local agreementText = [[ 使用游戏作弊工具风险提示与免责声明 一、账号风险 使用本工具可能导致您的游戏账号被官方检测并封禁,包括但不限于永久封号、临时封禁、清除游戏数据等处理。由此造成的账号损失及充值损失由使用者自行承担。 二、设备风险 本工具可能需要特殊权限运行,可能对设备系统稳定性产生影响,包括但不限于闪退、卡顿、数据异常等。请确保重要数据已备份,因使用本工具导致的设备问题由使用者自行承担。 三、法律风险 在部分国家或地区,使用游戏作弊工具可能违反相关法律法规或游戏服务协议。使用者应自行了解并遵守所在地法律法规,因违规使用产生的法律责任由使用者本人承担。 四、游戏体验 使用作弊工具可能破坏游戏平衡性,影响其他玩家的正常游戏体验,可能导致被其他玩家举报。 五、免责声明 本工具仅供学习交流与技术研究使用。创作者不对使用本工具产生的任何直接或间接后果负责,包括但不限于账号封禁、财产损失、法律责任等。使用者需对自己的行为负全部责任。 六、确认 点击下方"我同意并承担所有后果"即表示您已充分阅读并理解以上内容,自愿承担一切因使用本工具可能产生的后果,与工具创作者无关。]] agreementContent:setText(agreementText) local agreeBtnBg = getBg(4, 0xFF007AFF) local agreeBtnBgDisabled = getBg(4, 0xFF999999) local agreeBtnBgDown = getBg(4, 0xFF0051D5) agreementAgreeBtn:setBackground(agreeBtnBgDisabled) agreementAgreeBtn:setEnabled(false) agreementAgreeBtn:setClickable(false) local _agreementScrolledToBottom = false local function onAgreementScrolledToBottom() if _agreementScrolledToBottom then return end _agreementScrolledToBottom = true agreementAgreeBtn:setText("我同意并承担所有后果") agreementAgreeBtn:setBackground(agreeBtnBg) agreementAgreeBtn:setEnabled(true) agreementAgreeBtn:setClickable(true) agreementHint:setText("已阅读完整协议,可点击下方按钮继续") agreementHint:setTextColor(0xFF007AFF) end local function checkAgreementScroll() local scrollY = agreementScroll:getScrollY() local height = agreementScroll:getHeight() local child = agreementScroll:getChildAt(0) if child == nil then return end local contentHeight = child:getHeight() if contentHeight <= height then onAgreementScrolledToBottom() elseif scrollY + height >= contentHeight - 5 then onAgreementScrolledToBottom() end end agreementScroll:getViewTreeObserver():addOnScrollChangedListener( luajava.createProxy("android.view.ViewTreeObserver$OnScrollChangedListener", { onScrollChanged = function() checkAgreementScroll() end }) ) local function checkAgreementScrollDelayed() mainHandler:postDelayed(toRun(function() checkAgreementScroll() end), 300) end agreementAgreeBtn:setOnTouchListener(luajava.createProxy("android.view.View$OnTouchListener", { onTouch = function(v, event) local a = event:getAction() if a == MotionEvent.ACTION_DOWN then if _agreementScrolledToBottom then v:setBackground(agreeBtnBgDown) end btnPressAnim(v, 0.95) elseif a == MotionEvent.ACTION_UP or a == MotionEvent.ACTION_CANCEL then if _agreementScrolledToBottom then v:setBackground(agreeBtnBg) else v:setBackground(agreeBtnBgDisabled) end btnReleaseAnim(v) end return false end })) agreementAgreeBtn:setOnClickListener(luajava.createProxy("android.view.View$OnClickListener", { onClick = function(v) if not _agreementScrolledToBottom then return end saveAgreementAccepted() hideAgreementPage() end })) agreementExitBtn:setOnClickListener(luajava.createProxy("android.view.View$OnClickListener", { onClick = function(v) os.exit(0) end })) agreementBar:setOnClickListener(luajava.createProxy("android.view.View$OnClickListener", { onClick = function(v) showAgreementPage() end })) inputBox:setImeActionLabel("登录", EditorInfo.IME_ACTION_DONE) inputBox:setImeOptions(EditorInfo.IME_ACTION_DONE) local labelFloated = false function updateCursor() local text = inputBox:getText():toString() local w = inputBox:getPaint():measureText(text) cursorView:setTranslationX(w + 2 * density) cursorView:setTranslationY(-1 * density) end function doFloatLabel() if labelFloated then return end labelFloated = true floatLabel:animate():cancel() floatLabel:animate() :translationY(density * floatTransY) :translationX(density * floatTransX) :scaleX(0.8) :scaleY(0.8) :setDuration(280) :setInterpolator(easeOutBack) :start() animateTextColor(floatLabel, 0xFF999999, 0xFF007AFF, 280) end function doSinkLabel() if not labelFloated then return end if inputBox:getText():toString() == "" then labelFloated = false floatLabel:animate():cancel() floatLabel:animate() :translationY(0) :translationX(0) :scaleX(1) :scaleY(1) :setDuration(240) :setInterpolator(easeInOutCubic) :start() animateTextColor(floatLabel, 0xFF007AFF, 0xFF999999, 240) end end inputBox:setOnFocusChangeListener(luajava.createProxy("android.view.View$OnFocusChangeListener", { onFocusChange = function(v, hasFocus) if hasFocus then doFloatLabel() else doSinkLabel() end end })) inputBox:addTextChangedListener(luajava.createProxy("android.text.TextWatcher", { beforeTextChanged = function(s, start, count, after) end, onTextChanged = function(s, start, before, count) if s and s:length() > 0 then doFloatLabel() end errorText:setAlpha(0) end, afterTextChanged = function(s) end })) local verified = false local lastClickTime = 0 function toRun(func) return luajava.createProxy("java.lang.Runnable", { run = func }) end function safeThread(func, tip) if type(func) ~= "function" then return end luajava.newThread(function() local ok, err = pcall(func) if not ok then local msg = (tip or "功能") .. " 执行出错:\n" .. tostring(err) pcall(function() gg.alert(msg) end) end end):start() end function shake(v, onEnd) smoothShake(v, onEnd) end function showError(msg) errorText:setText(msg) errorText:setAlpha(0) errorText:setTranslationY(10 * density) errorText:animate():cancel() errorText:animate() :alpha(1) :translationY(0) :setDuration(350) :setInterpolator(easeOutBack) :withEndAction(toRun(function() mainHandler:postDelayed(toRun(function() smoothShake(errorText, function() errorText:animate() :alpha(0) :translationY(-10 * density) :setDuration(250) :setInterpolator(easeInBack) :start() end) end), 400) end)) :start() end function showKamiError(msg) kamiErrorTitle:setText(msg) pcall(function() local imm = context:getSystemService("input_method") imm:hideSoftInputFromWindow(inputBox:getWindowToken(), 0) end) loginForm:animate():cancel() kamiErrorPage:animate():cancel() loginForm:animate() :alpha(0) :translationX(-30 * density) :setDuration(280) :setInterpolator(easeInBack) :withEndAction(toRun(function() loginForm:setVisibility(View.GONE) loginForm:setTranslationX(0) loginForm:setAlpha(1) kamiErrorPage:setVisibility(View.VISIBLE) kamiErrorPage:setAlpha(0) kamiErrorPage:setTranslationX(30 * density) kamiErrorPage:animate() :alpha(1) :translationX(0) :setDuration(380) :setInterpolator(easeOutBack) :start() end)) :start() end function backToLogin() kamiErrorPage:animate():cancel() loginForm:animate():cancel() kamiErrorPage:animate() :alpha(0) :translationX(30 * density) :setDuration(250) :setInterpolator(easeInBack) :withEndAction(toRun(function() kamiErrorPage:setVisibility(View.GONE) kamiErrorPage:setTranslationX(0) kamiErrorPage:setAlpha(1) loginForm:setVisibility(View.VISIBLE) loginForm:setAlpha(0) loginForm:setTranslationX(-30 * density) loginForm:animate() :alpha(1) :translationX(0) :setDuration(380) :setInterpolator(easeOutBack) :start() end)) :start() end local _noticeBarShown = false function showNoticeBar() if _noticeBarShown then return end _noticeBarShown = true noticeBar:setVisibility(View.VISIBLE) noticeBar:setAlpha(0) noticeBar:setTranslationY(-15 * density) noticeBar:animate():cancel() noticeBar:animate() :alpha(1) :translationY(0) :setDuration(450) :setInterpolator(easeOutBack) :start() end function showNoticePage() loginForm:animate():cancel() noticePage:animate():cancel() loginForm:animate() :alpha(0) :translationX(-30 * density) :setDuration(280) :setInterpolator(easeInBack) :withEndAction(toRun(function() loginForm:setVisibility(View.GONE) loginForm:setTranslationX(0) loginForm:setAlpha(1) noticePage:setVisibility(View.VISIBLE) noticePage:setAlpha(0) noticePage:setTranslationX(30 * density) noticePage:animate() :alpha(1) :translationX(0) :setDuration(380) :setInterpolator(easeOutBack) :start() end)) :start() end function hideNoticePage() loginForm:animate():cancel() noticePage:animate():cancel() noticePage:animate() :alpha(0) :translationX(30 * density) :setDuration(250) :setInterpolator(easeInBack) :withEndAction(toRun(function() noticePage:setVisibility(View.GONE) noticePage:setTranslationX(0) noticePage:setAlpha(1) loginForm:setVisibility(View.VISIBLE) loginForm:setAlpha(0) loginForm:setTranslationX(-30 * density) loginForm:animate() :alpha(1) :translationX(0) :setDuration(380) :setInterpolator(easeOutBack) :start() end)) :start() end local _agreementBarShown = false function showAgreementBar() if _agreementBarShown then return end _agreementBarShown = true agreementBar:setVisibility(View.VISIBLE) agreementBar:setAlpha(0) agreementBar:setTranslationY(-15 * density) agreementBar:animate():cancel() agreementBar:animate() :alpha(1) :translationY(0) :setDuration(450) :setInterpolator(easeOutBack) :start() end local _countBarShown = false function showCountBar() if _countBarShown then return end _countBarShown = true countBar:setVisibility(View.VISIBLE) countBar:setAlpha(0) countBar:setTranslationY(-15 * density) countBar:animate():cancel() countBar:animate() :alpha(1) :translationY(0) :setDuration(450) :setInterpolator(easeOutBack) :start() end function refreshGlobalCount() countBarText:setText("全网启动次数刷新中...") countDot:setTextColor(0xFFAAAAAA) countBarText:setTextColor(0xFFAAAAAA) countRefresh:setTextColor(0xFFAAAAAA) safeThread(function() local ok, ini = pcall(function() return rlyunyz.checkUpdate() end) luajava.runOnUiThread(function() local count = 0 if ok and type(ini) == 'table' then count = tonumber(ini.api_total) or 0 end countBarText:setText(string.format("全网启动次数:%s次", count)) countDot:setTextColor(0xFF34C759) countBarText:setTextColor(0xFF34C759) countRefresh:setTextColor(0xFF34C759) showCountBar() end) end, "全网启动次数") end function showAgreementPage() loginForm:animate():cancel() agreementPage:animate():cancel() loginForm:animate() :alpha(0) :translationX(-30 * density) :setDuration(280) :setInterpolator(easeInBack) :withEndAction(toRun(function() loginForm:setVisibility(View.GONE) loginForm:setTranslationX(0) loginForm:setAlpha(1) agreementPage:setVisibility(View.VISIBLE) agreementPage:setAlpha(0) agreementPage:setTranslationX(30 * density) _agreementScrolledToBottom = false agreementScroll:scrollTo(0, 0) agreementAgreeBtn:setText("请向下滑动阅读完整协议") agreementAgreeBtn:setBackground(agreeBtnBgDisabled) agreementAgreeBtn:setEnabled(false) agreementAgreeBtn:setClickable(false) agreementHint:setText("请向下滑动阅读完整协议") agreementHint:setTextColor(0xFFAAAAAA) agreementPage:animate() :alpha(1) :translationX(0) :setDuration(380) :setInterpolator(easeOutBack) :start() checkAgreementScrollDelayed() end)) :start() end function hideAgreementPage() loginForm:animate():cancel() agreementPage:animate():cancel() agreementPage:animate() :alpha(0) :translationX(30 * density) :setDuration(250) :setInterpolator(easeInBack) :withEndAction(toRun(function() agreementPage:setVisibility(View.GONE) agreementPage:setTranslationX(0) agreementPage:setAlpha(1) loginForm:setVisibility(View.VISIBLE) loginForm:setAlpha(0) loginForm:setTranslationX(-30 * density) loginForm:animate() :alpha(1) :translationX(0) :setDuration(380) :setInterpolator(easeOutBack) :start() end)) :start() end function showAgreementDirect() loginForm:setVisibility(View.GONE) _agreementScrolledToBottom = false agreementScroll:scrollTo(0, 0) agreementAgreeBtn:setText("请向下滑动阅读完整协议") agreementAgreeBtn:setBackground(agreeBtnBgDisabled) agreementAgreeBtn:setEnabled(false) agreementAgreeBtn:setClickable(false) agreementHint:setText("请向下滑动阅读完整协议") agreementHint:setTextColor(0xFFAAAAAA) agreementPage:setVisibility(View.VISIBLE) agreementPage:setAlpha(0) agreementPage:animate():cancel() agreementPage:animate() :alpha(1) :setDuration(400) :setInterpolator(easeOutCubic) :start() checkAgreementScrollDelayed() end function backToLoginPage() pcall(function() leftPanel:animate():cancel() end) pcall(function() rightPanel:animate():cancel() end) pcall(function() loginForm:animate():cancel() end) pcall(function() leftImage:animate():cancel() end) pcall(function() rightImage:animate():cancel() end) pcall(function() successView:animate():cancel() end) pcall(function() finalImage:animate():cancel() end) if Build.VERSION.SDK_INT >= 21 then view:setClipToOutline(false) end view:setBackgroundColor(0x00000000) leftPanel:setAlpha(1) leftPanel:setVisibility(View.VISIBLE) rightPanel:setAlpha(1) rightPanel:setVisibility(View.VISIBLE) rightImage:setAlpha(0) loginForm:setVisibility(View.VISIBLE) loginForm:setAlpha(1) loginForm:setTranslationX(0) leftImage:setAlpha(1) leftImage:setVisibility(View.VISIBLE) leftImage:setTranslationX(0) successView:setAlpha(0) pcall(function() while successView:getChildCount() > 1 do successView:removeViewAt(successView:getChildCount() - 1) end end) finalImage:setAlpha(0) kamiErrorPage:setVisibility(View.GONE) kamiErrorPage:setAlpha(1) noticePage:setVisibility(View.GONE) noticePage:setAlpha(1) noticePage:setTranslationX(0) agreementPage:setVisibility(View.GONE) agreementPage:setAlpha(1) agreementPage:setTranslationX(0) inputBox:setText("") verified = false lastClickTime = 0 local llp = luajava.newInstance("android.widget.LinearLayout$LayoutParams", 0, -1) llp.weight = 1 view:addView(leftPanel, llp) local rlp = luajava.newInstance("android.widget.LinearLayout$LayoutParams", 0, -1) rlp.weight = 1 view:addView(rightPanel, rlp) end function showUnbindInfo() local kami = KMUI._verifiedKami or "" local unbindDone = false local function maskKami(k) local len = #k if len <= 4 then return k:sub(1, 1) .. string.rep("*", len - 2) .. k:sub(-1) end return k:sub(1, 3) .. string.rep("*", len - 4) .. k:sub(-1) end local unbindLineBg = getBg(0, 0xFFE8E8E8) local unbindDotBg = getBg(50, 0xFF007AFF) local unbindLayout = luajava.loadlayout({ LinearLayout, layout_width = "match_parent", layout_height = "match_parent", orientation = "vertical", background = getBg(16, 0xFFFFFFFF), paddingLeft = "24dp", paddingRight = "24dp", paddingTop = "28dp", paddingBottom = "28dp", { TextView, text = "解绑信息", textSize = "16sp", textColor = 0xFF333333, textStyle = "bold", shadowColor = 0x33000000, shadowDx = 1, shadowDy = 1, shadowRadius = 2, layout_width = "wrap_content", layout_height = "wrap_content", }, { View, layout_width = "match_parent", layout_height = "0.5dp", background = unbindLineBg, layout_marginTop = "12dp", }, { LinearLayout, layout_width = "match_parent", layout_height = "wrap_content", orientation = "horizontal", gravity = 16, layout_marginTop = "14dp", { View, layout_width = "2.5dp", layout_height = "10dp", background = unbindDotBg, layout_marginRight = "5dp", }, { TextView, text = "当前卡密", textSize = "13sp", textColor = 0xFF999999, textStyle = "bold", shadowColor = 0x33000000, shadowDx = 1, shadowDy = 1, shadowRadius = 2, layout_width = "wrap_content", layout_height = "wrap_content", }, { View, layout_width = "0dp", layout_height = "1dp", layout_weight = 1, }, { TextView, id = "unbindStatus", text = maskKami(kami), textSize = "13sp", textColor = 0xFF007AFF, textStyle = "bold", shadowColor = 0x33000000, shadowDx = 1, shadowDy = 1, shadowRadius = 2, layout_width = "wrap_content", layout_height = "wrap_content", }, }, { LinearLayout, layout_width = "match_parent", layout_height = "wrap_content", orientation = "horizontal", gravity = 16, layout_marginTop = "12dp", { View, layout_width = "2.5dp", layout_height = "10dp", background = unbindDotBg, layout_marginRight = "5dp", }, { TextView, text = "设备状态", textSize = "13sp", textColor = 0xFF999999, textStyle = "bold", shadowColor = 0x33000000, shadowDx = 1, shadowDy = 1, shadowRadius = 2, layout_width = "wrap_content", layout_height = "wrap_content", }, { View, layout_width = "0dp", layout_height = "1dp", layout_weight = 1, }, { TextView, id = "unbindDevice", text = "已绑定", textSize = "13sp", textColor = 0xFF007AFF, textStyle = "bold", shadowColor = 0x33000000, shadowDx = 1, shadowDy = 1, shadowRadius = 2, layout_width = "wrap_content", layout_height = "wrap_content", }, }, { View, layout_width = "match_parent", layout_height = "0dp", layout_weight = 1, }, { TextView, id = "unbindBtn", text = "内置解绑", textSize = "14sp", textColor = 0xFFFFFFFF, textStyle = "bold", shadowColor = 0x33000000, shadowDx = 1, shadowDy = 1, shadowRadius = 2, layout_width = "match_parent", layout_height = "36dp", background = luajava.newInstance('android.graphics.drawable.GradientDrawable'), }, { View, layout_width = "match_parent", layout_height = "8dp", }, { TextView, id = "unbindEnterBtn", text = "直接进入", textSize = "14sp", textColor = 0xFF999999, textStyle = "bold", shadowColor = 0x33000000, shadowDx = 1, shadowDy = 1, shadowRadius = 2, layout_width = "match_parent", layout_height = "36dp", background = luajava.newInstance('android.graphics.drawable.GradientDrawable'), }, }) local wrapper = luajava.newInstance('android.widget.FrameLayout', context) local wlp = luajava.newInstance("android.widget.LinearLayout$LayoutParams", -1, -1) view:addView(wrapper, wlp) local flp = luajava.newInstance("android.widget.FrameLayout$LayoutParams", -1, -1) wrapper:addView(unbindLayout, flp) unbindLayout:setAlpha(0) unbindLayout:setScaleX(0.9) unbindLayout:setScaleY(0.9) unbindLayout:animate() :alpha(1) :scaleX(1) :scaleY(1) :setDuration(350) :setInterpolator(easeOutBack) :start() unbindBtn:setTypeface(customTypeface) unbindBtn:setGravity(17) unbindEnterBtn:setTypeface(customTypeface) unbindEnterBtn:setGravity(17) local unbindBtnBg = getBg(4, 0xFF007AFF) local unbindBtnBgDown = getBg(4, 0xFF0051D5) local unbindBtnBgDone = getBg(4, 0xFF1DC981) unbindBtn:setBackground(unbindBtnBg) local enterBtnBg = getBg(4, 0xFFFFFFFF) enterBtnBg:setStroke(1 * density, 0xFFD0D0D0) local enterBtnBgDown = getBg(4, 0xFFF5F5F5) enterBtnBgDown:setStroke(1 * density, 0xFFD0D0D0) unbindEnterBtn:setBackground(enterBtnBg) unbindBtn:setOnTouchListener(luajava.createProxy("android.view.View$OnTouchListener", { onTouch = function(v, event) if unbindDone then return true end local a = event:getAction() if a == MotionEvent.ACTION_DOWN then v:setBackground(unbindBtnBgDown) btnPressAnim(v, 0.95) elseif a == MotionEvent.ACTION_UP or a == MotionEvent.ACTION_CANCEL then v:setBackground(unbindBtnBg) btnReleaseAnim(v) end return false end })) unbindEnterBtn:setOnTouchListener(luajava.createProxy("android.view.View$OnTouchListener", { onTouch = function(v, event) local a = event:getAction() if a == MotionEvent.ACTION_DOWN then v:setBackground(enterBtnBgDown) btnPressAnim(v, 0.95) elseif a == MotionEvent.ACTION_UP or a == MotionEvent.ACTION_CANCEL then v:setBackground(enterBtnBg) btnReleaseAnim(v) end return false end })) unbindBtn:setOnClickListener(luajava.createProxy("android.view.View$OnClickListener", { onClick = function(v) if unbindDone then return end unbindBtn:setEnabled(false) unbindEnterBtn:setEnabled(false) if Build.VERSION.SDK_INT >= 31 then local RenderEffect = luajava.bindClass("android.graphics.RenderEffect") unbindLayout:setRenderEffect(RenderEffect:createBlurEffect(8, 8, luajava.bindClass("android.graphics.Shader$TileMode").CLAMP)) else unbindLayout:setAlpha(0.3) end local confirmLayout = luajava.loadlayout({ LinearLayout, layout_width = "match_parent", layout_height = "match_parent", orientation = "vertical", gravity = 17, background = getBg(16, 0x80000000), paddingLeft = "20dp", paddingRight = "20dp", paddingTop = "20dp", paddingBottom = "20dp", { TextView, id = "cfmTitle", text = "解绑页面", textSize = "16sp", textColor = 0xFFFFFFFF, textStyle = "bold", shadowColor = 0x33000000, shadowDx = 1, shadowDy = 1, shadowRadius = 2, layout_width = "wrap_content", layout_height = "wrap_content", }, { TextView, id = "cfmSub", text = "这是最后的警告!\n解绑后将清除当前设备绑定,换设备需重新验证\n解绑后5秒自动退出", textSize = "12sp", textColor = 0xFFCCCCCC, textStyle = "bold", shadowColor = 0x33000000, shadowDx = 1, shadowDy = 1, shadowRadius = 2, layout_width = "wrap_content", layout_height = "wrap_content", layout_marginTop = "4dp", }, { View, layout_width = "match_parent", layout_height = "14dp", }, { TextView, id = "confirmUnbindBtn", text = "坚持解绑", textSize = "14sp", textColor = 0xFFFFFFFF, textStyle = "bold", shadowColor = 0x33000000, shadowDx = 1, shadowDy = 1, shadowRadius = 2, layout_width = "match_parent", layout_height = "36dp", background = luajava.newInstance('android.graphics.drawable.GradientDrawable'), }, { View, layout_width = "match_parent", layout_height = "8dp", }, { TextView, id = "cancelUnbindBtn", text = "取 消", textSize = "14sp", textColor = 0xFFCCCCCC, textStyle = "bold", shadowColor = 0x33000000, shadowDx = 1, shadowDy = 1, shadowRadius = 2, layout_width = "match_parent", layout_height = "36dp", background = luajava.newInstance('android.graphics.drawable.GradientDrawable'), }, }) local clp = luajava.newInstance("android.widget.FrameLayout$LayoutParams", -1, -1) wrapper:addView(confirmLayout, clp) confirmLayout:setAlpha(0) confirmLayout:setScaleX(0.85) confirmLayout:setScaleY(0.85) confirmLayout:animate() :alpha(1) :scaleX(1) :scaleY(1) :setDuration(320) :setInterpolator(easeOutBack) :start() cfmTitle:setTypeface(defaultBold) cfmSub:setTypeface(defaultBold) cfmTitle:setGravity(17) cfmSub:setGravity(17) confirmUnbindBtn:setTypeface(customTypeface) confirmUnbindBtn:setGravity(17) cancelUnbindBtn:setTypeface(customTypeface) cancelUnbindBtn:setGravity(17) local cfmBg = getBg(4, 0xFF007AFF) local cfmBgDown = getBg(4, 0xFF0051D5) confirmUnbindBtn:setBackground(cfmBg) local cclBg = getBg(4, 0xFFFFFFFF) cclBg:setStroke(1 * density, 0xFFD0D0D0) local cclBgDown = getBg(4, 0xFFF5F5F5) cclBgDown:setStroke(1 * density, 0xFFD0D0D0) cancelUnbindBtn:setBackground(cclBg) confirmUnbindBtn:setOnTouchListener(luajava.createProxy("android.view.View$OnTouchListener", { onTouch = function(v2, e2) local a2 = e2:getAction() if a2 == MotionEvent.ACTION_DOWN then v2:setBackground(cfmBgDown) btnPressAnim(v2, 0.95) elseif a2 == MotionEvent.ACTION_UP or a2 == MotionEvent.ACTION_CANCEL then v2:setBackground(cfmBg) btnReleaseAnim(v2) end return false end })) cancelUnbindBtn:setOnTouchListener(luajava.createProxy("android.view.View$OnTouchListener", { onTouch = function(v2, e2) local a2 = e2:getAction() if a2 == MotionEvent.ACTION_DOWN then v2:setBackground(cclBgDown) btnPressAnim(v2, 0.95) elseif a2 == MotionEvent.ACTION_UP or a2 == MotionEvent.ACTION_CANCEL then v2:setBackground(cclBg) btnReleaseAnim(v2) end return false end })) local function closeConfirm() confirmLayout:animate() :alpha(0) :scaleX(0.9) :scaleY(0.9) :setDuration(200) :setInterpolator(easeInBack) :withEndAction(toRun(function() wrapper:removeView(confirmLayout) if Build.VERSION.SDK_INT >= 31 then unbindLayout:setRenderEffect(nil) else unbindLayout:setAlpha(1) end unbindBtn:setEnabled(true) unbindEnterBtn:setEnabled(true) end)):start() end cancelUnbindBtn:setOnClickListener(luajava.createProxy("android.view.View$OnClickListener", { onClick = function(v2) closeConfirm() end })) confirmUnbindBtn:setOnClickListener(luajava.createProxy("android.view.View$OnClickListener", { onClick = function(v2) unbindDone = true confirmUnbindBtn:setText("解绑中...") confirmUnbindBtn:setBackground(cfmBgDown) cancelUnbindBtn:setVisibility(View.GONE) safeThread(function() local res = rlyunyz.postApi('kmunmachine', {kami = kami}) luajava.runOnUiThread(function() if type(res) == 'table' and res.code == 200 then unbindDevice:setText("已解绑") unbindDevice:setTextColor(0xFF1DC981) unbindBtn:setText("解绑成功") unbindBtn:setBackground(unbindBtnBgDone) cfmTitle:setText("解绑成功") cfmTitle:setTextColor(0xFF1DC981) cfmSub:setText("设备绑定已清除,可更换设备重新验证") confirmUnbindBtn:setVisibility(View.GONE) cancelUnbindBtn:setVisibility(View.GONE) mainHandler:postDelayed(toRun(function() confirmLayout:animate() :alpha(0) :scaleX(0.9) :scaleY(0.9) :setDuration(250) :setInterpolator(easeInBack) :withEndAction(toRun(function() wrapper:removeView(confirmLayout) unbindLayout:animate() :alpha(0) :scaleX(0.95) :scaleY(0.95) :setDuration(250) :setInterpolator(easeInBack) :withEndAction(toRun(function() view:removeView(wrapper) backToLoginPage() end)):start() end)):start() end), 6000) else local failMsg = "解绑失败" if type(res) == 'table' and type(res.msg) == 'string' then failMsg = res.msg elseif type(res) == 'string' then failMsg = res end unbindDevice:setText(failMsg) unbindDevice:setTextColor(0xFFFF4444) unbindBtn:setText("解绑失败") unbindBtn:setBackground(unbindBtnBgDone) unbindDone = false cfmTitle:setText("解绑失败") cfmTitle:setTextColor(0xFFFF4444) cfmSub:setText(failMsg) confirmUnbindBtn:setText("确定") confirmUnbindBtn:setBackground(cfmBg) confirmUnbindBtn:setOnClickListener(luajava.createProxy("android.view.View$OnClickListener", { onClick = function(v3) closeConfirm() cancelUnbindBtn:setVisibility(View.VISIBLE) end })) end end) end, "解绑") end })) end })) unbindEnterBtn:setOnClickListener(luajava.createProxy("android.view.View$OnClickListener", { onClick = function(v) unbindLayout:animate() :alpha(0) :scaleX(0.95) :scaleY(0.95) :setDuration(250) :setInterpolator(easeInBack) :withEndAction(toRun(function() view:removeView(wrapper) KMUI._running = false if KMUI.onEnter then KMUI.onEnter(KMUI._verifiedKami or '') end end)):start() end })) end function showSuccess(remainStr, useCount) if verified then return end verified = true local imm = context:getSystemService("input_method") imm:hideSoftInputFromWindow(inputBox:getWindowToken(), 0) local dist = 100 * density loginForm:animate():cancel() leftImage:animate():cancel() rightImage:animate():cancel() successView:animate():cancel() loginForm:animate() :translationX(dist) :alpha(0) :setDuration(400) :setInterpolator(easeInBack) :start() leftImage:animate() :translationX(-dist * 1.2) :alpha(0) :setDuration(450) :setInterpolator(easeInBack) :setStartDelay(20) :start() rightImage:setAlpha(0) rightImage:setScaleX(1.1) rightImage:setScaleY(1.1) rightImage:setTranslationX(60 * density) rightImage:animate() :alpha(1) :scaleX(1) :scaleY(1) :translationX(0) :setDuration(800) :setInterpolator(easeOutCubic) :setStartDelay(200) :withEndAction(toRun(function() loginForm:setVisibility(View.GONE) leftImage:setVisibility(View.GONE) successView:setAlpha(0) successView:setScaleX(0.8) successView:setScaleY(0.8) successView:setTranslationY(20 * density) successView:animate() :alpha(1) :scaleX(1) :scaleY(1) :translationY(0) :setDuration(500) :setInterpolator(easeOutBack) :start() local expireText = luajava.newInstance("android.widget.TextView", context) expireText:setText(remainStr) expireText:setTextSize(12) expireText:setTextColor(0xFF999999) expireText:setTypeface(defaultBold) expireText:setGravity(17) expireText:setAlpha(0) expireText:setTranslationY(10 * density) local lp = luajava.newInstance("android.widget.LinearLayout$LayoutParams", luajava.newInstance("android.view.ViewGroup$LayoutParams", -2, -2)) lp:setMargins(0, 8 * density, 0, 0) expireText:setLayoutParams(lp) successView:addView(expireText) local countText = luajava.newInstance("android.widget.TextView", context) countText:setText("使用次数:" .. tostring(useCount)) countText:setTextSize(12) countText:setTextColor(0xFF007AFF) countText:setTypeface(defaultBold) countText:setGravity(17) countText:setAlpha(0) countText:setTranslationY(10 * density) local lp2 = luajava.newInstance("android.widget.LinearLayout$LayoutParams", luajava.newInstance("android.view.ViewGroup$LayoutParams", -2, -2)) lp2:setMargins(0, 5 * density, 0, 0) countText:setLayoutParams(lp2) successView:addView(countText) mainHandler:postDelayed(toRun(function() expireText:animate() :alpha(1) :translationY(0) :setDuration(400) :setInterpolator(easeOutBack) :start() end), 200) mainHandler:postDelayed(toRun(function() countText:animate() :alpha(1) :translationY(0) :setDuration(400) :setInterpolator(easeOutBack) :start() end), 350) loadImg(finalImage, baseDir .. "/沈幼楚", 1.2) mainHandler:postDelayed(toRun(function() successView:animate() :alpha(0) :translationY(-15 * density) :setDuration(350) :setInterpolator(easeInBack) :withEndAction(toRun(function() mainHandler:postDelayed(toRun(function() finalImage:setAlpha(0) finalImage:setScaleX(0.92) finalImage:setScaleY(0.92) finalImage:animate() :alpha(1) :scaleX(1) :scaleY(1) :setDuration(600) :setInterpolator(easeOutBack) :withEndAction(toRun(function() mainHandler:postDelayed(toRun(function() local whiteBg = getBg(16, 0xFFFFFFFF) view:setBackground(whiteBg) if Build.VERSION.SDK_INT >= 21 then view:setClipToOutline(true) end leftPanel:animate():alpha(0):setDuration(600):setInterpolator(easeInOutCubic):start() rightPanel:animate():alpha(0):setDuration(600):setInterpolator(easeInOutCubic):withEndAction(toRun(function() view:removeAllViews() showUnbindInfo() end)):start() end), 1500) end)) :start() end), 20) end)) :start() end), 2500) end)) :start() end function doLogin() if not isAgreementAccepted() then showAgreementDirect() gg.toast("请先阅读并同意使用协议") return end local now = os.time() if now - lastClickTime < 2 then return end lastClickTime = now local kami = inputBox:getText():toString() if kami == "" then return end KMUI._pendingKami = kami end loginBtn:setOnClickListener(luajava.createProxy("android.view.View$OnClickListener", { onClick = function(v) doLogin() end })) inputBox:setOnEditorActionListener(luajava.createProxy("android.widget.TextView$OnEditorActionListener", { onEditorAction = function(v, actionId, event) if actionId == EditorInfo.IME_ACTION_DONE or (event ~= nil and event:getKeyCode() == 66) then doLogin() return true end return false end })) xfqpic = baseDir .. "/陈楚生" ICON_SIZE = math.floor(45 * density + 0.5) EXPANDED_WIDTH = math.floor(宽度 * density + 0.5) EXPANDED_HEIGHT = math.floor(高度 * density + 0.5) lastExpandedWidth = EXPANDED_WIDTH lastExpandedHeight = EXPANDED_HEIGHT iconBgDrawable = luajava.newInstance('android.graphics.drawable.GradientDrawable') iconBgDrawable:setShape(1) iconBgDrawable:setColor(0xFF007AFF) iconLayer = luajava.loadlayout({ FrameLayout, id = "iconLayer", layout_width = "45dp", layout_height = "45dp", background = iconBgDrawable, visibility = View.GONE, { ImageView, layout_width = "match_parent", layout_height = "match_parent", src = xfqpic, scaleType = "centerCrop", onTouch = iconTouch, } }) if Build.VERSION.SDK_INT >= 21 then iconLayer:setClipToOutline(true) iconLayer:setElevation(6 * density) end morphRoot = luajava.loadlayout({ FrameLayout, id = "morphRoot", layout_width = "match_parent", layout_height = "match_parent", view, { FrameLayout, id = "dragBar", layout_width = "60dp", layout_height = "48dp", onTouch = function(v, event) hanshu(v, event) return true end, background = getBg(0, 0x00000000), } }) floatWindow = luajava.loadlayout({ FrameLayout, id = "floatWindow", layout_width = "wrap_content", layout_height = "wrap_content", morphRoot, iconLayer, }) local LayoutParams = luajava.bindClass("android.view.WindowManager$LayoutParams") local params = luajava.new(LayoutParams) if Build.VERSION.SDK_INT >= 26 then params.type = LayoutParams.TYPE_APPLICATION_OVERLAY else params.type = LayoutParams.TYPE_PHONE end params.format = PixelFormat.RGBA_8888 params.flags = LayoutParams.FLAG_NOT_TOUCH_MODAL params.gravity = Gravity.LEFT | Gravity.TOP local metrics = context:getResources():getDisplayMetrics() local screenW = metrics.widthPixels local screenH = metrics.heightPixels params.x = math.floor((screenW - EXPANDED_WIDTH) / 2 + 0.5) params.y = math.floor((screenH - EXPANDED_HEIGHT) / 2 + 0.5) params.width = EXPANDED_WIDTH params.height = EXPANDED_HEIGHT params.softInputMode = LayoutParams.SOFT_INPUT_ADJUST_RESIZE mainLayoutParams = params luajava.runOnUiThread(function() window:addView(floatWindow, mainLayoutParams) initQuickLoginBtn() startQPopAnim(morphRoot) if not isAgreementAccepted() then showAgreementDirect() end end) safeThread(function() local res = rlyunyz.postApi('notice', nil) luajava.runOnUiThread(function() local txt = nil if type(res) == 'table' and res.code == 200 then if type(res.msg) == 'table' and res.msg.app_gg then txt = res.msg.app_gg elseif type(res.msg) == 'string' and #res.msg > 0 then txt = res.msg end end if txt and #txt > 0 then noticePageContent:setText(txt) else noticePageContent:setText("作者在看片忘记写公告了") noticeBarText:setText("故辞国体") noticeBarText:setTextColor(0xFFAAAAAA) noticeDot:setTextColor(0xFFCCCCCC) noticeArrow:setTextColor(0xFFCCCCCC) end showNoticeBar() end) end, "公告") safeThread(function() local ok, ini = pcall(function() return rlyunyz.checkUpdate() end) luajava.runOnUiThread(function() local count = 0 if ok and type(ini) == 'table' then count = tonumber(ini.api_total) or 0 end countBarText:setText(string.format("全网启动次数:%s次", count)) showCountBar() end) end, "全网启动次数") isExpanded = true isAnimating = false function 隐藏() if isAnimating then return end luajava.runOnUiThread(function() if not morphRoot then return end if isExpanded then isExpanded = false isAnimating = true lastExpandedWidth = mainLayoutParams.width lastExpandedHeight = mainLayoutParams.height morphRoot:setPivotX(0) morphRoot:setPivotY(0) view:animate():cancel() view:animate() :alpha(0) :scaleX(0.92) :scaleY(0.92) :setDuration(180) :setInterpolator(easeInBack) :start() morphRoot:animate():cancel() morphRoot:animate() :scaleX(ICON_SIZE / lastExpandedWidth) :scaleY(ICON_SIZE / lastExpandedHeight) :setDuration(320) :setInterpolator(easeInOutBack) :withEndAction(toRun(function() view:setVisibility(View.GONE) view:setAlpha(1) view:setScaleX(1) view:setScaleY(1) mainLayoutParams.width = ICON_SIZE mainLayoutParams.height = ICON_SIZE mainLayoutParams.flags = LayoutParams.FLAG_NOT_FOCUSABLE window:updateViewLayout(floatWindow, mainLayoutParams) morphRoot:setScaleX(1) morphRoot:setScaleY(1) iconLayer:setVisibility(View.VISIBLE) iconLayer:setAlpha(0) iconLayer:setScaleX(0.3) iconLayer:setScaleY(0.3) iconLayer:animate():cancel() iconLayer:animate() :alpha(1) :scaleX(1) :scaleY(1) :setDuration(350) :setInterpolator(easeOutBack) :withEndAction(toRun(function() isAnimating = false end)) :start() end)) :start() else isExpanded = true isAnimating = true iconLayer:animate():cancel() iconLayer:animate() :alpha(0) :scaleX(0.7) :scaleY(0.7) :setDuration(150) :setInterpolator(easeInBack) :withEndAction(toRun(function() iconLayer:setVisibility(View.GONE) iconLayer:setAlpha(1) iconLayer:setScaleX(1) iconLayer:setScaleY(1) mainLayoutParams.width = lastExpandedWidth mainLayoutParams.height = lastExpandedHeight mainLayoutParams.flags = LayoutParams.FLAG_NOT_TOUCH_MODAL window:updateViewLayout(floatWindow, mainLayoutParams) morphRoot:setPivotX(0) morphRoot:setPivotY(0) morphRoot:setScaleX(ICON_SIZE / lastExpandedWidth) morphRoot:setScaleY(ICON_SIZE / lastExpandedHeight) morphRoot:animate():cancel() morphRoot:animate() :scaleX(1) :scaleY(1) :setDuration(420) :setInterpolator(easeOutBack) :withEndAction(toRun(function() isAnimating = false end)) :start() view:setVisibility(View.VISIBLE) view:setAlpha(0) view:setScaleX(0.95) view:setScaleY(0.95) view:animate():cancel() view:animate() :alpha(1) :scaleX(1) :scaleY(1) :setDuration(350) :setInterpolator(easeOutCubic) :setStartDelay(80) :start() end)) :start() end end) end useCountPath = gg.FILES_DIR .. "/我真没想重生啊配置/usecount.dat" savedKamiPath = gg.FILES_DIR .. "/我真没想重生啊配置/savedkami.dat" agreementPath = gg.FILES_DIR .. "/我真没想重生啊配置/使用协议" function isAgreementAccepted() local f = io.open(agreementPath, "r") if f then f:close() return true end return false end function saveAgreementAccepted() local f = io.open(agreementPath, "w") if f then f:write("agreed") f:close() end end function saveKami(kami) if not kami or kami == "" then return end local f = io.open(savedKamiPath, "w") if f then f:write(kami) f:close() end end function loadSavedKami() local f = io.open(savedKamiPath, "r") if f then local kami = f:read("*a") f:close() if kami and kami ~= "" then return kami end end return nil end function clearSavedKami() os.remove(savedKamiPath) end function addUseCount(kami) local counts = {} local f = io.open(useCountPath, "r") if f then local content = f:read("*a") f:close() if content and content ~= "" then for k, v in content:gmatch("(%S+)=(%d+)") do counts[k] = tonumber(v) or 0 end end end counts[kami] = (counts[kami] or 0) + 1 local out = {} for k, v in pairs(counts) do out[#out + 1] = k .. "=" .. tostring(v) end f = io.open(useCountPath, "w") if f then f:write(table.concat(out, "\n")) f:close() end return counts[kami] end KMUI = {} KMUI._running = true KMUI._pendingKami = nil KMUI._verifiedKami = nil KMUI.onEnter = nil function KMUI.exit() KMUI._running = false end function KMUI.start() while KMUI._running do if KMUI._pendingKami then local kami = KMUI._pendingKami local kamiyz = rlyunyz.postApi('kmlogon', {kami = kami}) luajava.runOnUiThread(function() local success = false local remainStr = "使用剩余时间:未知" local useCount = 0 if type(kamiyz) == 'table' and kamiyz.code == 200 then success = true local msg = kamiyz.msg if type(msg) == 'table' and msg.vip then local n = tonumber(msg.vip) if n then local now = tonumber(kamiyz.time) or os.time() local remainSec = n - now if remainSec > 0 then local days = math.floor(remainSec / 86400) local hours = math.floor((remainSec % 86400) / 3600) local mins = math.floor((remainSec % 3600) / 60) if days > 0 then remainStr = string.format("使用剩余时间:%d天%d小时%d分钟", days, hours, mins) elseif hours > 0 then remainStr = string.format("使用剩余时间:%d小时%d分钟", hours, mins) else remainStr = string.format("使用剩余时间:%d分钟", mins) end else remainStr = "使用剩余时间:已到期" end end end useCount = addUseCount(kami) end if not success then local errMsg = "卡密验证失败" if type(kamiyz) == 'string' then if kamiyz:find("不存在") then errMsg = "卡密不存在" elseif kamiyz:find("到期") or kamiyz:find("过期") then errMsg = "卡密已到期" else errMsg = kamiyz end elseif type(kamiyz) == 'table' and type(kamiyz.msg) == 'string' then errMsg = kamiyz.msg end KMUI._pendingKami = nil showKamiError(errMsg) else KMUI._verifiedKami = kami saveKami(kami) showSuccess(remainStr, useCount) end end) KMUI._pendingKami = nil end gg.sleep(100) end luajava.runOnUiThread(function() pcall(function() if floatWindow then endQPopAnim(morphRoot, function() pcall(function() if floatWindow then window:removeView(floatWindow) floatWindow = nil end end) end) end end) end) end KMUI.start() if not pcall(peizhi) then end