Got basic mesh generation working for a unity Visualizer, as well as a block editor for the same.

develop
Japa 2013-07-21 10:28:46 +05:30
parent 24d8a1f1c1
commit 0bd627a6f6
57 changed files with 1415 additions and 14 deletions

@ -0,0 +1,11 @@
[Oo]bj
[Bb]in
*.user
*.suo
*.[Cc]ache
*.bak
*.ncb
*.log
*.DS_Store
[Tt]humbs.db
Ankh.NoLoad

@ -0,0 +1,69 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>10.0.20506</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{AEF4C46B-71B7-6E0B-EF7E-154F411C7DF8}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace></RootNamespace>
<AssemblyName>Assembly-CSharp-Editor</AssemblyName>
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>Temp\bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE;UNITY_STANDALONE_WIN;ENABLE_MICROPHONE;ENABLE_IMAGEEFFECTS;ENABLE_WEBCAM;ENABLE_AUDIO_FMOD;UNITY_STANDALONE;ENABLE_NETWORK;ENABLE_MONO;ENABLE_PHYSICS;ENABLE_TERRAIN;ENABLE_CACHING;ENABLE_SUBSTANCE;ENABLE_GENERICS;ENABLE_CLOTH;ENABLE_MOVIES;ENABLE_AUDIO;ENABLE_WWW;ENABLE_SHADOWS;ENABLE_DUCK_TYPING;UNITY_4_1_5;UNITY_4_1;ENABLE_PROFILER;UNITY_EDITOR</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<NoWarn>0169</NoWarn>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>Temp\bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<NoWarn>0169</NoWarn>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.XML" />
<Reference Include="System.Core" />
<Reference Include="UnityEngine">
<HintPath>C:/Program Files (x86)/Unity/Editor/Data/Managed/UnityEngine.dll</HintPath>
</Reference>
<Reference Include="UnityEditor">
<HintPath>C:/Program Files (x86)/Unity/Editor/Data/Managed/UnityEditor.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="Assets\Editor\MapBlockEditor.cs" />
<None Include="Assets\VertexColor.shader" />
<Reference Include="protobuf-net">
<HintPath>Assets\protobuf-net.dll</HintPath>
</Reference>
<Reference Include="UnityEditor.Graphs">
<HintPath>C:\Program Files (x86)\Unity\Editor\Data\Managed\UnityEditor.Graphs.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="Assembly-CSharp-vs.csproj">
<Project>{AE3AFC6C-A022-3549-CF6C-7716EC410CE6}</Project> <Name>Assembly-CSharp-vs</Name> </ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>

@ -0,0 +1,69 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>10.0.20506</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{AEF4C46B-71B7-6E0B-EF7E-154F411C7DF8}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace></RootNamespace>
<AssemblyName>Assembly-CSharp-Editor</AssemblyName>
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>Temp\bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE;UNITY_STANDALONE_WIN;ENABLE_MICROPHONE;ENABLE_IMAGEEFFECTS;ENABLE_WEBCAM;ENABLE_AUDIO_FMOD;UNITY_STANDALONE;ENABLE_NETWORK;ENABLE_MONO;ENABLE_PHYSICS;ENABLE_TERRAIN;ENABLE_CACHING;ENABLE_SUBSTANCE;ENABLE_GENERICS;ENABLE_CLOTH;ENABLE_MOVIES;ENABLE_AUDIO;ENABLE_WWW;ENABLE_SHADOWS;ENABLE_DUCK_TYPING;UNITY_4_1_5;UNITY_4_1;ENABLE_PROFILER;UNITY_EDITOR</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<NoWarn>0169</NoWarn>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>Temp\bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<NoWarn>0169</NoWarn>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.XML" />
<Reference Include="System.Core" />
<Reference Include="UnityEngine">
<HintPath>C:/Program Files (x86)/Unity/Editor/Data/Managed/UnityEngine.dll</HintPath>
</Reference>
<Reference Include="UnityEditor">
<HintPath>C:/Program Files (x86)/Unity/Editor/Data/Managed/UnityEditor.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="Assets\Editor\MapBlockEditor.cs" />
<None Include="Assets\VertexColor.shader" />
<Reference Include="protobuf-net">
<HintPath>Assets\protobuf-net.dll</HintPath>
</Reference>
<Reference Include="UnityEditor.Graphs">
<HintPath>C:\Program Files (x86)\Unity\Editor\Data\Managed\UnityEditor.Graphs.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="Assembly-CSharp.csproj">
<Project>{AE3AFC6C-A022-3549-CF6C-7716EC410CE6}</Project> <Name>Assembly-CSharp</Name> </ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>

@ -0,0 +1,73 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>10.0.20506</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{AE3AFC6C-A022-3549-CF6C-7716EC410CE6}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace></RootNamespace>
<AssemblyName>Assembly-CSharp</AssemblyName>
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>Temp\bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE;UNITY_STANDALONE_WIN;ENABLE_MICROPHONE;ENABLE_IMAGEEFFECTS;ENABLE_WEBCAM;ENABLE_AUDIO_FMOD;UNITY_STANDALONE;ENABLE_NETWORK;ENABLE_MONO;ENABLE_PHYSICS;ENABLE_TERRAIN;ENABLE_CACHING;ENABLE_SUBSTANCE;ENABLE_GENERICS;ENABLE_CLOTH;ENABLE_MOVIES;ENABLE_AUDIO;ENABLE_WWW;ENABLE_SHADOWS;ENABLE_DUCK_TYPING;UNITY_4_1_5;UNITY_4_1;ENABLE_PROFILER;UNITY_EDITOR</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<NoWarn>0169</NoWarn>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>Temp\bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<NoWarn>0169</NoWarn>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.XML" />
<Reference Include="System.Core" />
<Reference Include="UnityEngine">
<HintPath>C:/Program Files (x86)/Unity/Editor/Data/Managed/UnityEngine.dll</HintPath>
</Reference>
<Reference Include="UnityEditor">
<HintPath>C:/Program Files (x86)/Unity/Editor/Data/Managed/UnityEditor.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="Assets\DFHack\isoworldremote.pb.cs" />
<Compile Include="Assets\GameWindow.cs" />
<Compile Include="Assets\HUDFPS.cs" />
<Compile Include="Assets\MapGen\GameMap.cs" />
<Compile Include="Assets\MapGen\MapBlock.cs" />
<Compile Include="Assets\RemoteClient\Basic.cs" />
<Compile Include="Assets\RemoteClient\BasicApi.cs" />
<Compile Include="Assets\RemoteClient\ColorText.cs" />
<Compile Include="Assets\RemoteClient\CoreProtocol.cs" />
<Compile Include="Assets\RemoteClient\RemoteClient.cs" />
<Compile Include="Assets\RemoteClient\Tools.cs" />
<Compile Include="Assets\TestScript.cs" />
<None Include="Assets\VertexColor.shader" />
<Reference Include="protobuf-net">
<HintPath>Assets\protobuf-net.dll</HintPath>
</Reference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>

@ -0,0 +1,73 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>10.0.20506</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{AE3AFC6C-A022-3549-CF6C-7716EC410CE6}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace></RootNamespace>
<AssemblyName>Assembly-CSharp</AssemblyName>
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>Temp\bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE;UNITY_STANDALONE_WIN;ENABLE_MICROPHONE;ENABLE_IMAGEEFFECTS;ENABLE_WEBCAM;ENABLE_AUDIO_FMOD;UNITY_STANDALONE;ENABLE_NETWORK;ENABLE_MONO;ENABLE_PHYSICS;ENABLE_TERRAIN;ENABLE_CACHING;ENABLE_SUBSTANCE;ENABLE_GENERICS;ENABLE_CLOTH;ENABLE_MOVIES;ENABLE_AUDIO;ENABLE_WWW;ENABLE_SHADOWS;ENABLE_DUCK_TYPING;UNITY_4_1_5;UNITY_4_1;ENABLE_PROFILER;UNITY_EDITOR</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<NoWarn>0169</NoWarn>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>Temp\bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<NoWarn>0169</NoWarn>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.XML" />
<Reference Include="System.Core" />
<Reference Include="UnityEngine">
<HintPath>C:/Program Files (x86)/Unity/Editor/Data/Managed/UnityEngine.dll</HintPath>
</Reference>
<Reference Include="UnityEditor">
<HintPath>C:/Program Files (x86)/Unity/Editor/Data/Managed/UnityEditor.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="Assets\DFHack\isoworldremote.pb.cs" />
<Compile Include="Assets\GameWindow.cs" />
<Compile Include="Assets\HUDFPS.cs" />
<Compile Include="Assets\MapGen\GameMap.cs" />
<Compile Include="Assets\MapGen\MapBlock.cs" />
<Compile Include="Assets\RemoteClient\Basic.cs" />
<Compile Include="Assets\RemoteClient\BasicApi.cs" />
<Compile Include="Assets\RemoteClient\ColorText.cs" />
<Compile Include="Assets\RemoteClient\CoreProtocol.cs" />
<Compile Include="Assets\RemoteClient\RemoteClient.cs" />
<Compile Include="Assets\RemoteClient\Tools.cs" />
<Compile Include="Assets\TestScript.cs" />
<None Include="Assets\VertexColor.shader" />
<Reference Include="protobuf-net">
<HintPath>Assets\protobuf-net.dll</HintPath>
</Reference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

@ -0,0 +1,312 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
// Generated from: isoworldremote.proto
namespace isoworldremote
{
[global::System.Serializable, global::ProtoBuf.ProtoContract(Name=@"EmbarkTileLayer")]
public partial class EmbarkTileLayer : global::ProtoBuf.IExtensible
{
public EmbarkTileLayer() {}
private readonly global::System.Collections.Generic.List<isoworldremote.BasicMaterial> _mat_type_table = new global::System.Collections.Generic.List<isoworldremote.BasicMaterial>();
[global::ProtoBuf.ProtoMember(4, Name=@"mat_type_table", DataFormat = global::ProtoBuf.DataFormat.TwosComplement, Options = global::ProtoBuf.MemberSerializationOptions.Packed)]
public global::System.Collections.Generic.List<isoworldremote.BasicMaterial> mat_type_table
{
get { return _mat_type_table; }
}
private readonly global::System.Collections.Generic.List<int> _mat_subtype_table = new global::System.Collections.Generic.List<int>();
[global::ProtoBuf.ProtoMember(5, Name=@"mat_subtype_table", DataFormat = global::ProtoBuf.DataFormat.TwosComplement, Options = global::ProtoBuf.MemberSerializationOptions.Packed)]
public global::System.Collections.Generic.List<int> mat_subtype_table
{
get { return _mat_subtype_table; }
}
private readonly global::System.Collections.Generic.List<isoworldremote.BasicShape> _tile_shape_table = new global::System.Collections.Generic.List<isoworldremote.BasicShape>();
[global::ProtoBuf.ProtoMember(6, Name=@"tile_shape_table", DataFormat = global::ProtoBuf.DataFormat.TwosComplement, Options = global::ProtoBuf.MemberSerializationOptions.Packed)]
public global::System.Collections.Generic.List<isoworldremote.BasicShape> tile_shape_table
{
get { return _tile_shape_table; }
}
private global::ProtoBuf.IExtension extensionObject;
global::ProtoBuf.IExtension global::ProtoBuf.IExtensible.GetExtensionObject(bool createIfMissing)
{ return global::ProtoBuf.Extensible.GetExtensionObject(ref extensionObject, createIfMissing); }
}
[global::System.Serializable, global::ProtoBuf.ProtoContract(Name=@"EmbarkTile")]
public partial class EmbarkTile : global::ProtoBuf.IExtensible
{
public EmbarkTile() {}
private int _world_x;
[global::ProtoBuf.ProtoMember(1, IsRequired = true, Name=@"world_x", DataFormat = global::ProtoBuf.DataFormat.TwosComplement)]
public int world_x
{
get { return _world_x; }
set { _world_x = value; }
}
private int _world_y;
[global::ProtoBuf.ProtoMember(2, IsRequired = true, Name=@"world_y", DataFormat = global::ProtoBuf.DataFormat.TwosComplement)]
public int world_y
{
get { return _world_y; }
set { _world_y = value; }
}
private int _world_z;
[global::ProtoBuf.ProtoMember(3, IsRequired = true, Name=@"world_z", DataFormat = global::ProtoBuf.DataFormat.ZigZag)]
public int world_z
{
get { return _world_z; }
set { _world_z = value; }
}
private readonly global::System.Collections.Generic.List<isoworldremote.EmbarkTileLayer> _tile_layer = new global::System.Collections.Generic.List<isoworldremote.EmbarkTileLayer>();
[global::ProtoBuf.ProtoMember(4, Name=@"tile_layer", DataFormat = global::ProtoBuf.DataFormat.Default)]
public global::System.Collections.Generic.List<isoworldremote.EmbarkTileLayer> tile_layer
{
get { return _tile_layer; }
}
private int _current_year = default(int);
[global::ProtoBuf.ProtoMember(5, IsRequired = false, Name=@"current_year", DataFormat = global::ProtoBuf.DataFormat.TwosComplement)]
[global::System.ComponentModel.DefaultValue(default(int))]
public int current_year
{
get { return _current_year; }
set { _current_year = value; }
}
private int _current_season = default(int);
[global::ProtoBuf.ProtoMember(6, IsRequired = false, Name=@"current_season", DataFormat = global::ProtoBuf.DataFormat.TwosComplement)]
[global::System.ComponentModel.DefaultValue(default(int))]
public int current_season
{
get { return _current_season; }
set { _current_season = value; }
}
private bool _is_valid = default(bool);
[global::ProtoBuf.ProtoMember(7, IsRequired = false, Name=@"is_valid", DataFormat = global::ProtoBuf.DataFormat.Default)]
[global::System.ComponentModel.DefaultValue(default(bool))]
public bool is_valid
{
get { return _is_valid; }
set { _is_valid = value; }
}
private global::ProtoBuf.IExtension extensionObject;
global::ProtoBuf.IExtension global::ProtoBuf.IExtensible.GetExtensionObject(bool createIfMissing)
{ return global::ProtoBuf.Extensible.GetExtensionObject(ref extensionObject, createIfMissing); }
}
[global::System.Serializable, global::ProtoBuf.ProtoContract(Name=@"TileRequest")]
public partial class TileRequest : global::ProtoBuf.IExtensible
{
public TileRequest() {}
private int _want_x = default(int);
[global::ProtoBuf.ProtoMember(1, IsRequired = false, Name=@"want_x", DataFormat = global::ProtoBuf.DataFormat.TwosComplement)]
[global::System.ComponentModel.DefaultValue(default(int))]
public int want_x
{
get { return _want_x; }
set { _want_x = value; }
}
private int _want_y = default(int);
[global::ProtoBuf.ProtoMember(2, IsRequired = false, Name=@"want_y", DataFormat = global::ProtoBuf.DataFormat.TwosComplement)]
[global::System.ComponentModel.DefaultValue(default(int))]
public int want_y
{
get { return _want_y; }
set { _want_y = value; }
}
private global::ProtoBuf.IExtension extensionObject;
global::ProtoBuf.IExtension global::ProtoBuf.IExtensible.GetExtensionObject(bool createIfMissing)
{ return global::ProtoBuf.Extensible.GetExtensionObject(ref extensionObject, createIfMissing); }
}
[global::System.Serializable, global::ProtoBuf.ProtoContract(Name=@"MapRequest")]
public partial class MapRequest : global::ProtoBuf.IExtensible
{
public MapRequest() {}
private string _save_folder = "";
[global::ProtoBuf.ProtoMember(1, IsRequired = false, Name=@"save_folder", DataFormat = global::ProtoBuf.DataFormat.Default)]
[global::System.ComponentModel.DefaultValue("")]
public string save_folder
{
get { return _save_folder; }
set { _save_folder = value; }
}
private global::ProtoBuf.IExtension extensionObject;
global::ProtoBuf.IExtension global::ProtoBuf.IExtensible.GetExtensionObject(bool createIfMissing)
{ return global::ProtoBuf.Extensible.GetExtensionObject(ref extensionObject, createIfMissing); }
}
[global::System.Serializable, global::ProtoBuf.ProtoContract(Name=@"MapReply")]
public partial class MapReply : global::ProtoBuf.IExtensible
{
public MapReply() {}
private bool _available;
[global::ProtoBuf.ProtoMember(1, IsRequired = true, Name=@"available", DataFormat = global::ProtoBuf.DataFormat.Default)]
public bool available
{
get { return _available; }
set { _available = value; }
}
private int _region_x = default(int);
[global::ProtoBuf.ProtoMember(2, IsRequired = false, Name=@"region_x", DataFormat = global::ProtoBuf.DataFormat.TwosComplement)]
[global::System.ComponentModel.DefaultValue(default(int))]
public int region_x
{
get { return _region_x; }
set { _region_x = value; }
}
private int _region_y = default(int);
[global::ProtoBuf.ProtoMember(3, IsRequired = false, Name=@"region_y", DataFormat = global::ProtoBuf.DataFormat.TwosComplement)]
[global::System.ComponentModel.DefaultValue(default(int))]
public int region_y
{
get { return _region_y; }
set { _region_y = value; }
}
private int _region_size_x = default(int);
[global::ProtoBuf.ProtoMember(4, IsRequired = false, Name=@"region_size_x", DataFormat = global::ProtoBuf.DataFormat.TwosComplement)]
[global::System.ComponentModel.DefaultValue(default(int))]
public int region_size_x
{
get { return _region_size_x; }
set { _region_size_x = value; }
}
private int _region_size_y = default(int);
[global::ProtoBuf.ProtoMember(5, IsRequired = false, Name=@"region_size_y", DataFormat = global::ProtoBuf.DataFormat.TwosComplement)]
[global::System.ComponentModel.DefaultValue(default(int))]
public int region_size_y
{
get { return _region_size_y; }
set { _region_size_y = value; }
}
private int _current_year = default(int);
[global::ProtoBuf.ProtoMember(6, IsRequired = false, Name=@"current_year", DataFormat = global::ProtoBuf.DataFormat.TwosComplement)]
[global::System.ComponentModel.DefaultValue(default(int))]
public int current_year
{
get { return _current_year; }
set { _current_year = value; }
}
private int _current_season = default(int);
[global::ProtoBuf.ProtoMember(7, IsRequired = false, Name=@"current_season", DataFormat = global::ProtoBuf.DataFormat.TwosComplement)]
[global::System.ComponentModel.DefaultValue(default(int))]
public int current_season
{
get { return _current_season; }
set { _current_season = value; }
}
private global::ProtoBuf.IExtension extensionObject;
global::ProtoBuf.IExtension global::ProtoBuf.IExtensible.GetExtensionObject(bool createIfMissing)
{ return global::ProtoBuf.Extensible.GetExtensionObject(ref extensionObject, createIfMissing); }
}
[global::System.Serializable, global::ProtoBuf.ProtoContract(Name=@"RawNames")]
public partial class RawNames : global::ProtoBuf.IExtensible
{
public RawNames() {}
private bool _available;
[global::ProtoBuf.ProtoMember(1, IsRequired = true, Name=@"available", DataFormat = global::ProtoBuf.DataFormat.Default)]
public bool available
{
get { return _available; }
set { _available = value; }
}
private readonly global::System.Collections.Generic.List<string> _inorganic = new global::System.Collections.Generic.List<string>();
[global::ProtoBuf.ProtoMember(2, Name=@"inorganic", DataFormat = global::ProtoBuf.DataFormat.Default)]
public global::System.Collections.Generic.List<string> inorganic
{
get { return _inorganic; }
}
private readonly global::System.Collections.Generic.List<string> _organic = new global::System.Collections.Generic.List<string>();
[global::ProtoBuf.ProtoMember(3, Name=@"organic", DataFormat = global::ProtoBuf.DataFormat.Default)]
public global::System.Collections.Generic.List<string> organic
{
get { return _organic; }
}
private global::ProtoBuf.IExtension extensionObject;
global::ProtoBuf.IExtension global::ProtoBuf.IExtensible.GetExtensionObject(bool createIfMissing)
{ return global::ProtoBuf.Extensible.GetExtensionObject(ref extensionObject, createIfMissing); }
}
[global::ProtoBuf.ProtoContract(Name=@"BasicMaterial")]
public enum BasicMaterial
{
[global::ProtoBuf.ProtoEnum(Name=@"AIR", Value=0)]
AIR = 0,
[global::ProtoBuf.ProtoEnum(Name=@"OTHER", Value=1)]
OTHER = 1,
[global::ProtoBuf.ProtoEnum(Name=@"INORGANIC", Value=2)]
INORGANIC = 2,
[global::ProtoBuf.ProtoEnum(Name=@"LIQUID", Value=3)]
LIQUID = 3,
[global::ProtoBuf.ProtoEnum(Name=@"PLANT", Value=4)]
PLANT = 4,
[global::ProtoBuf.ProtoEnum(Name=@"WOOD", Value=5)]
WOOD = 5
}
[global::ProtoBuf.ProtoContract(Name=@"LiquidType")]
public enum LiquidType
{
[global::ProtoBuf.ProtoEnum(Name=@"ICE", Value=0)]
ICE = 0,
[global::ProtoBuf.ProtoEnum(Name=@"WATER", Value=1)]
WATER = 1,
[global::ProtoBuf.ProtoEnum(Name=@"MAGMA", Value=2)]
MAGMA = 2
}
[global::ProtoBuf.ProtoContract(Name=@"BasicShape")]
public enum BasicShape
{
[global::ProtoBuf.ProtoEnum(Name=@"NONE", Value=0)]
NONE = 0,
[global::ProtoBuf.ProtoEnum(Name=@"OPEN", Value=1)]
OPEN = 1,
[global::ProtoBuf.ProtoEnum(Name=@"WALL", Value=3)]
WALL = 3,
[global::ProtoBuf.ProtoEnum(Name=@"FLOOR", Value=4)]
FLOOR = 4
}
}

@ -0,0 +1,104 @@
using isoworldremote;
using UnityEditor;
using UnityEngine;
using System;
[CustomEditor(typeof(MapBlock))]
[CanEditMultipleObjects]
public class MapBlockEditor : Editor
{
static Color32 selectedColor = Color.white;
static BasicShape selectedShape = BasicShape.WALL;
public override void OnInspectorGUI()
{
MapBlock[] targetBlocks = Array.ConvertAll(targets, element => (MapBlock)element);
if(targets.Length == 1)
EditorGUILayout.LabelField(targets.Length + " Map Block selected.");
else
EditorGUILayout.LabelField(targets.Length + " Map Blocks selected.");
selectedColor = EditorGUILayout.ColorField("Material Color", selectedColor);
selectedShape = (BasicShape)EditorGUILayout.EnumPopup("Terrain Shape ", selectedShape);
EditorGUILayout.BeginVertical();
DFHack.DFCoord2d tempCoord = new DFHack.DFCoord2d();
for (int i = 0; i < 16; i++)
{
EditorGUILayout.BeginHorizontal();
for (int j = 0; j < 16; j++)
{
tempCoord.x = j;
tempCoord.y = i;
Color currentColor = targetBlocks[0].GetColor(tempCoord);
for (int index = 1; index < targetBlocks.Length; index++)
{
if (currentColor != targetBlocks[index].GetColor(tempCoord))
{
currentColor = Color.white;
break;
}
}
currentColor.a = 1.0f;
GUI.color = currentColor;
string buttonIcon = "\u00A0";
BasicShape tile = targetBlocks[0].GetSingleTile(tempCoord);
for (int index = 1; index < targetBlocks.Length; index++)
{
if (tile != targetBlocks[index].GetSingleTile(tempCoord))
{
tile = BasicShape.NONE;
break;
}
}
switch (tile)
{
case BasicShape.WALL:
buttonIcon = "▓";
break;
case BasicShape.FLOOR:
buttonIcon = "+";
break;
case BasicShape.NONE:
buttonIcon = "?";
break;
case BasicShape.OPEN:
buttonIcon = "\u00A0";
break;
default:
buttonIcon = "?";
break;
}
if (GUILayout.Button(buttonIcon))
{
for (int index = 0; index < targetBlocks.Length; index++)
{
targetBlocks[index].SetSingleTile(tempCoord, selectedShape);
targetBlocks[index].SetColor(tempCoord, selectedColor);
targetBlocks[index].Regenerate();
EditorUtility.SetDirty(targetBlocks[index]);
}
}
}
EditorGUILayout.EndHorizontal();
}
EditorGUILayout.EndVertical();
GUI.color = Color.white;
if (GUILayout.Button("Fill"))
{
for (int index = 0; index < targetBlocks.Length; index++)
{
for (int i = 0; i < 16; i++)
for (int j = 0; j < 16; j++)
{
DFHack.DFCoord2d here = new DFHack.DFCoord2d(j, i);
targetBlocks[index].SetSingleTile(here, selectedShape);
targetBlocks[index].SetColor(here, selectedColor);
}
targetBlocks[index].Regenerate();
EditorUtility.SetDirty(targetBlocks[index]);
}
}
}
}

@ -0,0 +1,57 @@
using UnityEngine;
using System.Collections;
public class GameWindow : MonoBehaviour
{
public int viewPortWidth = 80;
public int viewPortHeight = 25;
public float verticalShift;
public float viewDistance = 5;
float n, f, r, l, t, b;
Matrix4x4 mat = new Matrix4x4();
// Use this for initialization
void Start()
{
}
// Update is called once per frame
void Update()
{
float screenAspect = (float)Screen.width / (float)Screen.height;
float viewportAspect = (float)viewPortWidth / (float)viewPortHeight;
float fraction = screenAspect / viewportAspect;
float height = (viewPortHeight / 2.0f) / Mathf.Sin((camera.fov / 2) * Mathf.Deg2Rad);
transform.localPosition = new Vector3(0, height, -verticalShift);
camera.nearClipPlane = height - 1.0001f;
camera.farClipPlane = height + viewDistance;
RenderSettings.fogStartDistance = camera.nearClipPlane;
RenderSettings.fogEndDistance = camera.farClipPlane;
if (fraction > 1.0f) //If the screen is wider than the DF Viewport
{
camera.rect = new Rect(0.5f - ((1.0f / fraction) / 2.0f), 0.0f, 1.0f / fraction, 1.0f);
}
else //If the DF Viewport is wider.
{
camera.rect = new Rect(0.0f, 0.5f - (fraction / 2.0f), 1.0f, fraction);
}
//make a custom camera matrix, rather than use the inbuilt one.
n = camera.nearClipPlane;
f = camera.farClipPlane;
r = viewPortWidth / 2.0f;
l = -viewPortWidth / 2.0f;
t = verticalShift + (viewPortHeight / 2.0f);
b = verticalShift - (viewPortHeight / 2.0f);
mat[0, 0] = 2 * n / (r - l); mat[1, 0] = 0; mat[2, 0] = 0; mat[3, 0] = 0;
mat[0, 1] = 0; mat[1, 1] = 2 * n / (t - b); mat[2, 1] = 0; mat[3, 1] = 0;
mat[0, 2] = (r + l) / (r - l); mat[1, 2] = (t + b) / (t - b); mat[2, 2] = -(f + n) / (f - n); mat[3, 2] = -1;
mat[0, 3] = 0; mat[1, 3] = 0; mat[2, 3] = -2 * f * n / (f - n); ; mat[3, 3] = 0;
camera.projectionMatrix = mat;
}
}

@ -0,0 +1,79 @@
using UnityEngine;
using System.Collections;
[AddComponentMenu("Utilities/HUDFPS")]
public class HUDFPS : MonoBehaviour
{
// Attach this to any object to make a frames/second indicator.
//
// It calculates frames/second over each updateInterval,
// so the display does not keep changing wildly.
//
// It is also fairly accurate at very low FPS counts (<10).
// We do this not by simply counting frames per interval, but
// by accumulating FPS for each frame. This way we end up with
// corstartRect overall FPS even if the interval renders something like
// 5.5 frames.
public Rect startRect = new Rect(10, 10, 75, 50); // The rect the window is initially displayed at.
public bool updateColor = true; // Do you want the color to change if the FPS gets low
public bool allowDrag = true; // Do you want to allow the dragging of the FPS window
public float frequency = 0.5F; // The update frequency of the fps
public int nbDecimal = 1; // How many decimal do you want to display
private float accum = 0f; // FPS accumulated over the interval
private int frames = 0; // Frames drawn over the interval
private Color color = Color.white; // The color of the GUI, depending of the FPS ( R < 10, Y < 30, G >= 30 )
private string sFPS = ""; // The fps formatted into a string.
private GUIStyle style; // The style the text will be displayed at, based en defaultSkin.label.
void Start()
{
StartCoroutine(FPS());
}
void Update()
{
accum += Time.timeScale / Time.deltaTime;
++frames;
}
IEnumerator FPS()
{
// Infinite loop executed every "frenquency" secondes.
while (true)
{
// Update the FPS
float fps = accum / frames;
sFPS = fps.ToString("f" + Mathf.Clamp(nbDecimal, 0, 10));
//Update the color
color = (fps >= 30) ? Color.green : ((fps > 10) ? Color.red : Color.yellow);
accum = 0.0F;
frames = 0;
yield return new WaitForSeconds(frequency);
}
}
void OnGUI()
{
// Copy the default label skin, change the color and the alignement
if (style == null)
{
style = new GUIStyle(GUI.skin.label);
style.normal.textColor = Color.white;
style.alignment = TextAnchor.MiddleCenter;
}
GUI.color = updateColor ? color : Color.white;
startRect = GUI.Window(0, startRect, DoMyWindow, "");
}
void DoMyWindow(int windowID)
{
GUI.Label(new Rect(0, 0, startRect.width, startRect.height), sFPS + " FPS", style);
if (allowDrag) GUI.DragWindow(new Rect(0, 0, Screen.width, Screen.height));
}
}

@ -0,0 +1,15 @@
using UnityEngine;
using System.Collections;
public class GameMap : MonoBehaviour {
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
}
}

@ -0,0 +1,262 @@
using DFHack;
using System.Collections.Generic;
using UnityEngine;
using isoworldremote;
public class MapBlock : MonoBehaviour
{
public static float floorHeight = 0.1f;
DFCoord coordinates;
GameMap parent;
[SerializeField]
BasicShape[] terrain = new BasicShape[256];
[SerializeField]
Color32[] colors = new Color32[256];
List<Vector3> finalVertices = new List<Vector3>();
List<int> finalFaces = new List<int>();
List<Color32> finalVertexColors = new List<Color32>();
List<Vector2> finalUVs = new List<Vector2>();
public enum Openness
{
air,
mixed,
stone
}
Openness openness;
public void SetOpenness()
{
int air = 0;
int solid = 0;
for (int x = 0; x < 16; x++)
for (int y = 0; y < 16; y++)
{
if (terrain[y * 16 + x] == BasicShape.OPEN || terrain[y * 16 + x] == BasicShape.NONE)
air++;
else if (terrain[y * 16 + x] == BasicShape.WALL)
solid++;
}
if (air == 256)
openness = Openness.air;
else if (solid == 256)
openness = Openness.stone;
else openness = Openness.mixed;
}
public Openness GetOpenness()
{
return openness;
}
public Color32 GetColor(DFCoord2d position)
{
return colors[position.x + position.y * 16];
}
public void SetColor(DFCoord2d position, Color32 input)
{
colors[position.x + position.y * 16] = input;
}
public void SetSingleTile(DFCoord2d position, BasicShape tile)
{
terrain[position.x + position.y * 16] = tile;
SetOpenness();
}
public BasicShape GetSingleTile(DFCoord2d position)
{
if (position.x >= 0 && position.x < 16 && position.y >= 0 && position.y < 16)
return terrain[position.x + position.y * 16];
else
return BasicShape.NONE;
}
public void Regenerate()
{
finalVertices.Clear();
finalFaces.Clear();
finalVertexColors.Clear();
finalUVs.Clear();
if (openness == Openness.air)
{
}
else
{
for (int i = 0; i < 16; i++)
for (int j = 0; j < 16; j++)
{
DFCoord2d here = new DFCoord2d(i, j);
switch (GetSingleTile(here))
{
case BasicShape.WALL:
AddTopFace(here, 1.0f);
break;
case BasicShape.FLOOR:
AddTopFace(here, floorHeight);
break;
}
AddSideFace(here, FaceDirection.North);
AddSideFace(here, FaceDirection.South);
AddSideFace(here, FaceDirection.East);
AddSideFace(here, FaceDirection.West);
}
}
MeshFilter mf = GetComponent<MeshFilter>();
Mesh mesh = new Mesh();
mf.mesh = mesh;
mesh.vertices = finalVertices.ToArray();
mesh.uv = finalUVs.ToArray();
mesh.colors32 = finalVertexColors.ToArray();
mesh.triangles = finalFaces.ToArray();
mesh.RecalculateBounds();
mesh.RecalculateNormals();
}
enum FaceDirection
{
Up,
Down,
North,
South,
East,
West
}
BasicShape GetRelativeTile(DFCoord2d position, FaceDirection direction)
{
DFCoord2d relativePosition = new DFCoord2d(position.x, position.y);
switch (direction)
{
case FaceDirection.North:
relativePosition.y--;
break;
case FaceDirection.South:
relativePosition.y++;
break;
case FaceDirection.East:
relativePosition.x++;
break;
case FaceDirection.West:
relativePosition.x--;
break;
}
return GetSingleTile(relativePosition);
}
void AddSideFace(DFCoord2d position, FaceDirection direction)
{
float currentFloorHeight = -0.5f;
float adjacentFloorHeight = -0.5f;
switch (GetSingleTile(position))
{
case BasicShape.WALL:
currentFloorHeight = 0.5f;
break;
case BasicShape.FLOOR:
currentFloorHeight = floorHeight - 0.5f;
break;
default:
break;
}
switch (GetRelativeTile(position, direction))
{
case BasicShape.WALL:
adjacentFloorHeight = 0.5f;
break;
case BasicShape.FLOOR:
adjacentFloorHeight = floorHeight - 0.5f;
break;
default:
break;
}
if (currentFloorHeight <= adjacentFloorHeight)
return;
int startindex = finalVertices.Count;
int uvPos = 0;
switch (direction)
{
case FaceDirection.North:
finalVertices.Add(new Vector3(position.x + 0.5f, currentFloorHeight, -(position.y - 0.5f)));
finalVertices.Add(new Vector3(position.x - 0.5f, currentFloorHeight, -(position.y - 0.5f)));
finalVertices.Add(new Vector3(position.x + 0.5f, adjacentFloorHeight, -(position.y - 0.5f)));
finalVertices.Add(new Vector3(position.x - 0.5f, adjacentFloorHeight, -(position.y - 0.5f)));
uvPos = position.x;
break;
case FaceDirection.South:
finalVertices.Add(new Vector3(position.x - 0.5f, currentFloorHeight, -(position.y + 0.5f)));
finalVertices.Add(new Vector3(position.x + 0.5f, currentFloorHeight, -(position.y + 0.5f)));
finalVertices.Add(new Vector3(position.x - 0.5f, adjacentFloorHeight, -(position.y + 0.5f)));
finalVertices.Add(new Vector3(position.x + 0.5f, adjacentFloorHeight, -(position.y + 0.5f)));
uvPos = 16 - position.x;
break;
case FaceDirection.East:
finalVertices.Add(new Vector3(position.x + 0.5f, currentFloorHeight, -(position.y + 0.5f)));
finalVertices.Add(new Vector3(position.x + 0.5f, currentFloorHeight, -(position.y - 0.5f)));
finalVertices.Add(new Vector3(position.x + 0.5f, adjacentFloorHeight, -(position.y + 0.5f)));
finalVertices.Add(new Vector3(position.x + 0.5f, adjacentFloorHeight, -(position.y - 0.5f)));
uvPos = position.y;
break;
case FaceDirection.West:
finalVertices.Add(new Vector3(position.x - 0.5f, currentFloorHeight, -(position.y - 0.5f)));
finalVertices.Add(new Vector3(position.x - 0.5f, currentFloorHeight, -(position.y + 0.5f)));
finalVertices.Add(new Vector3(position.x - 0.5f, adjacentFloorHeight, -(position.y - 0.5f)));
finalVertices.Add(new Vector3(position.x - 0.5f, adjacentFloorHeight, -(position.y + 0.5f)));
uvPos = 16 - position.y;
break;
default:
break;
}
finalUVs.Add(new Vector2(-(float)(uvPos + 1) / 16.0f, -(float)(0) / 16.0f));
finalUVs.Add(new Vector2(-(float)(uvPos) / 16.0f, -(float)(0) / 16.0f));
finalUVs.Add(new Vector2(-(float)(uvPos + 1) / 16.0f, -(float)(0 + 1) / 16.0f));
finalUVs.Add(new Vector2(-(float)(uvPos) / 16.0f, -(float)(0 + 1) / 16.0f));
finalVertexColors.Add(GetColor(position));
finalVertexColors.Add(GetColor(position));
finalVertexColors.Add(GetColor(position));
finalVertexColors.Add(GetColor(position));
finalFaces.Add(startindex);
finalFaces.Add(startindex + 1);
finalFaces.Add(startindex + 2);
finalFaces.Add(startindex + 1);
finalFaces.Add(startindex + 3);
finalFaces.Add(startindex + 2);
}
void AddTopFace(DFCoord2d position, float height)
{
height -= 0.5f;
//Todo: Weld vertices that should be welded
//On second though, not with vertex colors there.
int startindex = finalVertices.Count;
finalVertices.Add(new Vector3(position.x - 0.5f, height, -(position.y - 0.5f)));
finalVertices.Add(new Vector3(position.x + 0.5f, height, -(position.y - 0.5f)));
finalVertices.Add(new Vector3(position.x - 0.5f, height, -(position.y + 0.5f)));
finalVertices.Add(new Vector3(position.x + 0.5f, height, -(position.y + 0.5f)));
finalUVs.Add(new Vector2((float)(position.x) / 16.0f, -(float)(position.y) / 16.0f));
finalUVs.Add(new Vector2((float)(position.x + 1) / 16.0f, -(float)(position.y) / 16.0f));
finalUVs.Add(new Vector2((float)(position.x) / 16.0f, -(float)(position.y + 1) / 16.0f));
finalUVs.Add(new Vector2((float)(position.x + 1) / 16.0f, -(float)(position.y + 1) / 16.0f));
finalVertexColors.Add(GetColor(position));
finalVertexColors.Add(GetColor(position));
finalVertexColors.Add(GetColor(position));
finalVertexColors.Add(GetColor(position));
finalFaces.Add(startindex);
finalFaces.Add(startindex + 1);
finalFaces.Add(startindex + 2);
finalFaces.Add(startindex + 1);
finalFaces.Add(startindex + 3);
finalFaces.Add(startindex + 2);
}
}

@ -58,8 +58,8 @@ namespace DFHack
class RPCHandshakeHeader
{
public string magic;
public int version;
//public string magic;
//public int version;
public static string REQUEST_MAGIC = "DFHack?\n";
public static string RESPONSE_MAGIC = "DFHack!\n";
@ -93,6 +93,136 @@ namespace DFHack
}
}
// simple function to store
struct DFCoord
{
public int x, y, z;
//convert
UnityEngine.Vector3 ToVector3()
{
return new UnityEngine.Vector3(x + 0.5f, z + 0.5f, -y - 0.5f);
}
static DFCoord FromVector3(UnityEngine.Vector3 input)
{
DFCoord output = new DFCoord((int)input.x, (int)(-input.z), (int)input.y);
return output;
}
DFCoord(int inx, int iny, int inz)
{
x = inx;
y = iny;
z = inz;
}
public bool isValid()
{
return x != -30000;
}
public void clear()
{
x = y = z = -30000;
}
public static bool operator <(DFCoord a, DFCoord b)
{
if (a.x != b.x) return (a.x < b.x);
if (a.y != b.y) return (a.y < b.y);
return a.z < b.z;
}
public static bool operator >(DFCoord a, DFCoord b)
{
if (a.x != b.x) return (a.x > b.x);
if (a.y != b.y) return (a.y > b.y);
return a.z > b.z;
}
public static DFCoord operator +(DFCoord a, DFCoord b)
{
return new DFCoord(a.x + b.x, a.y + b.y, a.z + b.z);
}
public static DFCoord operator -(DFCoord a, DFCoord b)
{
return new DFCoord(a.x - b.x, a.y - b.y, a.z - b.z);
}
public static DFCoord operator /(DFCoord a, int number)
{
return new DFCoord((a.x < 0 ? a.x - number : a.x) / number, (a.y < 0 ? a.y - number : a.y) / number, a.z);
}
public static DFCoord operator *(DFCoord a, int number)
{
return new DFCoord(a.x * number, a.y * number, a.z);
}
public static DFCoord operator %(DFCoord a, int number)
{
return new DFCoord((a.x + number) % number, (a.y + number) % number, a.z);
}
public static DFCoord operator -(DFCoord a, int number)
{
return new DFCoord(a.x, a.y, a.z - number);
}
public static DFCoord operator +(DFCoord a, int number)
{
return new DFCoord(a.x, a.y, a.z + number);
}
}
public struct DFCoord2d
{
public int x;
public int y;
public DFCoord2d(int _x, int _y)
{
x = _x;
y = _y;
}
public bool isValid()
{
return x != -30000;
}
public void clear()
{
x = y = -30000;
}
public static bool operator <(DFCoord2d a, DFCoord2d b)
{
if (a.x != b.x) return (a.x < b.x);
return a.y < b.y;
}
public static bool operator >(DFCoord2d a, DFCoord2d b)
{
if (a.x != b.x) return (a.x > b.x);
return a.y > b.y;
}
public static DFCoord2d operator +(DFCoord2d a, DFCoord2d b)
{
return new DFCoord2d(a.x + b.x, a.y + b.y);
}
public static DFCoord2d operator -(DFCoord2d a, DFCoord2d b)
{
return new DFCoord2d(a.x - b.x, a.y - b.y);
}
public static DFCoord2d operator /(DFCoord2d a, int number)
{
return new DFCoord2d((a.x < 0 ? a.x - number : a.x) / number, (a.y < 0 ? a.y - number : a.y) / number);
}
public static DFCoord2d operator *(DFCoord2d a, int number)
{
return new DFCoord2d(a.x * number, a.y * number);
}
public static DFCoord2d operator %(DFCoord2d a, int number)
{
return new DFCoord2d((a.x + number) % number, (a.y + number) % number);
}
public static DFCoord2d operator &(DFCoord2d a, int number)
{
return new DFCoord2d(a.x & number, a.y & number);
}
}
/* Protocol description:
*
* 1. Handshake
@ -323,7 +453,7 @@ namespace DFHack
this.proto, this.name, header.size);
return command_result.CR_LINK_FAILURE;
}
byte[] buf = new byte[header.size];
if (!RemoteClient.readFullBuffer(p_client.socket, buf, header.size))
@ -361,7 +491,6 @@ namespace DFHack
break;
}
}
return command_result.CR_OK;
}
@ -671,7 +800,6 @@ namespace DFHack
if (!suspend_ready)
{
suspend_ready = true;
suspend_call.bind(this, "CoreSuspend");
resume_call.bind(this, "CoreResume");
}
@ -701,7 +829,8 @@ namespace DFHack
RemoteFunction<dfproto.CoreRunCommandRequest> runcmd_call;
bool suspend_ready;
RemoteFunction<EmptyMessage, IntMessage> suspend_call, resume_call;
RemoteFunction<EmptyMessage, IntMessage> suspend_call = new RemoteFunction<EmptyMessage,IntMessage>();
RemoteFunction<EmptyMessage, IntMessage> resume_call = new RemoteFunction<EmptyMessage,IntMessage>();
}
class RemoteSuspender

@ -468,7 +468,7 @@ namespace AT.MIN
#endregion
#region s - string
case 's': // string
string t = "{0" + ( fieldLength != int.MinValue ? "," + ( flagLeft2Right ? "-" : String.Empty ) + fieldLength.ToString() : String.Empty ) + ":s}";
//string t = "{0" + ( fieldLength != int.MinValue ? "," + ( flagLeft2Right ? "-" : String.Empty ) + fieldLength.ToString() : String.Empty ) + ":s}";
w = o.ToString();
if ( fieldPrecision >= 0 )
w = w.Substring( 0, fieldPrecision );

@ -6,12 +6,12 @@ public class TestScript : MonoBehaviour {
RemoteClient remoteClient = new RemoteClient();
// Use this for initialization
void Start () {
if (!remoteClient.connect())
Debug.LogError("Could not connect");
else
{
remoteClient.run_command("ls", new List<string>());
}
if (!remoteClient.connect())
Debug.LogError("Could not connect");
else
{
remoteClient.run_command("ls", new List<string>());
}
}
// Update is called once per frame

Binary file not shown.

After

Width:  |  Height:  |  Size: 292 KiB

@ -0,0 +1,33 @@
// Upgrade NOTE: replaced 'SeperateSpecular' with 'SeparateSpecular'
Shader " Vertex Colored" {
Properties {
_Color ("Main Color", Color) = (1,1,1,1)
_SpecColor ("Spec Color", Color) = (1,1,1,1)
_Emission ("Emmisive Color", Color) = (0,0,0,0)
_Shininess ("Shininess", Range (0.01, 1)) = 0.7
_MainTex ("Base (RGB)", 2D) = "white" {}
}
SubShader {
Pass {
Material {
Shininess [_Shininess]
Specular [_SpecColor]
Emission [_Emission]
}
ColorMaterial AmbientAndDiffuse
Lighting On
SeparateSpecular On
SetTexture [_MainTex] {
Combine texture * primary, texture * primary
}
SetTexture [_MainTex] {
constantColor [_Color]
Combine previous * constant DOUBLE, previous * constant
}
}
}
Fallback " VertexLit", 1
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

@ -0,0 +1,45 @@
Microsoft Visual Studio Solution File, Format Version 11.00
# Visual Studio 2008
Project("{277888DF-B633-98F9-AF58-18CFF25BE876}") = "simple_sample", "Assembly-CSharp-vs.csproj", "{AE3AFC6C-A022-3549-CF6C-7716EC410CE6}"
EndProject
Project("{277888DF-B633-98F9-AF58-18CFF25BE876}") = "simple_sample", "Assembly-CSharp-Editor-vs.csproj", "{AEF4C46B-71B7-6E0B-EF7E-154F411C7DF8}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{AE3AFC6C-A022-3549-CF6C-7716EC410CE6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{AE3AFC6C-A022-3549-CF6C-7716EC410CE6}.Debug|Any CPU.Build.0 = Debug|Any CPU
{AE3AFC6C-A022-3549-CF6C-7716EC410CE6}.Release|Any CPU.ActiveCfg = Release|Any CPU
{AE3AFC6C-A022-3549-CF6C-7716EC410CE6}.Release|Any CPU.Build.0 = Release|Any CPU
{AEF4C46B-71B7-6E0B-EF7E-154F411C7DF8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{AEF4C46B-71B7-6E0B-EF7E-154F411C7DF8}.Debug|Any CPU.Build.0 = Debug|Any CPU
{AEF4C46B-71B7-6E0B-EF7E-154F411C7DF8}.Release|Any CPU.ActiveCfg = Release|Any CPU
{AEF4C46B-71B7-6E0B-EF7E-154F411C7DF8}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(MonoDevelopProperties) = preSolution
StartupItem = Assembly-CSharp.csproj
Policies = $0
$0.TextStylePolicy = $1
$1.inheritsSet = null
$1.scope = text/x-csharp
$0.CSharpFormattingPolicy = $2
$2.inheritsSet = Mono
$2.inheritsScope = text/x-csharp
$2.scope = text/x-csharp
$0.TextStylePolicy = $3
$3.FileWidth = 120
$3.TabWidth = 4
$3.EolMarker = Unix
$3.inheritsSet = Mono
$3.inheritsScope = text/plain
$3.scope = text/plain
EndGlobalSection
EndGlobal

@ -0,0 +1,45 @@
Microsoft Visual Studio Solution File, Format Version 11.00
# Visual Studio 2008
Project("{277888DF-B633-98F9-AF58-18CFF25BE876}") = "simple_sample", "Assembly-CSharp.csproj", "{AE3AFC6C-A022-3549-CF6C-7716EC410CE6}"
EndProject
Project("{277888DF-B633-98F9-AF58-18CFF25BE876}") = "simple_sample", "Assembly-CSharp-Editor.csproj", "{AEF4C46B-71B7-6E0B-EF7E-154F411C7DF8}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{AE3AFC6C-A022-3549-CF6C-7716EC410CE6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{AE3AFC6C-A022-3549-CF6C-7716EC410CE6}.Debug|Any CPU.Build.0 = Debug|Any CPU
{AE3AFC6C-A022-3549-CF6C-7716EC410CE6}.Release|Any CPU.ActiveCfg = Release|Any CPU
{AE3AFC6C-A022-3549-CF6C-7716EC410CE6}.Release|Any CPU.Build.0 = Release|Any CPU
{AEF4C46B-71B7-6E0B-EF7E-154F411C7DF8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{AEF4C46B-71B7-6E0B-EF7E-154F411C7DF8}.Debug|Any CPU.Build.0 = Debug|Any CPU
{AEF4C46B-71B7-6E0B-EF7E-154F411C7DF8}.Release|Any CPU.ActiveCfg = Release|Any CPU
{AEF4C46B-71B7-6E0B-EF7E-154F411C7DF8}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(MonoDevelopProperties) = preSolution
StartupItem = Assembly-CSharp.csproj
Policies = $0
$0.TextStylePolicy = $1
$1.inheritsSet = null
$1.scope = text/x-csharp
$0.CSharpFormattingPolicy = $2
$2.inheritsSet = Mono
$2.inheritsScope = text/x-csharp
$2.scope = text/x-csharp
$0.TextStylePolicy = $3
$3.FileWidth = 120
$3.TabWidth = 4
$3.EolMarker = Unix
$3.inheritsSet = Mono
$3.inheritsScope = text/plain
$3.scope = text/plain
EndGlobalSection
EndGlobal

@ -0,0 +1,8 @@
<Properties>
<MonoDevelop.Ide.Workspace ActiveConfiguration="Debug" />
<MonoDevelop.Ide.Workbench />
<MonoDevelop.Ide.DebuggingService.Breakpoints>
<BreakpointStore />
</MonoDevelop.Ide.DebuggingService.Breakpoints>
<MonoDevelop.Ide.DebuggingService.PinnedWatches />
</Properties>

@ -18,9 +18,26 @@ enum LiquidType {
MAGMA = 2;
}
enum BasicShape {
NONE = 0;
OPEN = 1;
WALL = 3;
FLOOR = 4;
RAMP_UP = 5;
RAMP_DOWN = 6;
}
message ColorDefinition {
required int32 red = 1;
required int32 green = 2;
required int32 blue = 3;
}
message EmbarkTileLayer {
repeated BasicMaterial mat_type_table = 4 [packed=true];
repeated int32 mat_subtype_table = 5 [packed=true];
repeated BasicShape tile_shape_table = 6 [packed=true];
repeated ColorDefinition tile_color_table = 7 [packed=true];
}
message EmbarkTile {

@ -1 +1 @@
Subproject commit dbcc80ff364978e9e5fec13e425b0af84c403f10
Subproject commit 25eae7ef6f19a24b7fc7e0d72ed45cbef7ebe092