@@ -67,8 +67,8 @@ function M:init(node_or_node_id, callback, custom_args, anim_node)
67
67
self .start_scale = gui .get_scale (self .anim_node )
68
68
self .start_pos = gui .get_position (self .anim_node )
69
69
self .params = custom_args
70
- self .hover = self .druid :new_hover (node_or_node_id , self ._on_button_hover )
71
- self .hover .on_mouse_hover :subscribe (self ._on_button_mouse_hover )
70
+ self .hover = self .druid :new_hover (node_or_node_id , self .button_hover )
71
+ self .hover .on_mouse_hover :subscribe (self .button_mouse_hover )
72
72
self .click_zone = nil
73
73
self .is_repeated_started = false
74
74
self .last_pressed_time = 0
@@ -184,7 +184,7 @@ function M:on_input(action_id, action)
184
184
if self ._is_html5_mode then
185
185
self ._is_html5_listener_set = true
186
186
html5 .set_interaction_listener (function ()
187
- self :_on_button_click ()
187
+ self :button_click ()
188
188
end )
189
189
end
190
190
return is_consume
@@ -193,7 +193,7 @@ function M:on_input(action_id, action)
193
193
-- While hold button, repeat rate pick from input.repeat_interval
194
194
if action .repeated then
195
195
if not self .on_repeated_click :is_empty () and self .can_action then
196
- self :_on_button_repeated_click ()
196
+ self :button_repeated_click ()
197
197
return is_consume
198
198
end
199
199
end
@@ -211,7 +211,7 @@ function M:on_input(action_id, action)
211
211
end
212
212
213
213
if press_time >= self .style .LONGTAP_TIME then
214
- self :_on_button_hold (press_time )
214
+ self :button_hold (press_time )
215
215
return is_consume
216
216
end
217
217
end
@@ -326,18 +326,18 @@ end
326
326
327
327
328
328
--- @param hover_state boolean True if the hover state is active
329
- function M :_on_button_hover (hover_state )
329
+ function M :button_hover (hover_state )
330
330
self .style .on_hover (self , self .anim_node , hover_state )
331
331
end
332
332
333
333
334
334
--- @param hover_state boolean True if the hover state is active
335
- function M :_on_button_mouse_hover (hover_state )
335
+ function M :button_mouse_hover (hover_state )
336
336
self .style .on_mouse_hover (self , self .anim_node , hover_state )
337
337
end
338
338
339
339
340
- function M :_on_button_click ()
340
+ function M :button_click ()
341
341
if self ._is_html5_mode then
342
342
self ._is_html5_listener_set = false
343
343
html5 .set_interaction_listener (nil )
@@ -348,7 +348,7 @@ function M:_on_button_click()
348
348
end
349
349
350
350
351
- function M :_on_button_repeated_click ()
351
+ function M :button_repeated_click ()
352
352
if not self .is_repeated_started then
353
353
self .click_in_row = 0
354
354
self .is_repeated_started = true
@@ -360,23 +360,23 @@ function M:_on_button_repeated_click()
360
360
end
361
361
362
362
363
- function M :_on_button_long_click ()
363
+ function M :button_long_click ()
364
364
self .click_in_row = 1
365
365
local time = socket .gettime () - self .last_pressed_time
366
366
self .on_long_click :trigger (self :get_context (), self .params , self , time )
367
367
self .style .on_click (self , self .anim_node )
368
368
end
369
369
370
370
371
- function M :_on_button_double_click ()
371
+ function M :button_double_click ()
372
372
self .click_in_row = self .click_in_row + 1
373
373
self .on_double_click :trigger (self :get_context (), self .params , self , self .click_in_row )
374
374
self .style .on_click (self , self .anim_node )
375
375
end
376
376
377
377
378
378
--- @param press_time number Amount of time the button was held
379
- function M :_on_button_hold (press_time )
379
+ function M :button_hold (press_time )
380
380
self .on_hold_callback :trigger (self :get_context (), self .params , self , press_time )
381
381
end
382
382
@@ -413,14 +413,14 @@ function M:_on_button_release()
413
413
if is_long_click then
414
414
local is_hold_complete = (time - self .last_pressed_time ) >= self .style .AUTOHOLD_TRIGGER
415
415
if is_hold_complete then
416
- self :_on_button_long_click ()
416
+ self :button_long_click ()
417
417
else
418
418
self .on_click_outside :trigger (self :get_context (), self .params , self )
419
419
end
420
420
elseif is_double_click then
421
- self :_on_button_double_click ()
421
+ self :button_double_click ()
422
422
else
423
- self :_on_button_click ()
423
+ self :button_click ()
424
424
end
425
425
426
426
self .last_released_time = time
0 commit comments