MarkAsChanged() public method

UILabel needs additional processing when something changes.
public MarkAsChanged ( ) : void
return void
Beispiel #1
0
    void SetColor(Color color)
    {
        if (curType == ComponentType.ENUM_LABEL)
        {
            for (int i = 0; i < tran.Length; i++)
            {
                UILabel lb = tran[i].GetComponent <UILabel>();
                if (lb != null)
                {
                    switch (witchColor)
                    {
                    case 0:
                        lb.color = color;
                        lb.MarkAsChanged();
                        break;

                    case 1:
                        lb.TopColor = color;
                        lb.MarkAsChanged();
                        break;

                    case 2:
                        lb.BottomColor = color;
                        lb.MarkAsChanged();
                        break;

                    case 3:
                        lb.effectColor = color;
                        break;

                    default:
                        break;
                    }
                }
            }
        }
        else if (curType == ComponentType.ENUM_SPRITE)
        {
            for (int i = 0; i < tran.Length; i++)
            {
                UISprite sp = tran[i].GetComponent <UISprite>();
                if (sp != null)
                {
                    if (witchColor == 0)
                    {
                        sp.color = color;
                        sp.MarkAsChanged();
                    }
                }
            }
        }
    }
Beispiel #2
0
    private void SetLabel(GameObject obj, string text)
    {
        UILabel lbl = obj.GetComponent <UILabel>();

        lbl.text = text;
        lbl.MarkAsChanged();
    }
Beispiel #3
0
    private void SetLabel(GameObject to, string newText)
    {
        UILabel lbl = to.transform.GetComponent <UILabel>();

        lbl.text = newText;
        lbl.MarkAsChanged();
    }
Beispiel #4
0
    static public void NGUISetLabel(GameObject to, string newText)
    {
        UILabel lbl = to.transform.GetComponent <UILabel>();

        lbl.text = newText;
        lbl.MarkAsChanged();
    }
Beispiel #5
0
        private void ApplyUnitInfo()
        {
            Unit unit = selector.GetUnit();

            if (unit != null)
            {
                string description = string.Format(
                    unitDescriptionFormat,
                    unit.HealthStatistics.TotalPoints,
                    unit.HealthStatistics.Deffence,
                    unit.AttackStatistics.Area,
                    unit.AttackStatistics.Power,
                    unit.AttackStatistics.Range,
                    unit.AttackStatistics.TotalQuantity,
                    unit.MovementStatistics.TotalRange,
                    unit.MovementStatistics.DifficultTerrainMoveAbility,
                    GetUnitSpecialAbilityDescription(unit.UnitType));
                UILabel content = this.tabPanes[index].ContentLabel;
                content.text = description;
                content.MarkAsChanged();
            }
            else
            {
                Debug.LogWarning("No unit type information available.");
            }
        }
Beispiel #6
0
    static int MarkAsChanged(IntPtr L)
    {
        LuaScriptMgr.CheckArgsCount(L, 1);
        UILabel obj = (UILabel)LuaScriptMgr.GetUnityObjectSelf(L, 1, "UILabel");

        obj.MarkAsChanged();
        return(0);
    }
    // Update is called once per frame
    void Update()
    {
        //find the current time measurement
        //UICenterOnChild

        Calculate();

        if (DateTime.Compare(targetDateTime, DateTime.Now) > 0)
        {
            Display();
        }
        else
        {
            label.text = Celebrate();
            label.MarkAsChanged();
        }
    }
Beispiel #8
0
    /// <summary>
    /// Check every frame to see if the text has changed and mark the label as having been updated.
    /// </summary>

    protected override void OnUpdate(float factor, bool isFinished)
    {
        if (mLabel)
        {
            mLabel.enabled = !(isFinished && mCurrent == hoverOut && mCurrent.alpha == 0f);
            mLabel.MarkAsChanged();
        }
    }
