public void OnCalendarStateChanged(CalendarState calendarState)
 {
     if (calendarStateChanged != null)
     {
         calendarStateChanged.Invoke(calendarState);
     }
 }
Exemplo n.º 2
0
 public void OnPointerExit(PointerEventData eventData)
 {
     if (currentState != CalendarState.Pressed)
     {
         CurrentState = CalendarState.Inactive;
     }
 }
Exemplo n.º 3
0
 public void OnPointerEnter(PointerEventData eventData)
 {
     if (currentState != CalendarState.Pressed)
     {
         CurrentState = CalendarState.Hover;
     }
 }
Exemplo n.º 4
0
 public void OnPointerClick(PointerEventData eventData)
 {
     if (OnSettingStateChange != null)
     {
         OnSettingStateChange(SettingView.SettingState.Pressed);
     }
     CurrentState = CalendarState.Pressed;
 }
Exemplo n.º 5
0
        public static void SetState(DependencyObject element, CalendarState value)
        {
            if (element == null)
            {
                throw new ArgumentNullException("element");
            }

            element.SetValue(StateProperty, value);
        }
Exemplo n.º 6
0
 public void FinishTournament(CalendarEventReader eventReader)
 {
     this.calendarState = CalendarState.SEASON;
     this.tournament.Finish();
     if (currentMonth >= scheduledCalendar.Length)
     {
         calendarState = CalendarState.END_OF_SEASON;
         eventReader.OnCalendarStateChanged(CalendarState.END_OF_SEASON);
     }
 }
Exemplo n.º 7
0
        public void Reset(GameEngine gameEngine, MainCharacter mainCharacter, ContentManager content)
        {
            if (IsTransitioning)
            {
                GState          = CalendarState.ActivityChoice;
                Background      = new Background(content, "bulletin");
                IsTransitioning = false;
                return;
            }

            Point WindowSize = Game1.GetWindowSize();

            content.Unload();

            // Common to all Modes
            Background     = new Background(content, "bulletin");
            MainCharacter  = mainCharacter;
            Content        = content;
            JustBreathe    = Content.Load <SpriteFont>("Fonts/JustBreathe20");
            Arial          = Content.Load <SpriteFont>("Fonts/Arial");
            GState         = CalendarState.ActivityChoice;
            MouseState     = Mouse.GetState();
            PrevMouseState = MouseState;

            // Load Case Info (will want to create method for this)
            String CasePath = Path.Combine(Content.RootDirectory, "case" + MainCharacter.CurrentCase + ".txt");
            String CaseJSON = File.ReadAllText(CasePath);

            Case = JsonSerializer.Deserialize <Case>(CaseJSON);

            ThisMonday = MainCharacter.GetDate();

            ActivityRect = new Rectangle(WindowSize.X / 2, WindowSize.Y / 2, 500, 300);
            // eventually pull from Activity list json.
            Dictionary <string, string> Activities = new Dictionary <string, string>
            {
                { "Have a tea party", "charm" },
                { "Fight a dragon", "courage" },
                { "Have a chat", "empathy" },
                { "Go to the library", "intelligence" },
                { "Pump iron", "strength" },
                { "Start a business", "money" }
            };

            ActivitiesList = new OptionsList(Activities, JustBreathe,
                                             new Point(ActivityRect.X + 10, ActivityRect.Y + 30));
            PeopleList = new OptionsList(Case.CharDict, JustBreathe,
                                         new Point(ActivityRect.X + 4 * ActivityRect.Width / 6, ActivityRect.Y + 30));

            ConfirmButton = null;
            Calendar      = new Calendar(new Rectangle(110, 150, 960, 200), JustBreathe, ThisMonday);
            Notebook      = new ClickableTexture(Content.Load <Texture2D>("notebook_icon"), new Vector2(WindowSize.X - 100, 20));
        }
Exemplo n.º 8
0
        /// <summary>
        /// Creates a new instance of a <typeparamref name="Calendar"/> object, and initializes it with the specified properties.
        /// </summary>
        /// <param name="account"></param>
        /// <param name="name"></param>
        /// <param name="state"></param>
        public Calendar(Account account, string name, CalendarState state = CalendarState.Published)
        {
            if (String.IsNullOrWhiteSpace(name))
            {
                throw new ArgumentNullException(nameof(name));
            }

            this.AccountId = account?.Id ?? throw new ArgumentNullException(nameof(account));
            this.Account   = account;
            this.Name      = name;
            this.Key       = Guid.NewGuid();
            this.State     = state;
        }
Exemplo n.º 9
0
        private void SetupContext(TestContext ctx)
        {
            var testContextBuilder = new TestContextBuilder(ctx);

            testContextBuilder.AddCommon();
            var dataServiceMock = Mock.Of <IPlannerItemDataService>(o => o.LoadItems(It.IsAny <DateTime>(), It.IsAny <DateTime>()) == Task.FromResult <IEnumerable <PlannerItemModel> >(Array.Empty <PlannerItemModel>()));

            ctx.Services.AddScoped <IPlannerItemDataService>(o => dataServiceMock);
            state = new CalendarState();
            var calendarServiceMock = new Mock <ICalendarService>();

            calendarServiceMock.Setup(c => c.State).Returns(state);
            ctx.Services.AddScoped <ICalendarService>(o => calendarServiceMock.Object);
        }
Exemplo n.º 10
0
        /* MouseClick Handler */
        private void MouseClicked(int x, int y)
        {
            Rectangle mouseClickRect = new Rectangle(x, y, 10, 10);

            switch (GState)
            {
            case CalendarState.ConfirmActivity:
                if (mouseClickRect.Intersects(ConfirmButton.Rect))
                {
                    // Later on there will be more complicated effects, keeping basic
                    if (!MainCharacter.Stats.ContainsKey(ActivitiesList.SelectedOption))
                    {
                        MainCharacter.Stats[ActivitiesList.SelectedOption] = 1;
                    }
                    else
                    {
                        MainCharacter.Stats[ActivitiesList.SelectedOption]++;
                    }

                    if (!MainCharacter.Relationships.ContainsKey(PeopleList.SelectedOption))
                    {
                        MainCharacter.Relationships[PeopleList.SelectedOption] = 1;
                    }
                    else
                    {
                        MainCharacter.Relationships[PeopleList.SelectedOption]++;
                    }

                    Calendar.AddEntry(ActivitiesList.SelectedLabel + " with " + PeopleList.SelectedLabel);
                    GState = CalendarState.NextDay;
                    Calendar.MoveDay();
                }

                if (mouseClickRect.Intersects(Notebook.Rect))
                {
                    GState = CalendarState.ToNotebook;
                }
                break;

            case CalendarState.ActivityChoice:
                if (mouseClickRect.Intersects(Notebook.Rect))
                {
                    GState = CalendarState.ToNotebook;
                }
                break;

            default:
                break;
            }
        }
Exemplo n.º 11
0
        public IntentExecutor(
            ILogger <IntentExecutor> logger,
            BringState bringState,
            RouteState routeState,
            SpotifyState spotifyState,
            HueState hueState,
            WeatherState weatherState,
            CalendarState calendarState,
            FuelState fuelState,
            ClockState clockState,
            VvsState vvsState,
            FitbitState fitbitState,
            GoogleFitState googleFitState,
            SoccerState bundesligaState,
            NewsState newsState)
        {
            _logger          = logger;
            _bringState      = bringState;
            _routeState      = routeState;
            _spotifyState    = spotifyState;
            _hueState        = hueState;
            _weatherState    = weatherState;
            _calendarState   = calendarState;
            _fuelState       = fuelState;
            _clockState      = clockState;
            _vvsState        = vvsState;
            _fitbitState     = fitbitState;
            _googleFitState  = googleFitState;
            _bundesligaState = bundesligaState;
            _newsState       = newsState;

            _displayableDictionary = new Dictionary <Type, Displayable>
            {
                { typeof(BringState), bringState },
                { typeof(RouteState), routeState },
                { typeof(SpotifyState), spotifyState },
                { typeof(HueState), hueState },
                { typeof(WeatherState), weatherState },
                { typeof(CalendarState), calendarState },
                { typeof(FuelState), fuelState },
                { typeof(ClockState), clockState },
                { typeof(VvsState), vvsState },
                { typeof(FitbitState), fitbitState },
                { typeof(GoogleFitState), googleFitState },
                { typeof(SoccerState), bundesligaState },
                { typeof(NewsState), newsState },
            };
        }
Exemplo n.º 12
0
    private CalendarState GetCalendarState()
    {
        var state = Session["ActivityCalendar_CalendarState"] as CalendarState;

        if (state == null)
        {
            state = new CalendarState
            {
                View = Options.DefaultView,
                User = Options.DefaultUser ?? SlxWebScheduleInfo.LoggedOnUserName
            };
            Session["ActivityCalendar_CalendarState"] = state;
        }

        state.Date = GetDateFromCookie() ?? SlxWebScheduleInfo.ActiveDayUtc;
        return(state);
    }
