P4 -> GitHub sync.
This commit is contained in:
max
2020-11-01 03:54:32 +01:00
parent e6b8bcef3c
commit 1165a4e4a8
124 changed files with 15569 additions and 3 deletions

14
Assets/Scripts/Options.cs Normal file
View 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();
}
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 7a83b90928bd7b3409c2aad736f20f28
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: fcc26bc422be36d4ba05f437c7ea52f6
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View 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
);
}
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: cfd2b97d613d4f04f8b3b11e66ad23e2
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View 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;
}
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: d2d913ba40069e249affef31f3f9ed72
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View 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";
}
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: f3d24c2bb90ddd24fa229a7f3429b868
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View 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);
}
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 8eaea5168b73e1a4790b4a86e6bc5aac
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View 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);
}
}
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 60a1dc9732b768841b8eaadcac6860c2
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View 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)
{
}
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 63c231cd38eac57429b1091348882930
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 977a2b7b6c2ca034aa201c687f8e0150
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View 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
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 978cb2b8bd47605408384d0375fe2e82
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View 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
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 1a52e2fdc38fe1f47ba34b6f5818afca
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View 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;
}
}
}

View 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
View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 723da6917db88b04bbaa4424be50b1a2
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View 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
}
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: c1fd32c98211f8744bbb554e3fd928d7
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View 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
);
}
}
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 3df6f29a361ab574789d62241d8f0310
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View 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();
}
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 4777ae165e0fc384c9b2f40261e50fb0
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View 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);
}
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: f517fa6682ad6dd4ebec0f35cd3cfc1a
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View 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);
}
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 0de3abbefbab004458d0b32fa4794c61
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View 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);
}
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 9695356589cdfd24f9058351ac2f48e3
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant: