Exemplo n.º 1
0
    public void GoTask(int buttonIndex)
    {
        if (game.dayTime == Game.DayTime.DAY)
        {
            DayAgent.DayTask dayTask  = DAY_TASKS[currentPanelIndex - 1][buttonIndex];
            DayAgent         dayAgent = (DayAgent)agent;
            dayAgent.task = dayTask;
            for (int i = 0; i < 4; i++)
            {
                int needDays = dayAgent.GetDaysResult(dayTask);
                if (needDays > 0)
                {
                    topImages[i].gameObject.SetActive(true);
                    topTexts[i].text = $"{needDays}";
                    addImages[i].gameObject.SetActive(true);
                }
                else
                {
                    topImages[i].gameObject.SetActive(false);
                    topTexts[i].text = "";
                    addImages[i].gameObject.SetActive(false);
                }

                float firstResult  = dayAgent.GetFirstResult(game, SOCIALS[i], dayTask);
                float secondResult = dayAgent.GetSecondResult(game, SOCIALS[i], dayTask);
                if (firstResult == 0)
                {
                    leftImages[i].gameObject.SetActive(false);
                    leftTexts[i].text = "";
                }
                else
                {
                    leftTexts[i].text = $"{firstResult}";
                    leftImages[i].gameObject.SetActive(true);
                    switch (dayTask)
                    {
                    case DayAgent.DayTask.ATTRACT_FOLLOWERS:
                        leftImages[i].sprite = strengthSprites[i];
                        break;

                    case DayAgent.DayTask.GIVE_ALMS:
                        leftImages[i].sprite = goldSprites[i];
                        break;

                    case DayAgent.DayTask.SELL_MIRACULOUS_BALMS:
                        leftImages[i].sprite = faithSprites[i];
                        break;

                    case DayAgent.DayTask.SELL_INDULGENCES:
                        leftImages[i].sprite = goldSprites[i];
                        break;

                    case DayAgent.DayTask.DISTRACT_THE_INQUISITION:
                        leftImages[i].sprite = attentionSprite;
                        break;

                    case DayAgent.DayTask.PREACHING:
                        leftImages[i].sprite = faithSprites[i];
                        break;

                    case DayAgent.DayTask.JOINT_CHANTING:
                        leftImages[i].sprite = faithSprites[i];
                        break;

                    case DayAgent.DayTask.ACCEPTANCE_OF_THE_ELECT:
                        leftImages[i].sprite = goldSprites[i];
                        break;

                    case DayAgent.DayTask.CONDUCT_A_SERVICE:
                        leftImages[i].sprite = lockSprite;
                        break;
                    }
                }
                if (secondResult == 0)
                {
                    rightImages[i].gameObject.SetActive(false);
                    rightTexts[i].text = "";
                }
                else
                {
                    rightTexts[i].text = $"{secondResult}";
                    rightImages[i].gameObject.SetActive(true);
                    switch (dayTask)
                    {
                    case DayAgent.DayTask.GIVE_ALMS:
                        rightImages[i].sprite = attentionSprite;
                        break;

                    case DayAgent.DayTask.SELL_MIRACULOUS_BALMS:
                        rightImages[i].sprite = goldSprites[i];
                        break;

                    case DayAgent.DayTask.SELL_INDULGENCES:
                        rightImages[i].sprite = strengthSprites[i];
                        break;

                    case DayAgent.DayTask.ACCEPTANCE_OF_THE_ELECT:
                        rightImages[i].sprite = sinsSprites[i];
                        break;
                    }
                }
            }
        }
        else
        {
            NightAgent.NightTask nightTask  = NIGHT_TASKS[currentPanelIndex - 1][buttonIndex];
            NightAgent           nightAgent = (NightAgent)agent;
            nightAgent.task = nightTask;
            for (int i = 0; i < 4; i++)
            {
                int needDays = nightAgent.GetDaysResult(nightTask);
                if (needDays > 0)
                {
                    topImages[i].gameObject.SetActive(true);
                    topTexts[i].text = $"{needDays}";
                    addImages[i].gameObject.SetActive(true);
                }
                else
                {
                    topImages[i].gameObject.SetActive(false);
                    topTexts[i].text = "";
                    addImages[i].gameObject.SetActive(false);
                }

                float firstResult  = nightAgent.GetFirstResult(game, SOCIALS[i], nightTask);
                float secondResult = nightAgent.GetSecondResult(game, SOCIALS[i], nightTask);
                if (firstResult == 0)
                {
                    leftImages[i].gameObject.SetActive(false);
                    leftTexts[i].text = "";
                }
                else
                {
                    leftTexts[i].text = $"{firstResult}";
                    leftImages[i].gameObject.SetActive(true);
                    switch (nightTask)
                    {
                    case NightAgent.NightTask.MANIPULATION:
                        leftImages[i].sprite = sinsSprites[i];
                        break;

                    case NightAgent.NightTask.SLANDER:
                        leftImages[i].sprite = strengthSprites[i];
                        break;

                    case NightAgent.NightTask.ROBBERY:
                        leftImages[i].sprite = goldSprites[i];
                        break;

                    case NightAgent.NightTask.CORRUPTION:
                        leftImages[i].sprite = wealthSprites[i];
                        break;

                    case NightAgent.NightTask.TRAINING:
                        leftImages[i].sprite = nightAgentSprite;
                        break;

                    case NightAgent.NightTask.TEMPT:
                        leftImages[i].sprite = sinsSprites[i];
                        break;

                    case NightAgent.NightTask.THE_FALL:
                        leftImages[i].sprite = sinsSprites[i];
                        break;

                    case NightAgent.NightTask.PROPAGANDA:
                        leftImages[i].sprite = goldSprites[i];
                        break;

                    case NightAgent.NightTask.TEMPERING_OF_SPIRIT:
                        leftImages[i].sprite = dayAgentSprite;
                        break;
                    }
                }
                if (secondResult == 0)
                {
                    rightImages[i].gameObject.SetActive(false);
                    rightTexts[i].text = "";
                }
                else
                {
                    rightTexts[i].text = $"{secondResult}";
                    rightImages[i].gameObject.SetActive(true);
                    switch (nightTask)
                    {
                    case NightAgent.NightTask.MANIPULATION:
                        rightImages[i].sprite = attentionSprite;
                        break;

                    case NightAgent.NightTask.SLANDER:
                        rightImages[i].sprite = attentionSprite;
                        break;

                    case NightAgent.NightTask.ROBBERY:
                        rightImages[i].sprite = attentionSprite;
                        break;

                    case NightAgent.NightTask.CORRUPTION:
                        rightImages[i].sprite = attentionSprite;
                        break;

                    case NightAgent.NightTask.TEMPT:
                        rightImages[i].sprite = goldSprites[i];
                        break;

                    case NightAgent.NightTask.THE_FALL:
                        rightImages[i].sprite = wealthSprites[i];
                        break;
                    }
                }
            }
        }
        ShowPanel(currentPanelIndex);
    }
