public void StepNext()
        {
            int nextEntryIdx = -1;

            if (selectedEntryIdx == pickerEntries.Count - 1)
            {
                return;
            }
            else
            {
                nextEntryIdx = selectedEntryIdx + 1;
            }

            if (pickerEntries[nextEntryIdx].Puzzle.IsLocked)
            {
                AudioManager.PlayCue("locked");

                rotState    = RotationState.LockedNext;
                lockedState = LockedState.Clear1;
            }
            else
            {
                AudioManager.PlayCue("puzzlePickerRotate");

                rotState                       = RotationState.StepNext;
                unselectedEntryIdx             = nextEntryIdx;
                UnselectedPickerEntry.Rotation = ANCHOR_ROTATE_HALF;
            }
        }
Beispiel #2
0
 public ItemGroup(T[] items, LockedState lockedState)
 {
     State = lockedState;
     Items = items;
     Level = -1;
     MascotIconContentKey = null;
     LocalizedThemeName   = null;
     ThemeIconContentKey  = null;
     BGImage       = BGImage.Default;
     GroupPosition = GroupPosition.None;
 }
        public static bool HasLockedState(this IIsLockedFlagEntity entity, LockedState state)
        {
            switch (state)
            {
            case LockedState.NotLocked:
                return(!entity.IsLocked);

            case LockedState.Locked:
                return(entity.IsLocked);

            case LockedState.Any:
                return(true);

            default:
                throw new ArgumentOutOfRangeException();
            }
        }
        public static IEnumerable <T> OfLockedState <T>(this IEnumerable <T> query, LockedState state)
            where T : class, IIsLockedFlagEntity
        {
            switch (state)
            {
            case LockedState.NotLocked:
                return(query.OfInLocked());

            case LockedState.Locked:
                return(query.OfLocked());

            case LockedState.Any:
                return(query);

            default:
                throw new ArgumentOutOfRangeException(nameof(state));
            }
        }
        public void ContinuousNext()
        {
            if (selectedEntryIdx + CONTINUOUS_COUNT <= pickerEntries.Count - 1)
            {
                destEntryIdx = selectedEntryIdx + CONTINUOUS_COUNT;
            }
            else
            {
                destEntryIdx = pickerEntries.Count - 1;
            }

            int nextEntryIdx = -1;

            if (selectedEntryIdx == pickerEntries.Count - 1)
            {
                return;
            }
            else
            {
                nextEntryIdx = selectedEntryIdx + 1;
            }

            if (pickerEntries[nextEntryIdx].Puzzle.IsLocked)
            {
                AudioManager.PlayCue("locked");

                rotState    = RotationState.LockedNext;
                lockedState = LockedState.Clear1;
            }
            else
            {
                AudioManager.PlayCue("puzzlePickerShuffle");

                rotState                       = RotationState.ContinuousNext;
                unselectedEntryIdx             = nextEntryIdx;
                UnselectedPickerEntry.Rotation = ANCHOR_ROTATE_HALF;
            }
        }
Beispiel #6
0
 public void LockedStateUnitTestSetup()
 {
     controlSubstitute = Substitute.For <IControl>();
     uut = new LockedState();
 }
Beispiel #7
0
 private static extern int SimGetPhoneLockedState(
     IntPtr hSim,
     ref LockedState lpdwLockedState);
