コード例 #1
0
    public void Hide(CharInventoryState newState)
    {
        if (CurrentCritter != null)
        {
            GameSystems.TimeEvent.ResumeGameTime();
        }

        if (UiSystems.Popup.IsAnyOpen())
        {
            UiSystems.Popup.CloseAll();
        }

        if (CurrentPage >= 1 && CurrentPage <= 4)
        {
            CurrentPage = 0;
        }

        Inventory.BagIndex = 0;

        if (GameSystems.Combat.IsCombatActive())
        {
            // Clear the flag that allows us to change more than one item while in the inventory menu,
            // without losing even more of our turn.
            var tbStatus = GameSystems.D20.Actions.curSeqGetTurnBasedStatus();
            tbStatus.tbsFlags &= ~TurnBasedStatusFlags.ChangedWornItem;
        }

        if (Inventory.DraggedObject != null)
        {
            Inventory.DraggedObject = null;
            Tig.Mouse.ClearDraggedIcon();
        }

        _mainWidget.Hide();
        Stats.Hide();
        Portrait.Hide();
        Inventory.Hide();
        Skills.Hide();
        Feats.Hide();
        Spells.Hide();
        LevelUp.Hide();

        switch (_state)
        {
        case CharInventoryState.Closed:
            break;

        case CharInventoryState.Looting:
        case CharInventoryState.Bartering:
        case CharInventoryState.Unknown6:
            if (newState != _state)
            {
                Looting.Hide();
            }

            break;

        case CharInventoryState.LevelUp:
            LevelUp.Hide();
            break;

        case CharInventoryState.CastingSpell:
            _itemPickedCallback?.Invoke(null);
            _itemPickedCallback = null;
            break;

        case CharInventoryState.PartyPool:
            break;

        default:
            throw new ArgumentOutOfRangeException();
        }

        State          = newState;
        CurrentCritter = null;
        Help.Hide();
    }