本文介绍了我该怎么把它放在循环中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好我怎么把这个循环放在哪里如果用户点击构建按钮,Plot 2将变为Plant 2,Plot 3将出现在Plant 2下方,其风格与Plot 2相同/>


这是PLOT 2

Hi guys how do i put this a loop where if user clicks build button, "Plot 2" will change to "Plant 2" and "Plot 3" will appear below "Plant 2" with same style like Plot 2

This is PLOT 2

message.AppendLine();
message.AppendLine("Plot 2");
message.Append(string.Format("$:{0} ", Cash), Color.Gray, TextMarkup.FontDecrease);
message.Append(string.Format("F:{0} ", Food), Color.Gray, TextMarkup.FontDecrease);
message.Append(string.Format("C:{0} ", Concrete), Color.Gray, TextMarkup.FontDecrease);
message.AppendLine(string.Format("M:{0}", Metal), Color.Gray, TextMarkup.FontDecrease);
message.AppendLine(string.Format("Time: {0}", Time), Color.Gray, TextMarkup.FontDecrease);
message.AppendLine(MessageBuilder.Elements.CreateLink("btnBuild", "Build", ""));

推荐答案


for (int i = 0; i < maxCount; i++)
            {
                message.AppendLine();

                if (i==maxCount-1)
                    message.AppendLine("Plot " + i+1);
                else
                    message.AppendLine("Plant " + i+1);

                message.Append(string.Format("



这篇关于我该怎么把它放在循环中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-23 01:41
查看更多