Esempio n. 1
0
        private void OnSelectedCharacter(Object p_sender, EventArgs p_args)
        {
            if (DragDropManager.Instance.DraggedItem != null)
            {
                Boolean flag  = DragDropManager.Instance.DraggedItem is BasicActionDragObject;
                Boolean flag2 = DragDropManager.Instance.DraggedItem is SpellDragObject;
                Boolean flag3 = DragDropManager.Instance.DraggedItem is QuickActionDragObject;
                Boolean flag4 = DragDropManager.Instance.DraggedItem is ItemDragObject;
                if (flag || flag2 || flag3 || flag4)
                {
                    DragDropManager.Instance.CancelDragAction();
                }
            }
            Character selectedCharacter = LegacyLogic.Instance.WorldManager.Party.SelectedCharacter;

            for (Int32 i = 0; i < m_actionButtons.Length; i++)
            {
                CharacterQuickActions.Action action = selectedCharacter.QuickActions[i];
                m_actionButtons[i].Reset();
                m_actionButtons[i].Type  = action.Type;
                m_actionButtons[i].Spell = selectedCharacter.SpellHandler.GetSpell(action.Spell);
                m_actionButtons[i].Item  = action.Item;
                m_actionButtons[i].UpdateItemCounter();
                m_actionButtons[i].UpdateVisibility();
                m_actionButtons[i].CheckUsability();
                if (action.Type == EQuickActionType.USE_BEST_HEALTHPOTION)
                {
                    m_actionButtons[i].GetBestPotion(EPotionType.HEALTH_POTION);
                }
                else if (action.Type == EQuickActionType.USE_BEST_MANAPOTION)
                {
                    m_actionButtons[i].GetBestPotion(EPotionType.MANA_POTION);
                }
            }
        }
Esempio n. 2
0
        private void Start()
        {
            Character selectedCharacter = LegacyLogic.Instance.WorldManager.Party.SelectedCharacter;

            for (Int32 i = 0; i < m_actionButtons.Length; i++)
            {
                CharacterQuickActions.Action action = selectedCharacter.QuickActions[i];
                m_actionButtons[i].Init(i, action.Type, action.Item, selectedCharacter.SpellHandler.GetSpell(action.Spell));
            }
            UpdateHotkeys();
            LegacyLogic.Instance.EventManager.RegisterEvent(EEventType.CHARACTER_SELECTED, new EventHandler(OnSelectedCharacter));
            LegacyLogic.Instance.EventManager.RegisterEvent(EEventType.UPDATE_AVAILABLE_ACTIONS, new EventHandler(OnUpdateAvailableActions));
            LegacyLogic.Instance.EventManager.RegisterEvent(EEventType.MONSTER_SELECTED, new EventHandler(OnUpdateAvailableActions));
            LegacyLogic.Instance.EventManager.RegisterEvent(EEventType.INPUT_CHANGED, new EventHandler(OnOptionsChanged));
        }