public static bool OffhandFilter(Equipment e) { if (e.IsEquipped) { return(false); } if (e.Base.equipSlot == EquipSlotType.OFF_HAND) { return(true); } GroupType weaponType = GroupType.SHIELD; if (HeroDetailWindow.hero.GetEquipmentInSlot(EquipSlotType.WEAPON) is Weapon mainWeapon) { if (mainWeapon.GetGroupTypes().Contains(GroupType.SPEAR) && HeroDetailWindow.hero.HasSpecialBonus(BonusType.CAN_USE_SPEARS_WITH_SHIELDS) && e.GetGroupTypes().Contains(GroupType.SHIELD)) { return(true); } else if (HeroDetailWindow.hero.GetEquipmentGroupTypes(mainWeapon).Contains(GroupType.TWO_HANDED_WEAPON) && !HeroDetailWindow.hero.HasSpecialBonus(BonusType.TWO_HANDED_WEAPONS_ARE_ONE_HANDED)) { return(false); } if (mainWeapon.GetGroupTypes().Contains(GroupType.MELEE_WEAPON)) { weaponType = GroupType.MELEE_WEAPON; } else if (mainWeapon.GetGroupTypes().Contains(GroupType.RANGED_WEAPON)) { weaponType = GroupType.RANGED_WEAPON; } } System.Collections.Generic.HashSet <GroupType> groups = e.GetGroupTypes(); if (groups.Contains(weaponType)) { if (HeroDetailWindow.hero.HasSpecialBonus(BonusType.TWO_HANDED_WEAPONS_ARE_ONE_HANDED) && (groups.Contains(GroupType.TWO_HANDED_WEAPON) || groups.Contains(GroupType.ONE_HANDED_WEAPON))) { return(true); } else if (groups.Contains(GroupType.ONE_HANDED_WEAPON)) { return(true); } else if (groups.Contains(GroupType.TWO_HANDED_WEAPON)) { return(false); } } return(false); }
public bool Contains(Element element) { if (element == null || !element.IsDefined) { return(false); } var result = hashSet.Contains(element); return(result); }
protected void OnKeyPressEvent(object sender, KeyPressEventArgs a) { if (selectedControls == null) { return; } var key = a.Event.Key; if (pressed.Contains(key)) { return; } if (key == Gdk.Key.Shift_L) { selectedControls = shiftedControls; foreach (var ctrl in shiftlessControls) { if (pressed.Contains(ctrl.Key)) { ctrl.Value.Stop(); if (shiftedControls.ContainsKey(ctrl.Key)) { shiftedControls[ctrl.Key].Start(); } } } } else { if (!selectedControls.ContainsKey(key)) { return; } pressed.Add(key); selectedControls[key].Start(); } }
public void SetMatchDetails(Current details, System.Collections.Generic.HashSet <string> friends) { if (details.teams.Count == 2) { Team t1 = details.teams[0]; Team t2 = details.teams[1]; matchDetails = details; team1.text = t1.name; team2.text = t2.name; var coach1 = TextPanelHandler.SanitizeText(t1.coach); var coach2 = TextPanelHandler.SanitizeText(t2.coach); if (friends.Contains(t1.coach)) { coach1 = $"<#00F324>{coach1}</color>"; } if (friends.Contains(t2.coach)) { coach2 = $"<#00F324>{coach2}</color>"; } team1Score.text = t1.score.ToString(); team2Score.text = t2.score.ToString(); team1Info.text = $"({t1.rating}) {coach1} TV {t1.tv / 1000}k {t1.race}"; team2Info.text = $"{t2.race} TV {t2.tv / 1000}k {coach2} ({t2.rating})"; turnIndicator.text = $"h{details.half}t{details.turn}"; float progress = (float)((((float)details.half - 1) * 8) + (float)details.turn) / 16f; progressBar.fillAmount = progress; FumbblApi.GetImage(t1.logolarge, team1Image); FumbblApi.GetImage(t2.logolarge, team2Image); } else { LogManager.Error("Invalid number of teams found when parsing match details"); } }
public void ValidateShaderResources(ShaderPathID shaderPathID) { string path = AssetDatabase.GUIDToAssetPath(ShaderUtils.GetShaderGUID(shaderPathID)); Assert.IsFalse(string.IsNullOrEmpty(path)); var shader = AssetDatabase.LoadAssetAtPath <Shader>(path); Assert.AreEqual(shader.name, ShaderUtils.GetShaderPath(shaderPathID)); var propertyNames = new System.Collections.Generic.HashSet <string>(); for (int j = 0; j < shader.GetPropertyCount(); ++j) { string propertyName = shader.GetPropertyName(j); Assert.IsFalse(propertyNames.Contains(propertyName), $"{shader.name} has duplicated property {propertyName}!"); propertyNames.Add(propertyName); } }
public void Create() { int random_level_width, maps_to_create = number_of_maps.text == "" ? 20 : int.Parse(number_of_maps.text); int level_width = int.Parse(width.text); int level_height = int.Parse(height.text); while (maps_to_create > 0) { random_level_width = UnityEngine.Random.Range(2, 4); LevelMap m = LevelMap.GetRandomMap(level_width, level_height); if (!current_maps_hash.Contains(m.map_id)) { m.Save("map_" + (current_maps_hash.Count + 1) + ".map"); print("MAP CREATED: " + m.map_id); current_maps_hash.Add(m.map_id); maps_to_create--; } } SetupCanvasController.CreateMapSet(); }
// Helper method that a user might want to implement static bool IsInRegisteredList(ulong id) { return(RegisteredGameObjects.Contains(id)); }
public static IList <string> GenerateArguments( Option <VideoInputFile> maybeVideoInputFile, Option <AudioInputFile> maybeAudioInputFile, Option <WatermarkInputFile> maybeWatermarkInputFile, Option <ConcatInputFile> maybeConcatInputFile, IList <IPipelineStep> pipelineSteps) { var arguments = new List <string>(); foreach (IPipelineStep step in pipelineSteps) { arguments.AddRange(step.GlobalOptions); } var includedPaths = new System.Collections.Generic.HashSet <string>(); foreach (VideoInputFile videoInputFile in maybeVideoInputFile) { includedPaths.Add(videoInputFile.Path); foreach (IInputOption step in videoInputFile.InputOptions) { arguments.AddRange(step.InputOptions(videoInputFile)); } arguments.AddRange(new[] { "-i", videoInputFile.Path }); } foreach (AudioInputFile audioInputFile in maybeAudioInputFile) { if (!includedPaths.Contains(audioInputFile.Path)) { includedPaths.Add(audioInputFile.Path); foreach (IInputOption step in audioInputFile.InputOptions) { arguments.AddRange(step.InputOptions(audioInputFile)); } arguments.AddRange(new[] { "-i", audioInputFile.Path }); } } foreach (WatermarkInputFile watermarkInputFile in maybeWatermarkInputFile) { if (!includedPaths.Contains(watermarkInputFile.Path)) { includedPaths.Add(watermarkInputFile.Path); foreach (IInputOption step in watermarkInputFile.InputOptions) { arguments.AddRange(step.InputOptions(watermarkInputFile)); } arguments.AddRange(new[] { "-i", watermarkInputFile.Path }); } } foreach (ConcatInputFile concatInputFile in maybeConcatInputFile) { foreach (IInputOption step in concatInputFile.InputOptions) { arguments.AddRange(step.InputOptions(concatInputFile)); } arguments.AddRange(new[] { "-i", concatInputFile.Path }); } foreach (IPipelineStep step in pipelineSteps) { arguments.AddRange(step.FilterOptions); } foreach (IPipelineStep step in pipelineSteps.Filter(s => s is not StreamSeekFilterOption)) { arguments.AddRange(step.OutputOptions); } return(arguments); }
/// <inheritdoc /> public bool Contains(T item) { return(_set.Contains(item)); }
/// <summary> /// Asset Bundle-like export, except using DataNode's deep serialization. /// </summary> static public void ExportAssets(DataNode.SaveType type, string path) { EditorUtility.DisplayCancelableProgressBar("Working", "Collecting references...", 0f); ComponentSerialization.ClearReferences(); var objects = Selection.GetFiltered(typeof(Object), SelectionMode.DeepAssets); var components = new System.Collections.Generic.HashSet <string>(); foreach (var obj in objects) { if (obj is MonoScript) { var s = obj.name; if (!components.Contains(s)) { components.Add(s); } continue; } var go = obj as GameObject; if (go) { go.CollectReferencedPrefabs(true); var comps = go.GetComponentsInChildren <MonoBehaviour>(true); foreach (var comp in comps) { var t = comp.GetType().ToString(); if (!components.Contains(t)) { components.Add(t); } } } else { ComponentSerialization.AddReference(obj); } } EditorUtility.DisplayCancelableProgressBar("Working", "Copying scripts...", 0f); var dir = Tools.GetDirectoryFromPath(path); // Copy the scripts foreach (var c in components) { var fn = c + ".cs"; var p = Tools.FindFile(Application.dataPath, fn); if (!string.IsNullOrEmpty(p)) { System.IO.File.Copy(p, System.IO.Path.Combine(dir, fn), true); } } EditorUtility.DisplayCancelableProgressBar("Working", "Creating a DataNode...", 0f); foreach (var pair in ComponentSerialization.referencedPrefabs) { pair.Value.CollectReferencedResources(); } var data = ComponentSerialization.SerializeBundle(); if (data != null && data.children.size > 0) { Save(data, path, type); } else { Debug.LogWarning("No assets found to serialize"); } ComponentSerialization.ClearReferences(); EditorUtility.ClearProgressBar(); }