67 lines
		
	
	
		
			1.4 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
			
		
		
	
	
			67 lines
		
	
	
		
			1.4 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
| /*
 | |
| 文件名:Scroll_Bar.nut
 | |
| 路径:User/UI/Widget/Scroll_Bar.nut
 | |
| 创建日期:2024-12-13	23:17
 | |
| 文件用途:
 | |
| */
 | |
| //滚动条
 | |
| class Yosin_ScrollBar extends Yosin_CommonUi {
 | |
|     //控制器
 | |
|     Controller = null;
 | |
| 
 | |
|     //是否焦点
 | |
|     IsFocus = false;
 | |
| 
 | |
|     //上按钮
 | |
|     UpButton = null;
 | |
|     //滚动按钮
 | |
|     ScrollButton = null;
 | |
|     //下按钮
 | |
|     DownButton = null;
 | |
| 
 | |
|     //回调函数
 | |
|     OnChange = null;
 | |
| 
 | |
|     //Path
 | |
|     Path = "sprite/interface/lenheartwindowcommon.img";
 | |
| 
 | |
|     constructor(X, Y, H, S_H) {
 | |
|         base.constructor(X, Y, 9, H > 26 ? H : 26);
 | |
| 
 | |
|         Controller = {
 | |
|             CurPos = 0,
 | |
|         }
 | |
| 
 | |
|         //上按钮
 | |
|         UpButton = Yosin_BaseButton(0, 0, 9, 13, Path, 16);
 | |
|         //点击事件回调
 | |
|         UpButton.OnClick = function(Button) {
 | |
| 
 | |
|         }.bindenv(this);
 | |
|         AddUIChild(UpButton);
 | |
| 
 | |
|         //滚动条
 | |
|         ScrollButton = Yosin_DragButton(0, 13, 9, S_H, Path, 184, false, false);
 | |
|         ScrollButton.SetMaxMoveValue(Height - 26);
 | |
|         AddUIChild(ScrollButton);
 | |
| 
 | |
|         //下按钮
 | |
|         DownButton = Yosin_BaseButton(0, Height - 13, 9, 13, Path, 22);
 | |
|         //点击事件回调
 | |
|         DownButton.OnClick = function(Button) {
 | |
| 
 | |
|         }.bindenv(this);
 | |
|         AddUIChild(DownButton);
 | |
| 
 | |
|     }
 | |
| 
 | |
|     function Proc(Dt) {
 | |
|         base.Proc(Dt);
 | |
|         Controller.CurPos = ScrollButton.Detect_Value;
 | |
|     }
 | |
| 
 | |
|     function SetChangeCallBack(Func) {
 | |
|         ScrollButton.OnChange = Func;
 | |
|     }
 | |
| 
 | |
| } |