Exemplo n.º 1
0
    public void ThatFillInData(assemblyCsharp.Province province)
    {
        this.Name.text = province.getProvName();
        string resource = province.getResource().ToString();

        Sprite newResourceSprite = Resources.Load("Resource/" + resource, typeof(Sprite)) as Sprite;

        this.Resource.sprite         = newResourceSprite;
        this.Resource.preserveAspect = true;
        Debug.Log("You f****r...." + province.getProduction().ToString());
        this.Produces.text      = "Produces " + province.getProduction().ToString("0.0") + " " + resource + " /turn";
        this.RailroadLevel.text = province.getInfrastructure().ToString();
        this.FortLevel.text     = province.getFortLevel().ToString();
        this.Culture.text       = "Culture: " + province.culture;
        // this.resourceText.text = "Province produces " + resource;
        string nation = province.getOwner().ToString();

        Debug.Log("Owner: " + nation);
        this.DevelopmentLevel.text = province.getDevelopmentLevel().ToString();
        this.NationName.text       = nation;
        //text.text = "Province produces " + Resource;
        this.Flag.sprite = Resources.Load("Flags/" + province.getOwner().ToString(), typeof(Sprite)) as Sprite;
        pickProductionPicture(province);
        // Text flagText = FlagTip.GetComponentInChildren<Text>();
        // Debug.Log("Flag text: " + flagText.text);
        // flagText.text = Owner;
        //flagTip.GetComponent<Text>().text = nation;
    }
Exemplo n.º 2
0
    private void UpgradeDevelopment()
    {
        App    app       = UnityEngine.Object.FindObjectOfType <App>();
        Nation player    = State.getNations()[app.GetHumanIndex()];
        int    provIndex = State.getCurrentlySelectedProvince();

        assemblyCsharp.Province prov = State.getProvinces()[provIndex];
        PlayerPayer.payDevelopment(player, prov);
        this.DevelopmentLevel.text = prov.getDevelopmentLevel().ToString();
        AP.text = player.getAP().ToString();
        updateSelfProvinceButtons(player, prov);
    }
Exemplo n.º 3
0
    public static int getNumberProvDevelopments(Nation player)
    {
        int amount = 0;

        for (int i = 0; i < player.getProvinces().Count; i++)
        {
            int pIndex = player.getProvinces()[i];
            assemblyCsharp.Province prov = State.getProvinces()[pIndex];
            amount += prov.getDevelopmentLevel();
        }
        return(amount);
    }
