示例#1
0
 public void OpenPanel(UnoccupiedMonument newMonument)
 {
     if (newMonument.GetPlayer().unlockedMonumentsDick[newMonument.era].Count < 2)
     {
         popImage.gameObject.SetActive(true);
         popText.gameObject.SetActive(true);
         popImage.sprite = HUD.speciesPopSpriteDick[newMonument.GetSpecies()];
         otherTexts [2].rectTransform.anchorMin = new Vector2(0f, 0.55f);
         otherTexts [2].rectTransform.anchorMax = new Vector2(1f, 0.65f);
         if (newMonument.GetPlayer().unlockedMonumentsDick[newMonument.era].Count == 0)
         {
             otherTexts [1].rectTransform.anchorMin = new Vector2(0f, 0.65f);
             otherTexts [1].rectTransform.anchorMax = new Vector2(1f, 0.9f);
             for (int i = 0; i < selectionButtons.Length; i++)
             {
                 selectionButtons[i].GetComponent <RectTransform>().anchorMin = new Vector2(0.15f, 0.25f - i * 0.2f);
                 selectionButtons[i].GetComponent <RectTransform>().anchorMax = new Vector2(0.85f, 0.4f - i * 0.2f);
                 AddSelectMonumentListener(newMonument, selectionButtons[i], monSelectionMenu.lockedPopCost);
             }
         }
         else
         {
             otherTexts[1].gameObject.SetActive(false);
             for (int i = 0; i < selectionButtons.Length; i++)
             {
                 SpecType monumentSpec = MonumentSelectionMenu.speciesMonumentTypeDick[newMonument.GetSpecies()][newMonument.era][selectionButtons[i].GetComponentInChildren <Text>().text];
                 if (newMonument.GetPlayer().unlockedMonumentsDick[newMonument.era].Contains(monumentSpec))
                 {
                     selectionButtons[i].GetComponent <RectTransform>().anchorMin = new Vector2(0.15f, 0.7f);
                     selectionButtons[i].GetComponent <RectTransform>().anchorMax = new Vector2(0.85f, 0.85f);
                     AddSelectMonumentListener(newMonument, selectionButtons[i], 0);
                 }
                 else
                 {
                     selectionButtons[i].GetComponent <RectTransform>().anchorMin = new Vector2(0.15f, 0.25f);
                     selectionButtons[i].GetComponent <RectTransform>().anchorMax = new Vector2(0.85f, 0.4f);
                     AddSelectMonumentListener(newMonument, selectionButtons[i], monSelectionMenu.lockedPopCost);
                 }
             }
         }
     }
     else
     {
         popImage.gameObject.SetActive(false);
         popText.gameObject.SetActive(false);
         for (int i = 0; i < selectionButtons.Length; i++)
         {
             selectionButtons[i].GetComponent <RectTransform>().anchorMin = new Vector2(0.15f, 0.7f - i * 0.2f);
             selectionButtons[i].GetComponent <RectTransform>().anchorMax = new Vector2(0.85f, 0.85f - i * 0.2f);
             AddSelectMonumentListener(newMonument, selectionButtons[i], 0);
         }
         otherTexts[2].rectTransform.anchorMax = new Vector2(1f, 0.4f);
         otherTexts[2].rectTransform.anchorMin = new Vector2(0f, 0.3f);
         otherTexts[1].text = "None";
         otherTexts[1].rectTransform.anchorMax = new Vector2(1f, 0.3f);
         otherTexts[1].rectTransform.anchorMin = new Vector2(0f, 0.1f);
     }
 }
示例#2
0
 public void Initiate(UnoccupiedMonument newUnoccupiedMon)
 {
     transform.SetParent(StrategicPointTransform.thisTransform);
     Occupy(newUnoccupiedMon.GetPlayer(), newUnoccupiedMon.population);
     buildingArea.buildingSlots = newUnoccupiedMon.buildingArea.buildingSlots;
     foreach (BuildingSlot bS in buildingArea.buildingSlots)
     {
         bS.Initiate(this);
     }
     unoccupiedMon = newUnoccupiedMon;
 }
    public static void OpenMenu(UnoccupiedMonument newMonument)
    {
        thisGameObject.SetActive(true);
        selectedMonument = newMonument;
        List <string> monNamesList = new List <string> ();

        foreach (string monName in speciesMonumentTypeDick[newMonument.GetSpecies()][newMonument.era].Keys)
        {
            monNamesList.Add(monName);
        }
        for (int i = 0; i < monSelectionPanel.selectionButtons.Length; i++)
        {
            monSelectionPanel.selectionButtons[i].GetComponentInChildren <Text>().text = monNamesList[i];
        }
        monSelectionPanel.OpenPanel(selectedMonument);
    }
示例#4
0
    private void AddSelectMonumentListener(UnoccupiedMonument newMonument, Button selectionButton, int popCost)
    {
        SpecType monumentSpec = MonumentSelectionMenu.speciesMonumentTypeDick[newMonument.GetSpecies()][newMonument.era][selectionButton.GetComponentInChildren <Text>().text];

        selectionButton.onClick.AddListener(delegate { monSelectionMenu.SelectMonument(selectionButton, monumentSpec, popCost); });
    }