请教一下,子公司的BUFF功能是如何做到的?
最近将游戏打了论坛大神的真实补丁,说明里面的最后一条很有意思,“收购部分公司有特定BUFF,收购英特尔、AMD、英伟达分别-20%主机生产成本,腾讯加500%免费游戏销量、网易加100%免费游戏销量、Cygames加10%免费游戏销量,Steam加100%数字版游戏销量(手游除外)、Epic加20%数字版游戏销量(手游除外)、收购万代加10000%手办销量.手办最高售价从29.99提高到999.99”,请教一下,这一条是怎么实现的呢?有没有大佬可以解答一下疑惑。谢谢。子公司buff
platformScript添加类成员,189是英特尔、197是英伟达、198是AMD,分别减20%主机生产成本
private int SubsidiaryProductionsBuff()
{
int num = 100;
GameObject[] array = GameObject.FindGameObjectsWithTag("Publisher");
if (array.Length != 0)
{
int num2 = 189;
publisherScript component = array.GetComponent<publisherScript>();
if (component && component.isUnlocked && component.IsTochterfirma() && !component.isPlayer)
{
num -= 20;
}
}
if (array.Length != 0)
{
int num3 = 197;
publisherScript component2 = array.GetComponent<publisherScript>();
if (component2 && component2.isUnlocked && component2.IsTochterfirma() && !component2.isPlayer)
{
num -= 20;
}
}
if (array.Length != 0)
{
int num4 = 198;
publisherScript component3 = array.GetComponent<publisherScript>();
if (component3 && component3.isUnlocked && component3.IsTochterfirma() && !component3.isPlayer)
{
num -= 20;
}
}
return num;
}
改动GetAktuellProductionsCosts
{
float num = (float)(this.startProduktionskosten - (50 + this.anzController * 5));
num -= num * (this.kostenreduktion * 0.01f);
num += (float)(50 + this.anzController * 5);
num *= (float)this.SubsidiaryProductionsBuff() * 0.01f;
if (num < 59f)
{
num = 59f;
}
if (num > 2000f)
{
num = 2000f;
}
if (this.mS_.globalEvent == 12)
{
num += 100f;
}
return Mathf.RoundToInt(num);
}
gameScript添加类成员,71是腾讯、95是网易、200是Cygames
gameScript添加类成员,91是Steam、42是EPIC
gameScript添加类成员,4是万代
private int SubsidiaryInAppPurchasesBuff()
{
int num = 100;
GameObject[] array = GameObject.FindGameObjectsWithTag("Publisher");
if (array.Length != 0)
{
int num2 = 71;
publisherScript component = array.GetComponent<publisherScript>();
if (component && component.isUnlocked && component.IsTochterfirma() && !component.isPlayer)
{
num += 500;
}
}
if (array.Length != 0)
{
int num3 = 95;
publisherScript component2 = array.GetComponent<publisherScript>();
if (component2 && component2.isUnlocked && component2.IsTochterfirma() && !component2.isPlayer)
{
num += 100;
}
}
if (array.Length != 0)
{
int num4 = 200;
publisherScript component3 = array.GetComponent<publisherScript>();
if (component3 && component3.isUnlocked && component3.IsTochterfirma() && !component3.isPlayer)
{
num += 10;
}
}
return num;
}
private int SubsidiaryDigitalVersionBuff()
{
int num = 100;
GameObject[] array = GameObject.FindGameObjectsWithTag("Publisher");
if (array.Length != 0)
{
int num2 = 91;
publisherScript component = array.GetComponent<publisherScript>();
if (component && component.isUnlocked && component.IsTochterfirma() && !component.isPlayer)
{
num += 100;
}
}
if (array.Length != 0)
{
int num3 = 42;
publisherScript component2 = array.GetComponent<publisherScript>();
if (component2 && component2.isUnlocked && component2.IsTochterfirma() && !component2.isPlayer)
{
num += 20;
}
}
return num;
}
private int SubsidiaryFanshopBuff()
{
int num = 0;
GameObject[] array = GameObject.FindGameObjectsWithTag("Publisher");
if (array.Length != 0)
{
int num2 = 4;
publisherScript component = array.GetComponent<publisherScript>();
if (component && component.isUnlocked && component.IsTochterfirma() && !component.isPlayer)
{
num += 100;
}
}
return num;
}
在 if (this.gameTyp == 2)
{
int amountOfF2Ps = this.games_.GetAmountOfF2Ps();
上面加
if (this.IsMyGame() && this.gameTyp == 2)
{
num2 *= this.SubsidiaryInAppPurchasesBuff() * 0.01f;
}
在0.2f * this.GetPreisAbzug(3); (num68比num69 += (float)num65 * 0.2f * this.GetPreisAbzug(3);小一个)
下面加 if (!this.handy)
{
num68 *= (float)SubsidiaryDigitalVersionBuff() * 0.01f;
}
在int num8 = Mathf.RoundToInt(num6);前面加
if (this.SubsidiaryFanshopBuff() == 100 && j == 7)
{
num6 *= 100f;
}
Menu_Fanshop和Menu_Fanshop_Standardpreise添加类成员
private int SubsidiaryFanshopBuff()
{
int num = 0;
GameObject[] array = GameObject.FindGameObjectsWithTag("Publisher");
if (array.Length != 0)
{
int num2 = 4;
publisherScript component = array.GetComponent<publisherScript>();
if (component && component.isUnlocked && component.IsTochterfirma() && !component.isPlayer)
{
num += 100;
}
}
return num;
}
Menu_Fanshop的2处29.99改成
if (this.SubsidiaryFanshopBuff() != 100)
{
if (this.selectedGame.merchVerkaufspreis > 29.99f)
{
this.selectedGame.merchVerkaufspreis = 29.99f;
}
}
if (this.SubsidiaryFanshopBuff() == 100)
{
if (i != 7 && this.selectedGame.merchVerkaufspreis > 29.99f)
{
this.selectedGame.merchVerkaufspreis = 29.99f;
}
if (i == 7 && this.selectedGame.merchVerkaufspreis > 999.99f)
{
this.selectedGame.merchVerkaufspreis = 999.99f;
}
}
Menu_Fanshop_Standardpreise的2处29.99改成
if (this.SubsidiaryFanshopBuff() != 100)
{
if (this.mS_.merchStandardpreis > 29.99f)
{
this.mS_.merchStandardpreis = 29.99f;
}
}
if (this.SubsidiaryFanshopBuff() == 100)
{
if (i != 7 && this.mS_.merchStandardpreis > 29.99f)
{
this.mS_.merchStandardpreis = 29.99f;
}
if (i == 7 && this.mS_.merchStandardpreis > 999.99f)
{
this.mS_.merchStandardpreis = 999.99f;
}
} yellowottomany 发表于 2023-1-12 15:24
非常感谢大佬的解答,我研究研究:handshake yellowottomany 发表于 2023-1-12 15:24
写的很简洁,我看懂了。谢谢。
yellowottomany 发表于 2023-1-12 15:24
[*]在 if (this.gameTyp == 2)
[*] {
[*] int amountOfF2Ps = this.games_.GetAmountOfF2Ps();
[*]上面加
[*] if (this.IsMyGame() && this.gameTyp == 2)
[*] {
[*] num2 *= this.SubsidiaryInAppPurchasesBuff() * 0.01f;
[*] }
大佬,在这处出问题了,前面操作很顺利,这里“this.SubsidiaryInAppPurchasesBuff()”是红色,而this.SubsidiaryInAppPurchasesBuff()类成员添加并保存后再读取操作的。求助!!
自行解决问题了,选建类成员时,是搜索“类的选项”
页:
[1]