Unity3d開發之十四:unity3d長string格式化,並且滑動顯示,指定替換文字內容
unity3d長string格式化,並且滑動顯示,指定替換文字內容
長文字顯示-----------------------------------------------------------------------------
宣告一個string型別,記住格式 @“文字 ”:
例項如下:
string detail = @"
1 .This activity is valid from {0} to {1}. You have to use {2} App Client (the ""App"")to join in this activity.
2 .During the activity, you may get different kinds of Puzzles and redeem them for the following rewards:
{3}
3 .During the activity, you may get the Puzzles in the following ways:
(1) Bubble for Puzzles.You may get random Puzzles when take part in Bubble for Puzzles.There are six Bubbles at the same time displayed in applicable page as well as the kind of the Puzzle(s) you may get for each Bubble.You may choose the Bubble you want and watch a video from the beginning to the end according to the instruction to get a random number of the Puzzle(s) of such kind. Please note that if you close the App Or turn off the screen before you finish watching the video, you will get nothing;
(2) Luck Spin.You may get random Puzzles when you spin in the Lucky Spin.To get a chance of spin, you shall watch a video from the beginning to the end according to the instruction.
4 .The ways you get the Puzzles, the number of Puzzles you get in each way and the rewards may be changed from time to time. Please refer to the activity page in the App to check the latest activity details.
5 .When you redeem for a reward (except for the Coins), you must fill in your shipping information accurately, otherwise you are solely responsible for the failure of reward delivery.We will confirm your shipping information within 7 working days.After our confirmation, the reward will be delivered to you in several days. You need to abide by all applicable laws and take responsibility for tax declaration and payment.
6 .Please note that upon the end of the activity, any unredeemed Puzzles will be cleared up and no compensation will be made to you.
7 .We will not provide any after-sales services for the rewards you get in the App. If you have any question about the rewards, please contact the applicable manufacturer.
8 .In the event of any force majeure event or any change of circumstance that we cannot control(including but not limited to strikes, act of God, policy changes, act of governmental, cyberattack and system failure) leading to the cessation or adjustment of any activity, please understand that we are not obligated to make any compensation to you, nor shall we undertake any liability whatsoever.In the event of any failure to whatsoever.In the event of any failure to participate in any activity due to your improper operation, network failure, failure of telecom operator or any third party reasons, we are not obligated to make any compensation, nor shall we undertake any legal liability whatsoever.
9 .Please strictly abide by the activity rules.If any cheating or violation is found(including but not limited to using illegal tools to decode our services and hackings), measures will be taken including but not limited to disqualification from taking part in this activity, redeeming for any rewards, getting any redeemed reward and/or using the App, under which circumstance, no compensation in any form will be made to you and we also reserve the right to require you to return any rights, interests and rewards that you have received.
10 .To the extent permitted by the applicable law, we have the right to make adjustments to the activity rules at any time, and we will send prior notice in the App if we decide to make significant adjustment. The adjustment will take effect at the time of the release of the notice or the time specified in the notice. If you do not agree with any adjustments please do not join in this activity anymore.
11 .We reserve the right to interpret the activity rules to the extent permitted by applicable laws and regulations.
12 .Our End User License Agreement and Privacy Policy shall also be applicable to this activity.In case of any difference and inconsistency between the policies and any specific activity rules, the specific activity rules shall prevail in terms of this activity.
13 .If you have any questions or disputes arising out of or in relation to the rules this activity or the App please contact us by emailing at {4}.
14 .Apple is not involved in any way with this activity.
";
展示:
m_Email.text = m_DetailData.email;
滑動顯示-----------------------------------------------------------------------------
新增滑動列表:
為滑動列表新增自動擴充的元件:
為文字框新增自動擴充元件:
程式碼裡面匹配文字框高度和滑動列表高度,這裡需要注意的就是需要用協程做個延時,0.1s就行,不然會有匹配不了高度的bug,這可能是unity自帶的毛病:
StartCoroutine(TimeUtlis.Delay(() =>
{
float height = m_Texts.GetComponent<RectTransform>().rect.height;
m_content.GetComponent<RectTransform>().SetHeight(height);
}));
替換指定文字-----------------------------------------------------------------------------
主要使用的是 string.Format(替換的文字,文字中的指定位置{0},文字中的指定位置{1},文字中的指定位置{2},文字中的指定位置{3},文字中的指定位置{4})
類似:
如果需要手動換行,在指定位置使用 \n即可!
string detailText = "";
for (int i = 0; i < m_DetailData.detailItemDatas.Count; i++)
{
detailText += "("+(i+1)+")" +" Redeem " + m_DetailData.detailItemDatas[i].target +" " + m_DetailData.detailItemDatas[i].title+ " Puzzles for a " + m_DetailData.detailItemDatas[i].title+"; \n";
}
m_Texts.text = string.Format(detail, m_DetailData.startDate, m_DetailData.endDate, m_DetailData.name, detailText, m_DetailData.email);
相關文章
- JavaScript 替換字串全部指定內容JavaScript字串
- 文字超出容器長度自動隱藏並且顯示省略號
- vim 清空內容和替換文字
- 文字框填內容寫達到指定長度自動切換
- JAVA編輯word替換指定內容,解決插入圖片顯示不全問題Java
- Flex佈局-垂直居中並換行顯示內容Flex
- QT之——QTableWidget拖拽單元格並替換內容(進階)QT
- css文字超出div隱藏剩下內容並顯示省略號CSS
- idea替換內容快捷鍵 idea怎麼替換掉所選的文字Idea
- Python提取文字指定內容Python
- unity3d學校的課程內容有哪些?Unity3D
- Python 查詢PDF中的指定文字並高亮顯示Python
- vim內替換檔案內容
- css文字超出2行就隱藏並且顯示省略號CSS
- Linux給檔案內容每行指定字元資料脫敏替換Linux字元
- js控制文字內容過多時候點選展開方式顯示全部內容demoJS
- css記錄1:文字塊內超長只顯示一行,且超過寬度顯示為省略號CSS
- 有什麼方法可以自動合併視訊並替換音訊內容音訊
- Unity3D Android鍵盤輸入內容為白色解決方案Unity3DAndroid
- unity3d外掛之 DoTweenUnity3D
- 圖片上傳顯示替換
- mysql 如何替換資料表欄位字串中指定單詞的內容MySql字串
- 複習Linux如何顯示檔案指定行數的內容Linux
- Unity3D Demo專案開發記錄Unity3D
- Unity3D - 如何引入包到指定的資料夾Unity3D
- VS 正規表示式替換內容
- Jmeter二次開發函式 - 文字替換JMeter函式
- Unity3d Android SDK接入解析(一)Unity3d 與 Android之間的互相呼叫Unity3DAndroid
- unity3d開發的大型網路遊戲Unity3D遊戲
- linux文字替換Linux
- chm 檔案開啟只顯示目錄,不顯示內容
- Unity3d 初探Unity3D
- unity3d碰撞Unity3D
- unity3d sqliteUnity3DSQLite
- 滑動視窗3.替換後最長重複字元子串字元
- grep、sed批量替換檔案內容shell
- 公司網站怎樣替換內容呢網站
- Android開發之指令碼替換PackageNameAndroid指令碼Package