Beispiel #8
0
		private static extern int SimGetPhoneLockedState (
			IntPtr hSim,
			ref LockedState lpdwLockedState );
        private void updateRotation(GameTime gameTime)
        {
            switch (rotState)
            {
            case RotationState.StepNext:

                SelectedPickerEntry.Rotation   += ROTATION_SPEED_STEP;
                UnselectedPickerEntry.Rotation += ROTATION_SPEED_STEP;

                if (SelectedPickerEntry.Rotation >= ANCHOR_ROTATE_HALF)
                {
                    selectedEntryIdx             = unselectedEntryIdx;
                    unselectedEntryIdx           = -1;
                    SelectedPickerEntry.Rotation = ANCHOR_ROTATE_START;
                    rotState = RotationState.Ready;
                }
                break;

            case RotationState.ContinuousNext:

                SelectedPickerEntry.Rotation   += ROTATION_SPEED_CONTINUOUS;
                UnselectedPickerEntry.Rotation += ROTATION_SPEED_CONTINUOUS;

                if (SelectedPickerEntry.Rotation >= ANCHOR_ROTATE_HALF)
                {
                    selectedEntryIdx             = unselectedEntryIdx;
                    unselectedEntryIdx           = -1;
                    SelectedPickerEntry.Rotation = ANCHOR_ROTATE_START;

                    if (selectedEntryIdx == destEntryIdx)
                    {
                        rotState = RotationState.Ready;
                    }
                    else
                    {
                        AudioManager.PlayCue("puzzlePickerShuffle");

                        int nextEntryIdx = -1;
                        if (selectedEntryIdx == pickerEntries.Count - 1)
                        {
                            return;
                        }
                        else
                        {
                            nextEntryIdx = selectedEntryIdx + 1;
                        }

                        if (pickerEntries[nextEntryIdx].Puzzle.IsLocked)
                        {
                            rotState = RotationState.Ready;
                        }
                        else
                        {
                            unselectedEntryIdx             = nextEntryIdx;
                            UnselectedPickerEntry.Rotation = ANCHOR_ROTATE_HALF;
                        }
                    }
                }
                break;

            case RotationState.LockedNext:

                switch (lockedState)
                {
                case LockedState.Clear1:
                    lockedTimerClear++;
                    if (lockedTimerClear >= LOCKED_TIMER_CLEAR)
                    {
                        lockedTimerClear = 0;
                        lockedState      = LockedState.Flash1;
                    }
                    break;

                case LockedState.Flash1:
                    lockedTimerFlash++;
                    if (lockedTimerFlash >= LOCKED_TIMER_FLASH)
                    {
                        lockedTimerFlash = 0;
                        lockedState      = LockedState.Clear2;
                    }
                    break;

                case LockedState.Clear2:
                    lockedTimerClear++;
                    if (lockedTimerClear >= LOCKED_TIMER_CLEAR)
                    {
                        lockedTimerClear = 0;
                        lockedState      = LockedState.Flash2;
                    }
                    break;

                case LockedState.Flash2:
                    lockedTimerFlash++;
                    if (lockedTimerFlash >= LOCKED_TIMER_FLASH)
                    {
                        lockedTimerFlash = 0;
                        lockedState      = LockedState.Clear3;
                    }
                    break;

                case LockedState.Clear3:
                    lockedTimerClear++;
                    if (lockedTimerClear >= LOCKED_TIMER_CLEAR)
                    {
                        lockedTimerClear = 0;
                        lockedState      = LockedState.Clear1;
                        rotState         = RotationState.Ready;
                    }
                    break;
                }
                break;

            case RotationState.StepPrevious:
                SelectedPickerEntry.Rotation   -= ROTATION_SPEED_STEP;
                UnselectedPickerEntry.Rotation -= ROTATION_SPEED_STEP;

                if (SelectedPickerEntry.Rotation <= -ANCHOR_ROTATE_HALF)
                {
                    selectedEntryIdx             = unselectedEntryIdx;
                    unselectedEntryIdx           = -1;
                    SelectedPickerEntry.Rotation = ANCHOR_ROTATE_START;
                    rotState = RotationState.Ready;
                }
                break;

            case RotationState.ContinuousPrevious:
                SelectedPickerEntry.Rotation   -= ROTATION_SPEED_CONTINUOUS;
                UnselectedPickerEntry.Rotation -= ROTATION_SPEED_CONTINUOUS;

                if (SelectedPickerEntry.Rotation <= -ANCHOR_ROTATE_HALF)
                {
                    selectedEntryIdx             = unselectedEntryIdx;
                    unselectedEntryIdx           = -1;
                    SelectedPickerEntry.Rotation = ANCHOR_ROTATE_START;

                    if (selectedEntryIdx == destEntryIdx)
                    {
                        rotState = RotationState.Ready;
                    }
                    else
                    {
                        AudioManager.PlayCue("puzzlePickerShuffle");

                        int prevEntryIdx = -1;
                        if (selectedEntryIdx == 0)
                        {
                            return;
                        }
                        else
                        {
                            prevEntryIdx = selectedEntryIdx - 1;
                        }

                        if (pickerEntries[prevEntryIdx].Puzzle.IsLocked)
                        {
                            rotState = RotationState.LockedPrevious;
                        }
                        else
                        {
                            unselectedEntryIdx             = prevEntryIdx;
                            UnselectedPickerEntry.Rotation = ANCHOR_ROTATE_HALF;
                        }
                    }
                }
                break;

            case RotationState.LockedPrevious:
                rotState = RotationState.Ready;
                break;

            case RotationState.Ready:
                break;
            }
        }