示例#1
0
文件: Spells.cs 项目: teamstor/aod
        public static IEnumerator <ICoroutineOperation> Show(WorldState world, OnSpellsUICompleted completeEvent = null, bool noOffset = false)
        {
            SpellsUI sui = new SpellsUI(world, world.Player, noOffset);

            sui._completedEvent = completeEvent;
            return(world.Coroutine.Start(sui.ShowCoroutine));
        }
示例#2
0
文件: Player.cs 项目: teamstor/aod
        private void UpdateHook(object sender, Game.UpdateEventArgs e)
        {
            if (_offsetY == 0)
            {
                if (!_closed && InputMap.FindMapping(InputAction.Inventory).Pressed(_world.Input))
                {
                    InventoryUI.Show(_world, _entity, null, true);
                    _transitioning = true;
                }

                if (!_closed && InputMap.FindMapping(InputAction.Spells).Pressed(_world.Input))
                {
                    SpellsUI.Show(_world, null, true);
                    _transitioning = true;
                }

                if (InputMap.FindMapping(InputAction.Back).Pressed(_world.Input) ||
                    InputMap.FindMapping(InputAction.Inventory).Pressed(_world.Input) ||
                    InputMap.FindMapping(InputAction.Spells).Pressed(_world.Input))
                {
                    _closed = true;
                }
            }
        }
示例#3
0
文件: Inventory.cs 项目: teamstor/aod
        private void UpdateHook(object sender, Game.UpdateEventArgs e)
        {
            if (_offsetY == 0)
            {
                if (!_closed && _state is WorldState && InputMap.FindMapping(InputAction.Spells).Pressed(_state.Input))
                {
                    SpellsUI.Show(_state as WorldState, null, true);
                    _transitioning = true;
                }

                if (!_closed && _state is WorldState && InputMap.FindMapping(InputAction.Player).Pressed(_state.Input))
                {
                    PlayerUI.Show(_state as WorldState, null, true);
                    _transitioning = true;
                }

                if (InputMap.FindMapping(InputAction.Back).Pressed(_state.Input) ||
                    (_state is WorldState && InputMap.FindMapping(InputAction.Spells).Pressed(_state.Input)) ||
                    (_state is WorldState && InputMap.FindMapping(InputAction.Player).Pressed(_state.Input)))
                {
                    _closed = true;
                }

                if (_rightPaneSelected)
                {
                    if (InputMap.FindMapping(InputAction.Left).Pressed(_state.Input))
                    {
                        if (_selectedAction > 0)
                        {
                            _selectedAction--;
                        }
                        else
                        {
                            _rightPaneSelected = false;
                        }
                    }

                    if (InputMap.FindMapping(InputAction.Right).Pressed(_state.Input))
                    {
                        if (_selectedAction < _actions.Count - 1)
                        {
                            _selectedAction++;
                        }
                        else
                        {
                            _rightPaneSelected = false;
                        }
                    }

                    if (InputMap.FindMapping(InputAction.Action).Pressed(_state.Input) &&
                        _actions.Count > 0 &&
                        !(_state is CombatState && !(_sortedList[_selectedSlot].Item is CombatItem)))
                    {
                        int oldAction = _selectedAction;
                        _actions[_selectedAction].OnAction(_actions[_selectedAction], _entity, _sortedList[_selectedSlot], this);

                        // update actions manually
                        IEnumerator <ICoroutineOperation> func = ChangeSelectedSlot(_selectedSlot);
                        while (func.MoveNext())
                        {
                        }

                        _selectedAction = oldAction;

                        if (CloseOnAction)
                        {
                            WasActionPerformedOnClose = true;
                            _closed = true;
                        }
                    }
                }
                else if (_selectedSlot != -1 && !_rightPaneSelected)
                {
                    if (InputMap.FindMapping(InputAction.Up).Pressed(_state.Input))
                    {
                        if (_selectedSlot > 0)
                        {
                            _state.Coroutine.AddExisting(ChangeSelectedSlot(_selectedSlot - 1));
                        }
                        else
                        {
                            _state.Coroutine.AddExisting(ChangeSelectedSlot(_entity.Inventory.OccupiedSlots - 1));
                        }
                    }

                    if (InputMap.FindMapping(InputAction.Down).Pressed(_state.Input))
                    {
                        if (_selectedSlot < _entity.Inventory.OccupiedSlots - 1)
                        {
                            _state.Coroutine.AddExisting(ChangeSelectedSlot(_selectedSlot + 1));
                        }
                        else
                        {
                            _state.Coroutine.AddExisting(ChangeSelectedSlot(0));
                        }
                    }

                    if (InputMap.FindMapping(InputAction.Left).Pressed(_state.Input))
                    {
                        _rightPaneSelected = true;
                        _selectedAction    = _actions.Count - 1;
                    }

                    if (InputMap.FindMapping(InputAction.Right).Pressed(_state.Input))
                    {
                        _rightPaneSelected = true;
                        _selectedAction    = 0;
                    }
                }

                if (_state is CombatState && _selectedSlot != -1 && !(_sortedList[_selectedSlot].Item is CombatItem) && _rightPaneSelected)
                {
                    _rightPaneSelected = false;
                }
            }
        }