From 1d560b8bad0ed4020702eee9ef22d2f3c8ee7ef7 Mon Sep 17 00:00:00 2001 From: "star\\zhenghan" Date: Fri, 12 Aug 2022 10:09:09 +0800 Subject: [PATCH] =?UTF-8?q?=E7=A7=8D=E6=A4=8D=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Excel/Json/s/StartSceneConfig.txt | 4 +- Excel/StartSceneConfig@s.xlsx | Bin 10783 -> 10805 bytes Proto/OuterMessage.proto | 39 ++++++- Server/Hotfix/Demo/C2G_EnterMapHandler.cs | 1 + Server/Hotfix/Server.Hotfix.csproj | 3 + Server/Model/Generate/Message/OuterMessage.cs | 85 ++++++++++++++- Server/Model/Generate/Message/OuterOpcode.cs | 5 + Server/Model/Server.Model.csproj | 4 + Unity/Animancer.FSM.csproj | 9 ++ Unity/Animancer.csproj | 9 ++ .../Demo/Building/BuildingComponentSystem.cs | 5 +- .../Hotfix/Demo/Building/BuildingSystem.cs | 25 ++++- .../Construct/ConstructComponentSystem.cs | 12 ++- .../Hotfix/Demo/Farmland/FarmlandSystem.cs | 99 ++++++++++++++++++ .../Hotfix/Demo/Helper/ConstructHelper.cs | 2 +- .../Hotfix/Demo/Helper/FarmlandHelper.cs | 55 ++++++++++ .../Hotfix/Demo/Item/StoreComponentSystem.cs | 66 ++++++------ .../Hotfix/Demo/Operate/ConstructOperate.cs | 15 +-- .../Hotfix/Demo/Operate/FarmlandOperate.cs | 50 +++++++++ Unity/Codes/Hotfix/Demo/Unit/UnitSystem.cs | 21 +++- Unity/Codes/Model/Demo/Building/Building.cs | 3 +- Unity/Codes/Model/Demo/ConstValue.cs | 11 ++ Unity/Codes/Model/Demo/Farmland/Farmland.cs | 20 ++++ Unity/Codes/Model/Demo/Unit/Unit.cs | 5 + .../Model/Generate/Message/OuterMessage.cs | 85 ++++++++++++++- .../Model/Generate/Message/OuterOpcode.cs | 5 + Unity/Codes/Model/Module/Message/ErrorCode.cs | 6 ++ 27 files changed, 593 insertions(+), 51 deletions(-) create mode 100644 Unity/Codes/Hotfix/Demo/Farmland/FarmlandSystem.cs create mode 100644 Unity/Codes/Hotfix/Demo/Helper/FarmlandHelper.cs create mode 100644 Unity/Codes/Hotfix/Demo/Operate/FarmlandOperate.cs create mode 100644 Unity/Codes/Model/Demo/Farmland/Farmland.cs diff --git a/Excel/Json/s/StartSceneConfig.txt b/Excel/Json/s/StartSceneConfig.txt index 7b3de1e..92083b6 100644 --- a/Excel/Json/s/StartSceneConfig.txt +++ b/Excel/Json/s/StartSceneConfig.txt @@ -3,8 +3,8 @@ {"_t":"StartSceneConfig","_id":2,"Process":1,"Zone":1,"SceneType":"Gate","Name":"Gate1","OuterPort":10003}, {"_t":"StartSceneConfig","_id":3,"Process":1,"Zone":1,"SceneType":"Gate","Name":"Gate2","OuterPort":10004}, {"_t":"StartSceneConfig","_id":4,"Process":1,"Zone":1,"SceneType":"Location","Name":"Location","OuterPort":0}, -{"_t":"StartSceneConfig","_id":5,"Process":3,"Zone":1,"SceneType":"Map","Name":"Game_1","OuterPort":0}, -{"_t":"StartSceneConfig","_id":6,"Process":1,"Zone":1,"SceneType":"Map","Name":"Game_2","OuterPort":0}, +{"_t":"StartSceneConfig","_id":5,"Process":1,"Zone":1,"SceneType":"Map","Name":"Game_1","OuterPort":0}, +{"_t":"StartSceneConfig","_id":6,"Process":3,"Zone":1,"SceneType":"Map","Name":"Game_2","OuterPort":0}, {"_t":"StartSceneConfig","_id":7,"Process":1,"Zone":1,"SceneType":"Account","Name":"Account","OuterPort":10005}, {"_t":"StartSceneConfig","_id":8,"Process":1,"Zone":1,"SceneType":"LoginCenter","Name":"LoginCenter","OuterPort":0}, {"_t":"StartSceneConfig","_id":9,"Process":1,"Zone":1,"SceneType":"UnitCache","Name":"UnitCache","OuterPort":0}, diff --git a/Excel/StartSceneConfig@s.xlsx b/Excel/StartSceneConfig@s.xlsx index 27b6c88531e0ef6f247dccae55eea12922f62510..02f2ac2f63c43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o+_`-^v640MQWu02lxO000000096X00024lfEf&2D~Kz00005 Cn~$9U diff --git a/Proto/OuterMessage.proto b/Proto/OuterMessage.proto index d5ebe96..a1b169d 100644 --- a/Proto/OuterMessage.proto +++ b/Proto/OuterMessage.proto @@ -65,7 +65,8 @@ message BuildingProto float X = 3; float Y = 4; int32 Durable = 5; - int32 State = 6; //1.建造中 2.完成 3.维修中 + FarmlandProto Farmland = 6; + } message PeopleProto @@ -1195,5 +1196,41 @@ message M2C_GMAddItem // IActorLocationResponse string Message = 92; } +message FarmlandProto +{ + int64 id = 1; + int32 SeedCfgId = 2; + int32 plantCfgId = 3; + int32 duration = 4; + int32 exProduct = 5; + int32 farmlandState = 6; +} + +//ResponseType M2C_FarmlandPlant +message C2M_FarmlandPlant // IActorLocationRequest +{ + int32 RpcId = 90; + int64 FarmlandId = 1; + int32 CropCfgId = 2; +} + +message M2C_FarmlandPlant // IActorLocationResponse +{ + int32 RpcId = 90; + int32 Error = 91; + string Message = 92; +} +//ResponseType M2C_FarmlandHarvest +message C2M_FarmlandHarvest // IActorLocationRequest +{ + int32 RpcId = 90; + int64 FarmlandId = 1; +} +message M2C_FarmlandHarvest // IActorLocationResponse +{ + int32 RpcId = 90; + int32 Error = 91; + string Message = 92; +} \ No newline at end of file diff --git a/Server/Hotfix/Demo/C2G_EnterMapHandler.cs b/Server/Hotfix/Demo/C2G_EnterMapHandler.cs index 1284d48..83bfc06 100644 --- a/Server/Hotfix/Demo/C2G_EnterMapHandler.cs +++ b/Server/Hotfix/Demo/C2G_EnterMapHandler.cs @@ -5,6 +5,7 @@ namespace ET { [FriendClass(typeof(GateMapComponent))] [MessageHandler] + //此函数已经放弃了 public class C2G_EnterMapHandler : AMRpcHandler { protected override async ETTask Run(Session session, C2G_EnterMap request, G2C_EnterMap response, Action reply) diff --git a/Server/Hotfix/Server.Hotfix.csproj b/Server/Hotfix/Server.Hotfix.csproj index a2ad759..39e2171 100644 --- a/Server/Hotfix/Server.Hotfix.csproj +++ b/Server/Hotfix/Server.Hotfix.csproj @@ -40,6 +40,9 @@ Demo\Construct\ConstructSystem.cs + + Demo\Farmland\FarmlandSystem.cs + Demo\Fighter\FighterComponentSystem.cs diff --git a/Server/Model/Generate/Message/OuterMessage.cs b/Server/Model/Generate/Message/OuterMessage.cs index ec6e88e..4d918db 100644 --- a/Server/Model/Generate/Message/OuterMessage.cs +++ b/Server/Model/Generate/Message/OuterMessage.cs @@ -141,7 +141,7 @@ namespace ET public int Durable { get; set; } [ProtoMember(6)] - public int State { get; set; } + public FarmlandProto Farmland { get; set; } } @@ -2490,4 +2490,87 @@ namespace ET } + [Message(OuterOpcode.FarmlandProto)] + [ProtoContract] + public partial class FarmlandProto: Object + { + [ProtoMember(1)] + public long id { get; set; } + + [ProtoMember(2)] + public int SeedCfgId { get; set; } + + [ProtoMember(3)] + public int plantCfgId { get; set; } + + [ProtoMember(4)] + public int duration { get; set; } + + [ProtoMember(5)] + public int exProduct { get; set; } + + [ProtoMember(6)] + public int farmlandState { get; set; } + + } + + [ResponseType(nameof(M2C_FarmlandPlant))] + [Message(OuterOpcode.C2M_FarmlandPlant)] + [ProtoContract] + public partial class C2M_FarmlandPlant: Object, IActorLocationRequest + { + [ProtoMember(90)] + public int RpcId { get; set; } + + [ProtoMember(1)] + public long FarmlandId { get; set; } + + [ProtoMember(2)] + public int CropCfgId { get; set; } + + } + + [Message(OuterOpcode.M2C_FarmlandPlant)] + [ProtoContract] + public partial class M2C_FarmlandPlant: Object, IActorLocationResponse + { + [ProtoMember(90)] + public int RpcId { get; set; } + + [ProtoMember(91)] + public int Error { get; set; } + + [ProtoMember(92)] + public string Message { get; set; } + + } + + [ResponseType(nameof(M2C_FarmlandHarvest))] + [Message(OuterOpcode.C2M_FarmlandHarvest)] + [ProtoContract] + public partial class C2M_FarmlandHarvest: Object, IActorLocationRequest + { + [ProtoMember(90)] + public int RpcId { get; set; } + + [ProtoMember(1)] + public long FarmlandId { get; set; } + + } + + [Message(OuterOpcode.M2C_FarmlandHarvest)] + [ProtoContract] + public partial class M2C_FarmlandHarvest: Object, IActorLocationResponse + { + [ProtoMember(90)] + public int RpcId { get; set; } + + [ProtoMember(91)] + public int Error { get; set; } + + [ProtoMember(92)] + public string Message { get; set; } + + } + } diff --git a/Server/Model/Generate/Message/OuterOpcode.cs b/Server/Model/Generate/Message/OuterOpcode.cs index acd513c..2639765 100644 --- a/Server/Model/Generate/Message/OuterOpcode.cs +++ b/Server/Model/Generate/Message/OuterOpcode.cs @@ -147,5 +147,10 @@ namespace ET public const ushort M2C_BuildingDurable = 10144; public const ushort C2M_GMAddItem = 10145; public const ushort M2C_GMAddItem = 10146; + public const ushort FarmlandProto = 10147; + public const ushort C2M_FarmlandPlant = 10148; + public const ushort M2C_FarmlandPlant = 10149; + public const ushort C2M_FarmlandHarvest = 10150; + public const ushort M2C_FarmlandHarvest = 10151; } } diff --git a/Server/Model/Server.Model.csproj b/Server/Model/Server.Model.csproj index 182f0e6..f384074 100644 --- a/Server/Model/Server.Model.csproj +++ b/Server/Model/Server.Model.csproj @@ -70,6 +70,10 @@ Demo\ConstValue.cs + + Demo\Farmland\Farmland.cs + + Demo\Fighter\Fighter.cs diff --git a/Unity/Animancer.FSM.csproj b/Unity/Animancer.FSM.csproj index 4432b1b..8c724c1 100644 --- a/Unity/Animancer.FSM.csproj +++ b/Unity/Animancer.FSM.csproj @@ -310,6 +310,9 @@ C:\Program Files\Unity\Hub\Editor\2021.3.7f1c1\Editor\Data\Managed\UnityEditor.Graphs.dll + + C:\Program Files\Unity\Hub\Editor\2021.3.7f1c1\Editor\Data\PlaybackEngines\AndroidPlayer\UnityEditor.Android.Extensions.dll + C:\Program Files\Unity\Hub\Editor\2021.3.7f1c1\Editor\Data\PlaybackEngines\WindowsStandaloneSupport\UnityEditor.WindowsStandalone.Extensions.dll @@ -346,6 +349,12 @@ Assets\ThirdParty\NCalc\NCalc.dll + + C:\Program Files\Unity\Hub\Editor\2021.3.7f1c1\Editor\Data\PlaybackEngines\AndroidPlayer\Unity.Android.Types.dll + + + C:\Program Files\Unity\Hub\Editor\2021.3.7f1c1\Editor\Data\PlaybackEngines\AndroidPlayer\Unity.Android.Gradle.dll + C:\Program Files\Unity\Hub\Editor\2021.3.7f1c1\Editor\Data\UnityReferenceAssemblies\unity-4.8-api\mscorlib.dll diff --git a/Unity/Animancer.csproj b/Unity/Animancer.csproj index 7017be2..779372b 100644 --- a/Unity/Animancer.csproj +++ b/Unity/Animancer.csproj @@ -447,6 +447,9 @@ C:\Program Files\Unity\Hub\Editor\2021.3.7f1c1\Editor\Data\Managed\UnityEditor.Graphs.dll + + C:\Program Files\Unity\Hub\Editor\2021.3.7f1c1\Editor\Data\PlaybackEngines\AndroidPlayer\UnityEditor.Android.Extensions.dll + C:\Program Files\Unity\Hub\Editor\2021.3.7f1c1\Editor\Data\PlaybackEngines\WindowsStandaloneSupport\UnityEditor.WindowsStandalone.Extensions.dll @@ -483,6 +486,12 @@ Assets\ThirdParty\NCalc\NCalc.dll + + C:\Program Files\Unity\Hub\Editor\2021.3.7f1c1\Editor\Data\PlaybackEngines\AndroidPlayer\Unity.Android.Types.dll + + + C:\Program Files\Unity\Hub\Editor\2021.3.7f1c1\Editor\Data\PlaybackEngines\AndroidPlayer\Unity.Android.Gradle.dll + C:\Program Files\Unity\Hub\Editor\2021.3.7f1c1\Editor\Data\UnityReferenceAssemblies\unity-4.8-api\mscorlib.dll diff --git a/Unity/Codes/Hotfix/Demo/Building/BuildingComponentSystem.cs b/Unity/Codes/Hotfix/Demo/Building/BuildingComponentSystem.cs index 31aa2a1..5fb37d5 100644 --- a/Unity/Codes/Hotfix/Demo/Building/BuildingComponentSystem.cs +++ b/Unity/Codes/Hotfix/Demo/Building/BuildingComponentSystem.cs @@ -21,7 +21,6 @@ namespace ET building.ConfigId = ConfigId; building.Position = new Vector2(X, Y); building.Durable = building.Config.Durable; - building.State = (int) BuildingState.Built; return building; } @@ -31,7 +30,7 @@ namespace ET foreach (var v in self.Children) { Building building = (Building) v.Value; - if (Array.IndexOf(StructureID, building.ConfigId) != -1 && building.State == (int) BuildingState.Built) + if (Array.IndexOf(StructureID, building.ConfigId) != -1 ) { hasBuilding = true; break; @@ -47,7 +46,7 @@ namespace ET foreach (var v in self.Children) { Building building = (Building) v.Value; - if (special == building.Config.Special && building.State == (int) BuildingState.Built) + if (special == building.Config.Special) { hasBuilding = true; break; diff --git a/Unity/Codes/Hotfix/Demo/Building/BuildingSystem.cs b/Unity/Codes/Hotfix/Demo/Building/BuildingSystem.cs index 9839549..1eab3ae 100644 --- a/Unity/Codes/Hotfix/Demo/Building/BuildingSystem.cs +++ b/Unity/Codes/Hotfix/Demo/Building/BuildingSystem.cs @@ -10,12 +10,33 @@ namespace ET self.Id = buildingProto.Id; self.Position = new Vector2(buildingProto.X, buildingProto.Y); self.ConfigId = buildingProto.ConfigId; - self.State = buildingProto.State; + self.Durable = buildingProto.Durable; + if (buildingProto.Farmland != null) + { + var farmland = self.AddChildWithId(buildingProto.Farmland.id); + farmland.FromMessage(buildingProto.Farmland); + } } public static BuildingProto ToMessage(this Building self) { - return new BuildingProto() { Id = self.Id, ConfigId = self.ConfigId, X = self.Position.x, Y = self.Position.y,State = self.State}; + var proto= new BuildingProto() { Id = self.Id, + ConfigId = self.ConfigId, + X = self.Position.x, + Y = self.Position.y, + Durable = self.Durable}; + if (self.Config.Special == (int) StructureSpecialEnum.FARMLAND) + { + foreach (var v in self.Children.Values) + { + if (v.GetType() == typeof (Farmland)) + { + proto.Farmland = ((Farmland) v).ToMessage(); + } + } + } + + return proto; } public static void DurableReduce(this Building self) diff --git a/Unity/Codes/Hotfix/Demo/Construct/ConstructComponentSystem.cs b/Unity/Codes/Hotfix/Demo/Construct/ConstructComponentSystem.cs index 73316d5..2608b5e 100644 --- a/Unity/Codes/Hotfix/Demo/Construct/ConstructComponentSystem.cs +++ b/Unity/Codes/Hotfix/Demo/Construct/ConstructComponentSystem.cs @@ -3,9 +3,10 @@ namespace ET { [FriendClass(typeof(Construct))] + [FriendClass(typeof(Building))] public static class ConstructComponentSystem { - public static Construct CreateConstruct( this ConstructComponent self,int configId, float x, float y,long id=0,long buildingId =0) + public static Construct CreateConstruct( this ConstructComponent self,Unit unit,int configId, float x, float y,long id=0,long buildingId =0) { Construct construct ; if (id == 0) @@ -21,6 +22,15 @@ namespace ET construct.X = x; construct.Y = y; construct.BuildingId = buildingId; + if (buildingId > 0) + { + var building = unit.GetComponent().GetChild(buildingId); + if (building != null) + { + building.IsUpgrade = 1; + } + } + return construct; } diff --git a/Unity/Codes/Hotfix/Demo/Farmland/FarmlandSystem.cs b/Unity/Codes/Hotfix/Demo/Farmland/FarmlandSystem.cs new file mode 100644 index 0000000..d3bc434 --- /dev/null +++ b/Unity/Codes/Hotfix/Demo/Farmland/FarmlandSystem.cs @@ -0,0 +1,99 @@ +namespace ET +{ + public class FarmlandDestroySystem : DestroySystem + { + public override void Destroy(Farmland self) + { + self.Parent.Parent.GetParent().RemoveFarmland(self); + } + } + + public class FarmlandAwakeSystem : AwakeSystem + { + public override void Awake(Farmland self) + { + self.Parent.Parent.GetParent().AddFarmland(self); + } + } + + public class FarmlandUpdateSystem: UpdateSystem + { + public override void Update(Farmland self) + { + + } + } + [FriendClass(typeof(Farmland))] + public static class FarmlandSystem + { + public static void FromMessage(this Farmland self, FarmlandProto farmlandProto) + { + self.Id = farmlandProto.id; + self.SeedCfgId = farmlandProto.SeedCfgId; + self.Duration = farmlandProto.duration; + self.ExProduct = farmlandProto.exProduct; + self.PlanSeedCfgId = farmlandProto.plantCfgId; + self.FarmlandState = farmlandProto.farmlandState; + } + + public static FarmlandProto ToMessage(this Farmland self) + { + FarmlandProto proto = new FarmlandProto(); + proto.id = self.Id; + proto.SeedCfgId = self.SeedCfgId; + proto.duration = self.Duration; + proto.exProduct = self.ExProduct; + proto.plantCfgId = self.PlanSeedCfgId; + proto.farmlandState = self.FarmlandState; + return proto; + } + + public static int Plant(this Farmland self, int cropId,int seedId) + { + if (self.FarmlandState != FarmlandState.FARMLAND_STATE_FREE) + { + return ErrorCode.ERR_FarmlandNotFree; + } + + self.ConfigId = cropId; + self.Duration = 0; + self.SeedCfgId = seedId; + self.PlanSeedCfgId = seedId; + self.FarmlandState = FarmlandState.FARMLAND_STATE_GROW; + self.ExProduct = 0; + return ErrorCode.ERR_Success; + + } + + public static void Update(this Farmland self) + { + if (self.FarmlandState != FarmlandState.FARMLAND_STATE_GROW) + { + return; + } + self.Duration += 1; + if (self.Duration >= self.Config.GrowthCycle) + { + self.FarmlandState = FarmlandState.FARMLAND_STATE_RIPE; + } + } + + public static int Harvest(this Farmland self) + { + if (self.FarmlandState != FarmlandState.FARMLAND_STATE_RIPE) + { + return ErrorCode.ERR_PlantNotRipe; + } + self.Duration = 0; + self.SeedCfgId = 0; + self.PlanSeedCfgId = 0; + self.ExProduct = 0; + self.FarmlandState = FarmlandState.FARMLAND_STATE_FREE; + return ErrorCode.ERR_Success; + + } + + } + + +} \ No newline at end of file diff --git a/Unity/Codes/Hotfix/Demo/Helper/ConstructHelper.cs b/Unity/Codes/Hotfix/Demo/Helper/ConstructHelper.cs index 7909294..2557a7c 100644 --- a/Unity/Codes/Hotfix/Demo/Helper/ConstructHelper.cs +++ b/Unity/Codes/Hotfix/Demo/Helper/ConstructHelper.cs @@ -13,7 +13,7 @@ namespace ET M2C_CreateConstruct resp = await unit.ZoneScene().GetComponent().Session.Call(msg) as M2C_CreateConstruct; if (resp.Error == ErrorCode.ERR_Success) { - var construct = unit.GetOrAddComponent().CreateConstruct(configId, x, y, resp.Id); + var construct = unit.GetOrAddComponent().CreateConstruct(unit,configId, x, y, resp.Id); Game.EventSystem.Publish(new EventType.AfterCreateConstruct(){Unit = unit, Construct = construct, IsNew = true}); } else diff --git a/Unity/Codes/Hotfix/Demo/Helper/FarmlandHelper.cs b/Unity/Codes/Hotfix/Demo/Helper/FarmlandHelper.cs new file mode 100644 index 0000000..ec77f41 --- /dev/null +++ b/Unity/Codes/Hotfix/Demo/Helper/FarmlandHelper.cs @@ -0,0 +1,55 @@ +using System; + +namespace ET +{ + public static class PlantHelper + { + public static async ETTask FarmlandPlant(Unit unit, long farmlandId, int cropId) + { + try + { + C2M_FarmlandPlant msg = new C2M_FarmlandPlant() { FarmlandId = farmlandId, CropCfgId = cropId }; + M2C_FarmlandPlant resp = await unit.ZoneScene().GetComponent().Session.Call(msg) as M2C_FarmlandPlant; + if (resp.Error == ErrorCode.ERR_Success) + { + FarmlandOperate.Plant(unit, farmlandId, cropId); + } + else + { + Log.Error(resp.Error.ToString()); + } + + return resp.Error; + } + catch (Exception e) + { + Log.Error(e.ToString()); + throw; + } + } + + public static async ETTask FarmlandHarvest(Unit unit, long farmlandId) + { + try + { + C2M_FarmlandHarvest msg = new C2M_FarmlandHarvest() { FarmlandId = farmlandId }; + M2C_FarmlandPlant resp = await unit.ZoneScene().GetComponent().Session.Call(msg) as M2C_FarmlandPlant; + if (resp.Error == ErrorCode.ERR_Success) + { + FarmlandOperate.Harvest(unit, farmlandId); + } + else + { + Log.Error(resp.Error.ToString()); + } + + return resp.Error; + } + catch (Exception e) + { + Log.Error(e.ToString()); + throw; + } + } + } +} \ No newline at end of file diff --git a/Unity/Codes/Hotfix/Demo/Item/StoreComponentSystem.cs b/Unity/Codes/Hotfix/Demo/Item/StoreComponentSystem.cs index 9c23c4c..71a3360 100644 --- a/Unity/Codes/Hotfix/Demo/Item/StoreComponentSystem.cs +++ b/Unity/Codes/Hotfix/Demo/Item/StoreComponentSystem.cs @@ -3,19 +3,17 @@ using System.Linq; namespace ET { - public class StoreComponentSystemDestroySystem : DestroySystem + public class StoreComponentSystemDestroySystem: DestroySystem { public override void Destroy(StoreComponent self) { - } } - - [FriendClass(typeof(Item))] - public static class StoreComponentSystem + + [FriendClass(typeof (Item))] + public static class StoreComponentSystem { - - public static void Add(this StoreComponent self,int configId,long amount,long id=0,bool bUpdateTime=false) + public static void Add(this StoreComponent self, int configId, long amount, long id = 0, bool bUpdateTime = false) { var config = AllItemConfigCategory.Instance.Get(configId); if (config.SuperpositionMax > 1) @@ -25,7 +23,7 @@ namespace ET var tempItem = (Item) v; if (tempItem.ConfigId == configId) { - tempItem.Amount+= amount; + tempItem.Amount += amount; return; } } @@ -39,20 +37,18 @@ namespace ET { item = self.AddChildWithId(id); } - + item.Amount = amount; item.ConfigId = configId; if (bUpdateTime) { item.CreateTime = TimeHelper.ServerUnix(); } - } else { for (int i = 0; i < amount; i++) { - Item item; if (id == 0) { @@ -62,6 +58,7 @@ namespace ET { item = self.AddChildWithId(id); } + item.Amount = 1; item.ConfigId = configId; if (bUpdateTime) @@ -69,9 +66,7 @@ namespace ET item.CreateTime = TimeHelper.ServerUnix(); } } - } - } public static long GetItemNum(this StoreComponent self, int configId) @@ -93,7 +88,7 @@ namespace ET long num = 0; foreach (var v in self.Children.Values) { - if (((Item)v).Config == config) + if (((Item) v).Config == config) { num++; } @@ -111,12 +106,13 @@ namespace ET { return false; } + var config = AllItemConfigCategory.Instance.Get(configId); if (config.SuperpositionMax > 1) { foreach (var v in self.Children.Values) { - var item = (Item)v; + var item = (Item) v; if (item.ConfigId == configId) { item.Amount -= amount; @@ -124,6 +120,7 @@ namespace ET { item.Dispose(); } + return true; } } @@ -133,7 +130,7 @@ namespace ET List removeList = new List(); foreach (var v in self.Children) { - var item = (Item)v.Value; + var item = (Item) v.Value; if (item.ConfigId == configId) { removeList.Add(item); @@ -147,13 +144,10 @@ namespace ET foreach (var v in removeList) { self.RemoveChildWithId(v.Id); - } - } return true; - } /// @@ -165,14 +159,14 @@ namespace ET /// public static List GetItemsWithType(this StoreComponent self, int mainType, int subType = -1) { - if (mainType == 0) return null; + if (mainType == 0) return null; var result = new List(); foreach (var v in self.Children.Values) { - var item = (Item)v; + var item = (Item) v; var config = AllItemConfigCategory.Instance.Get(item.ConfigId); - if(config.RelatedTable != mainType) continue; - if(subType == -1) + if (config.RelatedTable != mainType) continue; + if (subType == -1) { result.Add(item); } @@ -181,19 +175,20 @@ namespace ET switch (mainType) { case 1: + { + MaterialConfig materialConfig = MaterialConfigCategory.Instance.Get(config.RelatedId); + if (materialConfig == null) continue; + var types = materialConfig.Type.ToList(); + if (types.Contains(subType)) { - MaterialConfig materialConfig = MaterialConfigCategory.Instance.Get(config.RelatedId); - if (materialConfig == null) continue; - var types = materialConfig.Type.ToList(); - if (types.Contains(subType)) - { - result.Add(item); - } + result.Add(item); } + } break; } } } + return result; } @@ -209,6 +204,15 @@ namespace ET return true; } - + + public static bool IsEnoughItem(this StoreComponent self, int configId, int amount) + { + if (self.GetItemNum(configId) < amount) + { + return false; + } + + return true; + } } } \ No newline at end of file diff --git a/Unity/Codes/Hotfix/Demo/Operate/ConstructOperate.cs b/Unity/Codes/Hotfix/Demo/Operate/ConstructOperate.cs index f5aa5d3..73ef218 100644 --- a/Unity/Codes/Hotfix/Demo/Operate/ConstructOperate.cs +++ b/Unity/Codes/Hotfix/Demo/Operate/ConstructOperate.cs @@ -5,6 +5,7 @@ namespace ET { [FriendClass(typeof (Construct))] [FriendClass(typeof (Building))] + [FriendClass(typeof (Farmland))] public static class ConstructOperate { public static Construct CreateConstruct(Unit unit, int configId, float x, float y, long id = 0, long buildingId = 0) @@ -13,7 +14,7 @@ namespace ET // { // return null; // } - var construct = unit.GetOrAddComponent().CreateConstruct(configId, x, y, id, buildingId); + var construct = unit.GetOrAddComponent().CreateConstruct(unit,configId, x, y, id, buildingId); return construct; } @@ -150,17 +151,19 @@ namespace ET if (construct.IsUpgrade) { build = unit.GetOrAddComponent().GetChild(construct.BuildingId); - if (build == null) - { - Log.Error($"Can't find building:{construct.BuildingId} for construct:{construct.Id}"); - } + build.IsUpgrade = 0; } else { build = unit.GetOrAddComponent().AddChild(); build.Position.x = construct.X; build.Position.y = construct.Y; - build.State = (int) BuildingState.Built; + //如果是农场 + if (build.Config.Special == (int)StructureSpecialEnum.FARMLAND) + { + var farmland = build.AddChild(); + farmland.FarmlandState = FarmlandState.FARMLAND_STATE_FREE; + } } build.ConfigId = construct.Config.MixtureID; diff --git a/Unity/Codes/Hotfix/Demo/Operate/FarmlandOperate.cs b/Unity/Codes/Hotfix/Demo/Operate/FarmlandOperate.cs new file mode 100644 index 0000000..4726720 --- /dev/null +++ b/Unity/Codes/Hotfix/Demo/Operate/FarmlandOperate.cs @@ -0,0 +1,50 @@ +namespace ET +{ + [FriendClass(typeof(Unit))] + [FriendClass(typeof(Farmland))] + public static class FarmlandOperate + { + public static int Plant(Unit unit,long farmlandId, int cropId) + { + if (!unit.FarmlandDic.ContainsKey(farmlandId)) + { + return ErrorCode.ERR_FarmlandNotFound; + } + + var farmland = unit.FarmlandDic[farmlandId]; + if (farmland.FarmlandState != FarmlandState.FARMLAND_STATE_FREE) + { + return ErrorCode.ERR_FarmlandNotFree; + } + //检查种子数量 + var cropConfig = CropConfigCategory.Instance.Get(cropId); + if (cropConfig == null) + { + return ErrorCode.ERR_CropConfigNotFound; + } + + if (!unit.GetComponent().Remove(cropConfig.SeedNeed, cropConfig.SeedNum)) + { + return ErrorCode.ERR_SeedNotEnough; + } + + farmland.Plant(cropId,cropConfig.SeedNeed); + + return ErrorCode.ERR_Success; + } + + public static int Harvest(Unit unit, long farmlandId) + { + var farmland = unit.FarmlandDic[farmlandId]; + var storeNc = unit.GetComponent(); + storeNc.Add(farmland.Config.ProductID, farmland.Config.BasicProduction); + if (farmland.Config.ByProduct > 0) + { + storeNc.Add(farmland.Config.ByProduct,farmland.Config.ByProductNum); + } + storeNc.Add(farmland.SeedCfgId,farmland.Config.SeedProduce); + farmland.Harvest(); + return ErrorCode.ERR_Success; + } + } +} \ No newline at end of file diff --git a/Unity/Codes/Hotfix/Demo/Unit/UnitSystem.cs b/Unity/Codes/Hotfix/Demo/Unit/UnitSystem.cs index c88f5e4..cb7b5b6 100644 --- a/Unity/Codes/Hotfix/Demo/Unit/UnitSystem.cs +++ b/Unity/Codes/Hotfix/Demo/Unit/UnitSystem.cs @@ -21,6 +21,7 @@ namespace ET var now = TimeHelper.ServerNow(); var nowSec = now / 1000; var dt = now - self.UpdateTime; + //更新桃谷时间 var timeRate = WorldParametersConfigCategory.Instance.Get(WorldParam.TimeShift).Value[0]; if (dt > timeRate) { @@ -211,11 +212,29 @@ namespace ET return true; } - //每分钟的更新 + //耐久度的更新 public static void DurableReduce(this Unit self) { self.GetComponent()?.DurableReduce(); } + + public static void AddFarmland(this Unit self,Farmland farmland) + { + self.FarmlandDic[farmland.Id] = farmland; + } + + public static void RemoveFarmland(this Unit self, Farmland farmland) + { + self.FarmlandDic.Remove(farmland.Id); + } + + public static void UpdateGameTime(this Unit self) + { + foreach (var v in self.FarmlandDic.Values) + { + ((Farmland)v).Update(); + } + } } } \ No newline at end of file diff --git a/Unity/Codes/Model/Demo/Building/Building.cs b/Unity/Codes/Model/Demo/Building/Building.cs index 2278007..7ff618f 100644 --- a/Unity/Codes/Model/Demo/Building/Building.cs +++ b/Unity/Codes/Model/Demo/Building/Building.cs @@ -11,12 +11,13 @@ namespace ET Upgrade = 3, } + [ChildType(typeof(Farmland))] public class Building: Entity, IAwake, ISerializeToEntity { public int ConfigId; public Vector2 Position; public int Durable; - public int State; //1.正在建造,2.建造完成,3.维修 + public int IsUpgrade; [BsonIgnore] public StructureConfig Config => StructureConfigCategory.Instance.Get(this.ConfigId); diff --git a/Unity/Codes/Model/Demo/ConstValue.cs b/Unity/Codes/Model/Demo/ConstValue.cs index d405235..49e7f03 100644 --- a/Unity/Codes/Model/Demo/ConstValue.cs +++ b/Unity/Codes/Model/Demo/ConstValue.cs @@ -1,3 +1,5 @@ +using System; + namespace ET { public static class ConstValue @@ -116,4 +118,13 @@ namespace ET public const int CONSTRUCT_TYPE_NEW = 1; //创建新的建筑 public const int CONSTRUCT_TYPE_UPGRADE = 2; //升级建筑 } + + public static class FarmlandState + { + public const int FARMLAND_STATE_FREE = 1;//空闲 + public const int FARMLAND_STATE_PLANT = 2; //种植 + public const int FARMLAND_STATE_GROW = 3; //生长 + public const int FARMLAND_STATE_RIPE = 4; //成熟 + public const int FARMLAND_STATE_HARVEST = 5;//收割 + } } \ No newline at end of file diff --git a/Unity/Codes/Model/Demo/Farmland/Farmland.cs b/Unity/Codes/Model/Demo/Farmland/Farmland.cs new file mode 100644 index 0000000..5266eb5 --- /dev/null +++ b/Unity/Codes/Model/Demo/Farmland/Farmland.cs @@ -0,0 +1,20 @@ +using System; +using MongoDB.Bson.Serialization.Attributes; + +namespace ET +{ + public class Farmland: Entity, IAwake,IUpdate, IDestroy,ISerializeToEntity + { + public int SeedCfgId; //农作物configid + public int Duration; //种植时间 + public int ExProduct; //额外产量 + public int FarmlandState; //农田状态 + public int PlanSeedCfgId; //计划种植的东西 + public int ConfigId; + + [BsonIgnore] + public CropConfig Config =>CropConfigCategory.Instance.Get(this.ConfigId); + + + } +} \ No newline at end of file diff --git a/Unity/Codes/Model/Demo/Unit/Unit.cs b/Unity/Codes/Model/Demo/Unit/Unit.cs index 3c55ab5..8adf0e4 100644 --- a/Unity/Codes/Model/Demo/Unit/Unit.cs +++ b/Unity/Codes/Model/Demo/Unit/Unit.cs @@ -67,5 +67,10 @@ namespace ET [BsonIgnore] public long BattleId; + [BsonIgnore] + public Dictionary FarmlandDic = new Dictionary(); + + + } } \ No newline at end of file diff --git a/Unity/Codes/Model/Generate/Message/OuterMessage.cs b/Unity/Codes/Model/Generate/Message/OuterMessage.cs index ec6e88e..4d918db 100644 --- a/Unity/Codes/Model/Generate/Message/OuterMessage.cs +++ b/Unity/Codes/Model/Generate/Message/OuterMessage.cs @@ -141,7 +141,7 @@ namespace ET public int Durable { get; set; } [ProtoMember(6)] - public int State { get; set; } + public FarmlandProto Farmland { get; set; } } @@ -2490,4 +2490,87 @@ namespace ET } + [Message(OuterOpcode.FarmlandProto)] + [ProtoContract] + public partial class FarmlandProto: Object + { + [ProtoMember(1)] + public long id { get; set; } + + [ProtoMember(2)] + public int SeedCfgId { get; set; } + + [ProtoMember(3)] + public int plantCfgId { get; set; } + + [ProtoMember(4)] + public int duration { get; set; } + + [ProtoMember(5)] + public int exProduct { get; set; } + + [ProtoMember(6)] + public int farmlandState { get; set; } + + } + + [ResponseType(nameof(M2C_FarmlandPlant))] + [Message(OuterOpcode.C2M_FarmlandPlant)] + [ProtoContract] + public partial class C2M_FarmlandPlant: Object, IActorLocationRequest + { + [ProtoMember(90)] + public int RpcId { get; set; } + + [ProtoMember(1)] + public long FarmlandId { get; set; } + + [ProtoMember(2)] + public int CropCfgId { get; set; } + + } + + [Message(OuterOpcode.M2C_FarmlandPlant)] + [ProtoContract] + public partial class M2C_FarmlandPlant: Object, IActorLocationResponse + { + [ProtoMember(90)] + public int RpcId { get; set; } + + [ProtoMember(91)] + public int Error { get; set; } + + [ProtoMember(92)] + public string Message { get; set; } + + } + + [ResponseType(nameof(M2C_FarmlandHarvest))] + [Message(OuterOpcode.C2M_FarmlandHarvest)] + [ProtoContract] + public partial class C2M_FarmlandHarvest: Object, IActorLocationRequest + { + [ProtoMember(90)] + public int RpcId { get; set; } + + [ProtoMember(1)] + public long FarmlandId { get; set; } + + } + + [Message(OuterOpcode.M2C_FarmlandHarvest)] + [ProtoContract] + public partial class M2C_FarmlandHarvest: Object, IActorLocationResponse + { + [ProtoMember(90)] + public int RpcId { get; set; } + + [ProtoMember(91)] + public int Error { get; set; } + + [ProtoMember(92)] + public string Message { get; set; } + + } + } diff --git a/Unity/Codes/Model/Generate/Message/OuterOpcode.cs b/Unity/Codes/Model/Generate/Message/OuterOpcode.cs index acd513c..2639765 100644 --- a/Unity/Codes/Model/Generate/Message/OuterOpcode.cs +++ b/Unity/Codes/Model/Generate/Message/OuterOpcode.cs @@ -147,5 +147,10 @@ namespace ET public const ushort M2C_BuildingDurable = 10144; public const ushort C2M_GMAddItem = 10145; public const ushort M2C_GMAddItem = 10146; + public const ushort FarmlandProto = 10147; + public const ushort C2M_FarmlandPlant = 10148; + public const ushort M2C_FarmlandPlant = 10149; + public const ushort C2M_FarmlandHarvest = 10150; + public const ushort M2C_FarmlandHarvest = 10151; } } diff --git a/Unity/Codes/Model/Module/Message/ErrorCode.cs b/Unity/Codes/Model/Module/Message/ErrorCode.cs index afe5c0d..58866e1 100644 --- a/Unity/Codes/Model/Module/Message/ErrorCode.cs +++ b/Unity/Codes/Model/Module/Message/ErrorCode.cs @@ -88,5 +88,11 @@ namespace ET public const int ERR_FighterSilence = 210205;//玩家被沉默了 public const int ERR_FighterConstraint = 210206; //玩家被禁锢了 public const int ERR_SkillNotFound = 210207; //没有该技能 + //210201-210322 种植相关 + public const int ERR_FarmlandNotFree = 210201; //农场不是空闲 + public const int ERR_PlantNotRipe = 210202; //农作物没有成熟 + public const int ERR_FarmlandNotFound = 210203;// 农场没有找到 + public const int ERR_CropConfigNotFound = 210204;// 农场没有找到 + public const int ERR_SeedNotEnough = 210205;// 农场没有找到 } } \ No newline at end of file