Example #1
0
    public void GeneratePanelForBuilding(GameObject forBuilding)
    {
        if (forBuilding.GetComponent <InteractableObject>().type == ObjectType.flat)
        {
            Debug.Log("Generating panel");
            fb = forBuilding;
            Text[] texts = flatPanel.GetComponentsInChildren <Text>();
            //Debug.Log (texts.Length);

            FlatMechanics flatAttributes = fb.GetComponent <FlatMechanics>();

            texts[0].text = "Flats";
            texts[1].text = "Size <b>" + flatAttributes.size + "</b>";
            texts[2].text = "Eqipment <b>" + flatAttributes.equipment + "</b>";
            texts[3].text = "isTaken <b>" + flatAttributes.isTaken + "</b>";
            texts[4].text = "Upgrade Size " + (flatAttributes.sizeBasePrice + flatAttributes.sizeBasePrice * flatAttributes.size);
            texts[5].text = "Upgrade Equipment " + (flatAttributes.sizeBasePrice + flatAttributes.sizeBasePrice * flatAttributes.size);
            texts[6].text = "Rent Criminal";
            Button[] buttons = flatPanel.GetComponentsInChildren <Button>();
            buttons[0].onClick.AddListener(FlatButton1);
            buttons[1].onClick.AddListener(FlatButton2);

            enable(flatPanel);
        }
    }
Example #2
0
 public void Confiscate()
 {
     foreach (GameObject g in flats)
     {
         FlatMechanics f = g.GetComponent <FlatMechanics>();
         //f.equipment = 0;
         //f.size = 1;
         f.owner = GovermentPerson.Instance.confiscatePerson;
         //show loss panel
     }
 }
Example #3
0
    public void SetFlatValues()
    {
        FlatMechanics flat = currentBuilding.GetComponent <FlatMechanics>();

        if (flat.owner == PlayerManager.Instance.player)
        {
            FlatTexts[5].text = "Act of ownership T";
        }
        else
        {
            FlatTexts[5].text = "Act of ownership F";
        }

        FlatTexts[3].text = "SIZE  <b>" + flat.size + "</b>";
        FlatTexts[1].text = "QUALITY <b>: " + flat.equipment + "</b>";
        //FlatTexts[].text = "Occupied:" + flat.isTaken;
        FlatTexts[4].text = "Upgrade";        // + (flat.sizeBasePrice + flat.size * flat.sizePriceChange);
        FlatTexts[2].text = "Upgrade";
        FlatTexts[9].text = "OccupiedD <b>" + flat.roomNA + "/" + 8 * flat.size + "</b>";
        FlatTexts[6].text = "Purchase";
    }
Example #4
0
    public override bool checkd()
    {
        bool response = false;

        if (PlayerManager.Instance.APRLimit != 0)
        {
            if (!random)
            {
                FlatMechanics fmek = flat.GetComponent <FlatMechanics>();
                if (fmek.owner == PlayerManager.Instance.player)
                {
                    if (fmek.roomNA < fmek.size * 8)
                    {
                        response = true;
                        //Manager.Instance.increaseCash(income);
                        //Check witch account
                        int stI = 0;
                        for (int i = 0; i < webJob.client.bankAccounts.Length; i++)
                        {
                            if (webJob.client.bankAccounts[i].accountBlocked == true)
                            {
                                stI++;
                            }
                            else
                            {
                                break;
                            }
                        }
                        int stJ = 0;
                        for (int i = 0; i < fmek.owner.bankAccounts.Length; i++)
                        {
                            if (fmek.owner.bankAccounts[i].accountBlocked == true)
                            {
                                stJ++;
                            }
                            else
                            {
                                break;
                            }
                        }
                        webJob.client.bankAccounts[stI].TransferMoneyWithoutTaxes(fmek.owner.bankAccounts[stJ], "AFR MTRANSFER FROM " + webJob.client.ID + " TO " + PlayerManager.Instance.player, webJob.price);
                    }
                }
            }
            else
            {
                List <GameObject> propositions = new List <GameObject>();
                foreach (GameObject g in PlayerManager.Instance.playerassets)
                {
                    if (g.GetComponent("FlatMechanics") as FlatMechanics != null)
                    {
                        propositions.Add(g);
                    }
                }
                GameObject target = null;
                for (int i = 0; i < propositions.Count; i++)
                {
                    target = propositions[i];
                    if (target.GetComponent <FlatMechanics>().roomNA < target.GetComponent <FlatMechanics>().size *8)
                    {
                        response = true;
                        //Manager.Instance.increaseCash(income);
                        //Check which account
                        int stI = 0;
                        for (int j = 0; j < webJob.client.bankAccounts.Length; j++)
                        {
                            if (webJob.client.bankAccounts[j].accountBlocked == true)
                            {
                                stI++;
                            }
                            else
                            {
                                break;
                            }
                        }
                        int stJ = 0;
                        for (int k = 0; i < target.GetComponent <FlatMechanics>().owner.bankAccounts.Length; k++)
                        {
                            if (target.GetComponent <FlatMechanics>().owner.bankAccounts[k].accountBlocked == true)
                            {
                                stJ++;
                            }
                            else
                            {
                                break;
                            }
                        }
                        webJob.client.bankAccounts[stI].TransferMoneyWithoutTaxes(target.GetComponent <FlatMechanics>().owner.bankAccounts[stJ], "AFR MTRANSFER FROM " + webJob.client.ID + " TO " + PlayerManager.Instance.player, webJob.price);
                        break;
                    }
                }
            }
            //Manager.Instance.increaseCash(income);
            //response = true;
        }
        return(response);
    }