Ejemplo n.º 1
0
    public void populateOptions(UserScript currentPlayer)
    {
        currentPlayerObj = currentPlayer;
        cl = currentPlayer.getLocationAt(currentPlayer.currentML);

        int me = (currentPlayer.playerNumber + 1);

        int Votes = (cl.Population / 4);
        int Cost  = (cl.Demands / 4);

        int CalledFor = (cl.Status1 + cl.Status2 + cl.Status3);
        int Occupied  = CalledFor;
        int TxCost    = 0;

        switch (me)
        {
        case 1: { CalledFor -= cl.Status1; break; }

        case 2: { CalledFor -= cl.Status2; break; }

        case 3: { CalledFor -= cl.Status3; break; }
        }

        if (CalledFor > 0)
        {
            TxCost = cl.RallyMoney;
        }

        string name = "";

        if (cl.Status1 > 0 && me != 1 && (Cost + TxCost <= currentPlayer.Money))
        {
            name = "AAP";
            string toPay = "To buy 25% [" + Votes + "K Votes] from " + name + " you need to pay " + Cost + "K INR with Rally Cost: " + TxCost + "K INR";
            GameObject.Find("PayAAPButton").GetComponent <Button>().interactable = true;
            GameObject.Find("PayAAPButton").GetComponent <Button>().onClick.AddListener(() => ButtonHandler(Votes, name, Cost, TxCost));
            GameObject.Find("PayAAPButton").GetComponentInChildren <Text>().text = toPay;
            // enable button to pay to Aap
        }
        else
        {
            GameObject.Find("PayAAPButton").GetComponent <Button>().interactable = false;
        }

        if (cl.Status2 > 0 && me != 2 && (Cost + TxCost <= currentPlayer.Money))
        {
            name = "BJP";
            string toPay = "To buy 25% [" + Votes + "K Votes] from " + name + " you need to pay " + Cost + "K INR with Rally Cost: " + TxCost + "K INR";
            GameObject.Find("PayBJPButton").GetComponent <Button>().interactable = true;
            GameObject.Find("PayBJPButton").GetComponent <Button>().onClick.AddListener(() => ButtonHandler(Votes, name, Cost, TxCost));
            GameObject.Find("PayBJPButton").GetComponentInChildren <Text>().text = toPay;
            // enable button to pay to BJP
        }
        else
        {
            GameObject.Find("PayBJPButton").GetComponent <Button>().interactable = false;
        }

        if (cl.Status3 > 0 && me != 3 && (Cost + TxCost <= currentPlayer.Money))
        {
            name = "INC";
            string toPay = "To buy 25% [" + Votes + "K Votes] from " + name + " you need to pay " + Cost + "K INR with Rally Cost: " + TxCost + "K INR";
            GameObject.Find("PayINCButton").GetComponent <Button>().interactable = true;

            GameObject.Find("PayINCButton").GetComponent <Button>().onClick.AddListener(() => ButtonHandler(Votes, name, Cost, TxCost));

            GameObject.Find("PayINCButton").GetComponentInChildren <Text>().text = toPay;
            // enable button to pay to INC
        }
        else
        {
            GameObject.Find("PayINCButton").GetComponent <Button>().interactable = false;
        }

        if (CalledFor < 100 && Occupied != 100 && (Cost + TxCost <= currentPlayer.Money))
        {
            name = "Independent";
            string toPay = "To buy 25% [" + Votes + "K Votes] from " + name + " you need to pay " + Cost + "K INR with Rally Cost: " + TxCost + "K INR";
            GameObject.Find("BuyButton").GetComponent <Button>().interactable = true;
            GameObject.Find("BuyButton").GetComponent <Button>().onClick.AddListener(() => ButtonHandler(Votes, name, Cost, TxCost));

            GameObject.Find("BuyButton").GetComponentInChildren <Text>().text = toPay;
            // enable button to pay to Independent
        }
        else
        {
            GameObject.Find("BuyButton").GetComponent <Button>().interactable = false;
        }
    }