internal override object InvokeGet(InstanceMap instanceMap) { T value = default; InvokeGetter(instanceMap, ref value); return(value); }
/// <summary> /// Constructs and initializes a new controller /// </summary> /// <remarks>This <c>IController</c> implementation is a Multiton, /// so you should not call the constructor /// directly, but instead call the static Multiton /// Factory method <c>Controller.getInstance(multitonKey, key => new Controller(key))</c> /// </remarks> /// <param name="key">Key of controller</param> public Controller(string key) { multitonKey = key; InstanceMap.TryAdd(multitonKey, new Lazy <IController>(this)); commandMap = new ConcurrentDictionary <string, Func <ICommand> >(); InitializeController(); }
/// <summary> /// Constructs and initializes a new model /// </summary> /// <remarks> /// <para> /// This <c>IModel</c> implementation is a Multiton, /// so you should not call the constructor /// directly, but instead call the static Multiton /// Factory method <c>Model.getInstance(multitonKey, key => new Model(key))</c> /// </para> /// </remarks> /// <param name="key">Key of model</param> public Model(string key) { multitonKey = key; InstanceMap.TryAdd(key, new Lazy <IModel>(this)); proxyMap = new ConcurrentDictionary <string, IProxy>(); InitializeModel(); }
public instance_forge_of_souls_InstanceScript(InstanceMap map) : base(map) { SetHeaders("FOS"); SetBossNumber(2); teamInInstance = 0; }
private Geom(Space space, dGeomID ptr) { this.space = space; this.ptr = ptr; this.id = InstanceMap.Add(this); ode.dGeomSetData(ptr, (IntPtr)id); }
internal void Remove(InstanceInfo info) { if (!InstanceMap.TryRemove(info.InstanceId, out var removed)) { InstanceMap.TryRemove(info.HostName, out removed); } }
public bool InvokeSetter(InstanceMap instanceMap, T newValue) { if (!checkFunc(newValue)) { throw new ArgumentOutOfRangeException($"Value {newValue} invalid"); } return(true); }
public instance_azjol_nerub_InstanceScript(InstanceMap map) : base(map) { SetHeaders(ANInstanceMisc.DataHeader); SetBossNumber(ANInstanceMisc.EncounterCount); LoadBossBoundaries(ANInstanceMisc.boundaries); LoadDoorData(ANInstanceMisc.doorData); LoadObjectData(ANInstanceMisc.creatureData, ANInstanceMisc.gameobjectData); }
public instance_karazhan_InstanceMapScript(InstanceMap map) : base(map) { SetHeaders("KZ"); // 1 - OZ, 2 - HOOD, 3 - RAJ, this never gets altered. m_uiOperaEvent = RandomHelper.URand(1, 3); m_uiOzDeathCount = 0; }
/// <summary> /// Constructs and initializes a new view /// </summary> /// <remarks> /// <para> /// This <c>IView</c> implementation is a Multiton, /// so you should not call the constructor /// directly, but instead call the static Multiton /// Factory method <c>View.getInstance(multitonKey, key => new View(key))</c> /// </para> /// </remarks> /// <param name="key">Key of view</param> public View(string key) { multitonKey = key; InstanceMap.TryAdd(key, new Lazy <IView>(() => this)); mediatorMap = new ConcurrentDictionary <string, IMediator>(); observerMap = new ConcurrentDictionary <string, IList <IObserver> >(); InitializeView(); }
public Joint(World world, dJointID ptr, OdeJoint.JointType type) { this.world = world; this.type = type; this.ptr = ptr; id = InstanceMap.Add(this); ode.dJointSetData(ptr, (IntPtr)id); }
public bool InvokeGetter(InstanceMap instanceMap, ref T returnValue) { if (getMethod != null) { returnValue = (T)getMethod.Invoke(instanceMap?.GetLocal(parameter), Array.Empty <object>()); } return(true); }
public Body(World world) { this.world = world; world.AddBody(this); ptr = ode.dBodyCreate(world.ptr); id = InstanceMap.Add(this); ode.dBodySetData(ptr, (IntPtr)id); }
public MasterInterceptor(InstanceMap instanceMap, params IEnumerable <InterceptorMap>[] interceptors) { this.instanceMap = instanceMap; foreach ((MethodInfo memberInfo, IGeneralInterceptor interceptor) in interceptors.SelectMany(maps => maps)) { interceptorsMap.Add(memberInfo, interceptor); } objectProviderHandler = new ObjectProviderHandler(interceptorsMap.Values); }
public instance_pit_of_saron_InstanceScript(InstanceMap map) : base(map) { SetHeaders("POS"); SetBossNumber(3); LoadDoorData(Misc.Doors); _teamInInstance = 0; _cavernActive = 0; _shardsHit = 0; }
public instance_trial_of_the_champion_InstanceMapScript(InstanceMap map) : base(map) { SetHeaders("TC"); uiMovementDone = 0; uiGrandChampionsDeaths = 0; uiArgentSoldierDeaths = 0; //bDone = false; }
public bool InvokeGetter(InstanceMap instanceMap, ref T returnValue) { if (valueSet) { return(true); } returnValue = value; return(false); }
public bool InvokeSetter(InstanceMap instanceMap, T newValue) { if (value.Equals(newValue)) { return(true); } errorHandler(newValue); return(false); }
public void Invoke(InstanceMap instanceMap, ref object returnValue, object[] parameters, Type[] genericArguments, MethodInfo methodInfo) { if (!PropertyDefinition.IsMatch(methodInfo)) { throw new NotImplementedException(); } InvokeIntercept(instanceMap, ref returnValue, parameters); }
public bool InvokeGetter(InstanceMap instanceMap, ref T returnValue) { if (valueSet) { return(true); } returnValue = (T)instanceMap?.GetLocal(parameter); return(false); }
public instance_karazhan_InstanceMapScript(InstanceMap map) : base(map) { SetHeaders("KZ"); SetBossNumber(karazhanConst.MaxEncounter); // 1 - OZ, 2 - HOOD, 3 - RAJ, this never gets altered. OperaEvent = RandomHelper.URand(1, 3); OzDeathCount = 0; OptionalBossCount = 0; }
public static T GetInstanceAI <T>(WorldObject obj) where T : class { InstanceMap instance = obj.GetMap().ToInstanceMap(); if (instance != null && instance.GetInstanceScript() != null) { return((T)Activator.CreateInstance(typeof(T), new object[] { obj })); } return(null); }
public instance_gundrak_InstanceMapScript(InstanceMap map) : base(map) { SetHeaders("GD"); SetBossNumber(5); LoadDoorData(GDInstanceMisc.doorData); LoadObjectData(GDInstanceMisc.creatureData, GDInstanceMisc.gameObjectData); SladRanStatueState = GameObjectState.Active; DrakkariColossusStatueState = GameObjectState.Active; MoorabiStatueState = GameObjectState.Active; }
bool InstanceHasScript(WorldObject obj, string scriptName) { InstanceMap instance = obj.GetMap().ToInstanceMap(); if (instance != null) { return(instance.GetScriptName() == scriptName); } return(false); }
public instance_ahnkahet_InstanceScript(InstanceMap map) : base(map) { SetHeaders("AK"); SetBossNumber(DataTypes.HeraldVolazj + 1); LoadDoorData(new DoorData(GameObjectIds.PrinceTaldaramGate, DataTypes.PrinceTaldaram, DoorType.Passage)); SwitchTrigger = 0; SpheresState[0] = 0; SpheresState[1] = 0; }
public bool InvokeSetter(InstanceMap instanceMap, T newValue) { foreach (IPropertyDefinition <T> definition in definitions) { if (!definition.InvokeSetter(instanceMap, newValue)) { return(false); } } return(true); }
/// <summary> /// Remove a Core. /// </summary> /// <remarks> /// <para> /// Remove the Model, View, Controller and Facade /// instances for the given key. /// </para> /// </remarks> /// <param name="key">multitonKey of the Core to remove</param> public static void RemoveCore(string key) { if (InstanceMap.TryGetValue(key, out _) == false) { return; } Model.RemoveModel(key); View.RemoveView(key); Controller.RemoveController(key); InstanceMap.TryRemove(key, out _); }
public bool InvokeSetter(InstanceMap instanceMap, T newValue) { if (newValue.CompareTo(minimum) < 0) { throw new ArgumentOutOfRangeException(nameof(newValue), "Value too low"); } if (newValue.CompareTo(maximum) > 0) { throw new ArgumentOutOfRangeException(nameof(newValue), "Value too high"); } return(true); }
public static T GetInstanceAI <T>(WorldObject obj, string scriptName) where T : class { InstanceMap instance = obj.GetMap().ToInstanceMap(); if (instance != null && instance.GetInstanceScript() != null) { if (instance.GetScriptName() == scriptName) { return((T)Activator.CreateInstance(typeof(T), obj)); } } return(null); }
public static T GetInstanceAI <T>(WorldObject obj, string scriptName) where T : class { InstanceMap instance = obj.GetMap().ToInstanceMap(); if (instance != null && instance.GetInstanceScript() != null) { if (instance.GetScriptId() == Global.ObjectMgr.GetScriptId(scriptName)) { return((T)Activator.CreateInstance(typeof(T), new object[] { obj })); } } return(null); }