DayZ 1.30
DayZ Explorer by KGB
 
Загрузка...
Поиск...
Не найдено

◆ GetRequester() [2/2]

static PPERequesterBase PPERequesterRegistrations::GetRequester ( typename type )
staticprivate

Returns an instance (singleton) of a requester based on typename.

Аргументы
typetypename Typename of the requester.
Возвращает
PPERequesterBase Requester singleton.
Заметки
Returns only already registered instances, does not register anything.

См. определение в файле PPERequesterBank.c строка 338

342{
344 private static bool m_Initialized = false;
345
346 static int m_lastID = -1;
347
348 static const int INVALID = -1;
349 static const int REQ_INVENTORYBLUR = RegisterRequester(PPERequester_InventoryBlur);
350 static const int REQ_CONTROLLERDISCONNECT = RegisterRequester(PPERequester_ControllerDisconnectBlur);
351 static const int REQ_GLASSESSPORTBLACK = RegisterRequester(PPERequester_GlassesSportBlack);
352 static const int REQ_GLASSESSPORTBLUE = RegisterRequester(PPERequester_GlassesSportBlue);
353 static const int REQ_GLASSESSPORTGREEN = RegisterRequester(PPERequester_GlassesSportGreen);
354 static const int REQ_GLASSESSPORTORANGE = RegisterRequester(PPERequester_GlassesSportOrange);
355 static const int REQ_GLASSESAVIATOR = RegisterRequester(PPERequester_GlassesAviator);
356 static const int REQ_GLASSESDESIGNER = RegisterRequester(PPERequester_GlassesDesignerBlack);
357 static const int REQ_GLASSESTACTICAL = RegisterRequester(PPERequester_TacticalGoggles);
358 static const int REQ_MOTOHELMETBLACK = RegisterRequester(PPERequester_MotoHelmetBlack);
359 static const int REQ_GLASSESWELDING = RegisterRequester(PPERequester_WeldingMask);
360 static const int REQ_CAMERANV = RegisterRequester(PPERequester_CameraNV);
361 static const int REQ_CAMERAADS = RegisterRequester(PPERequester_CameraADS);
362 static const int REQ_BLOODLOSS = RegisterRequester(PPERequester_BloodLoss);
363 static const int REQ_DEATHEFFECTS = RegisterRequester(PPERequester_DeathDarkening);
364 static const int REQ_UNCONEFFECTS = RegisterRequester(PPERequester_UnconEffects);
365 static const int REQ_TUNELVISSION = RegisterRequester(PPERequester_TunnelVisionEffects);
366 static const int REQ_BURLAPSACK = RegisterRequester(PPERequester_BurlapSackEffects);
367 static const int REQ_INTROCHROMABB = RegisterRequester(PPERequester_IntroChromAbb);
368 static const int REQ_FEVEREFFECTS = RegisterRequester(PPERequester_FeverEffects);
369 static const int REQ_FLASHBANGEFFECTS = RegisterRequester(PPERequester_FlashbangEffects);
370 static const int REQ_SHOCKHITEFFECTS = RegisterRequester(PPERequester_ShockHitReaction);
371 static const int REQ_HEALTHHITEFFECTS = RegisterRequester(PPERequester_HealthHitReaction);
372 static const int REQ_MENUEFFECTS = RegisterRequester(PPERequester_MenuEffects);
373 static const int REQ_CONTROLLERBLUR = RegisterRequester(PPERequester_ControlsBlur);
374 static const int REQ_SERVERBROWSEREFFECTS = RegisterRequester(PPERequester_ServerBrowserBlur);
375 static const int REQ_TUTORIALEFFECTS = RegisterRequester(PPERequester_TutorialMenu);
376 static const int REQ_CONTAMINATEDAREA = RegisterRequester(PPERequester_ContaminatedAreaTint);
377 static const int REQ_SPOOKYAREA = RegisterRequester(PPERequester_SpookyAreaTint);
378 static const int REQ_PAINBLUR = RegisterRequester(PPERequester_PainBlur);
379 static const int REQ_UNDERGROUND = RegisterRequester(PPERUndergroundAcco);
380 static const int REQ_DROWNING = RegisterRequester(PPERequester_Drowning);
381 //static const int REQ_HMP_LVL3 = RegisterRequester(PPERequester_HeavyMetalPoisoning_3);
382 static const int REQ_HMP_GHOST = RegisterRequester(PPERequester_HMPGhosts);
383 static const int REQ_LATENCYBLUR = RegisterRequester(PPERequester_LatencyBlur);
384 static const int REQ_FEEDBACKBLUR = RegisterRequester(PPERequester_FeedbackBlur);
387
388 private static ref PPERequesterRegistrations m_Registrations; //more registrations to be placed here
389
390 static void Init()
391 {
393
394 if (!m_Instances)
396
397 m_Initialized = true;
398 }
399
400 static void Cleanup()
401 {
402 if (m_Initialized)
403 {
404 delete m_Registrations;
405 m_Instances.Clear();
406 }
407 }
408
415 static PPERequesterBase GetRequester(typename type)
416 {
417 if (!type)
418 {
419 Error("Requested type is NULL!");
420 return null;
421 }
422
423 PPERequesterBase temp;
425 for (int i = 0; i < m_Instances.Count(); i++)
426 {
427 temp = m_Instances.GetElement(i);
428 if (temp.Type() == type)
429 {
430 Class.CastTo(ret,temp);
431 break;
432 }
433 }
434
435 if (!ret)
436 {
437 Debug.Log("'" + type.ToString() + "' not found in bank! Register first in 'RegisterRequester' method.");
438 }
439 return ret;
440 }
441
448 static PPERequesterBase GetRequester(int index)
449 {
450 PPERequesterBase ret = m_Instances.Get(index);
451
452 if (!ret)
453 {
454 Debug.Log("Requester idx '" + index + "' not found in bank! Register first in 'RegisterRequester' method.");
455 }
456 return ret;
457 }
458
465 static int GetRequesterID(typename type)
466 {
467 int ret = -1;
468 PPERequesterBase temp;
469
470 for (int i = 0; i < m_Instances.Count(); i++)
471 {
472 temp = m_Instances.GetElement(i);
473 if (temp.Type() == type)
474 {
475 ret = m_Instances.GetKey(i);
476 }
477 }
478
479 if ( ret == -1 )
480 {
481 Debug.Log("Requester instance of the '" + type.ToString() + "' type not found in bank! Register first in 'RegisterRequester' method.");
482 }
483 return ret;
484 }
485
491 static typename GetRequesterTypename(int index)
492 {
493 typename ret;
494 PPERequesterBase temp = m_Instances.Get(index);
495 if ( !temp )
496 {
497 Debug.Log("No requester exists under idx '" + index + "' in bank! Register first in 'RegisterRequester' method.");
498 }
499 else
500 {
501 ret = temp.Type();
502 }
503
504 return ret;
505 }
506
511 static int RegisterRequester(typename type)
512 {
513 if (!m_Instances)
515
516 if ( GetRequester(type) != null )
517 {
518 //Error("Trying to register an already existing requester type: " + type);
519 Debug.Log("Trying to register an already existing requester type: " + type);
520 return -1;
521 }
522
523 m_lastID++;
524
526 req = PPERequesterBase.Cast(type.Spawn());
528 m_Instances.Set(m_lastID,req);
529
530 return m_lastID;
531 }
532
534 static bool VerifyRequester(PPERequesterBase req)
535 {
536 if (!m_Initialized) //initial registrations are fair game
537 {
538 return true;
539 }
540
541 PPERequesterBase temp;
542 for (int i = 0; i < m_Instances.Count(); i++)
543 {
544 temp = m_Instances.GetElement(i);
545 if (temp == req)
546 {
547 return true;
548 }
549 }
550
551 //Error("Requester instance " + req + " not valid! Please use registered instances from PPERequesterBank.");
552 Debug.Log("Requester instance '" + req + "' not valid! Please use registered instances from PPERequesterBank.");
553 return false;
554 }
555
557 static bool IsRequesterRunning(typename type)
558 {
559 PPERequesterBase req = GetRequester(type);
560 if (req)
561 {
562 return req.IsRequesterRunning();
563 }
564 else
565 {
566 Debug.Log("'" + type.ToString() + "' not found in bank! Register first in 'RegisterRequester' method.");
567 }
568
569 return false;
570 }
571
573 static bool IsRequesterRunning(int index)
574 {
575 PPERequesterBase req = GetRequester(index);
576 if (req)
577 {
578 return req.IsRequesterRunning();
579 }
580 else
581 {
582 Debug.Log("Requester idx '" + index + "' not found in bank! Register first in 'RegisterRequester' method.");
583 }
584
585 return false;
586 }
587
588 /*static void DumpInstances()
589 {
590 Print("DumpInstances");
591 for (int i = 0; i < m_Instances.Count(); i++)
592 {
593 Print(m_Instances.GetKey(i));
594 Print(m_Instances.GetElement(i));
595 }
596 }*/
597}
598
601{
603 {
605 }
606
607 protected void RegisterAdditionalRequesters()
608 {
609 //PPERequesterBank.RegisterRequester(TestReq);
610 }
611}
612
613/*modded class PPERequesterRegistrations extends Managed
614{
615 override protected void RegisterAdditionalRequesters()
616 {
617 PPERequesterBank.RegisterRequester(TestReq2);
618 }
619}
bool IsRequesterRunning()
Определения PPERequestPlatformsBase.c:486
static const int REQ_HEALTHHITEFFECTS
Определения PPERequesterBank.c:294
static const int REQ_GLASSESTACTICAL
Определения PPERequesterBank.c:280
static const int REQ_CONTROLLERDISCONNECT
Определения PPERequesterBank.c:273
static const int REQ_LATENCYBLUR
Определения PPERequesterBank.c:306
static const int REQ_GLASSESSPORTBLACK
Определения PPERequesterBank.c:274
void RegisterAdditionalRequesters()
Определения PPERequesterBank.c:270
static ref map< int, ref PPERequesterBase > m_Instances
Определения PPERequesterBank.c:266
static const int REQ_FEEDBACKBLUR
Определения PPERequesterBank.c:307
static const int REQ_INTROCHROMABB
Определения PPERequesterBank.c:290
static const int REQ_CONTROLLERBLUR
Определения PPERequesterBank.c:296
static const int REQ_GLASSESDESIGNER
Определения PPERequesterBank.c:279
class PPERequesterBank extends Managed PPERequesterRegistrations()
Mod this, if you wish to register custom requesters inside 'RegisterAdditionalRequesters' override.
Определения PPERequesterBank.c:265
static const int REQ_BURLAPSACK
Определения PPERequesterBank.c:289
static const int REQ_INVENTORYBLUR
Определения PPERequesterBank.c:272
static const int REQ_CONTAMINATEDAREA
Определения PPERequesterBank.c:299
static const int REQ_GLASSESAVIATOR
Определения PPERequesterBank.c:278
static const int REQ_MOTOHELMETBLACK
Определения PPERequesterBank.c:281
static bool VerifyRequester(PPERequesterBase req)
Verifies the instance.
Определения PPERequesterBank.c:457
static int m_lastID
Определения PPERequesterBank.c:269
static const int REQ_GLASSESSPORTORANGE
Определения PPERequesterBank.c:277
static const int REQ_CAMERANV
Определения PPERequesterBank.c:283
static const int REQ_SHOCKHITEFFECTS
Определения PPERequesterBank.c:293
static const int REQ_FEVEREFFECTS
Определения PPERequesterBank.c:291
static int RegisterRequester(typename type)
Registers new requester type.
Определения PPERequesterBank.c:434
static void Init()
Определения PPERequesterBank.c:313
static const int REQ_DROWNING
Определения PPERequesterBank.c:303
static int GetRequesterID(typename type)
Returns an ID of a requester type.
Определения PPERequesterBank.c:388
static const int REQ_TUTORIALEFFECTS
Определения PPERequesterBank.c:298
static ref PPERequesterRegistrations m_Registrations
Определения PPERequesterBank.c:311
static const int REQ_DEATHEFFECTS
Определения PPERequesterBank.c:286
static GetRequesterTypename(int index)
Returns a typename from a requester ID.
Определения PPERequesterBank.c:414
static const int REQ_SQUINT
Определения PPERequesterBank.c:308
static const int REQ_UNCONEFFECTS
Определения PPERequesterBank.c:287
static const int REQ_SANDSTORMEFFECT
Определения PPERequesterBank.c:309
static const int REQ_TUNELVISSION
Определения PPERequesterBank.c:288
static const int REQ_BLOODLOSS
Определения PPERequesterBank.c:285
static const int REQ_HMP_GHOST
Определения PPERequesterBank.c:305
static const int REQ_GLASSESWELDING
Определения PPERequesterBank.c:282
static const int REQ_PAINBLUR
Определения PPERequesterBank.c:301
static void Cleanup()
Определения PPERequesterBank.c:323
static const int REQ_FLASHBANGEFFECTS
Определения PPERequesterBank.c:292
static const int REQ_CAMERAADS
Определения PPERequesterBank.c:284
static const int REQ_MENUEFFECTS
Определения PPERequesterBank.c:295
static const int REQ_UNDERGROUND
Определения PPERequesterBank.c:302
static const int REQ_GLASSESSPORTBLUE
Определения PPERequesterBank.c:275
static const int REQ_SERVERBROWSEREFFECTS
Определения PPERequesterBank.c:297
static const int REQ_GLASSESSPORTGREEN
Определения PPERequesterBank.c:276
static const int REQ_SPOOKYAREA
Определения PPERequesterBank.c:300
bool m_Initialized
Определения UiHintPanel.c:317
PPERUndergroundAcco GetRequester()
Определения UndergroundHandlerClient.c:56
Super root of all classes in Enforce script.
Определения EnScript.c:11
static void Log(string message=LOG_DEFAULT, string plugin=LOG_DEFAULT, string author=LOG_DEFAULT, string label=LOG_DEFAULT, string entity=LOG_DEFAULT)
Prints debug message with normal prio.
Определения 3_Game/DayZ/tools/Debug.c:183
Определения 3_Game/DayZ/tools/Debug.c:2
TODO doc.
Определения EnScript.c:118
bool IsRequesterRunning()
Определения PPERequestPlatformsBase.c:53
void SetRequesterIDX(int idx)
automatically assigned by PPERequesterBank
Определения PPERequestPlatformsBase.c:59
Определения Transport.c:70
void Error(string err)
Messagebox with error message.
Определения EnDebug.c:90
static proto bool CastTo(out Class to, Class from)
Try to safely down-cast base class to child class.
@ INVALID
Invalid file.
Определения EnSystem.c:510