Exemplo n.º 4
0
    private void prepareAuctionPanel(AuctionHandler auction)
    {
        increaseBid.enabled = true;
        decreaseBid.enabled = true;
        App             app         = UnityEngine.Object.FindObjectOfType <App>();
        int             playerIndex = app.GetHumanIndex();
        Nation          player      = State.getNations()[playerIndex];
        TextMeshProUGUI title       = AuctionPanelTitleText.GetComponent <TextMeshProUGUI>();
        Nation          item        = State.getNations()[0];

        // Colony Auction
        backGroudImage.sprite = Resources.Load("Sprites/BackGrounds/imperialism_cartoon", typeof(Sprite)) as Sprite;
        title.text            = "Colony Bids";
        pointTypeText.text    = "Colonial Points";
        // PointTypeImage.sprite = Resources.Load("Sprites/GUI/eagle", typeof(Sprite)) as Sprite;

        item = State.getNations()[auction.getIndexOfCurrentItem()];

        // GameObject mapPrefab = Instantiate(Resources.Load<GameObject>("RPG100set/512/Prop/06_letter" + item.getNationName()));
        currentNumberOfBiddingPoints.text = player.GetColonialPoints().ToString();
        if (player.GetColonialPoints() < State.CurrentColonyAuctionBid || player.RecognizingTheseClaims.Contains(item.getIndex()) || player.landForces.Strength < 2)
        {
            increaseBid.interactable = false;
        }
        else
        {
            increaseBid.interactable = true;
        }

        TextMeshProUGUI itemName = ItemNameText.GetComponent <TextMeshProUGUI>();

        itemName.text = item.getNationName();

        GameObject itemFlag = Instantiate(Resources.Load <GameObject>("Flags/Prefabs/" + item.getNationName()));

        itemFlag1.ObjectPrefab = itemFlag.transform;

        // TextMeshProUGUI currentPlayerBid = currentBidAmount.GetComponent<TextMeshProUGUI>();
        currentBidAmount.text = "00";
        int firstProvIndex  = -1;
        int secondProvIndex = -1;

        foreach (int provIndex in item.getProvinces())
        {
            if (firstProvIndex == -1)
            {
                firstProvIndex = provIndex;
            }
            else
            {
                secondProvIndex = provIndex;
            }
        }

        assemblyCsharp.Province firstProvince = State.getProvince(firstProvIndex);
        itemProvinces.Rows[1].Cells[0].GetComponentInChildren <Text>().text = firstProvince.getProvName();
        //  itemProvinces.Rows[1].Cells[1].GetComponentInChildren<Image>().sprite =
        Transform P1Res      = itemProvinces.Rows[1].Cells[1].transform.GetChild(0);
        Image     P1ResImage = P1Res.GetComponent <Image>();

        // Image provOneRes = itemProvinces.Rows[1].Cells[1].GetComponentInChildren<Image>() as Image;
        //resImg.sprite = Resources.Load("Resource/" + imp.getResourceType().ToString(), typeof(Sprite)) as Sprite;
        //  Debug.Log("First Resource is: " + firstProvince.getResource());
        P1ResImage.sprite = Resources.Load("Resource/" + firstProvince.getResource().ToString(), typeof(Sprite)) as Sprite;
        itemProvinces.Rows[1].Cells[2].GetComponentInChildren <Text>().text = firstProvince.getDevelopmentLevel().ToString();
        Toggle provOneRail = itemProvinces.Rows[1].Cells[3].GetComponentInChildren <Toggle>();

        if (firstProvince.getRail())
        {
            provOneRail.isOn = true;
        }
        else
        {
            provOneRail.isOn = false;
        }

        assemblyCsharp.Province secondProvince = State.getProvince(secondProvIndex);
        itemProvinces.Rows[2].Cells[0].GetComponentInChildren <Text>().text = secondProvince.getProvName();
        //  itemProvinces.Rows[1].Cells[1].GetComponentInChildren<Image>().sprite =
        // Image provTwoRes = itemProvinces.Rows[2].Cells[1].GetComponentInChildren<Image>() as Image;
        // Debug.Log("Second Resource is: " + secondProvince.getResource());
        Transform P2Res      = itemProvinces.Rows[2].Cells[1].transform.GetChild(0);
        Image     P2ResImage = P2Res.GetComponent <Image>();

        P2ResImage.sprite = Resources.Load("Resource/" + secondProvince.getResource().ToString(), typeof(Sprite)) as Sprite;
        itemProvinces.Rows[2].Cells[2].GetComponentInChildren <Text>().text = secondProvince.getDevelopmentLevel().ToString();
        Toggle provTwoRail = itemProvinces.Rows[2].Cells[3].GetComponentInChildren <Toggle>();

        if (secondProvince.getRail())
        {
            provTwoRail.isOn = true;
        }
        else
        {
            provTwoRail.isOn = false;
        }
        if (item.IsColonyOf() != -1)
        {
            Nation currentOwner = State.getNations()[item.IsColonyOf()];
            currentOwnerName.text         = currentOwner.getNationName();
            relationWithCurrentOwner.text = player.Relations[currentOwner.getIndex()].ToString();
        }
        else
        {
            currentOwnerName.text = "None";
        }

        if (player.RecognizingTheseClaims.Contains(item.getIndex()))
        {
            isRecognizing.isOn = true;
        }
        else
        {
            isRecognizing.isOn = false;
        }
    }