mirror of
				https://github.com/maxartz15/TextureCombiner.git
				synced 2025-11-04 07:15:49 +01:00 
			
		
		
		
	Init.
P4 -> GitHub sync.
This commit is contained in:
		
							
								
								
									
										5
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										5
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							@@ -14,13 +14,14 @@
 | 
			
		||||
!/[Aa]ssets/**/*.meta
 | 
			
		||||
 | 
			
		||||
# Uncomment this line if you wish to ignore the asset store tools plugin
 | 
			
		||||
# /[Aa]ssets/AssetStoreTools*
 | 
			
		||||
/[Aa]ssets/AssetStoreTools*
 | 
			
		||||
 | 
			
		||||
# Autogenerated Jetbrains Rider plugin
 | 
			
		||||
[Aa]ssets/Plugins/Editor/JetBrains*
 | 
			
		||||
 | 
			
		||||
# Visual Studio cache directory
 | 
			
		||||
.vs/
 | 
			
		||||
.vscode/
 | 
			
		||||
 | 
			
		||||
# Gradle cache directory
 | 
			
		||||
.gradle/
 | 
			
		||||
@@ -58,3 +59,5 @@ sysinfo.txt
 | 
			
		||||
# Crashlytics generated file
 | 
			
		||||
crashlytics-build.properties
 | 
			
		||||
 | 
			
		||||
# p4ignore
 | 
			
		||||
*.p4ignore
 | 
			
		||||
							
								
								
									
										8
									
								
								Assets/Materials.meta
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										8
									
								
								Assets/Materials.meta
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,8 @@
 | 
			
		||||
fileFormatVersion: 2
 | 
			
		||||
guid: 0a97efa44a47b1b4f8dc4cc4858bc4ce
 | 
			
		||||
folderAsset: yes
 | 
			
		||||
DefaultImporter:
 | 
			
		||||
  externalObjects: {}
 | 
			
		||||
  userData: 
 | 
			
		||||
  assetBundleName: 
 | 
			
		||||
  assetBundleVariant: 
 | 
			
		||||
							
								
								
									
										67
									
								
								Assets/Materials/CombineShader.mat
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										67
									
								
								Assets/Materials/CombineShader.mat
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,67 @@
 | 
			
		||||
%YAML 1.1
 | 
			
		||||
%TAG !u! tag:unity3d.com,2011:
 | 
			
		||||
--- !u!21 &2100000
 | 
			
		||||
Material:
 | 
			
		||||
  serializedVersion: 6
 | 
			
		||||
  m_ObjectHideFlags: 0
 | 
			
		||||
  m_CorrespondingSourceObject: {fileID: 0}
 | 
			
		||||
  m_PrefabInstance: {fileID: 0}
 | 
			
		||||
  m_PrefabAsset: {fileID: 0}
 | 
			
		||||
  m_Name: CombineShader
 | 
			
		||||
  m_Shader: {fileID: 4800000, guid: 549aae9fe3b32db48804f14851ff0f48, type: 3}
 | 
			
		||||
  m_ShaderKeywords: 
 | 
			
		||||
  m_LightmapFlags: 4
 | 
			
		||||
  m_EnableInstancingVariants: 0
 | 
			
		||||
  m_DoubleSidedGI: 0
 | 
			
		||||
  m_CustomRenderQueue: -1
 | 
			
		||||
  stringTagMap: {}
 | 
			
		||||
  disabledShaderPasses: []
 | 
			
		||||
  m_SavedProperties:
 | 
			
		||||
    serializedVersion: 3
 | 
			
		||||
    m_TexEnvs:
 | 
			
		||||
    - _MainTex:
 | 
			
		||||
        m_Texture: {fileID: 0}
 | 
			
		||||
        m_Scale: {x: 1, y: 1}
 | 
			
		||||
        m_Offset: {x: 0, y: 0}
 | 
			
		||||
    - _Tex0:
 | 
			
		||||
        m_Texture: {fileID: 0}
 | 
			
		||||
        m_Scale: {x: 1, y: 1}
 | 
			
		||||
        m_Offset: {x: 0, y: 0}
 | 
			
		||||
    - _Tex1:
 | 
			
		||||
        m_Texture: {fileID: 0}
 | 
			
		||||
        m_Scale: {x: 1, y: 1}
 | 
			
		||||
        m_Offset: {x: 0, y: 0}
 | 
			
		||||
    - _Tex2:
 | 
			
		||||
        m_Texture: {fileID: 0}
 | 
			
		||||
        m_Scale: {x: 1, y: 1}
 | 
			
		||||
        m_Offset: {x: 0, y: 0}
 | 
			
		||||
    - _Tex3:
 | 
			
		||||
        m_Texture: {fileID: 0}
 | 
			
		||||
        m_Scale: {x: 1, y: 1}
 | 
			
		||||
        m_Offset: {x: 0, y: 0}
 | 
			
		||||
    - _TexA:
 | 
			
		||||
        m_Texture: {fileID: 0}
 | 
			
		||||
        m_Scale: {x: 1, y: 1}
 | 
			
		||||
        m_Offset: {x: 0, y: 0}
 | 
			
		||||
    - _TexB:
 | 
			
		||||
        m_Texture: {fileID: 0}
 | 
			
		||||
        m_Scale: {x: 1, y: 1}
 | 
			
		||||
        m_Offset: {x: 0, y: 0}
 | 
			
		||||
    - _TexG:
 | 
			
		||||
        m_Texture: {fileID: 0}
 | 
			
		||||
        m_Scale: {x: 1, y: 1}
 | 
			
		||||
        m_Offset: {x: 0, y: 0}
 | 
			
		||||
    - _TexR:
 | 
			
		||||
        m_Texture: {fileID: 0}
 | 
			
		||||
        m_Scale: {x: 1, y: 1}
 | 
			
		||||
        m_Offset: {x: 0, y: 0}
 | 
			
		||||
    m_Floats:
 | 
			
		||||
    - _Source0: 0
 | 
			
		||||
    - _Target0: 0
 | 
			
		||||
    m_Colors:
 | 
			
		||||
    - _Add: {r: 0, g: 0, b: 0, a: 0}
 | 
			
		||||
    - _Mask0: {r: 1, g: 0, b: 0, a: 0}
 | 
			
		||||
    - _Mask1: {r: 1, g: 0, b: 0, a: 0}
 | 
			
		||||
    - _Mask2: {r: 1, g: 0, b: 0, a: 0}
 | 
			
		||||
    - _Mask3: {r: 1, g: 0, b: 0, a: 0}
 | 
			
		||||
    - _MaskR: {r: 1, g: 1, b: 1, a: 1}
 | 
			
		||||
							
								
								
									
										8
									
								
								Assets/Materials/CombineShader.mat.meta
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										8
									
								
								Assets/Materials/CombineShader.mat.meta
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,8 @@
 | 
			
		||||
fileFormatVersion: 2
 | 
			
		||||
guid: 911f5ac4d693b154ab7bb551aa77a33c
 | 
			
		||||
NativeFormatImporter:
 | 
			
		||||
  externalObjects: {}
 | 
			
		||||
  mainObjectFileID: 0
 | 
			
		||||
  userData: 
 | 
			
		||||
  assetBundleName: 
 | 
			
		||||
  assetBundleVariant: 
 | 
			
		||||
							
								
								
									
										8
									
								
								Assets/Plugins.meta
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										8
									
								
								Assets/Plugins.meta
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,8 @@
 | 
			
		||||
fileFormatVersion: 2
 | 
			
		||||
guid: b88a1dd15b3636c4487c3d11cf2546c4
 | 
			
		||||
folderAsset: yes
 | 
			
		||||
DefaultImporter:
 | 
			
		||||
  externalObjects: {}
 | 
			
		||||
  userData: 
 | 
			
		||||
  assetBundleName: 
 | 
			
		||||
  assetBundleVariant: 
 | 
			
		||||
							
								
								
									
										8
									
								
								Assets/Plugins/StandaloneFileBrowser.meta
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										8
									
								
								Assets/Plugins/StandaloneFileBrowser.meta
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,8 @@
 | 
			
		||||
fileFormatVersion: 2
 | 
			
		||||
guid: 57e25b4a578dba94c9353f4633b20549
 | 
			
		||||
folderAsset: yes
 | 
			
		||||
DefaultImporter:
 | 
			
		||||
  externalObjects: {}
 | 
			
		||||
  userData: 
 | 
			
		||||
  assetBundleName: 
 | 
			
		||||
  assetBundleVariant: 
 | 
			
		||||
@@ -0,0 +1,13 @@
 | 
			
		||||
using System;
 | 
			
		||||
 | 
			
		||||
namespace SFB {
 | 
			
		||||
    public interface IStandaloneFileBrowser {
 | 
			
		||||
        string[] OpenFilePanel(string title, string directory, ExtensionFilter[] extensions, bool multiselect);
 | 
			
		||||
        string[] OpenFolderPanel(string title, string directory, bool multiselect);
 | 
			
		||||
        string SaveFilePanel(string title, string directory, string defaultName, ExtensionFilter[] extensions);
 | 
			
		||||
 | 
			
		||||
        void OpenFilePanelAsync(string title, string directory, ExtensionFilter[] extensions, bool multiselect, Action<string[]> cb);
 | 
			
		||||
        void OpenFolderPanelAsync(string title, string directory, bool multiselect, Action<string[]> cb);
 | 
			
		||||
        void SaveFilePanelAsync(string title, string directory, string defaultName, ExtensionFilter[] extensions, Action<string> cb);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -0,0 +1,12 @@
 | 
			
		||||
fileFormatVersion: 2
 | 
			
		||||
guid: 7609f7b6787a54496aa41a3053fcc76a
 | 
			
		||||
timeCreated: 1483902788
 | 
			
		||||
licenseType: Pro
 | 
			
		||||
MonoImporter:
 | 
			
		||||
  serializedVersion: 2
 | 
			
		||||
  defaultReferences: []
 | 
			
		||||
  executionOrder: 0
 | 
			
		||||
  icon: {instanceID: 0}
 | 
			
		||||
  userData: 
 | 
			
		||||
  assetBundleName: 
 | 
			
		||||
  assetBundleVariant: 
 | 
			
		||||
							
								
								
									
										8
									
								
								Assets/Plugins/StandaloneFileBrowser/Plugins.meta
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										8
									
								
								Assets/Plugins/StandaloneFileBrowser/Plugins.meta
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,8 @@
 | 
			
		||||
fileFormatVersion: 2
 | 
			
		||||
guid: ddc4e7b83981f244ba9a26b88c18cb67
 | 
			
		||||
folderAsset: yes
 | 
			
		||||
DefaultImporter:
 | 
			
		||||
  externalObjects: {}
 | 
			
		||||
  userData: 
 | 
			
		||||
  assetBundleName: 
 | 
			
		||||
  assetBundleVariant: 
 | 
			
		||||
							
								
								
									
										10
									
								
								Assets/Plugins/StandaloneFileBrowser/Plugins/Linux.meta
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										10
									
								
								Assets/Plugins/StandaloneFileBrowser/Plugins/Linux.meta
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,10 @@
 | 
			
		||||
fileFormatVersion: 2
 | 
			
		||||
guid: 82666e520ab4d4cf08bebbb8059cd6f4
 | 
			
		||||
folderAsset: yes
 | 
			
		||||
timeCreated: 1538224809
 | 
			
		||||
licenseType: Free
 | 
			
		||||
DefaultImporter:
 | 
			
		||||
  externalObjects: {}
 | 
			
		||||
  userData: 
 | 
			
		||||
  assetBundleName: 
 | 
			
		||||
  assetBundleVariant: 
 | 
			
		||||
@@ -0,0 +1,10 @@
 | 
			
		||||
fileFormatVersion: 2
 | 
			
		||||
guid: bd198408642944765b9305bd99404136
 | 
			
		||||
folderAsset: yes
 | 
			
		||||
timeCreated: 1538230728
 | 
			
		||||
licenseType: Free
 | 
			
		||||
DefaultImporter:
 | 
			
		||||
  externalObjects: {}
 | 
			
		||||
  userData: 
 | 
			
		||||
  assetBundleName: 
 | 
			
		||||
  assetBundleVariant: 
 | 
			
		||||
										
											Binary file not shown.
										
									
								
							@@ -0,0 +1,126 @@
 | 
			
		||||
fileFormatVersion: 2
 | 
			
		||||
guid: b8c465928f1784a3fac8dc3766f7201c
 | 
			
		||||
timeCreated: 1538230728
 | 
			
		||||
licenseType: Free
 | 
			
		||||
PluginImporter:
 | 
			
		||||
  externalObjects: {}
 | 
			
		||||
  serializedVersion: 2
 | 
			
		||||
  iconMap: {}
 | 
			
		||||
  executionOrder: {}
 | 
			
		||||
  isPreloaded: 0
 | 
			
		||||
  isOverridable: 0
 | 
			
		||||
  platformData:
 | 
			
		||||
  - first:
 | 
			
		||||
      '': Any
 | 
			
		||||
    second:
 | 
			
		||||
      enabled: 0
 | 
			
		||||
      settings:
 | 
			
		||||
        Exclude Android: 1
 | 
			
		||||
        Exclude Editor: 0
 | 
			
		||||
        Exclude Linux: 1
 | 
			
		||||
        Exclude Linux64: 0
 | 
			
		||||
        Exclude LinuxUniversal: 0
 | 
			
		||||
        Exclude OSXIntel: 1
 | 
			
		||||
        Exclude OSXIntel64: 1
 | 
			
		||||
        Exclude OSXUniversal: 1
 | 
			
		||||
        Exclude SamsungTV: 1
 | 
			
		||||
        Exclude Tizen: 1
 | 
			
		||||
        Exclude WebGL: 1
 | 
			
		||||
        Exclude Win: 0
 | 
			
		||||
        Exclude Win64: 0
 | 
			
		||||
        Exclude iOS: 1
 | 
			
		||||
  - first:
 | 
			
		||||
      Android: Android
 | 
			
		||||
    second:
 | 
			
		||||
      enabled: 0
 | 
			
		||||
      settings:
 | 
			
		||||
        CPU: ARMv7
 | 
			
		||||
  - first:
 | 
			
		||||
      Any: 
 | 
			
		||||
    second:
 | 
			
		||||
      enabled: 0
 | 
			
		||||
      settings: {}
 | 
			
		||||
  - first:
 | 
			
		||||
      Editor: Editor
 | 
			
		||||
    second:
 | 
			
		||||
      enabled: 1
 | 
			
		||||
      settings:
 | 
			
		||||
        CPU: x86_64
 | 
			
		||||
        DefaultValueInitialized: true
 | 
			
		||||
        OS: Linux
 | 
			
		||||
  - first:
 | 
			
		||||
      Facebook: Win
 | 
			
		||||
    second:
 | 
			
		||||
      enabled: 0
 | 
			
		||||
      settings:
 | 
			
		||||
        CPU: AnyCPU
 | 
			
		||||
  - first:
 | 
			
		||||
      Facebook: Win64
 | 
			
		||||
    second:
 | 
			
		||||
      enabled: 0
 | 
			
		||||
      settings:
 | 
			
		||||
        CPU: AnyCPU
 | 
			
		||||
  - first:
 | 
			
		||||
      Samsung TV: SamsungTV
 | 
			
		||||
    second:
 | 
			
		||||
      enabled: 0
 | 
			
		||||
      settings:
 | 
			
		||||
        STV_MODEL: STANDARD_15
 | 
			
		||||
  - first:
 | 
			
		||||
      Standalone: Linux
 | 
			
		||||
    second:
 | 
			
		||||
      enabled: 0
 | 
			
		||||
      settings:
 | 
			
		||||
        CPU: None
 | 
			
		||||
  - first:
 | 
			
		||||
      Standalone: Linux64
 | 
			
		||||
    second:
 | 
			
		||||
      enabled: 1
 | 
			
		||||
      settings:
 | 
			
		||||
        CPU: x86_64
 | 
			
		||||
  - first:
 | 
			
		||||
      Standalone: LinuxUniversal
 | 
			
		||||
    second:
 | 
			
		||||
      enabled: 1
 | 
			
		||||
      settings:
 | 
			
		||||
        CPU: x86_64
 | 
			
		||||
  - first:
 | 
			
		||||
      Standalone: OSXIntel
 | 
			
		||||
    second:
 | 
			
		||||
      enabled: 0
 | 
			
		||||
      settings:
 | 
			
		||||
        CPU: None
 | 
			
		||||
  - first:
 | 
			
		||||
      Standalone: OSXIntel64
 | 
			
		||||
    second:
 | 
			
		||||
      enabled: 0
 | 
			
		||||
      settings:
 | 
			
		||||
        CPU: None
 | 
			
		||||
  - first:
 | 
			
		||||
      Standalone: OSXUniversal
 | 
			
		||||
    second:
 | 
			
		||||
      enabled: 0
 | 
			
		||||
      settings:
 | 
			
		||||
        CPU: None
 | 
			
		||||
  - first:
 | 
			
		||||
      Standalone: Win
 | 
			
		||||
    second:
 | 
			
		||||
      enabled: 1
 | 
			
		||||
      settings:
 | 
			
		||||
        CPU: AnyCPU
 | 
			
		||||
  - first:
 | 
			
		||||
      Standalone: Win64
 | 
			
		||||
    second:
 | 
			
		||||
      enabled: 1
 | 
			
		||||
      settings:
 | 
			
		||||
        CPU: AnyCPU
 | 
			
		||||
  - first:
 | 
			
		||||
      iPhone: iOS
 | 
			
		||||
    second:
 | 
			
		||||
      enabled: 0
 | 
			
		||||
      settings:
 | 
			
		||||
        CompileFlags: 
 | 
			
		||||
        FrameworkDependencies: 
 | 
			
		||||
  userData: 
 | 
			
		||||
  assetBundleName: 
 | 
			
		||||
  assetBundleVariant: 
 | 
			
		||||
							
								
								
									
										
											BIN
										
									
								
								Assets/Plugins/StandaloneFileBrowser/Plugins/Ookii.Dialogs.dll
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								Assets/Plugins/StandaloneFileBrowser/Plugins/Ookii.Dialogs.dll
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							@@ -0,0 +1,130 @@
 | 
			
		||||
fileFormatVersion: 2
 | 
			
		||||
guid: e60958662eed5413d86143a0a69b731e
 | 
			
		||||
PluginImporter:
 | 
			
		||||
  externalObjects: {}
 | 
			
		||||
  serializedVersion: 2
 | 
			
		||||
  iconMap: {}
 | 
			
		||||
  executionOrder: {}
 | 
			
		||||
  defineConstraints: []
 | 
			
		||||
  isPreloaded: 0
 | 
			
		||||
  isOverridable: 0
 | 
			
		||||
  isExplicitlyReferenced: 0
 | 
			
		||||
  validateReferences: 1
 | 
			
		||||
  platformData:
 | 
			
		||||
  - first:
 | 
			
		||||
      : Any
 | 
			
		||||
    second:
 | 
			
		||||
      enabled: 0
 | 
			
		||||
      settings:
 | 
			
		||||
        Exclude Android: 1
 | 
			
		||||
        Exclude Editor: 0
 | 
			
		||||
        Exclude Linux: 1
 | 
			
		||||
        Exclude Linux64: 1
 | 
			
		||||
        Exclude LinuxUniversal: 1
 | 
			
		||||
        Exclude OSXIntel: 1
 | 
			
		||||
        Exclude OSXIntel64: 1
 | 
			
		||||
        Exclude OSXUniversal: 1
 | 
			
		||||
        Exclude WebGL: 1
 | 
			
		||||
        Exclude Win: 0
 | 
			
		||||
        Exclude Win64: 0
 | 
			
		||||
        Exclude iOS: 1
 | 
			
		||||
  - first:
 | 
			
		||||
      : Editor
 | 
			
		||||
    second:
 | 
			
		||||
      enabled: 0
 | 
			
		||||
      settings:
 | 
			
		||||
        CPU: AnyCPU
 | 
			
		||||
        OS: AnyOS
 | 
			
		||||
  - first:
 | 
			
		||||
      Android: Android
 | 
			
		||||
    second:
 | 
			
		||||
      enabled: 0
 | 
			
		||||
      settings:
 | 
			
		||||
        CPU: ARMv7
 | 
			
		||||
  - first:
 | 
			
		||||
      Any: 
 | 
			
		||||
    second:
 | 
			
		||||
      enabled: 0
 | 
			
		||||
      settings: {}
 | 
			
		||||
  - first:
 | 
			
		||||
      Editor: Editor
 | 
			
		||||
    second:
 | 
			
		||||
      enabled: 1
 | 
			
		||||
      settings:
 | 
			
		||||
        DefaultValueInitialized: true
 | 
			
		||||
  - first:
 | 
			
		||||
      Facebook: Win
 | 
			
		||||
    second:
 | 
			
		||||
      enabled: 0
 | 
			
		||||
      settings:
 | 
			
		||||
        CPU: AnyCPU
 | 
			
		||||
  - first:
 | 
			
		||||
      Facebook: Win64
 | 
			
		||||
    second:
 | 
			
		||||
      enabled: 0
 | 
			
		||||
      settings:
 | 
			
		||||
        CPU: AnyCPU
 | 
			
		||||
  - first:
 | 
			
		||||
      Standalone: Linux
 | 
			
		||||
    second:
 | 
			
		||||
      enabled: 0
 | 
			
		||||
      settings:
 | 
			
		||||
        CPU: None
 | 
			
		||||
  - first:
 | 
			
		||||
      Standalone: Linux64
 | 
			
		||||
    second:
 | 
			
		||||
      enabled: 0
 | 
			
		||||
      settings:
 | 
			
		||||
        CPU: None
 | 
			
		||||
  - first:
 | 
			
		||||
      Standalone: LinuxUniversal
 | 
			
		||||
    second:
 | 
			
		||||
      enabled: 0
 | 
			
		||||
      settings:
 | 
			
		||||
        CPU: None
 | 
			
		||||
  - first:
 | 
			
		||||
      Standalone: OSXIntel
 | 
			
		||||
    second:
 | 
			
		||||
      enabled: 0
 | 
			
		||||
      settings:
 | 
			
		||||
        CPU: None
 | 
			
		||||
  - first:
 | 
			
		||||
      Standalone: OSXIntel64
 | 
			
		||||
    second:
 | 
			
		||||
      enabled: 0
 | 
			
		||||
      settings:
 | 
			
		||||
        CPU: None
 | 
			
		||||
  - first:
 | 
			
		||||
      Standalone: OSXUniversal
 | 
			
		||||
    second:
 | 
			
		||||
      enabled: 0
 | 
			
		||||
      settings:
 | 
			
		||||
        CPU: None
 | 
			
		||||
  - first:
 | 
			
		||||
      Standalone: Win
 | 
			
		||||
    second:
 | 
			
		||||
      enabled: 1
 | 
			
		||||
      settings:
 | 
			
		||||
        CPU: AnyCPU
 | 
			
		||||
  - first:
 | 
			
		||||
      Standalone: Win64
 | 
			
		||||
    second:
 | 
			
		||||
      enabled: 1
 | 
			
		||||
      settings:
 | 
			
		||||
        CPU: AnyCPU
 | 
			
		||||
  - first:
 | 
			
		||||
      Windows Store Apps: WindowsStoreApps
 | 
			
		||||
    second:
 | 
			
		||||
      enabled: 0
 | 
			
		||||
      settings:
 | 
			
		||||
        CPU: AnyCPU
 | 
			
		||||
  - first:
 | 
			
		||||
      iPhone: iOS
 | 
			
		||||
    second:
 | 
			
		||||
      enabled: 0
 | 
			
		||||
      settings:
 | 
			
		||||
        CompileFlags: 
 | 
			
		||||
        FrameworkDependencies: 
 | 
			
		||||
  userData: 
 | 
			
		||||
  assetBundleName: 
 | 
			
		||||
  assetBundleVariant: 
 | 
			
		||||
@@ -0,0 +1,43 @@
 | 
			
		||||
fileFormatVersion: 2
 | 
			
		||||
guid: 110fdfb459db4fc448a2ccd37e200fa4
 | 
			
		||||
folderAsset: yes
 | 
			
		||||
PluginImporter:
 | 
			
		||||
  externalObjects: {}
 | 
			
		||||
  serializedVersion: 2
 | 
			
		||||
  iconMap: {}
 | 
			
