diff --git a/Unity/Codes/Hotfix/Demo/Gather/GatherSystem.cs b/Unity/Codes/Hotfix/Demo/Gather/GatherSystem.cs index 2ffc833..90fd1c8 100644 --- a/Unity/Codes/Hotfix/Demo/Gather/GatherSystem.cs +++ b/Unity/Codes/Hotfix/Demo/Gather/GatherSystem.cs @@ -1,7 +1,7 @@ namespace ET { - [FriendClass(typeof(Gather))] - [FriendClass(typeof(ResourcePoint))] + [FriendClass(typeof (Gather))] + [FriendClass(typeof (ResourcePoint))] public static class GatherSystem { public static void FromMessage(this Gather self, GatherProto gatherProto) @@ -99,7 +99,7 @@ return false; } - + #if SERVER public static ResourceAttri Product(this Gather self, Unit unit, int tick) { @@ -109,7 +109,7 @@ ResourcesConfig config = ResourcesConfigCategory.Instance.Get(self.ResConfigId); int amount = 0; - if (config.OutInterval == 0&&self.PeopleIdList.Count>0) + if (config.OutInterval == 0 && self.PeopleIdList.Count > 0) { amount = config.OutAmount; } @@ -122,34 +122,34 @@ //资源扣除 if (res != null) { - var (finish, product) = res.Product(config.Id,amount); + var (finish, product) = res.Product(config.Id, amount); if (finish) { GatherOperate.FinishGather(unit, self.Id); MessageHelper.SendToClient(unit, new M2C_NotifyGatherFinish() { GatherId = self.Id }); } + unit.GetComponent().Add(config.BaseOut, product); var rate = (float) res.ResAttriDic[config.Id].GatherAmount / (float) res.ResAttriDic[config.Id].MaxAmount; //额外产出 - for (int i=0; i< res.ResAttriDic[config.Id].ExtraOuts.Count;i++) + for (int i = 0; i < res.ResAttriDic[config.Id].ExtraOuts.Count; i++) { var v = res.ResAttriDic[config.Id].ExtraOuts[i]; - var num = (int)(rate * v.MaxAmount); + var num = (int) (rate * v.MaxAmount); if (finish) { num = v.MaxAmount; } + if (num > v.GatherAmount) { unit.GetComponent().Add(v.CfgId, num - v.GatherAmount); res.ResAttriDic[config.Id].ExtraOuts[i] = new ExtraOut() { CfgId = v.CfgId, GatherAmount = num, MaxAmount = v.MaxAmount }; - } } } - //月圆之夜, if (unit.IsMoonNight()) {