Пример #1
0
        protected void InitializeHandlers(BoxCollider mapCollider, bool giveUserControl)
        {
            //IL_000e: Unknown result type (might be due to invalid IL or missing references)
            CameraHandler current = CameraHandler.current;

            current.Initialize(m_mapDefinition, mapCollider.get_bounds(), giveUserControl);
            m_inputHandler = new FightMapInputHandler(mapCollider, current);
        }
Пример #2
0
        private bool TargetInputEvent(out Vector2Int?coords)
        {
            FightMapInputHandler inputHandler = m_inputHandler;

            switch (m_targetInputMode)
            {
            case TargetInputMode.Click:
                coords = inputHandler.mouseButtonReleaseLocation;
                return(inputHandler.clickedMouseButton);

            case TargetInputMode.Drag:
                coords = inputHandler.mouseButtonReleaseLocation;
                return(inputHandler.releasedMouseButton);

            default:
                throw new ArgumentOutOfRangeException();
            }
        }
Пример #3
0
        private void UpdatePreviewMode()
        {
            //IL_002b: Unknown result type (might be due to invalid IL or missing references)
            //IL_0030: Unknown result type (might be due to invalid IL or missing references)
            //IL_0032: Unknown result type (might be due to invalid IL or missing references)
            //IL_004d: Unknown result type (might be due to invalid IL or missing references)
            FightMapInputHandler inputHandler = m_inputHandler;

            if (inputHandler.pressedMouseButton)
            {
                if (!inputHandler.mouseButtonPressLocation.HasValue)
                {
                    return;
                }
                Vector2Int value = inputHandler.mouseButtonPressLocation.Value;
                if (!TryGetRegionIndex(value, out int regionIndex))
                {
                    return;
                }
                FightMapMovementContext fightMapMovementContext = m_movementContexts[regionIndex];
                if (fightMapMovementContext.entityProvider.TryGetEntityAt(value, out ICharacterEntity character))
                {
                    if (m_activeMovementContext != null)
                    {
                        m_activeMovementContext.End();
                    }
                    fightMapMovementContext.Begin(character, m_pathFinder);
                    m_activeMovementContext = fightMapMovementContext;
                    m_feedbackNeedsUpdate   = true;
                }
            }
            else if (inputHandler.releasedMouseButton)
            {
                FightMapMovementContext activeMovementContext = m_activeMovementContext;
                if (activeMovementContext != null)
                {
                    activeMovementContext.End();
                    m_activeMovementContext = null;
                    m_feedbackNeedsUpdate   = true;
                }
            }
        }
Пример #4
0
        private void UpdateMovementMode()
        {
            //IL_003e: Unknown result type (might be due to invalid IL or missing references)
            //IL_0043: Unknown result type (might be due to invalid IL or missing references)
            //IL_0045: Unknown result type (might be due to invalid IL or missing references)
            //IL_0067: Unknown result type (might be due to invalid IL or missing references)
            //IL_00b6: Unknown result type (might be due to invalid IL or missing references)
            FightMapInputHandler inputHandler = m_inputHandler;

            if (inputHandler.pressedMouseButton)
            {
                if (m_pathFinder.tracking || !inputHandler.mouseButtonPressLocation.HasValue)
                {
                    return;
                }
                Vector2Int value = inputHandler.mouseButtonPressLocation.Value;
                if (!TryGetRegionIndex(value, out int regionIndex))
                {
                    return;
                }
                FightMapMovementContext fightMapMovementContext = m_movementContexts[regionIndex];
                IMapEntityProvider      entityProvider          = fightMapMovementContext.entityProvider;
                if (entityProvider.TryGetEntityAt(value, out ICharacterEntity character))
                {
                    if (m_activeMovementContext != null)
                    {
                        m_activeMovementContext.End();
                    }
                    fightMapMovementContext.Begin(character, m_pathFinder);
                    m_activeMovementContext = fightMapMovementContext;
                    m_feedbackNeedsUpdate   = true;
                    if (entityProvider.IsCharacterPlayable(character))
                    {
                        m_pathFinder.Begin(value, character.movementPoints, fightMapMovementContext.canPassThrough);
                        m_cellPointerManager.EndHighlightingPlayableCharacters();
                    }
                    m_cellPointerManager.ShowCursor();
                    m_cellPointerManager.SetAnimatedCursor(value: false);
                }
            }
            else
            {
                if (!inputHandler.releasedMouseButton)
                {
                    return;
                }
                FightMapMovementContext activeMovementContext = m_activeMovementContext;
                if (activeMovementContext != null)
                {
                    if (m_pathFinder.tracking)
                    {
                        m_cellPointerManager.BeginHighlightingPlayableCharacters(this, activeMovementContext.entityProvider);
                        Vector2Int[] path = m_pathFinder.currentPath.ToArray();
                        ApplyMovement(path, activeMovementContext.trackedCharacter, activeMovementContext.targetedEntity);
                        m_pathFinder.End();
                        m_cellPointerManager.SetAnimatedCursor(value: false);
                    }
                    activeMovementContext.End();
                    m_activeMovementContext = null;
                    m_feedbackNeedsUpdate   = true;
                }
            }
        }
