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>();