网上看到的这题,下面贴出源代码

 

using UnityEngine;
using System.Collections;

public class c99 : MonoBehaviour//C#脚本名:c99
{

void OnGUI()
{
#region
const float offsetX = -30;
const float offsetY = -10;
const float width = 80;
const float height = 30;
Rect position;
string formula;

for (int i = 1; i <= 9; i++)
{
for (int j = 1; j <= i; j++)
{
position = new Rect(j * width + offsetX, i * height + offsetY, width, height);
formula = string.Format("{0} x {1} = {2}", j, i, i*j);
GUI.Label(position, formula);

// Debug.Log(formula);

} }

#endregion
}
}

Unity3D题目,Unity中利用GUI输出九九乘法表


 
                    
            
                

相关文章:

  • 2022-01-20
  • 2021-05-30
  • 2021-11-11
  • 2021-11-10
  • 2022-12-23
猜你喜欢
  • 2021-10-24
  • 2021-11-13
  • 2022-01-19
  • 2022-03-09
  • 2022-12-23
  • 2021-12-10
相关资源
相似解决方案