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

Commit

Permalink
ver0.2
Browse files Browse the repository at this point in the history
  • Loading branch information
chujohiroto committed May 22, 2019
0 parents commit d276ff7
Show file tree
Hide file tree
Showing 1,359 changed files with 324,782 additions and 0 deletions.
45 changes: 45 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
Assets/Plugins/Editor/JetBrains/
[Ll]ibrary/
[Tt]emp/
[Oo]bj/
[Bb]uild/
[Bb]uilds/
[Ll]ogs/
.idea/
Assets/AssetStoreTools*

# Visual Studio cache directory
.vs/

# Autogenerated VS/MD/Consulo solution and project files
ExportedObj/
.consulo/
*.csproj
*.unityproj
*.sln
*.suo
*.tmp
*.user
*.userprefs
*.pidb
*.booproj
*.svd
*.pdb
*.opendb
*.VC.db

# Unity3D generated meta files
*.pidb.meta
*.pdb.meta

# Unity3D Generated File On Crash Reports
sysinfo.txt

# Builds
*.apk
*.unitypackage

# Crashlytics generated file
Assets/StreamingAssets/crashlytics-build.properties

UpgradeLog.htm
1 change: 1 addition & 0 deletions Assets/.vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
8 changes: 8 additions & 0 deletions Assets/Editor.meta

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

81 changes: 81 additions & 0 deletions Assets/Editor/BuildClass.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
using UnityEditor;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using UnityEngine;

public class BuildClass
{
private static EditorBuildSettingsScene[] GetEditorBuildSettingsScenes()
{
// ビルド対象シーンリスト
List<EditorBuildSettingsScene> allScene = new List<EditorBuildSettingsScene>();
foreach (EditorBuildSettingsScene scene in EditorBuildSettings.scenes)
{
if (scene.enabled)
{
allScene.Add(scene);
}
}
return allScene.ToArray();
}

private static string DoBashCommand(string cmd)
{
var p = new Process();
p.StartInfo.FileName = "/bin/bash";
p.StartInfo.Arguments = "-c \" " + cmd + " \"";
p.StartInfo.UseShellExecute = false;
p.StartInfo.RedirectStandardOutput = true;
p.Start();

var output = p.StandardOutput.ReadToEnd();
p.WaitForExit();
p.Close();

return output;
}

private static string GetProjectRoot()
{
var path = Application.dataPath;
var s = path.Length - 7;
var root = path.Remove(s);
return root;
}

[MenuItem("UniP2P/Build and Double Run")]
public static void Build()
{
// 実行
#if UNITY_EDITOR_WIN
var filename = GetProjectRoot() + "/Build/" + DateTime.Now.ToString("yyyy-MM-dd-HH-mm") + "/" +
Application.productName + ".exe";
BuildPipeline.BuildPlayer(GetEditorBuildSettingsScenes(), filename, BuildTarget.StandaloneWindows64, BuildOptions.None);
Process.Start(filename);
Process.Start(filename);
#elif UNITY_EDITOR_MAC
var filename = GetProjectRoot() + "/Build/" + DateTime.Now.ToString("yyyy-MM-dd-HH-mm") + "/" +
Application.productName + ".app";
BuildPipeline.BuildPlayer(GetEditorBuildSettingsScenes(), filename, BuildTarget.StandaloneOSX, BuildOptions.None);
DoBashCommand("open -n " + filename);
DoBashCommand("open -n " + filename);
#endif
}

[MenuItem("UniP2P/Build and Run")]
public static void SingleBuild()
{
#if UNITY_EDITOR_WIN
var filename = GetProjectRoot() + "/Build/" + DateTime.Now.ToString("yyyy-MM-dd-HH-mm") + "/" +
Application.productName + ".exe";
BuildPipeline.BuildPlayer(GetEditorBuildSettingsScenes(), filename, BuildTarget.StandaloneWindows64, BuildOptions.None);
Process.Start(filename);
#elif UNITY_EDITOR_MAC
var filename = GetProjectRoot() + "/Build/" + DateTime.Now.ToString("yyyy-MM-dd-HH-mm") + "/" +
Application.productName + ".app";
BuildPipeline.BuildPlayer(GetEditorBuildSettingsScenes(), filename, BuildTarget.StandaloneOSX, BuildOptions.None);
DoBashCommand("open -n " + filename);
#endif
}
}
11 changes: 11 additions & 0 deletions Assets/Editor/BuildClass.cs.meta

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

9 changes: 9 additions & 0 deletions Assets/MessagePack.meta

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

75 changes: 75 additions & 0 deletions Assets/MessagePack/Attributes.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
using System;

namespace MessagePack
{
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct, AllowMultiple = false, Inherited = true)]
public class MessagePackObjectAttribute : Attribute
{
public bool KeyAsPropertyName { get; private set; }

public MessagePackObjectAttribute(bool keyAsPropertyName = false)
{
this.KeyAsPropertyName = keyAsPropertyName;
}
}