Beispiel #9
0
 /// <summary>
 ///   Tween the value.
 /// </summary>
 protected override void OnUpdate(float factor,
                                  bool isFinished)
 {
     this.gradientTop = Color.Lerp(from1,
                                   from2,
                                   factor);
     this.gradientBottom = Color.Lerp(to1,
                                      to2,
                                      factor);
     mLabel.MarkAsChanged();
 }
Beispiel #10
0
    private void RefreshSymbolList()
    {
        if (m_realMatchs == null)
        {
            return;
        }

        m_realMatchs.Clear();

        string mProcessedText = m_TextLabel.processedText;

        if (overflowMethod == UILabel.Overflow.ResizeHeight)
        {
            mProcessedText = m_Text;
        }
        else
        {
            NGUIText.WrapText(m_Text, out mProcessedText);
        }

        StringBuilder sString = new StringBuilder();
        const string  pattern = @"\#\w\w";

        m_realText = NGUIText.StripSymbols(mProcessedText);
        m_matchs   = Regex.Matches(m_realText, pattern);

        const string pat = "\\s";

        m_spaceMatchs = Regex.Matches(m_realText, pat);

        if (m_matchs.Count > 0)
        {
            Match item;
            for (int i = 0; i < m_matchs.Count; i++)
            {
                item = m_matchs[i];
                string name     = item.Value.Substring(1, 2);
                string realname = "{" + name + "}";
                if (m_Symbols.IndexOf(realname) > -1)
                {
                    m_realMatchs.Add(item);
                    sString.Append(realname);
                }
            }
        }

        m_TextLabel.text   = m_Text;
        m_SymbolLabel.text = sString.ToString();

        m_SymbolLabel.width  = m_TextLabel.width;
        m_SymbolLabel.height = m_TextLabel.height;

        m_SymbolLabel.MarkAsChanged();
    }
Beispiel #11
0
    public void addLabel(GameObject item, string text)
    {
        UILabel label = item.GetComponent <UILabel>();

        label.text = text;

        label.trueTypeFont = theFeed.textFont;
        label.fontSize     = 18;
        label.color        = new Color(0.3f, 0.3f, 0.3f, 1f);
        label.alignment    = NGUIText.Alignment.Left;
        label.MarkAsChanged();
    }
