提交 58e129be 编写于 作者: T tanghai

准备在mono层也加上Entity结构

上级 7de91dae
......@@ -35,3 +35,4 @@ _ReSharper.CSharp/
/Unity/CSharp60Support/compilation.log
/.vs
/Server/.vs/
/Unity/.vs/
fileFormatVersion: 2
guid: d2b1f66f808fc9a4ba043d89e5d982f9
folderAsset: yes
timeCreated: 1477361235
licenseType: Pro
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: f7281e8ad95b8df4f9a026c2946022fc
timeCreated: 1487213400
licenseType: Pro
guid: 5bc968db5a1250942b8587dd7d739972
timeCreated: 1498116020
licenseType: Free
MonoImporter:
serializedVersion: 2
defaultReferences: []
......
fileFormatVersion: 2
guid: e9bbdaba5951975479fcb38781fe8a83
timeCreated: 1487663913
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
......@@ -3,7 +3,7 @@ using Model;
namespace Hotfix
{
public class BenchmarkComponent: Component
public class BenchmarkComponent: HotfixComponent
{
private int k;
......@@ -13,11 +13,11 @@ namespace Hotfix
{
try
{
NetOuterComponent networkComponent = Game.Scene.GetComponent<NetOuterComponent>();
NetOuterComponent networkComponent = Hotfix.Scene.GetComponent<NetOuterComponent>();
for (int i = 0; i < 100; i++)
{
await Game.Scene.GetComponent<TimerComponent>().WaitAsync(10);
await Hotfix.Scene.GetComponent<TimerComponent>().WaitAsync(10);
this.TestAsync(networkComponent, address, i);
}
}
......
fileFormatVersion: 2
guid: c5ad06ffe2931aa4f897be9193d6e024
timeCreated: 1478068700
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: 97ef5ac3bc0b59240b674d0385978404
timeCreated: 1475893346
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: 0696a6710dd544946a4fa2c3e1b4bd08
timeCreated: 1477315726
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: e98bd4118f88e1c428e3af0983722aa8
folderAsset: yes
timeCreated: 1478144281
licenseType: Pro
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: befeb8cfbdbfc5b4ea5f967c200d4751
timeCreated: 1478144281
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: 35f166fd86ee5e44aaec9326bb0a5454
timeCreated: 1478144281
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: 31224cfdac2f28c42bd641d5a2e80fe8
timeCreated: 1478144281
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: bceb49362f439a248b806059721da628
timeCreated: 1478834038
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
......@@ -3,7 +3,7 @@ using System.Collections.Generic;
namespace Hotfix
{
public class ConfigComponent: Component
public class ConfigComponent: HotfixComponent
{
private Dictionary<Type, ICategory> allConfig;
......
fileFormatVersion: 2
guid: caa77cb967441e24b9ebf780fc97581f
timeCreated: 1477904772
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
......@@ -5,7 +5,7 @@ using Model;
namespace Hotfix
{
[EntityEvent(EntityEventId.EventComponent)]
public class EventComponent : Component, IAwake
public class EventComponent : HotfixComponent, IAwake
{
private Dictionary<int, List<object>> allEvents;
......
fileFormatVersion: 2
guid: fdeabd62f7ad9414fa74891de319729f
timeCreated: 1487297356
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
......@@ -3,7 +3,7 @@
namespace Hotfix
{
[EntityEvent(EntityEventId.GameObjectComponent)]
public class GameObjectComponent: Component
public class GameObjectComponent: HotfixComponent
{
public GameObject GameObject { get; private set; }
......
fileFormatVersion: 2
guid: b22c8ba7a4c107043b96baaec985d757
timeCreated: 1475915396
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
......@@ -6,7 +6,7 @@ namespace Hotfix
/// <summary>
/// Key Value组件用于保存一些数据
/// </summary>
public class KVComponent: Component
public class KVComponent: HotfixComponent
{
[BsonElement]
private readonly Dictionary<string, object> kv = new Dictionary<string, object>();
......
fileFormatVersion: 2
guid: df17a81a4db312744a45e5756fe92bce
timeCreated: 1476550924
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
......@@ -8,7 +8,7 @@ namespace Hotfix
/// 消息分发组件
/// </summary>
[EntityEvent(EntityEventId.MessageDispatherComponent)]
public class MessageDispatherComponent: Component, IAwake<AppType>, ILoad
public class MessageDispatherComponent: HotfixComponent, IAwake<AppType>, ILoad
{
private AppType AppType;
private Dictionary<ushort, List<IInstanceMethod>> handlers;
......
fileFormatVersion: 2
guid: 8e97599ee372f6f40aaa5e743851a74c
timeCreated: 1476550923
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: 1ab11b2f08956d1499373e40ab1eba6b
timeCreated: 1477015901
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: 2540893057b627148a6fe09470765227
timeCreated: 1477015901
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
......@@ -6,7 +6,7 @@ using Model;
namespace Hotfix
{
public abstract class NetworkComponent: Component
public abstract class NetworkComponent: HotfixComponent
{
private AService Service;
......
fileFormatVersion: 2
guid: 151d2db7aab5bc8438bc039443ba0e3b
timeCreated: 1476550922
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
......@@ -7,7 +7,7 @@ using UnityEngine;
namespace Hotfix
{
[EntityEvent(EntityEventId.ResourcesComponent)]
public class ResourcesComponent: Component
public class ResourcesComponent: HotfixComponent
{
public static AssetBundleManifest AssetBundleManifestObject { get; set; }
......@@ -70,7 +70,7 @@ namespace Hotfix
++count;
if (count > 1)
{
await Game.Scene.GetComponent<TimerComponent>().WaitAsync(2000);
await Hotfix.Scene.GetComponent<TimerComponent>().WaitAsync(2000);
}
if (this.Id == 0)
......
fileFormatVersion: 2
guid: 509cf7df1ed2a52438a824cb162c208a
timeCreated: 1478516097
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
namespace Hotfix
{
[EntityEvent(EntityEventId.RobotComponent)]
public class RobotComponent: Component
public class RobotComponent: HotfixComponent
{
public override void Dispose()
{
......
fileFormatVersion: 2
guid: 8f405bc76c5688946a2a5a0ef526877a
timeCreated: 1477643346
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
......@@ -5,7 +5,7 @@ namespace Hotfix
/// <summary>
/// 用于同步服务端和客户端时间
/// </summary>
public class TimeComponent: Component
public class TimeComponent: HotfixComponent
{
private long syncTime;
......
fileFormatVersion: 2
guid: ef493cd670f2eab428b7aa9d0e368212
timeCreated: 1476550924
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
......@@ -13,7 +13,7 @@ namespace Hotfix
}
[EntityEvent(EntityEventId.TimerComponent)]
public class TimerComponent: Component, IUpdate
public class TimerComponent: HotfixComponent, IUpdate
{
private readonly Dictionary<long, Timer> timers = new Dictionary<long, Timer>();
......
fileFormatVersion: 2
guid: 2f4a73ac996f1404aa1866a86140fe38
timeCreated: 1476550922
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: 04aa44487cc12004aaa03a8934ccfb4d
folderAsset: yes
timeCreated: 1487388885
licenseType: Pro
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:
......@@ -31,7 +31,7 @@ namespace Hotfix
/// 管理所有UI
/// </summary>
[EntityEvent(EntityEventId.UIComponent)]
public class UIComponent: Component, IAwake, ILoad
public class UIComponent: HotfixComponent, IAwake, ILoad
{
private UI Root;
private Dictionary<int, IUIFactory> UiTypes;
......
fileFormatVersion: 2
guid: 44e829de290b6374c879adcf05b10151
timeCreated: 1478510684
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
......@@ -3,7 +3,7 @@
namespace Hotfix
{
[EntityEvent(EntityEventId.UnitComponent)]
public class UnitComponent: Component
public class UnitComponent: HotfixComponent
{
private readonly Dictionary<long, Unit> idUnits = new Dictionary<long, Unit>();
......
fileFormatVersion: 2
guid: d0edacd02e5460b4fa72b01dba5e4083
timeCreated: 1480324632
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
using System;
using System.Collections.Generic;
using System.Linq;
using Model;
namespace Hotfix
{
......
......@@ -3,7 +3,7 @@
/// <summary>
/// 每个Config的基类
/// </summary>
public abstract class AConfig: Entity
public abstract class AConfig: HotfixEntity
{
protected AConfig(EntityType entityType): base(entityType)
{
......
......@@ -8,7 +8,7 @@ namespace Hotfix
[BsonKnownTypes(typeof (ClientConfig))]
[BsonKnownTypes(typeof (InnerConfig))]
[BsonKnownTypes(typeof (OuterConfig))]
public abstract class AConfigComponent: Component
public abstract class AConfigComponent: HotfixComponent
{
}
}
\ No newline at end of file
......@@ -3,7 +3,7 @@ using UnityEngine;
namespace Hotfix
{
public class AssetBundleLoaderAsync : Entity
public class AssetBundleLoaderAsync : HotfixEntity
{
private AssetBundle assetBundle;
......
fileFormatVersion: 2
guid: 3884a45c24f76244aa0697dcb9d95d15
timeCreated: 1487217220
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: 1136de56973a671409ed0bf599b1f478
folderAsset: yes
timeCreated: 1474944857
licenseType: Pro
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: 8433bdafcbe56e140b3fe0c93722e0cf
timeCreated: 1475898829
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: c181dc38f15288746960812611a7767e
timeCreated: 1476862821
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
using Model;
namespace Hotfix
{
public static class Game
{
private static EntityEventManager entityEventManager;
public static TPoller Poller { get; } = new TPoller();
private static Scene scene;
public static Scene Scene
{
get
{
if (scene == null)
{
scene = new Scene();
scene.AddComponent<EventComponent>();
scene.AddComponent<TimerComponent>();
}
return scene;
}
}
public static void CloseScene()
{
scene.Dispose();
scene = null;
}
public static EntityEventManager EntityEventManager
{
get
{
if (entityEventManager == null)
{
entityEventManager = new EntityEventManager();
}
return entityEventManager;
}
set
{
entityEventManager = value;
}
}
}
}
\ No newline at end of file
fileFormatVersion: 2
guid: 8b09c881ef13d1a468c08473032049e5
timeCreated: 1477361446
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
namespace Hotfix
{
public static class Hotfix
{
private static Scene scene;
public static Scene Scene
{
get
{
if (scene != null)
{
return scene;
}
scene = new Scene();
scene.AddComponent<EventComponent>();
scene.AddComponent<TimerComponent>();
return scene;
}
}
public static void Close()
{
scene.Dispose();
scene = null;
}
}
}
\ No newline at end of file
fileFormatVersion: 2
guid: e9766182470b7474a9ac9f1cccc8edcc
folderAsset: yes
timeCreated: 1477905041
licenseType: Pro
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: 05919d549c85a004db06311ff37fc9ec
timeCreated: 1474947336
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: 744bed14ed54ae24b86904852fc00a5c
timeCreated: 1487209071
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: a3ea7647c46dedb4186a28908a86005a
timeCreated: 1479696941
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
......@@ -15,7 +15,7 @@
Realm
}
public sealed class Scene: Entity
public sealed class Scene: HotfixEntity
{
public Scene Parent { get; set; }
......
fileFormatVersion: 2
guid: 6a74878a3e383af45bac4995de1e0f53
timeCreated: 1476550923
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
......@@ -8,7 +8,7 @@ using MongoDB.Bson;
namespace Hotfix
{
public sealed class Session : Entity
public sealed class Session : HotfixEntity
{
private static uint RpcId { get; set; }
private readonly NetworkComponent network;
......@@ -41,7 +41,7 @@ namespace Hotfix
private async void StartRecv()
{
TimerComponent timerComponent = Game.Scene.GetComponent<TimerComponent>();
TimerComponent timerComponent = Hotfix.Scene.GetComponent<TimerComponent>();
while (true)
{
if (this.Id == 0)
......
fileFormatVersion: 2
guid: 73d149d0c325fa24d91a94843bd520b8
timeCreated: 1477361540
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
......@@ -3,7 +3,7 @@ using UnityEngine;
namespace Hotfix
{
public sealed class UI: Entity
public sealed class UI: HotfixEntity
{
public Scene Scene { get; set; }
......
fileFormatVersion: 2
guid: 1ac1cd316713406438a0a904d951035d
timeCreated: 1475915395
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
......@@ -6,7 +6,7 @@
Npc
}
public sealed class Unit: Entity
public sealed class Unit: HotfixEntity
{
public UnitType UnitType { get; }
......
fileFormatVersion: 2
guid: 4da2290eec277924c88e511d3e4ae7b9
timeCreated: 1479694292
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
......@@ -6,7 +6,7 @@ using UnityEngine;
namespace Hotfix
{
[EntityEvent(EntityEventId.WWWAsync)]
public class WWWAsync: Entity
public class WWWAsync: HotfixEntity
{
public WWW www;
......
fileFormatVersion: 2
guid: 4d789ae4ba23a73469b228352499a1d0
timeCreated: 1487217220
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
using System;
using UnityEngine;
namespace Model
namespace Hotfix
{
public static class GameObjectHelper
{
......
......@@ -9,12 +9,12 @@ namespace Hotfix
{
try
{
Game.Scene.AddComponent<ResourcesComponent>();
Game.Scene.AddComponent<UIComponent>();
Game.Scene.AddComponent<UnitComponent>();
Game.Scene.AddComponent<MessageDispatherComponent, AppType>(AppType.Client);
Game.Scene.AddComponent<NetOuterComponent>();
Game.Scene.GetComponent<EventComponent>().Run(EventIdType.InitSceneStart);
Hotfix.Scene.AddComponent<ResourcesComponent>();
Hotfix.Scene.AddComponent<UIComponent>();
Hotfix.Scene.AddComponent<UnitComponent>();
Hotfix.Scene.AddComponent<MessageDispatherComponent, AppType>(AppType.Client);
Hotfix.Scene.AddComponent<NetOuterComponent>();
Hotfix.Scene.GetComponent<EventComponent>().Run(EventIdType.InitSceneStart);
}
catch (Exception e)
{
......@@ -26,7 +26,7 @@ namespace Hotfix
{
try
{
Game.EntityEventManager.Update();
ObjectEvents.Instance.Update();
}
catch (Exception e)
{
......@@ -36,7 +36,7 @@ namespace Hotfix
private static void OnApplicationQuit()
{
Game.CloseScene();
Hotfix.Close();
}
}
}
\ No newline at end of file
fileFormatVersion: 2
guid: 596cc447d1a588e47b6105622727b588
timeCreated: 1477040243
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
......@@ -6,18 +6,18 @@ namespace Hotfix
{
protected Disposer(): base(IdGenerater.GenerateId())
{
Game.EntityEventManager.Add(this);
ObjectEvents.Instance.Add(this);
}
protected Disposer(long id): base(id)
{
Game.EntityEventManager.Add(this);
ObjectEvents.Instance.Add(this);
}
public override void Dispose()
{
this.Id = 0;
Game.EntityEventManager.Remove(this);
ObjectEvents.Instance.Remove(this);
}
}
}
\ No newline at end of file
fileFormatVersion: 2
guid: 785b1815942ba374b9cea238401cd506
timeCreated: 1479695006
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: 5bb5f664ee9566b40a7fad24bab21d2f
timeCreated: 1474942922
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: eb0dcb40ecd1ec948b3eb4720cfa739f
timeCreated: 1474942922
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: 9053a11c1bcabe04d8a2b53044ae0682
timeCreated: 1479715122
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: a8f6aec364235394fa87b26ff5b476cf
timeCreated: 1474944344
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
......@@ -2,27 +2,26 @@
namespace Hotfix
{
[ILBinding]
[BsonKnownTypes(typeof (AConfigComponent))]
public abstract class Component: Disposer
public abstract class HotfixComponent: Disposer
{
[BsonIgnore]
public Entity Owner { get; set; }
public HotfixEntity Owner { get; set; }
public T GetOwner<T>() where T : Entity
public T GetOwner<T>() where T : HotfixEntity
{
return this.Owner as T;
}
protected Component()
protected HotfixComponent()
{
}
protected Component(long id): base(id)
protected HotfixComponent(long id): base(id)
{
}
public T GetComponent<T>() where T : Component
public T GetComponent<T>() where T : HotfixComponent
{
return this.Owner.GetComponent<T>();
}
......
......@@ -5,26 +5,25 @@ using Model;
namespace Hotfix
{
[ILBinding]
public class Entity: Disposer
public class HotfixEntity: Disposer
{
public EntityType Type { get; set; }
private HashSet<Component> components = new HashSet<Component>();
private HashSet<HotfixComponent> components = new HashSet<HotfixComponent>();
private Dictionary<Type, Component> componentDict = new Dictionary<Type, Component>();
private readonly Dictionary<Type, HotfixComponent> componentDict = new Dictionary<Type, HotfixComponent>();
protected Entity()
protected HotfixEntity()
{
this.Type = EntityType.None;
}
protected Entity(EntityType entityType)
protected HotfixEntity(EntityType entityType)
{
this.Type = entityType;
}
protected Entity(long id, EntityType entityType): base(id)
protected HotfixEntity(long id, EntityType entityType): base(id)
{
this.Type = entityType;
}
......@@ -38,7 +37,7 @@ namespace Hotfix
base.Dispose();
foreach (Component component in this.GetComponents())
foreach (HotfixComponent component in this.GetComponents())
{
try
{
......@@ -51,7 +50,7 @@ namespace Hotfix
}
}
public K AddComponent<K>() where K : Component, new()
public K AddComponent<K>() where K : HotfixComponent, new()
{
K component = (K) Activator.CreateInstance(typeof (K));
component.Owner = this;
......@@ -61,7 +60,7 @@ namespace Hotfix
}
if (this.components == null)
{
this.components = new HashSet<Component>();
this.components = new HashSet<HotfixComponent>();
}
this.components.Add(component);
this.componentDict.Add(component.GetType(), component);
......@@ -70,7 +69,7 @@ namespace Hotfix
return component;
}
public K AddComponent<K, P1>(P1 p1) where K : Component, new()
public K AddComponent<K, P1>(P1 p1) where K : HotfixComponent, new()
{
K component = (K) Activator.CreateInstance(typeof (K));
component.Owner = this;
......@@ -82,7 +81,7 @@ namespace Hotfix
if (this.components == null)
{
this.components = new HashSet<Component>();
this.components = new HashSet<HotfixComponent>();
}
this.components.Add(component);
......@@ -92,7 +91,7 @@ namespace Hotfix
return component;
}
public K AddComponent<K, P1, P2>(P1 p1, P2 p2) where K : Component, new()
public K AddComponent<K, P1, P2>(P1 p1, P2 p2) where K : HotfixComponent, new()
{
K component = (K) Activator.CreateInstance(typeof (K));
component.Owner = this;
......@@ -104,7 +103,7 @@ namespace Hotfix
if (this.components == null)
{
this.components = new HashSet<Component>();
this.components = new HashSet<HotfixComponent>();
}
this.components.Add(component);
......@@ -114,7 +113,7 @@ namespace Hotfix
return component;
}
public K AddComponent<K, P1, P2, P3>(P1 p1, P2 p2, P3 p3) where K : Component, new()
public K AddComponent<K, P1, P2, P3>(P1 p1, P2 p2, P3 p3) where K : HotfixComponent, new()
{
K component = (K) Activator.CreateInstance(typeof (K));
component.Owner = this;
......@@ -126,7 +125,7 @@ namespace Hotfix
if (this.components == null)
{
this.components = new HashSet<Component>();
this.components = new HashSet<HotfixComponent>();
}
this.components.Add(component);
......@@ -136,9 +135,9 @@ namespace Hotfix
return component;
}
public void RemoveComponent<K>() where K : Component
public void RemoveComponent<K>() where K : HotfixComponent
{
Component component;
HotfixComponent component;
if (!this.componentDict.TryGetValue(typeof (K), out component))
{
return;
......@@ -155,7 +154,7 @@ namespace Hotfix
public void RemoveComponent(Type type)
{
Component component;
HotfixComponent component;
if (!this.componentDict.TryGetValue(type, out component))
{
return;
......@@ -170,9 +169,9 @@ namespace Hotfix
component.Dispose();
}
public K GetComponent<K>() where K : Component
public K GetComponent<K>() where K : HotfixComponent
{
Component component;
HotfixComponent component;
if (!this.componentDict.TryGetValue(typeof (K), out component))
{
return default(K);
......@@ -180,7 +179,7 @@ namespace Hotfix
return (K) component;
}
public Component[] GetComponents()
public HotfixComponent[] GetComponents()
{
return components.ToArray();
}
......
fileFormatVersion: 2
guid: 75b4e4c782482aa4d87675b28e60ca49
timeCreated: 1474942922
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
......@@ -2,14 +2,24 @@
namespace Hotfix
{
public sealed class EntityEventManager
public sealed class ObjectEvents
{
private static ObjectEvents instance;
public Queue<Disposer> adds = new Queue<Disposer>();
public Queue<Disposer> removes = new Queue<Disposer>();
public HashSet<IUpdate> updates = new HashSet<IUpdate>();
public HashSet<ILoad> loads = new HashSet<ILoad>();
public static ObjectEvents Instance
{
get
{
return instance ?? (instance = new ObjectEvents());
}
}
public void Add(Disposer disposer)
{
adds.Enqueue(disposer);
......
fileFormatVersion: 2
guid: 951ed8c88c565c74cabe30a086b0863e
timeCreated: 1478516097
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: 534309c977d7aac4faa5eb0e0638e6d2
timeCreated: 1487316838
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: 342b768b2c60a114eb1177f10bee8f75
timeCreated: 1474944857
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: 07555aa583186e143a45759d14be8412
timeCreated: 1487325223
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: 4bcd750c3779547449f9cb1a567f7ee1
timeCreated: 1486638218
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: 6dbeba34767c3b64fbdef320fc34d2f3
timeCreated: 1487325223
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: 44cebd75ae43115438d62f2cdf56cc63
timeCreated: 1478510684
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: 8ef788fbad31e454bb0cb2b5c5c246c5
timeCreated: 1478511150
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: 020f0b438a1168b45af68b7c653480cf
timeCreated: 1487298529
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: 7ba4eddc4124ae740bd2d0c3208e5541
timeCreated: 1476674408
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: ea801aa284d9faa46bd1fb6751f50c4d
timeCreated: 1478510684
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: 479c1a787b2701241930fa99fdc67183
timeCreated: 1475915395
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
......@@ -6,7 +6,7 @@ using UnityEngine.UI;
namespace Hotfix
{
[EntityEvent(EntityEventId.UILobbyComponent)]
public class UILobbyComponent: Component, IAwake
public class UILobbyComponent: HotfixComponent, IAwake
{
public void Awake()
{
......@@ -22,9 +22,9 @@ namespace Hotfix
Session session = null;
try
{
session = Game.Scene.GetComponent<NetOuterComponent>().Create("127.0.0.1:10001");
session = Hotfix.Scene.GetComponent<NetOuterComponent>().Create("127.0.0.1:10001");
R2C_Login r2CLogin = await session.Call<C2R_Login, R2C_Login>(new C2R_Login() { Account = "abcdef", Password = "111111" });
Session gateSession = Game.Scene.GetComponent<NetOuterComponent>().Create(r2CLogin.Address);
Session gateSession = Hotfix.Scene.GetComponent<NetOuterComponent>().Create(r2CLogin.Address);
G2C_LoginGate g2CLoginGate = await gateSession.Call<C2G_LoginGate, G2C_LoginGate>(new C2G_LoginGate(r2CLogin.Key));
Log.Info("登陆gate成功!");
......
......@@ -7,7 +7,7 @@ namespace Hotfix
{
public void Run()
{
UI ui = Game.Scene.GetComponent<UIComponent>().Create(UIType.Lobby);
UI ui = Hotfix.Scene.GetComponent<UIComponent>().Create(UIType.Lobby);
}
}
}
......@@ -102,7 +102,7 @@
<Compile Include="Entity\AssetBundleLoaderAsync.cs" />
<Compile Include="Entity\Config\BuffConfig.cs" />
<Compile Include="Entity\Config\StartConfig.cs" />
<Compile Include="Entity\Game.cs" />
<Compile Include="Entity\Hotfix.cs" />
<Compile Include="Entity\Message\InnerMessage.cs" />
<Compile Include="Entity\Message\Opcode.cs" />
<Compile Include="Entity\Message\OuterMessage.cs" />
......@@ -127,15 +127,14 @@
<Compile Include="Message\MessageInfo.cs" />
<Compile Include="Message\OpcodeHelper.cs" />
<Compile Include="Message\RpcException.cs" />
<Compile Include="Object\Component.cs" />
<Compile Include="Object\HotfixComponent.cs" />
<Compile Include="Object\Disposer.cs" />
<Compile Include="Object\Entity.cs" />
<Compile Include="Object\HotfixEntity.cs" />
<Compile Include="Object\EntityEventAttribute.cs" />
<Compile Include="Object\EntityEventManager.cs" />
<Compile Include="Object\ObjectEvents.cs" />
<Compile Include="Object\EntityType.cs" />
<Compile Include="Object\Object.cs" />
<Compile Include="Other\EntityEventId.cs" />
<Compile Include="Other\ILBindingAttribute.cs" />
<Compile Include="Other\IUIFactory.cs" />
<Compile Include="Other\LayerNames.cs" />
<Compile Include="Other\UIFactoryAttribute.cs" />
......
......@@ -16,7 +16,7 @@
<CompilerResponseFile></CompilerResponseFile>
<UnityProjectType>Editor:5</UnityProjectType>
<UnityBuildTarget>StandaloneWindows64:19</UnityBuildTarget>
<UnityVersion>2017.1.0b7</UnityVersion>
<UnityVersion>2017.1.0b8</UnityVersion>
<RootNamespace></RootNamespace>
<LangVersion>6</LangVersion>
</PropertyGroup>
......@@ -107,24 +107,12 @@
<Reference Include="UnityEditor.Graphs">
<HintPath>Library\UnityAssemblies\UnityEditor.Graphs.dll</HintPath>
</Reference>
<Reference Include="UnityEditor.Android.Extensions">
<HintPath>Library\UnityAssemblies\UnityEditor.Android.Extensions.dll</HintPath>
</Reference>
<Reference Include="UnityEditor.iOS.Extensions">
<HintPath>Library\UnityAssemblies\UnityEditor.iOS.Extensions.dll</HintPath>
</Reference>
<Reference Include="UnityEditor.WindowsStandalone.Extensions">
<HintPath>Library\UnityAssemblies\UnityEditor.WindowsStandalone.Extensions.dll</HintPath>
</Reference>
<Reference Include="SyntaxTree.VisualStudio.Unity.Bridge">
<HintPath>Library\UnityAssemblies\SyntaxTree.VisualStudio.Unity.Bridge.dll</HintPath>
</Reference>
<Reference Include="UnityEditor.iOS.Extensions.Xcode">
<HintPath>Library\UnityAssemblies\UnityEditor.iOS.Extensions.Xcode.dll</HintPath>
</Reference>
<Reference Include="UnityEditor.iOS.Extensions.Common">
<HintPath>Library\UnityAssemblies\UnityEditor.iOS.Extensions.Common.dll</HintPath>
</Reference>
<Reference Include="ICSharpCode.SharpZipLib">
<HintPath>Assets\Plugins\ICSharpCode.SharpZipLib.dll</HintPath>
</Reference>
......
......@@ -12,15 +12,12 @@
<ProjectTypeGuids>{E097FAD1-6243-4DAD-9C02-E9B9EFC3FFC1};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<TargetFrameworkIdentifier>.NETFramework</TargetFrameworkIdentifier>
<TargetFrameworkVersion>v4.6</TargetFrameworkVersion>
<TargetFrameworkProfile>
</TargetFrameworkProfile>
<CompilerResponseFile>
</CompilerResponseFile>
<TargetFrameworkProfile></TargetFrameworkProfile>
<CompilerResponseFile></CompilerResponseFile>
<UnityProjectType>GamePlugins:3</UnityProjectType>
<UnityBuildTarget>StandaloneWindows64:19</UnityBuildTarget>
<UnityVersion>2017.1.0b7</UnityVersion>
<RootNamespace>
</RootNamespace>
<UnityVersion>2017.1.0b8</UnityVersion>
<RootNamespace></RootNamespace>
<LangVersion>6</LangVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
......@@ -77,12 +74,6 @@
<Reference Include="UnityEngine.HoloLens">
<HintPath>Library\UnityAssemblies\UnityEngine.HoloLens.dll</HintPath>
</Reference>
<Reference Include="UnityEditor.iOS.Extensions.Xcode">
<HintPath>Library\UnityAssemblies\UnityEditor.iOS.Extensions.Xcode.dll</HintPath>
</Reference>
<Reference Include="UnityEditor.iOS.Extensions.Common">
<HintPath>Library\UnityAssemblies\UnityEditor.iOS.Extensions.Common.dll</HintPath>
</Reference>
<Reference Include="ICSharpCode.SharpZipLib">
<HintPath>Assets\Plugins\ICSharpCode.SharpZipLib.dll</HintPath>
</Reference>
......@@ -461,4 +452,4 @@
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Target Name="GenerateTargetFrameworkMonikerAttribute" />
</Project>
\ No newline at end of file
</Project>
......@@ -12,12 +12,15 @@
<ProjectTypeGuids>{E097FAD1-6243-4DAD-9C02-E9B9EFC3FFC1};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<TargetFrameworkIdentifier>.NETFramework</TargetFrameworkIdentifier>
<TargetFrameworkVersion>v4.6</TargetFrameworkVersion>
<TargetFrameworkProfile></TargetFrameworkProfile>
<CompilerResponseFile></CompilerResponseFile>
<TargetFrameworkProfile>
</TargetFrameworkProfile>
<CompilerResponseFile>
</CompilerResponseFile>
<UnityProjectType>Game:1</UnityProjectType>
<UnityBuildTarget>StandaloneWindows64:19</UnityBuildTarget>
<UnityVersion>2017.1.0b7</UnityVersion>
<RootNamespace></RootNamespace>
<UnityVersion>2017.1.0b8</UnityVersion>
<RootNamespace>
</RootNamespace>
<LangVersion>6</LangVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
......@@ -74,12 +77,6 @@
<Reference Include="UnityEngine.HoloLens">
<HintPath>Library\UnityAssemblies\UnityEngine.HoloLens.dll</HintPath>
</Reference>
<Reference Include="UnityEditor.iOS.Extensions.Xcode">
<HintPath>Library\UnityAssemblies\UnityEditor.iOS.Extensions.Xcode.dll</HintPath>
</Reference>
<Reference Include="UnityEditor.iOS.Extensions.Common">
<HintPath>Library\UnityAssemblies\UnityEditor.iOS.Extensions.Common.dll</HintPath>
</Reference>
<Reference Include="ICSharpCode.SharpZipLib">
<HintPath>Assets\Plugins\ICSharpCode.SharpZipLib.dll</HintPath>
</Reference>
......@@ -379,6 +376,7 @@
<Compile Include="Assets\Scripts\IL\IAsyncStateMachineAdaptor.cs" />
<Compile Include="Assets\Scripts\IL\IDisposableAdaptor.cs" />
<Compile Include="Assets\Scripts\IL\ILAdapterAttribute.cs" />
<Compile Include="Assets\Scripts\IL\ILBindingAttribute.cs" />
<Compile Include="Assets\Scripts\IL\ILRedirection.cs" />
<Compile Include="Assets\Scripts\ILMethod.cs" />
<Compile Include="Assets\Scripts\Init.cs" />
......@@ -387,4 +385,4 @@
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Target Name="GenerateTargetFrameworkMonikerAttribute" />
</Project>
</Project>
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册