public ComponentImporter(Type type, ICustomTypeDescriptor typeDescriptor, IObjectConstructor constructor) : base(type) { if (typeDescriptor == null) typeDescriptor = new CustomTypeDescriptor(type); int count = 0; PropertyDescriptorCollection properties = typeDescriptor.GetProperties(); IObjectMemberImporter[] importers = new IObjectMemberImporter[properties.Count]; for (int i = 0; i < properties.Count; i++) { IServiceProvider sp = properties[i] as IServiceProvider; if (sp == null) continue; IObjectMemberImporter importer = (IObjectMemberImporter) sp.GetService(typeof(IObjectMemberImporter)); if (importer == null) continue; importers[i] = importer; count++; } _properties = properties; if (count > 0) _importers = importers; _constructor = constructor; }
void load_reduce() { object[] args = (object[])stack.pop(); IObjectConstructor constructor = (IObjectConstructor)stack.pop(); stack.add(constructor.construct(args)); }
void load_obj() { ArrayList args = stack.pop_all_since_marker(); IObjectConstructor constructor = (IObjectConstructor)args[0]; args = args.GetRange(1, args.Count - 1); object obj = constructor.construct(args.ToArray()); stack.add(obj); }
private void Start() { if (PrefabManager.GetInstance() == null) { throw new ApplicationException("can not init prefab manager"); } Instance = this; #if BUILD_SERVER GameChoice.Gamemode = GameMode.Server; #endif switch (Application.platform) { case RuntimePlatform.Android: if (GameChoice.GameMode == GameMode.Offline) { creator = new AppOfflineConstructor(); _buildAppOffline(); } break; case RuntimePlatform.LinuxPlayer: break; case RuntimePlatform.OSXEditor: case RuntimePlatform.OSXPlayer: case RuntimePlatform.WindowsPlayer: case RuntimePlatform.WindowsEditor: if (GameChoice.GameMode == GameMode.Offline) { creator = new PcOfflineConstructor(); _buildPcOffline(); } else if (GameChoice.GameMode == GameMode.Online) { creator = new OnlineClientConstructor(); _buildOnlineClient(); } else if (GameChoice.GameMode == GameMode.Server) { creator = new ServerConstructor(); _buildOnlineServer(); } break; default: throw new ArgumentException($"does not support at platform {Application.platform}"); } }
private void load_newobj_ex() { Hashtable kwargs = (Hashtable)stack.pop(); var args = (object[])stack.pop(); IObjectConstructor constructor = (IObjectConstructor)stack.pop(); if (kwargs.Count == 0) { stack.add(constructor.construct(args)); } else { throw new PickleException("newobj_ex with keyword arguments not supported"); } }
public ComponentImporter(Type type, ICustomTypeDescriptor typeDescriptor, IObjectConstructor constructor) : base(type) { if (typeDescriptor == null) { typeDescriptor = new CustomTypeDescriptor(type); } int count = 0; PropertyDescriptorCollection properties = typeDescriptor.GetProperties(); IObjectMemberImporter[] importers = new IObjectMemberImporter[properties.Count]; for (int i = 0; i < properties.Count; i++) { IServiceProvider sp = properties[i] as IServiceProvider; if (sp == null) { continue; } IObjectMemberImporter importer = (IObjectMemberImporter)sp.GetService(typeof(IObjectMemberImporter)); if (importer == null) { continue; } importers[i] = importer; count++; } _properties = properties; if (count > 0) { _importers = importers; } _constructor = constructor; }
/** * Register additional object constructors for custom classes. */ public static void registerConstructor(string module, string classname, IObjectConstructor constructor) { objectConstructors[module + "." + classname]=constructor; }
/** * Register additional object constructors for custom classes. */ public static void registerConstructor(string module, string classname, IObjectConstructor constructor) { objectConstructors[module + "." + classname] = constructor; }
public ComponentImporter(Type type, IObjectConstructor constructor) : this(type, null, constructor) { }
public TransientLifetimeManager() { _constructor = new ObjectConstructor(); }
public TransientLifetimeManager(IObjectConstructor constructor) { _constructor = constructor; }
public SingletonLifetimeManager(IObjectConstructor constructor) { _constructor = constructor; }
public SingletonLifetimeManager() { _constructor = new ObjectConstructor(); }