NOTICE: By continued use of this site you understand and agree to the binding Terms of Service and Privacy Policy.
// ==UserScript== // @name Kamihime Project R - Maximum exchange choice as default // @description Defaults shop exchange amount to maximum value instead of 1. Be careful about draconic eye exchange. // @license MIT // @match https://gnkh-api-r.prod.nkh.dmmgames.com/front/cocos2d-proj/components-pc/game/app.html // @updateURL https://openuserjs.org/meta/nike/Kamihime_Project_R_-_Maximum_exchange_choice_as_default.meta.js // @run-at document-start // ==/UserScript== (function () { var interval = setInterval(function () { if (typeof kh !== 'undefined' && kh.shop && kh.shop.controller && kh.shop.controller.ShopCheckChangePopupController) { clearInterval(interval); kh.shop.controller.ShopCheckChangePopupController.prototype._setBuyPopupPulldown = function (node, record) { // 個数のpulldown情報を取得する var condition = this._getPulldownCondition(record); var enable = !!condition.length; node.seekWidgetByName("btn_pulldown").setVisible(enable); node.seekWidgetByName("unit_label").setVisible(enable); var btnExchange = node.seekWidgetByName(this.BUTTON_NAMES.EXCHANGE); btnExchange.setTouchEnabled(enable); btnExchange.color = enable ? cc.color("#FFFFFF") : cc.color("#808080"); if (!condition.length) { return; } // プルダウンの基準点調整 var sortUI = node.seekWidgetByName("sort_ui"); if (condition && condition.length < 10) { var pulldownNodeHeight = 45; var sortUIBaseY = 134; var adjustY = ( 10 - condition.length ) * pulldownNodeHeight; sortUI.setPositionY(sortUIBaseY - adjustY); } var pulldownBody = node.seekWidgetByName("btn_pulldown"); // プルダウンボタンのnodeを呼び出した直後にタッチ領域をtrueにしてあげる。 pulldownBody.setTouchEnabled(true); // このポップアップ内には'amount_label'というラベルが二か所存在する。プルダウンは二つ目。 this.popupPulldown = new kh.Pulldown({ button: pulldownBody, label: pulldownBody.seekWidgetByName("amount_label"), menuBase: node.seekWidgetByName("gud_sh_sort"), choice: ccs.load(res["core-sort-sort_list_ui"]).node }, condition ); this.popupPulldown.onChange(function (selected) { this._selectedValue = selected.value; this._setMaterials(node, record); }.bind(this)); this._selectedValue = condition.at(-1).value pulldownBody.seekWidgetByName("amount_label").setString(condition.at(-1).text) this._setMaterials(node, record); } } }, 10); })();