Last active
January 18, 2017 02:40
-
-
Save yaqinking/2e0058c1ad163ac5daa02fe14f66050e to your computer and use it in GitHub Desktop.
添加浮动的系统控制到 KAGEX 中
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// put under code to AfterInit.tjs | |
// 浮动系统控制的 message layer index,在 macro 里初始化的带 button 的 message layer 和这个数字要相同 | |
var float_sys_control_layer_index = 5; | |
/** | |
* 鼠标移动的 callback | |
* 添加鼠标移动到指定位置显示 layer | |
*/ | |
function mouseMoveFunc(x, y, shift) { | |
//dm("mouseMoveFunc x-> ", x, " y->", y, " shift-> ", shift); | |
if (!kag.fore.messages[0].visible) { | |
return; | |
} | |
if (x > 0 && y > 650) { | |
if (!kag.fore.messages[float_sys_control_layer_index].visible) { | |
kag.fore.messages[float_sys_control_layer_index].setVisibleTime(true, 300); | |
} | |
} else { | |
if (kag.fore.messages[float_sys_control_layer_index].visible) { | |
kag.fore.messages[float_sys_control_layer_index].setVisibleTime(false, 300); | |
} | |
} | |
} | |
// 添加鼠标移动时的 hook function | |
kag.mouseMoveHook.add(mouseMoveFunc); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment