This commit is contained in:
Putoo
2026-06-18 18:54:22 +08:00
parent 4297019836
commit ad49fbb1b1
42 changed files with 1694 additions and 62 deletions

View File

@@ -64,6 +64,11 @@ public static class GameBus
isok = await accService.UpdateUserAcc(userId, operate, nameof(AccEnum.AccType.teach), count,
nameof(AccEnum.Name.), remark);
}
else if (goodsType.Equals(nameof(GameEnum.PropCode.map)))
{
var mapService = App.GetService<IGameMapService>();
isok = await mapService.AddUserCityMap(userId, Convert.ToInt32(parameter));
}
return isok;
}
@@ -338,6 +343,7 @@ public static class GameBus
isok = false;
}
}
result.Needs.Add(item);
}
@@ -351,6 +357,28 @@ public static class GameBus
#region
public static RandomDataBase GetRandomByWeight(List<RandomDataBase> data)
{
var _randomInstance = new Random();
if (data.Count == 0)
{
return null;
}
double totalWeight = data.Sum(it => it.random);
int rnd = _randomInstance.Next(Convert.ToInt32(totalWeight) + 1);
double current = 0;
foreach (var item in data)
{
current += item.random;
if (rnd < current)
{
return item;
}
}
return null;
}
public static List<TowerGet> GetRandomGoods(RandomModel random, int count = 1, int luck = 0)
{
List<TowerGet> result = new List<TowerGet>();

View File

@@ -138,7 +138,41 @@ public class GameTool
return result;
}
public static string GetEquQualityName(int count)
{
string result = "白";
switch (count)
{
case 1:
result = "红";
break;
case 2:
result = "橙";
break;
case 3:
result = "黄";
break;
case 4:
result = "绿";
break;
case 5:
result = "青";
break;
case 6:
result = "粉";
break;
case 7:
result = "紫";
break;
case 8:
result = "金";
break;
}
return result;
}
#region
/// <summary>