Exemplo n.º 13
0
    void UpdateCalendarState(CalendarState state)
    {
        switch (state)
        {
        case CalendarState.Hover:
            SetHoverView();
            break;

        case CalendarState.Pressed:
            SetPressedView();
            break;

        case CalendarState.Inactive:
            SetNormalView();
            break;
        }
    }
Exemplo n.º 14
0
    private void OnCalendarStateChanged(CalendarState calendarState)
    {
        switch (calendarState)
        {
        case CalendarState.POST_SEASON:
            calendarBar.gameObject.SetActive(false);
            playerButton.gameObject.SetActive(false);
            startSeasonButton.gameObject.SetActive(true);
            goTournamentBtn.gameObject.SetActive(false);
            killPlayerBtn.gameObject.SetActive(false);
            trainingButton.gameObject.SetActive(false);
            break;

        case CalendarState.SEASON:
            calendarBar.gameObject.SetActive(true);
            calendarBar.Refresh();
            playerButton.gameObject.SetActive(true);
            startSeasonButton.gameObject.SetActive(false);
            goTournamentBtn.gameObject.SetActive(false);
            killPlayerBtn.gameObject.SetActive(false);
            trainingButton.gameObject.SetActive(true);
            break;

        case CalendarState.TOURNAMENT:
            calendarBar.gameObject.SetActive(false);
            playerButton.gameObject.SetActive(true);
            startSeasonButton.gameObject.SetActive(false);
            goTournamentBtn.gameObject.SetActive(true);
            killPlayerBtn.gameObject.SetActive(false);
            trainingButton.gameObject.SetActive(false);
            break;

        case CalendarState.END_OF_SEASON:
            calendarBar.gameObject.SetActive(false);
            playerButton.gameObject.SetActive(true);
            startSeasonButton.gameObject.SetActive(false);
            goTournamentBtn.gameObject.SetActive(false);
            killPlayerBtn.gameObject.SetActive(true);
            trainingButton.gameObject.SetActive(false);
            break;
        }
    }
Exemplo n.º 15
0
        public void LoadDataFrom0531To0606()
        {
            // Arrange
            using var ctx = new TestContext();
            new TestContextBuilder(ctx).AddCommon();
            var dataServiceMock = new Mock <IPlannerItemDataService>();

            dataServiceMock.Setup(o => o.LoadItems(It.IsAny <DateTime>(), It.IsAny <DateTime>())).Returns(Task.FromResult <IEnumerable <PlannerItemModel> >(Array.Empty <PlannerItemModel>()));
            ctx.Services.AddScoped <IPlannerItemDataService>(o => dataServiceMock.Object);
            var calendarServiceMock = new Mock <ICalendarService>();

            state = new CalendarState();
            calendarServiceMock.Setup(c => c.State).Returns(state);
            ctx.Services.AddScoped <ICalendarService>(o => calendarServiceMock.Object);

            // Act
            var cut = ctx.RenderComponent <CalendarBase>();

            // Assert
            dataServiceMock
            .Verify(o => o.LoadItems(new DateTime(2020, 5, 31, 15, 0, 0), new DateTime(2020, 6, 6, 15, 0, 0)), Times.Once);
        }
Exemplo n.º 16
0
    public Calendar()
    {
        currentMonth      = 0;
        scheduledCalendar = new CalendarEvent[10];
        for (int i = 0; i < 10; i++)
        {
            switch (i)
            {
            case 2:
            case 4:
            case 7:
            case 9:
                scheduledCalendar[i] = CalendarEvent.TOURNAMENT;
                break;

            default:
                scheduledCalendar[i] = CalendarEvent.NOTHING;
                break;
            }
        }
        calendarState = CalendarState.POST_SEASON;
    }
Exemplo n.º 17
0
    public void NextMonth(CalendarEventReader eventReader)
    {
        this.currentMonth++;
        if (currentMonth >= scheduledCalendar.Length)
        {
            calendarState = CalendarState.END_OF_SEASON;
            eventReader.OnCalendarStateChanged(CalendarState.END_OF_SEASON);
        }
        else
        {
            eventReader.OnCalendarDateChanged(this);

            if (scheduledCalendar[currentMonth] == CalendarEvent.TOURNAMENT)
            {
                isTournamentNow = true;
            }
            else
            {
                isTournamentNow = false;
                tournament      = null;
            }
        }
    }
