Exemplo n.º 1
0
        }//function : setMat(Material nor, Material focus, Material sel)

        public IEnumerator Initialize()
        {
            if (!isGrowthValue)
            {
                valueAfterScale = shortValue / graph.barHeightScale[graph.curBid];
                if (valueAfterScale == 0.0f)
                {
                    valueAfterScale = 0.00001f;
                }
                BarMain.SetActive(true);

                yield return(StartCoroutine(GraphController.animate(new processAnimate(animateBarScale), 0.6f, 0.0f, valueAfterScale + 0.1f)));

                yield return(StartCoroutine(GraphController.animate(new processAnimate(animateBarScale), 0.6f, valueAfterScale + 0.1f, valueAfterScale - 0.06f)));

                yield return(StartCoroutine(GraphController.animate(new processAnimate(animateBarScale), 0.6f, valueAfterScale - 0.06f, valueAfterScale)));

                BarMain.transform.localScale = new Vector3(BarMain.transform.localScale.x, valueAfterScale, BarMain.transform.localScale.z);
            }
            else
            {
                if (shortValue < 0)
                {
                    shortValue = -shortValue;
                    BarMain.transform.localRotation = Quaternion.Euler(180.0f, 0.0f, 0.0f);

                    if (graph.graphName == "E Commerce")
                    {
                        isPopUpInfoAvailable = true;
                        BarPopUpBoardInfo.GetComponentInChildren <TextMeshPro>().text = "E-Commerce Decreased due to negative Twitter sentiment";
                    }
                    else if (graph.graphName == "Net Sales")
                    {
                        isPopUpInfoAvailable = true;
                        BarPopUpBoardInfo.GetComponentInChildren <TextMeshPro>().text = "Net Sales Decreased due to devaluation of Yuan";
                    }
                }
                else
                {
                    if (graph.graphName == "E Commerce")
                    {
                        isPopUpInfoAvailable = true;
                        BarPopUpBoardInfo.GetComponentInChildren <TextMeshPro>().text = "E-Commerce Increased due to positive Twitter sentiment";
                    }
                }
                assignMaterialToGrowthBar();

                //Growth Bar Scale only depends on Z axis Width10
                float scaleX = BarMain.transform.localScale.x;
                BarMain.transform.localScale = new Vector3(scaleX, scaleX, scaleX);
                BarMain.SetActive(true);

                valueAfterScale /= graph.barHeightScale[graph.curBid];
                //valueAfterScale += scaleX;
                valueAfterScale /= 2;

                yield return(StartCoroutine(GraphController.animate(new processAnimate(animateGrwothPosition), 1.8f, scaleX / 2.0f, valueAfterScale - (scaleX / 2.0f))));

                BarMain.transform.localPosition = new Vector3(0.0f, valueAfterScale - (scaleX / 2.0f), 0.0f);
            }


            totalLetter = ((int)shortValue).ToString().Length;
            BarValue.GetComponent <RectTransform>().sizeDelta     = new Vector2((smallFont / 17.0f) * totalLetter, BarValue.GetComponent <RectTransform>().sizeDelta.y);
            BarValue.GetComponent <RectTransform>().localPosition = new Vector3(0.0f, valueAfterScale, 0.0f);
            BarValue.GetComponent <TextMeshPro>().text            = "" + (int)shortValue;
            BarUnit.GetComponent <TextMeshPro>().text             = unit;
            BarValue.SetActive(true);

            //setting for PopUp
            BarPopUpBoard.transform.localPosition = defaultPosPopUp + new Vector3(0.0f, valueAfterScale, 0.0f);

            onUnFocus();
            yield return(null);
        }//function : Initialize()