Example #1
0
 private void Accept()
 {
     for (int i = 0; i < activitiesContent.childCount; i++)
     {
         EventPanel eventPanel = activitiesContent.GetChild(i).GetComponent <EventPanel>();
         if (eventPanel != null && (eventPanel.CheckAccept() || prevState == GameState.WAIT_ACTIVITY_CHOICE))
         {
             eventPanel.Accept();
         }
     }
     Close();
 }
Example #2
0
        public void Open(List <iActivityPlace> openedActivities)
        {
            Game game = Game.GetInstantiate();

            gameObject.SetActive(true);
            prevState = game.GetGameState();
            game.ChangeGameState(GameState.IN_ACTIVITIES_PANEL);
            activities = openedActivities;
            float height = 0;

            foreach (iActivityPlace activity in activities)
            {
                if (activity is QuestEvent)
                {
                    EventPanel eventPanel = Instantiate(eventPanelPrefab, activitiesContent);
                    eventPanel.questEvent = (QuestEvent)activity;
                    eventPanel.GetComponent <RectTransform>().SetInsetAndSizeFromParentEdge(RectTransform.Edge.Top, height, eventPanel.GetHeight());
                    height += eventPanel.GetHeight();
                }
                else if (activity is Office)
                {
                    OfficePanel officePanel = Instantiate(officePanelPrefab, activitiesContent);
                    officePanel.office = (Office)activity;
                    officePanel.GetComponent <RectTransform>().SetInsetAndSizeFromParentEdge(RectTransform.Edge.Top, height, officePanel.GetHeight());
                    height += officePanel.GetHeight();
                }
            }
            height += 20;
            RectTransform rect = GetComponent <RectTransform>();

            if (height > Screen.height - 20 - 120)
            {
                rect.SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, Screen.height - 20 - 120);
            }
            else
            {
                rect.SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, height);
            }
            CheckAccept();
        }
Example #3
0
        public void CheckAccept()
        {
            bool flag = false;

            for (int i = 0; i < activitiesContent.childCount; i++)
            {
                EventPanel eventPanel = activitiesContent.GetChild(i).GetComponent <EventPanel>();
                if (eventPanel != null && eventPanel.CheckAccept())
                {
                    flag = true;
                }
                break;
            }
            if (flag)
            {
                acceptButton.gameObject.SetActive(true);
            }
            else
            {
                acceptButton.gameObject.SetActive(false);
            }
        }