Skip to content

Commit

Permalink
Added net40-ish Observeables
Browse files Browse the repository at this point in the history
  • Loading branch information
HelloKitty committed Jul 27, 2016
1 parent 25ca59d commit 1c2e93e
Show file tree
Hide file tree
Showing 8 changed files with 190 additions and 0 deletions.
7 changes: 7 additions & 0 deletions PokemonGoDesktop.Unity.sln
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PokemonGoDesktop.Unity.Clie
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PokemonGoDesktop.Unity.Exceptions", "src\PokemonGoDesktop.Unity.Exceptions\PokemonGoDesktop.Unity.Exceptions.csproj", "{8CD98B0B-23F6-4686-8743-A2FAA784D270}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PokemonGoDesktop.Unity.UI", "src\PokemonGoDesktop.Unity.UI\PokemonGoDesktop.Unity.UI.csproj", "{4386B5C3-76B8-456E-98A7-E62C3837C213}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -55,6 +57,10 @@ Global
{8CD98B0B-23F6-4686-8743-A2FAA784D270}.Debug|Any CPU.Build.0 = Debug|Any CPU
{8CD98B0B-23F6-4686-8743-A2FAA784D270}.Release|Any CPU.ActiveCfg = Release|Any CPU
{8CD98B0B-23F6-4686-8743-A2FAA784D270}.Release|Any CPU.Build.0 = Release|Any CPU
{4386B5C3-76B8-456E-98A7-E62C3837C213}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{4386B5C3-76B8-456E-98A7-E62C3837C213}.Debug|Any CPU.Build.0 = Debug|Any CPU
{4386B5C3-76B8-456E-98A7-E62C3837C213}.Release|Any CPU.ActiveCfg = Release|Any CPU
{4386B5C3-76B8-456E-98A7-E62C3837C213}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand All @@ -67,5 +73,6 @@ Global
{29ED6ECF-BB2A-4A14-8E33-E1BF5FF63976} = {DD592D6C-44E7-4348-A2C1-C5367DE42B78}
{3490CB88-B181-492C-9029-D71FB7A26C35} = {DD592D6C-44E7-4348-A2C1-C5367DE42B78}
{8CD98B0B-23F6-4686-8743-A2FAA784D270} = {DD592D6C-44E7-4348-A2C1-C5367DE42B78}
{4386B5C3-76B8-456E-98A7-E62C3837C213} = {DD592D6C-44E7-4348-A2C1-C5367DE42B78}
EndGlobalSection
EndGlobal
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,8 @@
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Serialization\RequestBuilderService.cs" />
<Compile Include="Serialization\ResponseEnvelopeParserService.cs" />
<Compile Include="Services\Observe\IObservable.cs" />
<Compile Include="Services\Observe\IObserver.cs" />
<Compile Include="Session\UnityPokemonGoClientSession.cs" />
</ItemGroup>
<ItemGroup>
Expand All @@ -109,6 +111,7 @@
<Name>PokemonGoDesktop.Unity.Exceptions</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
<PostBuildEvent>xcopy /Q /Y /R "$(TargetDir)*.dll" "$(SolutionDir)Build"
Expand Down
17 changes: 17 additions & 0 deletions src/PokemonGoDesktop.Unity.Common/Services/Observe/IObservable.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace PokemonGoDesktop.Unity.Common
{
//based on net40 IObseravble<T> https://msdn.microsoft.com/en-us/library/dd990377(v=vs.110).aspx
public interface IObservable<out T>
{
/// <summary>
/// Subscribers an observer for values of <typeparamref name="T"/>.
/// </summary>
/// <param name="observer">Observer to recieve values.</param>
void Subscribe(IObserver<T> observer);
}
}
22 changes: 22 additions & 0 deletions src/PokemonGoDesktop.Unity.Common/Services/Observe/IObserver.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace PokemonGoDesktop.Unity.Common
{
//based on net40 IObserver<T> https://msdn.microsoft.com/en-us/library/dd783449(v=vs.110).aspx
/// <summary>
/// Class contract for being targted by <see cref="IObservable{T}"/>.
/// </summary>
/// <typeparam name="T">Type to observe.</typeparam>
public interface IObserver<in T>
{
/// <summary>
/// Called when the <see cref="IObservable{T}"/> publishes
/// a value.
/// </summary>
/// <param name="value">Value that was published.</param>
void OnObserved(T value);
}
}
21 changes: 21 additions & 0 deletions src/PokemonGoDesktop.Unity.UI/Game/Profile/PlayerDataUIObserver.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
using PokemonGoDesktop.API.Proto;
using PokemonGoDesktop.Unity.Common;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace PokemonGoDesktop.Unity.UI
{


public class PlayerDataUIObserver : IObserver<PlayerData>
{


public void OnObserved(PlayerData value)
{
throw new NotImplementedException();
}
}
}
79 changes: 79 additions & 0 deletions src/PokemonGoDesktop.Unity.UI/PokemonGoDesktop.Unity.UI.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{4386B5C3-76B8-456E-98A7-E62C3837C213}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>PokemonGoDesktop.Unity.UI</RootNamespace>
<AssemblyName>PokemonGoDesktop.Unity.UI</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>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="Easyception, Version=2.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\packages\Easyception.2.0.0\lib\net35\Easyception.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Google.Protobuf, Version=3.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\packages\PokemonGoDesktop.API.Proto.1.0.19\lib\net35\Google.Protobuf.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="PokemonGoDesktop.API.Proto, Version=1.0.19.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\packages\PokemonGoDesktop.API.Proto.1.0.19\lib\net35\PokemonGoDesktop.API.Proto.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
<Reference Include="UnityEngine">
<HintPath>..\..\lib\Unity3D\UnityEngine.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="Game\Profile\PlayerDataUIObserver.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<Folder Include="Services\" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\PokemonGoDesktop.Unity.Common\PokemonGoDesktop.Unity.Common.csproj">
<Project>{CC0CFF4C-D811-45FD-9215-92626A43C4BF}</Project>
<Name>PokemonGoDesktop.Unity.Common</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
</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>
36 changes: 36 additions & 0 deletions src/PokemonGoDesktop.Unity.UI/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;

// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("PokemonGoDesktop.Unity.UI")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Microsoft")]
[assembly: AssemblyProduct("PokemonGoDesktop.Unity.UI")]
[assembly: AssemblyCopyright("Copyright © Microsoft 2016")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]

// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("4386b5c3-76b8-456e-98a7-e62c3837c213")]

// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
5 changes: 5 additions & 0 deletions src/PokemonGoDesktop.Unity.UI/packages.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Easyception" version="2.0.0" targetFramework="net35" />
<package id="PokemonGoDesktop.API.Proto" version="1.0.19" targetFramework="net35" />
</packages>

0 comments on commit 1c2e93e

Please sign in to comment.