资深玩家
  
- 贡献度
- 2023
- 金元
- 26052
- 积分
- 10707
- 精华
- 1
- 注册时间
- 2021-1-12
|
先说一下整个过程,1.首先声明一个数组用来放图片,
2.再在themes.initarray()里对数组初始化,
3.然后加一个获取图片的方法,
4.最后把gamescript的调用改成上面的方法
1.3.右键themes,选择【添加类成员(c#)】,把下面的加在大括号里
private Sprite[,] themes_SCREENSHOTS;
public Sprite GetScreenshot(int theme_, int grafikPoints)
{
int num = 0;
int num2 = 0;
while (num2 < 1000 && System.IO.File.Exists(string.Concat(new string[]
{
Application.dataPath,
"/Extern/Screenshots/",
theme_.ToString(),
"/",
num2.ToString(),
".png"
})))
{
num = num2;
num2++;
}
int num3 = 30000 / (num + 1);
num3 = grafikPoints / num3;
if (num3 < 0)
{
num3 = 0;
}
if (num3 > num)
{
num3 = num;
}
if (this.themes_SCREENSHOTS[theme_, num3])
{
return this.themes_SCREENSHOTS[theme_, num3];
}
this.themes_SCREENSHOTS[theme_, num3] = this.mS_.LoadPNG(string.Concat(new string[]
{
Application.dataPath,
"/Extern/Screenshots/",
theme_.ToString(),
"/",
num3.ToString(),
".png"
}));
return this.themes_SCREENSHOTS[theme_, num3];
}
4.改动gamescript.getscreenshot()
里面改成
return this.themes_.GetScreenshot(this.gameMainTheme, Mathf.RoundToInt(this.points_grafik));
2.
改动themes.initArrays(),49是文件夹内图片最大数,根据实际改
最后加上
this.themes_SCREENSHOTS = new Sprite[this.tS_.themes_EN.Length, 49];
|
评分
-
1
查看全部评分
-
|