diff --git a/Assets/animations/test_anim_3.fbx b/Assets/animations/test_anim_3.fbx new file mode 100644 index 0000000..dee1faf --- /dev/null +++ b/Assets/animations/test_anim_3.fbx @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:93d6870f1aecee741fad71d21dc0672eab898adcfa798af70e67c339c56e1a7b +size 679388 diff --git a/Assets/animations/test_anim_4.fbx b/Assets/animations/test_anim_4.fbx new file mode 100644 index 0000000..981ff74 --- /dev/null +++ b/Assets/animations/test_anim_4.fbx @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:43bccb239c16d8c9a5519b8a219e095821700a842273d520a5df0ae8ef2ea8a6 +size 401836 diff --git a/Assets/animgraphs/custom_citizen.vanmgrph b/Assets/animgraphs/custom_citizen.vanmgrph index 5f8057f..3f93a60 100644 --- a/Assets/animgraphs/custom_citizen.vanmgrph +++ b/Assets/animgraphs/custom_citizen.vanmgrph @@ -33569,16 +33569,16 @@ { _class = "CSequenceAnimNode" m_sName = "Unnamed" - m_vecPosition = [ 6144.0, -880.0 ] + m_vecPosition = [ 6032.0, -992.0 ] m_nNodeID = { m_id = 1030023589 } m_sNote = "" m_tagSpans = [ ] - m_sequenceName = "test_anim_2" + m_sequenceName = "test_anim_4" m_playbackSpeed = 1.0 - m_bLoop = true + m_bLoop = false } }, { @@ -74354,14 +74354,14 @@ { _class = "CSequenceAnimNode" m_sName = "Unnamed" - m_vecPosition = [ 5952.0, -944.0 ] + m_vecPosition = [ 6064.0, -864.0 ] m_nNodeID = { m_id = 1952387107 } m_sNote = "" m_tagSpans = [ ] - m_sequenceName = "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" + m_sequenceName = "test_anim_3" m_playbackSpeed = 1.0 m_bLoop = true } diff --git a/Assets/fonts/Fontspring-DEMO-integralcf-bold.otf b/Assets/fonts/Fontspring-DEMO-integralcf-bold.otf new file mode 100644 index 0000000..236175c Binary files /dev/null and b/Assets/fonts/Fontspring-DEMO-integralcf-bold.otf differ diff --git a/Assets/fonts/Fontspring-DEMO-integralcf-boldoblique.otf b/Assets/fonts/Fontspring-DEMO-integralcf-boldoblique.otf new file mode 100644 index 0000000..f70cd07 Binary files /dev/null and b/Assets/fonts/Fontspring-DEMO-integralcf-boldoblique.otf differ diff --git a/Assets/fonts/Fontspring-DEMO-integralcf-demibold.otf b/Assets/fonts/Fontspring-DEMO-integralcf-demibold.otf new file mode 100644 index 0000000..4f248d3 Binary files /dev/null and b/Assets/fonts/Fontspring-DEMO-integralcf-demibold.otf differ diff --git a/Assets/fonts/Fontspring-DEMO-integralcf-demiboldoblique.otf b/Assets/fonts/Fontspring-DEMO-integralcf-demiboldoblique.otf new file mode 100644 index 0000000..02c715d Binary files /dev/null and b/Assets/fonts/Fontspring-DEMO-integralcf-demiboldoblique.otf differ diff --git a/Assets/fonts/Fontspring-DEMO-integralcf-extrabold.otf b/Assets/fonts/Fontspring-DEMO-integralcf-extrabold.otf new file mode 100644 index 0000000..b33201f Binary files /dev/null and b/Assets/fonts/Fontspring-DEMO-integralcf-extrabold.otf differ diff --git a/Assets/fonts/Fontspring-DEMO-integralcf-extraboldoblique.otf b/Assets/fonts/Fontspring-DEMO-integralcf-extraboldoblique.otf new file mode 100644 index 0000000..30a4ab0 Binary files /dev/null and b/Assets/fonts/Fontspring-DEMO-integralcf-extraboldoblique.otf differ diff --git a/Assets/fonts/Fontspring-DEMO-integralcf-heavy.otf b/Assets/fonts/Fontspring-DEMO-integralcf-heavy.otf new file mode 100644 index 0000000..88ec2d2 Binary files /dev/null and b/Assets/fonts/Fontspring-DEMO-integralcf-heavy.otf differ diff --git a/Assets/fonts/Fontspring-DEMO-integralcf-heavyoblique.otf b/Assets/fonts/Fontspring-DEMO-integralcf-heavyoblique.otf new file mode 100644 index 0000000..ea13d43 Binary files /dev/null and b/Assets/fonts/Fontspring-DEMO-integralcf-heavyoblique.otf differ diff --git a/Assets/fonts/Fontspring-DEMO-integralcf-medium.otf b/Assets/fonts/Fontspring-DEMO-integralcf-medium.otf new file mode 100644 index 0000000..ac31a55 Binary files /dev/null and b/Assets/fonts/Fontspring-DEMO-integralcf-medium.otf differ diff --git a/Assets/fonts/Fontspring-DEMO-integralcf-mediumoblique.otf b/Assets/fonts/Fontspring-DEMO-integralcf-mediumoblique.otf new file mode 100644 index 0000000..6ddd793 Binary files /dev/null and b/Assets/fonts/Fontspring-DEMO-integralcf-mediumoblique.otf differ diff --git a/Assets/fonts/Fontspring-DEMO-integralcf-regular.otf b/Assets/fonts/Fontspring-DEMO-integralcf-regular.otf new file mode 100644 index 0000000..920fa7e Binary files /dev/null and b/Assets/fonts/Fontspring-DEMO-integralcf-regular.otf differ diff --git a/Assets/fonts/Fontspring-DEMO-integralcf-regularoblique.otf b/Assets/fonts/Fontspring-DEMO-integralcf-regularoblique.otf new file mode 100644 index 0000000..abafc3a Binary files /dev/null and b/Assets/fonts/Fontspring-DEMO-integralcf-regularoblique.otf differ diff --git a/Assets/fonts/integralcf.txt b/Assets/fonts/integralcf.txt new file mode 100644 index 0000000..51dcead --- /dev/null +++ b/Assets/fonts/integralcf.txt @@ -0,0 +1 @@ +https://befonts.com/integral-cf-font-family.html \ No newline at end of file diff --git a/Assets/models/my_citizen/my_citizen.vmdl b/Assets/models/my_citizen/my_citizen.vmdl index 384a2ad..1222100 100644 --- a/Assets/models/my_citizen/my_citizen.vmdl +++ b/Assets/models/my_citizen/my_citizen.vmdl @@ -69,8 +69,8 @@ }, { _class = "AnimFile" - name = "test_anim_2" - activity_name = "test_anim_2" + name = "test_anim_3" + activity_name = "test_anim_3" activity_weight = 1 weight_list_name = "" fade_in_time = 0.2 @@ -83,7 +83,30 @@ disable_compression = false disable_interpolation = false enable_scale = false - source_filename = "animations/test_anim_2.fbx" + source_filename = "animations/test_anim_3.fbx" + start_frame = -1 + end_frame = -1 + framerate = -1.0 + take = 0 + reverse = false + }, + { + _class = "AnimFile" + name = "test_anim_4" + activity_name = "test_anim_4" + activity_weight = 1 + weight_list_name = "" + fade_in_time = 0.2 + fade_out_time = 0.2 + looping = false + delta = false + worldSpace = false + hidden = false + anim_markup_ordered = false + disable_compression = false + disable_interpolation = false + enable_scale = false + source_filename = "animations/test_anim_4.fbx" start_frame = -1 end_frame = -1 framerate = -1.0 diff --git a/Assets/prefabs/Player.prefab b/Assets/prefabs/Player.prefab index f01b018..5bf2091 100644 --- a/Assets/prefabs/Player.prefab +++ b/Assets/prefabs/Player.prefab @@ -102,27 +102,6 @@ "VectorGravity": "-97.97028,0,-844.3351", "WallTolerance": 1 }, - { - "__type": "Sandbox.SphereCollider", - "__guid": "ac941436-f43b-4bef-9171-fdee4422f354", - "Center": "0,0,44.79994", - "Friction": null, - "IsTrigger": true, - "OnComponentDestroy": null, - "OnComponentDisabled": null, - "OnComponentEnabled": null, - "OnComponentFixedUpdate": null, - "OnComponentStart": null, - "OnComponentUpdate": null, - "OnObjectTriggerEnter": null, - "OnObjectTriggerExit": null, - "OnTriggerEnter": null, - "OnTriggerExit": null, - "Radius": 8.499956, - "Static": false, - "Surface": null, - "SurfaceVelocity": "0,0,0" - }, { "__type": "Dedugan", "__guid": "c87cabbd-fbf9-4000-9d2c-77d476ae6692", @@ -208,6 +187,44 @@ "OnComponentFixedUpdate": null, "OnComponentStart": null, "OnComponentUpdate": null + }, + { + "__type": "Sandbox.ModelHitboxes", + "__guid": "75f1de36-d36a-4b4c-921a-67414eeae4bf", + "OnComponentDestroy": null, + "OnComponentDisabled": null, + "OnComponentEnabled": null, + "OnComponentFixedUpdate": null, + "OnComponentStart": null, + "OnComponentUpdate": null, + "Renderer": { + "_type": "component", + "component_id": "559de9a6-0eab-4676-99e4-9e6c3cdc2a95", + "go": "4ee14eb8-86a4-4742-8298-7492b7deccea", + "component_type": "SkinnedModelRenderer" + }, + "Target": null + }, + { + "__type": "Sandbox.SphereCollider", + "__guid": "e73e53b2-a335-4233-b811-f61b05c59b27", + "Center": "0,0,47.19997", + "Friction": null, + "IsTrigger": true, + "OnComponentDestroy": null, + "OnComponentDisabled": null, + "OnComponentEnabled": null, + "OnComponentFixedUpdate": null, + "OnComponentStart": null, + "OnComponentUpdate": null, + "OnObjectTriggerEnter": null, + "OnObjectTriggerExit": null, + "OnTriggerEnter": null, + "OnTriggerExit": null, + "Radius": 7.899954, + "Static": false, + "Surface": null, + "SurfaceVelocity": "0,0,0" } ], "Children": [ diff --git a/Assets/scenes/minimal.scene b/Assets/scenes/minimal.scene index ec4fe98..f8551e7 100644 --- a/Assets/scenes/minimal.scene +++ b/Assets/scenes/minimal.scene @@ -998,7 +998,6 @@ "Name": "Club", "Position": "0,0,5000", "Scale": "0.6,0.6,0.6", - "Enabled": true, "Components": [], "Children": [ { @@ -1208,7 +1207,11 @@ { "__type": "Teleporter", "__guid": "76f3c916-1052-42fd-9e9d-a7bad9f383d8", - "Building": null, + "Building": { + "_type": "gameobject", + "go": "ff3159db-f393-4632-a969-e9e8aeb61f68" + }, + "gravityType": "Down", "OnComponentDestroy": null, "OnComponentDisabled": null, "OnComponentEnabled": null, @@ -1223,48 +1226,6 @@ ], "Children": [] }, - { - "__guid": "a55f6065-4465-4520-937f-dbf7b3a3bb45", - "Flags": 0, - "Name": "NormalGravity", - "Position": "0,0,-421.6626", - "Enabled": true, - "Components": [ - { - "__type": "NormalGravityTrigger", - "__guid": "1161811e-33f7-42ef-a1ce-757a89db6b44", - "OnComponentDestroy": null, - "OnComponentDisabled": null, - "OnComponentEnabled": null, - "OnComponentFixedUpdate": null, - "OnComponentStart": null, - "OnComponentUpdate": null, - "TriggerOnEnter": false - }, - { - "__type": "Sandbox.BoxCollider", - "__guid": "c02dbc59-ccd8-4d25-b8ec-a40a1a2a217c", - "Center": "0,0,0", - "Friction": null, - "IsTrigger": true, - "OnComponentDestroy": null, - "OnComponentDisabled": null, - "OnComponentEnabled": null, - "OnComponentFixedUpdate": null, - "OnComponentStart": null, - "OnComponentUpdate": null, - "OnObjectTriggerEnter": null, - "OnObjectTriggerExit": null, - "OnTriggerEnter": null, - "OnTriggerExit": null, - "Scale": "2000,2000,1000", - "Static": true, - "Surface": null, - "SurfaceVelocity": "0,0,0" - } - ], - "Children": [] - }, { "__guid": "9ccdf814-1051-47e1-9735-75ba5aeddad8", "Flags": 0, @@ -2196,9 +2157,565 @@ "Children": [] } ] + }, + { + "__guid": "62f21cd0-bc18-43b6-aed4-905f28eb7dd6", + "Flags": 0, + "Name": "test_anim", + "Position": "98.93472,210.4744,-331.7082", + "Rotation": "0,0.000000000000001776357,0.9999999,0.00000003344307", + "Scale": "0.393735,0.393735,0.393735", + "Enabled": true, + "Components": [ + { + "__type": "Sandbox.SkinnedModelRenderer", + "__guid": "9aaa0e4a-8aa3-480f-8e2d-6fc9cae437e6", + "AnimationGraph": "animations/test/test_anim.vanmgrph", + "BodyGroups": 18446744073709551615, + "BoneMergeTarget": null, + "CreateAttachments": false, + "CreateBoneObjects": false, + "MaterialGroup": null, + "MaterialOverride": null, + "Model": "animations/test/test_anim.vmdl", + "Morphs": {}, + "OnComponentDestroy": null, + "OnComponentDisabled": null, + "OnComponentEnabled": null, + "OnComponentFixedUpdate": null, + "OnComponentStart": null, + "OnComponentUpdate": null, + "Parameters": { + "bools": { + "anim": false + }, + "ints": {}, + "floats": {}, + "vectors": {}, + "rotations": {} + }, + "PlaybackRate": 0.75, + "RenderOptions": { + "GameLayer": true, + "OverlayLayer": false, + "BloomLayer": false, + "AfterUILayer": false + }, + "RenderType": "On", + "Sequence": { + "Name": null, + "Looping": true + }, + "Tint": "1,1,1,1", + "UseAnimGraph": true + } + ], + "Children": [] + }, + { + "__guid": "16f2ad9d-9f85-4b59-a17f-a9bf0e29d84d", + "Flags": 0, + "Name": "Strip", + "Position": "78.80431,85.86729,-409.1845", + "Scale": "1.666667,1.666667,1.666667", + "Enabled": true, + "Components": [], + "Children": [ + { + "__guid": "e3a69197-6706-4b95-9b72-0eb6b7e10492", + "Flags": 0, + "Name": "Body", + "Enabled": true, + "Components": [ + { + "__type": "Sandbox.SkinnedModelRenderer", + "__guid": "22bf7556-93f3-40a0-9434-483cc9988fed", + "AnimationGraph": "animgraphs/custom_citizen.vanmgrph", + "BodyGroups": 341, + "BoneMergeTarget": null, + "CreateAttachments": false, + "CreateBoneObjects": false, + "MaterialGroup": null, + "MaterialOverride": null, + "Model": "models/citizen/citizen.vmdl", + "Morphs": {}, + "OnComponentDestroy": null, + "OnComponentDisabled": null, + "OnComponentEnabled": null, + "OnComponentFixedUpdate": null, + "OnComponentStart": null, + "OnComponentUpdate": null, + "Parameters": { + "bools": { + "test_dance": false, + "b_swim": true + }, + "ints": {}, + "floats": {}, + "vectors": {}, + "rotations": {} + }, + "PlaybackRate": 1, + "RenderOptions": { + "GameLayer": true, + "OverlayLayer": false, + "BloomLayer": false, + "AfterUILayer": false + }, + "RenderType": "On", + "Sequence": { + "Name": null, + "Looping": true + }, + "Tint": "1,1,1,1", + "UseAnimGraph": true + }, + { + "__type": "ClothingDresser", + "__guid": "7fc26f9b-6c82-451f-905b-61a9c6659322", + "OnComponentDestroy": null, + "OnComponentDisabled": null, + "OnComponentEnabled": null, + "OnComponentFixedUpdate": null, + "OnComponentStart": null, + "OnComponentUpdate": null + } + ], + "Children": [ + { + "__guid": "5fd6dcfd-f64e-46a4-b988-1ae4de1d0e0c", + "Flags": 0, + "Name": "Clothing - party_glasses", + "Tags": "clothing", + "Enabled": true, + "Components": [ + { + "__type": "Sandbox.SkinnedModelRenderer", + "__guid": "02f042cb-4486-46dc-9a98-b1d37b64e136", + "AnimationGraph": null, + "BodyGroups": 18446744073709551615, + "BoneMergeTarget": { + "_type": "component", + "component_id": "22bf7556-93f3-40a0-9434-483cc9988fed", + "go": "e3a69197-6706-4b95-9b72-0eb6b7e10492", + "component_type": "SkinnedModelRenderer" + }, + "CreateAttachments": false, + "CreateBoneObjects": false, + "MaterialGroup": null, + "MaterialOverride": null, + "Model": "models/citizen_clothes/glasses/party_glasses/mesh/party_glasses.vmdl", + "Morphs": {}, + "OnComponentDestroy": null, + "OnComponentDisabled": null, + "OnComponentEnabled": null, + "OnComponentFixedUpdate": null, + "OnComponentStart": null, + "OnComponentUpdate": null, + "Parameters": { + "bools": {}, + "ints": {}, + "floats": {}, + "vectors": {}, + "rotations": {} + }, + "PlaybackRate": 1, + "RenderOptions": { + "GameLayer": true, + "OverlayLayer": false, + "BloomLayer": false, + "AfterUILayer": false + }, + "RenderType": "On", + "Sequence": { + "Name": null, + "Looping": true + }, + "Tint": "1,1,1,1", + "UseAnimGraph": true + } + ], + "Children": [] + }, + { + "__guid": "cee2fd97-88e2-4358-99be-1a4cdd66d7f8", + "Flags": 0, + "Name": "Clothing - hair_long_bangs", + "Tags": "clothing", + "Enabled": true, + "Components": [ + { + "__type": "Sandbox.SkinnedModelRenderer", + "__guid": "f0a792d2-3f48-442f-834a-9f5a193c434c", + "AnimationGraph": null, + "BodyGroups": 18446744073709551615, + "BoneMergeTarget": { + "_type": "component", + "component_id": "22bf7556-93f3-40a0-9434-483cc9988fed", + "go": "e3a69197-6706-4b95-9b72-0eb6b7e10492", + "component_type": "SkinnedModelRenderer" + }, + "CreateAttachments": false, + "CreateBoneObjects": false, + "MaterialGroup": null, + "MaterialOverride": null, + "Model": "models/citizen_clothes/hair/hair_long_bangs/models/hair_long_bangs.vmdl", + "Morphs": {}, + "OnComponentDestroy": null, + "OnComponentDisabled": null, + "OnComponentEnabled": null, + "OnComponentFixedUpdate": null, + "OnComponentStart": null, + "OnComponentUpdate": null, + "Parameters": { + "bools": {}, + "ints": {}, + "floats": {}, + "vectors": {}, + "rotations": {} + }, + "PlaybackRate": 1, + "RenderOptions": { + "GameLayer": true, + "OverlayLayer": false, + "BloomLayer": false, + "AfterUILayer": false + }, + "RenderType": "On", + "Sequence": { + "Name": null, + "Looping": true + }, + "Tint": "1,1,1,1", + "UseAnimGraph": true + } + ], + "Children": [] + }, + { + "__guid": "3f6bacca-3843-4898-be28-4aaf5bfda1c3", + "Flags": 0, + "Name": "Clothing - slippers", + "Tags": "clothing", + "Enabled": true, + "Components": [ + { + "__type": "Sandbox.SkinnedModelRenderer", + "__guid": "457ffae2-4c85-46f5-80d6-107d573b699c", + "AnimationGraph": null, + "BodyGroups": 18446744073709551615, + "BoneMergeTarget": { + "_type": "component", + "component_id": "22bf7556-93f3-40a0-9434-483cc9988fed", + "go": "e3a69197-6706-4b95-9b72-0eb6b7e10492", + "component_type": "SkinnedModelRenderer" + }, + "CreateAttachments": false, + "CreateBoneObjects": false, + "MaterialGroup": null, + "MaterialOverride": null, + "Model": "models/citizen_clothes/shoes/slippers/models/slippers.vmdl", + "Morphs": {}, + "OnComponentDestroy": null, + "OnComponentDisabled": null, + "OnComponentEnabled": null, + "OnComponentFixedUpdate": null, + "OnComponentStart": null, + "OnComponentUpdate": null, + "Parameters": { + "bools": {}, + "ints": {}, + "floats": {}, + "vectors": {}, + "rotations": {} + }, + "PlaybackRate": 1, + "RenderOptions": { + "GameLayer": true, + "OverlayLayer": false, + "BloomLayer": false, + "AfterUILayer": false + }, + "RenderType": "On", + "Sequence": { + "Name": null, + "Looping": true + }, + "Tint": "1,1,1,1", + "UseAnimGraph": true + } + ], + "Children": [] + }, + { + "__guid": "42d2d426-9d40-42aa-b711-2d6d00f35244", + "Flags": 0, + "Name": "Clothing - simple_dress_blue", + "Tags": "clothing", + "Enabled": true, + "Components": [ + { + "__type": "Sandbox.SkinnedModelRenderer", + "__guid": "b6ab519a-70cf-458b-b95b-b1ab7e5d8449", + "AnimationGraph": null, + "BodyGroups": 18446744073709551615, + "BoneMergeTarget": { + "_type": "component", + "component_id": "22bf7556-93f3-40a0-9434-483cc9988fed", + "go": "e3a69197-6706-4b95-9b72-0eb6b7e10492", + "component_type": "SkinnedModelRenderer" + }, + "CreateAttachments": false, + "CreateBoneObjects": false, + "MaterialGroup": null, + "MaterialOverride": null, + "Model": "models/citizen_clothes/dress/simple_dress/models/simple_dress_blue.vmdl", + "Morphs": {}, + "OnComponentDestroy": null, + "OnComponentDisabled": null, + "OnComponentEnabled": null, + "OnComponentFixedUpdate": null, + "OnComponentStart": null, + "OnComponentUpdate": null, + "Parameters": { + "bools": {}, + "ints": {}, + "floats": {}, + "vectors": {}, + "rotations": {} + }, + "PlaybackRate": 1, + "RenderOptions": { + "GameLayer": true, + "OverlayLayer": false, + "BloomLayer": false, + "AfterUILayer": false + }, + "RenderType": "On", + "Sequence": { + "Name": null, + "Looping": true + }, + "Tint": "1,1,1,1", + "UseAnimGraph": true + } + ], + "Children": [] + }, + { + "__guid": "4f34337f-9a3a-4577-8c17-a958242a145a", + "Flags": 0, + "Name": "Clothing - boxing_gloves_blue", + "Tags": "clothing", + "Enabled": true, + "Components": [ + { + "__type": "Sandbox.SkinnedModelRenderer", + "__guid": "4f05e69a-828d-491b-b2b1-d29ddeb0195e", + "AnimationGraph": null, + "BodyGroups": 18446744073709551615, + "BoneMergeTarget": { + "_type": "component", + "component_id": "22bf7556-93f3-40a0-9434-483cc9988fed", + "go": "e3a69197-6706-4b95-9b72-0eb6b7e10492", + "component_type": "SkinnedModelRenderer" + }, + "CreateAttachments": false, + "CreateBoneObjects": false, + "MaterialGroup": null, + "MaterialOverride": null, + "Model": "models/citizen_clothes/gloves/boxing_gloves/models/boxing_gloves_blue.vmdl", + "Morphs": {}, + "OnComponentDestroy": null, + "OnComponentDisabled": null, + "OnComponentEnabled": null, + "OnComponentFixedUpdate": null, + "OnComponentStart": null, + "OnComponentUpdate": null, + "Parameters": { + "bools": {}, + "ints": {}, + "floats": {}, + "vectors": {}, + "rotations": {} + }, + "PlaybackRate": 1, + "RenderOptions": { + "GameLayer": true, + "OverlayLayer": false, + "BloomLayer": false, + "AfterUILayer": false + }, + "RenderType": "On", + "Sequence": { + "Name": null, + "Looping": true + }, + "Tint": "1,1,1,1", + "UseAnimGraph": true + } + ], + "Children": [] + }, + { + "__guid": "77e05105-bb0e-4f85-8d3a-01f97cfcb84c", + "Flags": 0, + "Name": "Clothing - plump_lips_03", + "Tags": "clothing", + "Enabled": true, + "Components": [ + { + "__type": "Sandbox.SkinnedModelRenderer", + "__guid": "d96f5988-ebbf-4d55-90eb-1fa621681cfe", + "AnimationGraph": null, + "BodyGroups": 18446744073709551615, + "BoneMergeTarget": { + "_type": "component", + "component_id": "22bf7556-93f3-40a0-9434-483cc9988fed", + "go": "e3a69197-6706-4b95-9b72-0eb6b7e10492", + "component_type": "SkinnedModelRenderer" + }, + "CreateAttachments": false, + "CreateBoneObjects": false, + "MaterialGroup": null, + "MaterialOverride": null, + "Model": "models/citizen_clothes/makeup/plump_lips/models/plump_lips_03.vmdl", + "Morphs": {}, + "OnComponentDestroy": null, + "OnComponentDisabled": null, + "OnComponentEnabled": null, + "OnComponentFixedUpdate": null, + "OnComponentStart": null, + "OnComponentUpdate": null, + "Parameters": { + "bools": {}, + "ints": {}, + "floats": {}, + "vectors": {}, + "rotations": {} + }, + "PlaybackRate": 1, + "RenderOptions": { + "GameLayer": true, + "OverlayLayer": false, + "BloomLayer": false, + "AfterUILayer": false + }, + "RenderType": "On", + "Sequence": { + "Name": null, + "Looping": true + }, + "Tint": "1,1,1,1", + "UseAnimGraph": true + } + ], + "Children": [] + }, + { + "__guid": "79dced14-3d0b-45a9-b726-c238e39d31c2", + "Flags": 0, + "Name": "Clothing - eye_makeup", + "Tags": "clothing", + "Enabled": true, + "Components": [ + { + "__type": "Sandbox.SkinnedModelRenderer", + "__guid": "393e9b23-b696-4b21-81fa-806306e30b58", + "AnimationGraph": null, + "BodyGroups": 18446744073709551615, + "BoneMergeTarget": { + "_type": "component", + "component_id": "22bf7556-93f3-40a0-9434-483cc9988fed", + "go": "e3a69197-6706-4b95-9b72-0eb6b7e10492", + "component_type": "SkinnedModelRenderer" + }, + "CreateAttachments": false, + "CreateBoneObjects": false, + "MaterialGroup": null, + "MaterialOverride": null, + "Model": "models/citizen_clothes/makeup/eye_makeup/models/eye_makeup.vmdl", + "Morphs": {}, + "OnComponentDestroy": null, + "OnComponentDisabled": null, + "OnComponentEnabled": null, + "OnComponentFixedUpdate": null, + "OnComponentStart": null, + "OnComponentUpdate": null, + "Parameters": { + "bools": {}, + "ints": {}, + "floats": {}, + "vectors": {}, + "rotations": {} + }, + "PlaybackRate": 1, + "RenderOptions": { + "GameLayer": true, + "OverlayLayer": false, + "BloomLayer": false, + "AfterUILayer": false + }, + "RenderType": "On", + "Sequence": { + "Name": null, + "Looping": true + }, + "Tint": "1,1,1,1", + "UseAnimGraph": true + } + ], + "Children": [] + } + ] + } + ] } ] }, + { + "__guid": "a55f6065-4465-4520-937f-dbf7b3a3bb45", + "Flags": 0, + "Name": "NormalGravity", + "Position": "0,0,4747.002", + "Scale": "0.6,0.6,0.6", + "Enabled": true, + "Components": [ + { + "__type": "NormalGravityTrigger", + "__guid": "1161811e-33f7-42ef-a1ce-757a89db6b44", + "OnComponentDestroy": null, + "OnComponentDisabled": null, + "OnComponentEnabled": null, + "OnComponentFixedUpdate": null, + "OnComponentStart": null, + "OnComponentUpdate": null, + "TriggerOnEnter": true + }, + { + "__type": "Sandbox.BoxCollider", + "__guid": "c02dbc59-ccd8-4d25-b8ec-a40a1a2a217c", + "Center": "0,0,0", + "Friction": null, + "IsTrigger": true, + "OnComponentDestroy": null, + "OnComponentDisabled": null, + "OnComponentEnabled": null, + "OnComponentFixedUpdate": null, + "OnComponentStart": null, + "OnComponentUpdate": null, + "OnObjectTriggerEnter": null, + "OnObjectTriggerExit": null, + "OnTriggerEnter": null, + "OnTriggerExit": null, + "Scale": "2000,2000,1000", + "Static": true, + "Surface": null, + "SurfaceVelocity": "0,0,0" + } + ], + "Children": [] + }, { "__guid": "285c9910-d341-4fa0-9e80-c89a2e31f4cb", "Flags": 0, @@ -2256,7 +2773,11 @@ { "__type": "Teleporter", "__guid": "587a82f6-7821-40db-9fdc-e62d098430f0", - "Building": null, + "Building": { + "_type": "gameobject", + "go": "ff3159db-f393-4632-a969-e9e8aeb61f68" + }, + "gravityType": "Down", "OnComponentDestroy": null, "OnComponentDisabled": null, "OnComponentEnabled": null, @@ -2676,60 +3197,6 @@ } ], "Children": [] - }, - { - "__guid": "62f21cd0-bc18-43b6-aed4-905f28eb7dd6", - "Flags": 0, - "Name": "test_anim", - "Position": "69.22212,98.3616,4800.975", - "Rotation": "0,0.000000000000001776357,0.9999999,0.00000003344307", - "Scale": "0.236241,0.236241,0.236241", - "Enabled": true, - "Components": [ - { - "__type": "Sandbox.SkinnedModelRenderer", - "__guid": "9aaa0e4a-8aa3-480f-8e2d-6fc9cae437e6", - "AnimationGraph": "animations/test/test_anim.vanmgrph", - "BodyGroups": 18446744073709551615, - "BoneMergeTarget": null, - "CreateAttachments": false, - "CreateBoneObjects": false, - "MaterialGroup": null, - "MaterialOverride": null, - "Model": "animations/test/test_anim.vmdl", - "Morphs": {}, - "OnComponentDestroy": null, - "OnComponentDisabled": null, - "OnComponentEnabled": null, - "OnComponentFixedUpdate": null, - "OnComponentStart": null, - "OnComponentUpdate": null, - "Parameters": { - "bools": { - "anim": false - }, - "ints": {}, - "floats": {}, - "vectors": {}, - "rotations": {} - }, - "PlaybackRate": 0.75, - "RenderOptions": { - "GameLayer": true, - "OverlayLayer": false, - "BloomLayer": false, - "AfterUILayer": false - }, - "RenderType": "On", - "Sequence": { - "Name": null, - "Looping": true - }, - "Tint": "1,1,1,1", - "UseAnimGraph": true - } - ], - "Children": [] } ], "SceneProperties": { diff --git a/Assets/shaders/swb_sam_red_dot.shader b/Assets/shaders/swb_sam_red_dot.shader new file mode 100644 index 0000000..c3d8d59 --- /dev/null +++ b/Assets/shaders/swb_sam_red_dot.shader @@ -0,0 +1,261 @@ +//========================================================================================================================= +// Optional +//========================================================================================================================= +HEADER +{ + Description = "Glass Shader"; + Version = 3; +} + +//========================================================================================================================= +// Optional +//========================================================================================================================= +FEATURES +{ + #include "common/features.hlsl" + Feature( F_RENDER_SIGHTS_ONLY, 0..1, "Glass"); +} + +//========================================================================================================================= +// Optional +//========================================================================================================================= +MODES +{ + VrForward(); // Indicates this shader will be used for main rendering + ToolsVis( S_MODE_TOOLS_VIS ); // Ability to see in the editor + ToolsWireframe("vr_tools_wireframe.shader"); // Allows for mat_wireframe to work + ToolsShadingComplexity("tools_shading_complexity.shader"); // Shows how expensive drawing is in debug view + Depth( S_MODE_DEPTH ); +} + +//========================================================================================================================= +COMMON +{ + #include "common/shared.hlsl" +} + +//========================================================================================================================= + +struct VertexInput +{ + #include "common/vertexinput.hlsl" +}; + +//========================================================================================================================= + +struct PixelInput +{ + #include "common/pixelinput.hlsl" +}; + +//========================================================================================================================= + +VS +{ + #include "common/vertex.hlsl" + // + // Main + // + PixelInput MainVs(VS_INPUT i) + { + PixelInput o = ProcessVertex(i); + // Add your vertex manipulation functions here + return FinalizeVertex(o); + } +} + +//========================================================================================================================= + +PS +{ + // Combos ---------------------------------------------------------------------------------------------- + StaticCombo( S_MODE_DEPTH, 0..1, Sys(ALL) ); + StaticCombo( S_RENDER_SIGHTS_ONLY, F_RENDER_SIGHTS_ONLY, Sys(ALL) ); + DynamicCombo( D_MULTIVIEW_INSTANCING, 0..1, Sys(PC) ); + + // Transparency + #if (S_RENDER_SIGHTS_ONLY) + #define BLEND_MODE_ALREADY_SET + RenderState(BlendEnable, true); + RenderState(SrcBlend, SRC_ALPHA); + RenderState(DstBlend, INV_SRC_ALPHA); + #endif + + // Attributes ------------------------------------------------------------------------------------------ + + #include "common/pixel.hlsl" + + BoolAttribute(bWantsFBCopyTexture, !F_RENDER_SIGHTS_ONLY ); + BoolAttribute(translucent, true); + + CreateTexture2D( g_tFrameBufferCopyTexture ) < Attribute("FrameBufferCopyTexture"); SrgbRead( false ); Filter(MIN_MAG_MIP_LINEAR); AddressU( MIRROR ); AddressV( MIRROR ); > ; + CreateTexture2DMS( g_tSceneDepth ) < Attribute( "DepthBuffer" ); SrgbRead( false ); Filter( POINT ); AddressU( MIRROR ); AddressV( MIRROR ); >; + + // + // Blur and Refraction Settings + // + float g_flBlurAmount < Default(0.0f); Range(0.0f, 1.0f); UiGroup("Glass,10/10"); > ; + float g_flRefractionStrength < Default(1.005); Range(1.0, 1.1); UiGroup("Glass,10/20"); > ; + float g_flIridescence < Default(600.0); Range(0.0f, 1000.0); UiGroup("Glass,10/30"); > ; + float g_flIridescenceScale < Default(1.0); Range(0.0f, 10.0); UiGroup("Glass,10/30"); > ; + + float3 g_vSightLightColor < UiType( Color ); Default3(1.0, 1.0, 1.0); UiGroup("Glass,10/40"); > ; + float g_flSightDistanceScale < Default(1.0); Range(0.0, 20.0); UiGroup("Glass,10/50"); > ; + + // + // Overlay layer + // + CreateInputTexture2D(RedDot, Srgb, 8, "", "_color", "Sight Dot,10/10", Default3(0.0, 0.0, 0.0)); + CreateInputTexture2D(RedDot2, Srgb, 8, "", "_color", "Sight Dot,10/10", Default3(0.0, 0.0, 0.0)); + CreateInputTexture2D(RedDot3, Srgb, 8, "", "_color", "Sight Dot,10/10", Default3(0.0, 0.0, 0.0)); + CreateTexture2DWithoutSampler(g_tRedDot) < Channel(R, Box(RedDot), Linear); Channel(G, Box(RedDot2), Linear); Channel(B, Box(RedDot3), Linear); OutputFormat(BC7); SrgbRead(false); > ; + + float3 GetIridescence(float3 vCameraDirWs, float3 vNormalWs, float k) + { + const float3 c1 = float3(3.54585104, 2.93225262, 2.41593945); + const float3 x1 = float3(0.69549072, 0.49228336, 0.27699880); + const float3 y1 = float3(0.02312639, 0.15225084, 0.52607955); + + const float3 c2 = float3(3.90307140, 3.21182957, 3.96587128); + const float3 x2 = float3(0.11748627, 0.86755042, 0.66077860); + const float3 y2 = float3(0.84897130, 0.88445281, 0.73949448); + + float3 color = 0; + float NDotV = dot(vNormalWs, vCameraDirWs); + + [unroll] + for (int n = 1; n <= 8; n++) { + float wavelength = abs( NDotV ) * k / float(n); + float x = saturate( ( wavelength - 400.0f ) / 300.0f ); + + float3 col1 = saturate(1 - (c1 * (x - x1)) * (c1 * (x - x1)) - y1); + float3 col2 = saturate(1 - (c2 * (x - x2)) * (c2 * (x - x2)) - y2); + + color += col1 + col2; + } + + return color; + } + + // + // Main + // + float4 MainPs(PixelInput i) : SV_Target0 + { + Material m = Material::From(i); + + // Shadows + #if S_MODE_DEPTH + { + float flOpacity = CalcBRDFReflectionFactor(dot(-i.vNormalWs.xyz, g_vCameraDirWs.xyz), m.Roughness, 0.04).x; + + flOpacity = pow(flOpacity, 1.0f / 2.0f); + flOpacity = lerp(flOpacity, 0.75f, sqrt(m.Roughness)); // Glossiness + flOpacity = lerp(flOpacity, 1.0 - dot(-i.vNormalWs.xyz, g_vCameraDirWs.xyz), ( g_flRefractionStrength - 1.0f ) * 5.0f ); // Refraction + flOpacity = lerp(1.0f, flOpacity + 0.04f, length(m.Albedo)); // Albedo absorption + + OpaqueFadeDepth(flOpacity, i.vPositionSs.xy); + + return 1; + } + #endif + + m.Metalness = 0; // Glass is always non-metallic + + float3 vViewRayWs = normalize(i.vPositionWithOffsetWs.xyz); + float flNDotV = saturate(dot(-m.Normal, vViewRayWs)); + float3 vEnvBRDF = CalcBRDFReflectionFactor(flNDotV, m.Roughness, 0.04); + + float4 vDotColor; + + { + float4 vRefractionColor = 0; + + float flDepthPs = RemapValClamped( Tex2DMS( 1 - g_tSceneDepth, i.vPositionSs.xy, 0 ).r, g_flViewportMinZ, g_flViewportMaxZ, 0.0, 1.0); + float3 vRefractionWs = RecoverWorldPosFromProjectedDepthAndRay(flDepthPs, normalize(i.vPositionWithOffsetWs.xyz)) - g_vCameraPositionWs; + float flDistanceVs = distance(i.vPositionWithOffsetWs.xyz, vRefractionWs); + + float3 vRefractRayWs = refract(vViewRayWs, m.Normal, 1.0 / g_flRefractionStrength); + float3 vRefractWorldPosWs = i.vPositionWithOffsetWs.xyz + vRefractRayWs * flDistanceVs; + + float4 vPositionPs = Position4WsToPs(float4(vRefractWorldPosWs, 0)); + + float2 vPositionSs = vPositionPs.xy / vPositionPs.w; + vPositionSs = vPositionSs * 0.5 + 0.5; + + vPositionSs.y = 1.0 - vPositionSs.y; + + // + // Multiview + // + #if (D_MULTIVIEW_INSTANCING) + { + vPositionSs.x *= 0.5; + } + #endif + + float flAmount; + float3 vAlbedoTint = m.Albedo; + vAlbedoTint += GetIridescence( vViewRayWs, m.Normal, g_flIridescence ) * g_flIridescenceScale * m.Albedo; + + // + // Color and blur + // + { + flAmount = g_flBlurAmount * m.Roughness * (1.0 - (1.0 / flDistanceVs)); + + // Isotropic blur based on grazing angle + flAmount /= flNDotV; + + const int nNumMips = 7; + + float2 vUV = float2(vPositionSs) * g_vFrameBufferCopyInvSizeAndUvScale.zw; + + vRefractionColor = Tex2DLevel(g_tFrameBufferCopyTexture, vUV, sqrt(flAmount) * nNumMips); + } + + // Blend + { + m.Emission = lerp(vRefractionColor.xyz, 0.0f, vEnvBRDF); + m.Emission *= vAlbedoTint; + m.Albedo = 0; + } + + // Sight dot + { + float3 vRedDotColor = g_vSightLightColor * 20.0f; + + float3 vCameraToPosition = i.vPositionWithOffsetWs; + float3 vCameraDir = normalize( vCameraToPosition ); + + float flProjectDirOntoNormal = 1.0f / dot( vCameraDir, m.Normal ); + float flProjectA = -g_flSightDistanceScale * flProjectDirOntoNormal ; + + float flProjectDirOntoTangentU = dot( vCameraDir, i.vTangentUWs ) ; + float flProjectDirOntoTangentV = dot( vCameraDir, i.vTangentVWs ) ; + + float2 vRedDotUV = saturate( i.vTextureCoords.xy + ( flProjectA * 0.5 ) * float2( flProjectDirOntoTangentU, flProjectDirOntoTangentV ) ); + float2 vRedDotUV2 = saturate( i.vTextureCoords.xy + ( flProjectA * 1.1 ) * float2( flProjectDirOntoTangentU, flProjectDirOntoTangentV ) ); + float2 vRedDotUV3 = saturate( i.vTextureCoords.xy + ( flProjectA * 1.2 ) * float2( flProjectDirOntoTangentU, flProjectDirOntoTangentV ) ); + + float flRedDot = Tex2DLevelS(g_tRedDot, TextureFiltering, vRedDotUV, sqrt(flAmount) * 7 ).r; + flRedDot += Tex2DLevelS(g_tRedDot, TextureFiltering, vRedDotUV2, sqrt(flAmount) * 7 ).g; + flRedDot += Tex2DLevelS(g_tRedDot, TextureFiltering, vRedDotUV3, sqrt(flAmount) * 7 ).b; + + vDotColor = float4( flRedDot * vRedDotColor * vAlbedoTint, flRedDot ); + m.Emission = lerp(m.Emission, vDotColor.rgb, vDotColor.a ); + } + + #if S_MODE_TOOLS_VIS + m.Albedo = m.Emission; + m.Emission = 0; + #endif + } + + #if S_RENDER_SIGHTS_ONLY + return vDotColor; + #endif + + return ShadingModelStandard::Shade(i, m); + } +} \ No newline at end of file diff --git a/Assets/shaders/swb_sam_red_dot.shader_c b/Assets/shaders/swb_sam_red_dot.shader_c new file mode 100644 index 0000000..6ec0a38 Binary files /dev/null and b/Assets/shaders/swb_sam_red_dot.shader_c differ diff --git a/Code/Gravity/Teleporter.cs b/Code/Gravity/Teleporter.cs index 2e460fd..885993b 100644 --- a/Code/Gravity/Teleporter.cs +++ b/Code/Gravity/Teleporter.cs @@ -1,10 +1,20 @@ using Sandbox; - +public enum GravityType +{ + Down, + Circle +} public sealed class Teleporter : Component, Component.ITriggerListener { [Property] public GameObject ToPosGameObject { get; set; } [Property] public GameObject Building { get; set; } + // [Property] public bool ResetGravity { get; set; } = false; + // [Property] public bool NormalGravity { get; set; } = true; + + + + [Property] public GravityType gravityType { get; set; } = GravityType.Down; public void OnTriggerEnter( Collider other ) { @@ -17,7 +27,16 @@ public sealed class Teleporter : Component, Component.ITriggerListener Log.Info($"{otherEntity.Name} вошел в зону телепорта"); otherEntity.WorldPosition = ToPosGameObject.WorldPosition; - controller.OverrideGravity = Vector3.Down; + + if ( gravityType == GravityType.Circle ) + { + controller.OverrideGravity = Vector3.Zero; + } + + if ( gravityType == GravityType.Down ) + { + controller.OverrideGravity = Vector3.Down; + } controller.EyeAngles = new Angles( 0, ToPosGameObject.WorldRotation.Yaw(), 0 ).ToRotation(); controller.Renderer.LocalRotation = new Angles( 0, ToPosGameObject.WorldRotation.Yaw(), 0 ).ToRotation(); diff --git a/Code/Player/Dedugan.Animations.cs b/Code/Player/Dedugan.Animations.cs index 39fe98f..32a3f73 100644 --- a/Code/Player/Dedugan.Animations.cs +++ b/Code/Player/Dedugan.Animations.cs @@ -6,10 +6,9 @@ public sealed partial class Dedugan { if ( Network.IsOwner ) { - // IsDancing = Input.Down( "Dance" ); + IsDancing = Input.Down( "Dance" ); } - Log.Info(IsDancing); Renderer.Set( "test_dance", IsDancing ); } } diff --git a/Code/Player/RagdollController.cs b/Code/Player/RagdollController.cs index ac972b4..fa89435 100644 --- a/Code/Player/RagdollController.cs +++ b/Code/Player/RagdollController.cs @@ -4,6 +4,8 @@ public sealed class RagdollController : Component [Group("Setup"), Order(-100), Property] public ModelPhysics bodyPhysics { get; set; } [Group("Setup"), Order(-100), Property] public SkinnedModelRenderer bodyRenderer { get; set; } [Group("Config"), Order(0), Property] public bool isLocked { get; set; } + + // [Property] public Collider Collider; [Sync] public new bool Enabled @@ -14,6 +16,7 @@ public sealed class RagdollController : Component bodyPhysics.Enabled = value; bodyPhysics.MotionEnabled = value; bodyRenderer.UseAnimGraph = !value; + // Collider.Enabled = !value; if ( !value ) { @@ -23,6 +26,13 @@ public sealed class RagdollController : Component } } + // protected override void OnStart() + // { + // Collider = GetComponent(); + // + // Log.Info(Collider.Enabled); + // } + protected override void OnUpdate() { if ( Network.IsOwner ) diff --git a/Libraries/trend.clothing_dresser/.bin/manifest.json b/Libraries/trend.clothing_dresser/.bin/manifest.json new file mode 100644 index 0000000..63a1398 --- /dev/null +++ b/Libraries/trend.clothing_dresser/.bin/manifest.json @@ -0,0 +1,4 @@ +[ + "package.base", + "package.trend.clothing_dresser" +] \ No newline at end of file diff --git a/Libraries/trend.clothing_dresser/.bin/package.trend.clothing_dresser.cll b/Libraries/trend.clothing_dresser/.bin/package.trend.clothing_dresser.cll new file mode 100644 index 0000000..b93c10a Binary files /dev/null and b/Libraries/trend.clothing_dresser/.bin/package.trend.clothing_dresser.cll differ diff --git a/Libraries/trend.clothing_dresser/.bin/package.trend.clothing_dresser.xml b/Libraries/trend.clothing_dresser/.bin/package.trend.clothing_dresser.xml new file mode 100644 index 0000000..5bfc5af --- /dev/null +++ b/Libraries/trend.clothing_dresser/.bin/package.trend.clothing_dresser.xml @@ -0,0 +1,8 @@ + + + + package.trend.clothing_dresser + + + + diff --git a/Libraries/trend.clothing_dresser/.version b/Libraries/trend.clothing_dresser/.version new file mode 100644 index 0000000..87b3f54 --- /dev/null +++ b/Libraries/trend.clothing_dresser/.version @@ -0,0 +1 @@ +1.0.84525 \ No newline at end of file diff --git a/Libraries/trend.clothing_dresser/Code/ClothingDresser.cs b/Libraries/trend.clothing_dresser/Code/ClothingDresser.cs new file mode 100644 index 0000000..62f2b56 --- /dev/null +++ b/Libraries/trend.clothing_dresser/Code/ClothingDresser.cs @@ -0,0 +1,16 @@ + +using Sandbox; +using System.Collections.Generic; + +[Icon( "checkroom" )] +[Category( "Citizen" )] +public sealed class ClothingDresser : Component, Component.ExecuteInEditor +{ + public Dictionary EnabledClothing { get; set; } = new(); + + + protected override void OnUpdate() + { + + } +} diff --git a/Libraries/trend.clothing_dresser/Code/clothingdresser.csproj.user b/Libraries/trend.clothing_dresser/Code/clothingdresser.csproj.user new file mode 100644 index 0000000..88a5509 --- /dev/null +++ b/Libraries/trend.clothing_dresser/Code/clothingdresser.csproj.user @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/Libraries/trend.clothing_dresser/Editor/ClothesList.cs b/Libraries/trend.clothing_dresser/Editor/ClothesList.cs new file mode 100644 index 0000000..90595ed --- /dev/null +++ b/Libraries/trend.clothing_dresser/Editor/ClothesList.cs @@ -0,0 +1,182 @@ +using System.Collections.Generic; +using System.Linq; +using Editor; +using Sandbox; +using Application = Editor.Application; + +public class ClothesList : ListView +{ + private readonly ClothingDresser Dresser; + + + public ClothesList( Widget parent, ClothingDresser dresser, IEnumerable clothingFilter ) : base( parent ) + { + Instance = this; + + ItemContextMenu = ShowItemContext; + ItemClicked = OnItemClicked; + MinimumHeight = 500; + //ItemAlign = Sandbox.UI.Align.SpaceBetween; + + Dresser = dresser; + + ItemSize = new Vector2( 96, 114 ); + + if ( clothingFilter != null && clothingFilter.Any() ) + { + BuildItems( clothingFilter ); + } + } + + public static ClothesList Instance { get; private set; } + + protected void OnItemClicked( object obj ) + { + if ( obj is not Clothing entry ) + { + return; + } + + var citizen = Dresser.Components.Get(); + var asset = AssetSystem.FindByPath( entry.ResourcePath ); + + if ( Dresser.EnabledClothing.ContainsValue( entry ) ) + { + var clothingEntry = Dresser.EnabledClothing.Where( x => x.Value == entry ).FirstOrDefault(); + + clothingEntry.Key.Destroy(); + Dresser.EnabledClothing.Remove( clothingEntry.Key ); + return; + } + + if ( entry.SlotsUnder == Clothing.Slots.Skin ) + { + if ( entry.SkinMaterial != null && entry.EyesMaterial != null ) + { + citizen.SetMaterialOverride( Material.Load( entry.SkinMaterial ), "skin" ); + citizen.SetMaterialOverride( Material.Load( entry.EyesMaterial ), "eyes" ); + } + + return; + } + + var clonedClothing = Dresser.Scene.CreateObject(); + clonedClothing.Parent = Dresser.GameObject; + clonedClothing.Name = $"Clothing - {asset.Name}"; + + var cloth = clonedClothing.Components.Create(); + cloth.Model = Model.Load( entry.Model ); + + cloth.BoneMergeTarget = citizen; + cloth.Tags.Add( "clothing" ); + + //Log.Info( $"{cloth.GameObject.Id}, {entry.Title}" ); + Dresser?.EnabledClothing.Add( cloth.GameObject, entry ); + } + + private void ShowItemContext( object obj ) + { + if ( obj is not Clothing entry ) + { + return; + } + + var m = new Menu(); + + if ( Dresser.EnabledClothing.ContainsValue( entry ) ) + { + m.AddOption( "Remove Clothing", "checkroom", () => + { + var clothingEntry = Dresser.EnabledClothing.Where( x => x.Value == entry ).FirstOrDefault(); + + clothingEntry.Key.Destroy(); + Dresser.EnabledClothing.Remove( clothingEntry.Key ); + } ); + } + + m.AddOption( "Open In Editor", "edit", () => + { + var asset = AssetSystem.FindByPath( entry.ResourcePath ); + asset?.OpenInEditor(); + } ); + + m.OpenAt( Application.CursorPosition ); + } + + public void BuildItems( IEnumerable objects ) + { + SetItems( objects ); + } + + protected override void PaintItem( VirtualWidget item ) + { + var rect = item.Rect.Shrink( 0, 0, 0, 15 ); + + if ( item.Object is not Clothing clothing ) + { + return; + } + + Paint.Antialiasing = true; + Paint.TextAntialiasing = true; + + var asset = AssetSystem.FindByPath( clothing.ResourcePath ); + + if ( asset is null ) + { + Paint.SetDefaultFont(); + Paint.SetPen( Color.Red ); + Paint.DrawText( item.Rect.Shrink( 2 ), "" ); + return; + } + + if ( Dresser.EnabledClothing.ContainsValue( clothing ) ) + { + Paint.ClearPen(); + Paint.SetBrush( item.Hovered ? Theme.Red.WithAlpha( 0.10f ) : Theme.Green.WithAlpha( 0.10f ) ); + Paint.SetPen( item.Hovered ? Theme.Red.WithAlpha( 0.50f ) : Theme.Green.WithAlpha( 0.90f ) ); + Paint.DrawRect( item.Rect.Shrink( 2 ), 3 ); + } + + if ( Paint.HasMouseOver ) + { + Paint.SetBrush( Theme.Blue.WithAlpha( item.Selected ? 0.2f : 0.2f ) ); + Paint.ClearPen(); + Paint.DrawRect( item.Rect, 4 ); + } + + var pixmap = asset.GetAssetThumb(); + + Paint.ClearPen(); + Paint.SetBrush( Theme.White.WithAlpha( 0.01f ) ); + Paint.SetPen( Theme.White.WithAlpha( 0.05f ) ); + Paint.DrawRect( item.Rect.Shrink( 2 ), 3 ); + + Paint.Draw( item.Rect.Shrink( item.Hovered ? 2 : 6 ), pixmap ); + + + var textRect = rect.Shrink( 4 ); + textRect.Top = textRect.Top + 50; + textRect.Top = textRect.Top + 25; + + Paint.ClearPen(); + Paint.SetBrush( Theme.Black.WithAlpha( 0.5f ) ); + Paint.DrawRect( textRect, 0.0f ); + + Paint.Antialiasing = true; + + Paint.SetPen( Theme.White, 2.0f ); + Paint.ClearBrush(); + Paint.SetFont( "Roboto Condensed", 9, 700 ); + Paint.DrawText( textRect, clothing.Title ); + } + + protected override void OnPaint() + { + Paint.ClearPen(); + Paint.SetBrush( Theme.ControlBackground ); + Paint.DrawRect( LocalRect, 4 ); + + base.OnPaint(); + } +} diff --git a/Libraries/trend.clothing_dresser/Editor/ClothingDresserEditor.cs b/Libraries/trend.clothing_dresser/Editor/ClothingDresserEditor.cs new file mode 100644 index 0000000..ca5e6a2 --- /dev/null +++ b/Libraries/trend.clothing_dresser/Editor/ClothingDresserEditor.cs @@ -0,0 +1,116 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using Editor; +using Sandbox; +using Sandbox.UI; +using Button = Editor.Button; +using Checkbox = Editor.Checkbox; + +[CustomEditor( typeof(ClothingDresser) )] +public class ClothingDresserEditor : ComponentEditorWidget +{ + public ClothingDresserEditor( SerializedObject obj ) : base( obj ) + { + Layout = Layout.Column(); + Layout.Margin = new Margin( 15, 5 ); + + var tabBar = new SegmentedControl( this ); + tabBar.SetSizeMode( SizeMode.Flexible, SizeMode.CanShrink ); + tabBar.FixedHeight = 35f; + + var row = Layout.AddRow(); + row.Add( tabBar ); + + var categories = Enum.GetValues(); + + foreach ( var category in categories ) + { + tabBar.AddOption( category.ToString() ); + } + + tabBar.OnSelectedChanged += tab => + { + if ( tab == "None" ) + { + ClothesList.BuildItems( AllClothing ); + return; + } + + ClothesList.BuildItems( AllClothing.Where( x => x.Category.ToString() == tab ) ); + }; + + + var dresser = SerializedObject.Targets.FirstOrDefault() as ClothingDresser; + + var secondRow = Layout.AddRow(); + + Filter = new LineEdit(); + Filter.PlaceholderText = "Filter.."; + Filter.FixedHeight = 30f; + Filter.TextEdited += text => + { + if ( !string.IsNullOrEmpty( text ) ) + { + // Log.Info( text ); + SearchQuery = text; + ClothesList.BuildItems( AllClothing.Where( x => + x.Title.Contains( SearchQuery, StringComparison.OrdinalIgnoreCase ) ) ); + return; + } + + ClothesList.BuildItems( AllClothing ); + }; + + + var resetClothing = new Button( "Reset Clothing" ); + resetClothing.Icon = "refresh"; + resetClothing.Tint = new Color( 179, 72, 64 ); + resetClothing.SetStyles( "font-size: 13px; padding: 8px;" ); + + resetClothing.Clicked = () => + { + foreach ( var kv in dresser?.EnabledClothing ) + { + kv.Key.Destroy(); + } + + dresser?.EnabledClothing.Clear(); + }; + + var checkbox = new Checkbox(); + checkbox.SetStyles( "padding: 10px;" ); + checkbox.Text = "Show Enabled"; + checkbox.Toggled += () => + { + if ( checkbox.Value ) + { + ClothesList.BuildItems( AllClothing.Where( x => dresser.EnabledClothing.ContainsValue( x ) ) ); + } + else + { + ClothesList.BuildItems( AllClothing ); + } + }; + + secondRow.Margin = new Margin( 0, 10 ); + secondRow.Add( Filter ); + secondRow.Add( checkbox ); + secondRow.AddStretchCell(); + secondRow.Add( resetClothing ); + + ClothesList = new ClothesList( null, dresser, AllClothing ); + + var tlayout = Layout.AddColumn(); + tlayout.Spacing = 8; + tlayout.Add( ClothesList ); + } + + public static List AllClothing => ResourceLibrary.GetAll().ToList(); + + public static LineEdit Filter { get; set; } + + public ClothesList ClothesList { get; set; } + + public static string SearchQuery { get; set; } = string.Empty; +} diff --git a/Libraries/trend.clothing_dresser/UnitTests/LibraryTest.cs b/Libraries/trend.clothing_dresser/UnitTests/LibraryTest.cs new file mode 100644 index 0000000..c5cf360 --- /dev/null +++ b/Libraries/trend.clothing_dresser/UnitTests/LibraryTest.cs @@ -0,0 +1,18 @@ +using Sandbox; + +[TestClass] +public partial class LibraryTests +{ + [TestMethod] + public void SceneTest() + { + var scene = new Scene(); + using ( scene.Push() ) + { + var go = new GameObject(); + + Assert.AreEqual( 1, scene.Directory.GameObjectCount ); + } + } + +} diff --git a/Libraries/trend.clothing_dresser/UnitTests/UnitTest.cs b/Libraries/trend.clothing_dresser/UnitTests/UnitTest.cs new file mode 100644 index 0000000..1ae9250 --- /dev/null +++ b/Libraries/trend.clothing_dresser/UnitTests/UnitTest.cs @@ -0,0 +1,11 @@ +global using Microsoft.VisualStudio.TestTools.UnitTesting; + +[TestClass] +public class TestInit +{ + [AssemblyInitialize] + public static void ClassInitialize( TestContext context ) + { + Sandbox.Application.InitUnitTest(); + } +} diff --git a/Libraries/trend.clothing_dresser/clothingdresser.sbproj b/Libraries/trend.clothing_dresser/clothingdresser.sbproj new file mode 100644 index 0000000..239b1eb --- /dev/null +++ b/Libraries/trend.clothing_dresser/clothingdresser.sbproj @@ -0,0 +1,15 @@ +{ + "Title": "Clothing Dresser", + "Type": "library", + "Org": "trend", + "Ident": "clothing_dresser", + "Schema": 1, + "IncludeSourceFiles": false, + "Resources": null, + "PackageReferences": [], + "EditorReferences": null, + "IsWhitelistDisabled": false, + "Metadata": { + "CsProjName": "" + } +} \ No newline at end of file