Пример #1
0
        // -------------------------------------------

        /*
         * Constructor
         */
        public void Initialize(RequestModel _item)
        {
            m_container = this.gameObject.transform;

            m_request = _item.Clone();

            m_iconOpen     = m_container.Find("IconStates/Open").gameObject;
            m_iconClosed   = m_container.Find("IconStates/Closed").gameObject;
            m_iconFinished = m_container.Find("IconStates/Finished").gameObject;
            m_iconBroken   = m_container.Find("IconStates/Broken").gameObject;
            m_iconToxic    = m_container.Find("IconStates/Toxic").gameObject;
            m_miniScore    = m_container.Find("MiniScore").gameObject;

            m_iconOpen.SetActive(false);
            m_iconClosed.SetActive(false);
            m_iconFinished.SetActive(false);
            m_iconBroken.SetActive(false);
            m_miniScore.SetActive(false);
            m_iconToxic.SetActive(false);

            m_iconCalendar = m_container.Find("Calendar").gameObject;
            m_iconCalendar.SetActive(false);

            if (m_container.Find("Loading") != null)
            {
                m_container.Find("Loading").GetComponent <Text>().text = LanguageController.Instance.GetText("message.loading");
            }



            UIEventController.Instance.UIEvent += new UIEventHandler(OnBasicEvent);

            LoadData(false);
        }
Пример #2
0
        // -------------------------------------------

        /*
         * LoadData
         */
        public void LoadData(bool _refreshData)
        {
            if (_refreshData)
            {
                RequestModel requestData = RequestsController.Instance.GetLocalRequest(m_request.Id);
                if (requestData != null)
                {
                    m_request = requestData.Clone();
                }
            }

            m_container.Find("Title").GetComponent <Text>().text    = m_request.Title;
            m_container.Find("Price").GetComponent <Text>().text    = m_request.Price.ToString();
            m_container.Find("Deadline").GetComponent <Text>().text = DateConverter.TimeStampToDateTimeString(m_request.Deadline);

            if (m_container.Find("Village") != null)
            {
                m_container.Find("Village").GetComponent <Text>().text = m_request.Village;
            }

            if (m_container.Find("Thumbnail") != null)
            {
                m_thumbnail = m_container.Find("Thumbnail/Image").GetComponent <Image>();
                if ((!m_request.CheckEnoughReportsToWarningForToxic()) && (m_request.Flaged != 1))
                {
                    UIEventController.Instance.DispatchUIEvent(ImagesController.EVENT_IMAGES_LOAD_FROM_ID, this.gameObject, m_request.Referenceimg, m_thumbnail, (int)(m_thumbnail.gameObject.GetComponent <RectTransform>().sizeDelta.y), false);
                }
                else
                {
                    HideLoading();
                    if (m_request.IsFlagged())
                    {
                        UIEventController.Instance.DispatchUIEvent(ImagesController.EVENT_IMAGES_LOAD_TOXIC_IMAGE, m_thumbnail, (int)(m_thumbnail.gameObject.GetComponent <RectTransform>().sizeDelta.y), ImageUtils.GetBytesJPG(MenusScreenController.Instance.ImageToxicConfirmed));
                    }
                    else
                    {
                        UIEventController.Instance.DispatchUIEvent(ImagesController.EVENT_IMAGES_LOAD_TOXIC_IMAGE, m_thumbnail, (int)(m_thumbnail.gameObject.GetComponent <RectTransform>().sizeDelta.y), ImageUtils.GetBytesJPG(MenusScreenController.Instance.ImageToxicPossible));
                    }
                }
            }

            if (m_request.IsFlagged())
            {
                m_iconToxic.SetActive(true);
                m_container.Find("Deadline").GetComponent <Text>().text = LanguageController.Instance.GetText("screen.create.request.toxic");
            }
            else
            {
                if ((m_request.Deliverydate != -1) &&
                    (m_request.ScoreCustomerGivesToTheProvider == -1) && (m_request.ScoreProviderGivesToTheCustomer == -1) &&
                    ((m_request.FeedbackCustomerGivesToTheProvider.Length > 0) || (m_request.FeedbackProviderGivesToTheCustomer.Length > 0)))
                {
                    m_iconBroken.SetActive(true);
                    m_container.Find("Deadline").GetComponent <Text>().text = LanguageController.Instance.GetText("screen.create.request.broken");
                }
                else
                {
                    if ((m_request.ScoreCustomerGivesToTheProvider != -1) && (m_request.ScoreProviderGivesToTheCustomer != -1))
                    {
                        m_iconFinished.SetActive(true);
                        m_miniScore.SetActive(true);
                        m_miniScore.GetComponent <Text>().text = m_request.ScoreCustomerGivesToTheProvider + "/" + m_request.ScoreProviderGivesToTheCustomer;
                        m_container.Find("Deadline").GetComponent <Text>().text = LanguageController.Instance.GetText("message.work.finished");
                    }
                    else
                    {
                        m_iconCalendar.SetActive(true);
                        if (m_request.Provider == -1)
                        {
                            m_iconOpen.SetActive(true);
                        }
                        else
                        {
                            m_iconClosed.SetActive(true);
                        }
                    }
                }
            }
        }