Beispiel #12
0
 static public int MarkAsChanged(IntPtr l)
 {
     try {
         UILabel self = (UILabel)checkSelf(l);
         self.MarkAsChanged();
         pushValue(l, true);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
Beispiel #13
0
        private UITableCell CreateLabel(string text, int i)
        {
            UILabel label = NGUIUtil.InstantiateWidget(grid.transform, titleLabelPrefab.gameObject).GetComponent <UILabel>();

            label.name = "Title" + i;
            label.SetText(text);
            label.MarkAsChanged();
            label.gameObject.SetActive(true);
            UILabelCell cell = label.gameObject.AddComponent <UILabelCell>();

            cell.label = label;
            return(cell);
        }
	static int MarkAsChanged(IntPtr L)
	{
		try
		{
			ToLua.CheckArgsCount(L, 1);
			UILabel obj = (UILabel)ToLua.CheckObject<UILabel>(L, 1);
			obj.MarkAsChanged();
			return 0;
		}
		catch (Exception e)
		{
			return LuaDLL.toluaL_exception(L, e);
		}
	}
Beispiel #15
0
 private static void OnFontTextureChanged(Font font)
 {
     for (int i = 0; i < mList.size; i++)
     {
         UILabel uILabel = mList[i];
         if (uILabel != null)
         {
             Font font2 = uILabel.trueTypeFont;
             if (font2 != null)
             {
                 font2.RequestCharactersInTexture(uILabel.mText, uILabel.mPrintedSize, uILabel.mFontStyle);
                 uILabel.MarkAsChanged();
             }
         }
     }
 }
    public static int MarkAsChanged(IntPtr l)
    {
        int result;

        try
        {
            UILabel uILabel = (UILabel)LuaObject.checkSelf(l);
            uILabel.MarkAsChanged();
            LuaObject.pushValue(l, true);
            result = 1;
        }
        catch (Exception e)
        {
            result = LuaObject.error(l, e);
        }
        return(result);
    }
Beispiel #17
0
    /// <summary>
    /// Notification called when the Unity's font's texture gets rebuilt.
    /// Unity's font has a nice tendency to simply discard other characters when the texture's dimensions change.
    /// By requesting them inside the notification callback, we immediately force them back in.
    /// Originally I was subscribing each label to the font individually, but as it turned out
    /// mono's delegate system causes an insane amount of memory allocations when += or -= to a delegate.
    /// So... queue yet another work-around.
    /// </summary>

    static void OnFontTextureChanged()
    {
        for (int i = 0; i < mList.size; ++i)
        {
            UILabel lbl = mList[i];

            if (lbl != null)
            {
                Font fnt = lbl.trueTypeFont;

                if (fnt != null)
                {
                    fnt.RequestCharactersInTexture(lbl.mText, lbl.mPrintedSize, lbl.mFontStyle);
                    lbl.MarkAsChanged();
                }
            }
        }
    }
Beispiel #18
0
    void Update()
    {
        // Update the HP & DP on the Unit's GUI Button
        if (UnitButton != null)
        {
            UILabel UnitHPLabel = GameObject.Find(UnitButton.name + "/HPLabel").GetComponent <UILabel>();
            UILabel UnitDPLabel = GameObject.Find(UnitButton.name + "/DPLabel").GetComponent <UILabel>();

            UnitHPLabel.text = "HP :" + HP;
            UnitDPLabel.text = "DP :" + DP;

            UnitHPLabel.MakePixelPerfect();
            UnitDPLabel.MakePixelPerfect();

            UnitHPLabel.MarkAsChanged();
            UnitDPLabel.MarkAsChanged();
        }         // End if block

        speed = gameObject.rigidbody2D.velocity.magnitude;
    }     // End Update()
Beispiel #19
0
 void RefreshAllLables(Font font)
 {
     UIPanel[] panels = UnityEngine.GameObject.FindObjectsOfType <UIPanel>() as UIPanel[];
     for (int i = 0; i < panels.Length; i++)
     {
         foreach (UIWidget widget in panels[i].widgets)
         {
             if (widget.GetType() == typeof(UILabel) || widget.GetType() == typeof(UIColorLabel))
             {
                 UILabel lbl = widget as UILabel;
                 if (lbl.TrueTypeFont == font)
                 {
                     lbl.MarkAsChanged();
                     lbl.ProcessText();
                     lbl.UpdateGeometry(ref panels[i].mWorldToLocal, (lbl.changeFlag == 1));
                 }
             }
         }
         panels[i].Fill();
     }
 }
Beispiel #20
0
    void SetByPixelSize(float bai, UILabel label)
    {
        if (label.overflowMethod == UILabel.Overflow.ShrinkContent)
        {
            label.keepCrispWhenShrunk = UILabel.Crispness.Always;
            minimumSize = label.fontSize;
        }
        int prevSize = label.fontSize;

        if (Mathf.FloorToInt(label.fontSize * bai) <= minimumSize)
        {
            bai = (float)minimumSize / (float)label.fontSize;
        }
        else if (Mathf.FloorToInt(label.fontSize * bai) >= maximumSize)
        {
            bai = (float)maximumSize / (float)label.fontSize;
        }
        label.fontSize = Mathf.FloorToInt(label.fontSize * bai);
        if (label.overflowMethod != UILabel.Overflow.ShrinkContent)
        {
            gameObject.transform.localScale = new Vector3(gameObject.transform.localScale.x / bai, gameObject.transform.localScale.y / bai, 1.0f);
        }
        label.MarkAsChanged();
    }
Beispiel #21
0
        public void RefreshChapterFormat()
        {
            if (!mChapterFormatLoaded)
            {
                //Debug.Log ("Chapter format not loeaded");
                return;
            }

            mTextScale.Set(ChapterFontSize, ChapterFontSize, 1f);

            TextLabel.font  = ChapterFont;
            TextLabel.pivot = ChapterAlignment;
            //TextLabel.transform.localScale = mTextScale;
            TextLabel.color = ChapterFontColor;
            TextLabel.MarkAsChanged();

//						Vector2 fontSize = ChapterFont.CalculatePrintedSize("The Quick Brown Fox", true);
//						mMaxLineWidth = TextLabel.lineWidth;
//						mAverageLineHeight = fontSize.y * TextLabel.transform.localScale.y;
//						mMaxLabelHeight = TextLabel.relativeSize.y * mAverageLineHeight;

            //FormatLabel.font = ChapterFont;
            //FormatLabel.transform.localScale = Vector3.one * ChapterFontSize;
            //FormatLabel.lineWidth = mMaxLineWidth;
            //FormatLabel.transform.localScale = mTextScale;
            //FormatLabel.pivot = ChapterAlignment;
            //FormatLabel.MarkAsChanged();

            mAlignmentPosition = Vector3.zero;
            switch (ChapterAlignment)
            {
            //TOP
            case UIWidget.Pivot.TopLeft:
            default:
                //do nothing, it's top left by default
                break;

            case UIWidget.Pivot.Top:                    //Center
                mAlignmentPosition.Set(mLabelScale.x / 2, 0f, 0f);
                break;

            case UIWidget.Pivot.TopRight:
                mAlignmentPosition.Set(mLabelScale.x, 0f, 0f);
                break;

            //CENTER
            case UIWidget.Pivot.Left:
                mAlignmentPosition.Set(0f, -mLabelScale.y / 2, 0f);
                break;

            case UIWidget.Pivot.Center:
                mAlignmentPosition.Set(mLabelScale.x / 2, -mLabelScale.y / 2, 0f);
                break;

            case UIWidget.Pivot.Right:
                mAlignmentPosition.Set(mLabelScale.x, -mLabelScale.y / 2, 0f);
                break;

            //BOTTOM
            case UIWidget.Pivot.BottomLeft:
                mAlignmentPosition.Set(0, -mLabelScale.y, 0f);
                break;

            case UIWidget.Pivot.Bottom:
                mAlignmentPosition.Set(mLabelScale.x / 2, -mLabelScale.y, 0f);
                break;

            case UIWidget.Pivot.BottomRight:
                mAlignmentPosition.Set(mLabelScale.x, -mLabelScale.y, 0f);
                break;
            }

            AlignmentObject.transform.localPosition = mAlignmentPosition;
            TextLabel.text = mChapterText;
            if (DisplayChapter)
            {
                ChapterLabel.text = "_Chapter " + (mChapterNumber + 1).ToString() + "_";
            }
            else
            {
                ChapterLabel.text = string.Empty;
            }
        }
Beispiel #22
0
 // Update is called once per frame
 void Update()
 {
     thisLabel.text = labelToCopy.text;
     thisLabel.MarkAsChanged();
 }
Beispiel #23
0
 public void OnEnable()
 {
     if (this._action != InputMappingIcons.Actions.None && (!this._gamepadOnly || TheForest.Utils.Input.IsGamePad || ForestVR.Enabled))
     {
         this._registeredAsBigIcon = (this._useBigIcon || (TheForest.Utils.Input.IsGamePad && this._useBigIconForGamepad));
         Transform transform = base.transform;
         InputMappingIcons.Actions           action            = this._action;
         ActionIcon.SideIconTypes            sideIcon          = this._sideIcon;
         ActionIconSystem.CurrentViewOptions currentViewOption = this._currentViewOption;
         bool       useAltTextIcon      = this._useAltTextIcon;
         bool       registeredAsBigIcon = this._registeredAsBigIcon;
         string     actionTextOverride  = this._actionTextOverride;
         ActionIcon actionIcon          = ActionIconSystem.RegisterIcon(transform, action, sideIcon, currentViewOption, useAltTextIcon, registeredAsBigIcon, null, actionTextOverride, false);
         if (actionIcon)
         {
             this._fillSprite = actionIcon._fillSprite;
             if (this._fillSprite)
             {
                 if (this._fillSprite.gameObject.activeSelf != this._useFillSprite)
                 {
                     this._fillSprite.gameObject.SetActive(this._useFillSprite);
                 }
                 if (this._useFillSprite && actionIcon._fillSpriteAction)
                 {
                     actionIcon._fillSpriteAction.SetAction(this._action);
                 }
             }
             if (actionIcon._sprite && this._widget && this._refreshSiblings)
             {
                 Transform target = this._widget.leftAnchor.target;
                 this._widget.leftAnchor.target = null;
                 this._widget.width             = Mathf.RoundToInt((float)actionIcon._sprite.width / base.transform.localScale.x);
                 this._widget.leftAnchor.target = target;
                 this._widget.SkipWidthUpdate   = true;
                 IEnumerator enumerator = base.transform.GetEnumerator();
                 try
                 {
                     while (enumerator.MoveNext())
                     {
                         object    obj        = enumerator.Current;
                         Transform transform2 = (Transform)obj;
                         UILabel   component  = transform2.GetComponent <UILabel>();
                         if (component)
                         {
                             component.MarkAsChanged();
                             component.ProcessText();
                         }
                     }
                 }
                 finally
                 {
                     IDisposable disposable;
                     if ((disposable = (enumerator as IDisposable)) != null)
                     {
                         disposable.Dispose();
                     }
                 }
             }
         }
     }
     if (this._sprite)
     {
         this._sprite.enabled = false;
     }
     if (this._label)
     {
         this._label.enabled = false;
     }
 }
Beispiel #24
0
        private bool DrawTest()
        {
            showTest = EditorGUILayout.Foldout(showTest, "Test");
            bool changed = false;

            if (showTest)
            {
                EditorGUI.indentLevel += 2;
                EditorGUIUtil.ObjectField <UIFont>("Font", ref testFont, true);
                int row = grid.rowCount;
                int col = grid.columnCount;
                if (EditorGUIUtil.IntField("Font Size", ref fontSize, GUILayout.ExpandWidth(false)))
                {
                    for (int r = 0; r < row; r++)
                    {
                        for (int c = 0; c < col; c++)
                        {
                            UILabel label = grid.GetCell(r, c).GetComponent <UILabel>();
                            if (label != null)
                            {
                                label.transform.localScale = new Vector3(fontSize, fontSize, 1);
                            }
                        }
                    }
                }
                if (EditorGUIUtil.ColorField("Font Color", ref fontColor, GUILayout.ExpandWidth(false)))
                {
                    for (int r = grid.rowHeader; r < row; r++)
                    {
                        for (int c = grid.columnHeader; c < col; c++)
                        {
                            UILabel label = grid.GetCell(r, c).GetComponent <UILabel>();
                            if (label != null)
                            {
                                label.color = fontColor;
                                label.MarkAsChanged();
                            }
                        }
                    }
                }
                Array.Resize(ref testStrings, grid.maxPerLine);
                for (int i = 0; i < grid.maxPerLine; i++)
                {
                    EditorGUIUtil.TextField(i.ToString(), ref testStrings[i], GUILayout.ExpandWidth(false));
                }
                GUI.enabled = testFont != null;
                if (GUILayout.Button("Fill Data"))
                {
                    for (int r = grid.rowHeader; r < row; r++)
                    {
                        for (int c = grid.columnHeader; c < col; c++)
                        {
                            UITableCell cell = grid.GetCell(r, c);
                            if (cell == null)
                            {
                                UILabel label = NGUITools.AddWidget <UILabel>(grid.gameObject);
                                label.bitmapFont = testFont;
                                label.name       = "__TEST__";
                                label.SetText(testStrings[grid.isHorizontal?c:r]);
                                label.transform.localScale = new Vector3(fontSize, fontSize, 1);
                                label.color = fontColor;
                                label.MarkAsChanged();
                                UILabelCell lc = label.gameObject.AddComponent <UILabelCell>();
                                lc.label = label;
                                grid.SetCell(r, c, lc);
                            }
                        }
                    }
                    changed = true;
                }
                GUI.enabled            = true;
                EditorGUI.indentLevel -= 2;
            }
            return(changed);
        }
Beispiel #25
0
    }     // End Awake()

    public bool OnClick()
    {
        GameVars.UnitTypeClicked = UnitType.ToLower();

        // Get the unit spot clicked...
        ThisUnitSpot = GameVars.UnitNumberClicked;

        // Find the background and change it to white on hover...
        gameObject.transform.FindChild("Background").GetComponent <UISprite>().color = new Color(1f, 1f, 1f);

        if (GameVars.UnitsRemaining[UnitType.ToLower()] > 0 && GameVars.SpotFilled[ThisUnitSpot - 1] == null)          // If the spot isn't already filled and we have units of this type:

        // Add the unit to the squad for this button
        {
            GameUnit = GameVars.AddUnitToSquad(UnitType.ToLower(), GameVars.SquadClicked, ThisUnitSpot);
            // Indicate that this spot is filled
            GameVars.SpotFilled[ThisUnitSpot - 1] = UnitType.ToLower();
        }
        else if (GameVars.UnitsRemaining[UnitType.ToLower()] > 0)          // If we have units of this type remaining...

        // Remove the last unit that was put in this spot
        {
            GameVars.RemoveUnitFromSquad(GameVars.SpotFilled[ThisUnitSpot - 1], GameVars.SquadClicked, ThisUnitSpot);

            // Add the new unit
            GameUnit = GameVars.AddUnitToSquad(UnitType.ToLower(), GameVars.SquadClicked, ThisUnitSpot);
            GameVars.SpotFilled[ThisUnitSpot - 1] = UnitType.ToLower();
        }
        else           // No unit was added

        {
            GameUnit = null;
        }                     // End if/else block

        if (GameUnit != null) // If a unit was added...


        {
            if (GameObject.Find("AddUnit" + ThisUnitSpot + "/HPLabel") != null)
            {
                Destroy(GameObject.Find("AddUnit" + ThisUnitSpot + "/HPLabel").gameObject);
            }
            if (GameObject.Find("AddUnit" + ThisUnitSpot + "/DPLabel") != null)
            {
                Destroy(GameObject.Find("AddUnit" + ThisUnitSpot + "/DPLabel").gameObject);
            }

            // ---------------------- Change the + Button to the Unit Type ---------------------- //

            // Grab the Add Tile Button
            AddTileObject = GameObject.Find("AddUnit" + GameVars.UnitNumberClicked.ToString());
            UIImageButton AddTileButton = AddTileObject.GetComponent <UIImageButton>();


            GameUnit.UnitButton = AddTileObject;

            // Change the sprite button's sprites to the blank version
            AddTileButton.normalSprite = AddTileButton.hoverSprite = AddTileButton.pressedSprite = AddTileButton.disabledSprite = "AddUnitBlank";

            // Change the background tile to the blank sprite
            UISprite AddTile = GameObject.Find("AddUnit" + GameVars.UnitNumberClicked.ToString() + "/Background").GetComponent <UISprite>();
            AddTile.spriteName = "AddUnitBlank";
            AddTile.MakePixelPerfect();
            AddTile.MarkAsChanged();


            // Destroy and previous unit sprites that may have been added here:
            Destroy(GameObject.Find("AddUnit" + GameVars.UnitNumberClicked.ToString() + "/UnitBKG"));

            // Instantiate a blank sprite game object
            GameObject unitRef = ((GameObject)Instantiate(Resources.Load <GameObject>("BlankSprite")));

            // Change the object's name
            unitRef.gameObject.name = "UnitBKG";

            // Get the actual sprite
            UISprite unitRefSprite = unitRef.GetComponent <UISprite>();

            // Change it to the unit's UI sprite
            unitRefSprite.spriteName = GameVars.UnitTypes[UnitType.ToLower()].GUISprite;

            // Make it's parent the AddTileButton
            unitRef.transform.parent = AddTileButton.transform;

            // Put it in the correct place
            unitRef.transform.localPosition = new Vector3(-16, 25, 0);

            // Update the sprite
            unitRefSprite.MakePixelPerfect();
            unitRefSprite.MarkAsChanged();


            // Add Unit Statistics for HP

            GameObject UnitHPLabelObject = new GameObject();
            UnitHPLabelObject.name = "HPLabel";
            UnitHPLabelObject.tag  = "hpLabel";

            UnitHPLabel = UnitHPLabelObject.AddComponent <UILabel>();
            UnitHPLabel.transform.parent = AddTileButton.transform;
            UnitHPLabel.text             = "HP: " + GameUnit.Type.HP;
            UnitHPLabel.name             = "HPLabel";
            UnitHPLabel.color            = new Color((191f / 255f), 0, 0);
            UnitHPLabel.font             = (UIFont)Resources.Load <UIFont>("UIFontSmall");
            UnitHPLabel.depth            = 50;
            UnitHPLabel.maxLineCount     = 1;
            UnitHPLabel.multiLine        = false;
            UnitHPLabel.pivot            = UIWidget.Pivot.Right;

            UnitHPLabel.MakePixelPerfect();
            UnitHPLabel.MarkAsChanged();

            UnitHPLabel.transform.localPosition = new Vector3(34, 25, 0);
            UnitHPLabel.transform.parent        = GameObject.Find("AddUnit" + ThisUnitSpot).gameObject.transform;


            // Add Unit Statistics for DP

            GameObject UnitDPLabelObject = new GameObject();
            UnitDPLabelObject.name = "HPLabel";
            UnitDPLabelObject.tag  = "dpLabel";

            UnitDPLabel = UnitDPLabelObject.AddComponent <UILabel>();
            UnitDPLabel.transform.parent = AddTileButton.transform;
            UnitDPLabel.text             = "DP: " + GameUnit.Type.DP;
            UnitDPLabel.name             = "DPLabel";
            UnitDPLabel.color            = new Color(0, (191f / 255f), (17f / 255f));
            UnitDPLabel.font             = (UIFont)Resources.Load <UIFont>("UIFontSmall");
            UnitDPLabel.depth            = 50;
            UnitDPLabel.maxLineCount     = 1;
            UnitDPLabel.multiLine        = false;
            UnitDPLabel.pivot            = UIWidget.Pivot.Right;

            UnitDPLabel.MakePixelPerfect();
            UnitDPLabel.MarkAsChanged();

            UnitDPLabel.transform.localPosition = new Vector3(34, 10, 0);
            UnitDPLabel.transform.parent        = GameObject.Find("AddUnit" + ThisUnitSpot).gameObject.transform;

            if (GameVars.UnitNumberClicked % 6 == 0)
            {
                NGUITools.SetActive(AddUnitBox, false);
            }

            GameVars.UnitNumberClicked++;
        }

        if (GameUnit == null)
        {
            return(false);
        }
        return(true);
    }     // End OnClick()
    /// <summary>
    /// Check every frame to see if the text has changed and mark the label as having been updated.
    /// </summary>

    protected override void OnUpdate(float factor, bool isFinished)
    {
        mLabel.MarkAsChanged();
    }