Exemplo n.º 18
0
 public CalendarPlugin()
 {
     state = new CalendarState();
     controller = new Controller();
 }
 void Calendar_OnStateChange(CalendarState state)
 {
     calendar.CurrentState = state;
 }
Exemplo n.º 20
0
 /// <summary>
 /// Sets the value of the <see cref="State"/> property
 /// </summary>
 /// <param name="state">Current state of the calendar</param>
 private void SetState(CalendarState state)
 {
     _state = state;
 }
        public CalendarState GetServiceState()
        {
            CalendarState ret = VidyoCalendarGetServiceStateNative(objPtr);

            return(ret);
        }
Exemplo n.º 22
0
    private CalendarState GetCalendarState()
    {
        var state = Session["ActivityCalendar_CalendarState"] as CalendarState;
        if (state == null)
        {
            state = new CalendarState
            {
                View = Options.DefaultView,
                User = Options.DefaultUser ?? SlxWebScheduleInfo.LoggedOnUserName
            };
            Session["ActivityCalendar_CalendarState"] = state;
        }

        state.Date = GetDateFromCookie() ?? SlxWebScheduleInfo.ActiveDayUtc;
        return state;
    }
Exemplo n.º 23
0
 private void OnMonthClicked(object sender, MouseButtonEventArgs e)
 {
     SelectedMonth = (int)((FrameworkElement)sender).Tag;
     CurrentState  = CalendarState.Days;
 }
Exemplo n.º 24
0
 private void OnSelectMonthOrYearClicked(object sender, MouseButtonEventArgs e)
 {
     CurrentState = CalendarState.Months;
 }
Exemplo n.º 25
0
        public void Update(GameEngine gameEngine, GameTime gameTime)
        {
            if (IsTransitioning)
            {
                return;
            }

            // Update Dynamic Components
            PeopleList?.Update();
            ActivitiesList?.Update();

            MouseState = Mouse.GetState();
            if (PrevMouseState.LeftButton == ButtonState.Pressed && MouseState.LeftButton == ButtonState.Released)
            {
                MouseClicked(MouseState.X, MouseState.Y);
            }

            switch (GState)
            {
            case CalendarState.NextDay:
                if (Calendar.IsMoving())
                {
                    Calendar.Update(gameTime);
                }
                else if (Calendar.DayIndex < 5)
                {
                    GState = CalendarState.ActivityChoice;
                }
                else
                {
                    GState = CalendarState.ToWeekend;
                }
                // update position of box
                break;

            case CalendarState.ToWeekend:
                gameEngine.Push(new MapManager(), true, true);
                MainCharacter.ToWeekend();
                IsTransitioning = true;
                break;

            case CalendarState.ToNotebook:
                int[] Null = new int[] { -1 };
                gameEngine.Push(new NotebookManager(false, ref Null), true, true);
                IsTransitioning = true;
                break;

            case CalendarState.ConfirmActivity:
                ConfirmButton?.Update();
                if (PeopleList?.SelectedOption == null || ActivitiesList?.SelectedOption == null)
                {
                    GState = CalendarState.ActivityChoice;
                }
                break;

            case CalendarState.ActivityChoice:
                if (PeopleList?.SelectedOption != null && ActivitiesList?.SelectedOption != null)
                {
                    GState        = CalendarState.ConfirmActivity;
                    ConfirmButton = new Button("Go!", JustBreathe,
                                               new Vector2(ActivityRect.X + ActivityRect.Width / 2,
                                                           ActivityRect.Y + ActivityRect.Height - 50));
                }
                break;

            default:
                break;
            }
            PrevMouseState = MouseState;
        }
Exemplo n.º 26
0
 public PluginHelper(CalendarState state)
 {
     this.state = state;
 }
Exemplo n.º 27
0
 /// <summary>
 /// Sets the value of the <see cref="State"/> property
 /// </summary>
 /// <param name="state">Current state of the calendar</param>
 private void SetState(CalendarState state)
 {
     _state = state;
 }
Exemplo n.º 28
0
 public CalendarService()
 {
     State = new CalendarState();
 }
Exemplo n.º 29
0
 public PluginHelper(CalendarState state)
 {
     this.state = state;
 }
Exemplo n.º 30
0
 public void SetCalendarState(CalendarState calendarState, CalendarEventReader eventReader)
 {
     this.calendarState = calendarState;
     eventReader.OnCalendarStateChanged(calendarState);
 }