Skip to content

Commit

Permalink
add example
Browse files Browse the repository at this point in the history
  • Loading branch information
hiram3512 committed Aug 2, 2019
1 parent 5902673 commit 9e6b922
Show file tree
Hide file tree
Showing 66 changed files with 103 additions and 9 deletions.
Binary file modified HiSocket/HiSocket.Message.dll
Binary file not shown.
Binary file modified HiSocket/HiSocket.Message.pdb
Binary file not shown.
Binary file modified HiSocket/HiSocket.dll
Binary file not shown.
Binary file modified HiSocket/HiSocket.pdb
Binary file not shown.
Binary file added HiSocket_2.9.2.zip
Binary file not shown.
8 changes: 7 additions & 1 deletion src/HiSocket.Example/Example1.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
using HiSocket.Tcp;
/***************************************************************
* Description:
*
* Documents: https://github.com/hiramtan/HiSocket
* Author: [email protected]
***************************************************************/
using HiSocket.Tcp;

namespace HiSocket.Example
{
Expand Down
8 changes: 7 additions & 1 deletion src/HiSocket.Example/Example2.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
using System;
/***************************************************************
* Description:
*
* Documents: https://github.com/hiramtan/HiSocket
* Author: [email protected]
***************************************************************/
using System;
using HiSocket.Tcp;

namespace HiSocket.Example
Expand Down
8 changes: 7 additions & 1 deletion src/HiSocket.Example/Example3.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
using HiSocket.Tcp;
/***************************************************************
* Description:
*
* Documents: https://github.com/hiramtan/HiSocket
* Author: [email protected]
***************************************************************/
using HiSocket.Tcp;

namespace HiSocket.Example
{
Expand Down
8 changes: 7 additions & 1 deletion src/HiSocket.Example/PackageExample.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
using HiFramework;
/***************************************************************
* Description:
*
* Documents: https://github.com/hiramtan/HiSocket
* Author: [email protected]
***************************************************************/
using HiFramework;
using HiSocket.Tcp;
using System;

Expand Down
Binary file modified src/HiSocket.Example/bin/Debug/HiSocket.Example.exe
Binary file not shown.
Binary file modified src/HiSocket.Example/bin/Debug/HiSocket.Example.pdb
Binary file not shown.
Binary file modified src/HiSocket.Example/bin/Debug/HiSocket.Message.dll
Binary file not shown.
Binary file modified src/HiSocket.Example/bin/Debug/HiSocket.Message.pdb
Binary file not shown.
Binary file modified src/HiSocket.Example/bin/Debug/HiSocket.dll
Binary file not shown.
Binary file modified src/HiSocket.Example/bin/Debug/HiSocket.pdb
Binary file not shown.
Binary file not shown.
Binary file modified src/HiSocket.Example/obj/Debug/HiSocket.Example.exe
Binary file not shown.
Binary file modified src/HiSocket.Example/obj/Debug/HiSocket.Example.pdb
Binary file not shown.
18 changes: 18 additions & 0 deletions src/HiSocket.Example_Unity/HiSocket.Example_Unity.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,27 @@
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="HiFramework, Version=1.0.7.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\HiFramework.1.0.7\lib\net35\HiFramework.dll</HintPath>
</Reference>
<Reference Include="HiFramework.Assert, Version=1.0.2.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\HiFramework.Assert.1.0.2\lib\net35\HiFramework.Assert.dll</HintPath>
</Reference>
<Reference Include="HiFramework.Core, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\HiFramework.Core.1.0.0\lib\net35\HiFramework.Core.dll</HintPath>
</Reference>
<Reference Include="HiFramework.Unity">
<HintPath>lib\HiFramework.Unity.dll</HintPath>
</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\UnityEngine.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="Program.cs" />
Expand All @@ -57,5 +72,8 @@
<Name>HiSocket.Tcp</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
52 changes: 48 additions & 4 deletions src/HiSocket.Example_Unity/Program.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,14 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
/***************************************************************
* Description:
*
* Documents: https://github.com/hiramtan/HiSocket
* Author: [email protected]
***************************************************************/
using HiFramework.Core;
using HiFramework.Unity;
using HiSocket.Example;
using HiSocket.Tcp;
using UnityEngine;

namespace HiSocket.Example_Unity
{
Expand All @@ -11,4 +18,41 @@ static void Main(string[] args)
{
}
}
public class Example : MonoBehaviour
{
private ITickComponent tick;
private IMainThread mainThread;
// Use this for initialization
void Start()
{
Center.Init();
tick = Center.Get<ITickComponent>();
Connect();
}

// Update is called once per frame
void Update()
{
tick.Tick(Time.deltaTime);
}

TcpConnection tcp;
void Connect()
{
var package = new PackageExample();
tcp = new TcpConnection(package);
tcp.OnReceiveMessage += OnReceive;
tcp.Connect("127.0.0.1", 999);
}

void OnReceive(byte[] message)
{
mainThread.RunOnMainThread(OnMainThread,message);
}

void OnMainThread(object message)
{
var data = message as byte[];
}
}
}
Binary file modified src/HiSocket.Example_Unity/bin/Debug/HiFramework.Assert.dll
Binary file not shown.
Binary file not shown.
Binary file modified src/HiSocket.Example_Unity/bin/Debug/HiSocket.Example.exe
Binary file not shown.
Binary file modified src/HiSocket.Example_Unity/bin/Debug/HiSocket.Example.pdb
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified src/HiSocket.Example_Unity/bin/Debug/HiSocket.Message.dll
Binary file not shown.
Binary file modified src/HiSocket.Example_Unity/bin/Debug/HiSocket.Message.pdb
Binary file not shown.
Binary file modified src/HiSocket.Example_Unity/bin/Debug/HiSocket.dll
Binary file not shown.
Binary file modified src/HiSocket.Example_Unity/bin/Debug/HiSocket.pdb
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added src/HiSocket.Example_Unity/lib/UnityEngine.dll
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1 +1 @@
96e74d90602e97ade72df0fd66b682badf9fbe33
4f0e9bdfc0bbc9c69411d59fe82c6b598fb59975
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,5 @@ D:\MyGit\github\HiSocket\src\HiSocket.Example_Unity\bin\Debug\HiSocket.Example.p
D:\MyGit\github\HiSocket\src\HiSocket.Example_Unity\bin\Debug\HiSocket.Message.pdb
D:\MyGit\github\HiSocket\src\HiSocket.Example_Unity\bin\Debug\HiSocket.pdb
D:\MyGit\github\HiSocket\src\HiSocket.Example_Unity\obj\Debug\HiSocket.Example_Unity.csproj.CopyComplete
D:\MyGit\github\HiSocket\src\HiSocket.Example_Unity\bin\Debug\HiFramework.Unity.dll
D:\MyGit\github\HiSocket\src\HiSocket.Example_Unity\bin\Debug\UnityEngine.dll
Binary file not shown.
Binary file not shown.
Binary file not shown.
6 changes: 6 additions & 0 deletions src/HiSocket.Example_Unity/packages.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="HiFramework" version="1.0.7" targetFramework="net35" />
<package id="HiFramework.Assert" version="1.0.2" targetFramework="net35" />
<package id="HiFramework.Core" version="1.0.0" targetFramework="net35" />
</packages>
Binary file not shown.
Binary file modified src/HiSocket.Message/obj/Debug/HiSocket.Message.dll
Binary file not shown.
Binary file modified src/HiSocket.Message/obj/Debug/HiSocket.Message.pdb
Binary file not shown.
Binary file not shown.
Binary file modified src/HiSocket.Tcp/obj/Debug/HiSocket.dll
Binary file not shown.
Binary file modified src/HiSocket.Tcp/obj/Debug/HiSocket.pdb
Binary file not shown.
Binary file added src/HiSocket.Test/bin/Debug/HiSocket.Example.exe
Binary file not shown.
Binary file added src/HiSocket.Test/bin/Debug/HiSocket.Example.pdb
Binary file not shown.
Binary file modified src/HiSocket.Test/bin/Debug/HiSocket.Message.dll
Binary file not shown.
Binary file modified src/HiSocket.Test/bin/Debug/HiSocket.Message.pdb
Binary file not shown.
Binary file modified src/HiSocket.Test/bin/Debug/HiSocket.Test.dll
Binary file not shown.
Binary file modified src/HiSocket.Test/bin/Debug/HiSocket.Test.pdb
Binary file not shown.
Binary file modified src/HiSocket.Test/bin/Debug/HiSocket.dll
Binary file not shown.
Binary file modified src/HiSocket.Test/bin/Debug/HiSocket.pdb
Binary file not shown.
Binary file not shown.
Binary file modified src/HiSocket.Test/obj/Debug/HiSocket.Test.dll
Binary file not shown.
Binary file modified src/HiSocket.Test/obj/Debug/HiSocket.Test.pdb
Binary file not shown.
Empty file.
Binary file removed src/release/HiFramework.Assert.dll
Binary file not shown.
Binary file removed src/release/HiFramework.Core.dll
Binary file not shown.
Binary file removed src/release/HiFramework.dll
Binary file not shown.
Binary file removed src/release/HiSocket.Message.dll
Binary file not shown.
Binary file removed src/release/HiSocket.Message.pdb
Binary file not shown.
Binary file removed src/release/HiSocket.dll
Binary file not shown.
Binary file removed src/release/HiSocket.pdb
Binary file not shown.
Binary file removed src/release/protobuf-net.dll
Binary file not shown.

0 comments on commit 9e6b922

Please sign in to comment.