Beispiel #1
0
        private void OnEntitiesChanged(FightStatus fightStatus, EntitiesChangedFlags flags)
        {
            int fightId = fightStatus.fightId;
            FightMapMovementContext fightMapMovementContext = m_movementContexts[fightId];

            if ((flags & (EntitiesChangedFlags.Added | EntitiesChangedFlags.Removed | EntitiesChangedFlags.AreaMoved)) != 0 && m_activeMovementContext == fightMapMovementContext)
            {
                ICharacterEntity trackedCharacter = fightMapMovementContext.trackedCharacter;
                if (trackedCharacter != null)
                {
                    fightMapMovementContext.End();
                    if (!trackedCharacter.isDirty)
                    {
                        fightMapMovementContext.Begin(trackedCharacter, m_pathFinder);
                    }
                    else
                    {
                        m_activeMovementContext = null;
                    }
                    m_feedbackNeedsUpdate = true;
                }
            }
            if (m_targetContext != null && (flags & (EntitiesChangedFlags.Removed | EntitiesChangedFlags.AreaMoved)) != 0)
            {
                m_targetContext.Refresh();
                m_feedbackNeedsUpdate = true;
            }
            if (m_interactiveMode == InteractiveMode.Movement && m_localMovementContext == fightMapMovementContext)
            {
                m_cellPointerManager.RefreshPlayableCharactersHighlights(this, fightStatus);
            }
            m_inputHandler.SetDirty();
        }
Beispiel #2
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;
                }
            }
        }
Beispiel #3
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;
                }
            }
        }