提交 c3f58e74 编写于 作者: T tanghai

1.enet更新版本

2.行为树编辑器增加设定路径功能
上级 4a2b7a7a
...@@ -32,34 +32,6 @@ ...@@ -32,34 +32,6 @@
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.1" /> <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.1" />
</startup> </startup>
<appSettings> <appSettings>
<add key="IP" value="192.168.11.95" /> <add key="NodePath" value="D:\Source\SLOL\Program\Unity\Assets\Resources\Config\" />
<add key="Port" value="8888" />
<add key="Account" value="egametang@163.com" />
<add key="Password" value="163bio1" />
<add key="NodePath" value="D:\Source\SLOL\Program\Unity\Assets\Resources\Config\TreeProto.txt" />
<add key="ClientSettingsProvider.ServiceUri" value="" />
</appSettings> </appSettings>
<system.serviceModel>
<bindings>
<netTcpBinding>
<binding name="NetTcpBinding_Calculator" />
</netTcpBinding>
</bindings>
<client>
<endpoint address="net.tcp://localhost:10000/Calculator/" binding="netTcpBinding" bindingConfiguration="NetTcpBinding_Calculator" contract="Proxy.Calculator" name="NetTcpBinding_Calculator">
</endpoint>
</client>
</system.serviceModel>
<system.web>
<membership defaultProvider="ClientAuthenticationMembershipProvider">
<providers>
<add name="ClientAuthenticationMembershipProvider" type="System.Web.ClientServices.Providers.ClientFormsAuthenticationMembershipProvider, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" serviceUri="" />
</providers>
</membership>
<roleManager defaultProvider="ClientRoleProvider" enabled="true">
<providers>
<add name="ClientRoleProvider" type="System.Web.ClientServices.Providers.ClientRoleProvider, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" serviceUri="" cacheTimeout="86400" />
</providers>
</roleManager>
</system.web>
</configuration> </configuration>
...@@ -28,6 +28,7 @@ ...@@ -28,6 +28,7 @@
<MenuItem Header="新建" Click="MenuItem_New" /> <MenuItem Header="新建" Click="MenuItem_New" />
<MenuItem Header="删除" Click="MenuItem_Remove" /> <MenuItem Header="删除" Click="MenuItem_Remove" />
<MenuItem Header="克隆" Click="MenuItem_Clone" /> <MenuItem Header="克隆" Click="MenuItem_Clone" />
<MenuItem Header="路径" Click="MenuItem_Path" />
</ContextMenu> </ContextMenu>
</ListBox.ContextMenu> </ListBox.ContextMenu>
<ListBox.ItemTemplate> <ListBox.ItemTemplate>
......
using System.ComponentModel.Composition; using System.ComponentModel.Composition;
using System.Configuration; using System.Configuration;
using System.IO;
using System.Windows; using System.Windows;
using System.Windows.Forms;
using System.Windows.Input; using System.Windows.Input;
using Infrastructure; using Infrastructure;
using Application = System.Windows.Application;
namespace Modules.BehaviorTreeModule namespace Modules.BehaviorTreeModule
{ {
...@@ -35,7 +38,7 @@ namespace Modules.BehaviorTreeModule ...@@ -35,7 +38,7 @@ namespace Modules.BehaviorTreeModule
private void MenuItem_Open(object sender, RoutedEventArgs e) private void MenuItem_Open(object sender, RoutedEventArgs e)
{ {
string nodePath = ConfigurationManager.AppSettings["NodePath"]; string nodePath = Path.Combine(ConfigurationManager.AppSettings["NodePath"], "TreeProto.txt");
this.ViewModel.Open(nodePath); this.ViewModel.Open(nodePath);
this.lbTrees.SelectedIndex = -1; this.lbTrees.SelectedIndex = -1;
this.treeView.ViewModel = null; this.treeView.ViewModel = null;
...@@ -43,7 +46,7 @@ namespace Modules.BehaviorTreeModule ...@@ -43,7 +46,7 @@ namespace Modules.BehaviorTreeModule
private void MenuItem_Save(object sender, RoutedEventArgs e) private void MenuItem_Save(object sender, RoutedEventArgs e)
{ {
string nodePath = ConfigurationManager.AppSettings["NodePath"]; string nodePath = Path.Combine(ConfigurationManager.AppSettings["NodePath"], "TreeProto.txt");
this.ViewModel.Save(nodePath); this.ViewModel.Save(nodePath);
} }
...@@ -65,6 +68,24 @@ namespace Modules.BehaviorTreeModule ...@@ -65,6 +68,24 @@ namespace Modules.BehaviorTreeModule
this.treeView.ViewModel = newTreeViewModel; this.treeView.ViewModel = newTreeViewModel;
} }
private void MenuItem_Path(object sender, RoutedEventArgs e)
{
FolderBrowserDialog dialog = new FolderBrowserDialog();
dialog.SelectedPath = ConfigurationManager.AppSettings["NodePath"];
dialog.ShowDialog();
string path = dialog.SelectedPath;
if (path.Length < 1 || !Directory.Exists(path))
{
System.Windows.MessageBox.Show("选择的目录无效");
return;
}
Configuration cfg = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
cfg.AppSettings.Settings["NodePath"].Value = path;
cfg.Save();
ConfigurationManager.AppSettings["NodePath"] = path;
Application.Current.MainWindow.Title = string.Format("行为树编辑器 当前工作目录[{0}]", ConfigurationManager.AppSettings["NodePath"]);
}
private void MenuItem_Remove(object sender, RoutedEventArgs e) private void MenuItem_Remove(object sender, RoutedEventArgs e)
{ {
if (this.lbTrees.SelectedItem == null) if (this.lbTrees.SelectedItem == null)
......
...@@ -25,7 +25,7 @@ extern "C" ...@@ -25,7 +25,7 @@ extern "C"
#define ENET_VERSION_MAJOR 1 #define ENET_VERSION_MAJOR 1
#define ENET_VERSION_MINOR 3 #define ENET_VERSION_MINOR 3
#define ENET_VERSION_PATCH 12 #define ENET_VERSION_PATCH 13
#define ENET_VERSION_CREATE(major, minor, patch) (((major)<<16) | ((minor)<<8) | (patch)) #define ENET_VERSION_CREATE(major, minor, patch) (((major)<<16) | ((minor)<<8) | (patch))
#define ENET_VERSION_GET_MAJOR(version) (((version)>>16)&0xFF) #define ENET_VERSION_GET_MAJOR(version) (((version)>>16)&0xFF)
#define ENET_VERSION_GET_MINOR(version) (((version)>>8)&0xFF) #define ENET_VERSION_GET_MINOR(version) (((version)>>8)&0xFF)
...@@ -208,7 +208,7 @@ enum ...@@ -208,7 +208,7 @@ enum
ENET_HOST_RECEIVE_BUFFER_SIZE = 256 * 1024, ENET_HOST_RECEIVE_BUFFER_SIZE = 256 * 1024,
ENET_HOST_SEND_BUFFER_SIZE = 256 * 1024, ENET_HOST_SEND_BUFFER_SIZE = 256 * 1024,
ENET_HOST_BANDWIDTH_THROTTLE_INTERVAL = 1000, ENET_HOST_BANDWIDTH_THROTTLE_INTERVAL = 1000,
ENET_HOST_DEFAULT_MTU = 512, ENET_HOST_DEFAULT_MTU = 600,
ENET_HOST_DEFAULT_MAXIMUM_PACKET_SIZE = 32 * 1024 * 1024, ENET_HOST_DEFAULT_MAXIMUM_PACKET_SIZE = 32 * 1024 * 1024,
ENET_HOST_DEFAULT_MAXIMUM_WAITING_DATA = 32 * 1024 * 1024, ENET_HOST_DEFAULT_MAXIMUM_WAITING_DATA = 32 * 1024 * 1024,
......
...@@ -102,7 +102,7 @@ enet_host_create (const ENetAddress * address, size_t peerCount, size_t channelL ...@@ -102,7 +102,7 @@ enet_host_create (const ENetAddress * address, size_t peerCount, size_t channelL
host -> duplicatePeers = ENET_PROTOCOL_MAXIMUM_PEER_ID; host -> duplicatePeers = ENET_PROTOCOL_MAXIMUM_PEER_ID;
host -> maximumPacketSize = ENET_HOST_DEFAULT_MAXIMUM_PACKET_SIZE; host -> maximumPacketSize = ENET_HOST_DEFAULT_MAXIMUM_PACKET_SIZE;
host -> maximumWaitingData = ENET_HOST_DEFAULT_MAXIMUM_WAITING_DATA; host -> maximumWaitingData = ENET_HOST_DEFAULT_MAXIMUM_WAITING_DATA;
host->checksum = enet_crc32; host ->checksum = enet_crc32;
host -> compressor.context = NULL; host -> compressor.context = NULL;
host -> compressor.compress = NULL; host -> compressor.compress = NULL;
......
...@@ -764,6 +764,10 @@ enet_protocol_handle_bandwidth_limit (ENetHost * host, ENetPeer * peer, const EN ...@@ -764,6 +764,10 @@ enet_protocol_handle_bandwidth_limit (ENetHost * host, ENetPeer * peer, const EN
if (peer -> incomingBandwidth == 0 && host -> outgoingBandwidth == 0) if (peer -> incomingBandwidth == 0 && host -> outgoingBandwidth == 0)
peer -> windowSize = ENET_PROTOCOL_MAXIMUM_WINDOW_SIZE; peer -> windowSize = ENET_PROTOCOL_MAXIMUM_WINDOW_SIZE;
else
if (peer -> incomingBandwidth == 0 || host -> outgoingBandwidth == 0)
peer -> windowSize = (ENET_MAX (peer -> incomingBandwidth, host -> outgoingBandwidth) /
ENET_PEER_WINDOW_SIZE_SCALE) * ENET_PROTOCOL_MINIMUM_WINDOW_SIZE;
else else
peer -> windowSize = (ENET_MIN (peer -> incomingBandwidth, host -> outgoingBandwidth) / peer -> windowSize = (ENET_MIN (peer -> incomingBandwidth, host -> outgoingBandwidth) /
ENET_PEER_WINDOW_SIZE_SCALE) * ENET_PROTOCOL_MINIMUM_WINDOW_SIZE; ENET_PEER_WINDOW_SIZE_SCALE) * ENET_PROTOCOL_MINIMUM_WINDOW_SIZE;
...@@ -1191,7 +1195,9 @@ commandError: ...@@ -1191,7 +1195,9 @@ commandError:
static int static int
enet_protocol_receive_incoming_commands (ENetHost * host, ENetEvent * event) enet_protocol_receive_incoming_commands (ENetHost * host, ENetEvent * event)
{ {
for (;;) int packets;
for (packets = 0; packets < 256; ++ packets)
{ {
int receivedLength; int receivedLength;
ENetBuffer buffer; ENetBuffer buffer;
...@@ -1484,7 +1490,7 @@ enet_protocol_send_reliable_outgoing_commands (ENetHost * host, ENetPeer * peer) ...@@ -1484,7 +1490,7 @@ enet_protocol_send_reliable_outgoing_commands (ENetHost * host, ENetPeer * peer)
! (outgoingCommand -> reliableSequenceNumber % ENET_PEER_RELIABLE_WINDOW_SIZE) && ! (outgoingCommand -> reliableSequenceNumber % ENET_PEER_RELIABLE_WINDOW_SIZE) &&
(channel -> reliableWindows [(reliableWindow + ENET_PEER_RELIABLE_WINDOWS - 1) % ENET_PEER_RELIABLE_WINDOWS] >= ENET_PEER_RELIABLE_WINDOW_SIZE || (channel -> reliableWindows [(reliableWindow + ENET_PEER_RELIABLE_WINDOWS - 1) % ENET_PEER_RELIABLE_WINDOWS] >= ENET_PEER_RELIABLE_WINDOW_SIZE ||
channel -> usedReliableWindows & ((((1 << ENET_PEER_FREE_RELIABLE_WINDOWS) - 1) << reliableWindow) | channel -> usedReliableWindows & ((((1 << ENET_PEER_FREE_RELIABLE_WINDOWS) - 1) << reliableWindow) |
(((1 << ENET_PEER_FREE_RELIABLE_WINDOWS) - 1) >> (ENET_PEER_RELIABLE_WINDOW_SIZE - reliableWindow))))) (((1 << ENET_PEER_FREE_RELIABLE_WINDOWS) - 1) >> (ENET_PEER_RELIABLE_WINDOWS - reliableWindow)))))
windowWrap = 1; windowWrap = 1;
if (windowWrap) if (windowWrap)
{ {
......
...@@ -104,7 +104,7 @@ enet_address_set_host (ENetAddress * address, const char * name) ...@@ -104,7 +104,7 @@ enet_address_set_host (ENetAddress * address, const char * name)
char buffer [2048]; char buffer [2048];
int errnum; int errnum;
#if defined(linux) || defined(__linux) || defined(__linux__) || defined(__FreeBSD__) || defined(__FreeBSD_kernel__) #if defined(linux) || defined(__linux) || defined(__linux__) || defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__)
gethostbyname_r (name, & hostData, buffer, sizeof (buffer), & hostEntry, & errnum); gethostbyname_r (name, & hostData, buffer, sizeof (buffer), & hostEntry, & errnum);
#else #else
hostEntry = gethostbyname_r (name, & hostData, buffer, sizeof (buffer), & errnum); hostEntry = gethostbyname_r (name, & hostData, buffer, sizeof (buffer), & errnum);
...@@ -162,7 +162,7 @@ enet_address_get_host (const ENetAddress * address, char * name, size_t nameLeng ...@@ -162,7 +162,7 @@ enet_address_get_host (const ENetAddress * address, char * name, size_t nameLeng
in.s_addr = address -> host; in.s_addr = address -> host;
#if defined(linux) || defined(__linux) || defined(__linux__) || defined(__FreeBSD__) || defined(__FreeBSD_kernel__) #if defined(linux) || defined(__linux) || defined(__linux__) || defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__)
gethostbyaddr_r ((char *) & in, sizeof (struct in_addr), AF_INET, & hostData, buffer, sizeof (buffer), & hostEntry, & errnum); gethostbyaddr_r ((char *) & in, sizeof (struct in_addr), AF_INET, & hostData, buffer, sizeof (buffer), & hostEntry, & errnum);
#else #else
hostEntry = gethostbyaddr_r ((char *) & in, sizeof (struct in_addr), AF_INET, & hostData, buffer, sizeof (buffer), & errnum); hostEntry = gethostbyaddr_r ((char *) & in, sizeof (struct in_addr), AF_INET, & hostData, buffer, sizeof (buffer), & errnum);
...@@ -246,7 +246,7 @@ enet_socket_set_option (ENetSocket socket, ENetSocketOption option, int value) ...@@ -246,7 +246,7 @@ enet_socket_set_option (ENetSocket socket, ENetSocketOption option, int value)
{ {
case ENET_SOCKOPT_NONBLOCK: case ENET_SOCKOPT_NONBLOCK:
#ifdef HAS_FCNTL #ifdef HAS_FCNTL
result = fcntl (socket, F_SETFL, O_NONBLOCK | fcntl (socket, F_GETFL)); result = fcntl (socket, F_SETFL, (value ? O_NONBLOCK : 0) | (fcntl (socket, F_GETFL) & ~O_NONBLOCK));
#else #else
result = ioctl (socket, FIONBIO, & value); result = ioctl (socket, FIONBIO, & value);
#endif #endif
......
...@@ -4,9 +4,10 @@ ...@@ -4,9 +4,10 @@
*/ */
#ifdef _WIN32 #ifdef _WIN32
#include <time.h>
#define ENET_BUILDING_LIB 1 #define ENET_BUILDING_LIB 1
#include "enet/enet.h" #include "enet/enet.h"
#include <windows.h>
#include <mmsystem.h>
static enet_uint32 timeBase = 0; static enet_uint32 timeBase = 0;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册