|
@@ -61,7 +61,6 @@ public class PlayerManager : Singleton<PlayerManager>
|
|
|
_timerEntity = null;
|
|
|
_timerEntity = TimerComponent.Instance.AddTimer(m, () =>
|
|
|
{
|
|
|
-
|
|
|
List<AccountFileInfo.DaoYouData> daoYouDatas = AccountFileInfo.Instance.playerData.daoYouDatas.ToList();
|
|
|
foreach (var keyValuePair in GuaijiDaoYou)
|
|
|
{
|
|
@@ -73,7 +72,8 @@ public class PlayerManager : Singleton<PlayerManager>
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- int count = Random.Range(0,GuaijiDaoYou.Count+1);
|
|
|
+
|
|
|
+ int count = Random.Range(0, daoYouDatas.Count + 1);
|
|
|
List<AccountFileInfo.DaoYouData> daoyou = new List<AccountFileInfo.DaoYouData>();
|
|
|
for (int i = 0; i < count; i++)
|
|
|
{
|
|
@@ -92,10 +92,59 @@ public class PlayerManager : Singleton<PlayerManager>
|
|
|
EventManager.Instance.Dispatch(CustomEventType.DaoYouCounUpdate, null);
|
|
|
}
|
|
|
|
|
|
- RandownDaoYou(gameConstantConfig.Daoyoushowuptime + 1000);
|
|
|
+ RandownDaoYou(gameConstantConfig.Daoyoushowuptime * 1000);
|
|
|
});
|
|
|
}
|
|
|
|
|
|
+ public int GetDaoYouLevel(AccountFileInfo.DaoYouData daoYouData)
|
|
|
+ {
|
|
|
+ DaoyouModelConfig daoyouModelConfig = ConfigComponent.Instance.Get<DaoyouModelConfig>(daoYouData.id);
|
|
|
+ int level = (int)(myHero.level.Value * daoyouModelConfig.growupRate * 0.01f);
|
|
|
+ if (level < 1) level = 1;
|
|
|
+ return level;
|
|
|
+ }
|
|
|
+
|
|
|
+ public int GetBl(AccountFileInfo.DaoYouData daoYouData, int guajibuffId)
|
|
|
+ {
|
|
|
+ DaoyouLevelupConfig daoyouLevelupConfig = ConfigComponent.Instance.Get<DaoyouLevelupConfig>(daoYouData.favorabilityLv);
|
|
|
+ int level = GetDaoYouLevel(daoYouData);
|
|
|
+ DaoyouguajiResourcLevel daoyouguajiResourcLevel = ConfigComponent.Instance.Get<DaoyouguajiResourcLevel>(level);
|
|
|
+ guajibuff guajibuff = ConfigComponent.Instance.Get<guajibuff>(guajibuffId);
|
|
|
+
|
|
|
+ int levelBl = 0;
|
|
|
+ int bl = 0;
|
|
|
+ switch (guajibuff.paraValue)
|
|
|
+ {
|
|
|
+ case 1:
|
|
|
+ levelBl = daoyouguajiResourcLevel.para1;
|
|
|
+ bl = (int)(guajibuff.GivingRate * levelBl * daoyouLevelupConfig.guajiGrowup * 0.01f * 0.001f);
|
|
|
+ return bl;
|
|
|
+ break;
|
|
|
+ case 2:
|
|
|
+ levelBl = daoyouguajiResourcLevel.para2;
|
|
|
+ bl = (int)(guajibuff.GivingRate * levelBl * daoyouLevelupConfig.guajiGrowup * 0.01f * 0.01f);
|
|
|
+ return bl;
|
|
|
+ break;
|
|
|
+ case 3:
|
|
|
+ levelBl = daoyouguajiResourcLevel.para3;
|
|
|
+ bl = (int)(guajibuff.GivingRate * levelBl * daoyouLevelupConfig.guajiGrowup * 0.01f * 0.01f);
|
|
|
+ return bl;
|
|
|
+ break;
|
|
|
+ case 4:
|
|
|
+ levelBl = daoyouguajiResourcLevel.para4;
|
|
|
+ bl = (int)(guajibuff.GivingRate * levelBl * daoyouLevelupConfig.guajiGrowup * 0.01f * 0.01f);
|
|
|
+ return bl;
|
|
|
+ break;
|
|
|
+ case 5:
|
|
|
+ levelBl = daoyouguajiResourcLevel.para4;
|
|
|
+ bl = (int)(guajibuff.GivingRate * levelBl * daoyouLevelupConfig.guajiGrowup * 0.01f * 0.01f);
|
|
|
+ return bl;
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
private void SetConfigs()
|
|
|
{
|
|
|
gameConstantConfig = ConfigComponent.Instance.Get<GameConstantConfig>(1);
|
|
@@ -175,12 +224,51 @@ public class PlayerManager : Singleton<PlayerManager>
|
|
|
AccountFileInfo.Instance.SavePlayerData();
|
|
|
}
|
|
|
|
|
|
+
|
|
|
foreach (var keyValuePair in GuaijiDaoYou)
|
|
|
{
|
|
|
if (TimeHelper.ClientNow() > keyValuePair.Key)
|
|
|
{
|
|
|
//判断概率给奖励
|
|
|
isUpdate = true;
|
|
|
+
|
|
|
+ foreach (var daoYouData in keyValuePair.Value)
|
|
|
+ {
|
|
|
+ DaoyouModelConfig daoyouModelConfig = ConfigComponent.Instance.Get<DaoyouModelConfig>(daoYouData.id);
|
|
|
+ int bl = GetBl(daoYouData, daoyouModelConfig.guajiBuffID[0]);
|
|
|
+
|
|
|
+ int randomValue1 = Random.Range(0, 101);
|
|
|
+ LogTool.Log("道友随机怪率:" + randomValue1 + " 比例:" + bl);
|
|
|
+ if (randomValue1 >= bl)
|
|
|
+ {
|
|
|
+ for (var i = 1; i < daoyouModelConfig.guajiBuffID.Length; i++)
|
|
|
+ {
|
|
|
+ int count = GetBl(daoYouData, daoyouModelConfig.guajiBuffID[i]);
|
|
|
+ guajibuff guajibuff = ConfigComponent.Instance.Get<guajibuff>(daoyouModelConfig.guajiBuffID[i]);
|
|
|
+ switch (guajibuff.paraValue)
|
|
|
+ {
|
|
|
+ case 1:
|
|
|
+ BagController.AddItem(1003, count);
|
|
|
+ LogTool.Log("道友获得道具id:" + 1003 + " 数量:" + count);
|
|
|
+ break;
|
|
|
+ case 2:
|
|
|
+ BagController.AddItem(1001, count);
|
|
|
+ LogTool.Log("道友获得道具id:" + 1001 + " 数量:" + count);
|
|
|
+ break;
|
|
|
+ case 3:
|
|
|
+ BagController.AddItem(1005, count);
|
|
|
+ LogTool.Log("道友获得道具id:" + 1005 + " 数量:" + count);
|
|
|
+ break;
|
|
|
+ case 4:
|
|
|
+ BagController.AddItem(1006, count);
|
|
|
+ LogTool.Log("道友获得道具id:" + 1006 + " 数量:" + count);
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
//移除
|
|
|
removeKey.Add(keyValuePair.Key);
|
|
|
}
|