From f9d7df3326ab7009787af1910ae155562b25ebb6 Mon Sep 17 00:00:00 2001 From: wserver/wangdisen <1065498738@qq.com> Date: Fri, 26 Aug 2022 09:53:20 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=A4=A9=E6=B0=94=E7=B3=BB?= =?UTF-8?q?=E7=BB=9F=EF=BC=8C=E4=BF=AE=E6=94=B9=E5=B0=8F=E5=B1=8B=E6=92=AD?= =?UTF-8?q?=E7=A7=8D=E7=9A=84BUG?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Config/WeatherConfigCategory.bytes | Bin 422 -> 424 bytes Excel/Json/c/WeatherConfig.txt | 12 +- Excel/Json/s/WeatherConfig.txt | 12 +- Excel/WeatherConfig.xlsx | Bin 11850 -> 11874 bytes Proto/OuterMessage.proto | 21 +++ .../Cabin/Handler/C2M_CabinSeedHandler.cs | 6 +- Server/Hotfix/Demo/Unit/UnitFactory.cs | 8 +- Server/Hotfix/Demo/Unit/UnitHelper.cs | 12 ++ Server/Hotfix/Server.Hotfix.csproj | 3 + Server/Model/Base/MongoRegister.cs | 2 +- Server/Model/Generate/Message/OuterMessage.cs | 36 +++++ Server/Model/Generate/Message/OuterOpcode.cs | 3 + .../Config/WeatherConfigCategory.bytes | Bin 422 -> 424 bytes Unity/Codes/Hotfix/Demo/Unit/UnitFactory.cs | 1 - Unity/Codes/Hotfix/Demo/Unit/UnitSystem.cs | 33 +++++ .../Handler/M2C_NtfWeatherEndHandler.cs | 13 ++ .../Handler/M2C_NtfWeatherStartHandler.cs | 10 ++ .../Hotfix/Demo/Weather/WeatherSystem.cs | 125 ++++++++++++++++++ Unity/Codes/Model/Demo/People/People.cs | 1 + Unity/Codes/Model/Demo/Unit/Unit.cs | 10 +- Unity/Codes/Model/Demo/Weather/Weather.cs | 14 +- .../Model/Generate/Message/OuterMessage.cs | 36 +++++ .../Model/Generate/Message/OuterOpcode.cs | 3 + 23 files changed, 338 insertions(+), 23 deletions(-) create mode 100644 Unity/Codes/Hotfix/Demo/Weather/Handler/M2C_NtfWeatherEndHandler.cs create mode 100644 Unity/Codes/Hotfix/Demo/Weather/Handler/M2C_NtfWeatherStartHandler.cs create mode 100644 Unity/Codes/Hotfix/Demo/Weather/WeatherSystem.cs diff --git a/Config/WeatherConfigCategory.bytes b/Config/WeatherConfigCategory.bytes index a92554065467ad1142324cd31bb0c00ed16a4a6f..cd64ce05acbee46bdfaefb271adb14215fb29b94 100644 GIT binary patch delta 87 zcmZ3+ynm9C h85JdzIk6!!3?4rl$n_=SSKz^2Jt5IFv@{x hT}DMQMGh{Yt~ncC&S_Uz!=xc+z-0kcIXR8d2>{G<6~_Po diff --git a/Excel/Json/c/WeatherConfig.txt b/Excel/Json/c/WeatherConfig.txt index a0e8ec4..70bec40 100644 --- a/Excel/Json/c/WeatherConfig.txt +++ b/Excel/Json/c/WeatherConfig.txt @@ -1,13 +1,13 @@ {"list":[ -{"_t":"WeatherConfig","_id":1,"Name":"大风","Disease":200,"Injury":0,"DurableDestroy":2,"LaborVariety":0,"Duration":[5,10],"CD":[2,3],"WeaterEffect":"","SpecialEfficacyCD":[10,15],"ICON":"","Describe":""}, +{"_t":"WeatherConfig","_id":1,"Name":"大风","Disease":200,"Injury":0,"DurableDestroy":2,"LaborVariety":0,"Duration":[10,20],"CD":[2,3],"WeaterEffect":"","SpecialEfficacyCD":[10,15],"ICON":"","Describe":""}, {"_t":"WeatherConfig","_id":2,"Name":"小雨","Disease":250,"Injury":0,"DurableDestroy":1,"LaborVariety":1,"Duration":[20,30],"CD":[2,3],"WeaterEffect":"","SpecialEfficacyCD":[0],"ICON":"","Describe":""}, {"_t":"WeatherConfig","_id":3,"Name":"暴雨","Disease":300,"Injury":0,"DurableDestroy":3,"LaborVariety":2,"Duration":[10,20],"CD":[2,3],"WeaterEffect":"","SpecialEfficacyCD":[0],"ICON":"","Describe":""}, -{"_t":"WeatherConfig","_id":4,"Name":"雷雨","Disease":350,"Injury":0,"DurableDestroy":5,"LaborVariety":3,"Duration":[5,10],"CD":[2,3],"WeaterEffect":"","SpecialEfficacyCD":[0],"ICON":"","Describe":""}, -{"_t":"WeatherConfig","_id":5,"Name":"冰雹","Disease":300,"Injury":200,"DurableDestroy":15,"LaborVariety":3,"Duration":[3,5],"CD":[2,3],"WeaterEffect":"","SpecialEfficacyCD":[0],"ICON":"","Describe":""}, +{"_t":"WeatherConfig","_id":4,"Name":"雷雨","Disease":350,"Injury":0,"DurableDestroy":5,"LaborVariety":3,"Duration":[10,20],"CD":[2,3],"WeaterEffect":"","SpecialEfficacyCD":[0],"ICON":"","Describe":""}, +{"_t":"WeatherConfig","_id":5,"Name":"冰雹","Disease":300,"Injury":200,"DurableDestroy":15,"LaborVariety":3,"Duration":[10,20],"CD":[2,3],"WeaterEffect":"","SpecialEfficacyCD":[0],"ICON":"","Describe":""}, {"_t":"WeatherConfig","_id":6,"Name":"高温","Disease":400,"Injury":0,"DurableDestroy":0,"LaborVariety":3,"Duration":[50,100],"CD":[2,3],"WeaterEffect":"","SpecialEfficacyCD":[10,15],"ICON":"","Describe":""}, {"_t":"WeatherConfig","_id":7,"Name":"雪","Disease":400,"Injury":0,"DurableDestroy":5,"LaborVariety":3,"Duration":[10,20],"CD":[2,3],"WeaterEffect":"","SpecialEfficacyCD":[0],"ICON":"","Describe":""}, -{"_t":"WeatherConfig","_id":8,"Name":"暴雪","Disease":500,"Injury":0,"DurableDestroy":10,"LaborVariety":5,"Duration":[5,10],"CD":[2,3],"WeaterEffect":"","SpecialEfficacyCD":[0],"ICON":"","Describe":""}, -{"_t":"WeatherConfig","_id":9,"Name":"寒流","Disease":400,"Injury":0,"DurableDestroy":0,"LaborVariety":4,"Duration":[5,10],"CD":[2,3],"WeaterEffect":"","SpecialEfficacyCD":[20,40],"ICON":"","Describe":"随机村民颤抖"}, -{"_t":"WeatherConfig","_id":10,"Name":"地震","Disease":0,"Injury":300,"DurableDestroy":30,"LaborVariety":10,"Duration":[3,5],"CD":[30],"WeaterEffect":"","SpecialEfficacyCD":[5,10],"ICON":"","Describe":""}, +{"_t":"WeatherConfig","_id":8,"Name":"暴雪","Disease":500,"Injury":0,"DurableDestroy":10,"LaborVariety":5,"Duration":[10,20],"CD":[2,3],"WeaterEffect":"","SpecialEfficacyCD":[0],"ICON":"","Describe":""}, +{"_t":"WeatherConfig","_id":9,"Name":"寒流","Disease":400,"Injury":0,"DurableDestroy":0,"LaborVariety":4,"Duration":[10,20],"CD":[2,3],"WeaterEffect":"","SpecialEfficacyCD":[20,40],"ICON":"","Describe":"随机村民颤抖"}, +{"_t":"WeatherConfig","_id":10,"Name":"地震","Disease":0,"Injury":300,"DurableDestroy":30,"LaborVariety":10,"Duration":[10,20],"CD":[30,30],"WeaterEffect":"","SpecialEfficacyCD":[5,10],"ICON":"","Describe":""}, {"_t":"WeatherConfig","_id":11,"Name":"流感","Disease":700,"Injury":0,"DurableDestroy":0,"LaborVariety":0,"Duration":[10,20],"CD":[2,3],"WeaterEffect":"","SpecialEfficacyCD":[10,20],"ICON":"","Describe":"随机村民打喷嚏"}, ]} diff --git a/Excel/Json/s/WeatherConfig.txt b/Excel/Json/s/WeatherConfig.txt index a0e8ec4..70bec40 100644 --- a/Excel/Json/s/WeatherConfig.txt +++ b/Excel/Json/s/WeatherConfig.txt @@ -1,13 +1,13 @@ {"list":[ -{"_t":"WeatherConfig","_id":1,"Name":"大风","Disease":200,"Injury":0,"DurableDestroy":2,"LaborVariety":0,"Duration":[5,10],"CD":[2,3],"WeaterEffect":"","SpecialEfficacyCD":[10,15],"ICON":"","Describe":""}, +{"_t":"WeatherConfig","_id":1,"Name":"大风","Disease":200,"Injury":0,"DurableDestroy":2,"LaborVariety":0,"Duration":[10,20],"CD":[2,3],"WeaterEffect":"","SpecialEfficacyCD":[10,15],"ICON":"","Describe":""}, {"_t":"WeatherConfig","_id":2,"Name":"小雨","Disease":250,"Injury":0,"DurableDestroy":1,"LaborVariety":1,"Duration":[20,30],"CD":[2,3],"WeaterEffect":"","SpecialEfficacyCD":[0],"ICON":"","Describe":""}, {"_t":"WeatherConfig","_id":3,"Name":"暴雨","Disease":300,"Injury":0,"DurableDestroy":3,"LaborVariety":2,"Duration":[10,20],"CD":[2,3],"WeaterEffect":"","SpecialEfficacyCD":[0],"ICON":"","Describe":""}, -{"_t":"WeatherConfig","_id":4,"Name":"雷雨","Disease":350,"Injury":0,"DurableDestroy":5,"LaborVariety":3,"Duration":[5,10],"CD":[2,3],"WeaterEffect":"","SpecialEfficacyCD":[0],"ICON":"","Describe":""}, -{"_t":"WeatherConfig","_id":5,"Name":"冰雹","Disease":300,"Injury":200,"DurableDestroy":15,"LaborVariety":3,"Duration":[3,5],"CD":[2,3],"WeaterEffect":"","SpecialEfficacyCD":[0],"ICON":"","Describe":""}, +{"_t":"WeatherConfig","_id":4,"Name":"雷雨","Disease":350,"Injury":0,"DurableDestroy":5,"LaborVariety":3,"Duration":[10,20],"CD":[2,3],"WeaterEffect":"","SpecialEfficacyCD":[0],"ICON":"","Describe":""}, +{"_t":"WeatherConfig","_id":5,"Name":"冰雹","Disease":300,"Injury":200,"DurableDestroy":15,"LaborVariety":3,"Duration":[10,20],"CD":[2,3],"WeaterEffect":"","SpecialEfficacyCD":[0],"ICON":"","Describe":""}, {"_t":"WeatherConfig","_id":6,"Name":"高温","Disease":400,"Injury":0,"DurableDestroy":0,"LaborVariety":3,"Duration":[50,100],"CD":[2,3],"WeaterEffect":"","SpecialEfficacyCD":[10,15],"ICON":"","Describe":""}, {"_t":"WeatherConfig","_id":7,"Name":"雪","Disease":400,"Injury":0,"DurableDestroy":5,"LaborVariety":3,"Duration":[10,20],"CD":[2,3],"WeaterEffect":"","SpecialEfficacyCD":[0],"ICON":"","Describe":""}, -{"_t":"WeatherConfig","_id":8,"Name":"暴雪","Disease":500,"Injury":0,"DurableDestroy":10,"LaborVariety":5,"Duration":[5,10],"CD":[2,3],"WeaterEffect":"","SpecialEfficacyCD":[0],"ICON":"","Describe":""}, -{"_t":"WeatherConfig","_id":9,"Name":"寒流","Disease":400,"Injury":0,"DurableDestroy":0,"LaborVariety":4,"Duration":[5,10],"CD":[2,3],"WeaterEffect":"","SpecialEfficacyCD":[20,40],"ICON":"","Describe":"随机村民颤抖"}, -{"_t":"WeatherConfig","_id":10,"Name":"地震","Disease":0,"Injury":300,"DurableDestroy":30,"LaborVariety":10,"Duration":[3,5],"CD":[30],"WeaterEffect":"","SpecialEfficacyCD":[5,10],"ICON":"","Describe":""}, +{"_t":"WeatherConfig","_id":8,"Name":"暴雪","Disease":500,"Injury":0,"DurableDestroy":10,"LaborVariety":5,"Duration":[10,20],"CD":[2,3],"WeaterEffect":"","SpecialEfficacyCD":[0],"ICON":"","Describe":""}, +{"_t":"WeatherConfig","_id":9,"Name":"寒流","Disease":400,"Injury":0,"DurableDestroy":0,"LaborVariety":4,"Duration":[10,20],"CD":[2,3],"WeaterEffect":"","SpecialEfficacyCD":[20,40],"ICON":"","Describe":"随机村民颤抖"}, +{"_t":"WeatherConfig","_id":10,"Name":"地震","Disease":0,"Injury":300,"DurableDestroy":30,"LaborVariety":10,"Duration":[10,20],"CD":[30,30],"WeaterEffect":"","SpecialEfficacyCD":[5,10],"ICON":"","Describe":""}, {"_t":"WeatherConfig","_id":11,"Name":"流感","Disease":700,"Injury":0,"DurableDestroy":0,"LaborVariety":0,"Duration":[10,20],"CD":[2,3],"WeaterEffect":"","SpecialEfficacyCD":[10,20],"ICON":"","Describe":"随机村民打喷嚏"}, ]} diff --git a/Excel/WeatherConfig.xlsx b/Excel/WeatherConfig.xlsx index 24535df212df2da2cc703a33ebab5c326dfbde6a..764069ebcd1b2511b64c26d31a7be94fda36592d 100644 GIT binary patch delta 2891 zcmV-R3$*mgT;g1?o&g0bQtb>zlcNDEf7+>=q3u9rR}KU#igzLTw-uW-B++gUAzt`0 zdgar2v9~bmx;jx1aud$^znuRh9WP}SJb|%gtuhox1O=dYElM@d&`mK3M<}q4DZ#2* zL55af(KtUmNV%rGHgIKX4aSv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UMzr}0Zd%YR!fb)A4cqNcE#IYU!-P|j(Kz0?8u6Gzlsti3-XE4|XDJle4B>(`E zzAF}!J}Mdkdy`ozlLf1`A_{)jm#1^@tm82|tn000000000103ZMW m0H*|#Aqy3gyDcvQ1`CrR3mTIKE-C@}lQAwU2B9ec0002Ef>8JX diff --git a/Proto/OuterMessage.proto b/Proto/OuterMessage.proto index f93cef3..0b6130b 100644 --- a/Proto/OuterMessage.proto +++ b/Proto/OuterMessage.proto @@ -190,6 +190,7 @@ message UnitProto repeated string EventNames = 22; repeated int64 FighterList = 24; repeated MonsterGroupProto MonsterGroupList = 25; + WeatherProto Weather = 26; } message M2C_CreateUnits // IActorMessage @@ -1441,4 +1442,24 @@ message M2C_CabinHarvest // IActorLocationResponse int32 RpcId = 90; int32 Error = 91; string Message = 92; +} + +message WeatherProto +{ + int64 Id = 1; + int32 ConfigId = 2; + int32 State = 3; //1表示天气生效中 + +} + +message M2C_NtfWeatherStart // IActorMessage +{ + int32 WeatherCfgId = 1; +} + + +message M2C_NtfWeatherEnd // IActorMessage +{ + int32 WeatherCfgId = 1; + } \ No newline at end of file diff --git a/Server/Hotfix/Demo/Cabin/Handler/C2M_CabinSeedHandler.cs b/Server/Hotfix/Demo/Cabin/Handler/C2M_CabinSeedHandler.cs index befa4e6..c30ecc9 100644 --- a/Server/Hotfix/Demo/Cabin/Handler/C2M_CabinSeedHandler.cs +++ b/Server/Hotfix/Demo/Cabin/Handler/C2M_CabinSeedHandler.cs @@ -17,6 +17,10 @@ namespace ET res.Error = ErrorCode.ERR_PeopleNotFound; } + if (GameUtil.IsErrorSuc(res.Error) && farmland.FarmlandState != FarmlandState.FARMLAND_STATE_FREE) + { + res.Error = ErrorCode.ERR_FarmlandNotFree; + } var cabin = unit.GetGrandChild(farmland.CabinId); if (GameUtil.IsErrorSuc(res.Error) && cabin == null) { @@ -35,7 +39,7 @@ namespace ET if (GameUtil.IsErrorSuc(res.Error)) { - res.Error = FarmlandOperate.FarmlandSeed(unit, farmland, request.CropCfgId); + res.Error = CabinOperate.CabinSeed(unit, farmland, request.CropCfgId); } reply(); diff --git a/Server/Hotfix/Demo/Unit/UnitFactory.cs b/Server/Hotfix/Demo/Unit/UnitFactory.cs index c5c9884..a4dfb48 100644 --- a/Server/Hotfix/Demo/Unit/UnitFactory.cs +++ b/Server/Hotfix/Demo/Unit/UnitFactory.cs @@ -67,8 +67,8 @@ namespace ET InitStoreComponent(unit); InitMenuComponent(unit); InitPrescriptionComponent(unit); + InitWeather(unit); } - unit.InitPeopleNumberic(); return unit; @@ -194,6 +194,12 @@ namespace ET }*/ } + public static void InitWeather(Unit unit) + { + Weather weather = unit.AddChild(); + unit.WeatherId = weather.Id; + } + } } \ No newline at end of file diff --git a/Server/Hotfix/Demo/Unit/UnitHelper.cs b/Server/Hotfix/Demo/Unit/UnitHelper.cs index c02674f..2ffab73 100644 --- a/Server/Hotfix/Demo/Unit/UnitHelper.cs +++ b/Server/Hotfix/Demo/Unit/UnitHelper.cs @@ -158,5 +158,17 @@ namespace ET { MessageHelper.SendToClient(unit,new M2C_NotifyUpdateValley(){Ks = Ks,Vs = Vs}); } + + public static void NotifyWeatherStart(Unit unit, int cfgId) + { + MessageHelper.SendToClient(unit,new M2C_NtfWeatherStart(){WeatherCfgId = cfgId}); + } + + public static void NotifyWeatherEnd(Unit unit, int cfgId) + { + MessageHelper.SendToClient(unit,new M2C_NtfWeatherEnd(){WeatherCfgId = cfgId}); + } + + } } \ No newline at end of file diff --git a/Server/Hotfix/Server.Hotfix.csproj b/Server/Hotfix/Server.Hotfix.csproj index a870a99..370d748 100644 --- a/Server/Hotfix/Server.Hotfix.csproj +++ b/Server/Hotfix/Server.Hotfix.csproj @@ -160,6 +160,9 @@ Demo\Unit\UnitSystem.cs + + Demo\Weather\WeatherSystem.cs + Demo\WorldParam.cs diff --git a/Server/Model/Base/MongoRegister.cs b/Server/Model/Base/MongoRegister.cs index 15e38d7..7da3745 100644 --- a/Server/Model/Base/MongoRegister.cs +++ b/Server/Model/Base/MongoRegister.cs @@ -22,7 +22,7 @@ namespace ET BsonSerializer.RegisterSerializer(typeof(Quaternion), new StructBsonSerialize()); BsonSerializer.RegisterSerializer(typeof(ResourceAttri), new StructBsonSerialize()); BsonSerializer.RegisterSerializer(typeof(ExtraOut), new StructBsonSerialize()); - BsonSerializer.RegisterSerializer(typeof(WatherInfo), new StructBsonSerialize()); + BsonSerializer.RegisterSerializer(typeof(WeatherInfo), new StructBsonSerialize()); #elif ROBOT BsonSerializer.RegisterSerializer(typeof(Quaternion), new StructBsonSerialize()); BsonSerializer.RegisterSerializer(typeof(Vector3), new StructBsonSerialize()); diff --git a/Server/Model/Generate/Message/OuterMessage.cs b/Server/Model/Generate/Message/OuterMessage.cs index b9f2d4f..1614fc7 100644 --- a/Server/Model/Generate/Message/OuterMessage.cs +++ b/Server/Model/Generate/Message/OuterMessage.cs @@ -446,6 +446,9 @@ namespace ET [ProtoMember(25)] public List MonsterGroupList = new List(); + [ProtoMember(26)] + public WeatherProto Weather { get; set; } + } [Message(OuterOpcode.M2C_CreateUnits)] @@ -2999,4 +3002,37 @@ namespace ET } + [Message(OuterOpcode.WeatherProto)] + [ProtoContract] + public partial class WeatherProto: Object + { + [ProtoMember(1)] + public long Id { get; set; } + + [ProtoMember(2)] + public int ConfigId { get; set; } + + [ProtoMember(3)] + public int State { get; set; } + + } + + [Message(OuterOpcode.M2C_NtfWeatherStart)] + [ProtoContract] + public partial class M2C_NtfWeatherStart: Object, IActorMessage + { + [ProtoMember(1)] + public int WeatherCfgId { get; set; } + + } + + [Message(OuterOpcode.M2C_NtfWeatherEnd)] + [ProtoContract] + public partial class M2C_NtfWeatherEnd: Object, IActorMessage + { + [ProtoMember(1)] + public int WeatherCfgId { get; set; } + + } + } diff --git a/Server/Model/Generate/Message/OuterOpcode.cs b/Server/Model/Generate/Message/OuterOpcode.cs index 115d4f6..67abb88 100644 --- a/Server/Model/Generate/Message/OuterOpcode.cs +++ b/Server/Model/Generate/Message/OuterOpcode.cs @@ -179,5 +179,8 @@ namespace ET public const ushort M2C_CabinUpdateFarmlands = 10176; public const ushort C2M_CabinHarvest = 10177; public const ushort M2C_CabinHarvest = 10178; + public const ushort WeatherProto = 10179; + public const ushort M2C_NtfWeatherStart = 10180; + public const ushort M2C_NtfWeatherEnd = 10181; } } diff --git a/Unity/Assets/Bundles/Config/WeatherConfigCategory.bytes b/Unity/Assets/Bundles/Config/WeatherConfigCategory.bytes index a92554065467ad1142324cd31bb0c00ed16a4a6f..cd64ce05acbee46bdfaefb271adb14215fb29b94 100644 GIT binary patch delta 87 zcmZ3+ynm9C h85JdzIk6!!3?4rl$n_=SSKz^2Jt5IFv@{x hT}DMQMGh{Yt~ncC&S_Uz!=xc+z-0kcIXR8d2>{G<6~_Po diff --git a/Unity/Codes/Hotfix/Demo/Unit/UnitFactory.cs b/Unity/Codes/Hotfix/Demo/Unit/UnitFactory.cs index 5a4a105..a5178c3 100644 --- a/Unity/Codes/Hotfix/Demo/Unit/UnitFactory.cs +++ b/Unity/Codes/Hotfix/Demo/Unit/UnitFactory.cs @@ -21,7 +21,6 @@ namespace ET unit.Day = unitProto.Day; unit.EventSeed = unitProto.EventSeed; unit.EventNames = unitProto.EventNames; - unit.SeasonConfig = SeasonConfigCategory.Instance.Get(unit.Season); for (int i = 0; i < unitProto.FighterList.Count / 2; i++) { diff --git a/Unity/Codes/Hotfix/Demo/Unit/UnitSystem.cs b/Unity/Codes/Hotfix/Demo/Unit/UnitSystem.cs index 4d0aff8..96f803c 100644 --- a/Unity/Codes/Hotfix/Demo/Unit/UnitSystem.cs +++ b/Unity/Codes/Hotfix/Demo/Unit/UnitSystem.cs @@ -45,8 +45,11 @@ namespace ET } #endif + [FriendClass(typeof(People))] [FriendClass(typeof (Unit))] [FriendClass(typeof (Farmland))] + [FriendClass(typeof (Building))] + public static class UnitSystem { public static void AddTime(this Unit self, int tick) @@ -82,6 +85,16 @@ namespace ET synthesisComponent.Update(self, now); } + var dt = now - self.UpdateTimeSec; + dt = dt / 1000; + if (dt > 0) + { + self.GetChild(self.WeatherId).Update(self,(int)dt); + self.UpdateTimeSec += dt * 1000; + + } + + #endif } @@ -108,8 +121,13 @@ namespace ET UnitOperate.NightEvent(self, nightTime, time); //每天长大一岁 self.AddAge(); + //触发天气 + self.GetChild(self.WeatherId).Produce(self); + } self.GameTime = time; + self.GetChild(self.WeatherId).CheckStart(self,self.GameTime); + } } @@ -149,6 +167,7 @@ namespace ET self.SeasonConfig = SeasonConfigCategory.Instance.Get(self.Season); self.InitPeopleNumberic(); self.InitGrandChildren(); + self.UpdateTimeSec = self.UpdateTime; } public static void updateSeason(this Unit self) @@ -308,5 +327,19 @@ namespace ET { self.GrandChildren.Remove(id); } + + public static void OnWeatherEnd(this Unit self, int configId) + { + var config = WeatherConfigCategory.Instance.Get(configId); + foreach (var v in self.GetComponent().Children.Values) + { + ((People) v).Disease += config.Disease; + ((People) v).Injury += config.Injury; + } + foreach (var v in self.GetComponent().Children.Values) + { + ((Building) v).Durable -= config.DurableDestroy; + } + } } } \ No newline at end of file diff --git a/Unity/Codes/Hotfix/Demo/Weather/Handler/M2C_NtfWeatherEndHandler.cs b/Unity/Codes/Hotfix/Demo/Weather/Handler/M2C_NtfWeatherEndHandler.cs new file mode 100644 index 0000000..47d64f7 --- /dev/null +++ b/Unity/Codes/Hotfix/Demo/Weather/Handler/M2C_NtfWeatherEndHandler.cs @@ -0,0 +1,13 @@ +namespace ET +{ + + + public class M2C_NtfWeatherEndHandler: AMHandler + { + protected override void Run(Session session, M2C_NtfWeatherEnd message) + { + + + } + } +} \ No newline at end of file diff --git a/Unity/Codes/Hotfix/Demo/Weather/Handler/M2C_NtfWeatherStartHandler.cs b/Unity/Codes/Hotfix/Demo/Weather/Handler/M2C_NtfWeatherStartHandler.cs new file mode 100644 index 0000000..5d6674a --- /dev/null +++ b/Unity/Codes/Hotfix/Demo/Weather/Handler/M2C_NtfWeatherStartHandler.cs @@ -0,0 +1,10 @@ +namespace ET.Handler +{ + public class M2C_NtfWeatherStartHandler: AMHandler + { + protected override void Run(Session session, M2C_NtfWeatherStart message) + { + UnitComponent.unit.OnWeatherEnd(message.WeatherCfgId); + } + } +} \ No newline at end of file diff --git a/Unity/Codes/Hotfix/Demo/Weather/WeatherSystem.cs b/Unity/Codes/Hotfix/Demo/Weather/WeatherSystem.cs new file mode 100644 index 0000000..1f6663c --- /dev/null +++ b/Unity/Codes/Hotfix/Demo/Weather/WeatherSystem.cs @@ -0,0 +1,125 @@ +using System.Collections.Generic; + +namespace ET +{ + [FriendClass(typeof(Weather))] + [FriendClass(typeof(Unit))] + public static class WeatherSystem + { + public static void FromMessage(this Weather self, WeatherProto weatherProto) + { + self.Id = weatherProto.Id; + self.ConfigId = weatherProto.ConfigId; + self.State = weatherProto.State; + } + + public static WeatherProto ToMessage(this Weather self) + { + WeatherProto weatherProto = new WeatherProto(); + weatherProto.Id = self.Id; + weatherProto.State = self.State; + return weatherProto; + } + + public static void Produce(this Weather self,Unit unit) + { + + if (self.Times >= 3 || self.ConfigId>0) + { + return; + } + + var seasonConfig = unit.GetSeasonConfig(); + var randomTimes = 0; + //随机季节 + while (self.ConfigId==0 && randomTimes>=seasonConfig.WeatherGroup.Length) + { + var index = RandomHelper.RandomByWeight(seasonConfig.Weights); + var weatherId = seasonConfig.WeatherGroup[index]; + randomTimes++; + WeatherInfo weatherInfo; + if (self.WeatherHistory.TryGetValue(weatherId,out weatherInfo)) + { + if (weatherInfo.Cd >= unit.Day - weatherInfo.StartDay) + { + self.ConfigId = weatherId; + } + } + else + { + self.ConfigId = weatherId; + } + } + + if (self.ConfigId == 0) + { + foreach (var v in seasonConfig.WeatherGroup) + { + WeatherInfo weatherInfo; + if (self.WeatherHistory.TryGetValue(v,out weatherInfo)) + { + if (weatherInfo.Cd >= unit.Day - weatherInfo.StartDay) + { + self.ConfigId = v; + break; + } + } + else + { + self.ConfigId = v; + break; + } + } + } + + if (self.ConfigId > 0) + { + self.Duration = RandomHelper.RandomNumber(self.Config.Duration[0], self.Config.Duration[1]+1); + var cd = RandomHelper.RandomNumber(self.Config.CD[0], self.Config.CD[1]+1); + self.StartTime = RandomHelper.RandomNumber(10, 16) * 100 + RandomHelper.RandomNumber(0, 60); + self.WeatherHistory[self.ConfigId] = new WeatherInfo() { ConfigId = self.ConfigId, Cd = cd, StartDay = unit.Day }; + + } + + + } + + public static void CheckStart(this Weather self,Unit unit,int gameTime) + { + if (self.ConfigId == 0) + { + return; + } + + if (self.StartTime < gameTime && self.State == 0) + { + self.State = 1; +#if SERVER + UnitHelper.NotifyWeatherStart(unit, self.ConfigId); + +#endif + } + + } + + public static void Update(this Weather self, Unit unit, int tick) + { + if (self.State == 0) + { + return; + } + + self.Duration -= tick; + if (self.Duration <= 0) + { + self.State = 0; + +#if SERVER + UnitHelper.NotifyWeatherEnd(unit, self.ConfigId); +#endif + self.ConfigId = 0; + } + + } + } +} \ No newline at end of file diff --git a/Unity/Codes/Model/Demo/People/People.cs b/Unity/Codes/Model/Demo/People/People.cs index 09a5e83..493bf20 100644 --- a/Unity/Codes/Model/Demo/People/People.cs +++ b/Unity/Codes/Model/Demo/People/People.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; +using MongoDB.Bson; using MongoDB.Bson.Serialization.Attributes; using MongoDB.Bson.Serialization.Options; diff --git a/Unity/Codes/Model/Demo/Unit/Unit.cs b/Unity/Codes/Model/Demo/Unit/Unit.cs index da921e0..fccf912 100644 --- a/Unity/Codes/Model/Demo/Unit/Unit.cs +++ b/Unity/Codes/Model/Demo/Unit/Unit.cs @@ -6,7 +6,7 @@ using UnityEngine; namespace ET { - [ChildType(typeof(Battle))] + [ChildType] #if SERVER public sealed class Unit: Entity, IAwake, IAddComponent, IGetComponent,IUpdate #else @@ -52,13 +52,14 @@ namespace ET public int EventSeed; public List EventNames; public int Hunger; //饥饿值 + public long WeatherId; [BsonDictionaryOptions(DictionaryRepresentation.ArrayOfArrays)] public Dictionary FighterDic=new Dictionary(); [BsonIgnore] - public long UpdateTime; + public long UpdateTime; //山谷时间 [BsonIgnore] public long UpdateValleyTime; @@ -72,6 +73,11 @@ namespace ET [BsonIgnore] public Dictionary GrandChildren = new Dictionary(); + [BsonIgnore] + public long UpdateTimeSec; + + + } diff --git a/Unity/Codes/Model/Demo/Weather/Weather.cs b/Unity/Codes/Model/Demo/Weather/Weather.cs index ee8c968..edcc30c 100644 --- a/Unity/Codes/Model/Demo/Weather/Weather.cs +++ b/Unity/Codes/Model/Demo/Weather/Weather.cs @@ -1,25 +1,29 @@ using System.Collections.Generic; +using MongoDB.Bson.Serialization.Attributes; namespace ET { - public struct WatherInfo + public struct WeatherInfo { public int ConfigId; public int Cd; - public int StartTime; //game day + public int StartDay; //game day } public class Weather:Entity,IAwake,ISerializeToEntity { public int ConfigId; public int Times; //当前季节触发次数 - public int Cd; public List SpringList; //春天列表 public List SummerList; public List AutumnList; public List WinterList; - public int StartTime;//开始时间,游戏时间 - public int RealStartTime; //实际时间 + public int StartTime;//开始时间(游戏时间) public int Duration; //持续 + public int State; //1表示天气影响中 + public Dictionary WeatherHistory = new Dictionary(); + + [BsonIgnore] + public WeatherConfig Config => WeatherConfigCategory.Instance.Get(this.ConfigId); diff --git a/Unity/Codes/Model/Generate/Message/OuterMessage.cs b/Unity/Codes/Model/Generate/Message/OuterMessage.cs index b9f2d4f..1614fc7 100644 --- a/Unity/Codes/Model/Generate/Message/OuterMessage.cs +++ b/Unity/Codes/Model/Generate/Message/OuterMessage.cs @@ -446,6 +446,9 @@ namespace ET [ProtoMember(25)] public List MonsterGroupList = new List(); + [ProtoMember(26)] + public WeatherProto Weather { get; set; } + } [Message(OuterOpcode.M2C_CreateUnits)] @@ -2999,4 +3002,37 @@ namespace ET } + [Message(OuterOpcode.WeatherProto)] + [ProtoContract] + public partial class WeatherProto: Object + { + [ProtoMember(1)] + public long Id { get; set; } + + [ProtoMember(2)] + public int ConfigId { get; set; } + + [ProtoMember(3)] + public int State { get; set; } + + } + + [Message(OuterOpcode.M2C_NtfWeatherStart)] + [ProtoContract] + public partial class M2C_NtfWeatherStart: Object, IActorMessage + { + [ProtoMember(1)] + public int WeatherCfgId { get; set; } + + } + + [Message(OuterOpcode.M2C_NtfWeatherEnd)] + [ProtoContract] + public partial class M2C_NtfWeatherEnd: Object, IActorMessage + { + [ProtoMember(1)] + public int WeatherCfgId { get; set; } + + } + } diff --git a/Unity/Codes/Model/Generate/Message/OuterOpcode.cs b/Unity/Codes/Model/Generate/Message/OuterOpcode.cs index 115d4f6..67abb88 100644 --- a/Unity/Codes/Model/Generate/Message/OuterOpcode.cs +++ b/Unity/Codes/Model/Generate/Message/OuterOpcode.cs @@ -179,5 +179,8 @@ namespace ET public const ushort M2C_CabinUpdateFarmlands = 10176; public const ushort C2M_CabinHarvest = 10177; public const ushort M2C_CabinHarvest = 10178; + public const ushort WeatherProto = 10179; + public const ushort M2C_NtfWeatherStart = 10180; + public const ushort M2C_NtfWeatherEnd = 10181; } }