		||||
  executionOrder: {}
 | 
			
		||||
  defineConstraints: []
 | 
			
		||||
  isPreloaded: 0
 | 
			
		||||
  isOverridable: 0
 | 
			
		||||
  isExplicitlyReferenced: 0
 | 
			
		||||
  validateReferences: 1
 | 
			
		||||
  platformData:
 | 
			
		||||
  - first:
 | 
			
		||||
      Any: 
 | 
			
		||||
    second:
 | 
			
		||||
      enabled: 0
 | 
			
		||||
      settings: {}
 | 
			
		||||
  - first:
 | 
			
		||||
      Editor: Editor
 | 
			
		||||
    second:
 | 
			
		||||
      enabled: 1
 | 
			
		||||
      settings:
 | 
			
		||||
        DefaultValueInitialized: true
 | 
			
		||||
  - first:
 | 
			
		||||
      Standalone: OSXIntel
 | 
			
		||||
    second:
 | 
			
		||||
      enabled: 1
 | 
			
		||||
      settings: {}
 | 
			
		||||
  - first:
 | 
			
		||||
      Standalone: OSXIntel64
 | 
			
		||||
    second:
 | 
			
		||||
      enabled: 1
 | 
			
		||||
      settings: {}
 | 
			
		||||
  - first:
 | 
			
		||||
      Standalone: OSXUniversal
 | 
			
		||||
    second:
 | 
			
		||||
      enabled: 1
 | 
			
		||||
      settings: {}
 | 
			
		||||
  userData: 
 | 
			
		||||
  assetBundleName: 
 | 
			
		||||
  assetBundleVariant: 
 | 
			
		||||
@@ -0,0 +1,8 @@
 | 
			
		||||
fileFormatVersion: 2
 | 
			
		||||
guid: 996ea0b0fb9804844ba9595686ee3e7a
 | 
			
		||||
folderAsset: yes
 | 
			
		||||
DefaultImporter:
 | 
			
		||||
  externalObjects: {}
 | 
			
		||||
  userData: 
 | 
			
		||||
  assetBundleName: 
 | 
			
		||||
  assetBundleVariant: 
 | 
			
		||||
@@ -0,0 +1,46 @@
 | 
			
		||||
<?xml version="1.0" encoding="UTF-8"?>
 | 
			
		||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
 | 
			
		||||
<plist version="1.0">
 | 
			
		||||
<dict>
 | 
			
		||||
	<key>BuildMachineOSBuild</key>
 | 
			
		||||
	<string>18A391</string>
 | 
			
		||||
	<key>CFBundleDevelopmentRegion</key>
 | 
			
		||||
	<string>English</string>
 | 
			
		||||
	<key>CFBundleExecutable</key>
 | 
			
		||||
	<string>StandaloneFileBrowser</string>
 | 
			
		||||
	<key>CFBundleIdentifier</key>
 | 
			
		||||
	<string>com.gkngkc.sfb</string>
 | 
			
		||||
	<key>CFBundleInfoDictionaryVersion</key>
 | 
			
		||||
	<string>6.0</string>
 | 
			
		||||
	<key>CFBundleName</key>
 | 
			
		||||
	<string>StandaloneFileBrowser</string>
 | 
			
		||||
	<key>CFBundlePackageType</key>
 | 
			
		||||
	<string>BNDL</string>
 | 
			
		||||
	<key>CFBundleShortVersionString</key>
 | 
			
		||||
	<string>1.0		</string>
 | 
			
		||||
	<key>CFBundleSignature</key>
 | 
			
		||||
	<string>????</string>
 | 
			
		||||
	<key>CFBundleSupportedPlatforms</key>
 | 
			
		||||
	<array>
 | 
			
		||||
		<string>MacOSX</string>
 | 
			
		||||
	</array>
 | 
			
		||||
	<key>CFBundleVersion</key>
 | 
			
		||||
	<string>1.0</string>
 | 
			
		||||
	<key>CSResourcesFileMapped</key>
 | 
			
		||||
	<true/>
 | 
			
		||||
	<key>DTCompiler</key>
 | 
			
		||||
	<string>com.apple.compilers.llvm.clang.1_0</string>
 | 
			
		||||
	<key>DTPlatformBuild</key>
 | 
			
		||||
	<string>10A255</string>
 | 
			
		||||
	<key>DTPlatformVersion</key>
 | 
			
		||||
	<string>GM</string>
 | 
			
		||||
	<key>DTSDKBuild</key>
 | 
			
		||||
	<string>18A384</string>
 | 
			
		||||
	<key>DTSDKName</key>
 | 
			
		||||
	<string>macosx10.14</string>
 | 
			
		||||
	<key>DTXcode</key>
 | 
			
		||||
	<string>1000</string>
 | 
			
		||||
	<key>DTXcodeBuild</key>
 | 
			
		||||
	<string>10A255</string>
 | 
			
		||||
</dict>
 | 
			
		||||
</plist>
 | 
			
		||||
@@ -0,0 +1,8 @@
 | 
			
		||||
fileFormatVersion: 2
 | 
			
		||||
guid: ce685769797f44046afa3e567860c94c
 | 
			
		||||
timeCreated: 1505756861
 | 
			
		||||
licenseType: Pro
 | 
			
		||||
DefaultImporter:
 | 
			
		||||
  userData: 
 | 
			
		||||
  assetBundleName: 
 | 
			
		||||
  assetBundleVariant: 
 | 
			
		||||
@@ -0,0 +1,8 @@
 | 
			
		||||
fileFormatVersion: 2
 | 
			
		||||
guid: a5a66f5db020f344c9327188aec2c060
 | 
			
		||||
folderAsset: yes
 | 
			
		||||
DefaultImporter:
 | 
			
		||||
  externalObjects: {}
 | 
			
		||||
  userData: 
 | 
			
		||||
  assetBundleName: 
 | 
			
		||||
  assetBundleVariant: 
 | 
			
		||||
										
											Binary file not shown.
										
									
								
							@@ -0,0 +1,8 @@
 | 
			
		||||
fileFormatVersion: 2
 | 
			
		||||
guid: ddf122e0e89124ce78aacfeecb3ec554
 | 
			
		||||
timeCreated: 1508179371
 | 
			
		||||
licenseType: Pro
 | 
			
		||||
DefaultImporter:
 | 
			
		||||
  userData: 
 | 
			
		||||
  assetBundleName: 
 | 
			
		||||
  assetBundleVariant: 
 | 
			
		||||
@@ -0,0 +1,90 @@
 | 
			
