// ------------------------------------------- /* * OnBasicEvent */ private void OnBasicEvent(string _nameEvent, params object[] _list) { if (!this.gameObject.activeSelf) { return; } if (_nameEvent == RequestsController.EVENT_REQUEST_RESULT_FORMATTED_RECORDS) { UIEventController.Instance.DispatchUIEvent(ScreenController.EVENT_FORCE_DESTRUCTION_POPUP); List <RequestModel> data = (List <RequestModel>)_list[0]; if ((int)_list[1] == RequestsController.TYPE_CONSULT_BY_USER) { m_requestsContainer.GetComponent <SlotManagerView>().ClearCurrentGameObject(); m_requestsContainer.GetComponent <SlotManagerView>().ClearCurrentRequests(); if (data.Count > 0) { // ADD TOXIC AND BROKEN FIRST for (int i = 0; i < data.Count; i++) { RequestModel item = data[i]; if ((item.Customer == m_userData.Id) && (item.IsFlagged() || item.IsBrokenDeal())) { m_requestsContainer.GetComponent <SlotManagerView>().AddNewRequests(item); } } // REST OF REQUESTS for (int i = 0; i < data.Count; i++) { RequestModel item = data[i]; if ((item.Customer == m_userData.Id) && (!(item.IsFlagged() || item.IsBrokenDeal()))) { m_requestsContainer.GetComponent <SlotManagerView>().AddNewRequests(item); } } } m_requestsContainer.GetComponent <SlotManagerView>().LoadCurrentPage(); } } if (_nameEvent == SlotRequestView.EVENT_SLOTREQUEST_SELECTED_REQUEST) { GameObject slotClicked = (GameObject)_list[0]; if (m_userData.IsBanned()) { string warning = LanguageController.Instance.GetText("message.warning"); string description = LanguageController.Instance.GetText("message.show.nothing.of.user.banned"); MenusScreenController.Instance.CreateNewInformationScreen(ScreenInformationView.SCREEN_INFORMATION, UIScreenTypePreviousAction.KEEP_CURRENT_SCREEN, warning, description, null, ""); } else { if (m_requestsContainer.GetComponent <SlotManagerView>().CheckSlotExisting(slotClicked)) { SlotRequestView slotSelected = slotClicked.GetComponent <SlotRequestView>(); UIEventController.Instance.DispatchUIEvent(RequestsController.EVENT_REQUEST_CALL_CONSULT_SINGLE_RECORD, slotSelected.Request.Id); } } } if (_nameEvent == RequestsController.EVENT_REQUEST_RESULT_FORMATTED_SINGLE_RECORD) { UIEventController.Instance.DispatchUIEvent(ScreenController.EVENT_FORCE_DESTRUCTION_POPUP); RequestModel request = (RequestModel)_list[0]; if (request != null) { MenusScreenController.Instance.CreateNewScreen(ScreenCreateRequestView.SCREEN_DISPLAY_REQUEST, UIScreenTypePreviousAction.HIDE_CURRENT_SCREEN, true, request); } else { string warning = LanguageController.Instance.GetText("message.error"); string description = LanguageController.Instance.GetText("message.request.not.found"); MenusScreenController.Instance.CreateNewInformationScreen(ScreenInformationView.SCREEN_INFORMATION, UIScreenTypePreviousAction.KEEP_CURRENT_SCREEN, warning, description, null, ""); } } if (_nameEvent == UIEventController.EVENT_SCREENMANAGER_ANDROID_BACK_BUTTON) { ExitPressed(); } }
// ------------------------------------------- /* * 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); } } } } }
// ------------------------------------------- /* * OnBasicEvent */ private void OnBasicEvent(string _nameEvent, params object[] _list) { if (!this.gameObject.activeSelf) { return; } if (_nameEvent == EVENT_SCREENOFFERS_LOAD_CURRENT_WORK_ACCEPTED) { UIEventController.Instance.DispatchUIEvent(RequestsController.EVENT_REQUEST_CALL_CONSULT_BY_PROVIDER, UsersController.Instance.CurrentUser.Id, false); } if (_nameEvent == RequestsController.EVENT_REQUEST_RESULT_FORMATTED_RECORDS) { UIEventController.Instance.DispatchUIEvent(ScreenController.EVENT_FORCE_DESTRUCTION_POPUP); List <RequestModel> data = (List <RequestModel>)_list[0]; if ((int)_list[1] == RequestsController.TYPE_CONSULT_BY_PROVIDER) { m_slotWorksFollowingInfoContainer.GetComponent <SlotManagerView>().ClearCurrentGameObject(); m_slotWorksAcceptedInfoContainer.GetComponent <SlotManagerView>().ClearCurrentGameObject(); m_slotWorksFinishedInfoContainer.GetComponent <SlotManagerView>().ClearCurrentGameObject(); m_slotWorksFollowingInfoContainer.GetComponent <SlotManagerView>().ClearCurrentRequests(); m_slotWorksAcceptedInfoContainer.GetComponent <SlotManagerView>().ClearCurrentRequests(); m_slotWorksFinishedInfoContainer.GetComponent <SlotManagerView>().ClearCurrentRequests(); if (data.Count > 0) { for (int i = 0; i < data.Count; i++) { RequestModel item = data[i]; if (!item.IsFlagged()) { if (item.Provider == -1) { m_slotWorksFollowingInfoContainer.GetComponent <SlotManagerView>().AddNewRequests(item); } else { if (item.Deliverydate == -1) { m_slotWorksAcceptedInfoContainer.GetComponent <SlotManagerView>().AddNewRequests(item); } else { m_slotWorksFinishedInfoContainer.GetComponent <SlotManagerView>().AddNewRequests(item); } } } } } m_slotWorksFollowingInfoContainer.GetComponent <SlotManagerView>().LoadCurrentPage(); m_slotWorksAcceptedInfoContainer.GetComponent <SlotManagerView>().LoadCurrentPage(); m_slotWorksFinishedInfoContainer.GetComponent <SlotManagerView>().LoadCurrentPage(); } } if (_nameEvent == SlotRequestView.EVENT_SLOTREQUEST_SELECTED_REQUEST) { GameObject slotClicked = (GameObject)_list[0]; if (CheckSlotRequestExisting(slotClicked)) { SlotRequestView slotSelected = slotClicked.GetComponent <SlotRequestView>(); UIEventController.Instance.DispatchUIEvent(RequestsController.EVENT_REQUEST_CALL_CONSULT_SINGLE_RECORD, slotSelected.Request.Id); } } if (_nameEvent == RequestsController.EVENT_REQUEST_RESULT_FORMATTED_SINGLE_RECORD) { UIEventController.Instance.DispatchUIEvent(ScreenController.EVENT_FORCE_DESTRUCTION_POPUP); RequestModel request = (RequestModel)_list[0]; if (request != null) { MenusScreenController.Instance.CreateNewScreen(ScreenCreateRequestView.SCREEN_DISPLAY_REQUEST, UIScreenTypePreviousAction.HIDE_CURRENT_SCREEN, true, request); } else { string warning = LanguageController.Instance.GetText("message.error"); string description = LanguageController.Instance.GetText("message.request.not.found"); MenusScreenController.Instance.CreateNewInformationScreen(ScreenInformationView.SCREEN_INFORMATION, UIScreenTypePreviousAction.KEEP_CURRENT_SCREEN, warning, description, null, ""); } } if (_nameEvent == UIEventController.EVENT_SCREENMANAGER_ANDROID_BACK_BUTTON) { BackPressed(); } }