public Boolean CheckNetworkUndirected(INetworkInfo network) { var sourceColumn = network.EdgeTable.GetStringColumn("source"); var targetColumn = network.EdgeTable.GetStringColumn("target"); List <int> noDoubleCheck = new List <int> { }; Boolean found = false; for (int row = 0; row < network.EdgeTable.RowCount; row++) { found = false; if (noDoubleCheck.Exists(element => element == row)) { } else { for (int row2 = 0; row2 < network.EdgeTable.RowCount; row2++) { if (sourceColumn[row] == targetColumn[row2] && targetColumn[row] == sourceColumn[row2]) { noDoubleCheck.Add(row2); found = true; break; } } if (!found) { return(false); } } } return(true); }
public NetworkVm(INetworkInfo info, bool isConnected) { _info = info; Name = $"{info.Mac}({info.Channel})"; _children = new ObservableCollection <NetworkVm>(); IsConnected = isConnected; }
/// <summary> /// Initialize the defualt values. /// </summary> protected override void Awake() { base.Awake(); m_TrailRenderer = GetComponent <TrailRenderer>(); if (m_TrailRenderer != null) { m_TrailRenderer.enabled = false; } m_ParticleSystem = GetComponent <ParticleSystem>(); if (m_ParticleSystem != null) { m_ParticleSystem.Stop(); } // The Rigidbody is only used to notify Unity that the object isn't static. The Rigidbody doesn't control any movement. var rigidbody = GetComponent <Rigidbody>(); rigidbody.mass = m_Mass; rigidbody.isKinematic = true; rigidbody.constraints = RigidbodyConstraints.FreezeAll; #if ULTIMATE_CHARACTER_CONTROLLER_MULTIPLAYER m_NetworkInfo = GetComponent <INetworkInfo>(); m_DestructibleMonitor = GetComponent <IDestructibleMonitor>(); #endif if (m_DestroyOnCollision && m_BounceMode != BounceMode.None) { Debug.LogWarning("Warning: The Destructible " + name + " will be destroyed on collision but does not have a Bounce Mode set to None."); m_BounceMode = BounceMode.None; } }
public static void UniqueNodes(this INetworkInfo network, string[] ids, Func <double[], double> combineNumeric, Func <string[], string> combineString, Func <string[][], string[]> combineCategory, Func <double[][], double[]> combineMultiNumeric) { var data = network.NodeTable; var order = ArrayUtils.Order(ids); var uniqueIdx = new List <int>(); var lastId = ""; var idxsWithSameId = new List <int>(); foreach (int j in order) { var id = ids[j]; if (id == lastId) { idxsWithSameId.Add(j); } else { CombineRows(data, idxsWithSameId, combineNumeric, combineString, combineCategory, combineMultiNumeric); network.RemoveNode(idxsWithSameId); uniqueIdx.Add(j); idxsWithSameId.Clear(); idxsWithSameId.Add(j); } lastId = id; } CombineRows(data, idxsWithSameId, combineNumeric, combineString, combineCategory, combineMultiNumeric); data.ExtractRows(uniqueIdx.ToArray()); }
/// <summary> /// Initialize the default values. /// </summary> private void Awake() { if (m_Targets == null || m_Targets.Length == 0) { Debug.LogError("Error: An IInteractableTarget must be specified in the Targets field."); return; } m_InteractableTargets = new IInteractableTarget[m_Targets.Length]; for (int i = 0; i < m_Targets.Length; ++i) { if (m_Targets[i] == null || !(m_Targets[i] is IInteractableTarget)) { Debug.LogError("Error: element " + i + " of the Targets array is null or does not subscribe to the IInteractableTarget iterface."); } else { m_InteractableTargets[i] = m_Targets[i] as IInteractableTarget; } } #if ULTIMATE_CHARACTER_CONTROLLER_MULTIPLAYER m_NetworkInfo = gameObject.GetCachedComponent <INetworkInfo>(); m_NetworkInteractable = gameObject.GetCachedComponent <INetworkInteractableMonitor>(); if (m_NetworkInfo != null && m_NetworkInteractable == null) { Debug.LogError("Error: The object " + gameObject.name + " must have a NetworkInteractableMonitor component."); } #endif m_IKTargets = GetComponentsInChildren <AbilityIKTarget>(); }
/// <summary> /// Initialize the defualt values. /// </summary> protected override void Awake() { base.Awake(); m_TrailRenderer = GetComponent <TrailRenderer>(); if (m_TrailRenderer != null) { m_TrailRenderer.enabled = false; } m_ParticleSystem = GetComponent <ParticleSystem>(); if (m_ParticleSystem != null) { m_ParticleSystem.Stop(); } // The Rigidbody is only used to notify Unity that the object isn't static. The Rigidbody doesn't control any movement. var destructableRigidbody = GetComponent <Rigidbody>(); if (destructableRigidbody != null) { destructableRigidbody.mass = m_Mass; destructableRigidbody.isKinematic = true; destructableRigidbody.constraints = RigidbodyConstraints.FreezeAll; } #if ULTIMATE_CHARACTER_CONTROLLER_MULTIPLAYER m_NetworkInfo = GetComponent <INetworkInfo>(); m_DestructibleMonitor = GetComponent <IDestructibleMonitor>(); #endif if (m_DestroyOnCollision && m_CollisionMode != CollisionMode.Collide && GetType() != typeof(MagicProjectile)) { Debug.LogWarning($"Warning: The Destructible {name} will be destroyed on collision but does not have a Collision Mode set to Collide."); m_CollisionMode = CollisionMode.Collide; } }
/// <summary> /// Initialize the default values. /// </summary> protected override void Awake() { base.Awake(); m_GameObject = gameObject; m_Transform = transform; m_CharacterLocomotion = m_GameObject.GetCachedComponent <UltimateCharacterLocomotion>(); m_CharacterLayerManager = m_GameObject.GetCachedComponent <CharacterLayerManager>(); #if ULTIMATE_CHARACTER_CONTROLLER_MULTIPLAYER m_NetworkInfo = m_GameObject.GetCachedComponent <INetworkInfo>(); #endif if (m_Feet == null) { InitializeHumanoidFeet(false); } if (m_Feet != null && m_Feet.Length != 0) { for (int i = 0; i < m_Feet.Length; ++i) { if (m_Feet[i].Object == null) { continue; } // The FeetGrouping list should be at least the size of the current group index. while (m_Feet[i].Group >= m_FeetGrouping.Count) { m_FeetGrouping.Add(new List <Transform>()); } m_FeetGrouping[m_Feet[i].Group].Add(m_Feet[i].Object); // The Transform should only be added to the set if the footprint is flipped. If the Transform is not in the set then the footprint is not flipped. if (m_Feet[i].FlippedFootprint) { m_FlippedFootprints.Add(m_Feet[i].Object); } } } else { m_FeetGrouping.Add(new List <Transform>()); m_FeetGrouping[0].Add(m_Transform); } if (m_FootstepMode == FootstepPlacementMode.Trigger || m_FootstepMode == FootstepPlacementMode.CameraBob || m_FootstepMode == FootstepPlacementMode.None) { // The component doesn't need to be enabled if using a trigger - the FootstepTrigger component will detect the footstep. The CameraBob will enable the component // when the look source is attached. enabled = false; } else if (m_Feet != null) { PrepareVerticalOffsetLists(); } EventHandler.RegisterEvent <ILookSource>(m_GameObject, "OnCharacterAttachLookSource", OnAttachLookSource); EventHandler.RegisterEvent <bool>(m_GameObject, "OnCharacterMoving", OnMoving); }
public NetworkClient(INetworkInfo networkInfo) { if (networkInfo == null) { throw new ArgumentNullException("NetworkInfo is null"); } this.networkInfo = networkInfo; }
/// <summary> /// Private ctor since we're cheezy and use a singleton. /// </summary> private NetworkStatus() { m_nListUtil = PlatformTypes.New <INetworkInfo>(); m_nListUtil.ConnectionStateChanged += () => { ConnectionStateChanged?.Invoke(); }; }
public ProfitInfo(IMarketManager marketManager, INetworkInfo networkInfo, IPoolConfig poolConfig) { _logger = Log.ForContext<ProfitInfo>().ForContext("Component", poolConfig.Coin.Name); _poolConfig = poolConfig; _networkInfo = networkInfo; _marketManager = marketManager; _marketManager.Update += OnMarketUpdate; }
public ProfitInfo(IMarketManager marketManager, INetworkInfo networkInfo, IPoolConfig poolConfig) { _logger = Log.ForContext <ProfitInfo>().ForContext("Component", poolConfig.Coin.Name); _poolConfig = poolConfig; _networkInfo = networkInfo; _marketManager = marketManager; _marketManager.Update += OnMarketUpdate; }
public IProfitInfo GetProfitInfo(INetworkInfo networkInfo, IPoolConfig poolConfig) { var @params = new NamedParameterOverloads { { "poolConfig", poolConfig }, { "networkInfo", networkInfo }, }; return(_applicationContext.Container.Resolve <IProfitInfo>(@params)); }
public UdpDeviceDetection(INetworkInfo networkInfo = null) { if (networkInfo == null) { this._networkInfo = new DefaultNetworkInfo(); return; } this._networkInfo = networkInfo; }
public MainViewModel(IAppInfo app, IBatteryInfo battery, INetworkInfo network, IHardwareInfo hardware) { this.App = app; this.Battery = battery; this.Network = network; this.Hardware = hardware; this.ClearApp = new Command(this.AppEvents.Clear); this.ClearBattery = new Command(this.BatteryEvents.Clear); this.ClearNetwork = new Command(this.NetworkEvents.Clear); }
public NetworkVm(string name, IEnumerable <NetworkVm> networkVms) { Name = name; _info = new NetworkInfo(); _children = new ObservableCollection <NetworkVm>(networkVms); foreach (var networkVm in _children) { networkVm.PropertyChanged += NetworkVmOnPropertyChanged; } IsConnected = networkVms.Any(vm => vm.IsConnected); }
public static void RemoveEdge(this INetworkInfo network, List <int> rowIdxs) { if (rowIdxs.Count <= 1) { return; } for (int i = 0; i < rowIdxs.Count - 1; i++) { var edge = network.EdgeIndex.FirstOrDefault(x => x.Value == rowIdxs[i]).Key; network.Graph.RemoveEdges(edge); } }
private Dictionary <INode, Boolean> DoBFS(Dictionary <INode, Boolean> queue, INetworkInfo network) { var unvis = queue.FirstOrDefault(x => x.Value == false).Key; while (unvis != null) { queue[unvis] = true; //update current node as visited queue = PushNeighborsToQueue(queue, unvis, network); // push neighbors to queue unvis = queue.FirstOrDefault(x => x.Value == false).Key; //search for next unvisited node } return(queue); }
/// <summary> /// Initialize the default values. /// </summary> public override void Awake() { base.Awake(); m_CharacterIK = m_GameObject.GetCachedComponent <CharacterIKBase>(); #if ULTIMATE_CHARACTER_CONTROLLER_MULTIPLAYER m_NetworkInfo = m_GameObject.GetCachedComponent <INetworkInfo>(); #endif EventHandler.RegisterEvent(m_GameObject, "OnAnimatorInteract", DoInteract); EventHandler.RegisterEvent(m_GameObject, "OnAnimatorInteractComplete", InteractComplete); }
/// <summary> /// Initialize the default values. /// </summary> protected virtual void Awake() { m_GameObject = gameObject; #if ULTIMATE_CHARACTER_CONTROLLER_MULTIPLAYER m_NetworkInfo = m_GameObject.GetCachedComponent <INetworkInfo>(); m_NetworkCharacter = m_GameObject.GetCachedComponent <INetworkCharacter>(); #endif DetermineSlotCount(); EventHandler.RegisterEvent <Vector3, Vector3, GameObject>(m_GameObject, "OnDeath", OnDeath); EventHandler.RegisterEvent(m_GameObject, "OnRespawn", OnRespawn); }
public AccountManager(IFileSystem filesystem, INetworkInfo networkInfo) { if (filesystem == null) { throw new ArgumentNullException("Filesystem is null"); } this.filesystem = filesystem; this.user = new User(); this.client = new NetworkClient(networkInfo); loadLogin(); /*this.user = new User (){ Username = "******", UserID = "0" }; * LoggedIn = true;*/ }
/// <summary> /// Initialize the default values. /// </summary> private void Awake() { m_GameObject = gameObject; m_Transform = transform; m_AudioSource = GetComponent <AudioSource>(); #if ULTIMATE_CHARACTER_CONTROLLER_MULTIPLAYER m_NetworkInfo = GetComponent <INetworkInfo>(); #endif // A turret head is required. if (m_TurretHead == null) { m_TurretHead = m_Transform; } }
public Boolean CheckNetworkConnected(INetworkInfo network) { IGraph g = network.Graph; var nodeEnum = g.GetEnumerator(); //for every node: Do weak connectivity BFS -> in whole: strong connectivity BFS while (nodeEnum.MoveNext()) { Dictionary <INode, Boolean> queue = new Dictionary <INode, Boolean> { [nodeEnum.Current] = false }; queue = DoBFS(queue, network); if (queue.Count != g.NumberOfNodes) { return(false); } } return(true); }
/// <summary> /// Initialize the default values. /// </summary> protected override void Awake() { base.Awake(); m_GameObject = gameObject; m_Item = m_GameObject.GetCachedComponent <Item>(); var characterLocomotion = m_GameObject.GetCachedParentComponent <UltimateCharacterLocomotion>(); m_Character = characterLocomotion.gameObject; m_Inventory = m_Character.GetCachedComponent <InventoryBase>(); #if ULTIMATE_CHARACTER_CONTROLLER_MULTIPLAYER m_NetworkInfo = m_Character.GetCachedComponent <INetworkInfo>(); m_NetworkCharacter = m_Character.GetCachedComponent <INetworkCharacter>(); if (m_NetworkInfo != null && m_NetworkCharacter == null) { Debug.LogError("Error: The character " + m_Character.name + " must have a NetworkCharacter component."); } #endif var perspectiveProperties = GetComponents <ItemPerspectiveProperties>(); for (int i = 0; i < perspectiveProperties.Length; ++i) { // The perspective properties Action ID must match. The ID allows multiple ItemActions/PerpsectiveProperties to be added to the same item. // An action ID of -1 can be used with any action. if (m_ID != perspectiveProperties[i].ActionID && perspectiveProperties[i].ActionID != -1) { continue; } if (perspectiveProperties[i].FirstPersonItem) { m_FirstPersonPerspectiveProperties = perspectiveProperties[i]; } else { m_ThirdPersonPerspectiveProperties = perspectiveProperties[i]; } } m_ActivePerspectiveProperties = characterLocomotion.FirstPersonPerspective ? m_FirstPersonPerspectiveProperties : m_ThirdPersonPerspectiveProperties; EventHandler.RegisterEvent <bool>(m_Character, "OnCharacterChangePerspectives", OnChangePerspectives); }
/// <summary> /// Initialize the default values. /// </summary> private void Awake() { #if THIRD_PERSON_CONTROLLER // If the third person Perspective Monitor exists then that component will manage the remote player's perspective. var perspectiveMonitor = gameObject.GetComponent <ThirdPersonController.Character.PerspectiveMonitor>(); if (perspectiveMonitor != null) { Destroy(this); return; } #endif m_GameObject = gameObject; m_NetworkInfo = m_GameObject.GetComponent <INetworkInfo>(); if (m_NetworkInfo == null) { Debug.LogError("Error: The character must have a NetworkInfo object."); return; } EventHandler.RegisterEvent <ILookSource>(m_GameObject, "OnCharacterAttachLookSource", OnAttachLookSource); }
/// <summary> /// Initialize the default values. /// </summary> protected override void Awake() { base.Awake(); m_GameObject = gameObject; m_Transform = transform; m_CharacterLocomotion = m_GameObject.GetCachedComponent <UltimateCharacterLocomotion>(); #if ULTIMATE_CHARACTER_CONTROLLER_MULTIPLAYER m_NetworkInfo = m_GameObject.GetCachedComponent <INetworkInfo>(); m_NetworkRespawnerMonitor = m_GameObject.GetCachedComponent <INetworkRespawnerMonitor>(); if (m_NetworkInfo != null && m_NetworkRespawnerMonitor == null) { Debug.LogError("Error: The object " + m_GameObject.name + " must have a NetworkRespawnerMonitor component."); } #endif m_StartPosition = m_Transform.position; m_StartRotation = m_Transform.rotation; EventHandler.RegisterEvent <Vector3, Vector3, GameObject>(m_GameObject, "OnDeath", OnDeath); }
/// <summary> /// Initialize the default values. /// </summary> protected override void Awake() { base.Awake(); m_GameObject = gameObject; m_Transform = transform; m_ForceObject = m_GameObject.GetCachedComponent <IForceObject>(); m_Rigidbody = m_GameObject.GetCachedComponent <Rigidbody>(); m_AttributeManager = GetComponent <AttributeManager>(); if (!string.IsNullOrEmpty(m_HealthAttributeName)) { m_HealthAttribute = m_AttributeManager.GetAttribute(m_HealthAttributeName); } if (!string.IsNullOrEmpty(m_ShieldAttributeName)) { m_ShieldAttribute = m_AttributeManager.GetAttribute(m_ShieldAttributeName); } m_AliveLayer = m_GameObject.layer; #if ULTIMATE_CHARACTER_CONTROLLER_MULTIPLAYER m_NetworkInfo = m_GameObject.GetCachedComponent <INetworkInfo>(); m_NetworkHealthMonitor = m_GameObject.GetCachedComponent <INetworkHealthMonitor>(); if (m_NetworkInfo != null && m_NetworkHealthMonitor == null) { Debug.LogError("Error: The object " + m_GameObject.name + " must have a NetworkHealthMonitor component."); } #endif if (m_Hitboxes != null && m_Hitboxes.Length > 0) { m_ColliderHitboxMap = new Dictionary <Collider, Hitbox>(); for (int i = 0; i < m_Hitboxes.Length; ++i) { m_ColliderHitboxMap.Add(m_Hitboxes[i].Collider, m_Hitboxes[i]); } m_RaycastHits = new RaycastHit[m_MaxHitboxCollisionCount]; m_RaycastHitComparer = new Utility.UnityEngineUtility.RaycastHitComparer(); } EventHandler.RegisterEvent(m_GameObject, "OnRespawn", OnRespawn); }
public static void UniqueEdges(this INetworkInfo network, string[] id1, string[] id2, Func <double[], double> combineNumeric, Func <string[], string> combineString, Func <string[][], string[]> combineCategory, Func <double[][], double[]> combineMultiNumeric) { var data = network.EdgeTable; List <Triple> list = new List <Triple>(); for (int i = 0; i < id1.Length; i++) { list.Add(new Triple() { One = id1[i], Two = id2[i], Index = i }); } list.Sort(); var uniqueIdx = new List <int>(); var lastId1 = ""; var lastId2 = ""; var idxsWithSameId = new List <int>(); foreach (Triple id in list) { if (id.One == lastId1 && id.Two == lastId2) { idxsWithSameId.Add(id.Index); } else { CombineRows(data, idxsWithSameId, combineNumeric, combineString, combineCategory, combineMultiNumeric); network.RemoveEdge(idxsWithSameId); uniqueIdx.Add(id.Index); idxsWithSameId.Clear(); idxsWithSameId.Add(id.Index); } lastId1 = id.One; lastId2 = id.Two; } CombineRows(data, idxsWithSameId, combineNumeric, combineString, combineCategory, combineMultiNumeric); data.ExtractRows(uniqueIdx.ToArray()); }
public MomentsManager(IFileSystem filesystem, ILocationManager locationManager, INetworkInfo networkInfo) { if (filesystem == null) { throw new ArgumentNullException("Filesystem is null"); } if (locationManager == null) { throw new ArgumentNullException("LocationManager is null"); } if (networkInfo == null) { throw new ArgumentNullException("NetworkInfo is null"); } this.fileSystem = filesystem; this.locationManager = locationManager; this.networkInfo = networkInfo; this.momentsNetworkClient = new NetworkClient(networkInfo); this.Moments = new List <Moment> (); this.AccountManager = new AccountManager(fileSystem, networkInfo); Poll(); }
/** * Set the delegate implementation. * * @param _delegate The delegate implementing platform specific functions. */ public void SetDelegate(INetworkInfo _delegate) { this._delegate = _delegate; }
/** * Constructor with delegate. * * @param _delegate The delegate implementing platform specific functions. */ public NetworkInfoBridge(INetworkInfo _delegate) : base() { this._delegate = _delegate; }
public ConnectionInfo(INetworkInfo monitor) { _monitor = monitor; }
public IProfitInfo GetProfitInfo(INetworkInfo networkInfo, IPoolConfig poolConfig) { var @params = new NamedParameterOverloads { {"poolConfig", poolConfig}, {"networkInfo", networkInfo}, }; return _applicationContext.Container.Resolve<IProfitInfo>(@params); }
private Dictionary <INode, Boolean> PushNeighborsToQueue(Dictionary <INode, Boolean> queue, INode node, INetworkInfo netw) { List <INode> neighbors = GetNeighbors(node); foreach (var neighbor in neighbors) { if (!queue.ContainsKey(neighbor)) { queue[neighbor] = false; } } return(queue); }