protected ListViewElementProject CreateListViewElement(SharedProject proj)
        {
            ListViewElementProject newElement = null;

            if (null != ListViewElementPool)
            {
                newElement = ListViewElementPool.GetObject();
            }

            if (null == newElement)
            {
                newElement = GameObject.Instantiate <ListViewElementProject>(ListViewElementPrefab);
                MousePointerEvents events = newElement.GetComponent <MousePointerEvents>();
                SubscribeToMouseEventPointers(events, proj, TooltipComponent);
            }
            else
            {
                MousePointerEvents events = newElement.GetComponent <MousePointerEvents>();
                events.RemoveAllListeners();
                SubscribeToMouseEventPointers(events, proj, TooltipComponent);
            }

            newElement.Project = proj;
            newElement.gameObject.SetActive(true);

            return(newElement);
        }
        private void OnProjectProgressUpdated(LocalProject proj)
        {
            ListViewElementProject element = GetProjectListViewElement(ListViewCompanyProjects, proj);

            element.Text.text = GetProjectListViewElementText(proj);

            if (null != SelectedScrum &&
                SelectedScrum.BindedProject == proj)
            {
                int estimatedCompletionTime = SelectedScrum.GetProjectEstimatedCompletionTime();
                TextProjectEstimatedCompletionTime.text = GetEstimatedCompletionTimeText(estimatedCompletionTime);
                SetProjectProgressBar(proj);
            }
        }
Esempio n. 3
0
        private void OnControlledCompanyProjectAdded(Scrum scrumObj)
        {
            ListViewElementProject newElement = CreateListViewElement(scrumObj.BindedProject);

            ButtonSelectorProjects.AddButton(newElement.GetComponent <Button>());
            ListViewCompanyProjects.AddControl(newElement.gameObject);
            newElement.Text.text = base.GetProjectListViewElementText(scrumObj.BindedProject);

            scrumObj.BindedProject.ProgressUpdated       += OnProjectProgressUpdated;
            scrumObj.BindedProject.Completed             += OnProjectCompleted;
            scrumObj.BindedProject.CompletionTimeUpdated += OnCompanyProjectCompletionTimeUpdated;

            SetListViewCompanyProjectsText();
        }
        private void OnControlledCompanyProjectAdded(Scrum scrumObj)
        {
            ListViewElementProject newElement = CreateListViewElement(scrumObj.BindedProject);

            newElement.Text.text         = GetProjectListViewElementText(scrumObj.BindedProject);
            newElement.FrontImage.sprite = scrumObj.BindedProject.Icon;
            ButtonSelectorProjects.AddButton(newElement.Button);

            ListViewCompanyProjects.AddControl(newElement.gameObject);

            scrumObj.BindedProject.ProgressUpdated += OnProjectProgressUpdated;
            scrumObj.BindedProject.Completed       += OnProjectCompleted;
            scrumObj.BindedProject.WorkerRemoved   += OnProjectWorkerRemoved;
            SetListViewCompanyProjectsText();
        }
Esempio n. 5
0
        private void OnButtonSelectorProjectsSelectedButtonChanged(Button btn)
        {
            if (null != btn)
            {
                ListViewElementProject el = btn.GetComponent <ListViewElementProject>();
                SelectedProject = el.Project;
            }
            else
            {
                SelectedProject = null;
            }

            SetProjectInfoText(SelectedProject);
            SetProjectMarketButton();
        }
