public void CreateTemporaryNetworkUsers() { if (!debug) { return; } GameObject meUser = LocalUserManager.GetFirstLocalUser().currentNetworkUser.gameObject; List <string> bodyNamesToCopy = new List <string>(DD2LobbySetupComponent.debug_characters); bodyNamesToCopy.RemoveAt(0); foreach (string bodyName in bodyNamesToCopy) { if (InstanceTracker.GetInstancesList <FakeNetworkUserMarker>().Count == 3) { break; } var copy = Instantiate(meUser); var nU = copy.GetComponent <NetworkUser>(); nU.SetBodyPreference(BodyCatalog.FindBodyIndex(bodyName)); nU.id = new NetworkUserId() { value = GetNetworkName(bodyName) }; copy.name = bodyName; copy.AddComponent <FakeNetworkUserMarker>(); Debug.Log($"Adding fake NetworkUser as {bodyName}"); } }
public SafeTimer() { WaitFlag = false; timeout = 0; WOTcb = HandleTimer; InstanceTracker.Add(this); }
public HTTPRequest() { this.KeepAliveHandler = new LifeTimeMonitor.LifeTimeHandler(this.KeepAliveSink); KeepAliveTimer.OnExpired += this.KeepAliveHandler; InstanceTracker.Add(this); this._PIPELINE = PIPELINE; }
private void ClearNearbyProjectiles() { float num = cfgHoustonRadius.Value; float num2 = num * num; List <ProjectileController> instancesList = InstanceTracker.GetInstancesList <ProjectileController>(); List <ProjectileController> list = new List <ProjectileController>(); int i = 0; int count = instancesList.Count; while (i < count) { ProjectileController projectileController = instancesList[i]; if (projectileController.teamFilter.teamIndex != teamIndex && (projectileController.transform.position - characterMaster.GetBody().corePosition).sqrMagnitude < num2) { list.Add(projectileController); } i++; } int j = 0; int count2 = list.Count; while (j < count2) { ProjectileController projectileController2 = list[j]; if (projectileController2) { UnityEngine.Object.Destroy(projectileController2.gameObject); } j++; } }
public object Clone() { object obj = MemberwiseClone(); InstanceTracker.Add(obj); return(obj); }
public object Clone() { object o = base.MemberwiseClone(); InstanceTracker.Add(o); return(o); }
// Token: 0x060021BC RID: 8636 RVA: 0x00091FF4 File Offset: 0x000901F4 private static void SetHudDisplayingArenaInfoPanel(HUD hud, bool shouldDisplay) { List <ArenaInfoPanel> instancesList = InstanceTracker.GetInstancesList <ArenaInfoPanel>(); ArenaInfoPanel arenaInfoPanel = null; for (int i = 0; i < instancesList.Count; i++) { ArenaInfoPanel arenaInfoPanel2 = instancesList[i]; if (arenaInfoPanel2.hud == hud) { arenaInfoPanel = arenaInfoPanel2; break; } } if (arenaInfoPanel != shouldDisplay) { if (!arenaInfoPanel) { Transform parent = (RectTransform)hud.GetComponent <ChildLocator>().FindChild("RightInfoBar"); UnityEngine.Object.Instantiate <GameObject>(ArenaInfoPanel.panelPrefab, parent).GetComponent <ArenaInfoPanel>().hud = hud; return; } UnityEngine.Object.Destroy(arenaInfoPanel.gameObject); } }
// Token: 0x06002322 RID: 8994 RVA: 0x00099A50 File Offset: 0x00097C50 private void FixedUpdate() { List <BossGroup> instancesList = InstanceTracker.GetInstancesList <BossGroup>(); int num = 0; for (int i = 0; i < instancesList.Count; i++) { if (instancesList[i].shouldDisplayHealthBarOnHud) { num++; } } this.SetListeningForClientDamageNotified(num > 1); if (num == 1) { for (int j = 0; j < instancesList.Count; j++) { if (instancesList[j].shouldDisplayHealthBarOnHud) { this.currentBossGroup = instancesList[j]; return; } } return; } if (instancesList.Count == 0) { this.currentBossGroup = null; } }
public static void UpdateAllItemDisplays() { foreach (var itemDisplayHelper in InstanceTracker.GetInstancesList <MysticsItemsOmarHackToolItemDisplayHelper>()) { itemDisplayHelper.UpdateItemDisplay(); } }
/// <summary> /// Instantiates a new Request Object /// </summary> public HTTPRequest() { KeepAliveHandler = KeepAliveSink; KeepAliveTimer.OnExpired += KeepAliveHandler; InstanceTracker.Add(this); _PIPELINE = PIPELINE; }
//method is only called by server private bool ThrowFruit(EquipmentSlot equipmentSlot) { if (InstanceTracker.GetInstancesList <FoodPickup>()?.Count < maxAmount) { GameObject pickup = UnityEngine.Object.Instantiate <GameObject>(fruitPickup, equipmentSlot.characterBody.transform.position, UnityEngine.Random.rotation); pickup.GetComponent <TeamFilter>().teamIndex = equipmentSlot.teamComponent.teamIndex; FoodPickup foodPickup = pickup.GetComponentInChildren <FoodPickup>(); foodPickup.owner = equipmentSlot.characterBody; pickup.transform.localScale = new Vector3(1f, 1f, 1f); Vector3 direction; if (equipmentSlot.characterBody.inputBank) { Ray aimRay = equipmentSlot.characterBody.inputBank.GetAimRay(); direction = aimRay.direction; pickup.transform.position = aimRay.origin; //set position to aimray if aimray is found } else { direction = equipmentSlot.transform.forward; } Rigidbody component = pickup.GetComponent <Rigidbody>(); component.velocity = Vector3.up * 5f + (direction * 20f); // please fine tune pickup.transform.eulerAngles = Vector3.zero; NetworkServer.Spawn(pickup); return(true); } return(false); }
private void SkipStage(SceneExitController self) { /*I actually dont know what this does * //self = explicitSceneExitController.GetComponent<SceneExitController>(); #if DEBUG * Chat.AddMessage("Turbo Edition: " + EquipmentName + " getComponent " + self); #endif*/ //CANNOT DO THIS!!!! Throws an exception on ExitStage.State newState! //self = new SceneExitController(); InstanceTracker.Add(self); #if DEBUG Chat.AddMessage("Turbo Edition: " + EquipmentName + " forced stage skip."); #endif //The game does this so lets do too if (NetworkServer.active) { //SceneExitController.ExitState == SceneExitController.ExitState.Idle; self.SetState(SceneExitController.ExitState.Idle); self.Begin(); } //If we are grabbing an already existing instance from the game thanks to InstanceTracker.FirstOrNull we are deleting that one //should be fine since we are leaving the scene though. InstanceTracker.Remove(self); }
public void Update() { // Clear and update this.interactablesItem.Clear(); this.interactablesBarrel = InstanceTracker.GetInstancesList <BarrelInteraction>(); // Process multishops MultiShopController[] multishops = GameObject.FindObjectsOfType <MultiShopController>(); foreach (MultiShopController multishop in multishops) { GameObject[] terminalGameObjects = multishop.GetFieldValue <GameObject[]>("terminalGameObjects"); if (terminalGameObjects != null) { foreach (GameObject terminal in terminalGameObjects) { ShopTerminalBehavior shop = terminal.GetComponent <ShopTerminalBehavior>(); PickupIndex pickup = shop.GetFieldValue <PickupIndex>("pickupIndex"); // TODO: Check if pickup is higher priority // FILLER this.interactablesItem.Add(new BotInteractable <PurchaseInteraction>(terminal.gameObject)); } } } // Process chests ChestBehavior[] chests = GameObject.FindObjectsOfType <ChestBehavior>(); foreach (ChestBehavior chest in chests) { interactablesItem.Add(new BotInteractable <PurchaseInteraction>(chest.gameObject)); } }
public static void TriggerBlinkForBody(CharacterBody body) { foreach (var itemDisplayHelper in InstanceTracker.GetInstancesList <MysticsItemsMysticSwordItemDisplayHelper>().Where(x => x.body == body)) { itemDisplayHelper.TriggerBlink(); } }
private void RecordDamage(GameObject attackerObject, CharacterBody victimBody, float damageDealt) { bool shouldBreak = false; foreach (var tracker in InstanceTracker.GetInstancesList <BossDamageTracker>()) { foreach (var bossMaster in tracker.bossGroup.combatSquad.membersList) { if (bossMaster.GetBody() == victimBody) { var attackerBody = attackerObject.GetComponent <CharacterBody>(); if (attackerBody && attackerBody.master) { tracker.AddDamage(attackerBody.master, damageDealt); } shouldBreak = true; break; } } if (shouldBreak) { break; } } }
public static void TriggerFlashForBody(CharacterBody body) { foreach (var itemDisplayHelper in InstanceTracker.GetInstancesList <MysticsItemsJudgementCutItemDisplayHelper>().Where(x => x.body == body)) { itemDisplayHelper.TriggerFlash(); } }
private void Stage_onStageStartGlobal(Stage stage) { foreach (var component in InstanceTracker.GetInstancesList <MysticsItemsOmarHackToolBehaviour>()) { component.usesLeft = component.maxUses; } }
public static object Create(Type type, Type[] interfaces, object initializer) { IGraphInstance instanceMixin = new InstanceTracker(); var options = new ProxyGenerationOptions(); options.AddMixinInstance(instanceMixin); IList <Type> interfacesToImplement = new List <Type>(interfaces); interfacesToImplement.Add(typeof(INotifyPropertyModified)); interfacesToImplement.Add(typeof(INotifyPropertyAccessed)); interfacesToImplement.Add(typeof(IMarkerInterface)); IList <Castle.Core.Interceptor.IInterceptor> interceptors = new List <Castle.Core.Interceptor.IInterceptor>(); interceptors.Add(new NotifyPropertyChangedInterceptor(type.Name)); if (initializer != null) { interceptors.Add((Castle.Core.Interceptor.IInterceptor)initializer); } var result = ProxyGenerator.CreateClassProxy(type, interfacesToImplement.ToArray <Type>(), options, interceptors.ToArray <Castle.Core.Interceptor.IInterceptor>()); NHibernateGraphTypeProvider.NHibernateGraphType graphType = (NHibernateGraphTypeProvider.NHibernateGraphType)GraphContext.Current.GetGraphType(result); // Need to build the instance here ((IGraphInstance)result).Instance = graphType.RaiseOnInit(result); ((INotifyPropertyAccessed)result).PropertyAccessed += new PropertyAccessedEventHandler(graphType.NHibernateGraphType_PropertyAccessed); ((INotifyPropertyModified)result).PropertyModified += new PropertyModifiedEventHandler(graphType.NHibernateGraphType_PropertyModified); return(result); }
protected override bool ValidateInternal(ref RpcExecutionContext ctx) { //TODO: Validate this should happen. InstanceTracker.NewInstance(); return(true); }
public static void StartMasterRoundEvent() { var playerList = PlayerCharacterMasterController.instances; var StageCount = Run.instance.stageClearCount; var maxHits = MaxAllowedHits + StageCount * AdditionalAllowedHitsPerStage; if (NetworkServer.active) { foreach (var player in playerList) { var body = player.master.GetBody(); if (body && body.healthComponent && body.healthComponent.alive) { var masterRoundComponent = player.master.gameObject.GetComponent <MasterRoundComponent>(); if (!masterRoundComponent) { masterRoundComponent = player.master.gameObject.AddComponent <MasterRoundComponent>(); } masterRoundComponent.allowedHits = maxHits + 1; masterRoundComponent.teleporterCharging = true; InstanceTracker.Add <MasterRoundComponent>(masterRoundComponent); } } } if (EnableAnnounceOnStart) { Chat.SendBroadcastChat(new SimpleChatMessage { baseToken = "RISKOFBULLETSTORM_MASTERROUND_START", paramTokens = new[] { maxHits.ToString() } }); } }
public NetworkInfo(InterfaceHandler onNewInterfaceSink) { this.OnNewInterfaceEvent = new WeakEvent(); this.OnInterfaceDisabledEvent = new WeakEvent(); this.InterfacePoller = new LifeTimeMonitor(); this.AddressTable = new ArrayList(); InstanceTracker.Add(this); this.InterfacePoller.OnExpired += new LifeTimeMonitor.LifeTimeHandler(this.PollInterface); this.HostName = Dns.GetHostName(); IPHostEntry hostByName = Dns.GetHostByName(this.HostName); this.AddressTable = new ArrayList(hostByName.AddressList); if (!this.AddressTable.Contains(IPAddress.Loopback)) { this.AddressTable.Add(IPAddress.Loopback); } if (onNewInterfaceSink != null) { this.OnNewInterface += onNewInterfaceSink; foreach (IPAddress address in this.AddressTable) { this.OnNewInterfaceEvent.Fire(this, address); } } this.InterfacePoller.Add(this, NetworkPollSeconds); }
public MiniWebServer(Uri BaseURL) { this.IdleTimeout = true; this.KeepAliveTimer = new LifeTimeMonitor(); this.SessionTimer = new LifeTimeMonitor(); this.SessionTable = new Hashtable(); this.OnSessionEvent = new WeakEvent(); this.OnReceiveEvent = new WeakEvent(); this.OnHeaderEvent = new WeakEvent(); InstanceTracker.Add(this); this.SessionTimer.OnExpired += new LifeTimeMonitor.LifeTimeHandler(this.SessionTimerSink); this.KeepAliveTimer.OnExpired += new LifeTimeMonitor.LifeTimeHandler(this.KeepAliveSink); string host = BaseURL.Host; if (BaseURL.HostNameType == UriHostNameType.Dns) { throw new MiniWebServerException("Uri must explicitly define IP Address"); } IPEndPoint localEP = new IPEndPoint(IPAddress.Parse(host), BaseURL.Port); this.endpoint_local = localEP; this.MainSocket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); this.MainSocket.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.ReuseAddress, 1); this.MainSocket.Bind(localEP); this.MainSocket.Listen(0x19); this.MainSocket.BeginAccept(new AsyncCallback(this.Accept), null); this.KeepAliveTimer.Add(false, 7); }
private static void CCUpdateDelay(ConCommandArgs args) { if (args.Count > 0) { var newValue = args.GetArgFloat(0); if (newValue < 0) { Debug.LogWarning("[BossDropRewardDelay] Can't set delay to less than 0!"); } else { var maxValueWarning = 5f; if (newValue > maxValueWarning) { Debug.LogWarning($"[BossDropRewardDelay] Warning: reward delay set to larger than {maxValueWarning} seconds ({newValue}), rewards may take a long time to complete!"); } spawnDelay = newValue; foreach (var bossDropRewardDelayComponent in InstanceTracker.GetInstancesList <DelayedBossRewards>()) { if (bossDropRewardDelayComponent) { bossDropRewardDelayComponent.delay = spawnDelay; bossDropRewardDelayComponent.age = 0; } } } } else { Debug.Log($"[BossDropRewardDelay] {spawnDelay} seconds."); } }
public void OnDisable() { InstanceTracker.Remove(this); foreach (HUD hud in HUD.readOnlyInstanceList) { SetHudCountdownEnabled(hud, false); } }
public void Dispose() { ManageModsViewModel.OnGetModifications -= OnGetModifications; InstanceTracker.OnProcessesChanged -= OnProcessesChanged; RefreshProcessesWithLoaderTimer?.Dispose(); InstanceTracker?.Dispose(); GC.SuppressFinalize(this); }
public static void Track_ChestBehavior(On.RoR2.ChestBehavior.orig_Awake orig, ChestBehavior self) { orig(self); InstanceTracker.Add(self); if (!self.GetComponent <InstanceTrackerRemover>()) { self.gameObject.AddComponent <InstanceTrackerRemover>().chestBehavior = self; } }
public void Dispose() { ModConfigService.Mods.CollectionChanged -= OnGetModifications; InstanceTracker.OnProcessesChanged -= OnProcessesChanged; RefreshProcessesWithLoaderTimer?.Dispose(); InstanceTracker?.Dispose(); GC.SuppressFinalize(this); }
private void UpdateReloadedProcesses() { var result = InstanceTracker.GetProcesses(); ActionWrappers.ExecuteWithApplicationDispatcher(() => { Collections.ModifyObservableCollection(ProcessesWithReloaded, result.ReloadedProcesses); Collections.ModifyObservableCollection(ProcessesWithoutReloaded, result.NonReloadedProcesses); }); }
public SafeTimer(int Milliseconds, bool Auto) : this() { // SWC 20130227 Fix high cpu problem // SWC Validate Interval setting //if (Milliseconds <= 0 || Milliseconds >= Int32.MaxValue) Milliseconds = 1000; // This should never happen //Interval = Milliseconds; Interval = Math.Max(MINIMUM_INTERVAL, Milliseconds); AutoReset = Auto; InstanceTracker.Add(this); }
private void CharacterSelectController_OnDisable(On.RoR2.UI.CharacterSelectController.orig_OnDisable orig, CharacterSelectController self) { orig(self); var netUsers = InstanceTracker.GetInstancesList <FakeNetworkUserMarker>(); foreach (var user in netUsers.ToList()) { Destroy(user.gameObject); } }
public SequenceFormatter(string delimiter, CallSpecAndTarget[] querySpec, ICall[] matchingCallsInOrder) { _delimiter = delimiter; var instances = new InstanceTracker(); _query = querySpec .Select(x => new CallData(instances.InstanceNumber(x.Target), x)).ToArray(); _actualCalls = matchingCallsInOrder .Select(x => new CallData(instances.InstanceNumber(x.Target()), x)).ToArray(); _hasMultipleInstances = instances.NumberOfInstances() > 1; _requiresInstanceNumbers = HasMultipleCallsOnSameType(); }
public void SetUp() { _instanceTracker = new InstanceTracker(); }