public override bool StartSpecialSkill(Cooldown sk) { if (sk.Skill.IconName == ManaBoost.Cooldown.Skill.IconName) { ManaBoost.StartCooldown(sk.Duration); return(true); } if (sk.Skill.IconName == PrimeFlame.IconName) { Fusion.Skill = PrimeFlame; Fusion.Start(sk.Duration, sk.Mode); if (sk.Mode != CooldownMode.Normal) { return(true); } _latestCooldown = (long)sk.OriginalDuration; _sw.Restart(); return(true); } var fusion = ManaBoost.Effect.IsAvailable ? FusionSkill : FusionSkillBoost; if (sk.Skill.IconName == fusion.IconName) { _latestCooldown = (long)sk.OriginalDuration; Fusion.Start(sk.Duration, sk.Mode); _sw.Restart(); return(false); } return(false); }
/// <summary> /// Starts the clustering. /// </summary> /// <param name="elements"></param> /// <param name="fusion"></param> /// <param name="metric"></param> /// <returns></returns> protected internal Cluster[] Cluster(List<Element> elements, Fusion fusion, IDistanceMetric metric) { HashSet<Cluster> clusters = new HashSet<Cluster>(); ClusterPairs pairs = new ClusterPairs(); // 1. Initialize each element as a cluster foreach (Element el in elements) { Cluster cl = new Cluster(fusion); cl.AddElement(el); clusters.Add(cl); } // 2. a) Calculate the distances of all clusters to all other clusters foreach (Cluster cl1 in clusters) { foreach (Cluster cl2 in clusters) { if (cl1 == cl2) continue; ClusterPair pair = new ClusterPair(cl1, cl2, cl1.CalculateDistance(cl2)); pairs.AddPair(pair); } } // 2. b) Initialize the pair with the lowest distance to each other. ClusterPair lowestDistancePair = pairs.LowestDistancePair; // 3. Merge clusters to new clusters and recalculate distances in a loop until there are only countCluster clusters while (!isFinished(clusters, lowestDistancePair)) { // a) Merge: Create a new cluster and add the elements of the two old clusters lowestDistancePair = pairs.LowestDistancePair; Cluster newCluster = new Cluster(fusion); newCluster.AddElements(lowestDistancePair.Cluster1.GetElements()); newCluster.AddElements(lowestDistancePair.Cluster2.GetElements()); // b)Remove the two old clusters from clusters clusters.Remove(lowestDistancePair.Cluster1); clusters.Remove(lowestDistancePair.Cluster2); // c) Remove the two old clusters from pairs pairs.RemovePairsByOldClusters(lowestDistancePair.Cluster1, lowestDistancePair.Cluster2); // d) Calculate the distance of the new cluster to all other clusters and save each as pair foreach (Cluster cluster in clusters) { ClusterPair pair = new ClusterPair(cluster, newCluster, cluster.CalculateDistance(newCluster)); pairs.AddPair(pair); } // e) Add the new cluster to clusters clusters.Add(newCluster); } return clusters.ToArray<Cluster>(); }
// Use this for initialization void Start() { rb = gameObject.GetComponent <Rigidbody>(); root = GameObject.Find("sensorfusion"); conn = (ConnectionScript)root.GetComponent <ConnectionScript>(); // attach rotator to correct sensor fusion instance parentGameObjectName = gameObject.name; if (parentGameObjectName == "kionix_iot") { myfusion = conn.myfusion; } else if (parentGameObjectName == "kionix_iot_2") { myfusion = conn.myfusion2; } else if (parentGameObjectName == "kionix_iot_3") { myfusion = conn.myfusion3; } else if (parentGameObjectName == "kionix_iot_4") { myfusion = conn.myfusion4; } //myfusion = root.GetComponent<Fusion>(); myq = new Quaternion(); lockPosition = false; }
private void _node_CapturedData(float[] data, float deltaT) { Quaternion q = new Quaternion(); // Quaternion Data lbl_qtn_w.Text = "W: " + q.w.ToString("{0:0.0000}"); lbl_qtn_x.Text = "X: " + q.x.ToString("{0:0.0000}"); lbl_qtn_y.Text = "Y: " + q.y.ToString("{0:0.0000}"); lbl_qtn_z.Text = "Z: " + q.z.ToString("{0:0.0000}"); // Accelerometer Data lbl_accel_x.Text = "X: " + data[0].ToString("{0:0.0000}"); lbl_accel_y.Text = "Y: " + data[1].ToString("{0:0.0000}"); lbl_accel_z.Text = "Z: " + data[2].ToString("{0:0.0000}"); // Gyroscope Data lbl_gyro_x.Text = "X: " + data[3].ToString("{0:0.0000}"); lbl_gyro_y.Text = "Y: " + data[4].ToString("{0:0.0000}"); lbl_gyro_z.Text = "Z: " + data[5].ToString("{0:0.0000}"); // Magnometer Data lbl_mag_x.Text = "X: " + data[6].ToString("{0:0.0000}"); lbl_mag_y.Text = "Y: " + data[7].ToString("{0:0.0000}"); lbl_mag_z.Text = "Z: " + data[8].ToString("{0:0.0000}"); if (graphs != null) { float[] angles = Fusion.GetTiltArray(data, deltaT); for (int i = 0; i < 3; i++) { graphs[i].AddPoint(deltaT, angles[i]); } } }
public void AddFreeCommit(Action <bool> callback) { Fusion.Get(ADD_COMMIT_FUSION, true, (Fusion fusion, NPNFError getError) => { if (getError == null) { User.CurrentProfile.Fusion.Fuse(ADD_COMMIT_FUSION, fusion.Prices[0].Name, null, 1, (FormulaResult result, NPNFError error) => { if (error == null) { if (callback != null) { callback(true); } } else { if (callback != null) { callback(false); } Debug.LogError("add commit error: " + error.ToString()); } }); } else { if (callback != null) { callback(false); } } }); }
public static RoloView GetMenu() { var view = Fusion.Create("RolodexMenu", new RolodexMenuRecipe().Parts).Get <RoloView>(); view.Init(); return(view); }
public void HireNewEngineer(Action <bool> callback) { Fusion.Get(HIRE_NEW_ENGINEER_FUSION, true, (Fusion fusion, NPNFError getError) => { if (getError == null) { User.CurrentProfile.Fusion.Fuse(HIRE_NEW_ENGINEER_FUSION, fusion.Prices[0].Name, null, 1, (FormulaResult result, NPNFError error) => { if (error == null) { if (callback != null) { callback(true); } } else { if (callback != null) { callback(false); } Debug.LogError("HireNewEngineer error: " + error.ToString()); } }); } else { if (callback != null) { callback(false); } } }); }
/// <summary> /// Creates a new HAC object that uses single-linkage as fusion function and the Jaccard index as distance metric /// to cluster the specified elements. /// </summary> /// <param name="elements"></param> public HacStart(Element[] elements) { setElements(elements); this.fusion = new SingleLinkage(); this.metric = new JaccardDistance(); this.fusion.Metric = metric; }
static void Main(string[] args) { Fusion carro = new Fusion(); carro.Acelerador = "Acelerador da hora"; carro.AlavancaCambio = "Cambio manual com caranguejo em cima"; carro.Automatico = false; carro.Embreagem = "Embreagem manual Full Power Blaster"; carro.Freio = "Freio tipo âncora (eu quero é ver o oco)"; carro.QtdMarchas = 4; carro.Volante = "Volante Esportivo Vermelho"; // EU, como motorista, sei dirigir a interface ICarro. Dirigir(carro); // Agora, eu vou dirigir outro carro Fusca carro2 = new Fusca(); carro2.Acelerador = "Acelerador da hora"; carro2.AlavancaCambio = "Cambio manual com caranguejo em cima"; carro2.Automatico = false; carro2.Embreagem = "Embreagem manual Full Power Blaster"; carro2.Freio = "Freio tipo âncora (eu quero é ver o oco)"; carro2.QtdMarchas = 4; carro2.Volante = "Volante Esportivo Vermelho"; // EU, como motorista, sei dirigir a interface ICarro. Dirigir(carro2); }
static GacInfo() { GacPaths = new string[] { Fusion.GetGacPath(false), Fusion.GetGacPath(true) }; var newOtherGacPaths = new List <string>(); var newWinmdPaths = new List <string>(); var windir = Environment.GetEnvironmentVariable("WINDIR"); if (!string.IsNullOrEmpty(windir)) { AddIfExists(newOtherGacPaths, windir, @"Microsoft.NET\Framework\v1.1.4322"); AddIfExists(newOtherGacPaths, windir, @"Microsoft.NET\Framework\v1.0.3705"); } var dirPF = Environment.GetEnvironmentVariable("ProgramFiles"); AddWinMDPaths(newWinmdPaths, dirPF); var dirPFx86 = Environment.GetEnvironmentVariable("ProgramFiles(x86)"); if (!StringComparer.OrdinalIgnoreCase.Equals(dirPF, dirPFx86)) { AddWinMDPaths(newWinmdPaths, dirPFx86); } AddIfExists(newWinmdPaths, Environment.SystemDirectory, "WinMetadata"); OtherGacPaths = newOtherGacPaths.ToArray(); WinmdPaths = newWinmdPaths.ToArray(); }
private static AssemblyName EnumerateCache(AssemblyName partialName) { new SecurityPermission(SecurityPermissionFlag.UnmanagedCode).Assert(); partialName.Version = null; ArrayList alAssems = new ArrayList(); Fusion.ReadCache(alAssems, partialName.FullName, 2); IEnumerator enumerator = alAssems.GetEnumerator(); AssemblyName name = null; CultureInfo cultureInfo = partialName.CultureInfo; while (enumerator.MoveNext()) { AssemblyName name2 = new AssemblyName((string)enumerator.Current); if (CulturesEqual(cultureInfo, name2.CultureInfo)) { if (name == null) { name = name2; } else if (name2.Version > name.Version) { name = name2; } } } return(name); }
public override bool StartSpecialSkill(Cooldown sk) { if (sk.Skill.IconName == ManaBoost.Cooldown.Skill.IconName) { ManaBoost.Cooldown.Start(sk.Duration); return(true); } if (sk.Skill.IconName == PrimeFlame.IconName) { Fusion.Skill = PrimeFlame; Fusion.Start(sk.Duration, sk.Mode); if (sk.Mode == CooldownMode.Normal) { _latestCooldown = (long)sk.OriginalDuration; _sw.Restart(); } return(true); } if (sk.Skill.IconName == Fusion.Skill.IconName) { _latestCooldown = (long)sk.OriginalDuration; Fusion.Start(sk.Duration, sk.Mode); _sw.Restart(); } return(false); }
public void GenerateNewReleaseProduct(int amount, Action <bool> callback) { Fusion.Get(GENERATE_RELEASE_PRODUCT, true, (Fusion fusion, NPNFError getError) => { if (getError == null) { User.CurrentProfile.Fusion.Fuse(GENERATE_RELEASE_PRODUCT, fusion.Prices[0].Name, null, amount, (FormulaResult result, NPNFError error) => { if (error == null) { if (callback != null) { callback(true); } } else { if (callback != null) { callback(false); } Debug.LogError("generate release error: " + error.ToString()); } }); } else { if (callback != null) { callback(false); } } }); }
private void MenuHeaderParts(Fusion obj) { obj.Add(LineParts); obj.NewChild(CloseButtonTag, CloseButtonParts); obj.Add <Image>(DarkBackground); }
internal void FusionRegisterInternal() { var ipId = FusionShouldRegister(); try { if (ipId > 0) { IpIdFactory.Block(ipId, IpIdFactory.DeviceType.Fusion); Fusion = new FusionRoom(ipId, System.ControlSystem, Name, Guid.NewGuid().ToString()); Fusion.Description = "Fusion for " + Name; Fusion.FusionStateChange += OnFusionStateChange; Fusion.OnlineStatusChange += OnFusionOnlineStatusChange; Fusion.FusionAssetStateChange += FusionOnFusionAssetStateChange; } else { return; } } catch (Exception e) { CloudLog.Exception(e); } try { FusionShouldRegisterUserSigs(); } catch (Exception e) { CloudLog.Exception(e); } try { FusionShouldRegisterAssets(); } catch (Exception e) { CloudLog.Exception(e); } try { var regResult = Fusion.Register(); if (regResult != eDeviceRegistrationUnRegistrationResponse.Success) { CloudLog.Error("Error registering fusion in room {0} with IpId 0x{1:X2}, result = {2}", Id, ipId, regResult); } } catch (Exception e) { CloudLog.Exception(e); } }
internal override void Draw(Fusion.Graphics.SpriteBatch sb, Fusion.Graphics.DebugStrings ds, StereoEye stereoEye) { float offsetScale = 0; if (stereoEye == StereoEye.Left) offsetScale = -Config.offsetScale; if (stereoEye == StereoEye.Right) offsetScale = Config.offsetScale; sb.Draw(Texture, Cell.X - offsetScale, Cell.Y, Config.HEX_SIZE, Config.HEX_SIZE, Team.Color); }
public void ElementParts(Fusion obj) { obj.Add(BaseParts); var view = obj.Add <RolodexElementView>(); view.Label = obj.Get <DivText>(LabelTag); view.Icon = obj.Get <Image>(IconTag); view.IconVisibility = obj.Get <DivVisibility>(IconTag); }
public ActionResult CallingList(Fusion.Models.CallCenter.CallCenterModels.Order model) { if (model.start_dt == Convert.ToDateTime("01.01.0001")) model.start_dt = DateTime.Today.AddDays(-1); if (model.end_dt == Convert.ToDateTime("01.01.0001")) model.end_dt = DateTime.Today.AddDays(-1); model.GetOrders(); return View(model); }
public ActionResult OperatorsReport(Fusion.Models.CallCenter.CallCenterModels.OperatorReport model) { if (model.start_dt == Convert.ToDateTime("01.01.0001")) model.start_dt = DateTime.Today.AddDays(-10); if (model.end_dt == Convert.ToDateTime("01.01.0001")) model.end_dt = DateTime.Today; model.GetOperatorOrdersSum(); return View("OperatorsReport", model); }
public override bool execute(Fusion.GameTime gameTime) { if (Entity.Cell == sub1.Cell) { ((Submarine)Entity).damage(); ((Team)Entity.Parent).AI.NotifyAccident((Submarine)Entity); ActionsQueue.Field.addNewNoise(Entity.Cell, Config.NOISE_ACCIDENT); if (Entity.ToRemove) ActionsQueue.deleteAllFor(Entity); } return true; }
private void IconParts(Fusion obj) { var div = obj.Add <Div>(); div.Margin.Set(5, 0); div.MinSize.Set(20, 20); var image = obj.Add <Image>(); obj.Add <DivEnable>().Add(image); image.sprite = Fusion.LoadResource <Sprite>("RolodexCircleSprite"); }
private void unistallToolStripMenuItem_Click(object sender, EventArgs e) { var asm = listView1.SelectedObject; if (asm == null) { return; } Fusion.GacUninstall(((AssemInfo)asm).Source); ReFillList(); }
public static IEnumerable <FusionDesignInfo> GetSplices(IChain nPeptide, Range nAllowedSpliceRange, IChain cPeptide, Range cAllowedSpliceRange, int topX = DefaultTopX) { List <FusionDesignInfo> splices = new List <FusionDesignInfo>(); int minAlignmentLength = 8; float maxRmsd = 0.25f; // Find all alignments and remove those that are not between the desired ranges // If this becomes a bottleneck, could specify allowed alignment ranges List <SequenceAlignment> alignments = Fusion.GetAlignmentsPreservingFullSsBlocks(nPeptide, cPeptide, SS.Helix, minAlignmentLength, maxRmsd); alignments.RemoveAll(a => !(nAllowedSpliceRange.Start <= a.Range1.Start && a.Range1.End <= nAllowedSpliceRange.End)); alignments.RemoveAll(a => !(cAllowedSpliceRange.Start <= a.Range2.Start && a.Range2.End <= cAllowedSpliceRange.End)); foreach (SequenceAlignment alignment in alignments) { Matrix alignmentTransform = Rmsd.GetRmsdTransformForResidues(nPeptide, alignment.Range1.Start, alignment.Range1.End, cPeptide, alignment.Range2.Start, alignment.Range2.End); IChain copy1 = new Chain(nPeptide); IChain copy2 = new Chain(cPeptide); copy1.Transform(alignmentTransform); IChain[] clashCheckPeptides = new IChain[] { copy1, copy2 }; if (Clash.GetInterSetBackboneClashes(clashCheckPeptides, new int[] { 0, alignment.Range2.End + 1 }, new int[] { alignment.Range1.Start - 1, copy2.Count - 1 })) { continue; } // Create the spliced peptide IChain splicedPeptide = Fusion.GetChain( new IChain[] { copy1, copy2 }, new SequenceAlignment[] { alignment }, new IEnumerable <int>[] { new int[] { }, new int[] { } }); // Save it FusionDesignInfo spliceInfo = new FusionDesignInfo(); Range[] originalRanges = null; Range[] finalRanges = null; Fusion.GetIdentityRanges(clashCheckPeptides, new SequenceAlignment[] { alignment }, out originalRanges, out finalRanges); spliceInfo.Peptide = splicedPeptide; spliceInfo.OriginalChains = new IChain[] { nPeptide, cPeptide }; spliceInfo.PdbOutputChains = new IChain[] { splicedPeptide, copy1, copy2 }; spliceInfo.ImmutablePositions = new int[] { }; spliceInfo.IdentityRanges = finalRanges; spliceInfo.OriginalRanges = originalRanges; splices.Add(spliceInfo); splices.Sort((a, b) => b.Score.CompareTo(a.Score)); if (splices.Count > topX) { splices.RemoveAt(topX); } } return(splices); }
protected FusionStaticAsset FusionAddAsset(IFusionAsset asset) { try { uint key = 1; while (_fusionAssets.ContainsKey(key)) { key++; } Fusion.AddAsset(eAssetType.StaticAsset, key, asset.Name, asset.AssetType.ToString().SplitCamelCase(), Guid.NewGuid().ToString()); _fusionAssets.Add(key, asset); var newAsset = Fusion.UserConfigurableAssetDetails[key].Asset as FusionStaticAsset; if (newAsset == null) { return(null); } newAsset.ParamMake.Value = asset.ManufacturerName; newAsset.ParamModel.Value = asset.ModelName; newAsset.Connected.InputSig.BoolValue = asset.DeviceCommunicating; newAsset.AddSig(eSigType.String, 1, "Device Address", eSigIoMask.InputSigOnly); newAsset.AddSig(eSigType.String, 2, "Serial Number", eSigIoMask.InputSigOnly); newAsset.AddSig(eSigType.String, 3, "Version Info", eSigIoMask.InputSigOnly); asset.DeviceCommunicatingChange += FusionAssetOnDeviceCommunicatingChange; var deviceWithPower = asset as IPowerDevice; if (deviceWithPower != null) { deviceWithPower.PowerStatusChange += FusionAssetOnPowerStatusChange; newAsset.PowerOn.InputSig.BoolValue = deviceWithPower.Power; } } catch (Exception e) { CloudLog.Error("Error registering Fusion asset: {0} ({1}), {2}", asset.GetType().Name, asset.AssetType, e.Message); } return(null); }
private AssemInfo[] GetDisplayedAssemblies() { if (_gacAssemblies == null) { var assemblies = new ArrayList(); Fusion.ReadCache(assemblies, Fusion.CacheType.GAC); Fusion.ReadCache(assemblies, Fusion.CacheType.Zap); _gacAssemblies = assemblies.Cast <object>().Select(obj => new AssemInfo(obj)).ToArray(); } return(!string.IsNullOrEmpty(boxFilter.Text) ? _gacAssemblies.Where(e => e.Name.IndexOf(boxFilter.Text) != -1).ToArray() : _gacAssemblies); }
public void PathElementParts(Fusion obj) { obj.Add(BaseParts); var div = obj.Get <Div>(); div.Padding.Set(0); obj.Get <Image>(DarkBackground); var view = obj.Add <RolodexPathElementView>(); view.Label = obj.Get <DivText>(LabelTag); view.Icon = obj.Get <Image>(IconTag); view.IconVisibility = obj.Get <DivVisibility>(IconTag); }
protected override void FusionShouldRegisterUserSigs() { Fusion.AddSig(eSigType.Bool, 1, "Room Booked", eSigIoMask.InputSigOnly); Fusion.AddSig(eSigType.Bool, 2, "In Call", eSigIoMask.InputSigOnly); Fusion.AddSig(eSigType.Bool, 3, "Volume Mute", eSigIoMask.InputSigOnly); Fusion.AddSig(eSigType.Bool, 4, "Mic Mute", eSigIoMask.InputSigOnly); Fusion.AddSig(eSigType.String, 1, "Current Source", eSigIoMask.InputSigOnly); Fusion.AddSig(eSigType.String, 2, "System ID", eSigIoMask.InputSigOnly); Fusion.AddSig(eSigType.String, 3, "Room Type", eSigIoMask.InputSigOnly); Fusion.AddSig(eSigType.String, 7, "Program Version", eSigIoMask.InputSigOnly); Fusion.AddSig(eSigType.UShort, 1, "Volume", eSigIoMask.InputSigOnly); _fusionUpdateTimer = new CTimer(FusionUpdatePollTimer, null, 60000, 10000); }
void ListView1DragDrop(object sender, DragEventArgs e) { if (!e.Data.GetDataPresent(DataFormats.FileDrop) || e.Effect != DragDropEffects.Move) { return; } var files = (string[])e.Data.GetData(DataFormats.FileDrop); foreach (var file in files.Where(f => f.EndsWith(".dll"))) { Fusion.AddAssemblytoGac(file); } ReFillList(); }
void Awake() { // add copies of connection objects to this game object myTCP = gameObject.AddComponent <TCPConnection>(); myTCP2 = gameObject.AddComponent <TCPConnection>(); myTCP3 = gameObject.AddComponent <TCPConnection>(); myTCP4 = gameObject.AddComponent <TCPConnection>(); myfusion = gameObject.AddComponent <Fusion>(); myfusion.instanceNumber = 1; myfusion2 = gameObject.AddComponent <Fusion>(); myfusion2.instanceNumber = 2; myfusion3 = gameObject.AddComponent <Fusion>(); myfusion3.instanceNumber = 3; myfusion4 = gameObject.AddComponent <Fusion>(); myfusion4.instanceNumber = 4; }
public void SubmitRoleData() { string jsonStr = ""; JsonData jsonData = new JsonData(); jsonData["zoneId"] = "1"; jsonData["zoneName"] = "大侠客栈"; jsonData["roleId"] = "1-1"; jsonData["roleName"] = "李逍遥"; jsonData["roleLevel"] = 1; jsonData["roleCreateTime"] = "5497223"; jsonData["sociatyId"] = "10"; jsonData["sociaty"] = "FT"; jsonData["vip"] = "11"; jsonData["type"] = "enterServer"; jsonStr = JsonMapper.ToJson(jsonData); Fusion.SubmitRoleData(jsonStr); }
private void BaseParts(Fusion obj) { obj.Add(LineParts); obj.NewChild(IconTag, IconParts); obj.NewChild(LabelTag, LabelParts); var image = obj.Add <Image>(LightBackground); var button = obj.Add <Button>(); button.targetGraphic = image; var colorBlock = button.colors; colorBlock.disabledColor = Color.white; button.colors = colorBlock; obj.Add <DivFade>(); obj.Add <PoolMember>(); }
private void CloseButtonParts(Fusion obj) { var div = obj.Add <Div>(); div.Margin.Set(5, 0); div.MinSize.Set(20, 20); var image = obj.Add <Image>(); image.sprite = Fusion.LoadResource <Sprite>("RolodexCloseSprite"); obj.Add <Button>().targetGraphic = image; var visibility = obj.Add <DivEnable>(); visibility.Add(image); visibility.IsVisible = false; }
public static List <DomAssemblyName> GetAssemblyList() { IApplicationContext applicationContext = null; IAssemblyEnum assemblyEnum = null; IAssemblyName assemblyName = null; List <DomAssemblyName> l = new List <DomAssemblyName>(); Fusion.CreateAssemblyEnum(out assemblyEnum, null, null, 2, 0); while (assemblyEnum.GetNextAssembly(out applicationContext, out assemblyName, 0) == 0) { uint nChars = 0; assemblyName.GetDisplayName(null, ref nChars, 0); StringBuilder sb = new StringBuilder((int)nChars); assemblyName.GetDisplayName(sb, ref nChars, 0); l.Add(new DomAssemblyName(sb.ToString())); } return(l); }
/// <summary> /// Handle keys for each demo /// </summary> /// <param name="sender"></param> /// <param name="e"></param> void InputDevice_KeyDown ( object sender, Fusion.Input.InputDevice.KeyEventArgs e ) { if (e.Key == Keys.F1) { DevCon.Show(this); } if (e.Key == Keys.F2) { Parameters.VSyncInterval = (Parameters.VSyncInterval == 0) ? 1 : 0; } if (e.Key == Keys.F5) { Reload(); } if (e.Key == Keys.F12) { GraphicsDevice.Screenshot(); } if (e.Key == Keys.Escape) { Exit(); } }
public void Parts(Fusion obj) { obj.NewChild(HeaderTag, MenuHeaderParts); obj.NewChild(ScrollTag, ScrollParts); var div = obj.Add <Div>(); div.Style = LayoutStyle.Vertical; div.ExpandChildren = true; var divScroll = obj.Get <DivScroll>(ScrollTag); divScroll.MaxSize.Set(0, 150); var menu = obj.Add <RoloView>(); menu.HeaderColor = DarkBackgroundColor; menu.DefaultColor = LightBackgroundColor; menu.HeaderDiv = obj.Get <Div>(HeaderTag); menu.ElementParent = obj.Get <Div>(ContentTag); menu.Scroll = divScroll; }
public void GetAllFusion(Action <bool> callback = null, int retry = 3) { Fusion.GetAll(false, (List <Fusion> fusions, NPNFError error) => { if (error == null) { for (int i = 0; i < fusions.Count; i++) { if (fusions[i].Name.Equals(GENERATE_RELEASE_PRODUCT)) { commitToReleaseProduct = fusions[i].Prices[0].Currencies[0].Count; } else if (fusions[i].Name.Equals(HIRE_NEW_ENGINEER_FUSION)) { goldToEngineer = fusions[i].Prices[0].Currencies[0].Count; } } if (callback != null) { callback(true); } } else { retry--; if (retry > 0) { GetAllFusion(callback, retry); } else { if (callback != null) { callback(false); } } } }); }
void InputDevice_KeyDown(object sender, Fusion.Input.InputDevice.KeyEventArgs e) { if (e.Key == Keys.Up) { if (Config.SPEED >= 10) Config.SPEED = Config.SPEED + 5; else if (Config.SPEED >= 2) Config.SPEED = Config.SPEED + 1; else Config.SPEED = (float)(Math.Round((double)Config.SPEED + 0.1f, 1)); } if (e.Key == Keys.Down) { if (Config.SPEED > 10) Config.SPEED = Config.SPEED - 5; else if (Config.SPEED > 2) Config.SPEED = Config.SPEED - 1; else Config.SPEED = (float)(Math.Round((double)Config.SPEED - 0.1f, 1)); } }
/// <summary> /// Creates a new HAC object to cluster the specified elements with the specified fusion and /// metric function. /// </summary> /// <param name="elements"></param> /// <param name="fusion"></param> /// <param name="metric"></param> public HacStart(Element[] elements, Fusion fusion, IDistanceMetric metric) { setElements(elements); this.fusion = fusion; this.fusion.Metric = metric; }
protected abstract void FuseErrorHandler(Fusion fusion, FusionTrigger trigger, NPNFError error);
/// <summary> /// Handle keys /// </summary> /// <param name="sender"></param> /// <param name="e"></param> void InputDevice_KeyDown(object sender, Fusion.Input.InputDevice.KeyEventArgs e) { if (e.Key == Keys.F1) { DevCon.Show(this); } if (e.Key == Keys.F5) { Reload(); } if (e.Key == Keys.F12) { GraphicsDevice.Screenshot(); } if (e.Key == Keys.Escape) { Exit(); } if (e.Key == Keys.P) { GetService<GraphSystem>().Pause(); } if (e.Key == Keys.Q) { Graph graph = GetService<GraphSystem>().GetGraph(); graph.WriteToFile("graph.gr"); Log.Message("Graph saved to file"); } if (e.Key == Keys.F) // focus on a node { var cam = GetService<GreatCircleCamera>(); var pSys = GetService<GraphSystem>(); if (!isSelected) { // cam.CenterOfOrbit = new Vector3(0, 0, 0); } else { // cam.CenterOfOrbit = pSys.GetGraph().Nodes[selectedNodeIndex].Position; pSys.Focus(selectedNodeIndex); } } if (e.Key == Keys.G) // collapse random edge { var pSys = GetService<GraphSystem>(); Graph graph = pSys.GetGraph(); int edge = rnd.Next(graph.EdgeCount); graph.CollapseEdge(edge); pSys.UpdateGraph(graph); } if (e.Key == Keys.LeftButton) { var pSys = GetService<GraphSystem>(); Point cursor = InputDevice.MousePosition; Vector3 nodePosition = new Vector3(); int selNode = 0; if (pSys.ClickNode(cursor, StereoEye.Mono, 0.025f, out selNode)) { selectedNodeIndex = selNode; isSelected = true; selectedNodePos = nodePosition; if (stNet != null && selectedNodeIndex < stNet.NodeCount) { Console.WriteLine(((NodeWithText)stNet.Nodes[selectedNodeIndex]).Text); } Doctor doctor = doctorToPatients.Keys.First(x => x.id == selectedNodeIndex ); doctorToPatients.TryGetValue( doctor, out patients); mainPanel.GetRightFrame().fillPatientList(patients, drawPatientsPath); } else { isSelected = false; } } }
/// <summary> /// Handle keys for each demo /// </summary> /// <param name="sender"></param> /// <param name="e"></param> void InputDevice_KeyDown (object sender, Fusion.Input.InputDevice.KeyEventArgs e) { if ( e.Key == Keys.F1 ) { //DevCon.Show(this); } if ( e.Key == Keys.F2 ) { Parameters.ToggleVSync(); } if ( e.Key == Keys.F5 ) { Reload(); } if ( e.Key == Keys.F12 ) { GraphicsDevice.Screenshot(); } if ( e.Key == Keys.Escape ) { Exit(); } if (e.Key==Keys.T) { foreach ( var box in space.Entities ) { box.AngularMomentum *= 10.1f; } } // pause physics if ( e.Key == Keys.P ) { if ( flag ) { flag = false; } else { flag = true; } } // shoot box from camera if ( e.Key == Keys.LeftButton ) { Vector3Fusion vector = GetService<Camera>().FreeCamPosition; Box box = new Box(new Vector3BEPU(vector.X, vector.Y, vector.Z), 1, 1, 1, 1); Vector3Fusion velocity = 10 * GetService<Camera>().GetCameraMatrix(StereoEye.Mono).Forward; box.LinearVelocity = new Vector3BEPU(velocity.X, velocity.Y, velocity.Z); box.Tag = RandomExt.NextColor(random); space.Add(box); } // add new box somewhere if ( e.Key == Keys.O ) { Vector3Fusion vector = RandomExt.NextVector3(random, new Vector3Fusion(-10, 20, -10), new Vector3Fusion(10, 30, 10)); Box box = new Box(new Vector3BEPU(vector.X, vector.Y, vector.Z), 1, 1, 1, 1); box.Tag = RandomExt.NextColor(random); space.Add(box); } }
void inputDevice_MouseScroll(object sender, Fusion.Input.InputDevice.MouseScrollEventArgs e) { var cam = GetService<GreatCircleCamera>(); cam.DollyZoom(e.WheelDelta / 60.0f); }
protected abstract void FuseDoneHandler(Fusion fusion, FusionTrigger trigger, FormulaResult results);
/// <summary> /// /// </summary> /// <param name="gameTime"></param> /// <param name="stereoEye"></param> protected override void Draw ( GameTime gameTime, Fusion.Graphics.StereoEye stereoEye ) { base.Draw(gameTime, stereoEye); }
void keyboardHandler(object sender, Fusion.Input.InputDevice.KeyEventArgs e) { if ( e.Key == Keys.OemPlus ) { commandQueue.Enqueue(1); } if ( e.Key == Keys.OemMinus ) { commandQueue.Enqueue(-1); } }
/// <summary> /// /// </summary> /// <param name="gameTime"></param> /// <param name="stereoEye"></param> public override void Draw( GameTime gameTime, Fusion.Graphics.StereoEye stereoEye ) { var device = Game.GraphicsDevice; var cam = Game.GetService<GreatCircleCamera>(); int lastCommand = 0; if ( commandQueue.Count > 0 ) { lastCommand = commandQueue.Dequeue(); } // Calculate positions: ---------------------------------------------------- lay.UseGPU = Config.UseGPU; lay.SpringTension = Config.SpringTension; lay.StepMode = Config.StepMode; lay.Update(lastCommand); // Render: ----------------------------------------------------------------- Params param = new Params(); param.View = cam.GetViewMatrix(stereoEye); param.Projection = cam.GetProjectionMatrix(stereoEye); param.SelectedNode = referenceNodeIndex; render( device, lay, param ); // Debug output: ------------------------------------------------------------ var debStr = Game.GetService<DebugStrings>(); //debStr.Add( Color.Yellow, "drawing " + nodeList.Count + " points" ); //debStr.Add( Color.Yellow, "drawing " + edgeList.Count + " lines" ); //debStr.Add( Color.Black, lay.UseGPU ? "Using GPU" : "Not using GPU" ); base.Draw( gameTime, stereoEye ); }
/// <summary> /// /// </summary> /// <param name="gameTime"></param> /// <param name="stereoEye"></param> public override void Draw( GameTime gameTime, Fusion.Graphics.StereoEye stereoEye ) { var device = Game.GraphicsDevice; int w = device.DisplayBounds.Width; int h = device.DisplayBounds.Height; Params param = new Params(); param.View = Matrix.Identity; param.Projection = Matrix.OrthoOffCenterRH(0, w, h, 0, -9999, 9999); param.MaxParticles = 0; param.DeltaTime = gameTime.ElapsedSec; device.ComputeShaderConstants[0] = paramsCB ; device.VertexShaderConstants[0] = paramsCB ; device.GeometryShaderConstants[0] = paramsCB ; device.PixelShaderConstants[0] = paramsCB ; device.PixelShaderSamplers[0] = SamplerState.LinearWrap ; // // Inject : // injectionBuffer.SetData( injectionBufferCPU ); device.Clear( simulationBufferDst, Int4.Zero ); device.ComputeShaderResources[1] = injectionBuffer ; device.SetCSRWBuffer( 0, simulationBufferDst, 0 ); param.MaxParticles = injectionCount; paramsCB.SetData( param ); //device.CSConstantBuffers[0] = paramsCB ; device.PipelineState = factory[ (int)Flags.INJECTION ]; device.Dispatch( MathUtil.IntDivUp( MaxInjectingParticles, BlockSize ) ); ClearParticleBuffer(); // // Simulate : // device.ComputeShaderResources[1] = simulationBufferSrc ; param.MaxParticles = MaxSimulatedParticles; paramsCB.SetData( param ); device.ComputeShaderConstants[0] = paramsCB ; device.PipelineState = factory[ (int)Flags.SIMULATION ]; device.Dispatch( MathUtil.IntDivUp( MaxSimulatedParticles, BlockSize ) );//*/ SwapParticleBuffers(); // // Render // device.PipelineState = factory[ (int)Flags.DRAW ]; device.SetCSRWBuffer( 0, null ); device.PixelShaderResources[0] = texture ; device.GeometryShaderResources[1] = simulationBufferSrc ; device.Draw( MaxSimulatedParticles, 0 ); /*var testSrc = new Particle[MaxSimulatedParticles]; var testDst = new Particle[MaxSimulatedParticles]; simulationBufferSrc.GetData( testSrc ); simulationBufferDst.GetData( testDst );*/ base.Draw( gameTime, stereoEye ); }
/// <summary> /// Handle keys /// </summary> /// <param name="sender"></param> /// <param name="e"></param> void InputDevice_KeyDown(object sender, Fusion.Input.InputDevice.KeyEventArgs e) { if (e.Key == Keys.F1) { DevCon.Show(this); } if (e.Key == Keys.F5) { Reload(); } if (e.Key == Keys.F12) { GraphicsDevice.Screenshot(); } if (e.Key == Keys.Escape) { Exit(); } }
public override bool execute(Fusion.GameTime gameTime) { ((Submarine)Entity).reload(); return true; }
public void updatePanelScroll(int verticalOffset, Fusion.Input.InputDevice.MouseScrollEventArgs e) { int maxwheel = listPatientsButton.ElementAt(listPatientsButton.Count() - 1).Y + this.Font.LineHeight; float bottom_boundary = maxwheel - this.Height; if ((listPatientsButton.ElementAt(0).Y < 0 && e.WheelDelta > 0) || (bottom_boundary >= 0 && e.WheelDelta < 0)) { verticalOffset += e.WheelDelta; int y = verticalOffset + 5; foreach (var child in listPatientsButton) { child.Y = y; y += child.Height + 10; } } }
/// <summary> /// Handle keys for each demo /// </summary> /// <param name="sender"></param> /// <param name="e"></param> void InputDevice_KeyDown ( object sender, Fusion.Input.InputDevice.KeyEventArgs e ) { if (e.Key == Keys.F1) { //DevCon.Show(this); } if (e.Key == Keys.F12) { GraphicsDevice.Screenshot(); } if (e.Key == Keys.F2) { Parameters.ToggleVSync(); } if (e.Key == Keys.Escape) { Exit(); } }
public Cluster(Fusion fusion) { this.fusion = fusion; }
public override bool execute(Fusion.GameTime gameTime) { ((Submarine)Entity).damage(); ((Team)Entity.Parent).AI.NotifyTorpedoDamage((Submarine)Entity); return true; }
/// <summary> /// Handle keys /// </summary> /// <param name="sender"></param> /// <param name="e"></param> void InputDevice_KeyDown(object sender, Fusion.Input.InputDevice.KeyEventArgs e) { if (e.Key == Keys.F1) { DevCon.Show(this); } if (e.Key == Keys.F5) { Reload(); } if (e.Key == Keys.F12) { GraphicsDevice.Screenshot(); } if (e.Key == Keys.Escape) { Exit(); } if (e.Key == Keys.P) // pause/unpause { var gs = GetService<GraphSystem>(); if (gs.Paused) gs.Unpause(); else gs.Pause(); } if (e.Key == Keys.F) // focus on a node { var cam = GetService<GreatCircleCamera>(); var pSys = GetService<GraphSystem>(); if (nodeSelected) { pSys.Focus(selectedNodeIndex, cam); } } if (e.Key == Keys.LeftButton) { var pSys = GetService<GraphSystem>(); Point cursor = InputDevice.MousePosition; int selNode = 0; if (nodeSelected = pSys.ClickNode(cursor, StereoEye.Mono, 0.025f, out selNode)) { selectedNodeIndex = selNode; var protein = protGraph.GetProtein(selectedNodeIndex); var inEdges = protGraph.GetIncomingInteractions(protein.Name); var outEdges = protGraph.GetOutcomingInteractions(protein.Name); string protName = ((NodeWithText)protGraph.Nodes[selNode]).Text; Console.WriteLine("id = " + selNode + " name: " + protein.Name + ": "); Console.WriteLine("incoming:"); foreach (var ie in inEdges) { Console.WriteLine(ie.Item1.GetInfo()); } Console.WriteLine("outcoming:"); foreach (var oe in outEdges) { Console.WriteLine(oe.Item1.GetInfo()); } Console.WriteLine(); s = "Name: " + protein.Name; } } if (e.Key == Keys.R) { ResetGraph(); } //if (e.Key == Keys.Q) //{ // Graph graph = GetService<GraphSystem>().GetGraph(); // graph.WriteToFile("../../../../graph.gr"); // Log.Message("Graph saved to file"); //} }
/// <summary> /// Handle keys /// </summary> /// <param name="sender"></param> /// <param name="e"></param> void InputDevice_KeyDown(object sender, Fusion.Input.InputDevice.KeyEventArgs e) { if (e.Key == Keys.F1) { DevCon.Show(this); } if (e.Key == Keys.F5) { Reload(); } if (e.Key == Keys.F12) { GraphicsDevice.Screenshot(); } if (e.Key == Keys.Escape) { Exit(); } if ( e.Key == Keys.P ) { GetService<GraphSystem>().Pause(); } //if (e.Key == Keys.I) //{ // GetService<GraphSystem>().SwitchStepMode(); //} //if (e.Key == Keys.M) //{ // Graph graph = Graph.MakeTree( 256, 2 ); // float[] centralities = new float[graph.NodeCount]; // float maxC = graph.GetCentrality(0); // float minC = maxC; // for (int i = 0; i < graph.NodeCount; ++i) // { // centralities[i] = graph.GetCentrality(i); // maxC = maxC < centralities[i] ? centralities[i] : maxC; // minC = minC > centralities[i] ? centralities[i] : minC; // Log.Message( ":{0}", i ); // } // float range = maxC - minC; // for (int i = 0; i < graph.NodeCount; ++i) // { // centralities[i] -= minC; // centralities[i] /= range; // centralities[i] *= 0.9f; // centralities[i] += 0.1f; // var color = new Color(0.6f, 0.3f, centralities[i], 1.0f); //// var color = new Color(centralities[i]); // B/W // graph.Nodes[i] = new BaseNode(5.0f, color); // } // GetService<GraphSystem>().AddGraph(graph); //} if (e.Key == Keys.Q) { Graph graph = GetService<GraphSystem>().GetGraph(); graph.WriteToFile( "graph.gr" ); Log.Message( "Graph saved to file" ); } if (e.Key == Keys.F) // focus on a node { var cam = GetService<GreatCircleCamera>(); var pSys = GetService<GraphSystem>(); if (!isSelected) { // cam.CenterOfOrbit = new Vector3(0, 0, 0); } else { // cam.CenterOfOrbit = pSys.GetGraph().Nodes[selectedNodeIndex].Position; pSys.Focus(selectedNodeIndex); } } if (e.Key == Keys.G) // collapse random edge { var pSys = GetService<GraphSystem>(); Graph graph = pSys.GetGraph(); int edge = rnd.Next(graph.EdgeCount); graph.CollapseEdge(edge); pSys.UpdateGraph(graph); } if (e.Key == Keys.LeftButton) { var pSys = GetService<GraphSystem>(); Point cursor = InputDevice.MousePosition; Vector3 nodePosition = new Vector3(); int selNode = 0; if (pSys.ClickNode(cursor, StereoEye.Mono, 0.025f, out selNode)) { selectedNodeIndex = selNode; isSelected = true; selectedNodePos = nodePosition; if (stNet != null && selectedNodeIndex < stNet.NodeCount) { Console.WriteLine(((NodeWithText)stNet.Nodes[selectedNodeIndex]).Text); } } else { isSelected = false; } } }
/// <summary> /// /// </summary> /// <param name="gameTime"></param> /// <param name="stereoEye"></param> public override void Draw( GameTime gameTime, Fusion.Graphics.StereoEye stereoEye ) { var ds = Game.GetService<DebugStrings>(); ds.Add("{0}", injectionCount ); var device = Game.GraphicsDevice; device.ResetStates(); device.SetTargets( null, device.BackbufferColor ); int w = device.DisplayBounds.Width; int h = device.DisplayBounds.Height; //var map = "SV_POSITION.xyzw;COLOR0.xyzw;COLOR1.xyzw;TEXCOORD0.xyzw;TEXCOORD1.xyzw;TEXCOORD2.xyzw"; Params param = new Params(); param.View = Matrix.Identity; param.Projection = Matrix.OrthoOffCenterRH(0, w, h, 0, -9999, 9999); param.MaxParticles = 100; param.DeltaTime = gameTime.ElapsedSec; paramsCB.SetData( param ); device.VertexShaderConstants[0] = paramsCB ; device.GeometryShaderConstants[0] = paramsCB ; device.PixelShaderConstants[0] = paramsCB ; device.PixelShaderSamplers[0] = SamplerState.LinearWrap ; // // Simulate : // device.PipelineState = factory[ (int)Flags.SIMULATION ]; device.SetupVertexInput( simulationSrcVB, null ); device.SetupVertexOutput( simulationDstVB, 0 ); device.DrawAuto(); // // Inject : // injectionVB.SetData( injectionBufferCPU ); device.PipelineState = factory[ (int)Flags.INJECTION ]; device.SetupVertexInput( injectionVB, null ); device.SetupVertexOutput( simulationDstVB, -1 ); device.Draw(injectionCount, 0 ); SwapParticleBuffers(); // // Render // paramsCB.SetData( param ); device.VertexShaderConstants[0] = paramsCB ; device.GeometryShaderConstants[0] = paramsCB ; device.PixelShaderConstants[0] = paramsCB ; device.PipelineState = factory[ (int)Flags.RENDER ]; device.PixelShaderResources[0] = texture ; device.SetupVertexOutput( null, 0 ); device.SetupVertexInput( simulationSrcVB, null ); //device.Draw( Primitive.PointList, injectionCount, 0 ); device.DrawAuto(); //device.Draw( Primitive.PointList, MaxSimulatedParticles, 0 ); ClearParticleBuffer(); base.Draw( gameTime, stereoEye ); }
/// <summary> /// /// </summary> //void SwapParticleBuffers () //{ // var temp = simulationBufferDst; // simulationBufferDst = simulationBufferSrc; // simulationBufferSrc = temp; //} /// <summary> /// /// </summary> /// <param name="gameTime"></param> /// <param name="stereoEye"></param> public override void Draw ( GameTime gameTime, Fusion.Graphics.StereoEye stereoEye ) { var device = Game.GraphicsDevice; int w = device.DisplayBounds.Width; int h = device.DisplayBounds.Height; Params param = new Params(); param.View = Matrix.Identity; param.Projection = Matrix.OrthoOffCenterRH(0, w, h, 0, -9999, 9999); param.MaxParticles = 0; param.DeltaTime = gameTime.ElapsedSec; device.ComputeShaderConstants[0] = paramsCB ; device.VertexShaderConstants[0] = paramsCB ; device.GeometryShaderConstants[0] = paramsCB ; device.PixelShaderConstants[0] = paramsCB ; device.PixelShaderSamplers[0] = SamplerState.LinearWrap ; // // Inject : // injectionBuffer.SetData( injectionBufferCPU ); device.ComputeShaderResources[1] = injectionBuffer ; device.SetCSRWBuffer( 0, simulationBuffer, 0 ); device.SetCSRWBuffer( 1, deadParticlesIndices, -1 ); param.MaxParticles = injectionCount; //param.DeadListSize = (uint)deadParticlesIndices.GetStructureCount(); paramsCB.SetData( param ); deadParticlesIndices.CopyStructureCount( paramsCB, 136 ); //device.CSConstantBuffers[0] = paramsCB ; device.PipelineState = factory[ (int)Flags.INJECTION ]; // GPU time ???? -> 0.0046 device.Dispatch( MathUtil.IntDivUp( MaxInjectingParticles, BlockSize ) ); ClearParticleBuffer(); // // Simulate : // bool skipSim = Game.InputDevice.IsKeyDown(Fusion.Input.Keys.P); if (!skipSim) { device.SetCSRWBuffer( 0, simulationBuffer, 0 ); device.SetCSRWBuffer( 1, deadParticlesIndices, -1 ); param.MaxParticles = MaxSimulatedParticles; paramsCB.SetData( param ); device.ComputeShaderConstants[0] = paramsCB ; device.PipelineState = factory[ (int)Flags.SIMULATION ]; /// GPU time : 1.665 ms --> 0.38 ms device.Dispatch( MathUtil.IntDivUp( MaxSimulatedParticles, BlockSize ) );//*/ } // // Render // device.PipelineState = factory[ (int)Flags.DRAW ]; device.SetCSRWBuffer( 0, null ); device.PixelShaderResources[0] = texture ; device.GeometryShaderResources[1] = simulationBuffer ; device.GeometryShaderResources[2] = simulationBuffer ; // GPU time : 0.81 ms -> 0.91 ms device.Draw( MaxSimulatedParticles, 0 ); base.Draw( gameTime, stereoEye ); }
internal override void Update(Fusion.GameTime gameTime) { if (ToRemove) Parent.Remove(this); }
public void ApplyAttributeBuilder(Attribute a, MethodSpec ctor, byte[] cdata, PredefinedAttributes pa) { if (a.IsValidSecurityAttribute()) { a.ExtractSecurityPermissionSet(ctor, ref declarative_security); return; } if (a.Type == pa.AssemblyCulture) { string value = a.GetString(); if (value == null || value.Length == 0) { return; } if (Compiler.Settings.Target == Target.Exe) { a.Error_AttributeEmitError("The executables cannot be satelite assemblies, remove the attribute or keep it empty"); return; } if (value == "neutral") { value = ""; } if (Compiler.Settings.Target == Target.Module) { SetCustomAttribute(ctor, cdata); } else { builder_extra.SetCulture(value, a.Location); } IsSatelliteAssembly = true; return; } if (a.Type == pa.AssemblyVersion) { string value = a.GetString(); if (value == null || value.Length == 0) { return; } var vinfo = IsValidAssemblyVersion(value, true); if (vinfo == null) { a.Error_AttributeEmitError(string.Format("Specified version `{0}' is not valid", value)); return; } if (Compiler.Settings.Target == Target.Module) { SetCustomAttribute(ctor, cdata); } else { builder_extra.SetVersion(vinfo, a.Location); } return; } if (a.Type == pa.AssemblyAlgorithmId) { const int pos = 2; // skip CA header uint alg = (uint)cdata [pos]; alg |= ((uint)cdata [pos + 1]) << 8; alg |= ((uint)cdata [pos + 2]) << 16; alg |= ((uint)cdata [pos + 3]) << 24; if (Compiler.Settings.Target == Target.Module) { SetCustomAttribute(ctor, cdata); } else { builder_extra.SetAlgorithmId(alg, a.Location); } return; } if (a.Type == pa.AssemblyFlags) { const int pos = 2; // skip CA header uint flags = (uint)cdata[pos]; flags |= ((uint)cdata [pos + 1]) << 8; flags |= ((uint)cdata [pos + 2]) << 16; flags |= ((uint)cdata [pos + 3]) << 24; // Ignore set PublicKey flag if assembly is not strongnamed if ((flags & (uint)AssemblyNameFlags.PublicKey) != 0 && public_key == null) { flags &= ~(uint)AssemblyNameFlags.PublicKey; } if (Compiler.Settings.Target == Target.Module) { SetCustomAttribute(ctor, cdata); } else { builder_extra.SetFlags(flags, a.Location); } return; } if (a.Type == pa.TypeForwarder) { TypeSpec t = a.GetArgumentType(); if (t == null || TypeManager.HasElementType(t)) { Report.Error(735, a.Location, "Invalid type specified as an argument for TypeForwardedTo attribute"); return; } if (emitted_forwarders == null) { emitted_forwarders = new Dictionary <ITypeDefinition, Attribute> (); } else if (emitted_forwarders.ContainsKey(t.MemberDefinition)) { Report.SymbolRelatedToPreviousError(emitted_forwarders[t.MemberDefinition].Location, null); Report.Error(739, a.Location, "A duplicate type forward of type `{0}'", t.GetSignatureForError()); return; } emitted_forwarders.Add(t.MemberDefinition, a); if (t.MemberDefinition.DeclaringAssembly == this) { Report.SymbolRelatedToPreviousError(t); Report.Error(729, a.Location, "Cannot forward type `{0}' because it is defined in this assembly", t.GetSignatureForError()); return; } if (t.IsNested) { Report.Error(730, a.Location, "Cannot forward type `{0}' because it is a nested type", t.GetSignatureForError()); return; } builder_extra.AddTypeForwarder(t.GetDefinition(), a.Location); return; } if (a.Type == pa.Extension) { a.Error_MisusedExtensionAttribute(); return; } if (a.Type == pa.InternalsVisibleTo) { string assembly_name = a.GetString(); if (assembly_name.Length == 0) { return; } #if STATIC ParsedAssemblyName aname; ParseAssemblyResult r = Fusion.ParseAssemblyName(assembly_name, out aname); if (r != ParseAssemblyResult.OK) { Report.Warning(1700, 3, a.Location, "Assembly reference `{0}' is invalid and cannot be resolved", assembly_name); return; } if (aname.Version != null || aname.Culture != null || aname.ProcessorArchitecture != ProcessorArchitecture.None) { Report.Error(1725, a.Location, "Friend assembly reference `{0}' is invalid. InternalsVisibleTo declarations cannot have a version, culture or processor architecture specified", assembly_name); return; } if (public_key != null && !aname.HasPublicKey) { Report.Error(1726, a.Location, "Friend assembly reference `{0}' is invalid. Strong named assemblies must specify a public key in their InternalsVisibleTo declarations", assembly_name); return; } #endif } else if (a.Type == pa.RuntimeCompatibility) { wrap_non_exception_throws_custom = true; } else if (a.Type == pa.AssemblyFileVersion) { string value = a.GetString(); if (string.IsNullOrEmpty(value) || IsValidAssemblyVersion(value, false) == null) { Report.Warning(1607, 1, a.Location, "The version number `{0}' specified for `{1}' is invalid", value, a.Name); return; } } SetCustomAttribute(ctor, cdata); }
void inputDevice_MouseScroll(object sender, Fusion.Input.InputDevice.MouseScrollEventArgs e) { Rectangle patientButtonArea = new Rectangle( GraphicsDevice.DisplayBounds.Width - 200, 0, 200, GraphicsDevice.DisplayBounds.Height ); if ( patientButtonArea.Contains( InputDevice.MousePosition ) && e.WheelDelta != 0 ) { mainPanel.GetRightFrame().updatePanelScroll(verticalOffset, e); } else { var cam = GetService<GreatCircleCamera>(); cam.DollyZoom(e.WheelDelta / 60.0f); } }