Пример #5
0
        private void UpdateSystems()
        {
            //IL_004d: Unknown result type (might be due to invalid IL or missing references)
            //IL_0052: Unknown result type (might be due to invalid IL or missing references)
            //IL_0054: Unknown result type (might be due to invalid IL or missing references)
            //IL_0073: Unknown result type (might be due to invalid IL or missing references)
            //IL_0082: Unknown result type (might be due to invalid IL or missing references)
            //IL_010d: Unknown result type (might be due to invalid IL or missing references)
            //IL_016c: Unknown result type (might be due to invalid IL or missing references)
            //IL_0177: Unknown result type (might be due to invalid IL or missing references)
            //IL_019b: Unknown result type (might be due to invalid IL or missing references)
            //IL_01ed: Unknown result type (might be due to invalid IL or missing references)
            //IL_0212: Unknown result type (might be due to invalid IL or missing references)
            //IL_0222: Unknown result type (might be due to invalid IL or missing references)
            //IL_0244: Unknown result type (might be due to invalid IL or missing references)
            FightMapInputHandler inputHandler = m_inputHandler;

            if (!inputHandler.Update(m_mapDefinition))
            {
                return;
            }
            if (m_objectFocusedByCursor != null)
            {
                m_objectFocusedByCursor.SetFocus(value: false);
                m_objectFocusedByCursor = null;
            }
            FightMapCellPointerManager cellPointerManager = m_cellPointerManager;
            Vector2Int?targetCell = inputHandler.targetCell;

            if (targetCell.HasValue)
            {
                Vector2Int value = targetCell.Value;
                if (TryGetRegionIndex(value, out int regionIndex))
                {
                    FightMapMovementContext fightMapMovementContext = m_movementContexts[regionIndex];
                    fightMapMovementContext.entityProvider.TryGetEntityAt(value, out IEntityWithBoardPresence character);
                    CellObject referenceCell = m_virtualGrid.GetReferenceCell(value);
                    if (null != referenceCell)
                    {
                        cellPointerManager.SetCursorPosition(referenceCell);
                        cellPointerManager.ShowCursor();
                    }
                    else
                    {
                        cellPointerManager.HideCursor();
                    }
                    IObjectWithFocus objectWithFocus;
                    if (character != null && (objectWithFocus = (character.view as IObjectWithFocus)) != null)
                    {
                        objectWithFocus.SetFocus(value: true);
                        m_objectFocusedByCursor = objectWithFocus;
                    }
                    if (m_pathFinder.tracking)
                    {
                        if (fightMapMovementContext == m_activeMovementContext)
                        {
                            ICharacterEntity trackedCharacter = fightMapMovementContext.trackedCharacter;
                            bool             flag;
                            if (fightMapMovementContext.canDoActionOnTarget)
                            {
                                IEntityWithBoardPresence entityWithBoardPresence = null;
                                if (character != null && character != trackedCharacter && (fightMapMovementContext.GetCell(value).state & FightMapMovementContext.CellState.Targetable) != 0)
                                {
                                    entityWithBoardPresence = character;
                                }
                                fightMapMovementContext.UpdateTarget(entityWithBoardPresence);
                                flag = (entityWithBoardPresence != null);
                            }
                            else
                            {
                                flag = false;
                            }
                            if (fightMapMovementContext.canMove)
                            {
                                if (flag)
                                {
                                    if (trackedCharacter.hasRange)
                                    {
                                        m_pathFinder.Reset();
                                    }
                                    else
                                    {
                                        m_pathFinder.Move(fightMapMovementContext.stateProvider, fightMapMovementContext.grid, value, isTargeting: true);
                                    }
                                }
                                else if ((fightMapMovementContext.GetCell(value).state & (FightMapMovementContext.CellState.Reachable | FightMapMovementContext.CellState.Occupied)) == FightMapMovementContext.CellState.Reachable)
                                {
                                    m_pathFinder.Move(fightMapMovementContext.stateProvider, fightMapMovementContext.grid, value, isTargeting: false);
                                }
                                else
                                {
                                    m_pathFinder.Reset();
                                }
                            }
                            cellPointerManager.SetAnimatedCursor(flag);
                        }
                        else
                        {
                            m_pathFinder.Reset();
                            cellPointerManager.SetAnimatedCursor(value: false);
                        }
                        m_feedbackNeedsUpdate = true;
                    }
                    else
                    {
                        if (m_interactiveMode != InteractiveMode.Target || onTargetChanged == null)
                        {
                            return;
                        }
                        if (m_targetContext.TryGetTargetAt(value, out Target target))
                        {
                            if (target.type == Target.Type.Entity && target.entity == character)
                            {
                                m_targetContext.UpdateTarget(value, character);
                            }
                            else
                            {
                                m_targetContext.UpdateTarget(value, null);
                            }
                            onTargetChanged(target, referenceCell);
                        }
                        else
                        {
                            m_targetContext.UpdateTarget(value, null);
                            onTargetChanged(null, null);
                        }
                    }
                    return;
                }
            }
            if (m_pathFinder.tracking)
            {
                m_pathFinder.Reset();
                m_feedbackNeedsUpdate = true;
            }
            m_cellPointerManager.HideCursor();
            if (m_interactiveMode == InteractiveMode.Target)
            {
                onTargetChanged?.Invoke(null, null);
            }
        }