Author Topic: why NGUI2.6.4 don't support "\n" again?  (Read 2753 times)

shokinhan

  • Guest
why NGUI2.6.4 don't support "\n" again?
« on: August 19, 2013, 08:41:33 AM »
The version before has the "\n" function.
But now it does't support. why?
The change would make a lot of troubles. Because my text already has a lot of "\n" for editing the text!


ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: why NGUI2.6.4 don't support "\n" again?
« Reply #1 on: August 19, 2013, 08:51:10 AM »
What do you mean "again"? It was never re-added. You probably re-added it yourself.

You need to fix your own text to not include two characters for \n. Newline is a single character.

shokinhan

  • Guest
Re: why NGUI2.6.4 don't support "\n" again?
« Reply #2 on: August 20, 2013, 07:19:30 AM »
I do it as so!

I add an line code as "mProcessedText = mText.Replace("\\n", "\n");", is it right?

   void ProcessText ()
   {
      mChanged = true;
      hasChanged = false;
      mLastText = mText;
      mProcessedText = mText.Replace("\\n", "\n");
               ...............................................

         }


missingno

  • Guest
Re: why NGUI2.6.4 don't support "\n" again?
« Reply #3 on: August 20, 2013, 08:31:55 AM »
I do it as so!

I add an line code as "mProcessedText = mText.Replace("\\n", "\n");", is it right?

   void ProcessText ()
   {
      mChanged = true;
      hasChanged = false;
      mLastText = mText;
      mProcessedText = mText.Replace("\\n", "\n");
               ...............................................

         }

Why are you doing this ? I set the UILabel.text property and include \n for a newline and it works just fine using stock 2.6.4

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: why NGUI2.6.4 don't support "\n" again?
« Reply #4 on: August 20, 2013, 02:13:09 PM »
For some obscure reason he keeps insisting on passing strings that use double characters for a newline instead of a single character. So instead of fixing his text, he prefers to hack the label. *shrug*

shokinhan

  • Guest
Re: why NGUI2.6.4 don't support "\n" again?
« Reply #5 on: August 21, 2013, 12:08:25 AM »
So if I want to mark the newline at file like 1.txt. And the program would read the file.

How to mark an newline in the file?


ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: why NGUI2.6.4 don't support "\n" again?
« Reply #6 on: August 21, 2013, 09:49:53 AM »
When you read your file, do the string.Replace before assigning it to your label.text.