Esempio n. 6
0
        private void OnProjectsMarketProjectRemoved(SharedProject proj)
        {
            ListViewElementProject element = GetProjectListViewElement(ListViewMarketProjects, proj);

            if (null == ListViewElementPool)
            {
                ListViewElementPool = new ObjectPool <ListViewElementProject>();
            }

            element.gameObject.SetActive(false);
            ListViewMarketProjects.RemoveControl(element.gameObject, false);
            ButtonSelectorProjects.RemoveButton(element.Button);
            ListViewElementPool.AddObject(element);
            SetListViewMarketProjectsText();

            proj.CompletionTimeUpdated -= OnMarketProjectCompletionTimeUpdated;
        }
        /// <summary>
        /// Returns list view element associated with given project
        /// </summary>
        /// <param name="listView">List view element will be searched in this list view</param>
        protected ListViewElementProject GetProjectListViewElement(ControlListView listView, SharedProject proj)
        {
            GameObject             elementObject = null;
            ListViewElementProject element       = null;

            elementObject = listView.Controls.Find(x =>
            {
                return(x.GetComponent <ListViewElementProject>().Project == proj);
            });

            if (null != elementObject)
            {
                element = elementObject.GetComponent <ListViewElementProject>();
            }

            return(element);
        }
Esempio n. 8
0
        private void OnProjectsMarketProjectAdded(SharedProject proj)
        {
            ListViewElementProject newElement   = CreateListViewElement(proj);
            MousePointerEvents     mousePtrEvts = newElement.GetComponent <MousePointerEvents>();

            mousePtrEvts.PointerDoubleClick += () =>
            {
                OnButtonTakeProjectClicked();
            };

            ButtonSelectorProjects.AddButton(newElement.Button);
            ListViewMarketProjects.AddControl(newElement.gameObject);
            newElement.Text.text         = GetProjectListViewElementText(proj);
            newElement.FrontImage.sprite = proj.Icon;
            SetListViewMarketProjectsText();

            proj.CompletionTimeUpdated += OnMarketProjectCompletionTimeUpdated;
        }
        private void OnProjectListViewSelectedElementChanged(Button btn)
        {
            if (null != SelectedScrum)
            {
                UnsubscribeProjectEvents();

                foreach (LocalWorker worker in SelectedScrum.BindedProject.Workers)
                {
                    ListViewElementWorker element = UIWorkers.GetWorkerListViewElement(worker, ListViewAssignedWorkers);
                    element.gameObject.SetActive(false);
                }
            }

            if (null != btn)
            {
                ListViewElementProject element = btn.GetComponent <ListViewElementProject>();
                SelectedScrum = SimulationManagerComponent.ControlledCompany.ScrumProcesses.Find(x =>
                {
                    return(element.Project == x.BindedProject);
                });

                SetProjectInfo();
                SubscribeProjectEvents();
                SetListViewAssignedWorkersText();
                ListViewAssignedWorkers.transform.parent.gameObject.SetActive(true);

                foreach (LocalWorker worker in SelectedScrum.BindedProject.Workers)
                {
                    ListViewElementWorker elem = UIWorkers.GetWorkerListViewElement(worker, ListViewAssignedWorkers);
                    elem.gameObject.SetActive(true);
                }
            }
            else
            {
                SelectedScrum = null;
                SetProjectInfo();
                ListViewAssignedWorkers.transform.parent.gameObject.SetActive(false);
            }
        }
        private void OnSelectedProjectCompletionTimeUpdated(SharedProject proj)
        {
            ListViewElementProject element = GetProjectListViewElement(ListViewCompanyProjects, proj);

            element.Text.text = GetProjectListViewElementText((LocalProject)proj);
        }
        private void OnProjectCompleted(LocalProject proj)
        {
            ListViewElementProject element = GetProjectListViewElement(ListViewCompanyProjects, proj);

            element.BackgroundImage.color = CompletedProjectListViewElementColors;
        }
Esempio n. 12
0
        private void OnProjectProgressUpdated(LocalProject proj)
        {
            ListViewElementProject element = GetProjectListViewElement(ListViewCompanyProjects, proj);

            element.Text.text = base.GetProjectListViewElementText(proj);
        }
Esempio n. 13
0
        private void OnMarketProjectCompletionTimeUpdated(SharedProject proj)
        {
            ListViewElementProject element = GetProjectListViewElement(ListViewMarketProjects, proj);

            element.Text.text = GetProjectListViewElementText(proj);
        }