Commit ec9702ab authored by 潘栩锋's avatar 潘栩锋 🚴

BulkData 满足 unity需求

parent 4d3c1635
......@@ -8,55 +8,8 @@ using System.Collections.Specialized;
namespace FLY.Thick.BulkDataModule
{
public class BulkDataServiceClient : FObj, INotifyPropertyChanged,IBulkDataService
public class BulkDataServiceClient : FObjServiceClient, INotifyPropertyChanged,IBulkDataService
{
private UInt32 mServerID = 0;
public UInt32 ServerID
{
get { return mServerID; }
set
{
if (mServerID != value)
{
mServerID = value;
NotifyPropertyChanged("ServerID");
}
}
}
private IFConn mConn;
public IFConn Conn
{
get { return mConn; }
set
{
mConn = value;
NotifyPropertyChanged("Conn");
}
}
private bool isconnected;
/// <summary>
/// 准备好,只有在 IsReady=true ,发送的命名才能执行,才能推送
/// </summary>
public bool IsReady
{
get
{
return isconnected;
}
protected set
{
if (isconnected != value)
{
isconnected = value;
NotifyPropertyChanged("IsReady");
}
}
}
#region IBulkDataService
class DataRequest
{
......@@ -179,79 +132,43 @@ namespace FLY.Thick.BulkDataModule
}
public event NotifyDatasChangedEventHandler DatasChanged;
private int count = 0;
/// <summary>
/// 数量
/// </summary>
public int Count
{
get { return count; }
set
{
if (count != value)
{
count = value;
NotifyPropertyChanged("Count");
}
}
}
private int currentbookmark = -1;
public int Count { get; set; }
/// <summary>
/// 最新的bookmark
/// </summary>
public int CurrentBookmark
{
get { return currentbookmark; }
set
{
if (currentbookmark != value)
{
currentbookmark = value;
NotifyPropertyChanged("CurrentBookmark");
}
}
}
public int CurrentBookmark { get; set; } = -1;
private int nbolts=80;
/// <summary>
/// 分区数
/// </summary>
public int NBolts
{
get { return nbolts; }
protected set {
if (nbolts != value)
{
nbolts = value;
NotifyPropertyChanged("NBolts");
}
}
}
private int boltNo1st=0;
public int NBolts { get; protected set; } = 80;
/// <summary>
/// 第1分区号
/// </summary>
public int BoltNo1st
{
get { return boltNo1st; }
protected set
{
if (boltNo1st != value)
{
boltNo1st = value;
NotifyPropertyChanged("BoltNo1st");
}
}
}
public int BoltNo1st { get; protected set; }
#endregion
public BulkDataServiceClient():this(BULKDATA_OBJ_INTERFACE.ID)
/// <summary>
///
/// </summary>
/// <param name="serviceId"></param>
public BulkDataServiceClient(UInt32 serviceId) : base(serviceId)
{
this.PropertyChanged += BulkDataServiceClient_PropertyChanged;
}
public BulkDataServiceClient(UInt32 id)
: base()
public BulkDataServiceClient(UInt32 serviceId, string connName) : base(serviceId, connName)
{
ServerID = id;
this.PropertyChanged += BulkDataServiceClient_PropertyChanged;
}
......@@ -428,8 +345,7 @@ namespace FLY.Thick.BulkDataModule
#region FObj
public override void ConnectNotify(IFConn from)
{
Conn = from;
IsReady = Conn.IsConnected;
base.ConnectNotify(from);
if (!from.IsConnected)
{
//连接断开,删除全部!!!
......@@ -641,13 +557,7 @@ namespace FLY.Thick.BulkDataModule
}
#region INotifyPropertyChanged 成员
protected void NotifyPropertyChanged(string propertyName)
{
if (PropertyChanged != null)
{
PropertyChanged.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
}
public event PropertyChangedEventHandler PropertyChanged;
#endregion
......
......@@ -16,14 +16,13 @@ namespace FLY.Thick.BulkDataModule
{
this.bulkdata = bulkdata;
bulkdata.PropertyChanged+=new PropertyChangedEventHandler(BulkdataClient_PropertyChanged);
bulkdata = new BulkDataServiceClient();
}
void BulkdataClient_PropertyChanged(object sender, PropertyChangedEventArgs e)
{
if (e.PropertyName == "IsReady")
if (e.PropertyName == "IsConnected")
{
if (bulkdata.IsReady)
if (bulkdata.IsConnected)
{
//所有都要向服务器重新注册
List<BulkDataGraph> send = new List<BulkDataGraph>();
......@@ -1074,7 +1073,7 @@ namespace FLY.Thick.BulkDataModule
mGraphs.Add(graph);
//没有, 需要向服务器注册
if (bulkdata.IsReady)
if (bulkdata.IsConnected)
{
Regist(graph);
}
......@@ -1102,7 +1101,7 @@ namespace FLY.Thick.BulkDataModule
var gl = from g in mGraphs where g.IsEquals(graph) select g;
if (gl.Count() == 1)
{
if (bulkdata.IsReady)
if (bulkdata.IsConnected)
{
UnRegist(graph);
}
......
......@@ -63,6 +63,11 @@
<Name>Misc</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<PackageReference Include="PropertyChanged.Fody">
<Version>3.2.5</Version>
</PackageReference>
</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.
......
<Weavers xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="FodyWeavers.xsd">
<PropertyChanged />
</Weavers>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<!-- This file was generated by Fody. Manual changes to this file will be lost when your project is rebuilt. -->
<xs:element name="Weavers">
<xs:complexType>
<xs:all>
<xs:element name="PropertyChanged" minOccurs="0" maxOccurs="1">
<xs:complexType>
<xs:attribute name="InjectOnPropertyNameChanged" type="xs:boolean">
<xs:annotation>
<xs:documentation>Used to control if the On_PropertyName_Changed feature is enabled.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="EventInvokerNames" type="xs:string">
<xs:annotation>
<xs:documentation>Used to change the name of the method that fires the notify event. This is a string that accepts multiple values in a comma separated form.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="CheckForEquality" type="xs:boolean">
<xs:annotation>
<xs:documentation>Used to control if equality checks should be inserted. If false, equality checking will be disabled for the project.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="CheckForEqualityUsingBaseEquals" type="xs:boolean">
<xs:annotation>
<xs:documentation>Used to control if equality checks should use the Equals method resolved from the base class.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="UseStaticEqualsFromBase" type="xs:boolean">
<xs:annotation>
<xs:documentation>Used to control if equality checks should use the static Equals method resolved from the base class.</xs:documentation>
</xs:annotation>
</xs:attribute>
</xs:complexType>
</xs:element>
</xs:all>
<xs:attribute name="VerifyAssembly" type="xs:boolean">
<xs:annotation>
<xs:documentation>'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="VerifyIgnoreCodes" type="xs:string">
<xs:annotation>
<xs:documentation>A comma-separated list of error codes that can be safely ignored in assembly verification.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="GenerateXsd" type="xs:boolean">
<xs:annotation>
<xs:documentation>'false' to turn off automatic generation of the XML Schema file.</xs:documentation>
</xs:annotation>
</xs:attribute>
</xs:complexType>
</xs:element>
</xs:schema>
\ No newline at end of file
......@@ -104,7 +104,7 @@ namespace FLY.Thick.BulkDataModule
/// <summary>
/// 准备好,只有在 IsReady=true ,发送的命令才能执行,才能推送
/// </summary>
bool IsReady { get; }
bool IsConnected { get; }
/// <summary>
/// 缓冲区数据
......
......@@ -587,7 +587,7 @@ namespace FLY.Thick.BulkDataModule
/// <summary>
/// 准备好,只有在 IsReady=true ,发送的命令才能执行,才能推送
/// </summary>
public bool IsReady
public bool IsConnected
{
get { return true; }
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment