├── ProjectSettings
├── ProjectVersion.txt
├── TagManager.asset
├── TimeManager.asset
├── AudioManager.asset
├── InputManager.asset
├── NavMeshAreas.asset
├── DynamicsManager.asset
├── EditorSettings.asset
├── GraphicsSettings.asset
├── NetworkManager.asset
├── ProjectSettings.asset
├── QualitySettings.asset
├── UnityAdsSettings.asset
├── Physics2DSettings.asset
├── ClusterInputManager.asset
├── EditorBuildSettings.asset
└── UnityConnectSettings.asset
├── 2017.png
├── README.md
├── Assets
├── GameSoul
│ ├── Scene
│ │ ├── Main.unity
│ │ └── Main.unity.meta
│ ├── UI
│ │ ├── Canvas_Paint.prefab
│ │ └── Canvas_Paint.prefab.meta
│ ├── Material
│ │ ├── ClearBrush.mat
│ │ ├── PaintBrush.mat
│ │ ├── ClearBrush.mat.meta
│ │ └── PaintBrush.mat.meta
│ ├── Texture
│ │ ├── UI
│ │ │ ├── Brush
│ │ │ │ ├── brush-0.png
│ │ │ │ ├── brush-1.png
│ │ │ │ ├── brush-2.png
│ │ │ │ ├── brush-3.png
│ │ │ │ ├── brush-4.png
│ │ │ │ ├── brush-5.png
│ │ │ │ ├── brush-0.png.meta
│ │ │ │ ├── brush-2.png.meta
│ │ │ │ ├── brush-1.png.meta
│ │ │ │ ├── brush-3.png.meta
│ │ │ │ ├── brush-4.png.meta
│ │ │ │ └── brush-5.png.meta
│ │ │ └── Brush.meta
│ │ └── UI.meta
│ ├── Scene.meta
│ ├── UI.meta
│ ├── Material.meta
│ ├── Scripts.meta
│ ├── Shader.meta
│ ├── Texture.meta
│ ├── Shader
│ │ ├── ClearBrush.shader.meta
│ │ ├── PaintBrush.shader.meta
│ │ ├── ClearBrush.shader
│ │ └── PaintBrush.shader
│ └── Scripts
│ │ ├── PaintView.cs.meta
│ │ └── PaintView.cs
└── GameSoul.meta
├── .gitignore
└── LICENSE
/ProjectSettings/ProjectVersion.txt:
--------------------------------------------------------------------------------
1 | m_EditorVersion: 2017.1.2f1
2 |
--------------------------------------------------------------------------------
/2017.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/coding2233/UnityPaint/HEAD/2017.png
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # UnityPaint
2 | ---
3 | 
--------------------------------------------------------------------------------
/Assets/GameSoul/Scene/Main.unity:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/coding2233/UnityPaint/HEAD/Assets/GameSoul/Scene/Main.unity
--------------------------------------------------------------------------------
/ProjectSettings/TagManager.asset:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/coding2233/UnityPaint/HEAD/ProjectSettings/TagManager.asset
--------------------------------------------------------------------------------
/ProjectSettings/TimeManager.asset:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/coding2233/UnityPaint/HEAD/ProjectSettings/TimeManager.asset
--------------------------------------------------------------------------------
/ProjectSettings/AudioManager.asset:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/coding2233/UnityPaint/HEAD/ProjectSettings/AudioManager.asset
--------------------------------------------------------------------------------
/ProjectSettings/InputManager.asset:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/coding2233/UnityPaint/HEAD/ProjectSettings/InputManager.asset
--------------------------------------------------------------------------------
/ProjectSettings/NavMeshAreas.asset:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/coding2233/UnityPaint/HEAD/ProjectSettings/NavMeshAreas.asset
--------------------------------------------------------------------------------
/Assets/GameSoul/UI/Canvas_Paint.prefab:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/coding2233/UnityPaint/HEAD/Assets/GameSoul/UI/Canvas_Paint.prefab
--------------------------------------------------------------------------------
/ProjectSettings/DynamicsManager.asset:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/coding2233/UnityPaint/HEAD/ProjectSettings/DynamicsManager.asset
--------------------------------------------------------------------------------
/ProjectSettings/EditorSettings.asset:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/coding2233/UnityPaint/HEAD/ProjectSettings/EditorSettings.asset
--------------------------------------------------------------------------------
/ProjectSettings/GraphicsSettings.asset:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/coding2233/UnityPaint/HEAD/ProjectSettings/GraphicsSettings.asset
--------------------------------------------------------------------------------
/ProjectSettings/NetworkManager.asset:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/coding2233/UnityPaint/HEAD/ProjectSettings/NetworkManager.asset
--------------------------------------------------------------------------------
/ProjectSettings/ProjectSettings.asset:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/coding2233/UnityPaint/HEAD/ProjectSettings/ProjectSettings.asset
--------------------------------------------------------------------------------
/ProjectSettings/QualitySettings.asset:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/coding2233/UnityPaint/HEAD/ProjectSettings/QualitySettings.asset
--------------------------------------------------------------------------------
/ProjectSettings/UnityAdsSettings.asset:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/coding2233/UnityPaint/HEAD/ProjectSettings/UnityAdsSettings.asset
--------------------------------------------------------------------------------
/Assets/GameSoul/Material/ClearBrush.mat:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/coding2233/UnityPaint/HEAD/Assets/GameSoul/Material/ClearBrush.mat
--------------------------------------------------------------------------------
/Assets/GameSoul/Material/PaintBrush.mat:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/coding2233/UnityPaint/HEAD/Assets/GameSoul/Material/PaintBrush.mat
--------------------------------------------------------------------------------
/ProjectSettings/Physics2DSettings.asset:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/coding2233/UnityPaint/HEAD/ProjectSettings/Physics2DSettings.asset
--------------------------------------------------------------------------------
/ProjectSettings/ClusterInputManager.asset:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/coding2233/UnityPaint/HEAD/ProjectSettings/ClusterInputManager.asset
--------------------------------------------------------------------------------
/ProjectSettings/EditorBuildSettings.asset:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/coding2233/UnityPaint/HEAD/ProjectSettings/EditorBuildSettings.asset
--------------------------------------------------------------------------------
/ProjectSettings/UnityConnectSettings.asset:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/coding2233/UnityPaint/HEAD/ProjectSettings/UnityConnectSettings.asset
--------------------------------------------------------------------------------
/Assets/GameSoul/Texture/UI/Brush/brush-0.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/coding2233/UnityPaint/HEAD/Assets/GameSoul/Texture/UI/Brush/brush-0.png
--------------------------------------------------------------------------------
/Assets/GameSoul/Texture/UI/Brush/brush-1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/coding2233/UnityPaint/HEAD/Assets/GameSoul/Texture/UI/Brush/brush-1.png
--------------------------------------------------------------------------------
/Assets/GameSoul/Texture/UI/Brush/brush-2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/coding2233/UnityPaint/HEAD/Assets/GameSoul/Texture/UI/Brush/brush-2.png
--------------------------------------------------------------------------------
/Assets/GameSoul/Texture/UI/Brush/brush-3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/coding2233/UnityPaint/HEAD/Assets/GameSoul/Texture/UI/Brush/brush-3.png
--------------------------------------------------------------------------------
/Assets/GameSoul/Texture/UI/Brush/brush-4.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/coding2233/UnityPaint/HEAD/Assets/GameSoul/Texture/UI/Brush/brush-4.png
--------------------------------------------------------------------------------
/Assets/GameSoul/Texture/UI/Brush/brush-5.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/coding2233/UnityPaint/HEAD/Assets/GameSoul/Texture/UI/Brush/brush-5.png
--------------------------------------------------------------------------------
/Assets/GameSoul/Scene/Main.unity.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 47327ba103081b34a88b128e6c724424
3 | timeCreated: 1511924158
4 | licenseType: Pro
5 | DefaultImporter:
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/Assets/GameSoul.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: cc065d236ef5c4147ab4797ceb4280b0
3 | folderAsset: yes
4 | timeCreated: 1511925143
5 | licenseType: Pro
6 | DefaultImporter:
7 | userData:
8 | assetBundleName:
9 | assetBundleVariant:
10 |
--------------------------------------------------------------------------------
/Assets/GameSoul/Material/ClearBrush.mat.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 54af7315d71ff5140b9d899166f8c2ab
3 | timeCreated: 1512006691
4 | licenseType: Pro
5 | NativeFormatImporter:
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/Assets/GameSoul/Material/PaintBrush.mat.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 5eb4be76793b7704688fa0e07550eeb9
3 | timeCreated: 1511931926
4 | licenseType: Pro
5 | NativeFormatImporter:
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/Assets/GameSoul/UI/Canvas_Paint.prefab.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: a6d88866cba5b3e4ba05944149010f52
3 | timeCreated: 1512021269
4 | licenseType: Pro
5 | NativeFormatImporter:
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/Assets/GameSoul/Scene.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 357758ed45c3a4347b090f9bfa9cc10d
3 | folderAsset: yes
4 | timeCreated: 1511924158
5 | licenseType: Pro
6 | DefaultImporter:
7 | userData:
8 | assetBundleName:
9 | assetBundleVariant:
10 |
--------------------------------------------------------------------------------
/Assets/GameSoul/UI.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: c2975bd6f2ca6574989d55201780c49f
3 | folderAsset: yes
4 | timeCreated: 1511925176
5 | licenseType: Pro
6 | DefaultImporter:
7 | userData:
8 | assetBundleName:
9 | assetBundleVariant:
10 |
--------------------------------------------------------------------------------
/Assets/GameSoul/Material.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: c03e435affd777c4daf441dac31394f1
3 | folderAsset: yes
4 | timeCreated: 1513476238
5 | licenseType: Pro
6 | DefaultImporter:
7 | userData:
8 | assetBundleName:
9 | assetBundleVariant:
10 |
--------------------------------------------------------------------------------
/Assets/GameSoul/Scripts.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 0cc07dbdd3a09724bb71cc13cb28557c
3 | folderAsset: yes
4 | timeCreated: 1511851054
5 | licenseType: Pro
6 | DefaultImporter:
7 | userData:
8 | assetBundleName:
9 | assetBundleVariant:
10 |
--------------------------------------------------------------------------------
/Assets/GameSoul/Shader.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 3fd66e219c206d04d84d567c8ec05590
3 | folderAsset: yes
4 | timeCreated: 1511927871
5 | licenseType: Pro
6 | DefaultImporter:
7 | userData:
8 | assetBundleName:
9 | assetBundleVariant:
10 |
--------------------------------------------------------------------------------
/Assets/GameSoul/Texture.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 86fbc7156ea963d4d81765fdb9fbeee4
3 | folderAsset: yes
4 | timeCreated: 1511923916
5 | licenseType: Pro
6 | DefaultImporter:
7 | userData:
8 | assetBundleName:
9 | assetBundleVariant:
10 |
--------------------------------------------------------------------------------
/Assets/GameSoul/Texture/UI.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: e76b4910299a7fa4a92bb9660dc1a3bf
3 | folderAsset: yes
4 | timeCreated: 1511923920
5 | licenseType: Pro
6 | DefaultImporter:
7 | userData:
8 | assetBundleName:
9 | assetBundleVariant:
10 |
--------------------------------------------------------------------------------
/Assets/GameSoul/Texture/UI/Brush.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: bf87e3ca02928dc4c93d54d1a672f067
3 | folderAsset: yes
4 | timeCreated: 1512013972
5 | licenseType: Pro
6 | DefaultImporter:
7 | userData:
8 | assetBundleName:
9 | assetBundleVariant:
10 |
--------------------------------------------------------------------------------
/Assets/GameSoul/Shader/ClearBrush.shader.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: b277b91ac69ead6418d2ec15d9aa3ff0
3 | timeCreated: 1512006393
4 | licenseType: Pro
5 | ShaderImporter:
6 | defaultTextures: []
7 | userData:
8 | assetBundleName:
9 | assetBundleVariant:
10 |
--------------------------------------------------------------------------------
/Assets/GameSoul/Shader/PaintBrush.shader.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: ac81738f1c673d3449c26ed2fd9ed949
3 | timeCreated: 1511927910
4 | licenseType: Pro
5 | ShaderImporter:
6 | defaultTextures: []
7 | userData:
8 | assetBundleName:
9 | assetBundleVariant:
10 |
--------------------------------------------------------------------------------
/Assets/GameSoul/Scripts/PaintView.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 9acbc1d110745bd4088bb0feca00ff18
3 | timeCreated: 1512021293
4 | licenseType: Pro
5 | MonoImporter:
6 | serializedVersion: 2
7 | defaultReferences: []
8 | executionOrder: 0
9 | icon: {instanceID: 0}
10 | userData:
11 | assetBundleName:
12 | assetBundleVariant:
13 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | /[Ll]ibrary/
2 | /[Tt]emp/
3 | /[Oo]bj/
4 | /[Bb]uild/
5 | /[Bb]uilds/
6 | /Assets/AssetStoreTools*
7 |
8 | # Visual Studio 2015 cache directory
9 | /.vs/
10 |
11 | # Autogenerated VS/MD/Consulo solution and project files
12 | ExportedObj/
13 | .consulo/
14 | *.csproj
15 | *.unityproj
16 | *.sln
17 | *.suo
18 | *.tmp
19 | *.user
20 | *.userprefs
21 | *.pidb
22 | *.booproj
23 | *.svd
24 | *.pdb
25 |
26 | # Unity3D generated meta files
27 | *.pidb.meta
28 |
29 | # Unity3D Generated File On Crash Reports
30 | sysinfo.txt
31 |
32 | # Builds
33 | *.apk
34 | *.unitypackage
35 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2017
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/Assets/GameSoul/Shader/ClearBrush.shader:
--------------------------------------------------------------------------------
1 | // Upgrade NOTE: replaced 'mul(UNITY_MATRIX_MVP,*)' with 'UnityObjectToClipPos(*)'
2 |
3 | Shader "Unlit/ClearBrush"
4 | {
5 | Properties
6 | {
7 | _MainTex ("Texture", 2D) = "white" {}
8 | }
9 | SubShader
10 | {
11 | Tags { "RenderType"="Opaque" }
12 | LOD 100
13 | ZTest Always Cull Off ZWrite Off Fog{ Mode Off }
14 | Blend One DstColor
15 | Pass
16 | {
17 | CGPROGRAM
18 | #pragma vertex vert
19 | #pragma fragment frag
20 |
21 | #include "UnityCG.cginc"
22 |
23 | struct appdata
24 | {
25 | float4 vertex : POSITION;
26 | float2 uv : TEXCOORD0;
27 | };
28 |
29 | struct v2f
30 | {
31 | float2 uv : TEXCOORD0;
32 | float4 vertex : SV_POSITION;
33 | };
34 |
35 | sampler2D _MainTex;
36 | float4 _MainTex_ST;
37 |
38 | v2f vert (appdata v)
39 | {
40 | v2f o;
41 | o.vertex = UnityObjectToClipPos(v.vertex);
42 | o.uv = TRANSFORM_TEX(v.uv, _MainTex);
43 | return o;
44 | }
45 |
46 | fixed4 frag (v2f i) : SV_Target
47 | {
48 | // sample the texture
49 | fixed4 col = tex2D(_MainTex, i.uv);
50 | col = 0;
51 | return col;
52 | }
53 | ENDCG
54 | }
55 | }
56 | }
57 |
--------------------------------------------------------------------------------
/Assets/GameSoul/Texture/UI/Brush/brush-0.png.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 7a9f296df5087ae45bacc46a0eb12af3
3 | timeCreated: 1511931958
4 | licenseType: Pro
5 | TextureImporter:
6 | fileIDToRecycleName: {}
7 | serializedVersion: 2
8 | mipmaps:
9 | mipMapMode: 0
10 | enableMipMap: 0
11 | linearTexture: 0
12 | correctGamma: 0
13 | fadeOut: 0
14 | borderMipMap: 0
15 | mipMapFadeDistanceStart: 1
16 | mipMapFadeDistanceEnd: 3
17 | bumpmap:
18 | convertToNormalMap: 0
19 | externalNormalMap: 0
20 | heightScale: 0.25
21 | normalMapFilter: 0
22 | isReadable: 0
23 | grayScaleToAlpha: 0
24 | generateCubemap: 0
25 | cubemapConvolution: 0
26 | cubemapConvolutionSteps: 7
27 | cubemapConvolutionExponent: 1.5
28 | seamlessCubemap: 0
29 | textureFormat: -3
30 | maxTextureSize: 512
31 | textureSettings:
32 | filterMode: 1
33 | aniso: 0
34 | mipBias: -1
35 | wrapMode: 1
36 | nPOTScale: 1
37 | lightmap: 0
38 | rGBM: 0
39 | compressionQuality: 50
40 | allowsAlphaSplitting: 0
41 | spriteMode: 0
42 | spriteExtrude: 1
43 | spriteMeshType: 1
44 | alignment: 0
45 | spritePivot: {x: 0.5, y: 0.5}
46 | spriteBorder: {x: 0, y: 0, z: 0, w: 0}
47 | spritePixelsToUnits: 3
48 | alphaIsTransparency: 1
49 | textureType: 5
50 | buildTargetSettings: []
51 | spriteSheet:
52 | serializedVersion: 2
53 | sprites: []
54 | outline: []
55 | spritePackingTag:
56 | userData:
57 | assetBundleName:
58 | assetBundleVariant:
59 |
--------------------------------------------------------------------------------
/Assets/GameSoul/Texture/UI/Brush/brush-2.png.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 55b73717ca6f430428018b88c48f1398
3 | timeCreated: 1512018767
4 | licenseType: Pro
5 | TextureImporter:
6 | fileIDToRecycleName: {}
7 | serializedVersion: 2
8 | mipmaps:
9 | mipMapMode: 0
10 | enableMipMap: 0
11 | linearTexture: 0
12 | correctGamma: 0
13 | fadeOut: 0
14 | borderMipMap: 0
15 | mipMapFadeDistanceStart: 1
16 | mipMapFadeDistanceEnd: 3
17 | bumpmap:
18 | convertToNormalMap: 0
19 | externalNormalMap: 0
20 | heightScale: 0.25
21 | normalMapFilter: 0
22 | isReadable: 0
23 | grayScaleToAlpha: 0
24 | generateCubemap: 0
25 | cubemapConvolution: 0
26 | cubemapConvolutionSteps: 7
27 | cubemapConvolutionExponent: 1.5
28 | seamlessCubemap: 0
29 | textureFormat: -3
30 | maxTextureSize: 128
31 | textureSettings:
32 | filterMode: -1
33 | aniso: 0
34 | mipBias: -1
35 | wrapMode: 1
36 | nPOTScale: 1
37 | lightmap: 0
38 | rGBM: 0
39 | compressionQuality: 50
40 | allowsAlphaSplitting: 0
41 | spriteMode: 0
42 | spriteExtrude: 1
43 | spriteMeshType: 1
44 | alignment: 0
45 | spritePivot: {x: 0.5, y: 0.5}
46 | spriteBorder: {x: 0, y: 0, z: 0, w: 0}
47 | spritePixelsToUnits: 100
48 | alphaIsTransparency: 1
49 | textureType: 5
50 | buildTargetSettings: []
51 | spriteSheet:
52 | serializedVersion: 2
53 | sprites: []
54 | outline: []
55 | spritePackingTag:
56 | userData:
57 | assetBundleName:
58 | assetBundleVariant:
59 |
--------------------------------------------------------------------------------
/Assets/GameSoul/Texture/UI/Brush/brush-1.png.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 2a02b95a8dc98974caa0c058e7346a43
3 | timeCreated: 1512018965
4 | licenseType: Pro
5 | TextureImporter:
6 | fileIDToRecycleName: {}
7 | serializedVersion: 2
8 | mipmaps:
9 | mipMapMode: 0
10 | enableMipMap: 0
11 | linearTexture: 0
12 | correctGamma: 0
13 | fadeOut: 0
14 | borderMipMap: 0
15 | mipMapFadeDistanceStart: 1
16 | mipMapFadeDistanceEnd: 3
17 | bumpmap:
18 | convertToNormalMap: 0
19 | externalNormalMap: 0
20 | heightScale: 0.25
21 | normalMapFilter: 0
22 | isReadable: 0
23 | grayScaleToAlpha: 0
24 | generateCubemap: 0
25 | cubemapConvolution: 0
26 | cubemapConvolutionSteps: 7
27 | cubemapConvolutionExponent: 1.5
28 | seamlessCubemap: 0
29 | textureFormat: -3
30 | maxTextureSize: 256
31 | textureSettings:
32 | filterMode: -1
33 | aniso: -1
34 | mipBias: -1
35 | wrapMode: 1
36 | nPOTScale: 1
37 | lightmap: 0
38 | rGBM: 0
39 | compressionQuality: 50
40 | allowsAlphaSplitting: 0
41 | spriteMode: 0
42 | spriteExtrude: 1
43 | spriteMeshType: 1
44 | alignment: 0
45 | spritePivot: {x: 0.5, y: 0.5}
46 | spriteBorder: {x: 0, y: 0, z: 0, w: 0}
47 | spritePixelsToUnits: 100
48 | alphaIsTransparency: 1
49 | textureType: 5
50 | buildTargetSettings: []
51 | spriteSheet:
52 | serializedVersion: 2
53 | sprites: []
54 | outline: []
55 | spritePackingTag:
56 | userData:
57 | assetBundleName:
58 | assetBundleVariant:
59 |
--------------------------------------------------------------------------------
/Assets/GameSoul/Texture/UI/Brush/brush-3.png.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: e4fb0cfaa8563b148b26727fb417cc55
3 | timeCreated: 1512016039
4 | licenseType: Pro
5 | TextureImporter:
6 | fileIDToRecycleName: {}
7 | serializedVersion: 2
8 | mipmaps:
9 | mipMapMode: 0
10 | enableMipMap: 0
11 | linearTexture: 0
12 | correctGamma: 0
13 | fadeOut: 0
14 | borderMipMap: 0
15 | mipMapFadeDistanceStart: 1
16 | mipMapFadeDistanceEnd: 3
17 | bumpmap:
18 | convertToNormalMap: 0
19 | externalNormalMap: 0
20 | heightScale: 0.25
21 | normalMapFilter: 0
22 | isReadable: 0
23 | grayScaleToAlpha: 0
24 | generateCubemap: 0
25 | cubemapConvolution: 0
26 | cubemapConvolutionSteps: 7
27 | cubemapConvolutionExponent: 1.5
28 | seamlessCubemap: 0
29 | textureFormat: -3
30 | maxTextureSize: 128
31 | textureSettings:
32 | filterMode: -1
33 | aniso: -1
34 | mipBias: -1
35 | wrapMode: 1
36 | nPOTScale: 1
37 | lightmap: 0
38 | rGBM: 0
39 | compressionQuality: 50
40 | allowsAlphaSplitting: 0
41 | spriteMode: 0
42 | spriteExtrude: 1
43 | spriteMeshType: 1
44 | alignment: 0
45 | spritePivot: {x: 0.5, y: 0.5}
46 | spriteBorder: {x: 0, y: 0, z: 0, w: 0}
47 | spritePixelsToUnits: 100
48 | alphaIsTransparency: 1
49 | textureType: 5
50 | buildTargetSettings: []
51 | spriteSheet:
52 | serializedVersion: 2
53 | sprites: []
54 | outline: []
55 | spritePackingTag:
56 | userData:
57 | assetBundleName:
58 | assetBundleVariant:
59 |
--------------------------------------------------------------------------------
/Assets/GameSoul/Texture/UI/Brush/brush-4.png.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: bb7062895ae545041bfa6f502be1f220
3 | timeCreated: 1512019505
4 | licenseType: Pro
5 | TextureImporter:
6 | fileIDToRecycleName: {}
7 | serializedVersion: 2
8 | mipmaps:
9 | mipMapMode: 0
10 | enableMipMap: 0
11 | linearTexture: 0
12 | correctGamma: 0
13 | fadeOut: 0
14 | borderMipMap: 0
15 | mipMapFadeDistanceStart: 1
16 | mipMapFadeDistanceEnd: 3
17 | bumpmap:
18 | convertToNormalMap: 0
19 | externalNormalMap: 0
20 | heightScale: 0.25
21 | normalMapFilter: 0
22 | isReadable: 0
23 | grayScaleToAlpha: 0
24 | generateCubemap: 0
25 | cubemapConvolution: 0
26 | cubemapConvolutionSteps: 7
27 | cubemapConvolutionExponent: 1.5
28 | seamlessCubemap: 0
29 | textureFormat: -3
30 | maxTextureSize: 2048
31 | textureSettings:
32 | filterMode: -1
33 | aniso: -1
34 | mipBias: -1
35 | wrapMode: 1
36 | nPOTScale: 1
37 | lightmap: 0
38 | rGBM: 0
39 | compressionQuality: 50
40 | allowsAlphaSplitting: 0
41 | spriteMode: 0
42 | spriteExtrude: 1
43 | spriteMeshType: 1
44 | alignment: 0
45 | spritePivot: {x: 0.5, y: 0.5}
46 | spriteBorder: {x: 0, y: 0, z: 0, w: 0}
47 | spritePixelsToUnits: 100
48 | alphaIsTransparency: 1
49 | textureType: 5
50 | buildTargetSettings: []
51 | spriteSheet:
52 | serializedVersion: 2
53 | sprites: []
54 | outline: []
55 | spritePackingTag:
56 | userData:
57 | assetBundleName:
58 | assetBundleVariant:
59 |
--------------------------------------------------------------------------------
/Assets/GameSoul/Texture/UI/Brush/brush-5.png.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 59e3dd86662cc434c9bf9c85b2d5f307
3 | timeCreated: 1512019780
4 | licenseType: Pro
5 | TextureImporter:
6 | fileIDToRecycleName: {}
7 | serializedVersion: 2
8 | mipmaps:
9 | mipMapMode: 0
10 | enableMipMap: 0
11 | linearTexture: 0
12 | correctGamma: 0
13 | fadeOut: 0
14 | borderMipMap: 0
15 | mipMapFadeDistanceStart: 1
16 | mipMapFadeDistanceEnd: 3
17 | bumpmap:
18 | convertToNormalMap: 0
19 | externalNormalMap: 0
20 | heightScale: 0.25
21 | normalMapFilter: 0
22 | isReadable: 0
23 | grayScaleToAlpha: 0
24 | generateCubemap: 0
25 | cubemapConvolution: 0
26 | cubemapConvolutionSteps: 7
27 | cubemapConvolutionExponent: 1.5
28 | seamlessCubemap: 0
29 | textureFormat: -3
30 | maxTextureSize: 2048
31 | textureSettings:
32 | filterMode: -1
33 | aniso: -1
34 | mipBias: -1
35 | wrapMode: 1
36 | nPOTScale: 1
37 | lightmap: 0
38 | rGBM: 0
39 | compressionQuality: 50
40 | allowsAlphaSplitting: 0
41 | spriteMode: 0
42 | spriteExtrude: 1
43 | spriteMeshType: 1
44 | alignment: 0
45 | spritePivot: {x: 0.5, y: 0.5}
46 | spriteBorder: {x: 0, y: 0, z: 0, w: 0}
47 | spritePixelsToUnits: 100
48 | alphaIsTransparency: 1
49 | textureType: 5
50 | buildTargetSettings: []
51 | spriteSheet:
52 | serializedVersion: 2
53 | sprites: []
54 | outline: []
55 | spritePackingTag:
56 | userData:
57 | assetBundleName:
58 | assetBundleVariant:
59 |
--------------------------------------------------------------------------------
/Assets/GameSoul/Shader/PaintBrush.shader:
--------------------------------------------------------------------------------
1 | // Upgrade NOTE: replaced 'mul(UNITY_MATRIX_MVP,*)' with 'UnityObjectToClipPos(*)'
2 |
3 | Shader "Unlit/PaintBrush"
4 | {
5 | Properties
6 | {
7 | _MainTex ("Texture", 2D) = "white" {}
8 | _BrushTex("Brush Texture",2D)= "white" {}
9 | _Color("Color",Color)=(1,1,1,1)
10 | _UV("UV",Vector)=(0,0,0,0)
11 | _Size("Size",Range(1,1000))=1
12 | }
13 | SubShader
14 | {
15 | Tags { "RenderType"="Transparent" }
16 | LOD 100
17 | ZTest Always Cull Off ZWrite Off Fog{ Mode Off }
18 | Blend SrcAlpha OneMinusSrcAlpha
19 | //Blend One DstColor
20 | Pass
21 | {
22 | CGPROGRAM
23 | #pragma vertex vert
24 | #pragma fragment frag
25 |
26 | #include "UnityCG.cginc"
27 |
28 | struct appdata
29 | {
30 | float4 vertex : POSITION;
31 | float2 uv : TEXCOORD0;
32 | };
33 |
34 | struct v2f
35 | {
36 | float2 uv : TEXCOORD0;
37 | float4 vertex : SV_POSITION;
38 | };
39 |
40 | sampler2D _MainTex;
41 | float4 _MainTex_ST;
42 | sampler2D _BrushTex;
43 | fixed4 _UV;
44 | float _Size;
45 | fixed4 _Color;
46 |
47 | v2f vert (appdata v)
48 | {
49 | v2f o;
50 | o.vertex = UnityObjectToClipPos(v.vertex);
51 | o.uv = TRANSFORM_TEX(v.uv, _MainTex);
52 | return o;
53 | }
54 |
55 | fixed4 frag (v2f i) : SV_Target
56 | {
57 | // sample the texture
58 | float size = _Size;
59 | float2 uv = i.uv + (0.5f/size);
60 | uv = uv - _UV.xy;
61 | uv *= size;
62 | fixed4 col = tex2D(_BrushTex,uv);
63 | col.rgb = 1;
64 | col *= _Color;
65 | return col;
66 | }
67 | ENDCG
68 | }
69 | }
70 | }
71 |
--------------------------------------------------------------------------------
/Assets/GameSoul/Scripts/PaintView.cs:
--------------------------------------------------------------------------------
1 | //-----------------------------------------------------------------------
2 | //
3 | // Copyright (c) codingworks. All rights reserved.
4 | //
5 | // codingworks
6 | // coding2233@163.com
7 | //
8 | //-----------------------------------------------------------------------
9 |
10 | using System.Collections;
11 | using System.Collections.Generic;
12 | using UnityEngine;
13 | using UnityEngine.EventSystems;
14 | using UnityEngine.UI;
15 |
16 |
17 | public class PaintView : MonoBehaviour
18 | {
19 | #region 属性
20 |
21 | //绘图shader&material
22 | [SerializeField]
23 | private Shader _paintBrushShader;
24 | private Material _paintBrushMat;
25 | //清理renderTexture的shader&material
26 | [SerializeField]
27 | private Shader _clearBrushShader;
28 | private Material _clearBrushMat;
29 | //默认笔刷RawImage
30 | [SerializeField]
31 | private RawImage _defaultBrushRawImage;
32 | //默认笔刷&笔刷合集
33 | [SerializeField]
34 | private Texture _defaultBrushTex;
35 | //renderTexture
36 | private RenderTexture _renderTex;
37 | //默认笔刷RawImage
38 | [SerializeField]
39 | private Image _defaultColorImage;
40 | //绘画的画布
41 | [SerializeField]
42 | private RawImage _paintCanvas;
43 | //笔刷的默认颜色&颜色合集
44 | [SerializeField]
45 | private Color _defaultColor;
46 | //笔刷大小的slider
47 | private Text _brushSizeText;
48 | //笔刷的大小
49 | private float _brushSize;
50 | //屏幕的宽高
51 | private int _screenWidth;
52 | private int _screenHeight;
53 | //笔刷的间隔大小
54 | private float _brushLerpSize;
55 | //默认上一次点的位置
56 | private Vector2 _lastPoint;
57 | #endregion
58 |
59 | void Start()
60 | {
61 | InitData();
62 | }
63 |
64 | private void Update()
65 | {
66 | Color clearColor = new Color(0, 0, 0, 0);
67 | if (Input.GetKeyDown(KeyCode.Space))
68 | _paintBrushMat.SetColor("_Color", clearColor);
69 | }
70 |
71 |
72 | #region 外部接口
73 |
74 | public void SetBrushSize(float size)
75 | {
76 | _brushSize = size;
77 | _paintBrushMat.SetFloat("_Size", _brushSize);
78 | }
79 |
80 | public void SetBrushTexture(Texture texture)
81 | {
82 | _defaultBrushTex = texture;
83 | _paintBrushMat.SetTexture("_BrushTex", _defaultBrushTex);
84 | _defaultBrushRawImage.texture = _defaultBrushTex;
85 | }
86 |
87 | public void SetBrushColor(Color color)
88 | {
89 | _defaultColor = color;
90 | _paintBrushMat.SetColor("_Color", _defaultColor);
91 | _defaultColorImage.color = _defaultColor;
92 | }
93 | ///
94 | /// 选择颜色
95 | ///
96 | ///
97 | public void SelectColor(Image image)
98 | {
99 | SetBrushColor(image.color);
100 | }
101 | ///
102 | /// 选择笔刷
103 | ///
104 | ///
105 | public void SelectBrush(RawImage rawImage)
106 | {
107 | SetBrushTexture(rawImage.texture);
108 | }
109 | ///
110 | /// 设置笔刷大小
111 | ///
112 | ///
113 | public void BrushSizeChanged(Slider slider)
114 | {
115 | // float value = slider.maxValue + slider.minValue - slider.value;
116 | SetBrushSize(Remap(slider.value,300.0f,30.0f));
117 | if (_brushSizeText == null)
118 | {
119 | _brushSizeText=slider.transform.Find("Background/Text").GetComponent();
120 | }
121 | _brushSizeText.text = slider.value.ToString("f2");
122 | }
123 |
124 | ///
125 | /// 拖拽
126 | ///
127 | public void DragUpdate()
128 | {
129 | if (_renderTex && _paintBrushMat)
130 | {
131 |
132 | if (Input.GetMouseButton(0))
133 | LerpPaint(Input.mousePosition);
134 |
135 |
136 | }
137 | }
138 | ///
139 | /// 拖拽结束
140 | ///
141 | public void DragEnd()
142 | {
143 | if (Input.GetMouseButtonUp(0))
144 | _lastPoint = Vector2.zero;
145 | }
146 |
147 | #endregion
148 |
149 | #region 内部函数
150 |
151 | //初始化数据
152 | void InitData()
153 | {
154 | _brushSize = 300.0f;
155 | _brushLerpSize = (_defaultBrushTex.width + _defaultBrushTex.height) / 2.0f / _brushSize;
156 | _lastPoint = Vector2.zero;
157 |
158 | if (_paintBrushMat == null)
159 | {
160 | UpdateBrushMaterial();
161 | }
162 | if(_clearBrushMat==null)
163 | _clearBrushMat = new Material(_clearBrushShader);
164 | if (_renderTex == null)
165 | {
166 | _screenWidth = Screen.width;
167 | _screenHeight = Screen.height;
168 |
169 | _renderTex = RenderTexture.GetTemporary(_screenWidth, _screenHeight, 24);
170 | _paintCanvas.texture = _renderTex;
171 | }
172 | Graphics.Blit(null, _renderTex, _clearBrushMat);
173 | }
174 |
175 | //更新笔刷材质
176 | private void UpdateBrushMaterial()
177 | {
178 | _paintBrushMat = new Material(_paintBrushShader);
179 | _paintBrushMat.SetTexture("_BrushTex", _defaultBrushTex);
180 | _paintBrushMat.SetColor("_Color", _defaultColor);
181 | _paintBrushMat.SetFloat("_Size", _brushSize);
182 | }
183 |
184 | //插点
185 | private void LerpPaint(Vector2 point)
186 | {
187 | Paint(point);
188 |
189 | if (_lastPoint == Vector2.zero)
190 | {
191 | _lastPoint = point;
192 | return;
193 | }
194 |
195 | float dis = Vector2.Distance(point, _lastPoint);
196 | if (dis > _brushLerpSize)
197 | {
198 | Vector2 dir = (point - _lastPoint).normalized;
199 | int num = (int)(dis / _brushLerpSize);
200 | for (int i = 0; i < num; i++)
201 | {
202 | Vector2 newPoint = _lastPoint + dir * (i + 1) * _brushLerpSize;
203 | Paint(newPoint);
204 | }
205 | }
206 | _lastPoint = point;
207 | }
208 |
209 | //画点
210 | private void Paint(Vector2 point)
211 | {
212 | if (point.x < 0 || point.x > _screenWidth || point.y < 0 || point.y > _screenHeight)
213 | return;
214 |
215 | Vector2 uv = new Vector2(point.x / (float)_screenWidth,
216 | point.y / (float)_screenHeight);
217 | _paintBrushMat.SetVector("_UV", uv);
218 | Graphics.Blit(_renderTex, _renderTex, _paintBrushMat);
219 | }
220 | ///
221 | /// 重映射 默认 value 为1-100
222 | ///
223 | ///
224 | ///
225 | ///
226 | ///
227 | private float Remap(float value, float startValue, float enValue)
228 | {
229 | float returnValue = (value - 1.0f) / (100.0f - 1.0f);
230 | returnValue = (enValue - startValue) * returnValue + startValue;
231 | return returnValue;
232 | }
233 |
234 | #endregion
235 |
236 | }
237 |
--------------------------------------------------------------------------------