Esempio n. 1
0
    void ClearSummaryPanel()
    {
        IncomePieGraphCarrier.GetComponent <GraphDrawer>().PieGraphClear();
        ExpensePieGraphCarrier.GetComponent <GraphDrawer>().PieGraphClear();

        for (int i = 0; i < SummaryReportCarrier.transform.childCount; i++)
        {
            if (i == 1 || i == 8 || i == 12)
            {
                continue;
            }

            SummaryReportCarrier.transform.GetChild(i).GetChild(1).gameObject.GetComponent <Text>().text = "0";
        }
    }
Esempio n. 2
0
    public void Scaling()
    {
        SummaryPanel.GetComponent <RectTransform>().sizeDelta = new Vector2(0, CallPanelController.CurrentUIsize * 6f);
        Vector2 SummaryPanelSize = SummaryPanel.GetComponent <RectTransform>().sizeDelta;

        DetailScrollPanel.GetComponent <RectTransform>().sizeDelta = new Vector2(0, Screen.height - CallPanelController.CurrentUIsize - SummaryPanelSize.y);
        Vector2 DetailScrollPanelSize = DetailScrollPanel.GetComponent <RectTransform>().sizeDelta;

        IncomePieGraphPanel.GetComponent <RectTransform>().sizeDelta = new Vector2(CallPanelController.CurrentUIsize * 5.6f, 0);
        float PieGraphPanelSize = IncomePieGraphPanel.GetComponent <RectTransform>().sizeDelta.x - (CallPanelController.CurrentEdgePadding * 2f);

        IncomePieGraphPanel.transform.GetChild(0).gameObject.GetComponent <RectTransform>().sizeDelta        = new Vector2(PieGraphPanelSize, CallPanelController.CurrentEdgePadding);
        IncomePieGraphPanel.transform.GetChild(0).gameObject.GetComponent <RectTransform>().anchoredPosition = new Vector2(CallPanelController.CurrentEdgePadding, -CallPanelController.CurrentEdgePadding);
        IncomePieGraphCarrier.GetComponent <RectTransform>().sizeDelta        = new Vector2(PieGraphPanelSize, PieGraphPanelSize);
        IncomePieGraphCarrier.GetComponent <RectTransform>().anchoredPosition = new Vector2(CallPanelController.CurrentEdgePadding, -CallPanelController.CurrentEdgePadding * 2f);
        IncomePieGraphPanel.transform.GetChild(2).gameObject.GetComponent <RectTransform>().sizeDelta        = new Vector2(PieGraphPanelSize, PieGraphPanelSize);
        IncomePieGraphPanel.transform.GetChild(2).gameObject.GetComponent <RectTransform>().anchoredPosition = new Vector2(CallPanelController.CurrentEdgePadding, -CallPanelController.CurrentEdgePadding * 2f);
        ExpensePieGraphPanel.GetComponent <RectTransform>().sizeDelta = new Vector2(PieGraphPanelSize + CallPanelController.CurrentEdgePadding, 0);
        ExpensePieGraphPanel.transform.GetChild(0).gameObject.GetComponent <RectTransform>().sizeDelta        = new Vector2(PieGraphPanelSize, CallPanelController.CurrentEdgePadding);
        ExpensePieGraphPanel.transform.GetChild(0).gameObject.GetComponent <RectTransform>().anchoredPosition = new Vector2(0, -CallPanelController.CurrentEdgePadding);
        ExpensePieGraphCarrier.GetComponent <RectTransform>().sizeDelta        = new Vector2(PieGraphPanelSize, PieGraphPanelSize);
        ExpensePieGraphCarrier.GetComponent <RectTransform>().anchoredPosition = new Vector2(0, -CallPanelController.CurrentEdgePadding * 2f);
        ExpensePieGraphPanel.transform.GetChild(2).gameObject.GetComponent <RectTransform>().sizeDelta        = new Vector2(PieGraphPanelSize, PieGraphPanelSize);
        ExpensePieGraphPanel.transform.GetChild(2).gameObject.GetComponent <RectTransform>().anchoredPosition = new Vector2(0, -CallPanelController.CurrentEdgePadding * 2f);
        SummaryReportPanel.GetComponent <RectTransform>().sizeDelta   = new Vector2(CallPanelController.CurrentUIsize * 4.4f, 0);
        SummaryReportCarrier.GetComponent <RectTransform>().offsetMin = new Vector2(0, CallPanelController.CurrentEdgePadding);
        SummaryReportCarrier.GetComponent <RectTransform>().offsetMax = new Vector2(-CallPanelController.CurrentEdgePadding, -CallPanelController.CurrentEdgePadding);
        SummaryReportCarrier.transform.GetChild(0).gameObject.GetComponent <RectTransform>().sizeDelta = new Vector2(0, CallPanelController.CurrentEdgePadding * 1.25f);
        SummaryReportCarrier.transform.GetChild(1).gameObject.GetComponent <RectTransform>().sizeDelta = new Vector2(0, CallPanelController.CurrentEdgePadding * 0.5f);
        for (int i = 2; i < 8; i++)
        {
            SummaryReportCarrier.transform.GetChild(i).gameObject.GetComponent <RectTransform>().sizeDelta = new Vector2(0, CallPanelController.CurrentEdgePadding);
        }
        SummaryReportCarrier.transform.GetChild(8).gameObject.GetComponent <RectTransform>().sizeDelta = new Vector2(0, CallPanelController.CurrentEdgePadding * 0.5f);
        for (int i = 9; i < 12; i++)
        {
            SummaryReportCarrier.transform.GetChild(i).gameObject.GetComponent <RectTransform>().sizeDelta = new Vector2(0, CallPanelController.CurrentEdgePadding);
        }
        SummaryReportCarrier.transform.GetChild(12).gameObject.GetComponent <RectTransform>().sizeDelta = new Vector2(0, CallPanelController.CurrentEdgePadding * 0.5f);
        SummaryReportCarrier.transform.GetChild(13).gameObject.GetComponent <RectTransform>().sizeDelta = new Vector2(0, CallPanelController.CurrentEdgePadding * 1.25f);
        for (int i = 0; i < SummaryReportCarrier.transform.childCount; i++)
        {
            if (i != 1 && i != 8 && i != 12 && i != 13)
            {
                SummaryReportCarrier.transform.GetChild(i).GetChild(0).gameObject.GetComponent <RectTransform>().sizeDelta = new Vector2(0, CallPanelController.CurrentUIsize * 0.4f);
                SummaryReportCarrier.transform.GetChild(i).GetChild(1).gameObject.GetComponent <RectTransform>().sizeDelta = new Vector2(0, CallPanelController.CurrentUIsize * 0.4f);
            }
        }
        SummaryReportCarrier.transform.GetChild(13).GetChild(0).gameObject.GetComponent <RectTransform>().sizeDelta = new Vector2(0, CallPanelController.CurrentUIsize * 0.6f);
        SummaryReportCarrier.transform.GetChild(13).GetChild(1).gameObject.GetComponent <RectTransform>().sizeDelta = new Vector2(0, CallPanelController.CurrentUIsize * 0.2f);
        SummaryReportCarrier.transform.GetChild(13).GetChild(2).gameObject.GetComponent <RectTransform>().sizeDelta = new Vector2(0, CallPanelController.CurrentUIsize * 0.4f);

        float DetailPanelBasicSize          = CallPanelController.CurrentUIsize * 5.6f;
        float DetailPanelCarrierBasicSize   = CallPanelController.CurrentUIsize * 4.6f;
        float DetailPanelCategoryObjectSize = CallPanelController.CurrentUIsize - CallPanelController.CurrentEdgePadding;

        DetailScrollPanel.transform.GetChild(0).gameObject.GetComponent <RectTransform>().offsetMin = new Vector2(0, 0);
        DetailScrollPanel.transform.GetChild(0).gameObject.GetComponent <RectTransform>().offsetMax = new Vector2(-CallPanelController.CurrentEdgePadding, 0);
        DetailScrollPanel.transform.GetChild(1).gameObject.GetComponent <RectTransform>().offsetMin = new Vector2(-CallPanelController.CurrentEdgePadding, 0);
        DetailScrollPanel.transform.GetChild(1).gameObject.GetComponent <RectTransform>().offsetMax = new Vector2(0, 0);

        DetailReportCategoryPanel.GetComponent <RectTransform>().sizeDelta = new Vector2(0, CallPanelController.CurrentUIsize);
        DetailReportCategoryPanel.transform.GetChild(0).gameObject.GetComponent <RectTransform>().sizeDelta        = new Vector2(0, DetailPanelCategoryObjectSize);
        DetailReportCategoryPanel.transform.GetChild(0).gameObject.GetComponent <RectTransform>().anchoredPosition = new Vector2(CallPanelController.CurrentUIsize, -(CallPanelController.CurrentEdgePadding * 0.5f));
        DetailReportCategoryPanel.transform.GetChild(1).gameObject.GetComponent <RectTransform>().sizeDelta        = new Vector2(CallPanelController.CurrentUIsize * 4f, DetailPanelCategoryObjectSize);
        DetailReportCategoryPanel.transform.GetChild(1).gameObject.GetComponent <RectTransform>().anchoredPosition = new Vector2(0, -(CallPanelController.CurrentEdgePadding * 0.5f));
        DetailReportInnerPanel.GetComponent <RectTransform>().sizeDelta = new Vector2(0, DetailPanelCarrierBasicSize + CallPanelController.CurrentEdgePadding);
        DetailReportInnerPanel.transform.GetChild(0).gameObject.GetComponent <RectTransform>().offsetMin = new Vector2(CallPanelController.CurrentEdgePadding, CallPanelController.CurrentEdgePadding);
        DetailReportInnerPanel.transform.GetChild(0).gameObject.GetComponent <RectTransform>().offsetMax = new Vector2(0, 0);
        DetailReportCarrier.GetComponent <RectTransform>().sizeDelta        = new Vector2(CallPanelController.CurrentUIsize * 15.2f, 0);
        DetailReportCarrier.GetComponent <RectTransform>().anchoredPosition = new Vector2(CallPanelController.CurrentEdgePadding, 0);

        for (int i = 0; i < DetailReportCarrier.transform.childCount; i++)
        {
            DetailReportCarrier.transform.GetChild(i).GetChild(0).gameObject.GetComponent <RectTransform>().sizeDelta = new Vector2(CallPanelController.CurrentUIsize * 3f, 0);
            DetailReportCarrier.transform.GetChild(i).GetChild(1).gameObject.GetComponent <RectTransform>().sizeDelta = new Vector2(CallPanelController.CurrentUIsize * 4f, 0);
            DetailReportCarrier.transform.GetChild(i).GetChild(2).gameObject.GetComponent <RectTransform>().sizeDelta = new Vector2(CallPanelController.CurrentUIsize * 2f, 0);
            DetailReportCarrier.transform.GetChild(i).GetChild(3).gameObject.GetComponent <RectTransform>().sizeDelta = new Vector2(CallPanelController.CurrentEdgePadding * 0.5f, 0);
            DetailReportCarrier.transform.GetChild(i).GetChild(4).gameObject.GetComponent <RectTransform>().sizeDelta = new Vector2(CallPanelController.CurrentUIsize * 4f, 0);
            DetailReportCarrier.transform.GetChild(i).GetChild(5).gameObject.GetComponent <RectTransform>().sizeDelta = new Vector2(CallPanelController.CurrentUIsize * 2f, 0);
            for (int j = 0; j < DetailReportCarrier.transform.GetChild(i).GetChild(j).childCount; j++)
            {
                if (i > 1)
                {
                    DetailReportCarrier.transform.GetChild(i).GetChild(j).GetChild(0).gameObject.GetComponent <RectTransform>().sizeDelta = new Vector2(0, CallPanelController.CurrentEdgePadding);
                }
                else
                {
                    DetailReportCarrier.transform.GetChild(i).GetChild(j).GetChild(0).gameObject.GetComponent <RectTransform>().sizeDelta = new Vector2(0, CallPanelController.CurrentEdgePadding * 0.75f);
                }
            }
        }

        CallPanelController.FontScaling(gameObject);
    }
Esempio n. 3
0
    public void DiplaySummary()
    {
        ClearSummaryPanel();

        List <EconomyValue.History> HistoryList = new List <EconomyValue.History>();

        SummaryReportCarrier.transform.GetChild(0).GetChild(1).gameObject.GetComponent <Text>().text = "TEST";
        string[] ExpenseCategoryList = new string[] { "Buy", "Install", "Upkeep", "Research", "Employee Pay", "Real Estate" };
        string[] IncomeCategoryList  = new string[] { "Sell", "Milestone", "Loan" };

        List <int> ExpenseAmountList = new List <int>();
        List <int> IncomeAmountList  = new List <int>();

        for (int i = 0; i < ExpenseCategoryList.Length; i++)
        {
            ExpenseAmountList.Add(CallEconomyValue.GetHistorySubByCategory(-1, ExpenseCategoryList[i]));

            SummaryReportCarrier.transform.GetChild(i + 2).GetChild(1).gameObject.GetComponent <Text>().text = ExpenseAmountList[i].ToString();
        }

        for (int i = 0; i < IncomeCategoryList.Length; i++)
        {
            IncomeAmountList.Add(CallEconomyValue.GetHistorySubByCategory(-1, IncomeCategoryList[i]));

            SummaryReportCarrier.transform.GetChild(i + 9).GetChild(1).gameObject.GetComponent <Text>().text = IncomeAmountList[i].ToString();
        }

        SummaryReportCarrier.transform.GetChild(13).GetChild(1).gameObject.GetComponent <Text>().text = CallEconomyValue.RealtimeIncome.ToString();
        if (CallEconomyValue.RealtimeIncome > 0)
        {
            SummaryReportCarrier.transform.GetChild(13).GetChild(1).gameObject.GetComponent <Text>().color = new Color(0, 1f, 0, 1f);
        }
        else if (CallEconomyValue.RealtimeIncome < 0)
        {
            SummaryReportCarrier.transform.GetChild(13).GetChild(1).gameObject.GetComponent <Text>().color = new Color(1f, 0, 0, 1f);
        }
        else
        {
            SummaryReportCarrier.transform.GetChild(13).GetChild(1).gameObject.GetComponent <Text>().color = new Color(1f, 1f, 1f, 1f);
        }
        SummaryReportCarrier.transform.GetChild(13).GetChild(2).gameObject.GetComponent <Text>().text = CallEconomyValue.Balance.ToString();

        List <string> PieGraphIndex = new List <string>();
        List <float>  PieGraphData  = new List <float>();

        foreach (var Category in IncomeCategoryList)
        {
            PieGraphIndex.Add(Category);
        }
        foreach (var Amount in IncomeAmountList)
        {
            PieGraphData.Add(Amount);
        }
        IncomePieGraphCarrier.GetComponent <GraphDrawer>().DrawPieGraph(PieGraphIndex, PieGraphData, null);

        PieGraphIndex.Clear();
        PieGraphData.Clear();
        foreach (var Category in ExpenseCategoryList)
        {
            PieGraphIndex.Add(Category);
        }
        foreach (var Amount in ExpenseAmountList)
        {
            PieGraphData.Add(-Amount);
        }
        ExpensePieGraphCarrier.GetComponent <GraphDrawer>().DrawPieGraph(PieGraphIndex, PieGraphData, null);
    }