void aui_Button::MouseLDropInside( aui_MouseEvent *mouseData ) { if (IsDisabled()) { g_soundManager->AddGameSound(GAMESOUNDS_DISABLED); return; } if ( !GetWhichSeesMouse() || GetWhichSeesMouse() == this ) { SetWhichSeesMouse( this ); if ( GetMouseOwnership() == this ) { ReleaseMouseOwnership(); PlaySound( AUI_SOUNDBASE_SOUND_EXECUTE ); m_mouseCode = AUI_ERRCODE_HANDLEDEXCLUSIVE; m_attributes &= ~k_CONTROL_ATTRIBUTE_DOWN; m_attributes &= ~k_CONTROL_ATTRIBUTE_ACTIVE; m_draw |= m_drawMask & k_AUI_REGION_DRAWFLAG_MOUSELDROPINSIDE; m_isRepeating = FALSE; if(GetAttracting()) { SetAttract(false, 0); } if ( !HandleGameSpecificLeftClick( this ) ) if ( m_ActionFunc ) m_ActionFunc( this, AUI_BUTTON_ACTION_EXECUTE, 0, m_cookie ); else if ( m_action ) m_action->Execute( this, AUI_BUTTON_ACTION_EXECUTE, 0 ); } else { PlaySound( AUI_SOUNDBASE_SOUND_ACTIVATE ); if ( m_mouseCode == AUI_ERRCODE_UNHANDLED ) m_mouseCode = AUI_ERRCODE_HANDLED; m_attributes |= k_CONTROL_ATTRIBUTE_ACTIVE; m_draw |= m_drawMask & k_AUI_REGION_DRAWFLAG_MOUSELDROPINSIDE; } } else MouseLDropOutside( mouseData ); }
void aui_Button::KeyboardCallback( aui_KeyboardEvent *keyboardData ) { if ( !GetMouseOwnership() && ( keyboardData->key == AUI_KEYBOARD_KEY_RETURN)) { if ( keyboardData->down && !m_keyboardEvent.down ) { PlaySound( AUI_SOUNDBASE_SOUND_ENGAGE ); HideTipWindow(); m_attributes |= k_CONTROL_ATTRIBUTE_DOWN; m_attributes |= k_CONTROL_ATTRIBUTE_ACTIVE; m_draw |= m_drawMask & k_AUI_REGION_DRAWFLAG_KEYSTATECHANGE; m_isRepeating = TRUE; m_repeatCount = 0; m_startWaitTime = keyboardData->time; if ( m_ActionFunc ) m_ActionFunc( this, AUI_BUTTON_ACTION_PRESS, 0, m_cookie ); else if ( m_action ) m_action->Execute( this, AUI_BUTTON_ACTION_PRESS, 0 ); } else if ( !keyboardData->down && m_keyboardEvent.down ) { PlaySound( AUI_SOUNDBASE_SOUND_EXECUTE ); m_attributes &= ~k_CONTROL_ATTRIBUTE_DOWN; m_attributes &= ~k_CONTROL_ATTRIBUTE_ACTIVE; m_draw |= m_drawMask & k_AUI_REGION_DRAWFLAG_KEYSTATECHANGE; if(GetAttracting()) { SetAttract(false, 0); } m_isRepeating = FALSE; if ( m_ActionFunc ) m_ActionFunc( this, AUI_BUTTON_ACTION_EXECUTE, 0, m_cookie ); else if ( m_action ) m_action->Execute( this, AUI_BUTTON_ACTION_EXECUTE, 0 ); } } }
LTBOOL CAIButeMgr::Init(ILTCSBase *pInterface, const char* szAttributeFile) { if (g_pAIButeMgr || !szAttributeFile) return LTFALSE; if (!Parse(pInterface, szAttributeFile)) return LTFALSE; // Set up global pointer g_pAIButeMgr = this; // See how many attribute templates there are m_cTemplateID = 0; sprintf(s_aTagName, "%s%d", "AttributeTemplate", m_cTemplateID); while (m_buteMgr.Exist(s_aTagName)) { m_cTemplateID++; sprintf(s_aTagName, "%s%d", "AttributeTemplate", m_cTemplateID); } m_aTemplates = debug_newa(AIBM_Template, m_cTemplateID); for ( int iTemplate = 0 ; iTemplate < m_cTemplateID ; iTemplate++ ) { SetTemplate(iTemplate); } // See how many brains there are m_cBrainID = 0; sprintf(s_aTagName, "%s%d", "Brain", m_cBrainID); while (m_buteMgr.Exist(s_aTagName)) { m_cBrainID++; sprintf(s_aTagName, "%s%d", "Brain", m_cBrainID); } m_aBrains = debug_newa(AIBM_Brain, m_cBrainID); for ( int iBrain = 0 ; iBrain < m_cBrainID ; iBrain++ ) { SetBrain(iBrain); } SetSenses(); SetAttract(); SetDEdit(); m_buteMgr.Term(); return LTTRUE; }