Browse Source

提交单个农田系统

master
star\zhenghan 3 years ago
parent
commit
f7d0449fc1
  1. 2
      Config/StartSceneConfigCategory.bytes
  2. 2
      Excel/Json/s/StartSceneConfig.txt
  3. BIN
      Excel/StartSceneConfig@s.xlsx
  4. 77
      FGUIProject/FUI_ET/assets/Building/Farmland/FarmlandWindow.xml
  5. 8
      FGUIProject/FUI_ET/assets/Building/Farmland/IconButton.xml
  6. 28
      FGUIProject/FUI_ET/assets/Building/Farmland/PlantSeedItem.xml
  7. 13
      FGUIProject/FUI_ET/assets/Building/Farmland/SeedInfoPopup.xml
  8. 4
      FGUIProject/FUI_ET/assets/Building/package.xml
  9. 2
      Server/Hotfix/Demo/Farmland/Handler/C2M_FarmlandRipeHandler.cs
  10. 2
      Server/Model/Server.Model.csproj
  11. 13
      Unity/Animancer.FSM.csproj
  12. 13
      Unity/Animancer.csproj
  13. BIN
      Unity/Assets/Bundles/FUI/Building_fui.bytes
  14. 20
      Unity/Codes/Hotfix/Demo/Farmland/FarmlandSystem.cs
  15. 2
      Unity/Codes/Hotfix/Demo/Farmland/Handler/M2C_NtfFarmlandRipeHandler.cs
  16. 4
      Unity/Codes/Hotfix/Demo/Helper/FarmlandHelper.cs
  17. 2
      Unity/Codes/Hotfix/Demo/Operate/ConstructOperate.cs
  18. 2
      Unity/Codes/Hotfix/Demo/Operate/FarmlandOperate.cs
  19. 2
      Unity/Codes/Hotfix/Demo/People/PeopleSystem.cs
  20. 17
      Unity/Codes/HotfixView/Demo/Building/BuildingViewComponentSystem.cs
  21. 21
      Unity/Codes/HotfixView/Demo/Building/PeopleMoveEnd_StartFarm.cs
  22. 21
      Unity/Codes/HotfixView/Demo/Building/PeopleMoveEnd_StartHarvest.cs
  23. 150
      Unity/Codes/HotfixView/Demo/FUI/AutoGeneratedCode/Building/FUI_FarmlandWindow.cs
  24. 67
      Unity/Codes/HotfixView/Demo/FUI/AutoGeneratedCode/Building/FUI_IconButton.cs
  25. 81
      Unity/Codes/HotfixView/Demo/FUI/AutoGeneratedCode/Building/FUI_PlantSeedItem.cs
  26. 79
      Unity/Codes/HotfixView/Demo/FUI/AutoGeneratedCode/Building/FUI_SeedInfoPopup.cs
  27. 25
      Unity/Codes/HotfixView/Demo/FUI/AutoGeneratedCode/Building/Friend/FUIFarmlandWindowComponentSystemFriend.cs
  28. 2
      Unity/Codes/HotfixView/Demo/FUI/Logic/Building/ConstructUpdate_RefreshWindow.cs
  29. 2
      Unity/Codes/HotfixView/Demo/FUI/Logic/Building/FUIBuildingSelectWorkerWindowComponentSystem.cs
  30. 342
      Unity/Codes/HotfixView/Demo/FUI/Logic/Building/FUIFarmlandWindowComponentSystem.cs
  31. 21
      Unity/Codes/HotfixView/Demo/FUI/Logic/Building/FarmlandStateChanged_RefreshWindow.cs
  32. 2
      Unity/Codes/HotfixView/Demo/FUI/Logic/Resource/FUISelectWorkerWindowComponentSystem.cs
  33. 4
      Unity/Codes/HotfixView/Demo/People/AfterCreatePeople_AddComponent.cs
  34. 18
      Unity/Codes/HotfixView/Demo/People/Behave/Behave_Construct.cs
  35. 18
      Unity/Codes/HotfixView/Demo/People/Behave/Behave_Gather.cs
  36. 34
      Unity/Codes/HotfixView/Demo/People/Behave/Behave_Harvest.cs
  37. 18
      Unity/Codes/HotfixView/Demo/People/Behave/Behave_Idle.cs
  38. 34
      Unity/Codes/HotfixView/Demo/People/Behave/Behave_Plant.cs
  39. 42
      Unity/Codes/HotfixView/Demo/People/Behave/Behave_Prepare_Construct.cs
  40. 42
      Unity/Codes/HotfixView/Demo/People/Behave/Behave_Prepare_Gather.cs
  41. 41
      Unity/Codes/HotfixView/Demo/People/Behave/Behave_Prepare_Harvest.cs
  42. 42
      Unity/Codes/HotfixView/Demo/People/Behave/Behave_Prepare_Plant.cs
  43. 55
      Unity/Codes/HotfixView/Demo/People/Behave/PeopleBehaveComponent.cs
  44. 3
      Unity/Codes/HotfixView/Demo/People/BehaveTypeChanged_UpdateAnimator.cs
  45. 82
      Unity/Codes/HotfixView/Demo/People/PeopleViewHelper.cs
  46. 12
      Unity/Codes/HotfixView/Demo/ResourceView/ResourceViewComponentSystem.cs
  47. 2
      Unity/Codes/HotfixView/Demo/Scene/SceneChangeStart_AddComponent.cs
  48. 18
      Unity/Codes/Model/Core/Object/Entity.cs
  49. 0
      Unity/Codes/Model/Demo/Common/CommonEventType.cs
  50. 11
      Unity/Codes/Model/Demo/Common/GameUtil.cs
  51. 8
      Unity/Codes/Model/Demo/ConstValue.cs
  52. 5
      Unity/Codes/Model/Demo/EventType.cs
  53. 67
      Unity/Codes/Model/Demo/Helper/TextHelper.cs
  54. 10
      Unity/Codes/Model/Module/Message/ErrorCode.cs
  55. 85
      Unity/Codes/ModelView/Demo/FUI/AutoGeneratedCode/Building/FUI_FarmlandWindow.cs
  56. 48
      Unity/Codes/ModelView/Demo/FUI/AutoGeneratedCode/Building/FUI_IconButton.cs
  57. 55
      Unity/Codes/ModelView/Demo/FUI/AutoGeneratedCode/Building/FUI_PlantSeedItem.cs
  58. 54
      Unity/Codes/ModelView/Demo/FUI/AutoGeneratedCode/Building/FUI_SeedInfoPopup.cs
  59. 4
      Unity/Codes/ModelView/Demo/FUI/AutoGeneratedCode/Building/PackageBuilding.cs
  60. 39
      Unity/Codes/ModelView/Demo/FUI/AutoGeneratedCode/Building/PlantSeedItem.cs
  61. 26
      Unity/Codes/ModelView/Demo/FUI/Logic/Building/FUIFarmlandWindowComponent.cs
  62. 37
      Unity/Codes/ModelView/Demo/FUI/Logic/Building/PlantSeedItem.cs
  63. 18
      Unity/Codes/ModelView/Demo/People/Behave/BehaveAttribute.cs
  64. 7
      Unity/Codes/ModelView/Demo/People/Behave/BehaveBase.cs
  65. 11
      Unity/Codes/ModelView/Demo/People/Behave/PeopleBehaveComponent.cs

2
Config/StartSceneConfigCategory.bytes

@ -4,7 +4,7 @@
"Gate*Gate20”N
"Location*Location
"Map*Game_1
"Map*Game_2
"Map*Game_2
"Account*Account0•N
" LoginCenter* LoginCenter
 " UnitCache* UnitCache

2
Excel/Json/s/StartSceneConfig.txt

@ -4,7 +4,7 @@
{"_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":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":6,"Process":1,"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},

BIN
Excel/StartSceneConfig@s.xlsx

Binary file not shown.

77
FGUIProject/FUI_ET/assets/Building/Farmland/FarmlandWindow.xml

@ -0,0 +1,77 @@
<?xml version="1.0" encoding="utf-8"?>
<component size="1280,720" pivot="0.5,0.5">
<controller name="farmlandState" pages="0,空闲,1,已经播种,3,生长,4,成熟" selected="3"/>
<controller name="hasPeople" pages="0,,1," selected="0"/>
<displayList>
<graph id="n1_nrka" name="n1" xy="140,570" size="1000,150" group="n4_nrka" type="rect"/>
<list id="n0_nrka" name="PlantSeedList" xy="164,591" size="800,110" group="n4_nrka" layout="row" overflow="scroll" scroll="horizontal" margin="5,5,0,0" lineGap="5" colGap="5" defaultItem="ui://2126z1eanrkav" autoClearItems="true">
<item/>
<item/>
<item/>
<item/>
<item/>
</list>
<component id="n2_nrka" name="ConfirmSeedButton" src="nd6r3" fileName="GreenButton.xml" xy="993,618" size="134,53" group="n4_nrka">
<Button title="确定"/>
</component>
<graph id="n3_nrka" name="n3" xy="979,596" size="2,100" group="n4_nrka" type="rect" fillColor="#ff000000"/>
<component id="n7_nrka" name="SeedInfoPopup" src="nrkaw" fileName="Farmland/SeedInfoPopup.xml" xy="143,403" group="n4_nrka"/>
<group id="n4_nrka" name="SeedPanel" xy="140,403" size="1000,317" advanced="true">
<gearDisplay controller="farmlandState" pages="0"/>
</group>
<graph id="n8_sp3r" name="n8" xy="240,570" size="800,150" group="n9_sp3r" type="rect"/>
<graph id="n10_sp3r" name="n10" xy="872,599" size="2,100" group="n9_sp3r" type="rect" fillColor="#ff000000"/>
<loader id="n11_sp3r" name="WaitForPlant_CropIcon" xy="538,606" size="90,90" group="n9_sp3r" align="center" vAlign="middle" fill="scale"/>
<text id="n12_sp3r" name="n12" xy="645,609" size="52,24" group="n9_sp3r" fontSize="16" text="状态:"/>
<text id="n13_sp3r" name="WaitForPlantText" xy="697,609" size="52,24" group="n9_sp3r" fontSize="16" ubb="true" text="待播种"/>
<text id="n14_sp3r" name="n14" xy="645,671" size="52,24" group="n9_sp3r" fontSize="16" text="产量:"/>
<text id="n15_sp3r" name="n15" xy="698,671" size="21,24" group="n9_sp3r" fontSize="16" text="---"/>
<component id="n36_ifd4" name="WFP_FarmerIconButton" src="ifd4x" fileName="Farmland/IconButton.xml" xy="906,595" group="n9_sp3r">
<gearDisplay controller="hasPeople" pages="1"/>
</component>
<component id="n16_sp3r" name="AddPlantPeopleButton" src="nd6r3" fileName="GreenButton.xml" xy="906,596" size="100,100" group="n9_sp3r">
<gearDisplay controller="hasPeople" pages="0"/>
<Button title="+"/>
</component>
<group id="n9_sp3r" name="WaitForPlantPanel" xy="240,570" size="800,150" advanced="true">
<gearDisplay controller="farmlandState" pages="1"/>
</group>
<graph id="n18_hm6k" name="n18" xy="240,570" size="800,150" group="n26_hm6k" type="rect"/>
<graph id="n19_hm6k" name="n19" xy="872,599" size="2,100" group="n26_hm6k" type="rect" fillColor="#ff000000"/>
<loader id="n20_hm6k" name="Grow_CropIcon" xy="538,606" size="90,90" group="n26_hm6k" align="center" vAlign="middle" fill="scale"/>
<text id="n21_hm6k" name="n21" xy="645,609" size="52,24" group="n26_hm6k" fontSize="16" text="状态:"/>
<text id="n22_hm6k" name="GrowText" xy="697,609" size="52,24" group="n26_hm6k" fontSize="16" ubb="true" text="待播种"/>
<text id="n23_hm6k" name="n23" xy="645,671" size="52,24" group="n26_hm6k" fontSize="16" text="产量:"/>
<text id="n24_hm6k" name="Grow_ProductionNum" xy="698,671" size="21,24" group="n26_hm6k" fontSize="16" ubb="true" text="---"/>
<component id="n25_hm6k" name="GrowSpeedUpButton" src="nd6r3" fileName="GreenButton.xml" xy="906,622" size="100,50" group="n26_hm6k">
<Button title="加速"/>
</component>
<group id="n26_hm6k" name="GrowPanel" xy="240,570" size="800,150" advanced="true">
<gearDisplay controller="farmlandState" pages="3"/>
</group>
<graph id="n27_ifd4" name="n27" xy="240,570" size="800,150" group="n35_ifd4" type="rect"/>
<graph id="n28_ifd4" name="n28" xy="872,599" size="2,100" group="n35_ifd4" type="rect" fillColor="#ff000000"/>
<loader id="n29_ifd4" name="Harvest_CropIcon" xy="538,606" size="90,90" group="n35_ifd4" align="center" vAlign="middle" fill="scale"/>
<text id="n30_ifd4" name="n30" xy="645,609" size="52,24" group="n35_ifd4" fontSize="16" text="状态:"/>
<text id="n31_ifd4" name="HarvestText" xy="697,609" size="52,24" group="n35_ifd4" fontSize="16" ubb="true" text="已成熟"/>
<text id="n32_ifd4" name="n32" xy="645,671" size="52,24" group="n35_ifd4" fontSize="16" text="产量:"/>
<text id="n33_ifd4" name="Harvest_ProductionNum" xy="698,671" size="21,24" group="n35_ifd4" fontSize="16" ubb="true" text="---"/>
<component id="n34_ifd4" name="HarvestButton" src="nd6r3" fileName="GreenButton.xml" xy="906,596" size="100,100" group="n35_ifd4">
<gearDisplay controller="hasPeople" pages="0"/>
<Button title="+"/>
</component>
<component id="n37_ifd4" name="Harvest_FarmerIconButton" src="ifd4x" fileName="Farmland/IconButton.xml" xy="906,596" group="n35_ifd4">
<gearDisplay controller="hasPeople" pages="1"/>
</component>
<group id="n35_ifd4" name="HarvestPanel" xy="240,570" size="800,150" advanced="true">
<gearDisplay controller="farmlandState" pages="4"/>
</group>
<component id="n17_sp3r" name="RemoveButton" src="nd6r3" fileName="GreenButton.xml" xy="20,670" size="114,49">
<Button title="拆除"/>
</component>
<component id="n5_nrka" name="CloseButton" src="nd6r3" fileName="GreenButton.xml" xy="1011,545" size="53,49">
<gearXY controller="farmlandState" pages="1,3,4" values="1011,547|1011,545|1011,545" default="1111,545"/>
<Button title="X"/>
</component>
</displayList>
</component>

8
FGUIProject/FUI_ET/assets/Building/Farmland/IconButton.xml

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<component size="100,100" extention="Button">
<displayList>
<loader id="n0_ifd4" name="Icon" xy="0,0" size="100,100" align="center" vAlign="middle" fill="scale"/>
<text id="n1_ifd4" name="Name" xy="32,76" size="36,24" fontSize="16" align="center" vAlign="middle" text="人名"/>
</displayList>
<Button/>
</component>

28
FGUIProject/FUI_ET/assets/Building/Farmland/PlantSeedItem.xml

@ -0,0 +1,28 @@
<?xml version="1.0" encoding="utf-8"?>
<component size="100,100" extention="Button">
<controller name="button" pages="0,up,1,down,2,over,3,selectedOver" selected="0"/>
<controller name="state" pages="0,,1,,2," selected="1"/>
<displayList>
<graph id="n0_nrka" name="n0" xy="0,0" size="100,100" touchable="false" type="rect" lineSize="0" fillColor="#fff0f0f0">
<gearDisplay controller="button" pages="0"/>
<relation target="" sidePair="width-width,height-height"/>
</graph>
<graph id="n1_nrka" name="n1" xy="0,0" size="100,100" touchable="false" type="rect" lineSize="0" fillColor="#fffafafa">
<gearDisplay controller="button" pages="2"/>
<relation target="" sidePair="width-width,height-height"/>
</graph>
<graph id="n2_nrka" name="n2" xy="0,0" size="100,100" touchable="false" type="rect" lineSize="0" fillColor="#ffcccccc">
<gearDisplay controller="button" pages="1,3"/>
<relation target="" sidePair="width-width,height-height"/>
</graph>
<loader id="n4_nrka" name="Icon" xy="5,5" size="90,90" align="center" vAlign="middle" fill="scale"/>
<text id="n3_nrka" name="Name" xy="24,75" size="52,24" fontSize="16" align="center" vAlign="middle" text="种子名"/>
<text id="n5_nrka" name="n5" xy="76,-8" size="36,24" rotation="30" fontSize="16" color="#ff0000" align="center" text="不可">
<gearDisplay controller="state" pages="1"/>
</text>
<text id="n6_nrka" name="n6" xy="76,-8" size="36,24" rotation="30" fontSize="16" color="#ff0000" align="center" text="不足">
<gearDisplay controller="state" pages="2"/>
</text>
</displayList>
<Button mode="Radio"/>
</component>

13
FGUIProject/FUI_ET/assets/Building/Farmland/SeedInfoPopup.xml

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<component size="250,160">
<displayList>
<graph id="n0_nrka" name="n0" xy="0,0" size="250,160" type="rect"/>
<graph id="n1_nrka" name="n1" xy="15,48" size="220,2" type="rect" fillColor="#ff000000"/>
<text id="n2_nrka" name="Name" xy="15,11" size="100,29" fontSize="20" autoSize="shrink" text="作物名称"/>
<text id="n3_nrka" name="NeedNum" xy="152,11" size="80,29" fontSize="20" align="right" ubb="true" autoSize="shrink" text="9999/30"/>
<text id="n4_nrka" name="n4" xy="18,64" size="84,24" fontSize="16" align="right" text="播种季节:"/>
<text id="n5_nrka" name="n5" xy="18,111" size="84,24" fontSize="16" align="right" text="生长时间:"/>
<text id="n6_nrka" name="Season" xy="109,63" size="52,24" fontSize="16" align="right" text="春、夏"/>
<text id="n7_nrka" name="GrowTime" xy="111,111" size="46,24" fontSize="16" align="right" text="999日"/>
</displayList>
</component>

4
FGUIProject/FUI_ET/assets/Building/package.xml

@ -30,6 +30,10 @@
<image id="ell8r" name="BuildClose.png" path="/"/>
<component id="ewizs" name="RepairBuildingWindow.xml" path="/" exported="true"/>
<component id="b4kqt" name="BuildingUpgradeWindow.xml" path="/" exported="true"/>
<component id="nrkau" name="FarmlandWindow.xml" path="/Farmland/" exported="true"/>
<component id="nrkav" name="PlantSeedItem.xml" path="/Farmland/" exported="true"/>
<component id="nrkaw" name="SeedInfoPopup.xml" path="/Farmland/"/>
<component id="ifd4x" name="IconButton.xml" path="/Farmland/"/>
</resources>
<publish name="" genCode="true"/>
</packageDescription>

2
Server/Hotfix/Demo/Farmland/Handler/C2M_FarmlandRipeHandler.cs

@ -13,7 +13,7 @@ namespace ET
Farmland farmland = unit.GetGrandChild<Farmland>(request.FarmlandId);
if (farmland != null)
{
farmland.FarmlandState = FarmlandState.FARMLAND_STATE_RIPE;
farmland.SetFarmlandState(FarmlandState.FARMLAND_STATE_RIPE);
response.Error = ErrorCode.ERR_Success;
FarmlandHelper.NotifyFarmlandRipe(unit,new List<long>{farmland.Id});
}

2
Server/Model/Server.Model.csproj

@ -54,7 +54,7 @@
<Link>Demo\Constant.cs</Link>
</Compile>
<Compile Include="..\..\Unity\Codes\Model\Demo\CommonEventType.cs">
<Compile Include="..\..\Unity\Codes\Model\Demo\Common\CommonEventType.cs">
<Link>Demo\CommonEventType.cs</Link>
</Compile>

13
Unity/Animancer.FSM.csproj

@ -22,7 +22,7 @@
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>Temp\Bin\Debug\</OutputPath>
<DefineConstants>UNITY_2021_3_7;UNITY_2021_3;UNITY_2021;UNITY_5_3_OR_NEWER;UNITY_5_4_OR_NEWER;UNITY_5_5_OR_NEWER;UNITY_5_6_OR_NEWER;UNITY_2017_1_OR_NEWER;UNITY_2017_2_OR_NEWER;UNITY_2017_3_OR_NEWER;UNITY_2017_4_OR_NEWER;UNITY_2018_1_OR_NEWER;UNITY_2018_2_OR_NEWER;UNITY_2018_3_OR_NEWER;UNITY_2018_4_OR_NEWER;UNITY_2019_1_OR_NEWER;UNITY_2019_2_OR_NEWER;UNITY_2019_3_OR_NEWER;UNITY_2019_4_OR_NEWER;UNITY_2020_1_OR_NEWER;UNITY_2020_2_OR_NEWER;UNITY_2020_3_OR_NEWER;UNITY_2021_1_OR_NEWER;UNITY_2021_2_OR_NEWER;UNITY_2021_3_OR_NEWER;PLATFORM_ARCH_64;UNITY_64;UNITY_INCLUDE_TESTS;USE_SEARCH_ENGINE_API;USE_SEARCH_TABLE;USE_SEARCH_MODULE;USE_PROPERTY_DATABASE;USE_SEARCH_EXTENSION_API;SCENE_TEMPLATE_MODULE;ENABLE_AR;ENABLE_AUDIO;ENABLE_CACHING;ENABLE_CLOTH;ENABLE_EVENT_QUEUE;ENABLE_MICROPHONE;ENABLE_MULTIPLE_DISPLAYS;ENABLE_PHYSICS;ENABLE_TEXTURE_STREAMING;ENABLE_VIRTUALTEXTURING;ENABLE_UNET;ENABLE_LZMA;ENABLE_UNITYEVENTS;ENABLE_VR;ENABLE_WEBCAM;ENABLE_UNITYWEBREQUEST;ENABLE_WWW;ENABLE_CLOUD_SERVICES;ENABLE_CLOUD_SERVICES_COLLAB;ENABLE_CLOUD_SERVICES_COLLAB_SOFTLOCKS;ENABLE_CLOUD_SERVICES_ADS;ENABLE_CLOUD_SERVICES_USE_WEBREQUEST;ENABLE_CLOUD_SERVICES_CRASH_REPORTING;ENABLE_CLOUD_SERVICES_PURCHASING;ENABLE_CLOUD_SERVICES_ANALYTICS;ENABLE_CLOUD_SERVICES_UNET;ENABLE_CLOUD_SERVICES_BUILD;ENABLE_CLOUD_LICENSE;ENABLE_EDITOR_HUB_LICENSE;ENABLE_WEBSOCKET_CLIENT;ENABLE_DIRECTOR_AUDIO;ENABLE_DIRECTOR_TEXTURE;ENABLE_MANAGED_JOBS;ENABLE_MANAGED_TRANSFORM_JOBS;ENABLE_MANAGED_ANIMATION_JOBS;ENABLE_MANAGED_AUDIO_JOBS;ENABLE_MANAGED_UNITYTLS;INCLUDE_DYNAMIC_GI;ENABLE_SCRIPTING_GC_WBARRIERS;PLATFORM_SUPPORTS_MONO;RENDER_SOFTWARE_CURSOR;ENABLE_VIDEO;ENABLE_ACCELERATOR_CLIENT_DEBUGGING;PLATFORM_STANDALONE;TEXTCORE_1_0_OR_NEWER;PLATFORM_STANDALONE_WIN;UNITY_STANDALONE_WIN;UNITY_STANDALONE;ENABLE_RUNTIME_GI;ENABLE_MOVIES;ENABLE_NETWORK;ENABLE_NVIDIA;ENABLE_CRUNCH_TEXTURE_COMPRESSION;ENABLE_OUT_OF_PROCESS_CRASH_HANDLER;ENABLE_CLUSTER_SYNC;ENABLE_CLUSTERINPUT;PLATFORM_UPDATES_TIME_OUTSIDE_OF_PLAYER_LOOP;GFXDEVICE_WAITFOREVENT_MESSAGEPUMP;ENABLE_WEBSOCKET_HOST;ENABLE_MONO;NET_4_6;NET_UNITY_4_8;ENABLE_PROFILER;DEBUG;TRACE;UNITY_ASSERTIONS;UNITY_EDITOR;UNITY_EDITOR_IG;UNITY_EDITOR_64;UNITY_EDITOR_WIN;ENABLE_UNITY_COLLECTIONS_CHECKS;ENABLE_BURST_AOT;UNITY_TEAM_LICENSE;ENABLE_CUSTOM_RENDER_TEXTURE;ENABLE_DIRECTOR;ENABLE_LOCALIZATION;ENABLE_SPRITES;ENABLE_TERRAIN;ENABLE_TILEMAP;ENABLE_TIMELINE;ENABLE_LEGACY_INPUT_MANAGER;NET452;CSHARP_7_OR_LATER;CSHARP_7_3_OR_NEWER</DefineConstants>
<DefineConstants>UNITY_2021_3_7;UNITY_2021_3;UNITY_2021;UNITY_5_3_OR_NEWER;UNITY_5_4_OR_NEWER;UNITY_5_5_OR_NEWER;UNITY_5_6_OR_NEWER;UNITY_2017_1_OR_NEWER;UNITY_2017_2_OR_NEWER;UNITY_2017_3_OR_NEWER;UNITY_2017_4_OR_NEWER;UNITY_2018_1_OR_NEWER;UNITY_2018_2_OR_NEWER;UNITY_2018_3_OR_NEWER;UNITY_2018_4_OR_NEWER;UNITY_2019_1_OR_NEWER;UNITY_2019_2_OR_NEWER;UNITY_2019_3_OR_NEWER;UNITY_2019_4_OR_NEWER;UNITY_2020_1_OR_NEWER;UNITY_2020_2_OR_NEWER;UNITY_2020_3_OR_NEWER;UNITY_2021_1_OR_NEWER;UNITY_2021_2_OR_NEWER;UNITY_2021_3_OR_NEWER;PLATFORM_ARCH_64;UNITY_64;UNITY_INCLUDE_TESTS;USE_SEARCH_ENGINE_API;USE_SEARCH_TABLE;USE_SEARCH_MODULE;USE_PROPERTY_DATABASE;USE_SEARCH_EXTENSION_API;SCENE_TEMPLATE_MODULE;ENABLE_AR;ENABLE_AUDIO;ENABLE_CACHING;ENABLE_CLOTH;ENABLE_EVENT_QUEUE;ENABLE_MICROPHONE;ENABLE_MULTIPLE_DISPLAYS;ENABLE_PHYSICS;ENABLE_TEXTURE_STREAMING;ENABLE_VIRTUALTEXTURING;ENABLE_UNET;ENABLE_LZMA;ENABLE_UNITYEVENTS;ENABLE_VR;ENABLE_WEBCAM;ENABLE_UNITYWEBREQUEST;ENABLE_WWW;ENABLE_CLOUD_SERVICES;ENABLE_CLOUD_SERVICES_COLLAB;ENABLE_CLOUD_SERVICES_COLLAB_SOFTLOCKS;ENABLE_CLOUD_SERVICES_ADS;ENABLE_CLOUD_SERVICES_USE_WEBREQUEST;ENABLE_CLOUD_SERVICES_CRASH_REPORTING;ENABLE_CLOUD_SERVICES_PURCHASING;ENABLE_CLOUD_SERVICES_ANALYTICS;ENABLE_CLOUD_SERVICES_UNET;ENABLE_CLOUD_SERVICES_BUILD;ENABLE_CLOUD_LICENSE;ENABLE_EDITOR_HUB_LICENSE;ENABLE_WEBSOCKET_CLIENT;ENABLE_DIRECTOR_AUDIO;ENABLE_DIRECTOR_TEXTURE;ENABLE_MANAGED_JOBS;ENABLE_MANAGED_TRANSFORM_JOBS;ENABLE_MANAGED_ANIMATION_JOBS;ENABLE_MANAGED_AUDIO_JOBS;ENABLE_MANAGED_UNITYTLS;INCLUDE_DYNAMIC_GI;ENABLE_SCRIPTING_GC_WBARRIERS;PLATFORM_SUPPORTS_MONO;RENDER_SOFTWARE_CURSOR;ENABLE_VIDEO;ENABLE_ACCELERATOR_CLIENT_DEBUGGING;PLATFORM_STANDALONE;TEXTCORE_1_0_OR_NEWER;PLATFORM_STANDALONE_WIN;UNITY_STANDALONE_WIN;UNITY_STANDALONE;ENABLE_RUNTIME_GI;ENABLE_MOVIES;ENABLE_NETWORK;ENABLE_NVIDIA;ENABLE_CRUNCH_TEXTURE_COMPRESSION;ENABLE_OUT_OF_PROCESS_CRASH_HANDLER;ENABLE_CLUSTER_SYNC;ENABLE_CLUSTERINPUT;PLATFORM_UPDATES_TIME_OUTSIDE_OF_PLAYER_LOOP;GFXDEVICE_WAITFOREVENT_MESSAGEPUMP;ENABLE_WEBSOCKET_HOST;ENABLE_MONO;NET_4_6;NET_UNITY_4_8;ENABLE_PROFILER;DEBUG;TRACE;UNITY_ASSERTIONS;UNITY_EDITOR;UNITY_EDITOR_IG;UNITY_EDITOR_64;UNITY_EDITOR_WIN;ENABLE_UNITY_COLLECTIONS_CHECKS;ENABLE_BURST_AOT;UNITY_TEAM_LICENSE;ENABLE_CUSTOM_RENDER_TEXTURE;ENABLE_DIRECTOR;ENABLE_LOCALIZATION;ENABLE_SPRITES;ENABLE_TERRAIN;ENABLE_TILEMAP;ENABLE_TIMELINE;ENABLE_LEGACY_INPUT_MANAGER;NET452;CLIENTTEST;CSHARP_7_OR_LATER;CSHARP_7_3_OR_NEWER</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<NoWarn>0169</NoWarn>
@ -53,7 +53,7 @@
<UnityVersion>2021.3.7f1c1</UnityVersion>
</PropertyGroup>
<ItemGroup>
<Analyzer Include="C:\Program Files\Microsoft Visual Studio\2022\Community\Common7\IDE\Extensions\Microsoft\Visual Studio Tools for Unity\Analyzers\Microsoft.Unity.Analyzers.dll" />
<Analyzer Include="D:\Program Files\Microsoft Visual Studio\2022\Community\Common7\IDE\Extensions\Microsoft\Visual Studio Tools for Unity\Analyzers\Microsoft.Unity.Analyzers.dll" />
</ItemGroup>
<ItemGroup>
<Compile Include="Assets\ThirdParty\Animancer\Utilities\FSM\StateMachine1.StateSelector.cs" />
@ -310,6 +310,9 @@
<Reference Include="UnityEditor.Graphs">
<HintPath>C:\Program Files\Unity\Hub\Editor\2021.3.7f1c1\Editor\Data\Managed\UnityEditor.Graphs.dll</HintPath>
</Reference>
<Reference Include="UnityEditor.Android.Extensions">
<HintPath>C:\Program Files\Unity\Hub\Editor\2021.3.7f1c1\Editor\Data\PlaybackEngines\AndroidPlayer\UnityEditor.Android.Extensions.dll</HintPath>
</Reference>
<Reference Include="UnityEditor.WindowsStandalone.Extensions">
<HintPath>C:\Program Files\Unity\Hub\Editor\2021.3.7f1c1\Editor\Data\PlaybackEngines\WindowsStandaloneSupport\UnityEditor.WindowsStandalone.Extensions.dll</HintPath>
</Reference>
@ -346,6 +349,12 @@
<Reference Include="NCalc">
<HintPath>Assets\ThirdParty\NCalc\NCalc.dll</HintPath>
</Reference>
<Reference Include="Unity.Android.Types">
<HintPath>C:\Program Files\Unity\Hub\Editor\2021.3.7f1c1\Editor\Data\PlaybackEngines\AndroidPlayer\Unity.Android.Types.dll</HintPath>
</Reference>
<Reference Include="Unity.Android.Gradle">
<HintPath>C:\Program Files\Unity\Hub\Editor\2021.3.7f1c1\Editor\Data\PlaybackEngines\AndroidPlayer\Unity.Android.Gradle.dll</HintPath>
</Reference>
<Reference Include="mscorlib">
<HintPath>C:\Program Files\Unity\Hub\Editor\2021.3.7f1c1\Editor\Data\UnityReferenceAssemblies\unity-4.8-api\mscorlib.dll</HintPath>
</Reference>

13
Unity/Animancer.csproj

@ -22,7 +22,7 @@
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>Temp\Bin\Debug\</OutputPath>
<DefineConstants>UNITY_2021_3_7;UNITY_2021_3;UNITY_2021;UNITY_5_3_OR_NEWER;UNITY_5_4_OR_NEWER;UNITY_5_5_OR_NEWER;UNITY_5_6_OR_NEWER;UNITY_2017_1_OR_NEWER;UNITY_2017_2_OR_NEWER;UNITY_2017_3_OR_NEWER;UNITY_2017_4_OR_NEWER;UNITY_2018_1_OR_NEWER;UNITY_2018_2_OR_NEWER;UNITY_2018_3_OR_NEWER;UNITY_2018_4_OR_NEWER;UNITY_2019_1_OR_NEWER;UNITY_2019_2_OR_NEWER;UNITY_2019_3_OR_NEWER;UNITY_2019_4_OR_NEWER;UNITY_2020_1_OR_NEWER;UNITY_2020_2_OR_NEWER;UNITY_2020_3_OR_NEWER;UNITY_2021_1_OR_NEWER;UNITY_2021_2_OR_NEWER;UNITY_2021_3_OR_NEWER;PLATFORM_ARCH_64;UNITY_64;UNITY_INCLUDE_TESTS;USE_SEARCH_ENGINE_API;USE_SEARCH_TABLE;USE_SEARCH_MODULE;USE_PROPERTY_DATABASE;USE_SEARCH_EXTENSION_API;SCENE_TEMPLATE_MODULE;ENABLE_AR;ENABLE_AUDIO;ENABLE_CACHING;ENABLE_CLOTH;ENABLE_EVENT_QUEUE;ENABLE_MICROPHONE;ENABLE_MULTIPLE_DISPLAYS;ENABLE_PHYSICS;ENABLE_TEXTURE_STREAMING;ENABLE_VIRTUALTEXTURING;ENABLE_UNET;ENABLE_LZMA;ENABLE_UNITYEVENTS;ENABLE_VR;ENABLE_WEBCAM;ENABLE_UNITYWEBREQUEST;ENABLE_WWW;ENABLE_CLOUD_SERVICES;ENABLE_CLOUD_SERVICES_COLLAB;ENABLE_CLOUD_SERVICES_COLLAB_SOFTLOCKS;ENABLE_CLOUD_SERVICES_ADS;ENABLE_CLOUD_SERVICES_USE_WEBREQUEST;ENABLE_CLOUD_SERVICES_CRASH_REPORTING;ENABLE_CLOUD_SERVICES_PURCHASING;ENABLE_CLOUD_SERVICES_ANALYTICS;ENABLE_CLOUD_SERVICES_UNET;ENABLE_CLOUD_SERVICES_BUILD;ENABLE_CLOUD_LICENSE;ENABLE_EDITOR_HUB_LICENSE;ENABLE_WEBSOCKET_CLIENT;ENABLE_DIRECTOR_AUDIO;ENABLE_DIRECTOR_TEXTURE;ENABLE_MANAGED_JOBS;ENABLE_MANAGED_TRANSFORM_JOBS;ENABLE_MANAGED_ANIMATION_JOBS;ENABLE_MANAGED_AUDIO_JOBS;ENABLE_MANAGED_UNITYTLS;INCLUDE_DYNAMIC_GI;ENABLE_SCRIPTING_GC_WBARRIERS;PLATFORM_SUPPORTS_MONO;RENDER_SOFTWARE_CURSOR;ENABLE_VIDEO;ENABLE_ACCELERATOR_CLIENT_DEBUGGING;PLATFORM_STANDALONE;TEXTCORE_1_0_OR_NEWER;PLATFORM_STANDALONE_WIN;UNITY_STANDALONE_WIN;UNITY_STANDALONE;ENABLE_RUNTIME_GI;ENABLE_MOVIES;ENABLE_NETWORK;ENABLE_NVIDIA;ENABLE_CRUNCH_TEXTURE_COMPRESSION;ENABLE_OUT_OF_PROCESS_CRASH_HANDLER;ENABLE_CLUSTER_SYNC;ENABLE_CLUSTERINPUT;PLATFORM_UPDATES_TIME_OUTSIDE_OF_PLAYER_LOOP;GFXDEVICE_WAITFOREVENT_MESSAGEPUMP;ENABLE_WEBSOCKET_HOST;ENABLE_MONO;NET_4_6;NET_UNITY_4_8;ENABLE_PROFILER;DEBUG;TRACE;UNITY_ASSERTIONS;UNITY_EDITOR;UNITY_EDITOR_IG;UNITY_EDITOR_64;UNITY_EDITOR_WIN;ENABLE_UNITY_COLLECTIONS_CHECKS;ENABLE_BURST_AOT;UNITY_TEAM_LICENSE;ENABLE_CUSTOM_RENDER_TEXTURE;ENABLE_DIRECTOR;ENABLE_LOCALIZATION;ENABLE_SPRITES;ENABLE_TERRAIN;ENABLE_TILEMAP;ENABLE_TIMELINE;ENABLE_LEGACY_INPUT_MANAGER;NET452;CSHARP_7_OR_LATER;CSHARP_7_3_OR_NEWER</DefineConstants>
<DefineConstants>UNITY_2021_3_7;UNITY_2021_3;UNITY_2021;UNITY_5_3_OR_NEWER;UNITY_5_4_OR_NEWER;UNITY_5_5_OR_NEWER;UNITY_5_6_OR_NEWER;UNITY_2017_1_OR_NEWER;UNITY_2017_2_OR_NEWER;UNITY_2017_3_OR_NEWER;UNITY_2017_4_OR_NEWER;UNITY_2018_1_OR_NEWER;UNITY_2018_2_OR_NEWER;UNITY_2018_3_OR_NEWER;UNITY_2018_4_OR_NEWER;UNITY_2019_1_OR_NEWER;UNITY_2019_2_OR_NEWER;UNITY_2019_3_OR_NEWER;UNITY_2019_4_OR_NEWER;UNITY_2020_1_OR_NEWER;UNITY_2020_2_OR_NEWER;UNITY_2020_3_OR_NEWER;UNITY_2021_1_OR_NEWER;UNITY_2021_2_OR_NEWER;UNITY_2021_3_OR_NEWER;PLATFORM_ARCH_64;UNITY_64;UNITY_INCLUDE_TESTS;USE_SEARCH_ENGINE_API;USE_SEARCH_TABLE;USE_SEARCH_MODULE;USE_PROPERTY_DATABASE;USE_SEARCH_EXTENSION_API;SCENE_TEMPLATE_MODULE;ENABLE_AR;ENABLE_AUDIO;ENABLE_CACHING;ENABLE_CLOTH;ENABLE_EVENT_QUEUE;ENABLE_MICROPHONE;ENABLE_MULTIPLE_DISPLAYS;ENABLE_PHYSICS;ENABLE_TEXTURE_STREAMING;ENABLE_VIRTUALTEXTURING;ENABLE_UNET;ENABLE_LZMA;ENABLE_UNITYEVENTS;ENABLE_VR;ENABLE_WEBCAM;ENABLE_UNITYWEBREQUEST;ENABLE_WWW;ENABLE_CLOUD_SERVICES;ENABLE_CLOUD_SERVICES_COLLAB;ENABLE_CLOUD_SERVICES_COLLAB_SOFTLOCKS;ENABLE_CLOUD_SERVICES_ADS;ENABLE_CLOUD_SERVICES_USE_WEBREQUEST;ENABLE_CLOUD_SERVICES_CRASH_REPORTING;ENABLE_CLOUD_SERVICES_PURCHASING;ENABLE_CLOUD_SERVICES_ANALYTICS;ENABLE_CLOUD_SERVICES_UNET;ENABLE_CLOUD_SERVICES_BUILD;ENABLE_CLOUD_LICENSE;ENABLE_EDITOR_HUB_LICENSE;ENABLE_WEBSOCKET_CLIENT;ENABLE_DIRECTOR_AUDIO;ENABLE_DIRECTOR_TEXTURE;ENABLE_MANAGED_JOBS;ENABLE_MANAGED_TRANSFORM_JOBS;ENABLE_MANAGED_ANIMATION_JOBS;ENABLE_MANAGED_AUDIO_JOBS;ENABLE_MANAGED_UNITYTLS;INCLUDE_DYNAMIC_GI;ENABLE_SCRIPTING_GC_WBARRIERS;PLATFORM_SUPPORTS_MONO;RENDER_SOFTWARE_CURSOR;ENABLE_VIDEO;ENABLE_ACCELERATOR_CLIENT_DEBUGGING;PLATFORM_STANDALONE;TEXTCORE_1_0_OR_NEWER;PLATFORM_STANDALONE_WIN;UNITY_STANDALONE_WIN;UNITY_STANDALONE;ENABLE_RUNTIME_GI;ENABLE_MOVIES;ENABLE_NETWORK;ENABLE_NVIDIA;ENABLE_CRUNCH_TEXTURE_COMPRESSION;ENABLE_OUT_OF_PROCESS_CRASH_HANDLER;ENABLE_CLUSTER_SYNC;ENABLE_CLUSTERINPUT;PLATFORM_UPDATES_TIME_OUTSIDE_OF_PLAYER_LOOP;GFXDEVICE_WAITFOREVENT_MESSAGEPUMP;ENABLE_WEBSOCKET_HOST;ENABLE_MONO;NET_4_6;NET_UNITY_4_8;ENABLE_PROFILER;DEBUG;TRACE;UNITY_ASSERTIONS;UNITY_EDITOR;UNITY_EDITOR_IG;UNITY_EDITOR_64;UNITY_EDITOR_WIN;ENABLE_UNITY_COLLECTIONS_CHECKS;ENABLE_BURST_AOT;UNITY_TEAM_LICENSE;ENABLE_CUSTOM_RENDER_TEXTURE;ENABLE_DIRECTOR;ENABLE_LOCALIZATION;ENABLE_SPRITES;ENABLE_TERRAIN;ENABLE_TILEMAP;ENABLE_TIMELINE;ENABLE_LEGACY_INPUT_MANAGER;NET452;CLIENTTEST;CSHARP_7_OR_LATER;CSHARP_7_3_OR_NEWER</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<NoWarn>0169</NoWarn>
@ -53,7 +53,7 @@
<UnityVersion>2021.3.7f1c1</UnityVersion>
</PropertyGroup>
<ItemGroup>
<Analyzer Include="C:\Program Files\Microsoft Visual Studio\2022\Community\Common7\IDE\Extensions\Microsoft\Visual Studio Tools for Unity\Analyzers\Microsoft.Unity.Analyzers.dll" />
<Analyzer Include="D:\Program Files\Microsoft Visual Studio\2022\Community\Common7\IDE\Extensions\Microsoft\Visual Studio Tools for Unity\Analyzers\Microsoft.Unity.Analyzers.dll" />
</ItemGroup>
<ItemGroup>
<Compile Include="Assets\ThirdParty\Animancer\Internal\Editor\Transition Preview Window\TransitionPreviewWindow.Animations.cs" />
@ -447,6 +447,9 @@
<Reference Include="UnityEditor.Graphs">
<HintPath>C:\Program Files\Unity\Hub\Editor\2021.3.7f1c1\Editor\Data\Managed\UnityEditor.Graphs.dll</HintPath>
</Reference>
<Reference Include="UnityEditor.Android.Extensions">
<HintPath>C:\Program Files\Unity\Hub\Editor\2021.3.7f1c1\Editor\Data\PlaybackEngines\AndroidPlayer\UnityEditor.Android.Extensions.dll</HintPath>
</Reference>
<Reference Include="UnityEditor.WindowsStandalone.Extensions">
<HintPath>C:\Program Files\Unity\Hub\Editor\2021.3.7f1c1\Editor\Data\PlaybackEngines\WindowsStandaloneSupport\UnityEditor.WindowsStandalone.Extensions.dll</HintPath>
</Reference>
@ -483,6 +486,12 @@
<Reference Include="NCalc">
<HintPath>Assets\ThirdParty\NCalc\NCalc.dll</HintPath>
</Reference>
<Reference Include="Unity.Android.Types">
<HintPath>C:\Program Files\Unity\Hub\Editor\2021.3.7f1c1\Editor\Data\PlaybackEngines\AndroidPlayer\Unity.Android.Types.dll</HintPath>
</Reference>
<Reference Include="Unity.Android.Gradle">
<HintPath>C:\Program Files\Unity\Hub\Editor\2021.3.7f1c1\Editor\Data\PlaybackEngines\AndroidPlayer\Unity.Android.Gradle.dll</HintPath>
</Reference>
<Reference Include="mscorlib">
<HintPath>C:\Program Files\Unity\Hub\Editor\2021.3.7f1c1\Editor\Data\UnityReferenceAssemblies\unity-4.8-api\mscorlib.dll</HintPath>
</Reference>

BIN
Unity/Assets/Bundles/FUI/Building_fui.bytes

Binary file not shown.

20
Unity/Codes/Hotfix/Demo/Farmland/FarmlandSystem.cs

@ -1,4 +1,6 @@
namespace ET
using ET.EventType;
namespace ET
{
public class FarmlandDestroySystem : DestroySystem<Farmland>
{
@ -54,7 +56,7 @@
public static void Plant(this Farmland self)
{
self.Duration = 0;
self.FarmlandState = FarmlandState.FARMLAND_STATE_GROW;
self.SetFarmlandState(FarmlandState.FARMLAND_STATE_GROW);
self.ExProduct = 0;
self.PeopleId = 0;
@ -66,7 +68,7 @@
self.Duration += 1;
if (self.Duration >= self.Config.GrowthCycle)
{
self.FarmlandState = FarmlandState.FARMLAND_STATE_RIPE;
self.SetFarmlandState(FarmlandState.FARMLAND_STATE_RIPE);
#if SERVER
@ -79,7 +81,7 @@
self.Duration = 0;
self.CropCfgId = 0;
self.ExProduct = 0;
self.FarmlandState = FarmlandState.FARMLAND_STATE_FREE;
self.SetFarmlandState(FarmlandState.FARMLAND_STATE_FREE);
self.PeopleId = 0;
}
@ -87,11 +89,19 @@
public static void Seed(this Farmland self,int cropCfgId)
{
self.CropCfgId = cropCfgId;
self.FarmlandState = FarmlandState.FARMLAND_STATE_SEED;
self.SetFarmlandState(FarmlandState.FARMLAND_STATE_SEED);
self.PlanCropCfgId = cropCfgId;
}
public static void SetFarmlandState(this Farmland self, int state)
{
self.FarmlandState = state;
#if !SERVER
Game.EventSystem.Publish(new FarmlandStateChanged(){Farmland = self});
#endif
}
}

2
Unity/Codes/Hotfix/Demo/Farmland/Handler/M2C_NtfFarmlandRipeHandler.cs

@ -10,7 +10,7 @@
Farmland farmland=UnitComponent.unit.GetGrandChild<Farmland>(v);
if ( farmland!= null)
{
farmland.FarmlandState = FarmlandState.FARMLAND_STATE_RIPE;
farmland.SetFarmlandState(FarmlandState.FARMLAND_STATE_RIPE);
}
}
}

4
Unity/Codes/Hotfix/Demo/Helper/FarmlandHelper.cs

@ -3,7 +3,7 @@ using System.Collections.Generic;
namespace ET
{
public static class PlantHelper
public static class FarmlandHelper
{
public static async ETTask<int> FarmlandSeed(Unit unit, List<long> farmlandIds, List<int> cropCfgIds)
{
@ -115,7 +115,7 @@ namespace ET
{
try
{
C2M_FarmlandHarvest msg = new C2M_FarmlandHarvest() { FarmlandId = farmland.Id };
C2M_FarmlandHarvest msg = new C2M_FarmlandHarvest() { FarmlandId = farmland.Id, PeopleId = people.Id};
M2C_FarmlandHarvest resp = await unit.ZoneScene().GetComponent<SessionComponent>().Session.Call(msg) as M2C_FarmlandHarvest;
if (resp.Error == ErrorCode.ERR_Success)
{

2
Unity/Codes/Hotfix/Demo/Operate/ConstructOperate.cs

@ -178,7 +178,7 @@ namespace ET
if (build.Config.Special == (int)StructureSpecialEnum.FARMLAND)
{
var farmland = build.AddChild<Farmland>();
farmland.FarmlandState = FarmlandState.FARMLAND_STATE_FREE;
farmland.SetFarmlandState(FarmlandState.FARMLAND_STATE_FREE);
unit.AddGrandChild(farmland);
}
}

2
Unity/Codes/Hotfix/Demo/Operate/FarmlandOperate.cs

@ -33,7 +33,7 @@ namespace ET
public static int GoHarvest(Unit unit, Farmland farmland, People people)
{
if (farmland.FarmlandState != FarmlandState.FARMLAND_STATE_SEED)
if (farmland.FarmlandState != FarmlandState.FARMLAND_STATE_RIPE)
{
return ErrorCode.ERR_FarmlandNotSeed;
}

2
Unity/Codes/Hotfix/Demo/People/PeopleSystem.cs

@ -23,7 +23,7 @@ namespace ET
self.Level = peopleProto.Level;
self.Exp = peopleProto.Exp;
self.Age = peopleProto.Age;
self.BehaveType = peopleProto.BehaveType;
self.SetBehaveType(peopleProto.BehaveType);
self.TargetId = peopleProto.TargetId;
self.PosX = peopleProto.X;
self.PosY = peopleProto.Y;

17
Unity/Codes/HotfixView/Demo/Building/BuildingViewComponentSystem.cs

@ -106,7 +106,7 @@ namespace ET
//TODO - 需要安排一个枚举方便区分建筑类型
switch (structureConfig.Type)
{
case 3:
case (int)StructureTypeEnum.FABRICATION:
{
//if(structureConfig.Special == 0)
//{
@ -125,6 +125,16 @@ namespace ET
}
}
break;
case (int) StructureTypeEnum.PRODUCTION:
{
if (structureConfig.Special == (int) StructureSpecialEnum.FARMLAND)
{
var farmlandWin = self.ZoneScene().GetComponent<FUIComponent>()
.ShowWindow<FUI_FarmlandWindow, FUIFarmlandWindowComponent>();
farmlandWin.ShowInfo(buildingInfo);
}
}
break;
default:
{
var buildingInfoWindowComp = self.ZoneScene().GetComponent<FUIComponent>().ShowWindow<FUI_BuildingInfoWindow, FUIBuildingInfoWindowComponent>();
@ -133,6 +143,11 @@ namespace ET
break;
}
}
public static Vector3 GetWorkPos(this BuildingViewComponent self)
{
return self.BuildingRoot.transform.position;
}
public static void Destroy(this BuildingViewComponent self)
{

21
Unity/Codes/HotfixView/Demo/Building/PeopleMoveEnd_StartFarm.cs

@ -0,0 +1,21 @@
using ET.EventType;
namespace ET
{
public class PeopleMoveEnd_StartFarm : AEvent<EventType.PeopleMoveEnd>
{
protected override void Run(PeopleMoveEnd args)
{
var people = args.People;
var unit = UnitHelper.GetMyUnitFromZoneScene(people.ZoneScene());
int behave = people.GetBehaveType();
var targetId = people.GetTargetId();
if (behave == ConstBehaveType.BEHAVE_PREPARE_PLANT)
{
var farmland = unit.GetGrandChild<Farmland>(targetId);
FarmlandHelper.StartFarmlandPlant(unit, people, farmland).Coroutine();
}
}
}
}

21
Unity/Codes/HotfixView/Demo/Building/PeopleMoveEnd_StartHarvest.cs

@ -0,0 +1,21 @@
using ET.EventType;
namespace ET
{
public class PeopleMoveEnd_StartHarvest : AEvent<EventType.PeopleMoveEnd>
{
protected override void Run(PeopleMoveEnd args)
{
var people = args.People;
var unit = UnitHelper.GetMyUnitFromZoneScene(people.ZoneScene());
int behave = people.GetBehaveType();
var targetId = people.GetTargetId();
if (behave == ConstBehaveType.BEHAVE_PREPARE_HARVEST)
{
var farmland = unit.GetGrandChild<Farmland>(targetId);
FarmlandHelper.StartFarmlandHarvest(unit, people, farmland).Coroutine();
}
}
}
}

150
Unity/Codes/HotfixView/Demo/FUI/AutoGeneratedCode/Building/FUI_FarmlandWindow.cs

@ -0,0 +1,150 @@
/** This is an automatically generated class by FairyGUI. Please do not modify it. **/
using FairyGUI;
using System.Threading.Tasks;
namespace ET
{
namespace FUIBuilding
{
public class FUI_FarmlandWindowAwakeSystem : AwakeSystem<FUI_FarmlandWindow>
{
public override void Awake(FUI_FarmlandWindow self)
{
self.Awake();
}
}
public class FUI_FarmlandWindowDestroySystem : DestroySystem<FUI_FarmlandWindow>
{
public override void Destroy(FUI_FarmlandWindow self)
{
self.Destroy();
}
}
[FriendClass(typeof(FUI))]
[FriendClass(typeof(FUI_FarmlandWindow))]
public static class FUI_FarmlandWindowSystem
{
public static void Awake(this FUI_FarmlandWindow self)
{
var fui = self.GetParent<FUI>();
if(fui.GObject == null)
{
return;
}
self.FGComp = (GComponent)fui.GObject;
self.FGComp.Add(fui);
var com = fui.GObject.asCom;
if(com != null)
{
self.m_farmlandState = com.GetControllerAt(0);
self.m_hasPeople = com.GetControllerAt(1);
self.m_n1 = (GGraph)com.GetChildAt(0);
self.m_PlantSeedList = (GList)com.GetChildAt(1);
self.m_ConfirmSeedButton = FUIHelper.Create<FUI_GreenButton>(self, com.GetChildAt(2));
self.m_n3 = (GGraph)com.GetChildAt(3);
self.m_SeedInfoPopup = FUIHelper.Create<FUI_SeedInfoPopup>(self, com.GetChildAt(4));
self.m_SeedPanel = (GGroup)com.GetChildAt(5);
self.m_n8 = (GGraph)com.GetChildAt(6);
self.m_n10 = (GGraph)com.GetChildAt(7);
self.m_WaitForPlant_CropIcon = (GLoader)com.GetChildAt(8);
self.m_n12 = (GTextField)com.GetChildAt(9);
self.m_WaitForPlantText = (GTextField)com.GetChildAt(10);
self.m_n14 = (GTextField)com.GetChildAt(11);
self.m_n15 = (GTextField)com.GetChildAt(12);
self.m_WFP_FarmerIconButton = FUIHelper.Create<FUI_IconButton>(self, com.GetChildAt(13));
self.m_AddPlantPeopleButton = FUIHelper.Create<FUI_GreenButton>(self, com.GetChildAt(14));
self.m_WaitForPlantPanel = (GGroup)com.GetChildAt(15);
self.m_n18 = (GGraph)com.GetChildAt(16);
self.m_n19 = (GGraph)com.GetChildAt(17);
self.m_Grow_CropIcon = (GLoader)com.GetChildAt(18);
self.m_n21 = (GTextField)com.GetChildAt(19);
self.m_GrowText = (GTextField)com.GetChildAt(20);
self.m_n23 = (GTextField)com.GetChildAt(21);
self.m_Grow_ProductionNum = (GTextField)com.GetChildAt(22);
self.m_GrowSpeedUpButton = FUIHelper.Create<FUI_GreenButton>(self, com.GetChildAt(23));
self.m_GrowPanel = (GGroup)com.GetChildAt(24);
self.m_n27 = (GGraph)com.GetChildAt(25);
self.m_n28 = (GGraph)com.GetChildAt(26);
self.m_Harvest_CropIcon = (GLoader)com.GetChildAt(27);
self.m_n30 = (GTextField)com.GetChildAt(28);
self.m_HarvestText = (GTextField)com.GetChildAt(29);
self.m_n32 = (GTextField)com.GetChildAt(30);
self.m_Harvest_ProductionNum = (GTextField)com.GetChildAt(31);
self.m_HarvestButton = FUIHelper.Create<FUI_GreenButton>(self, com.GetChildAt(32));
self.m_Harvest_FarmerIconButton = FUIHelper.Create<FUI_IconButton>(self, com.GetChildAt(33));
self.m_HarvestPanel = (GGroup)com.GetChildAt(34);
self.m_RemoveButton = FUIHelper.Create<FUI_GreenButton>(self, com.GetChildAt(35));
self.m_CloseButton = FUIHelper.Create<FUI_GreenButton>(self, com.GetChildAt(36));
}
}
public static void Destroy(this FUI_FarmlandWindow self)
{
if(self.IsDisposed)
{
return;
}
self.FGComp.Remove();
self.FGComp = null;
self.m_farmlandState = null;
self.m_hasPeople = null;
self.m_n1 = null;
self.m_PlantSeedList = null;
self.m_ConfirmSeedButton.Dispose();
self.m_ConfirmSeedButton = null;
self.m_n3 = null;
self.m_SeedInfoPopup.Dispose();
self.m_SeedInfoPopup = null;
self.m_SeedPanel = null;
self.m_n8 = null;
self.m_n10 = null;
self.m_WaitForPlant_CropIcon = null;
self.m_n12 = null;
self.m_WaitForPlantText = null;
self.m_n14 = null;
self.m_n15 = null;
self.m_WFP_FarmerIconButton.Dispose();
self.m_WFP_FarmerIconButton = null;
self.m_AddPlantPeopleButton.Dispose();
self.m_AddPlantPeopleButton = null;
self.m_WaitForPlantPanel = null;
self.m_n18 = null;
self.m_n19 = null;
self.m_Grow_CropIcon = null;
self.m_n21 = null;
self.m_GrowText = null;
self.m_n23 = null;
self.m_Grow_ProductionNum = null;
self.m_GrowSpeedUpButton.Dispose();
self.m_GrowSpeedUpButton = null;
self.m_GrowPanel = null;
self.m_n27 = null;
self.m_n28 = null;
self.m_Harvest_CropIcon = null;
self.m_n30 = null;
self.m_HarvestText = null;
self.m_n32 = null;
self.m_Harvest_ProductionNum = null;
self.m_HarvestButton.Dispose();
self.m_HarvestButton = null;
self.m_Harvest_FarmerIconButton.Dispose();
self.m_Harvest_FarmerIconButton = null;
self.m_HarvestPanel = null;
self.m_RemoveButton.Dispose();
self.m_RemoveButton = null;
self.m_CloseButton.Dispose();
self.m_CloseButton = null;
}
}
}
}

67
Unity/Codes/HotfixView/Demo/FUI/AutoGeneratedCode/Building/FUI_IconButton.cs

@ -0,0 +1,67 @@
/** This is an automatically generated class by FairyGUI. Please do not modify it. **/
using FairyGUI;
using System.Threading.Tasks;
namespace ET
{
namespace FUIBuilding
{
public class FUI_IconButtonAwakeSystem : AwakeSystem<FUI_IconButton>
{
public override void Awake(FUI_IconButton self)
{
self.Awake();
}
}
public class FUI_IconButtonDestroySystem : DestroySystem<FUI_IconButton>
{
public override void Destroy(FUI_IconButton self)
{
self.Destroy();
}
}
[FriendClass(typeof(FUI))]
[FriendClass(typeof(FUI_IconButton))]
public static class FUI_IconButtonSystem
{
public static void Awake(this FUI_IconButton self)
{
var fui = self.GetParent<FUI>();
if(fui.GObject == null)
{
return;
}
self.FGComp = (GButton)fui.GObject;
self.FGComp.Add(fui);
var com = fui.GObject.asCom;
if(com != null)
{
self.m_Icon = (GLoader)com.GetChildAt(0);
self.m_Name = (GTextField)com.GetChildAt(1);
}
}
public static void Destroy(this FUI_IconButton self)
{
if(self.IsDisposed)
{
return;
}
self.FGComp.Remove();
self.FGComp = null;
self.m_Icon = null;
self.m_Name = null;
}
}
}
}

81
Unity/Codes/HotfixView/Demo/FUI/AutoGeneratedCode/Building/FUI_PlantSeedItem.cs

@ -0,0 +1,81 @@
/** This is an automatically generated class by FairyGUI. Please do not modify it. **/
using FairyGUI;
using System.Threading.Tasks;
namespace ET
{
namespace FUIBuilding
{
public class FUI_PlantSeedItemAwakeSystem : AwakeSystem<FUI_PlantSeedItem>
{
public override void Awake(FUI_PlantSeedItem self)
{
self.Awake();
}
}
public class FUI_PlantSeedItemDestroySystem : DestroySystem<FUI_PlantSeedItem>
{
public override void Destroy(FUI_PlantSeedItem self)
{
self.Destroy();
}
}
[FriendClass(typeof(FUI))]
[FriendClass(typeof(FUI_PlantSeedItem))]
public static class FUI_PlantSeedItemSystem
{
public static void Awake(this FUI_PlantSeedItem self)
{
var fui = self.GetParent<FUI>();
if(fui.GObject == null)
{
return;
}
self.FGComp = (GButton)fui.GObject;
self.FGComp.Add(fui);
var com = fui.GObject.asCom;
if(com != null)
{
self.m_button = com.GetControllerAt(0);
self.m_state = com.GetControllerAt(1);
self.m_n0 = (GGraph)com.GetChildAt(0);
self.m_n1 = (GGraph)com.GetChildAt(1);
self.m_n2 = (GGraph)com.GetChildAt(2);
self.m_Icon = (GLoader)com.GetChildAt(3);
self.m_Name = (GTextField)com.GetChildAt(4);
self.m_n5 = (GTextField)com.GetChildAt(5);
self.m_n6 = (GTextField)com.GetChildAt(6);
}
}
public static void Destroy(this FUI_PlantSeedItem self)
{
if(self.IsDisposed)
{
return;
}
self.FGComp.Remove();
self.FGComp = null;
self.m_button = null;
self.m_state = null;
self.m_n0 = null;
self.m_n1 = null;
self.m_n2 = null;
self.m_Icon = null;
self.m_Name = null;
self.m_n5 = null;
self.m_n6 = null;
}
}
}
}

79
Unity/Codes/HotfixView/Demo/FUI/AutoGeneratedCode/Building/FUI_SeedInfoPopup.cs

@ -0,0 +1,79 @@
/** This is an automatically generated class by FairyGUI. Please do not modify it. **/
using FairyGUI;
using System.Threading.Tasks;
namespace ET
{
namespace FUIBuilding
{
public class FUI_SeedInfoPopupAwakeSystem : AwakeSystem<FUI_SeedInfoPopup>
{
public override void Awake(FUI_SeedInfoPopup self)
{
self.Awake();
}
}
public class FUI_SeedInfoPopupDestroySystem : DestroySystem<FUI_SeedInfoPopup>
{
public override void Destroy(FUI_SeedInfoPopup self)
{
self.Destroy();
}
}
[FriendClass(typeof(FUI))]
[FriendClass(typeof(FUI_SeedInfoPopup))]
public static class FUI_SeedInfoPopupSystem
{
public static void Awake(this FUI_SeedInfoPopup self)
{
var fui = self.GetParent<FUI>();
if(fui.GObject == null)
{
return;
}
self.FGComp = (GComponent)fui.GObject;
self.FGComp.Add(fui);
var com = fui.GObject.asCom;
if(com != null)
{
self.m_n0 = (GGraph)com.GetChildAt(0);
self.m_n1 = (GGraph)com.GetChildAt(1);
self.m_Name = (GTextField)com.GetChildAt(2);
self.m_NeedNum = (GTextField)com.GetChildAt(3);
self.m_n4 = (GTextField)com.GetChildAt(4);
self.m_n5 = (GTextField)com.GetChildAt(5);
self.m_Season = (GTextField)com.GetChildAt(6);
self.m_GrowTime = (GTextField)com.GetChildAt(7);
}
}
public static void Destroy(this FUI_SeedInfoPopup self)
{
if(self.IsDisposed)
{
return;
}
self.FGComp.Remove();
self.FGComp = null;
self.m_n0 = null;
self.m_n1 = null;
self.m_Name = null;
self.m_NeedNum = null;
self.m_n4 = null;
self.m_n5 = null;
self.m_Season = null;
self.m_GrowTime = null;
}
}
}
}

25
Unity/Codes/HotfixView/Demo/FUI/AutoGeneratedCode/Building/Friend/FUIFarmlandWindowComponentSystemFriend.cs

@ -0,0 +1,25 @@
/** This is an automatically generated class by FairyGUI. Please do not modify it. **/
namespace ET
{
using FUIBuilding;
[FriendClass(typeof(FUI_GreenButton))]
[FriendClass(typeof(FUI_SeedInfoPopup))]
[FriendClass(typeof(FUI_IconButton))]
[FriendClass(typeof(FUI_GreenButton))]
[FriendClass(typeof(FUI_GreenButton))]
[FriendClass(typeof(FUI_GreenButton))]
[FriendClass(typeof(FUI_IconButton))]
[FriendClass(typeof(FUI_GreenButton))]
[FriendClass(typeof(FUI_GreenButton))]
[FriendClass(typeof(FUIFarmlandWindowComponent))]
[FriendClass(typeof(FUI_FarmlandWindow))]
public static partial class FUIFarmlandWindowComponentSystem
{
}
}

2
Unity/Codes/HotfixView/Demo/FUI/Logic/Building/ConstructUpdate_RefreshWindow.cs

@ -8,7 +8,7 @@ namespace ET
protected override void Run(ConstructUpdate args)
{
var prepareBuildingWin = FUIComponent.Instance.GetWindow(FUI_PrepareBuildingWindow.UIResName) as FUIPrepareBuildingWindowComponent;
prepareBuildingWin.ShowInfo(args.Construct);
prepareBuildingWin?.ShowInfo(args.Construct);
}
}
}

2
Unity/Codes/HotfixView/Demo/FUI/Logic/Building/FUIBuildingSelectWorkerWindowComponentSystem.cs

@ -66,7 +66,7 @@ namespace ET
int behave = people.GetBehaveType();
long behaveTargetId = people.GetTargetId();
item.SetStateMsg(PeopleViewHelper.GetPeopleStateMsg(behave));
item.SetStateMsg(TextHelper.GetPeopleStateMsg(behave));
// check worker
if (behave != ConstBehaveType.BEHAVE_IDLE)
{

342
Unity/Codes/HotfixView/Demo/FUI/Logic/Building/FUIFarmlandWindowComponentSystem.cs

@ -0,0 +1,342 @@
/** This is an automatically generated class by FairyGUI. Please do not modify it. **/
using System.Collections.Generic;
using ET.FUIResource;
using FairyGUI;
using UnityEngine;
namespace ET
{
using FUIBuilding;
public class FUIFarmlandWindowComponentAwakeSystem : AwakeSystem<FUIFarmlandWindowComponent>
{
public override void Awake(FUIFarmlandWindowComponent self)
{
self.Awake();
}
}
[FriendClass(typeof(Unit))]
[FriendClass(typeof(Farmland))]
[FriendClass(typeof(People))]
public static partial class FUIFarmlandWindowComponentSystem
{
public static void Awake(this FUIFarmlandWindowComponent self)
{
self.FUIFarmlandWindow = self.Parent.GetComponent<FUI_FarmlandWindow>();
self.Window = new Window();
self.Window.contentPane = self.FUIFarmlandWindow.FGComp;
UIObjectFactory.SetPackageItemExtension(FUIPackage.Building_PlantSeedItem, typeof(PlantSeedItem));
// events
self.FUIFarmlandWindow.m_PlantSeedList.onClickItem.Add(self.OnSeedItemClick);
self.FUIFarmlandWindow.m_ConfirmSeedButton.FGComp.AddClickListenerAsync(self.OnSeedConfirmButtonClick);
self.FUIFarmlandWindow.m_WFP_FarmerIconButton.FGComp.onClick.Add(self.OnAddPlantPeopleButtonClick);
self.FUIFarmlandWindow.m_AddPlantPeopleButton.FGComp.onClick.Add(self.OnAddPlantPeopleButtonClick);
self.FUIFarmlandWindow.m_GrowSpeedUpButton.FGComp.AddClickListenerAsync(self.OnGrowSpeedUpButtonClick);
self.FUIFarmlandWindow.m_Harvest_FarmerIconButton.FGComp.onClick.Add(self.OnHarvestButtonClick);
self.FUIFarmlandWindow.m_HarvestButton.FGComp.onClick.Add(self.OnHarvestButtonClick);
self.FUIFarmlandWindow.m_RemoveButton.FGComp.onClick.Add(self.OnRemoveButtonClick);
self.FUIFarmlandWindow.m_CloseButton.FGComp.onClick.Add(self.OnCloseButtonClick);
}
public static void ShowInfo(this FUIFarmlandWindowComponent self, Building building)
{
self.Building = building;
self.Farmland = self.Building.GetChildByType<Farmland>();
if (self.Farmland == null)
{
Log.Error($"Building [{self.Building.Id}] doesn't have a Farmland");
return;
}
self.FUIFarmlandWindow.m_farmlandState.selectedIndex = self.Farmland.FarmlandState;
switch (self.Farmland.FarmlandState)
{
case FarmlandState.FARMLAND_STATE_FREE:
self.ShowSeedPanel();
break;
case FarmlandState.FARMLAND_STATE_SEED:
self.ShowWaitForPlantPanel();
break;
case FarmlandState.FARMLAND_STATE_GROW:
self.ShowGrowPanel();
break;
case FarmlandState.FARMLAND_STATE_RIPE:
self.ShowHarvestPanel();
break;
}
}
public static void Refresh(this FUIFarmlandWindowComponent self)
{
self.ShowInfo(self.Building);
}
// 当农田状态发生改变时,检查当前是否打开改变农田的界面,进行更新
public static void CheckToRefresh(this FUIFarmlandWindowComponent self, Farmland farmland)
{
if (self.Farmland == farmland)
{
self.Refresh();
}
}
public static void ShowSeedPanel(this FUIFarmlandWindowComponent self)
{
self.FUIFarmlandWindow.m_SeedInfoPopup.Visible = false;
var list = self.FUIFarmlandWindow.m_PlantSeedList;
var cropConfigList = CropConfigCategory.Instance.GetList();
// 获取当前种子的数量
Unit unit = UnitHelper.GetMyUnitFromZoneScene(self.ZoneScene());
var storeComp = unit.GetComponent<StoreComponent>();
list.RemoveChildrenToPool();
for (int i = 0; i < cropConfigList.Count; i++)
{
CropConfig cropConfig = cropConfigList[i];
var item = (PlantSeedItem)list.AddItemFromPool();
item.data = cropConfig;
item.Name.text = cropConfig.Name;
item.Icon.url = cropConfig.CropPic;
var itemConfig = AllItemConfigCategory.Instance.Get(cropConfig.SeedNeed);
var curNum = storeComp.GetItemNum(itemConfig.Id);
// TODO: 暂时去掉季节判断
// if (!cropConfig.Season.Contains(unit.Season))
// {
// item.SetSeedState(SeedState.NOT_AVAILABLE);
// }
// else
if (curNum < cropConfig.SeedNum)
{
item.SetSeedState(SeedState.NOT_NOT_ENOUGH);
}
else
{
item.SetSeedState(SeedState.OK);
}
if (i == 0)
{
list.selectedIndex = 0;
self.SelectSeedItem(item);
}
}
}
public static void ShowWaitForPlantPanel(this FUIFarmlandWindowComponent self)
{
var cropConfig = self.Farmland.Config;
if (cropConfig == null)
{
return;
}
self.FUIFarmlandWindow.m_WaitForPlant_CropIcon.url = cropConfig.CropPic;
if (self.Farmland.PeopleId > 0)
{
self.FUIFarmlandWindow.m_hasPeople.selectedIndex = 1;
Unit unit = UnitHelper.GetMyUnitFromZoneScene(self.ZoneScene());
var peopleComp = unit.GetComponent<PeopleComponent>();
var people = peopleComp.GetChild<People>(self.Farmland.PeopleId);
self.FUIFarmlandWindow.m_WFP_FarmerIconButton.m_Icon.url = PeopleViewHelper.GetHeadIconUrlByGender(people.GetGender());
self.FUIFarmlandWindow.m_WFP_FarmerIconButton.m_Name.text = people.Name;
}
else
{
self.FUIFarmlandWindow.m_hasPeople.selectedIndex = 0;
}
}
public static void ShowGrowPanel(this FUIFarmlandWindowComponent self)
{
var cropConfig = self.Farmland.Config;
if (cropConfig == null)
{
return;
}
self.FUIFarmlandWindow.m_Grow_CropIcon.url = cropConfig.CropPic;
int day = GameUtil.GetDaysOfTime(cropConfig.GrowthCycle);
self.FUIFarmlandWindow.m_GrowText.text = TextHelper.GetGrowUpTimeText(day);
self.FUIFarmlandWindow.m_Grow_ProductionNum.text = cropConfig.BasicProduction.ToString();
}
public static void ShowHarvestPanel(this FUIFarmlandWindowComponent self)
{
var cropConfig = self.Farmland.Config;
if (cropConfig == null)
{
return;
}
self.FUIFarmlandWindow.m_Harvest_CropIcon.url = cropConfig.CropPic;
if (self.Farmland.PeopleId > 0)
{
self.FUIFarmlandWindow.m_hasPeople.selectedIndex = 1;
Unit unit = UnitHelper.GetMyUnitFromZoneScene(self.ZoneScene());
var peopleComp = unit.GetComponent<PeopleComponent>();
var people = peopleComp.GetChild<People>(self.Farmland.PeopleId);
self.FUIFarmlandWindow.m_Harvest_FarmerIconButton.m_Icon.url = PeopleViewHelper.GetHeadIconUrlByGender(people.GetGender());
self.FUIFarmlandWindow.m_Harvest_FarmerIconButton.m_Name.text = people.Name;
}
else
{
self.FUIFarmlandWindow.m_hasPeople.selectedIndex = 0;
}
}
public static void OnAddPlantPeopleButtonClick(this FUIFarmlandWindowComponent self)
{
self.SelectPlantPeople().Coroutine();
}
public static async ETTask SelectPlantPeople(this FUIFarmlandWindowComponent self)
{
var selectWorkerWin = FUIComponent.Instance.ShowWindow<FUI_SelectWorkerWindow, FUISelectWorkerWindowComponent>();
var workers = await selectWorkerWin.ShowAsync(1);
if (workers.Count <= 0)
{
return;
}
var workerId = workers[0];
if (workerId <= 0)
{
return;
}
Unit unit = UnitHelper.GetMyUnitFromZoneScene(self.ZoneScene());
var peopleComp = unit.GetComponent<PeopleComponent>();
var worker = peopleComp.GetChild<People>(workerId);
await FarmlandHelper.GoFarmlandPlant(unit, worker, self.Farmland);
self.Refresh();
}
public static void SelectSeedItem(this FUIFarmlandWindowComponent self, PlantSeedItem plantSeedItem)
{
var cropConfig = (CropConfig) plantSeedItem.data;
self.CurSelectCrop = cropConfig;
var itemConfig = AllItemConfigCategory.Instance.Get(cropConfig.SeedNeed);
// 获取当前种子的数量
Unit unit = UnitHelper.GetMyUnitFromZoneScene(self.ZoneScene());
var storeComp = unit.GetComponent<StoreComponent>();
var curNum = storeComp.GetItemNum(itemConfig.Id);
var popup = self.FUIFarmlandWindow.m_SeedInfoPopup;
popup.m_Name.text = cropConfig.Name;
popup.m_NeedNum.text = $"{curNum}/{cropConfig.SeedNum}";
string seasonStr = "";
int[] seasonArray = cropConfig.Season;
for (int i = 0; i < seasonArray.Length; i++)
{
seasonStr += TextHelper.GetSeasonText(seasonArray[i]);
if (seasonArray.Length > 1 && i < seasonArray.Length - 1)
{
seasonStr += ",";
}
}
popup.m_Season.text = seasonStr;
popup.m_GrowTime.text = cropConfig.GrowthCycle.ToString();
popup.Visible = true;
GRoot.inst.ShowPopup(popup.FGComp, plantSeedItem);
}
public static void OnSeedItemClick(this FUIFarmlandWindowComponent self, EventContext context)
{
var plantSeedItem = (PlantSeedItem) context.data;
self.SelectSeedItem(plantSeedItem);
}
public static async ETTask OnSeedConfirmButtonClick(this FUIFarmlandWindowComponent self)
{
Farmland farmland = self.Building.GetChildByType<Farmland>();
if (farmland == null)
{
Log.Error($"Building [{self.Building.Id}] dosen't have a Farmland");
return;
}
List<long> farmlandList = new List<long>();
farmlandList.Add(farmland.Id);
List<int> cropList = new List<int>();
cropList.Add(self.CurSelectCrop.Id);
Unit unit = UnitHelper.GetMyUnitFromZoneScene(self.ZoneScene());
int result = await FarmlandHelper.FarmlandSeed(unit, farmlandList, cropList);
if (result != ErrorCode.ERR_Success)
{
return;
}
self.SelectPlantPeople().Coroutine();
}
public static async ETTask OnGrowSpeedUpButtonClick(this FUIFarmlandWindowComponent self)
{
Unit unit = UnitHelper.GetMyUnitFromZoneScene(self.ZoneScene());
int result = await FarmlandHelper.FarmlandRipe(unit, self.Farmland.Id);
}
public static async ETTask SelectHarvestPeople(this FUIFarmlandWindowComponent self)
{
var selectWorkerWin = FUIComponent.Instance.ShowWindow<FUI_SelectWorkerWindow, FUISelectWorkerWindowComponent>();
var workers = await selectWorkerWin.ShowAsync(1);
if (workers.Count <= 0)
{
return;
}
var workerId = workers[0];
if (workerId <= 0)
{
return;
}
Unit unit = UnitHelper.GetMyUnitFromZoneScene(self.ZoneScene());
var peopleComp = unit.GetComponent<PeopleComponent>();
var worker = peopleComp.GetChild<People>(workerId);
await FarmlandHelper.GoFarmlandHarvest(unit, worker, self.Farmland);
self.Refresh();
}
public static void OnHarvestButtonClick(this FUIFarmlandWindowComponent self)
{
self.SelectHarvestPeople().Coroutine();
}
public static void OnRemoveButtonClick(this FUIFarmlandWindowComponent self)
{
if (self.Building == null)
{
return;
}
Unit unit = UnitHelper.GetMyUnitFromZoneScene(self.ZoneScene());
BuildingHelper.RemoveBuilding(unit, self.Building).Coroutine();
self.Window.Hide();
}
public static void OnCloseButtonClick(this FUIFarmlandWindowComponent self)
{
self.Window.Hide();
}
}
}

21
Unity/Codes/HotfixView/Demo/FUI/Logic/Building/FarmlandStateChanged_RefreshWindow.cs

@ -0,0 +1,21 @@
using ET.EventType;
using ET.FUIBuilding;
namespace ET
{
public class FarmlandStateChanged_RefreshWindow : AEvent<FarmlandStateChanged>
{
protected override void Run(FarmlandStateChanged args)
{
var winEntity = FUIComponent.Instance.GetWindow(FUI_FarmlandWindow.UIResName) ;
if (winEntity != null)
{
var farmlandWin = winEntity as FUIFarmlandWindowComponent;
if (farmlandWin.IsShowing)
{
farmlandWin.CheckToRefresh(args.Farmland);
}
}
}
}
}

2
Unity/Codes/HotfixView/Demo/FUI/Logic/Resource/FUISelectWorkerWindowComponentSystem.cs

@ -89,7 +89,7 @@ namespace ET
item.WorkingCheckBox.onClick.Remove(self.OnPeopleItemCheckBoxClick);
item.WorkingCheckBox.onClick.Add(self.OnPeopleItemCheckBoxClick);
int behave = people.GetBehaveType();
item.SetStateMsg(PeopleViewHelper.GetPeopleStateMsg(behave));
item.SetStateMsg(TextHelper.GetPeopleStateMsg(behave));
if (behave != ConstBehaveType.BEHAVE_IDLE)
{

4
Unity/Codes/HotfixView/Demo/People/AfterCreatePeople_AddComponent.cs

@ -11,8 +11,8 @@ namespace ET
var people = args.People;
var pvc = people.AddComponent<PeopleViewComponent>();
people.AddComponent<PeopleAnimatorComponent>();
PeopleViewHelper.CheckWork(people);
PeopleViewHelper.UpdateAnimatorByBehave(people);
people.CheckWork();
// PeopleViewHelper.UpdateAnimatorByBehave(people);
people.AddComponent<PeopleAIComponent>();
}
}

18
Unity/Codes/HotfixView/Demo/People/Behave/Behave_Construct.cs

@ -0,0 +1,18 @@
namespace ET.PeopleBehave
{
[Behave(ConstBehaveType.BEHAVE_CONSTRUCT)]
public class Behave_Construct: BehaveBase
{
public override void Handle(People people)
{
var pAnimator = people.GetComponent<PeopleAnimatorComponent>();
if (pAnimator == null)
{
return;
}
pAnimator.StopAll();
pAnimator.PlayAnimation(PeopleAnimEnum.Construct);
}
}
}

18
Unity/Codes/HotfixView/Demo/People/Behave/Behave_Gather.cs

@ -0,0 +1,18 @@
namespace ET.PeopleBehave
{
[Behave(ConstBehaveType.BEHAVE_GATHER)]
public class Behave_Gather : BehaveBase
{
public override void Handle(People people)
{
var pAnimator = people.GetComponent<PeopleAnimatorComponent>();
if (pAnimator == null)
{
return;
}
pAnimator.StopAll();
pAnimator.PlayAnimation(PeopleAnimEnum.Gather);
}
}
}

34
Unity/Codes/HotfixView/Demo/People/Behave/Behave_Harvest.cs

@ -0,0 +1,34 @@
namespace ET.PeopleBehave
{
[Behave(ConstBehaveType.BEHAVE_HARVEST)]
public class Behave_Harvest : BehaveBase
{
public override void Handle(People people)
{
PlayPlantAnim(people).Coroutine();
}
public async ETTask PlayPlantAnim(People people)
{
var pAnimator = people.GetComponent<PeopleAnimatorComponent>();
if (pAnimator == null)
{
return;
}
pAnimator.StopAll();
pAnimator.PlayAnimation(PeopleAnimEnum.Gather);
await TimerComponent.Instance.WaitAsync(3000);
Unit unit = UnitHelper.GetMyUnitFromZoneScene(people.ZoneScene());
var targetId = people.GetTargetId();
var farmland = unit.GetGrandChild<Farmland>(targetId);
if (farmland == null)
{
Log.Error($"Can't find farmland: ${targetId}");
return;
}
FarmlandHelper.FarmlandHarvest(unit, farmland, people).Coroutine();
}
}
}

18
Unity/Codes/HotfixView/Demo/People/Behave/Behave_Idle.cs

@ -0,0 +1,18 @@
namespace ET.PeopleBehave
{
[Behave(ConstBehaveType.BEHAVE_IDLE)]
public class Behave_Idle : BehaveBase
{
public override void Handle(People people)
{
var pAnimator = people.GetComponent<PeopleAnimatorComponent>();
if (pAnimator == null)
{
return;
}
pAnimator.StopAll();
pAnimator.PlayAnimation(PeopleAnimEnum.Idle);
}
}
}

34
Unity/Codes/HotfixView/Demo/People/Behave/Behave_Plant.cs

@ -0,0 +1,34 @@
namespace ET.PeopleBehave
{
[Behave(ConstBehaveType.BEHAVE_PLANT)]
public class Behave_Plant : BehaveBase
{
public override void Handle(People people)
{
PlayPlantAnim(people).Coroutine();
}
public async ETTask PlayPlantAnim(People people)
{
var pAnimator = people.GetComponent<PeopleAnimatorComponent>();
if (pAnimator == null)
{
return;
}
pAnimator.StopAll();
pAnimator.PlayAnimation(PeopleAnimEnum.Construct);
await TimerComponent.Instance.WaitAsync(3000);
Unit unit = UnitHelper.GetMyUnitFromZoneScene(people.ZoneScene());
var targetId = people.GetTargetId();
var farmland = unit.GetGrandChild<Farmland>(targetId);
if (farmland == null)
{
Log.Error($"Can't find farmland: ${targetId}");
return;
}
FarmlandHelper.FinishFarmlandPlant(unit, farmland, people).Coroutine();
}
}
}

42
Unity/Codes/HotfixView/Demo/People/Behave/Behave_Prepare_Construct.cs

@ -0,0 +1,42 @@
namespace ET.PeopleBehave
{
[Behave(ConstBehaveType.BEHAVE_PREPARE_CONSTRUCT)]
[FriendClass(typeof(Construct))]
public class Behave_Prepare_Construct : BehaveBase
{
public override void Handle(People people)
{
PeopleViewComponent pView = people.GetComponent<PeopleViewComponent>();
if (pView == null)
{
return;
}
Unit unit = UnitHelper.GetMyUnitFromZoneScene(people.ZoneScene());
long targetId = people.GetTargetId();
ConstructComponent cc = unit.GetComponent<ConstructComponent>();
if (cc != null)
{
Construct c = cc.GetChild<Construct>(targetId);
if (c != null)
{
if (c.PreparePeopleIdList.Contains(people.Id))
{
var cView = c.GetComponent<ConstructViewComponent>();
pView.MoveToPos(cView.GetWorkerPos(people.Id));
}
}
}
var pAnimator = people.GetComponent<PeopleAnimatorComponent>();
if (pAnimator == null)
{
return;
}
pAnimator.StopAll();
pAnimator.PlayAnimation(PeopleAnimEnum.Run);
}
}
}

42
Unity/Codes/HotfixView/Demo/People/Behave/Behave_Prepare_Gather.cs

@ -0,0 +1,42 @@
namespace ET.PeopleBehave
{
[Behave(ConstBehaveType.BEHAVE_PREPARE_GATHER)]
[FriendClass(typeof(Gather))]
[FriendClass(typeof(ResourcePoint))]
public class Behave_Prepare_Gather : BehaveBase
{
public override void Handle(People people)
{
PeopleViewComponent pView = people.GetComponent<PeopleViewComponent>();
if (pView == null)
{
return;
}
Unit unit = UnitHelper.GetMyUnitFromZoneScene(people.ZoneScene());
GatherComponent gc = unit.GetComponent<GatherComponent>();
Gather gather = gc?.GetGatherByPeopleId(people.Id);
if (gather != null && gather.PreparePeopleIdList.Contains(people.Id))
{
ResourcePointComponent rc = unit.GetComponent<ResourcePointComponent>();
var resource = rc.GetChild<ResourcePoint>(gather.ResPointId);
var resourceViewComp = resource.GetComponent<ResourceViewComponent>();
if (resourceViewComp == null)
{
Log.Error($"Can't find resourceViewComp of {resource.Id} : {resource.ConfigId}");
}
pView.MoveToPos(resourceViewComp.GetWorkerPos());
}
var pAnimator = people.GetComponent<PeopleAnimatorComponent>();
if (pAnimator == null)
{
return;
}
pAnimator.StopAll();
pAnimator.PlayAnimation(PeopleAnimEnum.Run);
}
}
}

41
Unity/Codes/HotfixView/Demo/People/Behave/Behave_Prepare_Harvest.cs

@ -0,0 +1,41 @@
namespace ET.PeopleBehave
{
[Behave(ConstBehaveType.BEHAVE_PREPARE_HARVEST)]
public class Behave_Prepare_Harvest : BehaveBase
{
public override void Handle(People people)
{
PeopleViewComponent pView = people.GetComponent<PeopleViewComponent>();
if (pView == null)
{
return;
}
Unit unit = UnitHelper.GetMyUnitFromZoneScene(people.ZoneScene());
// 为farmland
long targetId = people.GetTargetId();
var farmland = unit.GetGrandChild<Farmland>(targetId);
if (farmland != null)
{
Building building = farmland.GetParent<Building>();
if (building != null)
{
var bView = building.GetComponent<BuildingViewComponent>();
pView.MoveToPos(bView.GetWorkPos());
}
}
var pAnimator = people.GetComponent<PeopleAnimatorComponent>();
if (pAnimator == null)
{
return;
}
pAnimator.StopAll();
pAnimator.PlayAnimation(PeopleAnimEnum.Run);
}
}
}

42
Unity/Codes/HotfixView/Demo/People/Behave/Behave_Prepare_Plant.cs

@ -0,0 +1,42 @@
namespace ET.PeopleBehave
{
[Behave(ConstBehaveType.BEHAVE_PREPARE_PLANT)]
[FriendClass(typeof(Unit))]
public class Behave_Prepare_Plant : BehaveBase
{
public override void Handle(People people)
{
PeopleViewComponent pView = people.GetComponent<PeopleViewComponent>();
if (pView == null)
{
return;
}
Unit unit = UnitHelper.GetMyUnitFromZoneScene(people.ZoneScene());
// 为farmland
long targetId = people.GetTargetId();
var farmland = unit.GetGrandChild<Farmland>(targetId);
if (farmland != null)
{
Building building = farmland.GetParent<Building>();
if (building != null)
{
var bView = building.GetComponent<BuildingViewComponent>();
pView.MoveToPos(bView.GetWorkPos());
}
}
var pAnimator = people.GetComponent<PeopleAnimatorComponent>();
if (pAnimator == null)
{
return;
}
pAnimator.StopAll();
pAnimator.PlayAnimation(PeopleAnimEnum.Run);
}
}
}

55
Unity/Codes/HotfixView/Demo/People/Behave/PeopleBehaveComponent.cs

@ -0,0 +1,55 @@
using System;
using System.Linq;
namespace ET.PeopleBehave
{
public class PeopleBehaveComponentAwakeSystem: AwakeSystem<PeopleBehaveComponent>
{
public override void Awake(PeopleBehaveComponent self)
{
PeopleBehaveComponent.Instance = self;
self.Awake();
}
}
[FriendClass(typeof(PeopleBehaveComponent))]
public static class PeopleBehaveComponentSystem
{
public static void Awake(this PeopleBehaveComponent self)
{
var behaves = Game.EventSystem.GetTypes(typeof (BehaveAttribute));
foreach (var type in behaves)
{
object[] attrs = type.GetCustomAttributes(typeof (BehaveAttribute), false);
if (attrs.Length == 0)
{
continue;
}
BehaveAttribute behaveAttribute = attrs[0] as BehaveAttribute;
BehaveBase behave = Activator.CreateInstance(type) as BehaveBase;
self.AllBehaveDict.Add(behaveAttribute.BehaveID, behave);
}
}
public static void HandlePeopleBehave(this PeopleBehaveComponent self, People people)
{
int behaveId = people.GetBehaveType();
if (!self.AllBehaveDict.ContainsKey(behaveId))
{
return;
}
try
{
self.AllBehaveDict[behaveId].Handle(people);
}
catch (Exception e)
{
Log.Error(e);
throw;
}
}
}
}

3
Unity/Codes/HotfixView/Demo/People/BehaveTypeChanged_UpdateAnimator.cs

@ -7,7 +7,8 @@ namespace ET
protected override void Run(BehaveTypeChanged args)
{
People people = args.People;
PeopleViewHelper.UpdateAnimatorByBehave(people);
//PeopleViewHelper.UpdateAnimatorByBehave(people);
people.CheckWork();
}
}
}

82
Unity/Codes/HotfixView/Demo/People/PeopleViewHelper.cs

@ -1,4 +1,5 @@
using UnityEngine;
using ET.PeopleBehave;
using UnityEngine;
using UnityEngine.AI;
namespace ET
@ -18,85 +19,18 @@ namespace ET
return url;
}
public static void CheckWork(People people)
public static void CheckWork(this People self)
{
// 检查是否在采集资源的路上
Unit unit = UnitHelper.GetMyUnitFromZoneScene(people.ZoneScene());
PeopleViewComponent pView = people.GetComponent<PeopleViewComponent>();
int behave = people.GetBehaveType();
long targetId = people.GetTargetId();
switch (behave)
{
case ConstBehaveType.BEHAVE_IDLE:
break;
case ConstBehaveType.BEHAVE_PREPARE_GATHER:
GatherComponent gc = unit.GetComponent<GatherComponent>();
Gather gather = gc?.GetGatherByPeopleId(people.Id);
if (gather != null && gather.PreparePeopleIdList.Contains(people.Id))
{
ResourcePointComponent rc = unit.GetComponent<ResourcePointComponent>();
var resource = rc.GetChild<ResourcePoint>(gather.ResPointId);
var resourceViewComp = resource.GetComponent<ResourceViewComponent>();
if (resourceViewComp == null)
{
Log.Error($"Can't find resourceViewComp of {resource.Id} : {resource.ConfigId}");
}
pView.MoveToPos(resourceViewComp.GetWorkerPos());
}
break;
case ConstBehaveType.BEHAVE_PREPARE_CONSTRUCT:
ConstructComponent cc = unit.GetComponent<ConstructComponent>();
if (cc != null)
{
Construct c = cc.GetChild<Construct>(targetId);
if (c != null)
{
if (c.PreparePeopleIdList.Contains(people.Id))
{
var cView = c.GetComponent<ConstructViewComponent>();
pView.MoveToPos(cView.GetWorkerPos(people.Id));
}
}
}
break;
}
}
public static string GetPeopleStateMsg(int behaveType)
{
string msg = "未知";
switch (behaveType)
{
case ConstBehaveType.BEHAVE_IDLE:
msg = "空闲";
break;
case ConstBehaveType.BEHAVE_PREPARE_GATHER:
msg = "去采集的路上";
break;
case ConstBehaveType.BEHAVE_GATHER:
msg = "正在采集";
break;
case ConstBehaveType.BEHAVE_PREPARE_CONSTRUCT:
msg = "在去建造的路上";
break;
case ConstBehaveType.BEHAVE_CONSTRUCT:
msg = "正在建造";
break;
default:
Log.Error($"Unkown behaviour type:{behaveType}");
break;
}
return msg;
PeopleBehaveComponent.Instance?.HandlePeopleBehave(self);
}
public static void UpdateAnimatorByBehave(People people)
{
var pAnimator = people.GetComponent<PeopleAnimatorComponent>();
if (pAnimator == null)
{
return;
}
int behave = people.GetBehaveType();
switch (behave)
{

12
Unity/Codes/HotfixView/Demo/ResourceView/ResourceViewComponentSystem.cs

@ -146,12 +146,12 @@ namespace ET
var resource = resourceViewComponent.Resource;
// 如果有怪,则先进行打怪
if (resource.MonsterGroupId > 0)
{
Unit unit = UnitHelper.GetMyUnitFromZoneScene(self.ZoneScene());
BattleHelper.EnterBattle(unit, resource.MonsterGroupId, ConstBattleType.BATTLE_PVE).Coroutine();
return;
}
// if (resource.MonsterGroupId > 0)
// {
// Unit unit = UnitHelper.GetMyUnitFromZoneScene(self.ZoneScene());
// BattleHelper.EnterBattle(unit, resource.MonsterGroupId, ConstBattleType.BATTLE_PVE).Coroutine();
// return;
// }
var resourceWindowComp = self.ZoneScene().GetComponent<FUIComponent>().ShowWindow<FUI_ResourceWindow,FUIResourceWindowComponent>();
resourceWindowComp.ShowInfo(resource);

2
Unity/Codes/HotfixView/Demo/Scene/SceneChangeStart_AddComponent.cs

@ -1,3 +1,4 @@
using ET.PeopleBehave;
using FairyGUI;
using UnityEngine;
@ -37,6 +38,7 @@ namespace ET
currentScene.AddComponent<CameraComponent>();
currentScene.AddComponent<OperationComponent>();
currentScene.AddComponent<BattleSceneViewComponent>();
currentScene.AddComponent<PeopleBehaveComponent>();
Unit unit = UnitComponent.unit;

18
Unity/Codes/Model/Core/Object/Entity.cs

@ -612,6 +612,24 @@ namespace ET
this.children.TryGetValue(id, out Entity child);
return child as K;
}
public K GetChildByType<K>() where K : Entity
{
if (this.children == null)
{
return null;
}
foreach (var keyValuePair in this.children)
{
if (keyValuePair.Value is K)
{
return keyValuePair.Value as K;
}
}
return null;
}
public void RemoveComponent<K>() where K : Entity
{

0
Unity/Codes/Model/Demo/CommonEventType.cs → Unity/Codes/Model/Demo/Common/CommonEventType.cs

11
Unity/Codes/Model/Demo/Common/GameUtil.cs

@ -0,0 +1,11 @@
namespace ET
{
public static class GameUtil
{
// 传入真实时间,转化为游戏的天数
public static int GetDaysOfTime(float time)
{
return (int)time;
}
}
}

8
Unity/Codes/Model/Demo/ConstValue.cs

@ -126,9 +126,9 @@ namespace ET
public static class FarmlandState
{
public const int FARMLAND_STATE_FREE = 1;//空闲
public const int FARMLAND_STATE_SEED = 2; //播种
public const int FARMLAND_STATE_GROW = 3; //生长
public const int FARMLAND_STATE_RIPE = 4; //成熟
public const int FARMLAND_STATE_FREE = 0;//空闲
public const int FARMLAND_STATE_SEED = 1; //播种
public const int FARMLAND_STATE_GROW = 2; //生长
public const int FARMLAND_STATE_RIPE = 3; //成熟
}
}

5
Unity/Codes/Model/Demo/EventType.cs

@ -245,5 +245,10 @@ namespace ET
{
public People People;
}
public struct FarmlandStateChanged
{
public Farmland Farmland;
}
}
}