		||||
var StandaloneFileBrowserWebGLPlugin = {
 | 
			
		||||
    // Open file.
 | 
			
		||||
    // gameObjectNamePtr: Unique GameObject name. Required for calling back unity with SendMessage.
 | 
			
		||||
    // methodNamePtr: Callback method name on given GameObject.
 | 
			
		||||
    // filter: Filter files. Example filters:
 | 
			
		||||
    //     Match all image files: "image/*"
 | 
			
		||||
    //     Match all video files: "video/*"
 | 
			
		||||
    //     Match all audio files: "audio/*"
 | 
			
		||||
    //     Custom: ".plist, .xml, .yaml"
 | 
			
		||||
    // multiselect: Allows multiple file selection
 | 
			
		||||
    UploadFile: function(gameObjectNamePtr, methodNamePtr, filterPtr, multiselect) {
 | 
			
		||||
        gameObjectName = Pointer_stringify(gameObjectNamePtr);
 | 
			
		||||
        methodName = Pointer_stringify(methodNamePtr);
 | 
			
		||||
        filter = Pointer_stringify(filterPtr);
 | 
			
		||||
 | 
			
		||||
        // Delete if element exist
 | 
			
		||||
        var fileInput = document.getElementById(gameObjectName)
 | 
			
		||||
        if (fileInput) {
 | 
			
		||||
            document.body.removeChild(fileInput);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        fileInput = document.createElement('input');
 | 
			
		||||
        fileInput.setAttribute('id', gameObjectName);
 | 
			
		||||
        fileInput.setAttribute('type', 'file');
 | 
			
		||||
        fileInput.setAttribute('style','display:none;');
 | 
			
		||||
        fileInput.setAttribute('style','visibility:hidden;');
 | 
			
		||||
        if (multiselect) {
 | 
			
		||||
            fileInput.setAttribute('multiple', '');
 | 
			
		||||
        }
 | 
			
		||||
        if (filter) {
 | 
			
		||||
            fileInput.setAttribute('accept', filter);
 | 
			
		||||
        }
 | 
			
		||||
        fileInput.onclick = function (event) {
 | 
			
		||||
            // File dialog opened
 | 
			
		||||
            this.value = null;
 | 
			
		||||
        };
 | 
			
		||||
        fileInput.onchange = function (event) {
 | 
			
		||||
            // multiselect works
 | 
			
		||||
            var urls = [];
 | 
			
		||||
            for (var i = 0; i < event.target.files.length; i++) {
 | 
			
		||||
                urls.push(URL.createObjectURL(event.target.files[i]));
 | 
			
		||||
            }
 | 
			
		||||
            // File selected
 | 
			
		||||
            SendMessage(gameObjectName, methodName, urls.join());
 | 
			
		||||
 | 
			
		||||
            // Remove after file selected
 | 
			
		||||
            document.body.removeChild(fileInput);
 | 
			
		||||
        }
 | 
			
		||||
        document.body.appendChild(fileInput);
 | 
			
		||||
 | 
			
		||||
        document.onmouseup = function() {
 | 
			
		||||
            fileInput.click();
 | 
			
		||||
            document.onmouseup = null;
 | 
			
		||||
        }
 | 
			
		||||
    },
 | 
			
		||||
 | 
			
		||||
    // Save file
 | 
			
		||||
    // DownloadFile method does not open SaveFileDialog like standalone builds, its just allows user to download file
 | 
			
		||||
    // gameObjectNamePtr: Unique GameObject name. Required for calling back unity with SendMessage.
 | 
			
		||||
    // methodNamePtr: Callback method name on given GameObject.
 | 
			
		||||
    // filenamePtr: Filename with extension
 | 
			
		||||
    // byteArray: byte[]
 | 
			
		||||
    // byteArraySize: byte[].Length
 | 
			
		||||
    DownloadFile: function(gameObjectNamePtr, methodNamePtr, filenamePtr, byteArray, byteArraySize) {
 | 
			
		||||
        gameObjectName = Pointer_stringify(gameObjectNamePtr);
 | 
			
		||||
        methodName = Pointer_stringify(methodNamePtr);
 | 
			
		||||
        filename = Pointer_stringify(filenamePtr);
 | 
			
		||||
 | 
			
		||||
        var bytes = new Uint8Array(byteArraySize);
 | 
			
		||||
        for (var i = 0; i < byteArraySize; i++) {
 | 
			
		||||
            bytes[i] = HEAPU8[byteArray + i];
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        var downloader = window.document.createElement('a');
 | 
			
		||||
        downloader.setAttribute('id', gameObjectName);
 | 
			
		||||
        downloader.href = window.URL.createObjectURL(new Blob([bytes], { type: 'application/octet-stream' }));
 | 
			
		||||
        downloader.download = filename;
 | 
			
		||||
        document.body.appendChild(downloader);
 | 
			
		||||
 | 
			
		||||
        document.onmouseup = function() {
 | 
			
		||||
            downloader.click();
 | 
			
		||||
            document.body.removeChild(downloader);
 | 
			
		||||
        	document.onmouseup = null;
 | 
			
		||||
 | 
			
		||||
            SendMessage(gameObjectName, methodName);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
mergeInto(LibraryManager.library, StandaloneFileBrowserWebGLPlugin);
 | 
			
		||||
@@ -0,0 +1,99 @@
 | 
			
		||||
fileFormatVersion: 2
 | 
			
		||||
guid: 265aaf20a6d564e0fb00a9c4a7a9c300
 | 
			
		||||
PluginImporter:
 | 
			
		||||
  externalObjects: {}
 | 
			
		||||
  serializedVersion: 2
 | 
			
		||||
  iconMap: {}
 | 
			
		||||
  executionOrder: {}
 | 
			
		||||
  defineConstraints: []
 | 
			
		||||
  isPreloaded: 0
 | 
			
		||||
  isOverridable: 0
 | 
			
		||||
  isExplicitlyReferenced: 0
 | 
			
		||||
  validateReferences: 1
 | 
			
		||||
  platformData:
 | 
			
		||||
  - first:
 | 
			
		||||
      : Any
 | 
			
		||||
    second:
 | 
			
		||||
      enabled: 0
 | 
			
		||||
      settings:
 | 
			
		||||
        Exclude Editor: 1
 | 
			
		||||
        Exclude Linux: 1
 | 
			
		||||
        Exclude Linux64: 1
 | 
			
		||||
        Exclude LinuxUniversal: 1
 | 
			
		||||
        Exclude OSXUniversal: 1
 | 
			
		||||
        Exclude Win: 1
 | 
			
		||||
        Exclude Win64: 1
 | 
			
		||||
  - first:
 | 
			
		||||
      Any: 
 | 
			
		||||
    second:
 | 
			
		||||
      enabled: 0
 | 
			
		||||
      settings: {}
 | 
			
		||||
  - first:
 | 
			
		||||
      Editor: Editor
 | 
			
		||||
    second:
 | 
			
		||||
      enabled: 0
 | 
			
		||||
      settings:
 | 
			
		||||
        CPU: AnyCPU
 | 
			
		||||
        DefaultValueInitialized: true
 | 
			
		||||
        OS: AnyOS
 | 
			
		||||
  - first:
 | 
			
		||||
      Facebook: WebGL
 | 
			
		||||
    second:
 | 
			
		||||
      enabled: 1
 | 
			
		||||
      settings: {}
 | 
			
		||||
  - first:
 | 
			
		||||
      Facebook: Win
 | 
			
		||||
    second:
 | 
			
		||||
      enabled: 0
 | 
			
		||||
      settings:
 | 
			
		||||
        CPU: AnyCPU
 | 
			
		||||
  - first:
 | 
			
		||||
      Facebook: Win64
 | 
			
		||||
    second:
 | 
			
		||||
      enabled: 0
 | 
			
		||||
      settings:
 | 
			
		||||
        CPU: AnyCPU
 | 
			
		||||
  - first:
 | 
			
		||||
      Standalone: Linux
 | 
			
		||||
    second:
 | 
			
		||||
      enabled: 0
 | 
			
		||||
      settings:
 | 
			
		||||
        CPU: x86
 | 
			
		||||
  - first:
 | 
			
		||||
      Standalone: Linux64
 | 
			
		||||
    second:
 | 
			
		||||
      enabled: 0
 | 
			
		||||
      settings:
 | 
			
		||||
        CPU: AnyCPU
 | 
			
		||||
  - first:
 | 
			
		||||
      Standalone: LinuxUniversal
 | 
			
		||||
    second:
 | 
			
		||||
      enabled: 0
 | 
			
		||||
      settings:
 | 
			
		||||
        CPU: None
 | 
			
		||||
  - first:
 | 
			
		||||
      Standalone: OSXUniversal
 | 
			
		||||
    second:
 | 
			
		||||
      enabled: 0
 | 
			
		||||
      settings:
 | 
			
		||||
        CPU: AnyCPU
 | 
			
		||||
  - first:
 | 
			
		||||
      Standalone: Win
 | 
			
		||||
    second:
 | 
			
		||||
      enabled: 0
 | 
			
		||||
      settings:
 | 
			
		||||
        CPU: AnyCPU
 | 
			
		||||
  - first:
 | 
			
		||||
      Standalone: Win64
 | 
			
		||||
    second:
 | 
			
		||||
      enabled: 0
 | 
			
		||||
      settings:
 | 
			
		||||
        CPU: AnyCPU
 | 
			
		||||
  - first:
 | 
			
		||||
      WebGL: WebGL
 | 
			
		||||
    second:
 | 
			
		||||
      enabled: 1
 | 
			
		||||
      settings: {}
 | 
			
		||||
  userData: 
 | 
			
		||||
  assetBundleName: 
 | 
			
		||||
  assetBundleVariant: 
 | 
			
		||||
										
											Binary file not shown.
										
									
								
							@@ -0,0 +1,130 @@
 | 
			
		||||
fileFormatVersion: 2
 | 
			
		||||
guid: 7d459a96865cc4aaab657012c6dc4833
 | 
			
		||||
PluginImporter:
 | 
			
		||||
  externalObjects: {}
 | 
			
		||||
  serializedVersion: 2
 | 
			
		||||
  iconMap: {}
 | 
			
		||||
  executionOrder: {}
 | 
			
		||||
  defineConstraints: []
 | 
			
		||||
  isPreloaded: 0
 | 
			
		||||
  isOverridable: 0
 | 
			
		||||
  isExplicitlyReferenced: 0
 | 
			
		||||
  validateReferences: 1
 | 
			
		||||
  platformData:
 | 
			
		||||
  - first:
 | 
			
		||||
      : Any
 | 
			
		||||
    second:
 | 
			
		||||
      enabled: 0
 | 
			
		||||
      settings:
 | 
			
		||||
        Exclude Android: 1
 | 
			
		||||
        Exclude Editor: 0
 | 
			
		||||
        Exclude Linux: 1
 | 
			
		||||
        Exclude Linux64: 1
 | 
			
		||||
        Exclude LinuxUniversal: 1
 | 
			
		||||
        Exclude OSXIntel: 1
 | 
			
		||||
        Exclude OSXIntel64: 1
 | 
			
		||||
        Exclude OSXUniversal: 1
 | 
			
		||||
        Exclude WebGL: 1
 | 
			
		||||
        Exclude Win: 0
 | 
			
		||||
        Exclude Win64: 0
 | 
			
		||||
        Exclude iOS: 1
 | 
			
		||||
  - first:
 | 
			
		||||
      : Editor
 | 
			
		||||
    second:
 | 
			
		||||
      enabled: 0
 | 
			
		||||
      settings:
 | 
			
		||||
        CPU: AnyCPU
 | 
			
		||||
        OS: AnyOS
 | 
			
		||||
  - first:
 | 
			
		||||
      Android: Android
 | 
			
		||||
    second:
 | 
			
		||||
      enabled: 0
 | 
			
		||||
      settings:
 | 
			
		||||
        CPU: ARMv7
 | 
			
		||||
  - first:
 | 
			
		||||
      Any: 
 | 
			
		||||
    second:
 | 
			
		||||
      enabled: 0
 | 
			
		||||
      settings: {}
 | 
			
		||||
  - first:
 | 
			
		||||
      Editor: Editor
 | 
			
		||||
    second:
 | 
			
		||||
      enabled: 1
 | 
			
		||||
      settings:
 | 
			
		||||
        DefaultValueInitialized: true
 | 
			
		||||
  - first:
 | 
			
		||||
      Facebook: Win
 | 
			
		||||
    second:
 | 
			
		||||
      enabled: 0
 | 
			
		||||
      settings:
 | 
			
		||||
        CPU: AnyCPU
 | 
			
		||||
  - first:
 | 
			
		||||
      Facebook: Win64
 | 
			
		||||
    second:
 | 
			
		||||
      enabled: 0
 | 
			
		||||
      settings:
 | 
			
		||||
        CPU: AnyCPU
 | 
			
		||||
  - first:
 | 
			
		||||
      Standalone: Linux
 | 
			
		||||
    second:
 | 
			
		||||
      enabled: 0
 | 
			
		||||
      settings:
 | 
			
		||||
        CPU: None
 | 
			
		||||
  - first:
 | 
			
		||||
      Standalone: Linux64
 | 
			
		||||
    second:
 | 
			
		||||
      enabled: 0
 | 
			
		||||
      settings:
 | 
			
		||||
        CPU: None
 | 
			
		||||
  - first:
 | 
			
		||||
      Standalone: LinuxUniversal
 | 
			
		||||
    second:
 | 
			
		||||
      enabled: 0
 | 
			
		||||
      settings:
 | 
			
		||||
        CPU: None
 | 
			
		||||
  - first:
 | 
			
		||||
      Standalone: OSXIntel
 | 
			
		||||
    second:
 | 
			
		||||
      enabled: 0
 | 
			
		||||
      settings:
 | 
			
		||||
        CPU: None
 | 
			
		||||
  - first:
 | 
			
		||||
      Standalone: OSXIntel64
 | 
			
		||||
    second:
 | 
			
		||||
      enabled: 0
 | 
			
		||||
      settings:
 | 
			
		||||
        CPU: None
 | 
			
		||||
  - first:
 | 
			
		||||
      Standalone: OSXUniversal
 | 
			
		||||
    second:
 | 
			
		||||
      enabled: 0
 | 
			
		||||
      settings:
 | 
			
		||||
        CPU: None
 | 
			
		||||
  - first:
 | 
			
		||||
      Standalone: Win
 | 
			
		||||
    second:
 | 
			
		||||
      enabled: 1
 | 
			
		||||
      settings:
 | 
			
		||||
        CPU: AnyCPU
 | 
			
		||||
  - first:
 | 
			
		||||
      Standalone: Win64
 | 
			
		||||
    second:
 | 
			
		||||
      enabled: 1
 | 
			
		||||
      settings:
 | 
			
		||||
        CPU: AnyCPU
 | 
			
		||||
  - first:
 | 
			
		||||
      Windows Store Apps: WindowsStoreApps
 | 
			
		||||
    second:
 | 
			
		||||
      enabled: 0
 | 
			
		||||
      settings:
 | 
			
		||||
        CPU: AnyCPU
 | 
			
		||||
  - first:
 | 
			
		||||
      iPhone: iOS
 | 
			
		||||
    second:
 | 
			
		||||
      enabled: 0
 | 
			
		||||
      settings:
 | 
			
		||||
        CompileFlags: 
 | 
			
		||||
        FrameworkDependencies: 
 | 
			
		||||
  userData: 
 | 
			
		||||
  assetBundleName: 
 | 
			
		||||
  assetBundleVariant: 
 | 
			
		||||
							
								
								
									
										153
									
								
								Assets/Plugins/StandaloneFileBrowser/StandaloneFileBrowser.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										153
									
								
								Assets/Plugins/StandaloneFileBrowser/StandaloneFileBrowser.cs
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,153 @@
 | 
			
		||||
using System;
 | 
			
		||||
 | 
			
		||||
namespace SFB {
 | 
			
		||||
    public struct ExtensionFilter {
 | 
			
		||||
        public string Name;
 | 
			
		||||
        public string[] Extensions;
 | 
			
		||||
 | 
			
		||||
        public ExtensionFilter(string filterName, params string[] filterExtensions) {
 | 
			
		||||
            Name = filterName;
 | 
			
		||||
            Extensions = filterExtensions;
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public class StandaloneFileBrowser {
 | 
			
		||||
        private static IStandaloneFileBrowser _platformWrapper = null;
 | 
			
		||||
 | 
			
		||||
        static StandaloneFileBrowser() {
 | 
			
		||||
#if UNITY_STANDALONE_OSX
 | 
			
		||||
            _platformWrapper = new StandaloneFileBrowserMac();
 | 
			
		||||
#elif UNITY_STANDALONE_WIN
 | 
			
		||||
            _platformWrapper = new StandaloneFileBrowserWindows();
 | 
			
		||||
#elif UNITY_STANDALONE_LINUX
 | 
			
		||||
            _platformWrapper = new StandaloneFileBrowserLinux();
 | 
			
		||||
#elif UNITY_EDITOR
 | 
			
		||||
            _platformWrapper = new StandaloneFileBrowserEditor();
 | 
			
		||||
#endif
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// Native open file dialog
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        /// <param name="title">Dialog title</param>
 | 
			
		||||
        /// <param name="directory">Root directory</param>
 | 
			
		||||
        /// <param name="extension">Allowed extension</param>
 | 
			
		||||
        /// <param name="multiselect">Allow multiple file selection</param>
 | 
			
		||||
        /// <returns>Returns array of chosen paths. Zero length array when cancelled</returns>
 | 
			
		||||
        public static string[] OpenFilePanel(string title, string directory, string extension, bool multiselect) {
 | 
			
		||||
            var extensions = string.IsNullOrEmpty(extension) ? null : new [] { new ExtensionFilter("", extension) };
 | 
			
		||||
            return OpenFilePanel(title, directory, extensions, multiselect);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// Native open file dialog
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        /// <param name="title">Dialog title</param>
 | 
			
		||||
        /// <param name="directory">Root directory</param>
 | 
			
		||||
        /// <param name="extensions">List of extension filters. Filter Example: new ExtensionFilter("Image Files", "jpg", "png")</param>
 | 
			
		||||
        /// <param name="multiselect">Allow multiple file selection</param>
 | 
			
		||||
        /// <returns>Returns array of chosen paths. Zero length array when cancelled</returns>
 | 
			
		||||
        public static string[] OpenFilePanel(string title, string directory, ExtensionFilter[] extensions, bool multiselect) {
 | 
			
		||||
            return _platformWrapper.OpenFilePanel(title, directory, extensions, multiselect);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// Native open file dialog async
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        /// <param name="title">Dialog title</param>
 | 
			
		||||
        /// <param name="directory">Root directory</param>
 | 
			
		||||
        /// <param name="extension">Allowed extension</param>
 | 
			
		||||
        /// <param name="multiselect">Allow multiple file selection</param>
 | 
			
		||||
        /// <param name="cb">Callback")</param>
 | 
			
		||||
        public static void OpenFilePanelAsync(string title, string directory, string extension, bool multiselect, Action<string[]> cb) {
 | 
			
		||||
            var extensions = string.IsNullOrEmpty(extension) ? null : new [] { new ExtensionFilter("", extension) };
 | 
			
		||||
            OpenFilePanelAsync(title, directory, extensions, multiselect, cb);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// Native open file dialog async
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        /// <param name="title">Dialog title</param>
 | 
			
		||||
        /// <param name="directory">Root directory</param>
 | 
			
		||||
        /// <param name="extensions">List of extension filters. Filter Example: new ExtensionFilter("Image Files", "jpg", "png")</param>
 | 
			
		||||
        /// <param name="multiselect">Allow multiple file selection</param>
 | 
			
		||||
        /// <param name="cb">Callback")</param>
 | 
			
		||||
        public static void OpenFilePanelAsync(string title, string directory, ExtensionFilter[] extensions, bool multiselect, Action<string[]> cb) {
 | 
			
		||||
            _platformWrapper.OpenFilePanelAsync(title, directory, extensions, multiselect, cb);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// Native open folder dialog
 | 
			
		||||
        /// NOTE: Multiple folder selection doesn't supported on Windows
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        /// <param name="title"></param>
 | 
			
		||||
        /// <param name="directory">Root directory</param>
 | 
			
		||||
        /// <param name="multiselect"></param>
 | 
			
		||||
        /// <returns>Returns array of chosen paths. Zero length array when cancelled</returns>
 | 
			
		||||
        public static string[] OpenFolderPanel(string title, string directory, bool multiselect) {
 | 
			
		||||
            return _platformWrapper.OpenFolderPanel(title, directory, multiselect);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// Native open folder dialog async
 | 
			
		||||
        /// NOTE: Multiple folder selection doesn't supported on Windows
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        /// <param name="title"></param>
 | 
			
		||||
        /// <param name="directory">Root directory</param>
 | 
			
		||||
        /// <param name="multiselect"></param>
 | 
			
		||||
        /// <param name="cb">Callback")</param>
 | 
			
		||||
        public static void OpenFolderPanelAsync(string title, string directory, bool multiselect, Action<string[]> cb) {
 | 
			
		||||
            _platformWrapper.OpenFolderPanelAsync(title, directory, multiselect, cb);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// Native save file dialog
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        /// <param name="title">Dialog title</param>
 | 
			
		||||
        /// <param name="directory">Root directory</param>
 | 
			
		||||
        /// <param name="defaultName">Default file name</param>
 | 
			
		||||
        /// <param name="extension">File extension</param>
 | 
			
		||||
        /// <returns>Returns chosen path. Empty string when cancelled</returns>
 | 
			
		||||
        public static string SaveFilePanel(string title, string directory, string defaultName , string extension) {
 | 
			
		||||
            var extensions = string.IsNullOrEmpty(extension) ? null : new [] { new ExtensionFilter("", extension) };
 | 
			
		||||
            return SaveFilePanel(title, directory, defaultName, extensions);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// Native save file dialog
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        /// <param name="title">Dialog title</param>
 | 
			
		||||
        /// <param name="directory">Root directory</param>
 | 
			
		||||
        /// <param name="defaultName">Default file name</param>
 | 
			
		||||
        /// <param name="extensions">List of extension filters. Filter Example: new ExtensionFilter("Image Files", "jpg", "png")</param>
 | 
			
		||||
        /// <returns>Returns chosen path. Empty string when cancelled</returns>
 | 
			
		||||
        public static string SaveFilePanel(string title, string directory, string defaultName, ExtensionFilter[] extensions) {
 | 
			
		||||
            return _platformWrapper.SaveFilePanel(title, directory, defaultName, extensions);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// Native save file dialog async
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        /// <param name="title">Dialog title</param>
 | 
			
		||||
        /// <param name="directory">Root directory</param>
 | 
			
		||||
        /// <param name="defaultName">Default file name</param>
 | 
			
		||||
        /// <param name="extension">File extension</param>
 | 
			
		||||
        /// <param name="cb">Callback")</param>
 | 
			
		||||
        public static void SaveFilePanelAsync(string title, string directory, string defaultName , string extension, Action<string> cb) {
 | 
			
		||||
            var extensions = string.IsNullOrEmpty(extension) ? null : new [] { new ExtensionFilter("", extension) };
 | 
			
		||||
            SaveFilePanelAsync(title, directory, defaultName, extensions, cb);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// Native save file dialog async
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        /// <param name="title">Dialog title</param>
 | 
			
		||||
        /// <param name="directory">Root directory</param>
 | 
			
		||||
        /// <param name="defaultName">Default file name</param>
 | 
			
		||||
        /// <param name="extensions">List of extension filters. Filter Example: new ExtensionFilter("Image Files", "jpg", "png")</param>
 | 
			
		||||
        /// <param name="cb">Callback")</param>
 | 
			
		||||
        public static void SaveFilePanelAsync(string title, string directory, string defaultName, ExtensionFilter[] extensions, Action<string> cb) {
 | 
			
		||||
            _platformWrapper.SaveFilePanelAsync(title, directory, defaultName, extensions, cb);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -0,0 +1,12 @@
 | 
			
		||||
fileFormatVersion: 2
 | 
			
		||||
guid: 3c708be74128e4ced9b79eaaf80e8443
 | 
			
		||||
timeCreated: 1483902788
 | 
			
		||||
licenseType: Pro
 | 
			
		||||
MonoImporter:
 | 
			
		||||
  serializedVersion: 2
 | 
			
		||||
  defaultReferences: []
 | 
			
		||||
  executionOrder: 0
 | 
			
		||||
  icon: {instanceID: 0}
 | 
			
		||||
  userData: 
 | 
			
		||||
  assetBundleName: 
 | 
			
		||||
  assetBundleVariant: 
 | 
			
		||||
@@ -0,0 +1,56 @@
 | 
			
		||||
#if UNITY_EDITOR
 | 
			
		||||
 | 
			
		||||
using System;
 | 
			
		||||
using UnityEditor;
 | 
			
		||||
 | 
			
		||||
namespace SFB {
 | 
			
		||||
    public class StandaloneFileBrowserEditor : IStandaloneFileBrowser  {
 | 
			
		||||
        public string[] OpenFilePanel(string title, string directory, ExtensionFilter[] extensions, bool multiselect) {
 | 
			
		||||
            string path = "";
 | 
			
		||||
 | 
			
		||||
            if (extensions == null) {
 | 
			
		||||
                path = EditorUtility.OpenFilePanel(title, directory, "");
 | 
			
		||||
            }
 | 
			
		||||
            else {
 | 
			
		||||
                path = EditorUtility.OpenFilePanelWithFilters(title, directory, GetFilterFromFileExtensionList(extensions));
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            return string.IsNullOrEmpty(path) ? new string[0] : new[] { path };
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public void OpenFilePanelAsync(string title, string directory, ExtensionFilter[] extensions, bool multiselect, Action<string[]> cb) {
 | 
			
		||||
            cb.Invoke(OpenFilePanel(title, directory, extensions, multiselect));
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public string[] OpenFolderPanel(string title, string directory, bool multiselect) {
 | 
			
		||||
            var path = EditorUtility.OpenFolderPanel(title, directory, "");
 | 
			
		||||
            return string.IsNullOrEmpty(path) ? new string[0] : new[] {path};
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public void OpenFolderPanelAsync(string title, string directory, bool multiselect, Action<string[]> cb) {
 | 
			
		||||
            cb.Invoke(OpenFolderPanel(title, directory, multiselect));
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public string SaveFilePanel(string title, string directory, string defaultName, ExtensionFilter[] extensions) {
 | 
			
		||||
            var ext = extensions != null ? extensions[0].Extensions[0] : "";
 | 
			
		||||
            var name = string.IsNullOrEmpty(ext) ? defaultName : defaultName + "." + ext;
 | 
			
		||||
            return EditorUtility.SaveFilePanel(title, directory, name, ext);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public void SaveFilePanelAsync(string title, string directory, string defaultName, ExtensionFilter[] extensions, Action<string> cb) {
 | 
			
		||||
            cb.Invoke(SaveFilePanel(title, directory, defaultName, extensions));
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        // EditorUtility.OpenFilePanelWithFilters extension filter format
 | 
			
		||||
        private static string[] GetFilterFromFileExtensionList(ExtensionFilter[] extensions) {
 | 
			
		||||
            var filters = new string[extensions.Length * 2];
 | 
			
		||||
            for (int i = 0; i < extensions.Length; i++) {
 | 
			
		||||
                filters[(i * 2)] = extensions[i].Name;
 | 
			
		||||
                filters[(i * 2) + 1] = string.Join(",", extensions[i].Extensions);
 | 
			
		||||
            }
 | 
			
		||||
            return filters;
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#endif
 | 
			
		||||
@@ -0,0 +1,12 @@
 | 
			
		||||
fileFormatVersion: 2
 | 
			
		||||
guid: 2650af8de2cda46b99b1bc7cf5d30ca5
 | 
			
		||||
timeCreated: 1483902788
 | 
			
		||||
licenseType: Pro
 | 
			
		||||
MonoImporter:
 | 
			
		||||
  serializedVersion: 2
 | 
			
		||||
  defaultReferences: []
 | 
			
		||||
  executionOrder: 0
 | 
			
		||||
  icon: {instanceID: 0}
 | 
			
		||||
  userData: 
 | 
			
		||||
  assetBundleName: 
 | 
			
		||||
  assetBundleVariant: 
 | 
			
		||||
@@ -0,0 +1,115 @@
 | 
			
		||||
#if UNITY_STANDALONE_LINUX
 | 
			
		||||
 | 
			
		||||
using System;
 | 
			
		||||
using System.IO;
 | 
			
		||||
using System.Runtime.InteropServices;
 | 
			
		||||
using UnityEngine;
 | 
			
		||||
 | 
			
		||||
namespace SFB {
 | 
			
		||||
 | 
			
		||||
    public class StandaloneFileBrowserLinux : IStandaloneFileBrowser {
 | 
			
		||||
        
 | 
			
		||||
        private static Action<string[]> _openFileCb;
 | 
			
		||||
        private static Action<string[]> _openFolderCb;
 | 
			
		||||
        private static Action<string> _saveFileCb;
 | 
			
		||||
 | 
			
		||||
        [UnmanagedFunctionPointer(CallingConvention.StdCall)]
 | 
			
		||||
        public delegate void AsyncCallback(string path);
 | 
			
		||||
 | 
			
		||||
        [DllImport("StandaloneFileBrowser")]
 | 
			
		||||
        private static extern void DialogInit();
 | 
			
		||||
        [DllImport("StandaloneFileBrowser")]
 | 
			
		||||
        private static extern IntPtr DialogOpenFilePanel(string title, string directory, string extension, bool multiselect);
 | 
			
		||||
        [DllImport("StandaloneFileBrowser")]
 | 
			
		||||
        private static extern void DialogOpenFilePanelAsync(string title, string directory, string extension, bool multiselect, AsyncCallback callback);
 | 
			
		||||
        [DllImport("StandaloneFileBrowser")]
 | 
			
		||||
        private static extern IntPtr DialogOpenFolderPanel(string title, string directory, bool multiselect);
 | 
			
		||||
        [DllImport("StandaloneFileBrowser")]
 | 
			
		||||
        private static extern void DialogOpenFolderPanelAsync(string title, string directory, bool multiselect, AsyncCallback callback);
 | 
			
		||||
        [DllImport("StandaloneFileBrowser")]
 | 
			
		||||
        private static extern IntPtr DialogSaveFilePanel(string title, string directory, string defaultName, string extension);
 | 
			
		||||
        [DllImport("StandaloneFileBrowser")]
 | 
			
		||||
        private static extern void DialogSaveFilePanelAsync(string title, string directory, string defaultName, string extension, AsyncCallback callback);
 | 
			
		||||
 | 
			
		||||
        public StandaloneFileBrowserLinux()
 | 
			
		||||
        {
 | 
			
		||||
            DialogInit();
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public string[] OpenFilePanel(string title, string directory, ExtensionFilter[] extensions, bool multiselect) {
 | 
			
		||||
            var paths = Marshal.PtrToStringAnsi(DialogOpenFilePanel(
 | 
			
		||||
                title,
 | 
			
		||||
                directory,
 | 
			
		||||
                GetFilterFromFileExtensionList(extensions),
 | 
			
		||||
                multiselect));
 | 
			
		||||
            return paths.Split((char)28);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public void OpenFilePanelAsync(string title, string directory, ExtensionFilter[] extensions, bool multiselect, Action<string[]> cb) {
 | 
			
		||||
            _openFileCb = cb;
 | 
			
		||||
            DialogOpenFilePanelAsync(
 | 
			
		||||
                title,
 | 
			
		||||
                directory,
 | 
			
		||||
                GetFilterFromFileExtensionList(extensions),
 | 
			
		||||
                multiselect,
 | 
			
		||||
                (string result) => { _openFileCb.Invoke(result.Split((char)28)); });
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public string[] OpenFolderPanel(string title, string directory, bool multiselect) {
 | 
			
		||||
            var paths = Marshal.PtrToStringAnsi(DialogOpenFolderPanel(
 | 
			
		||||
                title,
 | 
			
		||||
                directory,
 | 
			
		||||
                multiselect));
 | 
			
		||||
            return paths.Split((char)28);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public void OpenFolderPanelAsync(string title, string directory, bool multiselect, Action<string[]> cb) {
 | 
			
		||||
            _openFolderCb = cb;
 | 
			
		||||
            DialogOpenFolderPanelAsync(
 | 
			
		||||
                title,
 | 
			
		||||
                directory,
 | 
			
		||||
                multiselect,
 | 
			
		||||
                (string result) => { _openFolderCb.Invoke(result.Split((char)28)); });
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public string SaveFilePanel(string title, string directory, string defaultName, ExtensionFilter[] extensions) {
 | 
			
		||||
            return Marshal.PtrToStringAnsi(DialogSaveFilePanel(
 | 
			
		||||
                title,
 | 
			
		||||
                directory,
 | 
			
		||||
                defaultName,
 | 
			
		||||
                GetFilterFromFileExtensionList(extensions)));
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public void SaveFilePanelAsync(string title, string directory, string defaultName, ExtensionFilter[] extensions, Action<string> cb) {
 | 
			
		||||
            _saveFileCb = cb;
 | 
			
		||||
            DialogSaveFilePanelAsync(
 | 
			
		||||
                title,
 | 
			
		||||
                directory,
 | 
			
		||||
                defaultName,
 | 
			
		||||
                GetFilterFromFileExtensionList(extensions),
 | 
			
		||||
                (string result) => { _saveFileCb.Invoke(result); });
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        private static string GetFilterFromFileExtensionList(ExtensionFilter[] extensions) {
 | 
			
		||||
            if (extensions == null) {
 | 
			
		||||
                return "";
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            var filterString = "";
 | 
			
		||||
            foreach (var filter in extensions) {
 | 
			
		||||
                filterString += filter.Name + ";";
 | 
			
		||||
 | 
			
		||||
                foreach (var ext in filter.Extensions) {
 | 
			
		||||
                    filterString += ext + ",";
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
                filterString = filterString.Remove(filterString.Length - 1);
 | 
			
		||||
                filterString += "|";
 | 
			
		||||
            }
 | 
			
		||||
            filterString = filterString.Remove(filterString.Length - 1);
 | 
			
		||||
            return filterString;
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#endif
 | 
			
		||||
@@ -0,0 +1,3 @@
 | 
			
		||||
fileFormatVersion: 2
 | 
			
		||||
guid: 5d3a668018554b8a89c3fe12de72b60c
 | 
			
		||||
timeCreated: 1538067919
 | 
			
		||||
							
								
								
									
										119
									
								
								Assets/Plugins/StandaloneFileBrowser/StandaloneFileBrowserMac.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										119
									
								
								Assets/Plugins/StandaloneFileBrowser/StandaloneFileBrowserMac.cs
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,119 @@
 | 
			
		||||
#if UNITY_STANDALONE_OSX
 | 
			
		||||
 | 
			
		||||
using System;
 | 
			
		||||
using System.Runtime.InteropServices;
 | 
			
		||||
 | 
			
		||||
namespace SFB {
 | 
			
		||||
    public class StandaloneFileBrowserMac : IStandaloneFileBrowser {
 | 
			
		||||
        private static Action<string[]> _openFileCb;
 | 
			
		||||
        private static Action<string[]> _openFolderCb;
 | 
			
		||||
        private static Action<string> _saveFileCb;
 | 
			
		||||
 | 
			
		||||
        [UnmanagedFunctionPointer(CallingConvention.StdCall)]
 | 
			
		||||
        public delegate void AsyncCallback(string path);
 | 
			
		||||
 | 
			
		||||
        [AOT.MonoPInvokeCallback(typeof(AsyncCallback))]
 | 
			
		||||
        private static void openFileCb(string result) {
 | 
			
		||||
            _openFileCb.Invoke(result.Split((char)28));
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        [AOT.MonoPInvokeCallback(typeof(AsyncCallback))]
 | 
			
		||||
        private static void openFolderCb(string result) {
 | 
			
		||||
            _openFolderCb.Invoke(result.Split((char)28));
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        [AOT.MonoPInvokeCallback(typeof(AsyncCallback))]
 | 
			
		||||
        private static void saveFileCb(string result) {
 | 
			
		||||
            _saveFileCb.Invoke(result);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        [DllImport("StandaloneFileBrowser")]
 | 
			
		||||
        private static extern IntPtr DialogOpenFilePanel(string title, string directory, string extension, bool multiselect);
 | 
			
		||||
        [DllImport("StandaloneFileBrowser")]
 | 
			
		||||
        private static extern void DialogOpenFilePanelAsync(string title, string directory, string extension, bool multiselect, AsyncCallback callback);
 | 
			
		||||
        [DllImport("StandaloneFileBrowser")]
 | 
			
		||||
        private static extern IntPtr DialogOpenFolderPanel(string title, string directory, bool multiselect);
 | 
			
		||||
        [DllImport("StandaloneFileBrowser")]
 | 
			
		||||
        private static extern void DialogOpenFolderPanelAsync(string title, string directory, bool multiselect, AsyncCallback callback);
 | 
			
		||||
        [DllImport("StandaloneFileBrowser")]
 | 
			
		||||
        private static extern IntPtr DialogSaveFilePanel(string title, string directory, string defaultName, string extension);
 | 
			
		||||
        [DllImport("StandaloneFileBrowser")]
 | 
			
		||||
        private static extern void DialogSaveFilePanelAsync(string title, string directory, string defaultName, string extension, AsyncCallback callback);
 | 
			
		||||
 | 
			
		||||
        public string[] OpenFilePanel(string title, string directory, ExtensionFilter[] extensions, bool multiselect) {
 | 
			
		||||
            var paths = Marshal.PtrToStringAnsi(DialogOpenFilePanel(
 | 
			
		||||
                title,
 | 
			
		||||
                directory,
 | 
			
		||||
                GetFilterFromFileExtensionList(extensions),
 | 
			
		||||
                multiselect));
 | 
			
		||||
            return paths.Split((char)28);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public void OpenFilePanelAsync(string title, string directory, ExtensionFilter[] extensions, bool multiselect, Action<string[]> cb) {
 | 
			
		||||
            _openFileCb = cb;
 | 
			
		||||
            DialogOpenFilePanelAsync(
 | 
			
		||||
                title,
 | 
			
		||||
                directory,
 | 
			
		||||
                GetFilterFromFileExtensionList(extensions),
 | 
			
		||||
                multiselect,
 | 
			
		||||
                openFileCb);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public string[] OpenFolderPanel(string title, string directory, bool multiselect) {
 | 
			
		||||
            var paths = Marshal.PtrToStringAnsi(DialogOpenFolderPanel(
 | 
			
		||||
                title,
 | 
			
		||||
                directory,
 | 
			
		||||
                multiselect));
 | 
			
		||||
            return paths.Split((char)28);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public void OpenFolderPanelAsync(string title, string directory, bool multiselect, Action<string[]> cb) {
 | 
			
		||||
            _openFolderCb = cb;
 | 
			
		||||
            DialogOpenFolderPanelAsync(
 | 
			
		||||
                title,
 | 
			
		||||
                directory,
 | 
			
		||||
                multiselect,
 | 
			
		||||
                openFolderCb);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public string SaveFilePanel(string title, string directory, string defaultName, ExtensionFilter[] extensions) {
 | 
			
		||||
            return Marshal.PtrToStringAnsi(DialogSaveFilePanel(
 | 
			
		||||
                title,
 | 
			
		||||
                directory,
 | 
			
		||||
                defaultName,
 | 
			
		||||
                GetFilterFromFileExtensionList(extensions)));
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public void SaveFilePanelAsync(string title, string directory, string defaultName, ExtensionFilter[] extensions, Action<string> cb) {
 | 
			
		||||
            _saveFileCb = cb;
 | 
			
		||||
            DialogSaveFilePanelAsync(
 | 
			
		||||
                title,
 | 
			
		||||
                directory,
 | 
			
		||||
                defaultName,
 | 
			
		||||
                GetFilterFromFileExtensionList(extensions),
 | 
			
		||||
                saveFileCb);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        private static string GetFilterFromFileExtensionList(ExtensionFilter[] extensions) {
 | 
			
		||||
            if (extensions == null) {
 | 
			
		||||
                return "";
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            var filterString = "";
 | 
			
		||||
            foreach (var filter in extensions) {
 | 
			
		||||
                filterString += filter.Name + ";";
 | 
			
		||||
 | 
			
		||||
                foreach (var ext in filter.Extensions) {
 | 
			
		||||
                    filterString += ext + ",";
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
                filterString = filterString.Remove(filterString.Length - 1);
 | 
			
		||||
                filterString += "|";
 | 
			
		||||
            }
 | 
			
		||||
            filterString = filterString.Remove(filterString.Length - 1);
 | 
			
		||||
            return filterString;
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#endif
 | 
			
		||||
@@ -0,0 +1,12 @@
 | 
			
		||||
fileFormatVersion: 2
 | 
			
		||||
guid: bcb49ddb0ed5644fda9c3b055cafa27a
 | 
			
		||||
timeCreated: 1483902788
 | 
			
		||||
licenseType: Pro
 | 
			
		||||
MonoImporter:
 | 
			
		||||
  serializedVersion: 2
 | 
			
		||||
  defaultReferences: []
 | 
			
		||||
  executionOrder: 0
 | 
			
		||||
  icon: {instanceID: 0}
 | 
			
		||||
  userData: 
 | 
			
		||||
  assetBundleName: 
 | 
			
		||||
  assetBundleVariant: 
 | 
			
		||||
@@ -0,0 +1,137 @@
 | 
			
		||||
#if UNITY_STANDALONE_WIN
 | 
			
		||||
 | 
			
		||||
using System;
 | 
			
		||||
using System.IO;
 | 
			
		||||
using System.Windows.Forms;
 | 
			
		||||
using System.Runtime.InteropServices;
 | 
			
		||||
using Ookii.Dialogs;
 | 
			
		||||
 | 
			
		||||
namespace SFB {
 | 
			
		||||
    // For fullscreen support
 | 
			
		||||
    // - WindowWrapper class and GetActiveWindow() are required for modal file dialog.
 | 
			
		||||
    // - "PlayerSettings/Visible In Background" should be enabled, otherwise when file dialog opened app window minimizes automatically.
 | 
			
		||||
 | 
			
		||||
    public class WindowWrapper : IWin32Window {
 | 
			
		||||
        private IntPtr _hwnd;
 | 
			
		||||
        public WindowWrapper(IntPtr handle) { _hwnd = handle; }
 | 
			
		||||
        public IntPtr Handle { get { return _hwnd; } }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public class StandaloneFileBrowserWindows : IStandaloneFileBrowser {
 | 
			
		||||
        [DllImport("user32.dll")]
 | 
			
		||||
        private static extern IntPtr GetActiveWindow();
 | 
			
		||||
 | 
			
		||||
        public string[] OpenFilePanel(string title, string directory, ExtensionFilter[] extensions, bool multiselect) {
 | 
			
		||||
            var fd = new VistaOpenFileDialog();
 | 
			
		||||
            fd.Title = title;
 | 
			
		||||
            if (extensions != null) {
 | 
			
		||||
                fd.Filter = GetFilterFromFileExtensionList(extensions);
 | 
			
		||||
                fd.FilterIndex = 1;
 | 
			
		||||
            }
 | 
			
		||||
            else {
 | 
			
		||||
                fd.Filter = string.Empty;
 | 
			
		||||
            }
 | 
			
		||||
            fd.Multiselect = multiselect;
 | 
			
		||||
            if (!string.IsNullOrEmpty(directory)) {
 | 
			
		||||
                fd.FileName = GetDirectoryPath(directory);
 | 
			
		||||
            }
 | 
			
		||||
            var res = fd.ShowDialog(new WindowWrapper(GetActiveWindow()));
 | 
			
		||||
            var filenames = res == DialogResult.OK ? fd.FileNames : new string[0];
 | 
			
		||||
            fd.Dispose();
 | 
			
		||||
            return filenames;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public void OpenFilePanelAsync(string title, string directory, ExtensionFilter[] extensions, bool multiselect, Action<string[]> cb) {
 | 
			
		||||
            cb.Invoke(OpenFilePanel(title, directory, extensions, multiselect));
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public string[] OpenFolderPanel(string title, string directory, bool multiselect) {
 | 
			
		||||
            var fd = new VistaFolderBrowserDialog();
 | 
			
		||||
            fd.Description = title;
 | 
			
		||||
            if (!string.IsNullOrEmpty(directory)) {
 | 
			
		||||
                fd.SelectedPath = GetDirectoryPath(directory);
 | 
			
		||||
            }
 | 
			
		||||
            var res = fd.ShowDialog(new WindowWrapper(GetActiveWindow()));
 | 
			
		||||
            var filenames = res == DialogResult.OK ? new []{ fd.SelectedPath } : new string[0];
 | 
			
		||||
            fd.Dispose();
 | 
			
		||||
            return filenames;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public void OpenFolderPanelAsync(string title, string directory, bool multiselect, Action<string[]> cb) {
 | 
			
		||||
            cb.Invoke(OpenFolderPanel(title, directory, multiselect));
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public string SaveFilePanel(string title, string directory, string defaultName, ExtensionFilter[] extensions) {
 | 
			
		||||
            var fd = new VistaSaveFileDialog();
 | 
			
		||||
            fd.Title = title;
 | 
			
		||||
 | 
			
		||||
            var finalFilename = "";
 | 
			
		||||
 | 
			
		||||
            if (!string.IsNullOrEmpty(directory)) {
 | 
			
		||||
                finalFilename = GetDirectoryPath(directory);
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            if (!string.IsNullOrEmpty(defaultName)) {
 | 
			
		||||
                finalFilename += defaultName;
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            fd.FileName = finalFilename;
 | 
			
		||||
            if (extensions != null) {
 | 
			
		||||
                fd.Filter = GetFilterFromFileExtensionList(extensions);
 | 
			
		||||
                fd.FilterIndex = 1;
 | 
			
		||||
                fd.DefaultExt = extensions[0].Extensions[0];
 | 
			
		||||
                fd.AddExtension = true;
 | 
			
		||||
            }
 | 
			
		||||
            else {
 | 
			
		||||
                fd.DefaultExt = string.Empty;
 | 
			
		||||
                fd.Filter = string.Empty;
 | 
			
		||||
                fd.AddExtension = false;
 | 
			
		||||
            }
 | 
			
		||||
            var res = fd.ShowDialog(new WindowWrapper(GetActiveWindow()));
 | 
			
		||||
            var filename = res == DialogResult.OK ? fd.FileName : "";
 | 
			
		||||
            fd.Dispose();
 | 
			
		||||
            return filename;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public void SaveFilePanelAsync(string title, string directory, string defaultName, ExtensionFilter[] extensions, Action<string> cb) {
 | 
			
		||||
            cb.Invoke(SaveFilePanel(title, directory, defaultName, extensions));
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        // .NET Framework FileDialog Filter format
 | 
			
		||||
        // https://msdn.microsoft.com/en-us/library/microsoft.win32.filedialog.filter
 | 
			
		||||
        private static string GetFilterFromFileExtensionList(ExtensionFilter[] extensions) {
 | 
			
		||||
            var filterString = "";
 | 
			
		||||
            foreach (var filter in extensions) {
 | 
			
		||||
                filterString += filter.Name + "(";
 | 
			
		||||
 | 
			
		||||
                foreach (var ext in filter.Extensions) {
 | 
			
		||||
                    filterString += "*." + ext + ",";
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
                filterString = filterString.Remove(filterString.Length - 1);
 | 
			
		||||
                filterString += ") |";
 | 
			
		||||
 | 
			
		||||
                foreach (var ext in filter.Extensions) {
 | 
			
		||||
                    filterString += "*." + ext + "; ";
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
                filterString += "|";
 | 
			
		||||
            }
 | 
			
		||||
            filterString = filterString.Remove(filterString.Length - 1);
 | 
			
		||||
            return filterString;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        private static string GetDirectoryPath(string directory) {
 | 
			
		||||
            var directoryPath = Path.GetFullPath(directory);
 | 
			
		||||
            if (!directoryPath.EndsWith("\\")) {
 | 
			
		||||
                directoryPath += "\\";
 | 
			
		||||
            }
 | 
			
		||||
            if (Path.GetPathRoot(directoryPath) == directoryPath) {
 | 
			
		||||
                return directory;
 | 
			
		||||
            }
 | 
			
		||||
            return Path.GetDirectoryName(directoryPath) + Path.DirectorySeparatorChar;
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#endif
 | 
			
		||||
@@ -0,0 +1,12 @@
 | 
			
		||||
fileFormatVersion: 2
 | 
			
		||||
guid: 194e247414a78461d83ae606c1b96917
 | 
			
		||||
timeCreated: 1483902788
 | 
			
		||||
licenseType: Pro
 | 
			
		||||
MonoImporter:
 | 
			
		||||
  serializedVersion: 2
 | 
			
		||||
  defaultReferences: []
 | 
			
		||||
  executionOrder: 0
 | 
			
		||||
  icon: {instanceID: 0}
 | 
			
		||||
  userData: 
 | 
			
		||||
  assetBundleName: 
 | 
			
		||||
  assetBundleVariant: 
 | 
			
		||||
							
								
								
									
										8
									
								
								Assets/Plugins/UnityWindowsFileDrag-Drop.meta
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										8
									
								
								Assets/Plugins/UnityWindowsFileDrag-Drop.meta
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,8 @@
 | 
			
		||||
fileFormatVersion: 2
 | 
			
		||||
guid: 6bdd66e9646020e4f87e93d796c27b9c
 | 
			
		||||
folderAsset: yes
 | 
			
		||||
DefaultImporter:
 | 
			
		||||
  externalObjects: {}
 | 
			
		||||
  userData: 
 | 
			
		||||
  assetBundleName: 
 | 
			
		||||
  assetBundleVariant: 
 | 
			
		||||
							
								
								
									
										494
									
								
								Assets/Plugins/UnityWindowsFileDrag-Drop/B83.Win32.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										494
									
								
								Assets/Plugins/UnityWindowsFileDrag-Drop/B83.Win32.cs
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,494 @@
 | 
			
		||||
/* * * * *
 | 
			
		||||
 * This is a collection of Win API helpers. Mainly dealing with window message hooks
 | 
			
		||||
 * and file drag&drop support for Windows standalone Unity applications.
 | 
			
		||||
 * 
 | 
			
		||||
 * 2019.11.28 - Changed the "UnityDragAndDropHook" class to a static class. This
 | 
			
		||||
 *   has been done for IL2CPP support. IL2CPP can not marshall instance method
 | 
			
		||||
 *   callbacks passed to native code. So the callbacks must be static methods.
 | 
			
		||||
 *   Therefore all fields involved also need to be static.
 | 
			
		||||
 * 
 | 
			
		||||
 * The MIT License (MIT)
 | 
			
		||||
 * 
 | 
			
		||||
 * Copyright (c) 2018 Markus Göbel (Bunny83)
 | 
			
		||||
 * 
 | 
			
		||||
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 | 
			
		||||
 * of this software and associated documentation files (the "Software"), to deal
 | 
			
		||||
 * in the Software without restriction, including without limitation the rights
 | 
			
		||||
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 | 
			
		||||
 * copies of the Software, and to permit persons to whom the Software is
 | 
			
		||||
 * furnished to do so, subject to the following conditions:
 | 
			
		||||
 * 
 | 
			
		||||
 * The above copyright notice and this permission notice shall be included in all
 | 
			
		||||
 * copies or substantial portions of the Software.
 | 
			
		||||
 * 
 | 
			
		||||
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 | 
			
		||||
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 | 
			
		||||
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 | 
			
		||||
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 | 
			
		||||
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 | 
			
		||||
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 | 
			
		||||
 * SOFTWARE.
 | 
			
		||||
 * 
 | 
			
		||||
 * * * * */
 | 
			
		||||
using System;
 | 
			
		||||
using System.Collections.Generic;
 | 
			
		||||
using System.Runtime.InteropServices;
 | 
			
		||||
 | 
			
		||||
namespace B83.Win32
 | 
			
		||||
{
 | 
			
		||||
    public enum HookType : int
 | 
			
		||||
    {
 | 
			
		||||
        WH_JOURNALRECORD = 0,
 | 
			
		||||
        WH_JOURNALPLAYBACK = 1,
 | 
			
		||||
        WH_KEYBOARD = 2,
 | 
			
		||||
        WH_GETMESSAGE = 3,
 | 
			
		||||
        WH_CALLWNDPROC = 4,
 | 
			
		||||
        WH_CBT = 5,
 | 
			
		||||
        WH_SYSMSGFILTER = 6,
 | 
			
		||||
        WH_MOUSE = 7,
 | 
			
		||||
        WH_HARDWARE = 8,
 | 
			
		||||
        WH_DEBUG = 9,
 | 
			
		||||
        WH_SHELL = 10,
 | 
			
		||||
        WH_FOREGROUNDIDLE = 11,
 | 
			
		||||
        WH_CALLWNDPROCRET = 12,
 | 
			
		||||
        WH_KEYBOARD_LL = 13,
 | 
			
		||||
        WH_MOUSE_LL = 14
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    // windows messages
 | 
			
		||||
    public enum WM : uint
 | 
			
		||||
    {
 | 
			
		||||
        NULL = 0x0000,
 | 
			
		||||
        CREATE = 0x0001,
 | 
			
		||||
        DESTROY = 0x0002,
 | 
			
		||||
        MOVE = 0x0003,
 | 
			
		||||
        SIZE = 0x0005,
 | 
			
		||||
        ACTIVATE = 0x0006,
 | 
			
		||||
        SETFOCUS = 0x0007,
 | 
			
		||||
        KILLFOCUS = 0x0008,
 | 
			
		||||
        ENABLE = 0x000A,
 | 
			
		||||
        SETREDRAW = 0x000B,
 | 
			
		||||
        SETTEXT = 0x000C,
 | 
			
		||||
        GETTEXT = 0x000D,
 | 
			
		||||
        GETTEXTLENGTH = 0x000E,
 | 
			
		||||
        PAINT = 0x000F,
 | 
			
		||||
        CLOSE = 0x0010,
 | 
			
		||||
        QUERYENDSESSION = 0x0011,
 | 
			
		||||
        QUERYOPEN = 0x0013,
 | 
			
		||||
        ENDSESSION = 0x0016,
 | 
			
		||||
        QUIT = 0x0012,
 | 
			
		||||
        ERASEBKGND = 0x0014,
 | 
			
		||||
        SYSCOLORCHANGE = 0x0015,
 | 
			
		||||
        SHOWWINDOW = 0x0018,
 | 
			
		||||
        WININICHANGE = 0x001A,
 | 
			
		||||
        SETTINGCHANGE = WININICHANGE,
 | 
			
		||||
        DEVMODECHANGE = 0x001B,
 | 
			
		||||
        ACTIVATEAPP = 0x001C,
 | 
			
		||||
        FONTCHANGE = 0x001D,
 | 
			
		||||
        TIMECHANGE = 0x001E,
 | 
			
		||||
        CANCELMODE = 0x001F,
 | 
			
		||||
        SETCURSOR = 0x0020,
 | 
			
		||||
        MOUSEACTIVATE = 0x0021,
 | 
			
		||||
        CHILDACTIVATE = 0x0022,
 | 
			
		||||
        QUEUESYNC = 0x0023,
 | 
			
		||||
        GETMINMAXINFO = 0x0024,
 | 
			
		||||
        PAINTICON = 0x0026,
 | 
			
		||||
        ICONERASEBKGND = 0x0027,
 | 
			
		||||
        NEXTDLGCTL = 0x0028,
 | 
			
		||||
        SPOOLERSTATUS = 0x002A,
 | 
			
		||||
        DRAWITEM = 0x002B,
 | 
			
		||||
        MEASUREITEM = 0x002C,
 | 
			
		||||
        DELETEITEM = 0x002D,
 | 
			
		||||
        VKEYTOITEM = 0x002E,
 | 
			
		||||
        CHARTOITEM = 0x002F,
 | 
			
		||||
        SETFONT = 0x0030,
 | 
			
		||||
        GETFONT = 0x0031,
 | 
			
		||||
        SETHOTKEY = 0x0032,
 | 
			
		||||
        GETHOTKEY = 0x0033,
 | 
			
		||||
        QUERYDRAGICON = 0x0037,
 | 
			
		||||
        COMPAREITEM = 0x0039,
 | 
			
		||||
        GETOBJECT = 0x003D,
 | 
			
		||||
        COMPACTING = 0x0041,
 | 
			
		||||
        [Obsolete]
 | 
			
		||||
        COMMNOTIFY = 0x0044,
 | 
			
		||||
        WINDOWPOSCHANGING = 0x0046,
 | 
			
		||||
        WINDOWPOSCHANGED = 0x0047,
 | 
			
		||||
        [Obsolete]
 | 
			
		||||
        POWER = 0x0048,
 | 
			
		||||
        COPYDATA = 0x004A,
 | 
			
		||||
        CANCELJOURNAL = 0x004B,
 | 
			
		||||
        NOTIFY = 0x004E,
 | 
			
		||||
        INPUTLANGCHANGEREQUEST = 0x0050,
 | 
			
		||||
        INPUTLANGCHANGE = 0x0051,
 | 
			
		||||
        TCARD = 0x0052,
 | 
			
		||||
        HELP = 0x0053,
 | 
			
		||||
        USERCHANGED = 0x0054,
 | 
			
		||||
        NOTIFYFORMAT = 0x0055,
 | 
			
		||||
        CONTEXTMENU = 0x007B,
 | 
			
		||||
        STYLECHANGING = 0x007C,
 | 
			
		||||
        STYLECHANGED = 0x007D,
 | 
			
		||||
        DISPLAYCHANGE = 0x007E,
 | 
			
		||||
        GETICON = 0x007F,
 | 
			
		||||
        SETICON = 0x0080,
 | 
			
		||||
        NCCREATE = 0x0081,
 | 
			
		||||
        NCDESTROY = 0x0082,
 | 
			
		||||
        NCCALCSIZE = 0x0083,
 | 
			
		||||
        NCHITTEST = 0x0084,
 | 
			
		||||
        NCPAINT = 0x0085,
 | 
			
		||||
        NCACTIVATE = 0x0086,
 | 
			
		||||
        GETDLGCODE = 0x0087,
 | 
			
		||||
        SYNCPAINT = 0x0088,
 | 
			
		||||
        NCMOUSEMOVE = 0x00A0,
 | 
			
		||||
        NCLBUTTONDOWN = 0x00A1,
 | 
			
		||||
        NCLBUTTONUP = 0x00A2,
 | 
			
		||||
        NCLBUTTONDBLCLK = 0x00A3,
 | 
			
		||||
        NCRBUTTONDOWN = 0x00A4,
 | 
			
		||||
        NCRBUTTONUP = 0x00A5,
 | 
			
		||||
        NCRBUTTONDBLCLK = 0x00A6,
 | 
			
		||||
        NCMBUTTONDOWN = 0x00A7,
 | 
			
		||||
        NCMBUTTONUP = 0x00A8,
 | 
			
		||||
        NCMBUTTONDBLCLK = 0x00A9,
 | 
			
		||||
        NCXBUTTONDOWN = 0x00AB,
 | 
			
		||||
        NCXBUTTONUP = 0x00AC,
 | 
			
		||||
        NCXBUTTONDBLCLK = 0x00AD,
 | 
			
		||||
        INPUT_DEVICE_CHANGE = 0x00FE,
 | 
			
		||||
        INPUT = 0x00FF,
 | 
			
		||||
        KEYFIRST = 0x0100,
 | 
			
		||||
        KEYDOWN = 0x0100,
 | 
			
		||||
        KEYUP = 0x0101,
 | 
			
		||||
        CHAR = 0x0102,
 | 
			
		||||
        DEADCHAR = 0x0103,
 | 
			
		||||
        SYSKEYDOWN = 0x0104,
 | 
			
		||||
        SYSKEYUP = 0x0105,
 | 
			
		||||
        SYSCHAR = 0x0106,
 | 
			
		||||
        SYSDEADCHAR = 0x0107,
 | 
			
		||||
        UNICHAR = 0x0109,
 | 
			
		||||
        KEYLAST = 0x0108,
 | 
			
		||||
        IME_STARTCOMPOSITION = 0x010D,
 | 
			
		||||
        IME_ENDCOMPOSITION = 0x010E,
 | 
			
		||||
        IME_COMPOSITION = 0x010F,
 | 
			
		||||
        IME_KEYLAST = 0x010F,
 | 
			
		||||
        INITDIALOG = 0x0110,
 | 
			
		||||
        COMMAND = 0x0111,
 | 
			
		||||
        SYSCOMMAND = 0x0112,
 | 
			
		||||
        TIMER = 0x0113,
 | 
			
		||||
        HSCROLL = 0x0114,
 | 
			
		||||
        VSCROLL = 0x0115,
 | 
			
		||||
        INITMENU = 0x0116,
 | 
			
		||||
        INITMENUPOPUP = 0x0117,
 | 
			
		||||
        MENUSELECT = 0x011F,
 | 
			
		||||
        MENUCHAR = 0x0120,
 | 
			
		||||
        ENTERIDLE = 0x0121,
 | 
			
		||||
        MENURBUTTONUP = 0x0122,
 | 
			
		||||
        MENUDRAG = 0x0123,
 | 
			
		||||
        MENUGETOBJECT = 0x0124,
 | 
			
		||||
        UNINITMENUPOPUP = 0x0125,
 | 
			
		||||
        MENUCOMMAND = 0x0126,
 | 
			
		||||
        CHANGEUISTATE = 0x0127,
 | 
			
		||||
        UPDATEUISTATE = 0x0128,
 | 
			
		||||
        QUERYUISTATE = 0x0129,
 | 
			
		||||
        CTLCOLORMSGBOX = 0x0132,
 | 
			
		||||
        CTLCOLOREDIT = 0x0133,
 | 
			
		||||
        CTLCOLORLISTBOX = 0x0134,
 | 
			
		||||
        CTLCOLORBTN = 0x0135,
 | 
			
		||||
        CTLCOLORDLG = 0x0136,
 | 
			
		||||
        CTLCOLORSCROLLBAR = 0x0137,
 | 
			
		||||
        CTLCOLORSTATIC = 0x0138,
 | 
			
		||||
        MOUSEFIRST = 0x0200,
 | 
			
		||||
        MOUSEMOVE = 0x0200,
 | 
			
		||||
        LBUTTONDOWN = 0x0201,
 | 
			
		||||
        LBUTTONUP = 0x0202,
 | 
			
		||||
        LBUTTONDBLCLK = 0x0203,
 | 
			
		||||
        RBUTTONDOWN = 0x0204,
 | 
			
		||||
        RBUTTONUP = 0x0205,
 | 
			
		||||
        RBUTTONDBLCLK = 0x0206,
 | 
			
		||||
        MBUTTONDOWN = 0x0207,
 | 
			
		||||
        MBUTTONUP = 0x0208,
 | 
			
		||||
        MBUTTONDBLCLK = 0x0209,
 | 
			
		||||
        MOUSEWHEEL = 0x020A,
 | 
			
		||||
        XBUTTONDOWN = 0x020B,
 | 
			
		||||
        XBUTTONUP = 0x020C,
 | 
			
		||||
        XBUTTONDBLCLK = 0x020D,
 | 
			
		||||
        MOUSEHWHEEL = 0x020E,
 | 
			
		||||
        MOUSELAST = 0x020E,
 | 
			
		||||
        PARENTNOTIFY = 0x0210,
 | 
			
		||||
        ENTERMENULOOP = 0x0211,
 | 
			
		||||
        EXITMENULOOP = 0x0212,
 | 
			
		||||
        NEXTMENU = 0x0213,
 | 
			
		||||
        SIZING = 0x0214,
 | 
			
		||||
        CAPTURECHANGED = 0x0215,
 | 
			
		||||
        MOVING = 0x0216,
 | 
			
		||||
        POWERBROADCAST = 0x0218,
 | 
			
		||||
        DEVICECHANGE = 0x0219,
 | 
			
		||||
        MDICREATE = 0x0220,
 | 
			
		||||
        MDIDESTROY = 0x0221,
 | 
			
		||||
        MDIACTIVATE = 0x0222,
 | 
			
		||||
        MDIRESTORE = 0x0223,
 | 
			
		||||
        MDINEXT = 0x0224,
 | 
			
		||||
        MDIMAXIMIZE = 0x0225,
 | 
			
		||||
        MDITILE = 0x0226,
 | 
			
		||||
        MDICASCADE = 0x0227,
 | 
			
		||||
        MDIICONARRANGE = 0x0228,
 | 
			
		||||
        MDIGETACTIVE = 0x0229,
 | 
			
		||||
        MDISETMENU = 0x0230,
 | 
			
		||||
        ENTERSIZEMOVE = 0x0231,
 | 
			
		||||
        EXITSIZEMOVE = 0x0232,
 | 
			
		||||
        DROPFILES = 0x0233,
 | 
			
		||||
        MDIREFRESHMENU = 0x0234,
 | 
			
		||||
        IME_SETCONTEXT = 0x0281,
 | 
			
		||||
        IME_NOTIFY = 0x0282,
 | 
			
		||||
        IME_CONTROL = 0x0283,
 | 
			
		||||
        IME_COMPOSITIONFULL = 0x0284,
 | 
			
		||||
        IME_SELECT = 0x0285,
 | 
			
		||||
        IME_CHAR = 0x0286,
 | 
			
		||||
        IME_REQUEST = 0x0288,
 | 
			
		||||
        IME_KEYDOWN = 0x0290,
 | 
			
		||||
        IME_KEYUP = 0x0291,
 | 
			
		||||
        MOUSEHOVER = 0x02A1,
 | 
			
		||||
        MOUSELEAVE = 0x02A3,
 | 
			
		||||
        NCMOUSEHOVER = 0x02A0,
 | 
			
		||||
        NCMOUSELEAVE = 0x02A2,
 | 
			
		||||
        WTSSESSION_CHANGE = 0x02B1,
 | 
			
		||||
        TABLET_FIRST = 0x02c0,
 | 
			
		||||
        TABLET_LAST = 0x02df,
 | 
			
		||||
        CUT = 0x0300,
 | 
			
		||||
        COPY = 0x0301,
 | 
			
		||||
        PASTE = 0x0302,
 | 
			
		||||
        CLEAR = 0x0303,
 | 
			
		||||
        UNDO = 0x0304,
 | 
			
		||||
        RENDERFORMAT = 0x0305,
 | 
			
		||||
        RENDERALLFORMATS = 0x0306,
 | 
			
		||||
        DESTROYCLIPBOARD = 0x0307,
 | 
			
		||||
        DRAWCLIPBOARD = 0x0308,
 | 
			
		||||
        PAINTCLIPBOARD = 0x0309,
 | 
			
		||||
        VSCROLLCLIPBOARD = 0x030A,
 | 
			
		||||
        SIZECLIPBOARD = 0x030B,
 | 
			
		||||
        ASKCBFORMATNAME = 0x030C,
 | 
			
		||||
        CHANGECBCHAIN = 0x030D,
 | 
			
		||||
        HSCROLLCLIPBOARD = 0x030E,
 | 
			
		||||
        QUERYNEWPALETTE = 0x030F,
 | 
			
		||||
        PALETTEISCHANGING = 0x0310,
 | 
			
		||||
        PALETTECHANGED = 0x0311,
 | 
			
		||||
        HOTKEY = 0x0312,
 | 
			
		||||
        PRINT = 0x0317,
 | 
			
		||||
        PRINTCLIENT = 0x0318,
 | 
			
		||||
        APPCOMMAND = 0x0319,
 | 
			
		||||
        THEMECHANGED = 0x031A,
 | 
			
		||||
        CLIPBOARDUPDATE = 0x031D,
 | 
			
		||||
        DWMCOMPOSITIONCHANGED = 0x031E,
 | 
			
		||||
        DWMNCRENDERINGCHANGED = 0x031F,
 | 
			
		||||
        DWMCOLORIZATIONCOLORCHANGED = 0x0320,
 | 
			
		||||
        DWMWINDOWMAXIMIZEDCHANGE = 0x0321,
 | 
			
		||||
        GETTITLEBARINFOEX = 0x033F,
 | 
			
		||||
        HANDHELDFIRST = 0x0358,
 | 
			
		||||
        HANDHELDLAST = 0x035F,
 | 
			
		||||
        AFXFIRST = 0x0360,
 | 
			
		||||
        AFXLAST = 0x037F,
 | 
			
		||||
        PENWINFIRST = 0x0380,
 | 
			
		||||
        PENWINLAST = 0x038F,
 | 
			
		||||
        APP = 0x8000,
 | 
			
		||||
        USER = 0x0400,
 | 
			
		||||
        CPL_LAUNCH = USER + 0x1000,
 | 
			
		||||
        CPL_LAUNCHED = USER + 0x1001,
 | 
			
		||||
        SYSTIMER = 0x118,
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    // WH_CALLWNDPROC
 | 
			
		||||
    [StructLayout(LayoutKind.Sequential)]
 | 
			
		||||
    public struct CWPSTRUCT
 | 
			
		||||
    {
 | 
			
		||||
        public IntPtr lParam;
 | 
			
		||||
        public IntPtr wParam;
 | 
			
		||||
        public WM message;
 | 
			
		||||
        public IntPtr hwnd;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    [StructLayout(LayoutKind.Sequential)]
 | 
			
		||||
    public struct POINT
 | 
			
		||||
    {
 | 
			
		||||
        public int x, y;
 | 
			
		||||
        public POINT(int aX, int aY)
 | 
			
		||||
        {
 | 
			
		||||
            x = aX;
 | 
			
		||||
            y = aY;
 | 
			
		||||
        }
 | 
			
		||||
        public override string ToString()
 | 
			
		||||
        {
 | 
			
		||||
            return "(" + x + ", " + y + ")";
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    //WH_GETMESSAGE
 | 
			
		||||
    [StructLayout(LayoutKind.Sequential)]
 | 
			
		||||
    public struct MSG
 | 
			
		||||
    {
 | 
			
		||||
        public IntPtr hwnd;
 | 
			
		||||
        public WM message;
 | 
			
		||||
        public IntPtr wParam;
 | 
			
		||||
        public IntPtr lParam;
 | 
			
		||||
        public ushort time;
 | 
			
		||||
        public POINT pt;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    [StructLayout(LayoutKind.Sequential)]
 | 
			
		||||
    public struct RECT
 | 
			
		||||
    {
 | 
			
		||||
        public int Left, Top, Right, Bottom;
 | 
			
		||||
 | 
			
		||||
        public RECT(int left, int top, int right, int bottom)
 | 
			
		||||
        {
 | 
			
		||||
            Left = left;
 | 
			
		||||
            Top = top;
 | 
			
		||||
            Right = right;
 | 
			
		||||
            Bottom = bottom;
 | 
			
		||||
        }
 | 
			
		||||
        public override string ToString()
 | 
			
		||||
        {
 | 
			
		||||
            return "(" + Left + ", " + Top + ", " + Right + ", " + Bottom + ")";
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public delegate IntPtr HookProc(int code, IntPtr wParam, ref MSG lParam);
 | 
			
		||||
    public delegate bool EnumThreadDelegate(IntPtr Hwnd, IntPtr lParam);
 | 
			
		||||
 | 
			
		||||
#if UNITY_STANDALONE_WIN || UNITY_EDITOR_WIN
 | 
			
		||||
 | 
			
		||||
    public static class Window
 | 
			
		||||
    {
 | 
			
		||||
        [DllImport("user32.dll")]
 | 
			
		||||
        public static extern bool EnumThreadWindows(uint dwThreadId, EnumThreadDelegate lpfn, IntPtr lParam);
 | 
			
		||||
 | 
			
		||||
        [DllImport("user32.dll", SetLastError = true)]
 | 
			
		||||
        public static extern bool GetWindowRect(IntPtr hwnd, out RECT lpRect);
 | 
			
		||||
 | 
			
		||||
        [DllImport("user32.dll")]
 | 
			
		||||
        public static extern bool IsWindowVisible(IntPtr hWnd);
 | 
			
		||||
 | 
			
		||||
        [DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Auto)]
 | 
			
		||||
        static extern int GetClassName(IntPtr hWnd, System.Text.StringBuilder lpClassName, int nMaxCount);
 | 
			
		||||
        public static string GetClassName(IntPtr hWnd)
 | 
			
		||||
        {
 | 
			
		||||
            var sb = new System.Text.StringBuilder(256);
 | 
			
		||||
            int count = GetClassName(hWnd, sb, 256);
 | 
			
		||||
            return sb.ToString(0, count);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        [DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Auto)]
 | 
			
		||||
        static extern int GetWindowTextLength(IntPtr hWnd);
 | 
			
		||||
        [DllImport("user32.dll", CharSet = CharSet.Unicode, SetLastError = true)]
 | 
			
		||||
        static extern int GetWindowText(IntPtr hWnd, System.Text.StringBuilder lpString, int nMaxCount);
 | 
			
		||||
        public static string GetWindowText(IntPtr hWnd)
 | 
			
		||||
        {
 | 
			
		||||
            int length = GetWindowTextLength(hWnd) + 2;
 | 
			
		||||
            var sb = new System.Text.StringBuilder(length);
 | 
			
		||||
            int count = GetWindowText(hWnd, sb, length);
 | 
			
		||||
            return sb.ToString(0, count);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public static class WinAPI
 | 
			
		||||
    {
 | 
			
		||||
        [DllImport("kernel32.dll", CharSet = CharSet.Auto)]
 | 
			
		||||
        public static extern IntPtr GetModuleHandle(string lpModuleName);
 | 
			
		||||
        [DllImport("kernel32.dll")]
 | 
			
		||||
        public static extern uint GetCurrentThreadId();
 | 
			
		||||
 | 
			
		||||
        [DllImport("user32.dll", SetLastError = true)]
 | 
			
		||||
        public static extern IntPtr SetWindowsHookEx(HookType hookType, HookProc lpfn, IntPtr hMod, uint dwThreadId);
 | 
			
		||||
        [DllImport("user32.dll", SetLastError = true)]
 | 
			
		||||
        public static extern bool UnhookWindowsHookEx(IntPtr hhk);
 | 
			
		||||
        [DllImport("user32.dll")]
 | 
			
		||||
        public static extern IntPtr CallNextHookEx(IntPtr hhk, int nCode, IntPtr wParam, ref MSG lParam);
 | 
			
		||||
 | 
			
		||||
        [DllImport("shell32.dll")]
 | 
			
		||||
        public static extern void DragAcceptFiles(IntPtr hwnd, bool fAccept);
 | 
			
		||||
        [DllImport("shell32.dll", CharSet = CharSet.Unicode)]
 | 
			
		||||
        public static extern uint DragQueryFile(IntPtr hDrop, uint iFile, System.Text.StringBuilder lpszFile, uint cch);
 | 
			
		||||
        [DllImport("shell32.dll")]
 | 
			
		||||
        public static extern void DragFinish(IntPtr hDrop);
 | 
			
		||||
 | 
			
		||||
        [DllImport("shell32.dll")]
 | 
			
		||||
        public static extern void DragQueryPoint(IntPtr hDrop, out POINT pos);
 | 
			
		||||
    }
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    public static class UnityDragAndDropHook
 | 
			
		||||
    {
 | 
			
		||||
        public delegate void DroppedFilesEvent(List<string> aPathNames, POINT aDropPoint);
 | 
			
		||||
#pragma warning disable CS0067
 | 
			
		||||
        public static event DroppedFilesEvent OnDroppedFiles;
 | 
			
		||||
#pragma warning restore CS0067
 | 
			
		||||
 | 
			
		||||
#if UNITY_STANDALONE_WIN && !UNITY_EDITOR_WIN
 | 
			
		||||
 | 
			
		||||
        private static uint threadId;
 | 
			
		||||
        private static IntPtr mainWindow = IntPtr.Zero;
 | 
			
		||||
        private static IntPtr m_Hook;
 | 
			
		||||
        private static string m_ClassName = "UnityWndClass";
 | 
			
		||||
 | 
			
		||||
        // attribute required for IL2CPP, also has to be a static method
 | 
			
		||||
        [AOT.MonoPInvokeCallback(typeof(EnumThreadDelegate))]
 | 
			
		||||
        private static bool EnumCallback(IntPtr W, IntPtr _)
 | 
			
		||||
        {
 | 
			
		||||
            if (Window.IsWindowVisible(W) && (mainWindow == IntPtr.Zero || (m_ClassName != null && Window.GetClassName(W) == m_ClassName)))
 | 
			
		||||
            {
 | 
			
		||||
                mainWindow = W;
 | 
			
		||||
            }
 | 
			
		||||
            return true;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public static void InstallHook()
 | 
			
		||||
        {
 | 
			
		||||
            threadId = WinAPI.GetCurrentThreadId();
 | 
			
		||||
            if (threadId > 0)
 | 
			
		||||
                Window.EnumThreadWindows(threadId, EnumCallback, IntPtr.Zero);
 | 
			
		||||
 | 
			
		||||
            var hModule = WinAPI.GetModuleHandle(null);
 | 
			
		||||
            m_Hook = WinAPI.SetWindowsHookEx(HookType.WH_GETMESSAGE, Callback, hModule, threadId);
 | 
			
		||||
            // Allow dragging of files onto the main window. generates the WM_DROPFILES message
 | 
			
		||||
            WinAPI.DragAcceptFiles(mainWindow, true);
 | 
			
		||||
        }
 | 
			
		||||
        public static void UninstallHook()
 | 
			
		||||
        {
 | 
			
		||||
            WinAPI.UnhookWindowsHookEx(m_Hook);
 | 
			
		||||
            WinAPI.DragAcceptFiles(mainWindow, false);
 | 
			
		||||
            m_Hook = IntPtr.Zero;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        // attribute required for IL2CPP, also has to be a static method
 | 
			
		||||
        [AOT.MonoPInvokeCallback(typeof(HookProc))]
 | 
			
		||||
        private static IntPtr Callback(int code, IntPtr wParam, ref MSG lParam)
 | 
			
		||||
        {
 | 
			
		||||
            if (code == 0 && lParam.message == WM.DROPFILES)
 | 
			
		||||
            {
 | 
			
		||||
                POINT pos;
 | 
			
		||||
                WinAPI.DragQueryPoint(lParam.wParam, out pos);
 | 
			
		||||
 | 
			
		||||
                // 0xFFFFFFFF as index makes the method return the number of files
 | 
			
		||||
                uint n = WinAPI.DragQueryFile(lParam.wParam, 0xFFFFFFFF, null, 0);
 | 
			
		||||
                var sb = new System.Text.StringBuilder(1024);
 | 
			
		||||
 | 
			
		||||
                List<string> result = new List<string>();
 | 
			
		||||
                for (uint i = 0; i < n; i++)
 | 
			
		||||
                {
 | 
			
		||||
                    int len = (int)WinAPI.DragQueryFile(lParam.wParam, i, sb, 1024);
 | 
			
		||||
                    result.Add(sb.ToString(0, len));
 | 
			
		||||
                    sb.Length = 0;
 | 
			
		||||
                }
 | 
			
		||||
                WinAPI.DragFinish(lParam.wParam);
 | 
			
		||||
                if (OnDroppedFiles != null)
 | 
			
		||||
                    OnDroppedFiles(result, pos);
 | 
			
		||||
            }
 | 
			
		||||
            return WinAPI.CallNextHookEx(m_Hook, code, wParam, ref lParam);
 | 
			
		||||
        }
 | 
			
		||||
#else
 | 
			
		||||
        public static void InstallHook()
 | 
			
		||||
        {
 | 
			
		||||
        }
 | 
			
		||||
        public static void UninstallHook()
 | 
			
		||||
        {
 | 
			
		||||
        }
 | 
			
		||||
#endif
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										11
									
								
								Assets/Plugins/UnityWindowsFileDrag-Drop/B83.Win32.cs.meta
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										11
									
								
								Assets/Plugins/UnityWindowsFileDrag-Drop/B83.Win32.cs.meta
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,11 @@
 | 
			
		||||
fileFormatVersion: 2
 | 
			
		||||
guid: fc411cd2c138a56498372ffcbebd36c3
 | 
			
		||||
MonoImporter:
 | 
			
		||||
  externalObjects: {}
 | 
			
		||||
  serializedVersion: 2
 | 
			
		||||
  defaultReferences: []
 | 
			
		||||
  executionOrder: 0
 | 
			
		||||
  icon: {instanceID: 0}
 | 
			
		||||
  userData: 
 | 
			
		||||
  assetBundleName: 
 | 
			
		||||
  assetBundleVariant: 
 | 
			
		||||
							
								
								
									
										21
									
								
								Assets/Plugins/UnityWindowsFileDrag-Drop/LICENSE
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										21
									
								
								Assets/Plugins/UnityWindowsFileDrag-Drop/LICENSE
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,21 @@
 | 
			
		||||
MIT License
 | 
			
		||||
 | 
			
		||||
Copyright (c) 2018 Markus Göbel (Bunny83)
 | 
			
		||||
 | 
			
		||||
Permission is hereby granted, free of charge, to any person obtaining a copy
 | 
			
		||||
of this software and associated documentation files (the "Software"), to deal
 | 
			
		||||
in the Software without restriction, including without limitation the rights
 | 
			
		||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 | 
			
		||||
copies of the Software, and to permit persons to whom the Software is
 | 
			
		||||
furnished to do so, subject to the following conditions:
 | 
			
		||||
 | 
			
		||||
The above copyright notice and this permission notice shall be included in all
 | 
			
		||||
copies or substantial portions of the Software.
 | 
			
		||||
 | 
			
		||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 | 
			
		||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 | 
			
		||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 | 
			
		||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 | 
			
		||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 | 
			
		||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 | 
			
		||||
SOFTWARE.
 | 
			
		||||
							
								
								
									
										7
									
								
								Assets/Plugins/UnityWindowsFileDrag-Drop/LICENSE.meta
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										7
									
								
								Assets/Plugins/UnityWindowsFileDrag-Drop/LICENSE.meta
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,7 @@
 | 
			
		||||
fileFormatVersion: 2
 | 
			
		||||
guid: b35cced8fc9e63e4aa13ce409bf135de
 | 
			
		||||
DefaultImporter:
 | 
			
		||||
  externalObjects: {}
 | 
			
		||||
  userData: 
 | 
			
		||||
  assetBundleName: 
 | 
			
		||||
  assetBundleVariant: 
 | 
			
		||||
							
								
								
									
										8
									
								
								Assets/Plugins/UnityWindowsFileDrag-Drop/README.md
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										8
									
								
								Assets/Plugins/UnityWindowsFileDrag-Drop/README.md
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,8 @@
 | 
			
		||||
# UnityWindowsFileDrag&Drop
 | 
			
		||||
Adds file drag and drop support for Unity standalone builds on windows.
 | 
			
		||||
 | 
			
		||||
It uses the GetMessage hook to intercept the WM_DROPFILES message
 | 
			
		||||
 | 
			
		||||
See the "FileDragAndDrop.cs" or "ImageExample.cs" file for an example usage.
 | 
			
		||||
 | 
			
		||||
Due to too many issues in the Unity editor (causes random silent crashes) I have disabled the hook when tested in playmode inside the editor. So this feature only works in a build.
 | 
			
		||||
							
								
								
									
										7
									
								
								Assets/Plugins/UnityWindowsFileDrag-Drop/README.md.meta
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										7
									
								
								Assets/Plugins/UnityWindowsFileDrag-Drop/README.md.meta
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,7 @@
 | 
			
		||||
fileFormatVersion: 2
 | 
			
		||||
guid: 9b1ee3ab5cbedc74381027f3dcb952e3
 | 
			
		||||
TextScriptImporter:
 | 
			
		||||
  externalObjects: {}
 | 
			
		||||
  userData: 
 | 
			
		||||
  assetBundleName: 
 | 
			
		||||
  assetBundleVariant: 
 | 
			
		||||
							
								
								
									
										8
									
								
								Assets/Prefabs.meta
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										8
									
								
								Assets/Prefabs.meta
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,8 @@
 | 
			
		||||
fileFormatVersion: 2
 | 
			
		||||
guid: 337fa7a7d4fc21742a52b86025861f73
 | 
			
		||||
folderAsset: yes
 | 
			
		||||
DefaultImporter:
 | 
			
		||||
  externalObjects: {}
 | 
			
		||||
  userData: 
 | 
			
		||||
  assetBundleName: 
 | 
			
		||||
  assetBundleVariant: 
 | 
			
		||||
							
								
								
									
										3467
									
								
								Assets/Prefabs/TextureSlot.prefab
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										3467
									
								
								Assets/Prefabs/TextureSlot.prefab
									
									
									
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										7
									
								
								Assets/Prefabs/TextureSlot.prefab.meta
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										7
									
								
								Assets/Prefabs/TextureSlot.prefab.meta
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,7 @@
 | 
			
		||||
fileFormatVersion: 2
 | 
			
		||||
guid: 061da2632e52755418cfea332c751f33
 | 
			
		||||
PrefabImporter:
 | 
			
		||||
  externalObjects: {}
 | 
			
		||||
  userData: 
 | 
			
		||||
  assetBundleName: 
 | 
			
		||||
  assetBundleVariant: 
 | 
			
		||||
							
								
								
									
										8
									
								
								Assets/Scenes.meta
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										8
									
								
								Assets/Scenes.meta
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,8 @@
 | 
			
		||||
fileFormatVersion: 2
 | 
			
		||||
guid: fedb96967b918da46ae80950725bf87d
 | 
			
		||||
folderAsset: yes
 | 
			
		||||
DefaultImporter:
 | 
			
		||||
  externalObjects: {}
 | 
			
		||||
  userData: 
 | 
			
		||||
  assetBundleName: 
 | 
			
		||||
  assetBundleVariant: 
 | 
			
		||||
							
								
								
									
										6859
									
								
								Assets/Scenes/SampleScene.unity
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										6859
									
								
								Assets/Scenes/SampleScene.unity
									
									
									
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										7
									
								
								Assets/Scenes/SampleScene.unity.meta
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										7
									
								
								Assets/Scenes/SampleScene.unity.meta
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,7 @@
 | 
			
		||||
fileFormatVersion: 2
 | 
			
		||||
guid: 2cda990e2423bbf4892e6590ba056729
 | 
			
		||||
DefaultImporter:
 | 
			
		||||
  externalObjects: {}
 | 
			
		||||
  userData: 
 | 
			
		||||
  assetBundleName: 
 | 
			
		||||
  assetBundleVariant: 
 | 
			
		||||
							
								
								
									
										8
									
								
								Assets/Scripts.meta
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										8
									
								
								Assets/Scripts.meta
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,8 @@
 | 
			
		||||
fileFormatVersion: 2
 | 
			
		||||
guid: 2f428e279a560ef44aea5fa06243828e
 | 
			
		||||
folderAsset: yes
 | 
			
		||||
DefaultImporter:
 | 
			
		||||
  externalObjects: {}
 | 
			
		||||
  userData: 
 | 
			
		||||
  assetBundleName: 
 | 
			
		||||
  assetBundleVariant: 
 | 
			
		||||
							
								
								
									
										14
									
								
								Assets/Scripts/Options.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										14
									
								
								Assets/Scripts/Options.cs
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,14 @@
 | 
			
		||||
using System.Collections;
 | 
			
		||||
using System.Collections.Generic;
 | 
			
		||||
using UnityEngine;
 | 
			
		||||
 | 
			
		||||
namespace TextureCombiner
 | 
			
		||||
{
 | 
			
		||||
	public abstract class Options : MonoBehaviour
 | 
			
		||||
	{
 | 
			
		||||
	    protected virtual void OnDisable()
 | 
			
		||||
	    {
 | 
			
		||||
	        PlayerPrefs.Save();
 | 
			
		||||
	    }
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										11
									
								
								Assets/Scripts/Options.cs.meta
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										11
									
								
								Assets/Scripts/Options.cs.meta
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,11 @@
 | 
			
		||||
fileFormatVersion: 2
 | 
			
		||||
guid: 7a83b90928bd7b3409c2aad736f20f28
 | 
			
		||||
MonoImporter:
 | 
			
		||||
  externalObjects: {}
 | 
			
		||||
  serializedVersion: 2
 | 
			
		||||
  defaultReferences: []
 | 
			
		||||
  executionOrder: 0
 | 
			
		||||
  icon: {instanceID: 0}
 | 
			
		||||
  userData: 
 | 
			
		||||
  assetBundleName: 
 | 
			
		||||
  assetBundleVariant: 
 | 
			
		||||
							
								
								
									
										8
									
								
								Assets/Scripts/Options.meta
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										8
									
								
								Assets/Scripts/Options.meta
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,8 @@
 | 
			
		||||
fileFormatVersion: 2
 | 
			
		||||
guid: fcc26bc422be36d4ba05f437c7ea52f6
 | 
			
		||||
folderAsset: yes
 | 
			
		||||
DefaultImporter:
 | 
			
		||||
  externalObjects: {}
 | 
			
		||||
  userData: 
 | 
			
		||||
  assetBundleName: 
 | 
			
		||||
  assetBundleVariant: 
 | 
			
		||||
							
								
								
									
										47
									
								
								Assets/Scripts/Options/AddOptions.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										47
									
								
								Assets/Scripts/Options/AddOptions.cs
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,47 @@
 | 
			
		||||
using System.Collections;
 | 
			
		||||
using System.Collections.Generic;
 | 
			
		||||
using UnityEngine;
 | 
			
		||||
using UnityEngine.UI;
 | 
			
		||||
 | 
			
		||||
namespace TextureCombiner
 | 
			
		||||
{
 | 
			
		||||
	public class AddOptions : Options
 | 
			
		||||
	{
 | 
			
		||||
	    [SerializeField]
 | 
			
		||||
	    private Slider inputFieldR = null;
 | 
			
		||||
	    [SerializeField]
 | 
			
		||||
	    private Slider inputFieldG = null;
 | 
			
		||||
	    [SerializeField]
 | 
			
		||||
	    private Slider inputFieldB = null;
 | 
			
		||||
	    [SerializeField]
 | 
			
		||||
	    private Slider inputFieldA = null;
 | 
			
		||||
	
 | 
			
		||||
	    private void OnEnable()
 | 
			
		||||
	    {
 | 
			
		||||
	        inputFieldR.value = PlayerPrefs.GetFloat("addR", 0);
 | 
			
		||||
	        inputFieldG.value = PlayerPrefs.GetFloat("addG", 0);
 | 
			
		||||
	        inputFieldB.value = PlayerPrefs.GetFloat("addB", 0);
 | 
			
		||||
	        inputFieldA.value = PlayerPrefs.GetFloat("addA", 0);
 | 
			
		||||
	    }
 | 
			
		||||
	
 | 
			
		||||
	    protected override void OnDisable()
 | 
			
		||||
	    {
 | 
			
		||||
	        PlayerPrefs.SetFloat("addR", inputFieldR.value);
 | 
			
		||||
	        PlayerPrefs.SetFloat("addG", inputFieldG.value);
 | 
			
		||||
	        PlayerPrefs.SetFloat("addB", inputFieldB.value);
 | 
			
		||||
	        PlayerPrefs.SetFloat("addA", inputFieldA.value);
 | 
			
		||||
 | 
			
		||||
			base.OnDisable();
 | 
			
		||||
	    }
 | 
			
		||||
	
 | 
			
		||||
	    public Vector4 GetAddValues()
 | 
			
		||||
	    {
 | 
			
		||||
	        return new Vector4(
 | 
			
		||||
	            inputFieldR.value,
 | 
			
		||||
	            inputFieldG.value,
 | 
			
		||||
	            inputFieldB.value,
 | 
			
		||||
	            inputFieldA.value
 | 
			
		||||
	            );
 | 
			
		||||
	    }
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										11
									
								
								Assets/Scripts/Options/AddOptions.cs.meta
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										11
									
								
								Assets/Scripts/Options/AddOptions.cs.meta
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,11 @@
 | 
			
		||||
fileFormatVersion: 2
 | 
			
		||||
guid: cfd2b97d613d4f04f8b3b11e66ad23e2
 | 
			
		||||
MonoImporter:
 | 
			
		||||
  externalObjects: {}
 | 
			
		||||
  serializedVersion: 2
 | 
			
		||||
  defaultReferences: []
 | 
			
		||||
  executionOrder: 0
 | 
			
		||||
  icon: {instanceID: 0}
 | 
			
		||||
  userData: 
 | 
			
		||||
  assetBundleName: 
 | 
			
		||||
  assetBundleVariant: 
 | 
			
		||||
							
								
								
									
										30
									
								
								Assets/Scripts/Options/CombineOptions.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										30
									
								
								Assets/Scripts/Options/CombineOptions.cs
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,30 @@
 | 
			
		||||
using System.Collections;
 | 
			
		||||
using System.Collections.Generic;
 | 
			
		||||
using UnityEngine;
 | 
			
		||||
using UnityEngine.UI;
 | 
			
		||||
 | 
			
		||||
namespace TextureCombiner
 | 
			
		||||
{
 | 
			
		||||
	public class CombineOptions : Options
 | 
			
		||||
	{
 | 
			
		||||
	    [SerializeField]
 | 
			
		||||
	    private Toggle autoCombineToggle = null;
 | 
			
		||||
	
 | 
			
		||||
	    private void OnEnable()
 | 
			
		||||
	    {
 | 
			
		||||
	        autoCombineToggle.isOn = PlayerPrefs.GetInt("autoCombine", 1) != 0;
 | 
			
		||||
	    }
 | 
			
		||||
	
 | 
			
		||||
	    protected override void OnDisable()
 | 
			
		||||
	    {
 | 
			
		||||
			PlayerPrefs.SetInt("autoCombine", autoCombineToggle.isOn ? 1 : 0);
 | 
			
		||||
 | 
			
		||||
			base.OnDisable();
 | 
			
		||||
		}
 | 
			
		||||
	
 | 
			
		||||
	    public bool GetAutoCombine()
 | 
			
		||||
	    {
 | 
			
		||||
	        return autoCombineToggle.isOn;
 | 
			
		||||
	    }
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										11
									
								
								Assets/Scripts/Options/CombineOptions.cs.meta
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										11
									
								
								Assets/Scripts/Options/CombineOptions.cs.meta
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,11 @@
 | 
			
		||||
fileFormatVersion: 2
 | 
			
		||||
guid: d2d913ba40069e249affef31f3f9ed72
 | 
			
		||||
MonoImporter:
 | 
			
		||||
  externalObjects: {}
 | 
			
		||||
  serializedVersion: 2
 | 
			
		||||
  defaultReferences: []
 | 
			
		||||
  executionOrder: 0
 | 
			
		||||
  icon: {instanceID: 0}
 | 
			
		||||
  userData: 
 | 
			
		||||
  assetBundleName: 
 | 
			
		||||
  assetBundleVariant: 
 | 
			
		||||
							
								
								
									
										30
									
								
								Assets/Scripts/Options/SaveOptions.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										30
									
								
								Assets/Scripts/Options/SaveOptions.cs
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,30 @@
 | 
			
		||||
using System.Collections;
 | 
			
		||||
using System.Collections.Generic;
 | 
			
		||||
using UnityEngine;
 | 
			
		||||
using UnityEngine.UI;
 | 
			
		||||
 | 
			
		||||
namespace TextureCombiner
 | 
			
		||||
{
 | 
			
		||||
	public class SaveOptions : Options
 | 
			
		||||
	{
 | 
			
		||||
	    [SerializeField]
 | 
			
		||||
	    private InputField inputFieldName = null;
 | 
			
		||||
	
 | 
			
		||||
	    private void OnEnable()
 | 
			
		||||
	    {
 | 
			
		||||
	        inputFieldName.text = PlayerPrefs.GetString("outputName", "_RMAH");
 | 
			
		||||
	    }
 | 
			
		||||
	
 | 
			
		||||
	    protected override void OnDisable()
 | 
			
		||||
	    {
 | 
			
		||||
	        PlayerPrefs.SetString("outputName", inputFieldName.text);
 | 
			
		||||
 | 
			
		||||
			base.OnDisable();
 | 
			
		||||
	    }
 | 
			
		||||
	
 | 
			
		||||
	    public string GetOutputName()
 | 
			
		||||
	    {
 | 
			
		||||
	        return inputFieldName.text + ".png";
 | 
			
		||||
	    }
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										11
									
								
								Assets/Scripts/Options/SaveOptions.cs.meta
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										11
									
								
								Assets/Scripts/Options/SaveOptions.cs.meta
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,11 @@
 | 
			
		||||
fileFormatVersion: 2
 | 
			
		||||
guid: f3d24c2bb90ddd24fa229a7f3429b868
 | 
			
		||||
MonoImporter:
 | 
			
		||||
  externalObjects: {}
 | 
			
		||||
  serializedVersion: 2
 | 
			
		||||
  defaultReferences: []
 | 
			
		||||
  executionOrder: 0
 | 
			
		||||
  icon: {instanceID: 0}
 | 
			
		||||
  userData: 
 | 
			
		||||
  assetBundleName: 
 | 
			
		||||
  assetBundleVariant: 
 | 
			
		||||
							
								
								
									
										48
									
								
								Assets/Scripts/Options/SizeOptions.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										48
									
								
								Assets/Scripts/Options/SizeOptions.cs
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,48 @@
 | 
			
		||||
using System.Collections;
 | 
			
		||||
using System.Collections.Generic;
 | 
			
		||||
using UnityEngine;
 | 
			
		||||
using UnityEngine.UI;
 | 
			
		||||
 | 
			
		||||
namespace TextureCombiner
 | 
			
		||||
{
 | 
			
		||||
	public class SizeOptions : Options
 | 
			
		||||
	{
 | 
			
		||||
	    public int width = 512;
 | 
			
		||||
	    public int height = 512;
 | 
			
		||||
	
 | 
			
		||||
	    [SerializeField]
 | 
			
		||||
	    private InputField inputFieldWidth = null;
 | 
			
		||||
	    [SerializeField]
 | 
			
		||||
	    private InputField inputFieldHeight = null;
 | 
			
		||||
	
 | 
			
		||||
	    private void OnEnable()
 | 
			
		||||
	    {
 | 
			
		||||
	        width = PlayerPrefs.GetInt("width", 512);
 | 
			
		||||
	        height = PlayerPrefs.GetInt("height", 512);
 | 
			
		||||
	
 | 
			
		||||
	        inputFieldWidth.text = width.ToString();
 | 
			
		||||
	        inputFieldHeight.text = height.ToString();
 | 
			
		||||
	
 | 
			
		||||
	        inputFieldWidth.onValueChanged.AddListener(UpdateWidth);
 | 
			
		||||
	        inputFieldHeight.onValueChanged.AddListener(UpdateHeight);
 | 
			
		||||
	    }
 | 
			
		||||
	
 | 
			
		||||
	    protected override void OnDisable()
 | 
			
		||||
	    {
 | 
			
		||||
	        PlayerPrefs.SetInt("width", width);
 | 
			
		||||
	        PlayerPrefs.SetInt("height", height);
 | 
			
		||||
 | 
			
		||||
			base.OnDisable();
 | 
			
		||||
	    }
 | 
			
		||||
	
 | 
			
		||||
	    private void UpdateWidth(string _width)
 | 
			
		||||
	    {
 | 
			
		||||
	        int.TryParse(_width, out width);
 | 
			
		||||
	    }
 | 
			
		||||
	
 | 
			
		||||
	    private void UpdateHeight(string _height)
 | 
			
		||||
	    {
 | 
			
		||||
	        int.TryParse(_height, out height);
 | 
			
		||||
	    }
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										11
									
								
								Assets/Scripts/Options/SizeOptions.cs.meta
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										11
									
								
								Assets/Scripts/Options/SizeOptions.cs.meta
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,11 @@
 | 
			
		||||
fileFormatVersion: 2
 | 
			
		||||
guid: 8eaea5168b73e1a4790b4a86e6bc5aac
 | 
			
		||||
MonoImporter:
 | 
			
		||||
  externalObjects: {}
 | 
			
		||||
  serializedVersion: 2
 | 
			
		||||
  defaultReferences: []
 | 
			
		||||
  executionOrder: 0
 | 
			
		||||
  icon: {instanceID: 0}
 | 
			
		||||
  userData: 
 | 
			
		||||
  assetBundleName: 
 | 
			
		||||
  assetBundleVariant: 
 | 
			
		||||
							
								
								
									
										173
									
								
								Assets/Scripts/TextureCombiner.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										173
									
								
								Assets/Scripts/TextureCombiner.cs
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,173 @@
 | 
			
		||||
using System.Text;
 | 
			
		||||
using System.Collections;
 | 
			
		||||
using System.Collections.Generic;
 | 
			
		||||
using System.Runtime.InteropServices;
 | 
			
		||||
using UnityEngine;
 | 
			
		||||
using UnityEngine.UI;
 | 
			
		||||
using System;
 | 
			
		||||
using SFB;
 | 
			
		||||
 | 
			
		||||
namespace TextureCombiner
 | 
			
		||||
{
 | 
			
		||||
    public class TextureCombiner : MonoBehaviour
 | 
			
		||||
    {
 | 
			
		||||
        [SerializeField]
 | 
			
		||||
        private TextureSlot m_textureSlotPrefab = null;
 | 
			
		||||
        [SerializeField]
 | 
			
		||||
        private RectTransform m_parent = null;
 | 
			
		||||
 | 
			
		||||
        [Space]
 | 
			
		||||
 | 
			
		||||
        [SerializeField]
 | 
			
		||||
        private Button m_openButton = null;
 | 
			
		||||
        [SerializeField]
 | 
			
		||||
        private Button m_combineButton = null;
 | 
			
		||||
        [SerializeField]
 | 
			
		||||
        private Button m_saveButton = null;
 | 
			
		||||
 | 
			
		||||
        [Space]
 | 
			
		||||
 | 
			
		||||
        [SerializeField]
 | 
			
		||||
        private Shader m_combineShader = null;
 | 
			
		||||
        [SerializeField]
 | 
			
		||||
        private RawImage m_imageOutput = null;
 | 
			
		||||
 | 
			
		||||
        private Texture2D m_source = null;
 | 
			
		||||
        private RenderTexture m_dest = null;
 | 
			
		||||
 | 
			
		||||
        private SizeOptions m_sizeOptions = null;
 | 
			
		||||
        private AddOptions m_addOptions = null;
 | 
			
		||||
        private CombineOptions m_combineOptions = null;
 | 
			
		||||
        private SaveOptions m_saveOptions = null;
 | 
			
		||||
 | 
			
		||||
        public Action m_loadDialogAction = null;
 | 
			
		||||
        public Action<string> m_saveDialogAction = null;
 | 
			
		||||
        public Action<string, byte[]> m_saveTextureAction = null;
 | 
			
		||||
 | 
			
		||||
        private void OnEnable()
 | 
			
		||||
        {
 | 
			
		||||
            m_openButton.onClick.AddListener(Load);
 | 
			
		||||
            m_combineButton.onClick.AddListener(CombineTextures);
 | 
			
		||||
            m_saveButton.onClick.AddListener(Save);
 | 
			
		||||
 | 
			
		||||
            m_sizeOptions = GetComponentInChildren<SizeOptions>();
 | 
			
		||||
            m_addOptions = GetComponentInChildren<AddOptions>();
 | 
			
		||||
            m_combineOptions = GetComponentInChildren<CombineOptions>();
 | 
			
		||||
            m_saveOptions = GetComponentInChildren<SaveOptions>();
 | 
			
		||||
 | 
			
		||||
            m_source = new Texture2D(2, 2);
 | 
			
		||||
            m_source.Apply();
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        private void OnDisable()
 | 
			
		||||
        {
 | 
			
		||||
            m_openButton.onClick.RemoveListener(Load);
 | 
			
		||||
            m_combineButton.onClick.RemoveListener(CombineTextures);
 | 
			
		||||
            m_saveButton.onClick.RemoveListener(Save);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        private void Update()
 | 
			
		||||
        {
 | 
			
		||||
            if(m_combineOptions.GetAutoCombine())
 | 
			
		||||
            {
 | 
			
		||||
                CombineTextures();
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        private void CombineTextures()
 | 
			
		||||
        {
 | 
			
		||||
            Material mat = new Material(m_combineShader);
 | 
			
		||||
 | 
			
		||||
            // Set material textures.
 | 
			
		||||
            foreach (TextureSlot ts in GetComponentsInChildren<TextureSlot>())
 | 
			
		||||
            {
 | 
			
		||||
                Vector4 sourceChannel = ts.GetSourceChannels();
 | 
			
		||||
                TextureSlot.Channels targetChannel = ts.GetTargetChannels();
 | 
			
		||||
 | 
			
		||||
                if (targetChannel.r)
 | 
			
		||||
                {
 | 
			
		||||
                    mat.SetVector("_Mask0", sourceChannel);
 | 
			
		||||
                    mat.SetTexture("_Tex0", ts.texture);
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
                if (targetChannel.g)
 | 
			
		||||
                {
 | 
			
		||||
                    mat.SetVector("_Mask1", sourceChannel);
 | 
			
		||||
                    mat.SetTexture("_Tex1", ts.texture);
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
                if (targetChannel.b)
 | 
			
		||||
                {
 | 
			
		||||
                    mat.SetVector("_Mask2", sourceChannel);
 | 
			
		||||
                    mat.SetTexture("_Tex2", ts.texture);
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
                if (targetChannel.a)
 | 
			
		||||
                {
 | 
			
		||||
                    mat.SetVector("_Mask3", sourceChannel);
 | 
			
		||||
                    mat.SetTexture("_Tex3", ts.texture);
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            mat.SetVector("_Add", m_addOptions.GetAddValues());
 | 
			
		||||
 | 
			
		||||
            if (m_dest)
 | 
			
		||||
            {
 | 
			
		||||
                if (RenderTexture.active == m_dest)
 | 
			
		||||
                {
 | 
			
		||||
                    RenderTexture.active = null;
 | 
			
		||||
                }
 | 
			
		||||
                m_dest.Release();
 | 
			
		||||
                m_dest = null;
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            m_dest = new RenderTexture(m_sizeOptions.width, m_sizeOptions.height, 0);
 | 
			
		||||
            m_dest.Create();
 | 
			
		||||
 | 
			
		||||
            Graphics.Blit(m_source, m_dest, mat);
 | 
			
		||||
 | 
			
		||||
            m_imageOutput.texture = m_dest;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public void Load()
 | 
			
		||||
        {
 | 
			
		||||
            m_loadDialogAction.Invoke();
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public void LoadTextureSlot(Texture2D texture2D)
 | 
			
		||||
        {
 | 
			
		||||
            TextureSlot ts = Instantiate(m_textureSlotPrefab, m_parent);
 | 
			
		||||
            ts.Init(texture2D);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public void Save()
 | 
			
		||||
        {
 | 
			
		||||
            m_saveDialogAction.Invoke(m_saveOptions.GetOutputName());
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public void SaveTextureBytes(string path)
 | 
			
		||||
        {
 | 
			
		||||
            if (m_dest)
 | 
			
		||||
            {
 | 
			
		||||
                // Get texture from renderTexture.
 | 
			
		||||
                RenderTexture curRT = RenderTexture.active;
 | 
			
		||||
                RenderTexture.active = m_dest;
 | 
			
		||||
 | 
			
		||||
                Texture2D tex = new Texture2D(m_dest.width, m_dest.height);
 | 
			
		||||
                tex.hideFlags = HideFlags.HideAndDontSave;
 | 
			
		||||
                tex.ReadPixels(new Rect(0, 0, m_dest.width, m_dest.height), 0, 0);
 | 
			
		||||
                tex.Apply();
 | 
			
		||||
 | 
			
		||||
                RenderTexture.active = curRT;
 | 
			
		||||
 | 
			
		||||
                // Convert texture to bytes.
 | 
			
		||||
                byte[] bytes;
 | 
			
		||||
                bytes = tex.EncodeToPNG();
 | 
			
		||||
 | 
			
		||||
                Destroy(tex);
 | 
			
		||||
 | 
			
		||||
                m_saveTextureAction.Invoke(path, bytes);
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										11
									
								
								Assets/Scripts/TextureCombiner.cs.meta
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										11
									
								
								Assets/Scripts/TextureCombiner.cs.meta
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,11 @@
 | 
			
		||||
fileFormatVersion: 2
 | 
			
		||||
guid: 60a1dc9732b768841b8eaadcac6860c2
 | 
			
		||||
MonoImporter:
 | 
			
		||||
  externalObjects: {}
 | 
			
		||||
  serializedVersion: 2
 | 
			
		||||
  defaultReferences: []
 | 
			
		||||
  executionOrder: 0
 | 
			
		||||
  icon: {instanceID: 0}
 | 
			
		||||
  userData: 
 | 
			
		||||
  assetBundleName: 
 | 
			
		||||
  assetBundleVariant: 
 | 
			
		||||
							
								
								
									
										44
									
								
								Assets/Scripts/TextureHandler.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										44
									
								
								Assets/Scripts/TextureHandler.cs
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,44 @@
 | 
			
		||||
using System.Collections;
 | 
			
		||||
using System.Collections.Generic;
 | 
			
		||||
using UnityEngine;
 | 
			
		||||
 | 
			
		||||
namespace TextureCombiner
 | 
			
		||||
{
 | 
			
		||||
	[RequireComponent(typeof(TextureCombiner))]
 | 
			
		||||
	public abstract class TextureHandler : MonoBehaviour
 | 
			
		||||
	{
 | 
			
		||||
	    protected TextureCombiner m_textureCombiner = null;
 | 
			
		||||
	
 | 
			
		||||
	    private void Awake()
 | 
			
		||||
	    {
 | 
			
		||||
	        m_textureCombiner = this.GetComponent<TextureCombiner>();
 | 
			
		||||
	    }
 | 
			
		||||
	
 | 
			
		||||
	    protected virtual void OnEnable()
 | 
			
		||||
	    {
 | 
			
		||||
	        m_textureCombiner.m_loadDialogAction += Load;
 | 
			
		||||
	        m_textureCombiner.m_saveDialogAction += Save;
 | 
			
		||||
	        m_textureCombiner.m_saveTextureAction += SaveTexture;
 | 
			
		||||
	    }
 | 
			
		||||
	
 | 
			
		||||
	    protected virtual void OnDisable()
 | 
			
		||||
	    {
 | 
			
		||||
	        m_textureCombiner.m_loadDialogAction -= Load;
 | 
			
		||||
	        m_textureCombiner.m_saveDialogAction -= Save;
 | 
			
		||||
	        m_textureCombiner.m_saveTextureAction -= SaveTexture;
 | 
			
		||||
	    }
 | 
			
		||||
	
 | 
			
		||||
	    protected virtual void Load()
 | 
			
		||||
	    {
 | 
			
		||||
	    }
 | 
			
		||||
	
 | 
			
		||||
	    protected virtual void Save(string name)
 | 
			
		||||
	    {
 | 
			
		||||
	        m_textureCombiner.SaveTextureBytes(name);
 | 
			
		||||
	    }
 | 
			
		||||
	
 | 
			
		||||
	    protected virtual void SaveTexture(string path, byte[] bytes)
 | 
			
		||||
	    {   
 | 
			
		||||
	    }
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										11
									
								
								Assets/Scripts/TextureHandler.cs.meta
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										11
									
								
								Assets/Scripts/TextureHandler.cs.meta
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,11 @@
 | 
			
		||||
fileFormatVersion: 2
 | 
			
		||||
guid: 63c231cd38eac57429b1091348882930
 | 
			
		||||
MonoImporter:
 | 
			
		||||
  externalObjects: {}
 | 
			
		||||
  serializedVersion: 2
 | 
			
		||||
  defaultReferences: []
 | 
			
		||||
  executionOrder: 0
 | 
			
		||||
  icon: {instanceID: 0}
 | 
			
		||||
  userData: 
 | 
			
		||||
  assetBundleName: 
 | 
			
		||||
  assetBundleVariant: 
 | 
			
		||||
							
								
								
									
										8
									
								
								Assets/Scripts/TextureHandlers.meta
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										8
									
								
								Assets/Scripts/TextureHandlers.meta
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,8 @@
 | 
			
		||||
fileFormatVersion: 2
 | 
			
		||||
guid: 977a2b7b6c2ca034aa201c687f8e0150
 | 
			
		||||
folderAsset: yes
 | 
			
		||||
DefaultImporter:
 | 
			
		||||
  externalObjects: {}
 | 
			
		||||
  userData: 
 | 
			
		||||
  assetBundleName: 
 | 
			
		||||
  assetBundleVariant: 
 | 
			
		||||
							
								
								
									
										72
									
								
								Assets/Scripts/TextureHandlers/TextureHandlerWeb.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										72
									
								
								Assets/Scripts/TextureHandlers/TextureHandlerWeb.cs
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,72 @@
 | 
			
		||||
using System.Collections;
 | 
			
		||||
using System.Collections.Generic;
 | 
			
		||||
using UnityEngine;
 | 
			
		||||
#if UNITY_WEBGL
 | 
			
		||||
using System.Text;
 | 
			
		||||
using System.Runtime.InteropServices;
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
namespace TextureCombiner
 | 
			
		||||
{
 | 
			
		||||
	public class TextureHandlerWeb : TextureHandler
 | 
			
		||||
	{
 | 
			
		||||
	#if UNITY_WEBGL
 | 
			
		||||
	    protected override void OnEnable()
 | 
			
		||||
	    {
 | 
			
		||||
	        base.OnEnable();
 | 
			
		||||
	    }
 | 
			
		||||
	
 | 
			
		||||
	    protected override void OnDisable()
 | 
			
		||||
	    {
 | 
			
		||||
	        base.OnDisable();
 | 
			
		||||
	    }
 | 
			
		||||
	
 | 
			
		||||
	    protected override void Load()
 | 
			
		||||
	    {
 | 
			
		||||
	        UploadFile(this.gameObject.name, "OnLoadTexturesWWW", ".png, .jpg, .jpeg", true);
 | 
			
		||||
	    }
 | 
			
		||||
	
 | 
			
		||||
	    public void OnLoadTexturesWWW(string path)
 | 
			
		||||
	    {
 | 
			
		||||
	        string[] paths = path.Split(',');
 | 
			
		||||
	        StartCoroutine(LoadTexturesWWW(paths));
 | 
			
		||||
	    }
 | 
			
		||||
	
 | 
			
		||||
	    public IEnumerator LoadTexturesWWW(string[] paths)
 | 
			
		||||
	    {
 | 
			
		||||
	        if (paths.Length != 0)
 | 
			
		||||
	        {
 | 
			
		||||
	            foreach (string p in paths)
 | 
			
		||||
	            {
 | 
			
		||||
	                Debug.Log(p);
 | 
			
		||||
	
 | 
			
		||||
	                // Load Image.
 | 
			
		||||
	                var loader = new WWW(p);
 | 
			
		||||
	                yield return loader;
 | 
			
		||||
	                m_textureCombiner.LoadTextureSlot(loader.texture);
 | 
			
		||||
	            }
 | 
			
		||||
	        }
 | 
			
		||||
	    }
 | 
			
		||||
	
 | 
			
		||||
	    public void OnSaveTextureWWW()
 | 
			
		||||
	    {
 | 
			
		||||
	        Debug.Log("OnSaveTextureWWW");
 | 
			
		||||
	    }
 | 
			
		||||
	
 | 
			
		||||
	    [DllImport("__Internal")]
 | 
			
		||||
	    private static extern void UploadFile(string gameObjectName, string methodName, string filter, bool multiple);
 | 
			
		||||
	    [DllImport("__Internal")]
 | 
			
		||||
	    private static extern void DownloadFile(string gameObjectName, string methodName, string filename, byte[] byteArray, int byteArraySize);
 | 
			
		||||
	
 | 
			
		||||
	    protected override void Save(string name)
 | 
			
		||||
	    {
 | 
			
		||||
	        base.Save(name);
 | 
			
		||||
	    }
 | 
			
		||||
	
 | 
			
		||||
	    protected override void SaveTexture(string path, byte[] bytes)
 | 
			
		||||
	    {
 | 
			
		||||
	        DownloadFile(this.gameObject.name, "OnSaveTextureWWW", path, bytes, bytes.Length);
 | 
			
		||||
	    }
 | 
			
		||||
	#endif
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										11
									
								
								Assets/Scripts/TextureHandlers/TextureHandlerWeb.cs.meta
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										11
									
								
								Assets/Scripts/TextureHandlers/TextureHandlerWeb.cs.meta
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,11 @@
 | 
			
		||||
fileFormatVersion: 2
 | 
			
		||||
guid: 978cb2b8bd47605408384d0375fe2e82
 | 
			
		||||
MonoImporter:
 | 
			
		||||
  externalObjects: {}
 | 
			
		||||
  serializedVersion: 2
 | 
			
		||||
  defaultReferences: []
 | 
			
		||||
  executionOrder: 0
 | 
			
		||||
  icon: {instanceID: 0}
 | 
			
		||||
  userData: 
 | 
			
		||||
  assetBundleName: 
 | 
			
		||||
  assetBundleVariant: 
 | 
			
		||||
							
								
								
									
										114
									
								
								Assets/Scripts/TextureHandlers/TextureHandlerWin.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										114
									
								
								Assets/Scripts/TextureHandlers/TextureHandlerWin.cs
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,114 @@
 | 
			
		||||
using System.Collections;
 | 
			
		||||
using System.Collections.Generic;
 | 
			
		||||
using UnityEngine;
 | 
			
		||||
#if UNITY_STANDALONE_WIN
 | 
			
		||||
using B83.Win32;
 | 
			
		||||
#endif
 | 
			
		||||
#if UNITY_STANDALONE
 | 
			
		||||
using SFB;
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
namespace TextureCombiner
 | 
			
		||||
{
 | 
			
		||||
	public class TextureHandlerWin : TextureHandler
 | 
			
		||||
	{
 | 
			
		||||
	#if UNITY_STANDALONE
 | 
			
		||||
	    protected override void OnEnable()
 | 
			
		||||
	    {
 | 
			
		||||
	#if UNITY_STANDALONE_WIN && !UNITY_EDITOR
 | 
			
		||||
	        UnityDragAndDropHook.InstallHook();
 | 
			
		||||
	        UnityDragAndDropHook.OnDroppedFiles += LoadDropPaths;
 | 
			
		||||
	#endif
 | 
			
		||||
	
 | 
			
		||||
	        base.OnEnable();
 | 
			
		||||
	    }
 | 
			
		||||
	
 | 
			
		||||
	    protected override void OnDisable()
 | 
			
		||||
	    {
 | 
			
		||||
	#if UNITY_STANDALONE_WIN && !UNITY_EDITOR
 | 
			
		||||
	        UnityDragAndDropHook.OnDroppedFiles -= LoadDropPaths;
 | 
			
		||||
	        UnityDragAndDropHook.UninstallHook();
 | 
			
		||||
	#endif
 | 
			
		||||
	
 | 
			
		||||
	        base.OnDisable();
 | 
			
		||||
	    }
 | 
			
		||||
	
 | 
			
		||||
	    protected override void Load()
 | 
			
		||||
	    {
 | 
			
		||||
	        // Open file with filter
 | 
			
		||||
	        var extensions = new[]
 | 
			
		||||
	        {
 | 
			
		||||
	            new ExtensionFilter("Image Files", "png", "jpg", "jpeg" )
 | 
			
		||||
	        };
 | 
			
		||||
	
 | 
			
		||||
	        StandaloneFileBrowser.OpenFilePanelAsync("Open File", "", extensions, true, LoadPaths);
 | 
			
		||||
	    }
 | 
			
		||||
	
 | 
			
		||||
	#if UNITY_STANDALONE_WIN && !UNITY_EDITOR
 | 
			
		||||
	    private void LoadDropPaths(List<string> paths, POINT aPos)
 | 
			
		||||
	    {
 | 
			
		||||
	        List<string> outPaths = new List<string>();
 | 
			
		||||
	
 | 
			
		||||
	        foreach (string p in paths)
 | 
			
		||||
	        {
 | 
			
		||||
	            var fi = new System.IO.FileInfo(p);
 | 
			
		||||
	            var ext = fi.Extension.ToLower();
 | 
			
		||||
	            if (ext == ".png" || ext == ".jpg" || ext == ".jpeg")
 | 
			
		||||
	            {
 | 
			
		||||
	                outPaths.Add(p);
 | 
			
		||||
	            }
 | 
			
		||||
	        }
 | 
			
		||||
	
 | 
			
		||||
	        if(outPaths.Count > 0)
 | 
			
		||||
	        {
 | 
			
		||||
	            LoadPaths(outPaths.ToArray());
 | 
			
		||||
	        }
 | 
			
		||||
	    }
 | 
			
		||||
	#endif
 | 
			
		||||
	
 | 
			
		||||
	    private void LoadPaths(string[] paths)
 | 
			
		||||
	    {
 | 
			
		||||
	        if(paths.Length != 0)
 | 
			
		||||
	        {
 | 
			
		||||
	            LoadTextures(paths);
 | 
			
		||||
	        }
 | 
			
		||||
	    }
 | 
			
		||||
	
 | 
			
		||||
	    private void LoadTextures(string[] paths)
 | 
			
		||||
	    {
 | 
			
		||||
	        if(paths.Length != 0)
 | 
			
		||||
	        {
 | 
			
		||||
	            foreach (string p in paths)
 | 
			
		||||
	            {
 | 
			
		||||
	                Debug.Log(p);
 | 
			
		||||
	
 | 
			
		||||
	                // Load Image.
 | 
			
		||||
	                var bytes = System.IO.File.ReadAllBytes(p);
 | 
			
		||||
	                Texture2D texture = new Texture2D(2, 2);
 | 
			
		||||
	                texture.hideFlags = HideFlags.HideAndDontSave;
 | 
			
		||||
	                texture.LoadImage(bytes);
 | 
			
		||||
	                texture.Apply();
 | 
			
		||||
	
 | 
			
		||||
	                m_textureCombiner.LoadTextureSlot(texture);
 | 
			
		||||
	            }
 | 
			
		||||
	        }
 | 
			
		||||
	    }
 | 
			
		||||
	
 | 
			
		||||
	    protected override void Save(string name)
 | 
			
		||||
	    {
 | 
			
		||||
	        // Open file with filter
 | 
			
		||||
	        var extensions = new[]
 | 
			
		||||
	        {
 | 
			
		||||
	                new ExtensionFilter("Image Files", "png")
 | 
			
		||||
	        };
 | 
			
		||||
	
 | 
			
		||||
	        StandaloneFileBrowser.SaveFilePanelAsync("Save file", "", name, extensions, base.Save);
 | 
			
		||||
	    }
 | 
			
		||||
	
 | 
			
		||||
	    protected override void SaveTexture(string path, byte[] bytes)
 | 
			
		||||
	    {
 | 
			
		||||
	        System.IO.File.WriteAllBytes(path, bytes);
 | 
			
		||||
	    }
 | 
			
		||||
	#endif
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										11
									
								
								Assets/Scripts/TextureHandlers/TextureHandlerWin.cs.meta
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										11
									
								
								Assets/Scripts/TextureHandlers/TextureHandlerWin.cs.meta
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,11 @@
 | 
			
		||||
fileFormatVersion: 2
 | 
			
		||||
guid: 1a52e2fdc38fe1f47ba34b6f5818afca
 | 
			
		||||
MonoImporter:
 | 
			
		||||
  externalObjects: {}
 | 
			
		||||
  serializedVersion: 2
 | 
			
		||||
  defaultReferences: []
 | 
			
		||||
  executionOrder: 0
 | 
			
		||||
  icon: {instanceID: 0}
 | 
			
		||||
  userData: 
 | 
			
		||||
  assetBundleName: 
 | 
			
		||||
  assetBundleVariant: 
 | 
			
		||||
							
								
								
									
										74
									
								
								Assets/Scripts/TextureSlot.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										74
									
								
								Assets/Scripts/TextureSlot.cs
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,74 @@
 | 
			
		||||
using System.Collections;
 | 
			
		||||
using System.Collections.Generic;
 | 
			
		||||
using UnityEngine;
 | 
			
		||||
using UnityEngine.UI;
 | 
			
		||||
 | 
			
		||||
namespace TextureCombiner
 | 
			
		||||
{
 | 
			
		||||
	public class TextureSlot : MonoBehaviour
 | 
			
		||||
	{
 | 
			
		||||
	    [SerializeField]
 | 
			
		||||
	    private Toggle[] sourceToggles = null;
 | 
			
		||||
	    [SerializeField]
 | 
			
		||||
	    private Toggle[] targetToggles = null;
 | 
			
		||||
	
 | 
			
		||||
	    public Texture2D texture
 | 
			
		||||
	    {
 | 
			
		||||
	        get;
 | 
			
		||||
	        private set;
 | 
			
		||||
	    }
 | 
			
		||||
	
 | 
			
		||||
	    [SerializeField]
 | 
			
		||||
	    private Button removeButton = null;
 | 
			
		||||
	    [SerializeField]
 | 
			
		||||
	    private RawImage rawImage = null;
 | 
			
		||||
	
 | 
			
		||||
	    public void Init(Texture2D tex)
 | 
			
		||||
	    {
 | 
			
		||||
	        texture = tex;
 | 
			
		||||
	        rawImage.texture = texture;
 | 
			
		||||
	
 | 
			
		||||
	        removeButton.onClick.AddListener(()=>
 | 
			
		||||
	        { 
 | 
			
		||||
	            Destroy(texture); 
 | 
			
		||||
	            Destroy(this.gameObject);
 | 
			
		||||
	        });
 | 
			
		||||
	    }
 | 
			
		||||
	
 | 
			
		||||
	    public Channels GetTargetChannels()
 | 
			
		||||
	    {
 | 
			
		||||
	        return new Channels(
 | 
			
		||||
	            targetToggles[0].isOn,
 | 
			
		||||
	            targetToggles[1].isOn,
 | 
			
		||||
	            targetToggles[2].isOn,
 | 
			
		||||
	            targetToggles[3].isOn
 | 
			
		||||
	        );
 | 
			
		||||
	    }
 | 
			
		||||
	
 | 
			
		||||
	    public Vector4 GetSourceChannels()
 | 
			
		||||
	    {
 | 
			
		||||
	        return new Vector4(
 | 
			
		||||
	            sourceToggles[0].isOn ? 1.0f : 0.0f,
 | 
			
		||||
	            sourceToggles[1].isOn ? 1.0f : 0.0f,
 | 
			
		||||
	            sourceToggles[2].isOn ? 1.0f : 0.0f,
 | 
			
		||||
	            sourceToggles[3].isOn ? 1.0f : 0.0f
 | 
			
		||||
	        );
 | 
			
		||||
	    }
 | 
			
		||||
	
 | 
			
		||||
	    public struct Channels
 | 
			
		||||
	    {
 | 
			
		||||
	        public Channels(bool _r, bool _g, bool _b, bool _a)
 | 
			
		||||
	        {
 | 
			
		||||
	            r = _r;
 | 
			
		||||
	            g = _g;
 | 
			
		||||
	            b = _b;
 | 
			
		||||
	            a = _a;
 | 
			
		||||
	        }
 | 
			
		||||
	
 | 
			
		||||
	        public bool r;
 | 
			
		||||
	        public bool g;
 | 
			
		||||
	        public bool b;
 | 
			
		||||
	        public bool a;
 | 
			
		||||
	    }
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										11
									
								
								Assets/Scripts/TextureSlot.cs.meta
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										11
									
								
								Assets/Scripts/TextureSlot.cs.meta
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,11 @@
 | 
			
		||||
fileFormatVersion: 2
 | 
			
		||||
guid: 7b24b75b037be27489d584dbb0e9b3e8
 | 
			
		||||
MonoImporter:
 | 
			
		||||
  externalObjects: {}
 | 
			
		||||
  serializedVersion: 2
 | 
			
		||||
  defaultReferences: []
 | 
			
		||||
  executionOrder: 0
 | 
			
		||||
  icon: {instanceID: 0}
 | 
			
		||||
  userData: 
 | 
			
		||||
  assetBundleName: 
 | 
			
		||||
  assetBundleVariant: 
 | 
			
		||||
							
								
								
									
										8
									
								
								Assets/Scripts/UI.meta
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										8
									
								
								Assets/Scripts/UI.meta
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,8 @@
 | 
			
		||||
fileFormatVersion: 2
 | 
			
		||||
guid: 723da6917db88b04bbaa4424be50b1a2
 | 
			
		||||
folderAsset: yes
 | 
			
		||||
DefaultImporter:
 | 
			
		||||
  externalObjects: {}
 | 
			
		||||
  userData: 
 | 
			
		||||
  assetBundleName: 
 | 
			
		||||
  assetBundleVariant: 
 | 
			
		||||
							
								
								
									
										53
									
								
								Assets/Scripts/UI/ButtonHandlerWeb.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										53
									
								
								Assets/Scripts/UI/ButtonHandlerWeb.cs
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,53 @@
 | 
			
		||||
using System.Collections;
 | 
			
		||||
using System.Collections.Generic;
 | 
			
		||||
using UnityEngine;
 | 
			
		||||
using UnityEngine.UI;
 | 
			
		||||
using UnityEngine.EventSystems;
 | 
			
		||||
 | 
			
		||||
namespace TextureCombiner
 | 
			
		||||
{
 | 
			
		||||
	[RequireComponent(typeof(Button))]
 | 
			
		||||
	public class ButtonHandlerWeb : MonoBehaviour, IPointerDownHandler
 | 
			
		||||
	{
 | 
			
		||||
	    public enum ButtonType
 | 
			
		||||
	    {
 | 
			
		||||
	        Load,
 | 
			
		||||
	        Save
 | 
			
		||||
	    }
 | 
			
		||||
	
 | 
			
		||||
	#pragma warning disable CS0414
 | 
			
		||||
	    [SerializeField]
 | 
			
		||||
	    private ButtonType m_buttonType = ButtonType.Load;
 | 
			
		||||
	#pragma warning restore CS0414
 | 
			
		||||
	
 | 
			
		||||
	#if UNITY_WEBGL
 | 
			
		||||
	    private TextureCombiner m_textureCombiner = null;
 | 
			
		||||
	    private Button m_button = null;
 | 
			
		||||
	
 | 
			
		||||
	    private void Awake()
 | 
			
		||||
	    {
 | 
			
		||||
	        m_textureCombiner = FindObjectOfType<TextureCombiner>();
 | 
			
		||||
	        m_button = this.GetComponent<Button>();
 | 
			
		||||
	    }
 | 
			
		||||
	#endif
 | 
			
		||||
	
 | 
			
		||||
	    public void OnPointerDown(UnityEngine.EventSystems.PointerEventData eventData)
 | 
			
		||||
	    {
 | 
			
		||||
	#if UNITY_WEBGL
 | 
			
		||||
	        m_button.onClick.RemoveAllListeners();
 | 
			
		||||
	
 | 
			
		||||
	        switch (m_buttonType)
 | 
			
		||||
	        {
 | 
			
		||||
	            case ButtonType.Load:
 | 
			
		||||
	                m_textureCombiner.Load();
 | 
			
		||||
	                break;
 | 
			
		||||
	            case ButtonType.Save:
 | 
			
		||||
	                m_textureCombiner.Save();
 | 
			
		||||
	                break;
 | 
			
		||||
	            default:
 | 
			
		||||
	                break;
 | 
			
		||||
	        }
 | 
			
		||||
	#endif
 | 
			
		||||
	    }
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										11
									
								
								Assets/Scripts/UI/ButtonHandlerWeb.cs.meta
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										11
									
								
								Assets/Scripts/UI/ButtonHandlerWeb.cs.meta
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,11 @@
 | 
			
		||||
fileFormatVersion: 2
 | 
			
		||||
guid: c1fd32c98211f8744bbb554e3fd928d7
 | 
			
		||||
MonoImporter:
 | 
			
		||||
  externalObjects: {}
 | 
			
		||||
  serializedVersion: 2
 | 
			
		||||
  defaultReferences: []
 | 
			
		||||
  executionOrder: 0
 | 
			
		||||
  icon: {instanceID: 0}
 | 
			
		||||
  userData: 
 | 
			
		||||
  assetBundleName: 
 | 
			
		||||
  assetBundleVariant: 
 | 
			
		||||
							
								
								
									
										39
									
								
								Assets/Scripts/UI/FitRect.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										39
									
								
								Assets/Scripts/UI/FitRect.cs
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,39 @@
 | 
			
		||||
using UnityEngine;
 | 
			
		||||
using UnityEngine.UI;
 | 
			
		||||
 | 
			
		||||
namespace TextureCombiner
 | 
			
		||||
{
 | 
			
		||||
	[RequireComponent(typeof(RectTransform)), ExecuteInEditMode]
 | 
			
		||||
	public class FitRect : MonoBehaviour
 | 
			
		||||
	{
 | 
			
		||||
		public bool m_fitHeight = false;
 | 
			
		||||
		public bool m_fitWidth = false;
 | 
			
		||||
		public RectTransform m_rectToFit = null;
 | 
			
		||||
 | 
			
		||||
		private RectTransform m_rectTransform = null;
 | 
			
		||||
		private Rect m_prevRect = new Rect();
 | 
			
		||||
 | 
			
		||||
		private void Awake()
 | 
			
		||||
		{
 | 
			
		||||
			m_rectTransform = GetComponent<RectTransform>();
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		private void Update()
 | 
			
		||||
		{
 | 
			
		||||
			if(!m_rectToFit)
 | 
			
		||||
			{
 | 
			
		||||
				return;
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
			if(m_prevRect != m_rectToFit.rect)
 | 
			
		||||
			{
 | 
			
		||||
				m_prevRect = m_rectToFit.rect;
 | 
			
		||||
 | 
			
		||||
				m_rectTransform.sizeDelta = new Vector2(
 | 
			
		||||
                        m_fitWidth ? m_rectToFit.rect.width : m_rectTransform.rect.width,
 | 
			
		||||
                        m_fitHeight ? m_rectToFit.rect.height : m_rectToFit.rect.height
 | 
			
		||||
                    );
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										11
									
								
								Assets/Scripts/UI/FitRect.cs.meta
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										11
									
								
								Assets/Scripts/UI/FitRect.cs.meta
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,11 @@
 | 
			
		||||
fileFormatVersion: 2
 | 
			
		||||
guid: 3df6f29a361ab574789d62241d8f0310
 | 
			
		||||
MonoImporter:
 | 
			
		||||
  externalObjects: {}
 | 
			
		||||
  serializedVersion: 2
 | 
			
		||||
  defaultReferences: []
 | 
			
		||||
  executionOrder: 0
 | 
			
		||||
  icon: {instanceID: 0}
 | 
			
		||||
  userData: 
 | 
			
		||||
  assetBundleName: 
 | 
			
		||||
  assetBundleVariant: 
 | 
			
		||||
							
								
								
									
										21
									
								
								Assets/Scripts/UI/HoverInfo.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										21
									
								
								Assets/Scripts/UI/HoverInfo.cs
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,21 @@
 | 
			
		||||
using UnityEngine;
 | 
			
		||||
using UnityEngine.EventSystems;
 | 
			
		||||
 | 
			
		||||
namespace TextureCombiner
 | 
			
		||||
{
 | 
			
		||||
	public class HoverInfo : MonoBehaviour, IPointerEnterHandler, IPointerExitHandler
 | 
			
		||||
	{
 | 
			
		||||
	    [SerializeField, Multiline]
 | 
			
		||||
	    private string m_text = "";
 | 
			
		||||
 | 
			
		||||
		public void OnPointerEnter(PointerEventData eventData)
 | 
			
		||||
	    {
 | 
			
		||||
			HoverInfoBox.s_hoverInfoBox.Show(m_text, eventData.position);
 | 
			
		||||
		}
 | 
			
		||||
	
 | 
			
		||||
	    public void OnPointerExit(PointerEventData eventData)
 | 
			
		||||
	    {
 | 
			
		||||
			HoverInfoBox.s_hoverInfoBox.Hide();
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										11
									
								
								Assets/Scripts/UI/HoverInfo.cs.meta
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										11
									
								
								Assets/Scripts/UI/HoverInfo.cs.meta
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,11 @@
 | 
			
		||||
fileFormatVersion: 2
 | 
			
		||||
guid: 4777ae165e0fc384c9b2f40261e50fb0
 | 
			
		||||
MonoImporter:
 | 
			
		||||
  externalObjects: {}
 | 
			
		||||
  serializedVersion: 2
 | 
			
		||||
  defaultReferences: []
 | 
			
		||||
  executionOrder: 0
 | 
			
		||||
  icon: {instanceID: 0}
 | 
			
		||||
  userData: 
 | 
			
		||||
  assetBundleName: 
 | 
			
		||||
  assetBundleVariant: 
 | 
			
		||||
							
								
								
									
										82
									
								
								Assets/Scripts/UI/HoverInfoBox.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										82
									
								
								Assets/Scripts/UI/HoverInfoBox.cs
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,82 @@
 | 
			
		||||
using UnityEngine;
 | 
			
		||||
using UnityEngine.UI;
 | 
			
		||||
 | 
			
		||||
namespace TextureCombiner
 | 
			
		||||
{
 | 
			
		||||
	public class HoverInfoBox : MonoBehaviour
 | 
			
		||||
	{
 | 
			
		||||
	    public static HoverInfoBox s_hoverInfoBox { get; private set; } = null;
 | 
			
		||||
	
 | 
			
		||||
	    [SerializeField]
 | 
			
		||||
	    private RectTransform m_infoBoxParent = null;
 | 
			
		||||
	    [SerializeField]
 | 
			
		||||
	    private Text m_text = null;
 | 
			
		||||
	    [SerializeField]
 | 
			
		||||
	    private Vector2 m_offset = new Vector2(0, 0);
 | 
			
		||||
	
 | 
			
		||||
	    private void Awake()
 | 
			
		||||
	    {
 | 
			
		||||
	        if(s_hoverInfoBox)
 | 
			
		||||
	        {
 | 
			
		||||
	            DestroyImmediate(gameObject);
 | 
			
		||||
	        }
 | 
			
		||||
	
 | 
			
		||||
	        s_hoverInfoBox = this;
 | 
			
		||||
	    }
 | 
			
		||||
 | 
			
		||||
        private void OnDisable()
 | 
			
		||||
        {
 | 
			
		||||
            Hide();
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
		public void Show(string a_text, Vector2 a_position)
 | 
			
		||||
	    {
 | 
			
		||||
			if(!enabled)
 | 
			
		||||
			{
 | 
			
		||||
				return;
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
			// Set text.
 | 
			
		||||
			m_text.text = a_text;
 | 
			
		||||
			m_text.SetLayoutDirty();
 | 
			
		||||
 | 
			
		||||
			// Flip when above 50% of the screen.
 | 
			
		||||
			if(Input.mousePosition.y < (Screen.height / 2))
 | 
			
		||||
			{
 | 
			
		||||
				a_position += new Vector2(m_offset.x - (m_infoBoxParent.rect.width / 2), m_offset.y);
 | 
			
		||||
			}
 | 
			
		||||
			else
 | 
			
		||||
			{
 | 
			
		||||
				a_position += new Vector2(m_offset.x - (m_infoBoxParent.rect.width / 2), -m_offset.y - m_infoBoxParent.rect.height);
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
			// Clamp borders.
 | 
			
		||||
			if(a_position.x < 0)
 | 
			
		||||
			{
 | 
			
		||||
				a_position.x = 0;
 | 
			
		||||
			}
 | 
			
		||||
			else if (a_position.x + m_infoBoxParent.rect.width > Screen.width)
 | 
			
		||||
            {
 | 
			
		||||
                a_position.x = Screen.width - m_infoBoxParent.rect.width;
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            if (a_position.y < 0)
 | 
			
		||||
			{
 | 
			
		||||
				a_position.y = 0;
 | 
			
		||||
			}
 | 
			
		||||
			else if (a_position.y + m_infoBoxParent.rect.height > Screen.height)
 | 
			
		||||
            {
 | 
			
		||||
                a_position.y = Screen.height - m_infoBoxParent.rect.height;
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            // Enable object.
 | 
			
		||||
            m_infoBoxParent.gameObject.SetActive(true);
 | 
			
		||||
			m_infoBoxParent.position = a_position;
 | 
			
		||||
	    }
 | 
			
		||||
	
 | 
			
		||||
	    public void Hide()
 | 
			
		||||
	    {
 | 
			
		||||
            m_infoBoxParent.gameObject.SetActive(false);
 | 
			
		||||
	    }
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										11
									
								
								Assets/Scripts/UI/HoverInfoBox.cs.meta
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										11
									
								
								Assets/Scripts/UI/HoverInfoBox.cs.meta
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,11 @@
 | 
			
		||||
fileFormatVersion: 2
 | 
			
		||||
guid: f517fa6682ad6dd4ebec0f35cd3cfc1a
 | 
			
		||||
MonoImporter:
 | 
			
		||||
  externalObjects: {}
 | 
			
		||||
  serializedVersion: 2
 | 
			
		||||
  defaultReferences: []
 | 
			
		||||
  executionOrder: 0
 | 
			
		||||
  icon: {instanceID: 0}
 | 
			
		||||
  userData: 
 | 
			
		||||
  assetBundleName: 
 | 
			
		||||
  assetBundleVariant: 
 | 
			
		||||
							
								
								
									
										24
									
								
								Assets/Scripts/UI/OpenURL.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										24
									
								
								Assets/Scripts/UI/OpenURL.cs
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,24 @@
 | 
			
		||||
using UnityEngine;
 | 
			
		||||
using UnityEngine.EventSystems;
 | 
			
		||||
 | 
			
		||||
namespace TextureCombiner
 | 
			
		||||
{
 | 
			
		||||
	public class OpenURL : MonoBehaviour, IPointerClickHandler
 | 
			
		||||
	{
 | 
			
		||||
		[SerializeField]
 | 
			
		||||
		private string m_url = "";
 | 
			
		||||
		[SerializeField]
 | 
			
		||||
		private bool m_httpsOnly = true;
 | 
			
		||||
 | 
			
		||||
		public void OnPointerClick(UnityEngine.EventSystems.PointerEventData eventData)
 | 
			
		||||
		{
 | 
			
		||||
			if(m_httpsOnly && !m_url.StartsWith("https://"))
 | 
			
		||||
			{
 | 
			
		||||
				m_url = "https://" + m_url;
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
			Application.OpenURL(m_url);
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										11
									
								
								Assets/Scripts/UI/OpenURL.cs.meta
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										11
									
								
								Assets/Scripts/UI/OpenURL.cs.meta
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,11 @@
 | 
			
		||||
fileFormatVersion: 2
 | 
			
		||||
guid: 0de3abbefbab004458d0b32fa4794c61
 | 
			
		||||
MonoImporter:
 | 
			
		||||
  externalObjects: {}
 | 
			
		||||
  serializedVersion: 2
 | 
			
		||||
  defaultReferences: []
 | 
			
		||||
  executionOrder: 0
 | 
			
		||||
  icon: {instanceID: 0}
 | 
			
		||||
  userData: 
 | 
			
		||||
  assetBundleName: 
 | 
			
		||||
  assetBundleVariant: 
 | 
			
		||||
							
								
								
									
										23
									
								
								Assets/Scripts/UI/ToggleInvoke.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										23
									
								
								Assets/Scripts/UI/ToggleInvoke.cs
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,23 @@
 | 
			
		||||
using System.Collections;
 | 
			
		||||
using System.Collections.Generic;
 | 
			
		||||
using UnityEngine;
 | 
			
		||||
using UnityEngine.UI;
 | 
			
		||||
 | 
			
		||||
namespace TextureCombiner
 | 
			
		||||
{
 | 
			
		||||
	[RequireComponent(typeof(Toggle))]
 | 
			
		||||
	public class ToggleInvoke : MonoBehaviour
 | 
			
		||||
	{
 | 
			
		||||
	    private Toggle m_toggle = null;
 | 
			
		||||
	
 | 
			
		||||
	    private void Awake()
 | 
			
		||||
	    {
 | 
			
		||||
	        m_toggle = GetComponent<Toggle>();
 | 
			
		||||
	    }
 | 
			
		||||
	
 | 
			
		||||
	    private void OnEnable()
 | 
			
		||||
	    {
 | 
			
		||||
	        m_toggle.onValueChanged.Invoke(m_toggle.isOn);
 | 
			
		||||
	    }
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										11
									
								
								Assets/Scripts/UI/ToggleInvoke.cs.meta
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										11
									
								
								Assets/Scripts/UI/ToggleInvoke.cs.meta
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,11 @@
 | 
			
		||||
fileFormatVersion: 2
 | 
			
		||||
guid: 9695356589cdfd24f9058351ac2f48e3
 | 
			
		||||
MonoImporter:
 | 
			
		||||
  externalObjects: {}
 | 
			
		||||
  serializedVersion: 2
 | 
			
		||||
  defaultReferences: []
 | 
			
		||||
  executionOrder: 0
 | 
			
		||||
  icon: {instanceID: 0}
 | 
			
		||||
  userData: 
 | 
			
		||||
  assetBundleName: 
 | 
			
		||||
  assetBundleVariant: 
 | 
			
		||||
							
								
								
									
										8
									
								
								Assets/Shaders.meta
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										8
									
								
								Assets/Shaders.meta
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,8 @@
 | 
			
		||||
fileFormatVersion: 2
 | 
			
		||||
guid: 61291a71f409dcf429855aa0a506d4ba
 | 
			
		||||
folderAsset: yes
 | 
			
		||||
DefaultImporter:
 | 
			
		||||
  externalObjects: {}
 | 
			
		||||
  userData: 
 | 
			
		||||
  assetBundleName: 
 | 
			
		||||
  assetBundleVariant: 
 | 
			
		||||
							
								
								
									
										80
									
								
								Assets/Shaders/CombineShader.shader
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										80
									
								
								Assets/Shaders/CombineShader.shader
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,80 @@
 | 
			
		||||
Shader "TextureCombiner/CombineShader"
 | 
			
		||||
{
 | 
			
		||||
    Properties
 | 
			
		||||
    {
 | 
			
		||||
        _MainTex("MainTex", 2D) = "white" {}
 | 
			
		||||
        _Tex0("TexR", 2D) = "black" {}
 | 
			
		||||
        _Tex1("TexG", 2D) = "black" {}
 | 
			
		||||
        _Tex2("TexB", 2D) = "black" {}
 | 
			
		||||
        _Tex3("TexA", 2D) = "black" {}
 | 
			
		||||
        _Mask0("MaskR", Vector) = (0, 0, 0, 0)
 | 
			
		||||
        _Mask1("MaskG", Vector) = (0, 0, 0, 0)
 | 
			
		||||
        _Mask2("MaskB", Vector) = (0, 0, 0, 0)
 | 
			
		||||
        _Mask3("MaskA", Vector) = (0, 0, 0, 0)
 | 
			
		||||
        _Add("Add", Vector) = (0, 0, 0, 0)
 | 
			
		||||
    }
 | 
			
		||||
    SubShader
 | 
			
		||||
    {
 | 
			
		||||
        Tags { "RenderType"="Opaque" }
 | 
			
		||||
        LOD 100
 | 
			
		||||
 | 
			
		||||
        Pass
 | 
			
		||||
        {
 | 
			
		||||
            CGPROGRAM
 | 
			
		||||
            #pragma vertex vert
 | 
			
		||||
            #pragma fragment frag
 | 
			
		||||
 | 
			
		||||
            #include "UnityCG.cginc"
 | 
			
		||||
 | 
			
		||||
            struct appdata
 | 
			
		||||
            {
 | 
			
		||||
                float4 vertex : POSITION;
 | 
			
		||||
                float2 uv : TEXCOORD0;
 | 
			
		||||
            };
 | 
			
		||||
 | 
			
		||||
            struct v2f
 | 
			
		||||
            {
 | 
			
		||||
                float2 uv : TEXCOORD0;
 | 
			
		||||
                float4 vertex : SV_POSITION;
 | 
			
		||||
            };
 | 
			
		||||
 | 
			
		||||
            sampler2D _MainTex;
 | 
			
		||||
            float4 _MainTex_ST;
 | 
			
		||||
            sampler2D _Tex0;
 | 
			
		||||
            sampler2D _Tex1;
 | 
			
		||||
            sampler2D _Tex2;
 | 
			
		||||
            sampler2D _Tex3;
 | 
			
		||||
            float4 _Mask0;
 | 
			
		||||
            float4 _Mask1;
 | 
			
		||||
            float4 _Mask2;
 | 
			
		||||
            float4 _Mask3;
 | 
			
		||||
            float4 _Add;
 | 
			
		||||
 | 
			
		||||
            v2f vert (appdata v)
 | 
			
		||||
            {
 | 
			
		||||
                v2f o;
 | 
			
		||||
                o.vertex = UnityObjectToClipPos(v.vertex);
 | 
			
		||||
                o.uv = TRANSFORM_TEX(v.uv, _MainTex);
 | 
			
		||||
                return o;
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            float GetChannelColor(float4 col, float4 mask)
 | 
			
		||||
            {
 | 
			
		||||
                return (col.r * mask.r) + (col.g * mask.g) + (col.b * mask.b) + (col.a * mask.a);
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            fixed4 frag(v2f i) : SV_Target
 | 
			
		||||
            {
 | 
			
		||||
                fixed4 col = fixed4(0, 0, 0, 0);
 | 
			
		||||
 | 
			
		||||
                col.r = clamp(GetChannelColor(tex2D(_Tex0, i.uv).rgba, _Mask0) + _Add.r, 0, 1);
 | 
			
		||||
                col.g = clamp(GetChannelColor(tex2D(_Tex1, i.uv).rgba, _Mask1) + _Add.g, 0, 1);
 | 
			
		||||
                col.b = clamp(GetChannelColor(tex2D(_Tex2, i.uv).rgba, _Mask2) + _Add.b, 0, 1);
 | 
			
		||||
                col.a = clamp(GetChannelColor(tex2D(_Tex3, i.uv).rgba, _Mask3) + _Add.a, 0, 1);
 | 
			
		||||
 | 
			
		||||
                return col;
 | 
			
		||||
            }
 | 
			
		||||
            ENDCG
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										9
									
								
								Assets/Shaders/CombineShader.shader.meta
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										9
									
								
								Assets/Shaders/CombineShader.shader.meta
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,9 @@
 | 
			
		||||
fileFormatVersion: 2
 | 
			
		||||
guid: 549aae9fe3b32db48804f14851ff0f48
 | 
			
		||||
ShaderImporter:
 | 
			
		||||
  externalObjects: {}
 | 
			
		||||
  defaultTextures: []
 | 
			
		||||
  nonModifiableTextures: []
 | 
			
		||||
  userData: 
 | 
			
		||||
  assetBundleName: 
 | 
			
		||||
  assetBundleVariant: 
 | 
			
		||||
							
								
								
									
										8
									
								
								Assets/Sprites.meta
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										8
									
								
								Assets/Sprites.meta
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,8 @@
 | 
			
		||||
fileFormatVersion: 2
 | 
			
		||||
guid: 08452dbad88f4094598d2fb38aae1822
 | 
			
		||||
folderAsset: yes
 | 
			
		||||
DefaultImporter:
 | 
			
		||||
  externalObjects: {}
 | 
			
		||||
  userData: 
 | 
			
		||||
  assetBundleName: 
 | 
			
		||||
  assetBundleVariant: 
 | 
			
		||||
							
								
								
									
										
											BIN
										
									
								
								Assets/Sprites/Arrow.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								Assets/Sprites/Arrow.png
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							| 
		 After Width: | Height: | Size: 2.1 KiB  | 
							
								
								
									
										92
									
								
								Assets/Sprites/Arrow.png.meta
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										92
									
								
								Assets/Sprites/Arrow.png.meta
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,92 @@
 | 
			
		||||
fileFormatVersion: 2
 | 
			
		||||
guid: fd7eaf5d07fc49249aef617718fc0586
 | 
			
		||||
TextureImporter:
 | 
			
		||||
  internalIDToNameTable: []
 | 
			
		||||
  externalObjects: {}
 | 
			
		||||
  serializedVersion: 11
 | 
			
		||||
  mipmaps:
 | 
			
		||||
    mipMapMode: 0
 | 
			
		||||
    enableMipMap: 0
 | 
			
		||||
    sRGBTexture: 1
 | 
			
		||||
    linearTexture: 0
 | 
			
		||||
    fadeOut: 0
 | 
			
		||||
    borderMipMap: 0
 | 
			
		||||
    mipMapsPreserveCoverage: 0
 | 
			
		||||
    alphaTestReferenceValue: 0.5
 | 
			
		||||
    mipMapFadeDistanceStart: 1
 | 
			
		||||
    mipMapFadeDistanceEnd: 3
 | 
			
		||||
  bumpmap:
 | 
			
		||||
    convertToNormalMap: 0
 | 
			
		||||
    externalNormalMap: 0
 | 
			
		||||
    heightScale: 0.25
 | 
			
		||||
    normalMapFilter: 0
 | 
			
		||||
  isReadable: 0
 | 
			
		||||
  streamingMipmaps: 0
 | 
			
		||||
  streamingMipmapsPriority: 0
 | 
			
		||||
  grayScaleToAlpha: 0
 | 
			
		||||
  generateCubemap: 6
 | 
			
		||||
  cubemapConvolution: 0
 | 
			
		||||
  seamlessCubemap: 0
 | 
			
		||||
  textureFormat: 1
 | 
			
		||||
  maxTextureSize: 2048
 | 
			
		||||
  textureSettings:
 | 
			
		||||
    serializedVersion: 2
 | 
			
		||||
    filterMode: -1
 | 
			
		||||
    aniso: -1
 | 
			
		||||
    mipBias: -100
 | 
			
		||||
    wrapU: 1
 | 
			
		||||
    wrapV: 1
 | 
			
		||||
    wrapW: 1
 | 
			
		||||
  nPOTScale: 0
 | 
			
		||||
  lightmap: 0
 | 
			
		||||
  compressionQuality: 50
 | 
			
		||||
  spriteMode: 1
 | 
			
		||||
  spriteExtrude: 1
 | 
			
		||||
  spriteMeshType: 1
 | 
			
		||||
  alignment: 0
 | 
			
		||||
  spritePivot: {x: 0.5, y: 0.5}
 | 
			
		||||
  spritePixelsToUnits: 100
 | 
			
		||||
  spriteBorder: {x: 0, y: 0, z: 0, w: 0}
 | 
			
		||||
  spriteGenerateFallbackPhysicsShape: 1
 | 
			
		||||
  alphaUsage: 1
 | 
			
		||||
  alphaIsTransparency: 1
 | 
			
		||||
  spriteTessellationDetail: -1
 | 
			
		||||
  textureType: 8
 | 
			
		||||
  textureShape: 1
 | 
			
		||||
  singleChannelComponent: 0
 | 
			
		||||
  maxTextureSizeSet: 0
 | 
			
		||||
  compressionQualitySet: 0
 | 
			
		||||
  textureFormatSet: 0
 | 
			
		||||
  applyGammaDecoding: 0
 | 
			
		||||
  platformSettings:
 | 
			
		||||
  - serializedVersion: 3
 | 
			
		||||
    buildTarget: DefaultTexturePlatform
 | 
			
		||||
    maxTextureSize: 2048
 | 
			
		||||
    resizeAlgorithm: 0
 | 
			
		||||
    textureFormat: -1
 | 
			
		||||
    textureCompression: 1
 | 
			
		||||
    compressionQuality: 50
 | 
			
		||||
    crunchedCompression: 0
 | 
			
		||||
    allowsAlphaSplitting: 0
 | 
			
		||||
    overridden: 0
 | 
			
		||||
    androidETC2FallbackOverride: 0
 | 
			
		||||
    forceMaximumCompressionQuality_BC6H_BC7: 0
 | 
			
		||||
  spriteSheet:
 | 
			
		||||
    serializedVersion: 2
 | 
			
		||||
    sprites: []
 | 
			
		||||
    outline: []
 | 
			
		||||
    physicsShape: []
 | 
			
		||||
    bones: []
 | 
			
		||||
    spriteID: 5e97eb03825dee720800000000000000
 | 
			
		||||
    internalID: 0
 | 
			
		||||
    vertices: []
 | 
			
		||||
    indices: 
 | 
			
		||||
    edges: []
 | 
			
		||||
    weights: []
 | 
			
		||||
    secondaryTextures: []
 | 
			
		||||
  spritePackingTag: 
 | 
			
		||||
  pSDRemoveMatte: 0
 | 
			
		||||
  pSDShowRemoveMatteOption: 0
 | 
			
		||||
  userData: 
 | 
			
		||||
  assetBundleName: 
 | 
			
		||||
  assetBundleVariant: 
 | 
			
		||||
							
								
								
									
										8
									
								
								Assets/WebGLTemplates.meta
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										8
									
								
								Assets/WebGLTemplates.meta
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,8 @@
 | 
			
		||||
fileFormatVersion: 2
 | 
			
		||||
guid: fe9cde33d3c89a1418dadad15e421367
 | 
			
		||||
folderAsset: yes
 | 
			
		||||
DefaultImporter:
 | 
			
		||||
  externalObjects: {}
 | 
			
		||||
  userData: 
 | 
			
		||||
  assetBundleName: 
 | 
			
		||||
  assetBundleVariant: 
 | 
			
		||||
							
								
								
									
										9
									
								
								Assets/WebGLTemplates/FS_Adaptive.meta
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										9
									
								
								Assets/WebGLTemplates/FS_Adaptive.meta
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,9 @@
 | 
			
		||||
fileFormatVersion: 2
 | 
			
		||||
guid: c9500305085e4cc48a63a560b3aca5cd
 | 
			
		||||
folderAsset: yes
 | 
			
		||||
timeCreated: 1483014353
 | 
			
		||||
licenseType: Pro
 | 
			
		||||
DefaultImporter:
 | 
			
		||||
  userData: 
 | 
			
		||||
  assetBundleName: 
 | 
			
		||||
  assetBundleVariant: 
 | 
			
		||||
							
								
								
									
										9
									
								
								Assets/WebGLTemplates/FS_Adaptive/TemplateData.meta
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										9
									
								
								Assets/WebGLTemplates/FS_Adaptive/TemplateData.meta
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,9 @@
 | 
			
		||||
fileFormatVersion: 2
 | 
			
		||||
guid: 9e12a3068ac5eb846ad50539469f5580
 | 
			
		||||
folderAsset: yes
 | 
			
		||||
timeCreated: 1483014763
 | 
			
		||||
licenseType: Pro
 | 
			
		||||
DefaultImporter:
 | 
			
		||||
  userData: 
 | 
			
		||||
  assetBundleName: 
 | 
			
		||||
  assetBundleVariant: 
 | 
			
		||||
							
								
								
									
										2
									
								
								Assets/WebGLTemplates/FS_Adaptive/TemplateData/style.css
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										2
									
								
								Assets/WebGLTemplates/FS_Adaptive/TemplateData/style.css
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,2 @@
 | 
			
		||||
.webgl-content * {border: 0; margin: 0; padding: 0}
 | 
			
		||||
.webgl-content {position: relative; top: 50%; left: 50%; -webkit-transform: translate(-50%, -50%); transform: translate(-50%, -50%);}
 | 
			
		||||
@@ -0,0 +1,8 @@
 | 
			
		||||
fileFormatVersion: 2
 | 
			
		||||
guid: 3080dfbadcb748c44b8bff806aaf74e8
 | 
			
		||||
timeCreated: 1483014763
 | 
			
		||||
licenseType: Pro
 | 
			
		||||
DefaultImporter:
 | 
			
		||||
  userData: 
 | 
			
		||||
  assetBundleName: 
 | 
			
		||||
  assetBundleVariant: 
 | 
			
		||||
							
								
								
									
										27
									
								
								Assets/WebGLTemplates/FS_Adaptive/index.html
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										27
									
								
								Assets/WebGLTemplates/FS_Adaptive/index.html
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,27 @@
 | 
			
		||||
<!DOCTYPE html>
 | 
			
		||||
<html lang="en-us">
 | 
			
		||||
  <head>
 | 
			
		||||
    <meta charset="utf-8">
 | 
			
		||||
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
 | 
			
		||||
      <style type="text/css">
 | 
			
		||||
          * {
 | 
			
		||||
            margin: 0;
 | 
			
		||||
            padding: 0;
 | 
			
		||||
          }
 | 
			
		||||
          
 | 
			
		||||
          canvas {
 | 
			
		||||
              width: 100%;
 | 
			
		||||
              height: 100%;
 | 
			
		||||
              position: absolute;
 | 
			
		||||
            }
 | 
			
		||||
      </style>
 | 
			
		||||
    <title>%UNITY_WEB_NAME%</title>
 | 
			
		||||
    <script src="%UNITY_WEBGL_LOADER_URL%"></script>
 | 
			
		||||
    <script>
 | 
			
		||||
      var gameInstance = UnityLoader.instantiate("gameContainer", "%UNITY_WEBGL_BUILD_URL%");
 | 
			
		||||
    </script>
 | 
			
		||||
  </head>
 | 
			
		||||
  <body>
 | 
			
		||||
    <div id="gameContainer" style="width: 100vw; height: 100vh; margin: auto"></div>
 | 
			
		||||
  </body>
 | 
			
		||||
</html>
 | 
			
		||||
							
								
								
									
										8
									
								
								Assets/WebGLTemplates/FS_Adaptive/index.html.meta
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										8
									
								
								Assets/WebGLTemplates/FS_Adaptive/index.html.meta
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,8 @@
 | 
			
		||||
fileFormatVersion: 2
 | 
			
		||||
guid: 2825144ff7011e341ad1b899285b1c21
 | 
			
		||||
timeCreated: 1483014353
 | 
			
		||||
licenseType: Pro
 | 
			
		||||
DefaultImporter:
 | 
			
		||||
  userData: 
 | 
			
		||||
  assetBundleName: 
 | 
			
		||||
  assetBundleVariant: 
 | 
			
		||||
							
								
								
									
										
											BIN
										
									
								
								Assets/WebGLTemplates/FS_Adaptive/thumbnail.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								Assets/WebGLTemplates/FS_Adaptive/thumbnail.png
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							| 
		 After Width: | Height: | Size: 2.9 KiB  | 
							
								
								
									
										8
									
								
								Assets/WebGLTemplates/FS_Adaptive/thumbnail.png.meta
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										8
									
								
								Assets/WebGLTemplates/FS_Adaptive/thumbnail.png.meta
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,8 @@
 | 
			
		||||
fileFormatVersion: 2
 | 
			
		||||
guid: 5cdb63f1232777c4cb75ef4ec05f88da
 | 
			
		||||
timeCreated: 1483014353
 | 
			
		||||
licenseType: Pro
 | 
			
		||||
DefaultImporter:
 | 
			
		||||
  userData: 
 | 
			
		||||
  assetBundleName: 
 | 
			
		||||
  assetBundleVariant: 
 | 
			
		||||
Some files were not shown because too many files have changed in this diff Show More
		Reference in New Issue
	
	Block a user