Exemplo n.º 2
0
 public void ShowPanel(int currentPanel)
 {
     if (game.dayTime == Game.DayTime.DAY)
     {
         agent = game.dayAgents[currentAgentIndex];
     }
     else
     {
         agent = game.nightAgents[currentAgentIndex];
     }
     currentPanelIndex = currentPanel;
     for (int i = 0; i < 4; i++)
     {
         activeButtons[i].SetActive(i == currentPanel);
         inactiveButtons[i].SetActive(i != currentPanel);
     }
     buttonsSkillsTexts[0].text = $"Хитрость {agent.skills[Agent.Skills.CUNNING]}";
     buttonsSkillsTexts[1].text = $"Разум {agent.skills[Agent.Skills.MIND]}";
     buttonsSkillsTexts[2].text = $"Дух {agent.skills[Agent.Skills.SPIRIT]}";
     buttonsSkillsTexts[3].text = $"Хитрость {agent.skills[Agent.Skills.CUNNING]}";
     buttonsSkillsTexts[4].text = $"Разум {agent.skills[Agent.Skills.MIND]}";
     buttonsSkillsTexts[5].text = $"Дух {agent.skills[Agent.Skills.SPIRIT]}";
     name.text = $"{agent.name}";
     firstPageLeftPage.SetActive(false);
     firstPageRightPage.SetActive(false);
     firstPageRightButton.SetActive(false);
     mainLeftPage.SetActive(false);
     mainRightPage.SetActive(false);
     mainRightButton.SetActive(false);
     agentsRightPage.SetActive(false);
     inquisitionRightPage.SetActive(false);
     moneyRightPage.SetActive(false);
     if (currentPanel == 0)
     {
         firstPageLeftPage.SetActive(true);
         firstPageRightPage.SetActive(true);
         firstPageRightButton.SetActive(true);
         trainButtonText.text = $"Повысить уровень {agent.NeedGold(agent.RemainExp())} золота";
         agentInfoText.text   =
             $"Доступно очков навыка: {agent.skillPoints}\nХитрость: {agent.skills[Agent.Skills.CUNNING]}\nРазум: {agent.skills[Agent.Skills.MIND]}\nДух: {agent.skills[Agent.Skills.SPIRIT]}\nОпыт: {agent.experience}/{Agent.EXPERIENCE[agent.level]}\nУровень: {(game.dayTime == Game.DayTime.DAY ? DAY_LEVELS[agent.level - 1] : NIGHT_LEVELS[agent.level - 1])}";
         for (int i = 0; i < 4; i++)
         {
             perksTexts[i].text = "";
         }
         int index = 0;
         foreach (Agent.Perks perks in agent.perks)
         {
             perksTexts[index].text = PERKS[perks];
         }
     }
     else
     {
         mainLeftPage.SetActive(true);
         mainRightButton.SetActive(true);
         tasksSkillText.text = TASKS_SKILL[currentPanel - 1];
         for (int i = 0; i < 3; i++)
         {
             buttonsTasks[i].onClick.RemoveAllListeners();
             buttonsTasksTicks[i].SetActive(false);
             if (game.dayTime == Game.DayTime.DAY)
             {
                 buttonsTasksTicksImages[i].sprite = dayTick;
                 DayAgent         dayAgent = (DayAgent)agent;
                 DayAgent.DayTask dayTask  = DAY_TASKS[currentPanel - 1][i];
                 buttonsTasksText[i].text = DAY_TASKS_TEXTS[currentPanel - 1][i];
                 if (dayAgent.IsSkillAvailable(dayTask))
                 {
                     buttonsTasksLocks[i].SetActive(false);
                     if (i == 0)
                     {
                         buttonsTasks[i].onClick.AddListener(delegate { GoTask(0); });
                     }
                     else if (i == 1)
                     {
                         buttonsTasks[i].onClick.AddListener(delegate { GoTask(1); });
                     }
                     else if (i == 2)
                     {
                         buttonsTasks[i].onClick.AddListener(delegate { GoTask(2); });
                     }
                     if (dayAgent.task == dayTask)
                     {
                         buttonsTasksTicks[i].SetActive(true);
                         buttonsTasksImages[i].sprite = activeButton;
                         mainRightPage.SetActive(true);
                     }
                     else
                     {
                         buttonsTasksImages[i].sprite = inactiveButton;
                     }
                 }
                 else
                 {
                     buttonsTasksLocks[i].SetActive(true);
                     buttonsTasksImages[i].sprite = lockedButton;
                 }
             }
             else
             {
                 buttonsTasksTicksImages[i].sprite = nightTick;
                 NightAgent           nightAgent = (NightAgent)agent;
                 NightAgent.NightTask nightTask  = NIGHT_TASKS[currentPanel - 1][i];
                 buttonsTasksText[i].text = NIGHT_TASKS_TEXTS[currentPanel - 1][i];
                 if (nightAgent.IsSkillAvailable(nightTask))
                 {
                     buttonsTasksLocks[i].SetActive(false);
                     if (i == 0)
                     {
                         buttonsTasks[i].onClick.AddListener(delegate { GoTask(0); });
                     }
                     else if (i == 1)
                     {
                         buttonsTasks[i].onClick.AddListener(delegate { GoTask(1); });
                     }
                     else if (i == 2)
                     {
                         buttonsTasks[i].onClick.AddListener(delegate { GoTask(2); });
                     }
                     if (nightAgent.task == nightTask)
                     {
                         buttonsTasksTicks[i].SetActive(true);
                         buttonsTasksImages[i].sprite = activeButton;
                         mainRightPage.SetActive(true);
                     }
                     else
                     {
                         buttonsTasksImages[i].sprite = inactiveButton;
                     }
                 }
                 else
                 {
                     buttonsTasksLocks[i].SetActive(true);
                     buttonsTasksImages[i].sprite = lockedButton;
                 }
             }
         }
     }
     for (int i = 0; i < 4; i++)
     {
         if (game.dayTime == Game.DayTime.DAY)
         {
             socialsTicks[i].SetActive(((DayAgent)agent).tempSocialStatus == SOCIALS[i]);
         }
         else
         {
             socialsTicks[i].SetActive(((NightAgent)agent).tempSocialStatus == SOCIALS[i]);
         }
     }
 }