Skip to content
This repository has been archived by the owner on Dec 7, 2021. It is now read-only.

Commit

Permalink
🌱 Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
monry committed Mar 5, 2018
0 parents commit 5746eea
Show file tree
Hide file tree
Showing 34 changed files with 2,237 additions and 0 deletions.
61 changes: 61 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# =============== #
# Unity generated #
# =============== #
/[Tt]emp/
/[Oo]bj/
/[Ll]ibrary/
/[Bb]uild/
/UnityGenerated/
# Library should not freeze version, it should be written in README.
/ProjectSettings/ProjectVersion.txt

# ============= #
# IDE generated #
# ============= #
# MonoDevelop / VisualStudio
/ExportedObj/
/*.svd
/*.userprefs
/*.csproj
/*.pidb
/*.suo
/*.sln
/*.user
/*.unityproj
/*.booproj
# Sublime Text
/*.sublime-*
# Visual Studio Code
/.vscode/
# IntelliJ Rider
/.idea/
/Assets/Plugins/Editor/JetBrains/
/Assets/Plugins/Editor/JetBrains.meta

# ======================= #
# umm (Node.js) generated #
# ======================= #
/node_modules/
/Assets/Modules*

# ============ #
# OS generated #
# ============ #
.DS_Store
.DS_Store?
._*
.Spotlight-V100
.Trashes
ehthumbs.db
Thumbs.db

# ======== #
# Optional #
# ======== #
/Assets/Plugins.meta
/Assets/Plugins/Editor.meta

# ====== #
# Custom #
# ====== #

7 changes: 7 additions & 0 deletions Assets/.npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
.npmignore
Modules/
Modules.meta
Plugins/
Plugins.meta
Tests/
Tests.meta
3 changes: 3 additions & 0 deletions Assets/Scripts.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions Assets/Scripts/UnityModule.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions Assets/Scripts/UnityModule/Command.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

102 changes: 102 additions & 0 deletions Assets/Scripts/UnityModule/Command/Runner.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
using System.Collections.Generic;
using System.Text;
using UniRx;

namespace UnityModule.Command {

public static class Runner<TResult> where TResult : class {

public static TResult Run(string command, string subCommand, List<string> argumentMap = null) {
if (typeof(TResult).IsGenericType && typeof(IObservable<>).IsAssignableFrom(typeof(TResult).GetGenericTypeDefinition())) {
return RunCommandAsync(command, subCommand, argumentMap) as TResult;
}
return RunCommand(command, subCommand, argumentMap) as TResult;
}

private static IObservable<string> RunCommandAsync(string command, string subCommand, List<string> argumentMap = null) {
return Observable
.Create<string>(
(observer) => {
try {
observer.OnNext(RunCommand(command, subCommand, argumentMap));
observer.OnCompleted();
} catch (System.Exception e) {
observer.OnError(e);
}
return null;
}
);
}

private static string RunCommand(string command, string subCommand, List<string> argumentMap = null) {
string output;
System.Diagnostics.Process process = CreateProcess(command, subCommand, argumentMap);
process.Start();
process.WaitForExit();
if (process.ExitCode == 0) {
output = process.StandardOutput.ReadToEnd();
process.Close();
} else {
process.Close();
throw new System.InvalidOperationException(process.StandardError.ReadToEnd());
}
return output;
}

private static System.Diagnostics.Process CreateProcess(string command, string subCommand, List<string> argumentMap = null) {
return new System.Diagnostics.Process {
StartInfo = {
FileName = command,
Arguments = string.Format("{0}{1}", subCommand, CreateArgument(argumentMap)),
UseShellExecute = false,
RedirectStandardOutput = true,
RedirectStandardError = true,
CreateNoWindow = true
},
};
}

private static string CreateArgument(List<string> argumentList) {
if (argumentList == default(List<string>) || argumentList.Count == 0) {
return string.Empty;
}
StringBuilder sb = new StringBuilder();
foreach (string argument in argumentList) {
sb.AppendFormat(" {0}", argument);
}
return sb.ToString();
}

}

internal class SafeList<T> : List<T> {

public SafeList(List<T> original) {
if (original != default(List<T>)) {
this.AddRange(original);
}
}

}

internal static class Extension {

internal static string Combine(this IEnumerable<string> items, bool surroundDoubleQuatation = true) {
StringBuilder sb = new StringBuilder();
foreach (string item in items) {
sb.AppendFormat(
"{1}{0}",
surroundDoubleQuatation ? item.Quot() : item,
sb.Length > 0 ? " " : string.Empty
);
}
return sb.ToString();
}

internal static string Quot(this string original) {
return string.Format("{1}{0}{1}", original, "\"");
}

}

}
3 changes: 3 additions & 0 deletions Assets/Scripts/UnityModule/Command/Runner.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions Assets/Scripts/UnityModule/Settings.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

45 changes: 45 additions & 0 deletions Assets/Scripts/UnityModule/Settings/EnvironmentSetting.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
using System;
using UnityEngine;

namespace UnityModule.Settings {

public partial class EnvironmentSetting {

public partial class EnvironmentSetting_Path {

/// <summary>
/// デフォルトの git コマンドパス
/// </summary>
private const string DEFAULT_COMMAND_PATH_AWS = "/usr/local/bin/aws";

/// <summary>
/// git コマンドへのパスを保存している環境変数のキー
/// </summary>
private const string ENVIRONMENT_KEY_COMMAND_AWS = "COMMAND_AWS";

/// <summary>
/// git コマンドのパスの実体
/// </summary>
[SerializeField]
private string commandAws;

/// <summary>
/// git コマンドのパス
/// </summary>
public string CommandAws {
get {
if (string.IsNullOrEmpty(this.commandAws)) {
this.commandAws = Environment.GetEnvironmentVariable(ENVIRONMENT_KEY_COMMAND_AWS);
}
if (string.IsNullOrEmpty(this.commandAws)) {
this.commandAws = DEFAULT_COMMAND_PATH_AWS;
}
return this.commandAws;
}
}

}

}

}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 21 additions & 0 deletions LICENSE.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2017 Tetsuya Mori

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.
17 changes: 17 additions & 0 deletions ProjectSettings/AudioManager.asset
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!11 &1
AudioManager:
m_ObjectHideFlags: 0
m_Volume: 1
Rolloff Scale: 1
Doppler Factor: 1
Default Speaker Mode: 2
m_SampleRate: 0
m_DSPBufferSize: 0
m_VirtualVoiceCount: 512
m_RealVoiceCount: 32
m_SpatializerPlugin:
m_AmbisonicDecoderPlugin:
m_DisableAudio: 0
m_VirtualizeEffects: 1
6 changes: 6 additions & 0 deletions ProjectSettings/ClusterInputManager.asset
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!236 &1
ClusterInputManager:
m_ObjectHideFlags: 0
m_Inputs: []
29 changes: 29 additions & 0 deletions ProjectSettings/DynamicsManager.asset
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!55 &1
PhysicsManager:
m_ObjectHideFlags: 0
serializedVersion: 7
m_Gravity: {x: 0, y: -9.81, z: 0}
m_DefaultMaterial: {fileID: 0}
m_BounceThreshold: 2
m_SleepThreshold: 0.005
m_DefaultContactOffset: 0.01
m_DefaultSolverIterations: 6
m_DefaultSolverVelocityIterations: 1
m_QueriesHitBackfaces: 0
m_QueriesHitTriggers: 1
m_EnableAdaptiveForce: 0
m_ClothInterCollisionDistance: 0
m_ClothInterCollisionStiffness: 0
m_ContactsGeneration: 1
m_LayerCollisionMatrix: ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
m_AutoSimulation: 1
m_AutoSyncTransforms: 1
m_ClothInterCollisionSettingsToggle: 0
m_ContactPairsMode: 0
m_BroadphaseType: 0
m_WorldBounds:
m_Center: {x: 0, y: 0, z: 0}
m_Extent: {x: 250, y: 250, z: 250}
m_WorldSubdivisions: 8
7 changes: 7 additions & 0 deletions ProjectSettings/EditorBuildSettings.asset
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1045 &1
EditorBuildSettings:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Scenes: []
21 changes: 21 additions & 0 deletions ProjectSettings/EditorSettings.asset
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!159 &1
EditorSettings:
m_ObjectHideFlags: 0
serializedVersion: 7
m_ExternalVersionControlSupport: Hidden Meta Files
m_SerializationMode: 2
m_LineEndingsForNewScripts: 1
m_DefaultBehaviorMode: 0
m_SpritePackerMode: 0
m_SpritePackerPaddingPower: 1
m_EtcTextureCompressorBehavior: 1
m_EtcTextureFastCompressor: 1
m_EtcTextureNormalCompressor: 2
m_EtcTextureBestCompressor: 4
m_ProjectGenerationIncludedExtensions: txt;xml;fnt;cd;asmdef;rsp
m_ProjectGenerationRootNamespace:
m_UserGeneratedProjectSuffix:
m_CollabEditorSettings:
inProgressEnabled: 1
Loading

0 comments on commit 5746eea

Please sign in to comment.