示例#1
0
        private void RefreshPrevious()
        {
            if (DataManager.Evaluation.Data == null || DataManager.Plan.Data == null)
            {
                return;
            }

            SetActiveView(mPreviousView);

            // Create an array of all represented months in our data
            DateTime[] months = CreateCompletedMonthList();

            for (int i = 0; i < months.Length; i++)
            {
                DateTime currentMonth = months[i];

                // Add month header
                string formatedMonth = currentMonth.ToString("MMMM yyyy", mLanguageInfo).ToUpper();
                string monthBarTitle = TextManager.Get(mCompletedTag) + " " + formatedMonth;
                Add(mHeaderPreviousPrefab).SetTitle(monthBarTitle);

                // Find the evaluation for this month and add it
                for (int j = 0; j < DataManager.Evaluation.Done.Length; j++)
                {
                    DataEvaluation evaluation = DataManager.Evaluation.Done[j];
                    DateTime       date       = evaluation.CreatedAt.Value;

                    if (date.Year == currentMonth.Year && date.Month == currentMonth.Month)
                    {
                        Add(mCheckPrefab).SetData(evaluation, mLanguageInfo);
                    }
                }

                // Find the goals for this month and add them
                for (int j = 0; j < DataManager.Plan.CompletedGoals.Length; j++)
                {
                    DataGoal goal = DataManager.Plan.CompletedGoals[j];
                    DateTime date = goal.FinishedAt.Value;

                    if (date.Year == currentMonth.Year && date.Month == currentMonth.Month)
                    {
                        MonthlyGoal created = Add(mGoalPrefab);
                        created.SetData(goal);

                        if (mToFocus != null && goal.ID == mToFocus.ID)
                        {
                            mFocusGoal      = created;
                            mFocusIsOngoing = false;
                        }
                    }
                }
            }
        }
示例#2
0
        public override void RefreshUI()
        {
            mEnteredWithFocus = mToFocus != null;

            if (!mEnteredWithFocus)
            {
                UIHeader.Show(mHeaderTag);
            }
            else
            {
                UIHeader.Show(mHeaderTag, () => UIManager.Open(UILocation.Progress));
            }

            RefreshContent();

            if (mEnteredWithFocus)
            {
                mNavigation.SetPage(mFocusIsOngoing ? 0 : 1);

                if (mFocusIsOngoing)
                {
                    LayoutRebuilder.ForceRebuildLayoutImmediate(mCurrentView);

                    Vector2 position = mCurrentView.anchoredPosition;
                    position.y = -mFocusGoal.GetComponent <RectTransform>().anchoredPosition.y;
                    mCurrentView.anchoredPosition = position;
                }
                else
                {
                    LayoutRebuilder.ForceRebuildLayoutImmediate(mPreviousView);

                    Vector2 position = mPreviousView.anchoredPosition;
                    position.y = -mFocusGoal.GetComponent <RectTransform>().anchoredPosition.y;
                    mPreviousView.anchoredPosition = position;

                    //Debug.Log("Move to wanted position. " + position.y);
                }

                mFocusGoal.Flash();
                mFocusGoal = null;
                mToFocus   = null;
            }
        }
示例#3
0
        private void RefreshCurrent()
        {
            if (DataManager.Evaluation.Data == null || DataManager.Plan.Data == null)
            {
                return;
            }

            SetActiveView(mCurrentView);

            Add(mHeaderCurrentPrefab).SetTitle(TextManager.Get(mLatestCheckTag));

            if (DataManager.Evaluation.Done.Length > 0)
            {
                Add(mCheckPrefab).SetData(DataManager.Evaluation.Done[0], mLanguageInfo);
            }

            int remainingGoalCount = DataManager.Plan.OngoingGoals.Length;

            if (remainingGoalCount > 0)
            {
                Add(mHeaderCurrentPrefab).SetTitle(TextManager.Get(mRemainingGoalsTag) + " (" + remainingGoalCount + ")");

                for (int i = 0; i < DataManager.Plan.OngoingGoals.Length; i++)
                {
                    DataGoal    goal    = DataManager.Plan.OngoingGoals[i];
                    MonthlyGoal created = Add(mGoalPrefab);
                    created.SetData(goal);

                    if (mToFocus != null && goal.ID == mToFocus.ID)
                    {
                        mFocusGoal      = created;
                        mFocusIsOngoing = true;
                    }
                }
            }
        }