Browse Source

调整排版

master
wserver/wangdisen 3 years ago
parent
commit
997fd4c531
  1. 18
      Unity/Codes/Hotfix/Demo/Gather/GatherSystem.cs

18
Unity/Codes/Hotfix/Demo/Gather/GatherSystem.cs

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

Loading…
Cancel
Save