예제 #1
0
        private void OnUpdateAvailableActions(Object p_sender, EventArgs p_args)
        {
            PartyTurnActor partyTurnActor   = LegacyLogic.Instance.UpdateManager.PartyTurnActor;
            Int32          currentCharacter = LegacyLogic.Instance.WorldManager.Party.CurrentCharacter;
            Boolean        isOpen           = LegacyLogic.Instance.ConversationManager.IsOpen;

            m_moveForwardButton.SetEnabled(partyTurnActor.CanDoCommand(MoveCommand.Forward, currentCharacter));
            m_moveBackwardButton.SetEnabled(partyTurnActor.CanDoCommand(MoveCommand.Backward, currentCharacter));
            m_strifeLeftButton.SetEnabled(partyTurnActor.CanDoCommand(MoveCommand.Left, currentCharacter));
            m_strifeRightButton.SetEnabled(partyTurnActor.CanDoCommand(MoveCommand.Right, currentCharacter));
            m_turnLeftButton.SetEnabled(partyTurnActor.CanDoCommand(RotateCommand.Left, currentCharacter));
            m_turnRightButton.SetEnabled(partyTurnActor.CanDoCommand(RotateCommand.Right, currentCharacter));
            m_inventoryButton.SetEnabled(!isOpen);
            m_spellbookButton.SetEnabled(!isOpen);
            m_journalButton.SetEnabled(!isOpen);
        }
예제 #2
0
        public void UpdateData()
        {
            if (!m_visible)
            {
                return;
            }
            if (m_isForStandardAction)
            {
                PartyTurnActor partyTurnActor = LegacyLogic.Instance.UpdateManager.PartyTurnActor;
                m_isAvailable = false;
                m_isUsable    = true;
                switch (m_actionType)
                {
                case EQuickActionType.ATTACK:
                    m_isAvailable = partyTurnActor.CanDoCommand(MeleeAttackCommand.Instance, m_character.Index);
                    m_isUsable    = m_character.Equipment.IsMeleeAttackWeaponEquiped();
                    break;

                case EQuickActionType.ATTACKRANGED:
                    m_isAvailable = partyTurnActor.CanDoCommand(RangeAttackCommand.Instance, m_character.Index);
                    m_isUsable    = m_character.Equipment.IsRangedAttackWeaponEquiped();
                    break;

                case EQuickActionType.USE_BEST_MANAPOTION:
                {
                    Potion bestPotion = LegacyLogic.Instance.WorldManager.Party.GetBestPotion(EPotionType.MANA_POTION, null);
                    if (bestPotion != null)
                    {
                        InventorySlotRef consumableSlot = LegacyLogic.Instance.WorldManager.Party.GetConsumableSlot(bestPotion);
                        m_isAvailable = partyTurnActor.CanDoCommand(new ConsumeCommand(consumableSlot, m_character.Index), m_character.Index);
                    }
                    else
                    {
                        m_isUsable = false;
                    }
                    break;
                }

                case EQuickActionType.USE_BEST_HEALTHPOTION:
                {
                    Potion bestPotion2 = LegacyLogic.Instance.WorldManager.Party.GetBestPotion(EPotionType.HEALTH_POTION, null);
                    if (bestPotion2 != null)
                    {
                        InventorySlotRef consumableSlot2 = LegacyLogic.Instance.WorldManager.Party.GetConsumableSlot(bestPotion2);
                        m_isAvailable = partyTurnActor.CanDoCommand(new ConsumeCommand(consumableSlot2, m_character.Index), m_character.Index);
                    }
                    else
                    {
                        m_isUsable = false;
                    }
                    break;
                }

                case EQuickActionType.DEFEND:
                    m_isAvailable = partyTurnActor.CanDoCommand(DefendCommand.Instance, m_character.Index);
                    break;
                }
                NGUITools.SetActiveSelf(m_labelMana.gameObject, false);
                m_icon.color     = m_iconColor;
                m_iconItem.color = m_iconColor;
                if (m_isUsable)
                {
                    m_labelName.color = ((!m_isAvailable) ? m_unlearnedColorText : m_normalColor);
                }
                else
                {
                    m_labelName.color = m_notUsableColorText;
                }
            }
            else if (m_isForPassiveAbility)
            {
                m_labelName.color = ((!m_hasSpell) ? m_unlearnedColorText : m_normalColor);
                m_labelMana.color = ((!m_hasSpell) ? m_unlearnedColorText : m_normalColor);
                m_icon.color      = ((!m_hasSpell) ? m_unlearnedColor : m_iconColor);
                NGUITools.SetActiveSelf(m_labelMana.gameObject, true);
            }
            else
            {
                m_isUsable = true;
                NGUITools.SetActiveSelf(m_labelMana.gameObject, m_hasSpell);
                if (m_hasSpell)
                {
                    PartyTurnActor partyTurnActor2 = LegacyLogic.Instance.UpdateManager.PartyTurnActor;
                    m_isAvailable = partyTurnActor2.CanDoCommand(new CastSpellCommand(m_spell, null, null), m_character.Index);
                    m_icon.color  = m_iconColor;
                    if (m_isAvailable)
                    {
                        m_labelName.color = m_normalColor;
                        m_labelMana.color = m_normalColor;
                    }
                    else
                    {
                        m_isUsable = (m_character.ManaPoints >= m_spell.StaticData.ManaCost);
                        if (m_spell.SpellType == ECharacterSpell.SPELL_LIGHT_LAY_ON_HANDS)
                        {
                            m_isUsable = (m_character.ManaPoints >= 1);
                        }
                        m_labelName.color = ((!m_isUsable) ? m_notUsableColorText : m_unlearnedColorText);
                        m_labelMana.color = ((!m_isUsable) ? m_notUsableColorText : m_unlearnedColorText);
                    }
                }
                else
                {
                    m_isAvailable     = false;
                    m_icon.color      = m_unlearnedColor;
                    m_labelName.color = m_unlearnedColorText;
                }
            }
        }