[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field, AllowMultiple = false, Inherited = true)]
public class KeyAttribute : Attribute
{
public int? IntKey { get; private set; }
public string StringKey { get; private set; }

public KeyAttribute(int x)
{
this.IntKey = x;
}

public KeyAttribute(string x)
{
this.StringKey = x;
}
}

[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field, AllowMultiple = false, Inherited = true)]
public class IgnoreMemberAttribute : Attribute
{
}

[AttributeUsage(AttributeTargets.Interface | AttributeTargets.Class, AllowMultiple = true, Inherited = false)]
public class UnionAttribute : Attribute
{
public int Key { get; private set; }
public Type SubType { get; private set; }

public UnionAttribute(int key, Type subType)
{
this.Key = key;
this.SubType = subType;
}
}

[AttributeUsage(AttributeTargets.Constructor, AllowMultiple = false, Inherited = true)]
public class SerializationConstructorAttribute : Attribute
{

}


[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Interface | AttributeTargets.Enum | AttributeTargets.Field | AttributeTargets.Property, AllowMultiple = false, Inherited = true)]
public class MessagePackFormatterAttribute : Attribute
{
public Type FormatterType { get; private set; }
public object[] Arguments { get; private set; }

public MessagePackFormatterAttribute(Type formatterType)
{
this.FormatterType = formatterType;
}

public MessagePackFormatterAttribute(Type formatterType, params object[] arguments)
{
this.FormatterType = formatterType;
this.Arguments = arguments;
}
}
}
12 changes: 12 additions & 0 deletions Assets/MessagePack/Attributes.cs.meta

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

118 changes: 118 additions & 0 deletions Assets/MessagePack/FloatBits.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
using System;
using System.Runtime.InteropServices;

namespace MessagePack
{
// safe accessor of Single/Double's underlying byte.
// This code is borrowed from MsgPack-Cli https://github.com/msgpack/msgpack-cli

[StructLayout(LayoutKind.Explicit)]
internal struct Float32Bits
{
[FieldOffset(0)]
public readonly float Value;

[FieldOffset(0)]
public readonly Byte Byte0;

[FieldOffset(1)]
public readonly Byte Byte1;

[FieldOffset(2)]
public readonly Byte Byte2;

[FieldOffset(3)]
public readonly Byte Byte3;

public Float32Bits(float value)
{
this = default(Float32Bits);
this.Value = value;
}

public Float32Bits(byte[] bigEndianBytes, int offset)
{
this = default(Float32Bits);

if (BitConverter.IsLittleEndian)
{
this.Byte0 = bigEndianBytes[offset + 3];
this.Byte1 = bigEndianBytes[offset + 2];
this.Byte2 = bigEndianBytes[offset + 1];
this.Byte3 = bigEndianBytes[offset];
}
else
{
this.Byte0 = bigEndianBytes[offset];
this.Byte1 = bigEndianBytes[offset + 1];
this.Byte2 = bigEndianBytes[offset + 2];
this.Byte3 = bigEndianBytes[offset + 3];
}
}
}

[StructLayout(LayoutKind.Explicit)]
internal struct Float64Bits
{
[FieldOffset(0)]
public readonly double Value;

[FieldOffset(0)]
public readonly Byte Byte0;

[FieldOffset(1)]
public readonly Byte Byte1;

[FieldOffset(2)]
public readonly Byte Byte2;

[FieldOffset(3)]
public readonly Byte Byte3;

[FieldOffset(4)]
public readonly Byte Byte4;

[FieldOffset(5)]
public readonly Byte Byte5;

[FieldOffset(6)]
public readonly Byte Byte6;

[FieldOffset(7)]
public readonly Byte Byte7;

public Float64Bits(double value)
{
this = default(Float64Bits);
this.Value = value;
}

public Float64Bits(byte[] bigEndianBytes, int offset)
{
this = default(Float64Bits);

if (BitConverter.IsLittleEndian)
{
this.Byte0 = bigEndianBytes[offset + 7];
this.Byte1 = bigEndianBytes[offset + 6];
this.Byte2 = bigEndianBytes[offset + 5];
this.Byte3 = bigEndianBytes[offset + 4];
this.Byte4 = bigEndianBytes[offset + 3];
this.Byte5 = bigEndianBytes[offset + 2];
this.Byte6 = bigEndianBytes[offset + 1];
this.Byte7 = bigEndianBytes[offset];
}
else
{
this.Byte0 = bigEndianBytes[offset];
this.Byte1 = bigEndianBytes[offset + 1];
this.Byte2 = bigEndianBytes[offset + 2];
this.Byte3 = bigEndianBytes[offset + 3];
this.Byte4 = bigEndianBytes[offset + 4];
this.Byte5 = bigEndianBytes[offset + 5];
this.Byte6 = bigEndianBytes[offset + 6];
this.Byte7 = bigEndianBytes[offset + 7];
}
}
}
}
12 changes: 12 additions & 0 deletions Assets/MessagePack/FloatBits.cs.meta

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

9 changes: 9 additions & 0 deletions Assets/MessagePack/Formatters.meta

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

Loading

0 comments on commit d276ff7

Please sign in to comment.