void ChangeViewMode(string Mode)
    {
        if (CurrentMode != Mode)
        {
            for (int i = 0; i < FunctionPanel.transform.childCount - 1; i++)
            {
                FunctionPanel.transform.GetChild(i).gameObject.SetActive(false);
            }

            if (Mode == "OverView")
            {
                foreach (var Panel in OverViewPanels)
                {
                    Panel.SetActive(true);
                }
                Canvas.ForceUpdateCanvases();
                CallPanelController.ContentSizeFitterReseter(FunctionPanel);
                ListPanel.SetActive(false);
            }
            else if (Mode == "Select")
            {
                foreach (var Panel in SelectModePanels)
                {
                    Panel.SetActive(true);
                }
                Canvas.ForceUpdateCanvases();
                CallPanelController.ContentSizeFitterReseter(FunctionPanel);
                ListPanel.SetActive(true);
                ListPanel.GetComponent <RectTransform>().sizeDelta = new Vector2(0, Screen.height - CallPanelController.CurrentUIsize - FunctionPanel.GetComponent <RectTransform>().rect.height);
            }
            CurrentMode = Mode;
        }
    }
Exemple #2
0
    void DisplayLatestNews()
    {
        if (NewsList.Count == 0)
        {
            return;
        }

        Sprite TypeIcon = null;

        switch (NewsList[NewsList.Count - 1].Type)
        {
        case "Attention":
            TypeIcon = Resources.Load <Sprite>("GameSystem/InGameUI/Sprite/AttentionIcon");
            break;

        case "Info":
            TypeIcon = Resources.Load <Sprite>("GameSystem/InGameUI/Sprite/InfoIcon");
            break;

        case "Award":
            TypeIcon = Resources.Load <Sprite>("GameSystem/InGameUI/Sprite/AwardIcon");
            break;
        }

        LatestNewsTypeIconImageCarrier.SetActive(true);
        LatestNewsTypeIconImageCarrier.transform.GetChild(0).gameObject.GetComponent <Image>().sprite = TypeIcon;
        LatestNewsTextObject.GetComponent <Text>().text = NewsList[NewsList.Count - 1].Content;

        float TextPanelSize = LatestNewsTextObject.GetComponent <Text>().text.Length * 9 * CallPanelController.UIscale;

        if (TextPanelSize > CallPanelController.CurrentUIsize * 10f)
        {
            TextPanelSize = CallPanelController.CurrentUIsize * 10f;
        }

        LatestNewsTextCarrier.GetComponent <RectTransform>().sizeDelta = new Vector2(TextPanelSize, CallPanelController.CurrentUIsize);

        Canvas.ForceUpdateCanvases();
        CallPanelController.ContentSizeFitterReseter(FunctionItem);
        CallPanelController.ContentSizeFitterReseter(NewsCarrier);

        NewsDisplayTimeLimit = 300;

        // CallPanelController.ContentSizeFitterReseter(LatestNewsTextCarrier);
        // Canvas.ForceUpdateCanvases();
    }
Exemple #3
0
    void Update()
    {
        if (CallTimeManager.TimeValue % CallTimeManager.Hour < CallTimeManager.PlaySpeed)
        {
            ClearAllGraph();

            GetElectricityStateValue();
            GetLaborForceStateValue();
            GetProcessingStateValue();

            DrawGraph();
        }

        if (UpdateState.CompleteUpdate)
        {
            for (int i = 0; i < ProcessGraphIndexPanel.transform.childCount; i++)
            {
                CallPanelController.ContentSizeFitterReseter(ProcessGraphIndexPanel.transform.GetChild(i).gameObject);
            }

            CallPanelController.ContentSizeFitterReseter(ProcessGraphIndexPanel);
            CallPanelController.ContentSizeFitterReseter(ProcessGraphPanelCarrier);

            Canvas.ForceUpdateCanvases();

            UpdateState.ResetValue();
        }
        if (UpdateState.NeedUpdate)
        {
            UpdateProcessingGraphIndex();
        }
    }
Exemple #4
0
    void DisplayReport(int MonthIndex, string Category, GameObject DetailTextObject, GameObject AmountTextObject)
    {
        List <EconomyValue.History> HistoryList = new List <EconomyValue.History>();

        HistoryList.AddRange(CallEconomyValue.GetHistoryByCategory(MonthIndex, Category));
        List <string> DetailList = new List <string>();

        // Debug.Log(Category + " " + HistoryList.Count);
        foreach (var History in HistoryList)
        {
            bool isDuplicated = false;
            foreach (var Detail in DetailList)
            {
                if (Detail == History.Detail)
                {
                    isDuplicated = true;
                    break;
                }
            }

            if (!isDuplicated)
            {
                DetailList.Add(History.Detail);
            }
        }

        Transform ParentTransform = DetailTextObject.transform.parent;

        if (DetailTextObject.transform.parent.childCount < DetailList.Count)
        {
            for (int i = ParentTransform.childCount; i < DetailList.Count; i++)
            {
                GameObject.Instantiate(DetailTextObject, DetailTextObject.transform.parent);
                GameObject.Instantiate(AmountTextObject, AmountTextObject.transform.parent);
            }

            for (int i = 0; i < ParentTransform.childCount; i++)
            {
                DetailTextObject.transform.parent.GetChild(i).gameObject.SetActive(true);
                AmountTextObject.transform.parent.GetChild(i).gameObject.SetActive(true);
            }
        }
        else if (ParentTransform.childCount > DetailList.Count)
        {
            for (int i = ParentTransform.childCount - 1; i >= DetailList.Count; i--)
            {
                if (i == 0)
                {
                    break;
                }
                DetailTextObject.transform.parent.GetChild(i).gameObject.SetActive(false);
                AmountTextObject.transform.parent.GetChild(i).gameObject.SetActive(false);
            }
        }

        if (DetailList.Count == 0)
        {
            DetailTextObject.GetComponent <Text>().text = "";
            AmountTextObject.GetComponent <Text>().text = "0";
        }
        else
        {
            for (int i = 0; i < ParentTransform.childCount; i++)
            {
                if (!ParentTransform.GetChild(i).gameObject.activeSelf)
                {
                    break;
                }

                GameObject TargetDetailText  = DetailTextObject.transform.parent.GetChild(i).gameObject;
                GameObject TargetAmountlText = AmountTextObject.transform.parent.GetChild(i).gameObject;

                TargetDetailText.GetComponent <Text>().text = DetailList[i];
                int Amount = 0;
                foreach (var History in HistoryList)
                {
                    if (History.Detail == DetailList[i])
                    {
                        Amount += History.Amount;
                    }
                }
                TargetAmountlText.GetComponent <Text>().text = Amount.ToString();
            }
        }

        for (int i = 1; i < DetailTextObject.transform.parent.childCount; i++)
        {
            if (!ParentTransform.GetChild(i).gameObject.activeSelf)
            {
                Destroy(DetailTextObject.transform.parent.GetChild(i).gameObject);
                Destroy(AmountTextObject.transform.parent.GetChild(i).gameObject);
            }
        }

        CallPanelController.ContentSizeFitterReseter(DetailTextObject.transform.parent.parent.gameObject);
    }