This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
using UnityEditor; | |
using UnityEditor.Callbacks; | |
using System.IO; | |
using System.Linq; | |
using System.Collections.Generic; | |
/// <summary> | |
/// Debug// | |
/// Unity5.2.4で動作確認// | |
/// </summary> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
using UnityEditor; | |
using UnityEditor.Callbacks; | |
using System.IO; | |
using System.Linq; | |
/// <summary> | |
/// SteamWorks.Netを使ってSteamAPIを組み込むとき、テスト用のsteam_appid.txtをビルド結果のフォルダに配置する// | |
/// Unity5.2.4で動作確認// | |
/// </summary> | |
public class PostBuildProcess |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Collections; | |
using UnityEngine; | |
using UnityEngine.Networking; | |
using UnityEngine.UI; | |
public class UnityWebRequestTest : MonoBehaviour | |
{ | |
public Image image; | |
private void Start() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
public static class Util | |
{ | |
public static Sprite CreateSpriteFromBytes(byte[] bytes) | |
{ | |
//横サイズの判定 | |
int pos = 16; | |
int width = 0; | |
for (int i = 0; i < 4; i++) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
public static class RectTransformExtension | |
{ | |
public static Vector2 GetLocalPosition(this RectTransform rectTransform, Vector2 screenPosition, Camera camera) | |
{ | |
Vector2 result = Vector2.zero; | |
RectTransformUtility.ScreenPointToLocalPointInRectangle(rectTransform, screenPosition, camera, out result); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public AudioMixer mixer; | |
public void SetLinearVolumeToMixerGroup(string mixerGroupName, float linearVolume) | |
{ | |
float decibel = 20.0f * Mathf.Log10(linearVolume); | |
if (float.IsNegativeInfinity(decibel)) | |
{ | |
decibel = -96f; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// <summary> | |
/// 使い方 Canvas下に空RestTransformを作りこれを貼る、下にスティック画像のImageをぶら下げてパブリックフィールドに設定する、GetAxis~から値を拾う。// | |
/// </summary> | |
/// <returns></returns> | |
using UnityEngine; | |
using UnityEngine.EventSystems; | |
using UnityEngine.UI; | |
public class JoyStick : Graphic, IEndDragHandler, IDragHandler, IPointerDownHandler, IPointerUpHandler | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Text; | |
public static class Utility | |
{ | |
public static string GenerateRandomAlphanumeric(int length = 44, bool removeMistakableChar = true) | |
{ | |
string guid = Guid.NewGuid().ToString("N"); | |
string str = Convert.ToBase64String(Encoding.UTF8.GetBytes(guid)); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//UnityMonoでDateTimeOffset.ToOffset(TimeSpan)が死ぬための処置// | |
//なお拡張メソッドでDateTimeに生やそうとするとオフセットが正常に取得できず死ぬ// | |
using System; | |
public static class DateTimeConverter | |
{ | |
public static DateTime UtcToLocal(DateTime utcTime) | |
{ | |
TimeSpan offset = TimeZone.CurrentTimeZone.GetUtcOffset(DateTime.Now); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.IO; | |
using System.Security.Cryptography; | |
using System.Text; | |
using UnityEngine; | |
/// <summary> | |
/// stringまたはシリアライズ可能なクラスをJSONに変換してAES暗号化して保存・読み込みする// | |
/// 参考: http://qiita.com/tempura/items/ad154d1269882ceda0f4 | |
/// </summary> |