67
Unity/Codes/Model/Demo/Helper/TextHelper.cs

@ -0,0 +1,67 @@
namespace ET
{
public static class TextHelper
{
public static string GetSeasonText(int season)
{
switch (season)
{
case 1:
return "春";
case 2:
return "夏";
case 3:
return "秋";
case 4:
return "冬";
default:
return "";
}
}
public static string GetGrowUpTimeText(int day)
{
return $"[color=#00FF00]{day}[/color]日后成熟";
}
public static string GetPeopleStateMsg(int behaveType)
{
string msg = "未知";
switch (behaveType)
{
case ConstBehaveType.BEHAVE_IDLE:
msg = "空闲";
break;
case ConstBehaveType.BEHAVE_PREPARE_GATHER:
msg = "去采集的路上";
break;
case ConstBehaveType.BEHAVE_GATHER:
msg = "正在采集";
break;
case ConstBehaveType.BEHAVE_PREPARE_CONSTRUCT:
msg = "在去建造的路上";
break;
case ConstBehaveType.BEHAVE_CONSTRUCT:
msg = "正在建造";
break;
case ConstBehaveType.BEHAVE_PREPARE_PLANT:
msg = "去种植的路上";
break;
case ConstBehaveType.BEHAVE_PLANT:
msg = "种植中";
break;
case ConstBehaveType.BEHAVE_PREPARE_HARVEST:
msg = "去收获的路上";
break;
case ConstBehaveType.BEHAVE_HARVEST:
msg = "收获中";
break;
default:
Log.Error($"Unknown behaviour type:{behaveType}");
break;
}
return msg;
}
}
}

10
Unity/Codes/Model/Module/Message/ErrorCode.cs

@ -84,10 +84,10 @@ namespace ET
public const int ERR_CanNotFoundEnemy = 210101; //找不到对手
public const int ERR_CanNotFoundBattle = 210102; //找不到对手
public const int ERR_SkillNotCd = 210103; //技能还没CD
public const int ERR_SkillSpiritNoEnongh = 210204; //战意不够
public const int ERR_FighterSilence = 210205;//玩家被沉默了
public const int ERR_FighterConstraint = 210206; //玩家被禁锢了
public const int ERR_SkillNotFound = 210207; //没有该技能
public const int ERR_SkillSpiritNoEnongh = 210104; //战意不够
public const int ERR_FighterSilence = 210105;//玩家被沉默了
public const int ERR_FighterConstraint = 210106; //玩家被禁锢了
public const int ERR_SkillNotFound = 210107; //没有该技能
//210201-210322 种植相关
public const int ERR_FarmlandNotFree = 210201; //农场不是空闲
public const int ERR_PlantNotRipe = 210202; //农作物没有成熟
@ -95,6 +95,6 @@ namespace ET
public const int ERR_CropConfigNotFound = 210204;// 农场没有找到
public const int ERR_SeedNotEnough = 210205;// 农场没有找到
public const int ERR_FarmlandNotRipe = 210206;//没有成熟
public const int ERR_FarmlandNotSeed = 210206;//没有播种
public const int ERR_FarmlandNotSeed = 210207;//没有播种
}
}

85
Unity/Codes/ModelView/Demo/FUI/AutoGeneratedCode/Building/FUI_FarmlandWindow.cs

@ -0,0 +1,85 @@
/** This is an automatically generated class by FairyGUI. Please do not modify it. **/
using FairyGUI;
namespace ET
{
namespace FUIBuilding
{
[ComponentOf(typeof(FUI))]
public sealed class FUI_FarmlandWindow : Entity, IAwake, IDestroy
{
public static string UIPackageName = "Building";
public static string UIResName = "FarmlandWindow";
/// <summary>
/// {uiResName}的组件类型(GComponent、GButton、GProcessBar等),它们都是GObject的子类。
/// </summary>
public GComponent FGComp;
public Controller m_farmlandState;
public Controller m_hasPeople;
public GGraph m_n1;
public GList m_PlantSeedList;
public FUI_GreenButton m_ConfirmSeedButton;
public GGraph m_n3;
public FUI_SeedInfoPopup m_SeedInfoPopup;
public GGroup m_SeedPanel;
public GGraph m_n8;
public GGraph m_n10;
public GLoader m_WaitForPlant_CropIcon;
public GTextField m_n12;
public GTextField m_WaitForPlantText;
public GTextField m_n14;
public GTextField m_n15;
public FUI_IconButton m_WFP_FarmerIconButton;
public FUI_GreenButton m_AddPlantPeopleButton;
public GGroup m_WaitForPlantPanel;
public GGraph m_n18;
public GGraph m_n19;
public GLoader m_Grow_CropIcon;
public GTextField m_n21;
public GTextField m_GrowText;
public GTextField m_n23;
public GTextField m_Grow_ProductionNum;
public FUI_GreenButton m_GrowSpeedUpButton;
public GGroup m_GrowPanel;
public GGraph m_n27;
public GGraph m_n28;
public GLoader m_Harvest_CropIcon;
public GTextField m_n30;
public GTextField m_HarvestText;
public GTextField m_n32;
public GTextField m_Harvest_ProductionNum;
public FUI_GreenButton m_HarvestButton;
public FUI_IconButton m_Harvest_FarmerIconButton;
public GGroup m_HarvestPanel;
public FUI_GreenButton m_RemoveButton;
public FUI_GreenButton m_CloseButton;
public const string URL = "ui://2126z1eanrkau";
public bool Visible
{
get
{
if (FGComp == null)
{
return false;
}
return FGComp.visible;
}
set
{
if (FGComp == null)
{
return;
}
FGComp.visible = value;
}
}
}
}
}

48
Unity/Codes/ModelView/Demo/FUI/AutoGeneratedCode/Building/FUI_IconButton.cs

@ -0,0 +1,48 @@
/** This is an automatically generated class by FairyGUI. Please do not modify it. **/
using FairyGUI;
namespace ET
{
namespace FUIBuilding
{
[ComponentOf(typeof(FUI))]
public sealed class FUI_IconButton : Entity, IAwake, IDestroy
{
public static string UIPackageName = "Building";
public static string UIResName = "IconButton";
/// <summary>
/// {uiResName}的组件类型(GComponent、GButton、GProcessBar等),它们都是GObject的子类。
/// </summary>
public GButton FGComp;
public GLoader m_Icon;
public GTextField m_Name;
public const string URL = "ui://2126z1eaifd4x";
public bool Visible
{
get
{
if (FGComp == null)
{
return false;
}
return FGComp.visible;
}
set
{
if (FGComp == null)
{
return;
}
FGComp.visible = value;
}
}
}
}
}

55
Unity/Codes/ModelView/Demo/FUI/AutoGeneratedCode/Building/FUI_PlantSeedItem.cs

@ -0,0 +1,55 @@
/** This is an automatically generated class by FairyGUI. Please do not modify it. **/
using FairyGUI;
namespace ET
{
namespace FUIBuilding
{
[ComponentOf(typeof(FUI))]
public sealed class FUI_PlantSeedItem : Entity, IAwake, IDestroy
{
public static string UIPackageName = "Building";
public static string UIResName = "PlantSeedItem";
/// <summary>
/// {uiResName}的组件类型(GComponent、GButton、GProcessBar等),它们都是GObject的子类。
/// </summary>
public GButton FGComp;
public Controller m_button;
public Controller m_state;
public GGraph m_n0;
public GGraph m_n1;
public GGraph m_n2;
public GLoader m_Icon;
public GTextField m_Name;
public GTextField m_n5;
public GTextField m_n6;
public const string URL = "ui://2126z1eanrkav";
public bool Visible
{
get
{
if (FGComp == null)
{
return false;
}
return FGComp.visible;
}
set
{
if (FGComp == null)
{
return;
}
FGComp.visible = value;
}
}
}
}
}

54
Unity/Codes/ModelView/Demo/FUI/AutoGeneratedCode/Building/FUI_SeedInfoPopup.cs

@ -0,0 +1,54 @@
/** This is an automatically generated class by FairyGUI. Please do not modify it. **/
using FairyGUI;
namespace ET
{
namespace FUIBuilding
{
[ComponentOf(typeof(FUI))]
public sealed class FUI_SeedInfoPopup : Entity, IAwake, IDestroy
{
public static string UIPackageName = "Building";
public static string UIResName = "SeedInfoPopup";
/// <summary>
/// {uiResName}的组件类型(GComponent、GButton、GProcessBar等),它们都是GObject的子类。
/// </summary>
public GComponent FGComp;
public GGraph m_n0;
public GGraph m_n1;
public GTextField m_Name;
public GTextField m_NeedNum;
public GTextField m_n4;
public GTextField m_n5;
public GTextField m_Season;
public GTextField m_GrowTime;
public const string URL = "ui://2126z1eanrkaw";
public bool Visible
{
get
{
if (FGComp == null)
{
return false;
}
return FGComp.visible;
}
set
{
if (FGComp == null)
{
return;
}
FGComp.visible = value;
}
}
}
}
}

4
Unity/Codes/ModelView/Demo/FUI/AutoGeneratedCode/Building/PackageBuilding.cs

@ -13,6 +13,7 @@ namespace ET
public const string Building_CheckButton = "ui://Building/CheckButton";
public const string Building_MaterialButton = "ui://Building/MaterialButton";
public const string Building_BuildingMaterialInfoPopup = "ui://Building/BuildingMaterialInfoPopup";
public const string Building_IconButton = "ui://Building/IconButton";
public const string Building_BuildingInfoWindow = "ui://Building/BuildingInfoWindow";
public const string Building_PrepareWorkerItem = "ui://Building/PrepareWorkerItem";
public const string Building_WorkerCancelButton = "ui://Building/WorkerCancelButton";
@ -23,6 +24,9 @@ namespace ET
public const string Building_BuildingWindow = "ui://Building/BuildingWindow";
public const string Building_BuildingItem = "ui://Building/BuildingItem";
public const string Building_GreenButton = "ui://Building/GreenButton";
public const string Building_FarmlandWindow = "ui://Building/FarmlandWindow";
public const string Building_PlantSeedItem = "ui://Building/PlantSeedItem";
public const string Building_SeedInfoPopup = "ui://Building/SeedInfoPopup";
public const string Building_WindowFrame = "ui://Building/WindowFrame";
public const string Building_PrepareBuildingWindow = "ui://Building/PrepareBuildingWindow";
public const string Building_DurabilityProgressBar = "ui://Building/DurabilityProgressBar";

39
Unity/Codes/ModelView/Demo/FUI/AutoGeneratedCode/Building/PlantSeedItem.cs

@ -0,0 +1,39 @@
/** This is an automatically generated class by FairyGUI. Please do not modify it. **/
using FairyGUI;
using FairyGUI.Utils;
namespace ET
{
namespace FUIBuilding
{
public partial class PlantSeedItem : GButton
{
public Controller button;
public Controller state;
public GGraph n0;
public GGraph n1;
public GGraph n2;
public GLoader Icon;
public GTextField Name;
public GTextField n5;
public GTextField n6;
public const string URL = "ui://2126z1eanrkav";
public override void ConstructFromXML(XML xml)
{
base.ConstructFromXML(xml);
button = GetControllerAt(0);
state = GetControllerAt(1);
n0 = (GGraph)GetChildAt(0);
n1 = (GGraph)GetChildAt(1);
n2 = (GGraph)GetChildAt(2);
Icon = (GLoader)GetChildAt(3);
Name = (GTextField)GetChildAt(4);
n5 = (GTextField)GetChildAt(5);
n6 = (GTextField)GetChildAt(6);
}
}
}
}

26
Unity/Codes/ModelView/Demo/FUI/Logic/Building/FUIFarmlandWindowComponent.cs

@ -0,0 +1,26 @@
/** This is an automatically generated class by FairyGUI. Please do not modify it. **/
namespace ET
{
using FUIBuilding;
using FairyGUI;
public class FUIFarmlandWindowComponent : Entity, IAwake, IDestroy, IFUIWindow
{
public Window Window { get; set; }
public FUI_FarmlandWindow FUIFarmlandWindow;
public Building Building;
public Farmland Farmland;
public CropConfig CurSelectCrop;
public bool IsShowing
{
get
{
return this.Window.isShowing;
}
}
}
}

37
Unity/Codes/ModelView/Demo/FUI/Logic/Building/PlantSeedItem.cs

@ -0,0 +1,37 @@
using UnityEditor.UI;
using UnityEngine;
namespace ET
{
namespace FUIBuilding
{
public enum SeedState
{
OK, // 满足所有条件
NOT_AVAILABLE, // 不可
NOT_NOT_ENOUGH, // 不足
}
public partial class PlantSeedItem
{
public void SetSeedState(SeedState seedState)
{
switch (seedState)
{
case SeedState.OK:
this.state.selectedIndex = 0;
this.Icon.color = Color.white;
break;
case SeedState.NOT_AVAILABLE:
this.state.selectedIndex = 1;
this.Icon.color = Color.gray;;
break;
case SeedState.NOT_NOT_ENOUGH:
this.state.selectedIndex = 2;
this.Icon.color = Color.gray;;
break;
}
}
}
}
}

18
Unity/Codes/ModelView/Demo/People/Behave/BehaveAttribute.cs

@ -0,0 +1,18 @@
using System;
namespace ET.PeopleBehave
{
[AttributeUsage(AttributeTargets.Class)]
public class BehaveAttribute: BaseAttribute
{
public int BehaveID
{
get;
}
public BehaveAttribute(int id)
{
this.BehaveID = id;
}
}
}

7
Unity/Codes/ModelView/Demo/People/Behave/BehaveBase.cs

@ -0,0 +1,7 @@
namespace ET.PeopleBehave
{
public abstract class BehaveBase
{
public abstract void Handle(People people);
}
}

11
Unity/Codes/ModelView/Demo/People/Behave/PeopleBehaveComponent.cs

@ -0,0 +1,11 @@
using System.Collections.Generic;
namespace ET.PeopleBehave
{
[ComponentOf(typeof(Scene))]
public class PeopleBehaveComponent: Entity, IAwake
{
public static PeopleBehaveComponent Instance { get; set; }
public Dictionary<int, BehaveBase> AllBehaveDict = new ();
}
}
Loading…
Cancel
Save