コード例 #1
0
        public void SetAssignment(DataAssignment assignment)
        {
            mAssignment = assignment;

            Clear();

            mTitle.text    = mAssignment.Name;
            mCategory.text = mAssignment.Category.Name;

            for (int i = 0; i < mAssignment.Forms.Length; i++)
            {
                SubmissionInput formType = (SubmissionInput)mAssignment.Forms[i].ID;

                switch (formType)
                {
                case SubmissionInput.Photo: mPhoto.SetActive(true); break;

                case SubmissionInput.Write: mWrite.SetActive(true); break;

                case SubmissionInput.Check: mCheck.SetActive(true); break;

                case SubmissionInput.All:
                    mPhoto.SetActive(true);
                    mWrite.SetActive(true);
                    mCheck.SetActive(true);
                    break;
                }
            }
        }
コード例 #2
0
        private static string CreateFormatedTimeString(DataAssignment data, bool clampLength)
        {
            string content = "<b>";

            // End date
            content += "Datum: <color=#01C0D1FF>";
            content += GetDateString(data.EndAt.Value);
            content += "</color> ";

            // Remaining timespan
            content += GetRemainingDaysString(data);

            content += "</b>\n";

            // Active timespan
            if (data.EndAt.HasValue && data.StartAt.HasValue)
            {
                TimeSpan timeSpan = data.EndAt.Value - data.StartAt.Value;

                if (timeSpan.TotalMinutes > 10 && timeSpan.TotalHours < 20)
                {
                    // Show time span
                    content += "<b>Klockan: <color=#01C0D1FF>"
                               + data.StartAt.Value.ToString("HH:mm") + "</color> till <color=#01C0D1FF>"
                               + data.EndAt.Value.ToString("HH:mm") + "</color></b>\n";
                }
            }

            content += GetDescriptionString(data, clampLength);

            return(content);
        }
コード例 #3
0
        private static string GetRemainingDaysString(DataAssignment data)
        {
            string result = string.Empty;

            // Remaining timespan
            int daysToEnd = DateHelper.DaysToEnd(data.EndAt.Value);

            string color = data.StatusObject.Color;
            string days  = Mathf.Abs(daysToEnd).ToString();

            if (daysToEnd < -1)
            {
                result = TextManager.Get("Time_Late");
            }
            else if (daysToEnd < 0)
            {
                result = TextManager.Get("Time_Yesterday");
            }
            else if (daysToEnd < 1)
            {
                result = TextManager.Get("Time_Today");
            }
            else if (daysToEnd < 2)
            {
                result = TextManager.Get("Time_Tomorrow");
            }
            else
            {
                result = TextManager.Get("Time_Future");
            }

            result = result.Replace("<COLOR>", color).Replace("<DAYS>", days);

            return(result);
        }
コード例 #4
0
        public static void Open(DataAssignment assignment, bool fromPlant = false)
        {
            mCurrentAssignment = assignment;
            mCameFromPlant     = fromPlant;

            UIManager.Open(UILocation.InspectAssignment);
        }
コード例 #5
0
 public static string Create(DataAssignment data, bool clampLength)
 {
     if (data.IsSubmitted)
     {
         return(CreateFormatedSubmitString(data, clampLength));
     }
     else
     {
         return(CreateFormatedTimeString(data, clampLength));
     }
 }
コード例 #6
0
        private static string CreateFormatedSubmitString(DataAssignment data, bool clampLength)
        {
            string content = string.Empty;

            if (data.IsWaiting)
            {
                content += "<b><color=#F18700FF>Inlämnad - inväntar bekräftelse</color></b>\n";
            }
            else
            {
                content += "<b>Avklarat <color=#52AA50FF>" + GetDateString(data.FinishedAt.Value) + "</color></b>\n";
            }

            content += GetDescriptionString(data, clampLength);

            return(content);
        }
コード例 #7
0
        public override void SetData(DataBaseObject data)
        {
            mData = data as DataAssignment;

            bool isActivity = mData.EndAt.HasValue && mData.StartAt.HasValue;

            mTopIcon.sprite = isActivity ? mActivitySprite : mAssignmentSprite;

            mTitleText.text    = mData.Name;
            mCategoryText.text = mData.Category.Name;

            mContentText.text = AssignmentContentFormat.Create(mData, true);

            mLayout.PerformLayout();

            UpdateBox();
        }
コード例 #8
0
        private void HandleGoalClick(DataGoal goal)
        {
            if (goal is DataAssignment)
            {
                DataAssignment assignment = goal as DataAssignment;

                if (assignment.IsSubmitted)
                {
                    ScreenInspectAssignmentDone.Open(assignment, true);
                }
                else
                {
                    ScreenInspectAssignment.Open(assignment, true);
                }
            }
            else
            {
                ScreenMonthlyCheck.Open(goal);
            }
        }
コード例 #9
0
        private static string GetDescriptionString(DataAssignment data, bool clampLength)
        {
            string result = string.Empty;

            if (!string.IsNullOrEmpty(data.Description))
            {
                bool isLong = clampLength && data.Description.Length > 95;

                if (isLong)
                {
                    result += data.Description.Substring(0, 95);
                    result += "<color=#01C0D1FF><b> ...mer</b></color>";
                }
                else
                {
                    result += data.Description;
                }
            }

            return(result);
        }