/// <summary>
    /// called by the "create new troop..." option from the demanding troop tier entry.
    /// should open the edit troop type panel for a new TT and then assign that new TT to the demandingEntry
    /// </summary>
    /// <param name="theDemandingEntry"></param>
    public void CreateNewTroopTypeForEntry(FactionTroopListEntry theDemandingEntry)
    {
        TroopType newTT = new TroopType(GameController.instance.LastRelevantTType);

        theDemandingEntry.SetContent(newTT);
        theDemandingEntry.RefreshInfoLabels();
        EditTierEntry(theDemandingEntry);
        GameInterface.instance.editFactionPanel.isDirty = true;
    }
示例#2
0
 public override void Open(MercCaravan editedMC, bool isNewEntry)
 {
     //set data
     base.Open(editedMC, isNewEntry);
     caravanColorInput.colorImg.color = dataBeingEdited.caravanColor;
     trainedTroopType.SetContent(GameController.GetTroopTypeByID(dataBeingEdited.containedTroopType));
     trainedTroopType.ReFillDropdownOptions();
     isDirty = false;
 }
    public override ListPanelEntry <TroopType> AddEntry(TroopType entryData)
    {
        GameObject newEntry = Instantiate(entryPrefab);

        newEntry.transform.SetParent(listContainer, false);
        FactionTroopListEntry entryScript = newEntry.GetComponent <FactionTroopListEntry>();

        entryScript.SetContent(entryData);
        entryScript.ReFillDropdownOptions();
        entryScript.selectEntryBtn.onClick.AddListener(() => SelectTierEntry(entryScript));
        entryScript.parentDirtablePanel   = GameInterface.instance.editFactionPanel;
        entryScript.actionOnEditTroopType = UpdateTreeTroopOptions;

        newEntry.transform.SetSiblingIndex(listContainer.childCount - 2);
        return(entryScript);
    }