UpdateText() публичный Метод

public UpdateText ( ) : void
Результат void
Пример #1
0
        private void SetDefaultLevelInfo()
        {
            for (int i = 0; i < Attributes.MAX_NUM_OF_LEVELS; i++)
            {
                GameObject obj             = null;
                bool       sameObjectCheck = false;
                if (this.contentPane.transform.childCount < Attributes.MAX_NUM_OF_LEVELS)
                {
                    obj = MonoBehaviour.Instantiate(this.levelInfoPrefab);
                }
                else
                {
                    obj             = this.contentPane.GetChild(i).gameObject;
                    sameObjectCheck = true;
                }
                LevelInfo levelInfo = obj.GetComponent <LevelInfo>();
                levelInfo.level          = i + 1;
                levelInfo.rate           = 1f;
                levelInfo.comparisonFlag = INVALID;
                levelInfo.UpdateText();

                levelInfo.transform.SetParent(this.contentPane.transform);
                RectTransform rectTransform = levelInfo.GetComponent <RectTransform>();
                Vector3       pos;
                if (sameObjectCheck)
                {
                    pos = this.contentPane.GetChild(i).GetComponent <RectTransform>().localPosition;
                }
                else
                {
                    pos = this.contentPane.transform.position;
                }
                pos.z = 0f;
                rectTransform.localScale    = Vector3.one;
                rectTransform.localRotation = this.contentPane.localRotation;
                rectTransform.localPosition = pos;
            }

            string defaultEquation = "y=1";

            this.yellowTeamAttributes.SetDirectHealthAttribute(defaultEquation);
            this.yellowTeamAttributes.SetDirectAttackAttribute(defaultEquation);
            this.yellowTeamAttributes.SetDirectSpeedAttribute(defaultEquation);
            this.yellowTeamAttributes.SetDirectSplitAttribute(defaultEquation);
            this.yellowTeamAttributes.SetDirectMergeAttribute(defaultEquation);
            this.yellowTeamAttributes.SetDirectAttackCooldownAttribute(defaultEquation);
            this.blueTeamAttributes.SetDirectHealthAttribute(defaultEquation);
            this.blueTeamAttributes.SetDirectAttackAttribute(defaultEquation);
            this.blueTeamAttributes.SetDirectSpeedAttribute(defaultEquation);
            this.blueTeamAttributes.SetDirectSplitAttribute(defaultEquation);
            this.blueTeamAttributes.SetDirectMergeAttribute(defaultEquation);
            this.blueTeamAttributes.SetDirectAttackCooldownAttribute(defaultEquation);
        }
Пример #2
0
        //-----------------  PRIVATE METHODS  ----------------------------

        private void UpdateLevelInfoIteration(int level, float answer, float previousAnswer)
        {
            bool       isLevelInfoInitialized = false;
            GameObject obj = null;

            if (this.contentPane.transform.childCount < Attributes.MAX_NUM_OF_LEVELS)
            {
                obj = MonoBehaviour.Instantiate(this.levelInfoPrefab);
                isLevelInfoInitialized = true;
            }
            else
            {
                obj = this.contentPane.GetChild(level).gameObject;
            }
            LevelInfo levelInfo = obj.GetComponent <LevelInfo>();

            levelInfo.level = level + 1;
            levelInfo.rate  = answer;
            if (levelInfo.level == 1)
            {
                levelInfo.comparisonFlag = INVALID;
            }
            else
            {
                if (answer < previousAnswer)
                {
                    levelInfo.comparisonFlag = SMALLER;
                }
                else if (Mathf.Abs(previousAnswer - answer) <= float.Epsilon)
                {
                    levelInfo.comparisonFlag = APPROXIMATE;
                }
                else if (answer > previousAnswer)
                {
                    levelInfo.comparisonFlag = LARGER;
                }
            }

            levelInfo.UpdateText();

            if (isLevelInfoInitialized)
            {
                levelInfo.transform.SetParent(this.contentPane.transform);
                levelInfo.transform.position = this.contentPane.transform.position;
                RectTransform rectTransform = levelInfo.GetComponent <RectTransform>();
                rectTransform.localScale    = Vector3.one;
                rectTransform.localRotation = this.contentPane.localRotation;
            }
        }