public virtual void AddDetectedCover(Cover cover) { if (detectedCover == null) detectedCover = new List<Cover>(); if (!detectedCover.Contains(cover)) detectedCover.Add(cover); }
bool FindCover() { for (int i = 0; i < covers.Length; i++) { Cover cover = covers [i].GetComponent<Cover> (); if (cover == null) cover = covers [i].AddComponent<Cover> (); if (cover.beingUsed == false) { myCover = cover; return true; } } return false; }
public static IEnumerable<Cover> FindCovers (IEnumerable<LSBody> checkBodies, Cover ignoreCov) { foreach (LSBody body in checkBodies) { Cover cover = body.GetComponent<Cover> (); if (body.GetComponent<Cover>() == null) { break; } if (cover == ignoreCov) { continue; } if (!IsActive (cover)) { continue; } yield return cover; } }
public GameMain() { Instance = this; string path = AppSettings.Instance.GetPath("Media") + "SpaceInv"; AppSettings.Instance.AddPath("Media", path); PicRef.ScanDirectory(path); this.m_clrOffwhite = System.Drawing.Color.FromArgb(214,181,140); this.m_interfaceSprites = new ArrayList(); this.m_score = new Score(); this.m_livesLeft = new LivesLeft(); Sprite sp = new Sprite(); sp.SetGraphics("Screen"); sp.LocZ = 500; sp.Ink = RasterOps.ROPs.AddPin; this.m_interfaceSprites.Add(sp); this.AddColorizers(); this.m_covers = new ArrayList(); Cover cover; for (int nCoverNum = 0; nCoverNum < 4; nCoverNum++) { cover = new Cover(); cover.Loc = new EPointF(170 + 90 + (nCoverNum-1)*90,369); this.m_covers.Add(cover); } ERectangleF rctPlayArea = ERectangleF.FromLTRB(155,20,550,400); //new ERectangleF(145,10,350,200); //155 550 this.m_invadersGrid = new InvadersGrid(); //ERectangleF rctPlayerConstraints = rctPlayArea+ERectangleF.FromLTRB(-10,0,-55,0); this.m_player = new Player(); }
// ------------------------------------------------- DefineCover public override void DefineCover () { CoverNode [] nodes = new CoverNode [nNodesOnOuter + nNodesOnInner + nNodesPoly]; PointF [] ptOuter = new PointF [nNodesOnOuter]; for (int i = 0; i < nNodesOnOuter; i++) { ptOuter [i] = Auxi_Geometry .PointToPoint (ptCenter, 2 * Math .PI * i / nNodesOnOuter, nrOuter); } for (int i = 0; i < nNodesOnOuter; i++) { nodes [i] = new CoverNode (i, ptOuter [i], nrSmall); } for (int i = 0; i < nNodesOnInner; i++) { nodes [nNodesOnOuter + i] = new CoverNode (nNodesOnOuter + i, Auxi_Geometry .PointToPoint (ptCenter, 2 * Math .PI * i / nNodesOnInner, nrInner), nrSmall); } double ratioRadiuses = (double) nrInner / nrOuter; int nSmall = nNodesOnOuter + nNodesOnInner; PointF p0_in, p1_in, p0_out, p1_out; for (int i = 0; i < nNodesPoly; i++) { int jOutPt = (i * 2) % nNodesOnOuter; p0_out = ptOuter [jOutPt]; p1_out = ptOuter [(jOutPt + 2) % nNodesOnOuter]; p0_in = Auxi_Geometry .PointOnLine (ptCenter, p0_out, ratioRadiuses); p1_in = Auxi_Geometry .PointOnLine (ptCenter, p1_out, ratioRadiuses); nodes [nSmall + i] = new CoverNode (nSmall + i, new PointF [] { p0_in, p0_out, p1_out, p1_in }); } cover = new Cover (nodes); cover .SetClearance (NodeShape .Circle, false); }
// ------------------------------------------------- DefineCover public override void DefineCover () { cover = new Cover (new CoverNode [] { new CoverNode (0, pt0, pt1, radius) }); }
// ------------------------------------------------- DefineCover public override void DefineCover () { CoverNode node = new CoverNode (0, center, radius, Cursors .SizeAll); cover = new Cover (new CoverNode [] { node }); }
// ------------------------------------------------- DefineCover public override void DefineCover () { cover = new Cover (rc, resize, radius, halfstrip); }
// ------------------------------------------------- DefineCover public override void DefineCover () { cover = new Cover (Area, Resizing .None); }
public override void OnTrigger(RulebookEventContext context) { if (!Main.Settings.UseSoftCover) { Main.Logger?.Write("Soft Cover Rules disabled, result of soft cover check is Cover.None"); Result = Cover.None; return; } Main.Logger?.Append("RuleCheckSoftCover Triggered"); Main.Logger?.Append($"Attacker = {Initiator.CharacterName} ({Initiator.UniqueId})"); Main.Logger?.Append($"Target = {Target.CharacterName} ({Target.UniqueId})"); Main.Logger?.Append($"#IgnoreUnits = {IgnoreUnits.Count}"); Main.Logger?.Append($"AttackerIgnoresCover = {AttackerIgnoresCover}"); Main.Logger?.Append($"AttackType = {AttackType}"); if (AttackerIgnoresCover) { Main.Logger?.Flush(); return; } Vector2 toPosition = Target.Position.To2D(); Vector2 fromPosition = Initiator.Position.To2D(); int i = 0; List <UnitEntityData> unitsToCheck = new List <UnitEntityData>(); Main.Logger?.Append("Looping over units in combat..."); foreach (UnitEntityData unit in Game.Instance.State.AwakeUnits) { i++; if (unit == Initiator || unit == Target) { Main.Logger?.Append($"{i}: unit {unit.CharacterName} ({unit.UniqueId}) is either the Initiator or the Target and does not count for cover"); continue; } if (IgnoreUnits.Contains(unit)) { Main.Logger?.Append($"{i}: unit {unit.CharacterName} ({unit.UniqueId}) is in the IgnoreUnits list and does not count for cover"); continue; } if (unit.Descriptor.State.IsDead) { Main.Logger?.Append($"{i}: unit {unit.CharacterName} ({unit.UniqueId}) is dead and does not count for cover"); continue; } if (unit.Descriptor.State.Prone.Active) { Main.Logger?.Append($"{i}: unit {unit.CharacterName} ({unit.UniqueId}) is prone and does not count for cover"); continue; } int sizeDifference = Target.Descriptor.State.Size - unit.Descriptor.State.Size; // e.g. a Small character cannot provide soft cover for a Large character if (sizeDifference >= 2) { Main.Logger?.Append($"{i}: the target is of size {Target.Descriptor.State.Size}, while unit {unit.CharacterName} ({unit.UniqueId}) is of size {unit.Descriptor.State.Size}, so the unit does not count for cover."); continue; } Vector2 unitPosition = unit.Position.To2D(); // A unit that is closer to the attacker than to the target and is smaller than the attacker does not provide cover to the target if (unit.Descriptor.State.Size < Initiator.Descriptor.State.Size && Vector2.Distance(fromPosition, unitPosition) < Vector2.Distance(unitPosition, toPosition)) { Main.Logger?.Append($"{i}: the attacker is of size {Initiator.Descriptor.State.Size}, the unit is of size {unit.Descriptor.State.Size}, and the unit is {Vector2.Distance(fromPosition, unitPosition)} away from the attacker and {Vector2.Distance(unitPosition, toPosition)} away from the target, so the unit does not count for cover."); continue; } // Filter nonsensical cases if (Vector2.Distance(fromPosition, toPosition) < Vector2.Distance(fromPosition, unitPosition) || VectorMath.AngleBetweenPoints(unitPosition, fromPosition, toPosition) < 90.0f) { Main.Logger?.Append($"{i}: Possibility of {unit.CharacterName} ({unit.UniqueId}) providing cover considered nonsensical: "); Main.Logger?.Append($" - Distance from attacker to target: {Vector2.Distance(fromPosition, toPosition)}"); Main.Logger?.Append($" - Distance from attacker to unit: {Vector2.Distance(fromPosition, unitPosition)}"); Main.Logger?.Append($" - Angle between attacker - unit - target: {VectorMath.AngleBetweenPoints(unitPosition, fromPosition, toPosition)}"); continue; } unitsToCheck.Add(unit); Main.Logger?.Append($"{i}: unit {unit.CharacterName} ({unit.UniqueId}) added to list of potential cover-providing units"); } if (unitsToCheck.Count < 1) { Main.Logger?.Append("No units could possibly provide cover."); Main.Logger?.Flush(); return; } Vector2 direction = (toPosition - fromPosition).normalized; Vector2 up = new Vector2(direction.y, -direction.x); Vector2 down = new Vector2(-direction.y, direction.x); Vector2 fromPointsStart = fromPosition + up * Initiator.Corpulence; Vector2 fromPointsEnd = fromPosition + down * Initiator.Corpulence; Vector2 tangent1 = Vector2.zero; Vector2 tangent2 = Vector2.zero; VectorMath.TangentPointsOnCircleFromPoint(fromPointsStart, toPosition, Target.Corpulence, out tangent1, out tangent2); Vector2 toPointsStart = Vector2.zero; float normDist = 0.0f; if (Pathfinding.VectorMath.SegmentsIntersect2D(fromPosition, toPosition, fromPointsStart, tangent1, out normDist)) { toPointsStart = tangent2; } else { toPointsStart = tangent1; } Vector2 tangent3 = Vector2.zero; Vector2 tangent4 = Vector2.zero; VectorMath.TangentPointsOnCircleFromPoint(fromPointsEnd, toPosition, Target.Corpulence, out tangent3, out tangent4); Vector2 toPointsEnd = Vector2.zero; if (Pathfinding.VectorMath.SegmentsIntersect2D(fromPosition, toPosition, fromPointsEnd, tangent3, out normDist)) { toPointsEnd = tangent4; } else { toPointsEnd = tangent3; } Vector2[] fromPoints = VectorMath.FindEquidistantPointsOnArc(fromPointsStart, fromPointsEnd, fromPosition, Initiator.Corpulence, 10); Vector2[] toPoints = VectorMath.FindEquidistantPointsOnArc(toPointsStart, toPointsEnd, toPosition, Target.Corpulence, 10); Main.Logger?.Append("Looping over lines..."); int raysBlocked = 0; for (i = 0; i < fromPoints.Length; i++) { Main.Logger?.Append($" - Checking line {i} ({fromPoints[i]} to {toPoints[i]})..."); #if DEBUG if (i > 0) { Main.Logger?.Append($" * Validate: lines {i} and {i - 1} intersect: {Pathfinding.VectorMath.SegmentsIntersect2D(fromPoints[i - 1], toPoints[i - 1], fromPoints[i], toPoints[i], out normDist)}"); } #endif for (int j = 0; j < unitsToCheck.Count; j++) { var p = VectorMath.NearestPointOnSegmentToPoint(fromPoints[i], toPoints[i], unitsToCheck[j].Position.To2D()); var d = Vector2.Distance(p, unitsToCheck[j].Position.To2D()); Main.Logger?.Append($" * closest distance of line {i} to unit {unitsToCheck[j].CharacterName} ({unitsToCheck[j].UniqueId}): {d}. Unit's corpulence: {unitsToCheck[j].Corpulence}"); if (Vector2.Distance(p, unitsToCheck[j].Position.To2D()) < unitsToCheck[j].Corpulence) { raysBlocked++; Main.Logger?.Append($" * line {i} is obstructed by unit {unitsToCheck[j].CharacterName} ({unitsToCheck[j].UniqueId}). Number of obstructed lines so far = {raysBlocked}. Continuing to next line..."); break; } else { Main.Logger?.Append($" * line {i} is not obstructed by unit {unitsToCheck[j].CharacterName} ({unitsToCheck[j].UniqueId})"); } } if (raysBlocked > 6) { break; } } Main.Logger?.Append($"Finished looping over target lines. Total lines blocked: {raysBlocked}"); if (raysBlocked > 6) { Result = Cover.Full; } else if (raysBlocked > 2) { Result = Cover.Partial; } else { Result = Cover.None; } Main.Logger?.Append($"Final cover result: {Result}"); Main.Logger?.Flush(); }
public static Cover FindCover (IEnumerable<LSBody> checkBodies, Cover ignoreCov) { foreach (Cover cover in FindCovers (checkBodies,ignoreCov)) { return cover; } return null; }
public View3DTextCreator(Vector3 viewerVolume, Vector2 bedCenter, MeshViewerWidget.BedShape bedShape) { boldTypeFace = TypeFace.LoadFrom(StaticData.Instance.ReadAllText(Path.Combine("Fonts", "LiberationSans-Bold.svg"))); MeshGroupExtraData = new List <PlatingMeshGroupData>(); FlowLayoutWidget mainContainerTopToBottom = new FlowLayoutWidget(FlowDirection.TopToBottom); mainContainerTopToBottom.HAnchor = Agg.UI.HAnchor.Max_FitToChildren_ParentWidth; mainContainerTopToBottom.VAnchor = Agg.UI.VAnchor.Max_FitToChildren_ParentHeight; FlowLayoutWidget centerPartPreviewAndControls = new FlowLayoutWidget(FlowDirection.LeftToRight); centerPartPreviewAndControls.AnchorAll(); GuiWidget viewArea = new GuiWidget(); viewArea.AnchorAll(); { meshViewerWidget = new MeshViewerWidget(viewerVolume, bedCenter, bedShape); meshViewerWidget.AllowBedRenderingWhenEmpty = true; meshViewerWidget.AnchorAll(); } viewArea.AddChild(meshViewerWidget); centerPartPreviewAndControls.AddChild(viewArea); mainContainerTopToBottom.AddChild(centerPartPreviewAndControls); FlowLayoutWidget buttonBottomPanel = new FlowLayoutWidget(FlowDirection.LeftToRight); buttonBottomPanel.HAnchor = HAnchor.ParentLeftRight; buttonBottomPanel.Padding = new BorderDouble(3, 3); buttonBottomPanel.BackgroundColor = ActiveTheme.Instance.PrimaryBackgroundColor; buttonRightPanel = CreateRightButtonPanel(viewerVolume.y); // add in the plater tools { FlowLayoutWidget editToolBar = new FlowLayoutWidget(); processingProgressControl = new ProgressControl("Finding Parts:".Localize(), ActiveTheme.Instance.PrimaryTextColor, ActiveTheme.Instance.PrimaryAccentColor); processingProgressControl.VAnchor = Agg.UI.VAnchor.ParentCenter; editToolBar.AddChild(processingProgressControl); editToolBar.VAnchor |= Agg.UI.VAnchor.ParentCenter; editPlateButtonsContainer = new FlowLayoutWidget(); MHTextEditWidget textToAddWidget = new MHTextEditWidget("", pixelWidth: 300, messageWhenEmptyAndNotSelected: "Enter Text Here".Localize()); textToAddWidget.VAnchor = VAnchor.ParentCenter; textToAddWidget.Margin = new BorderDouble(5); editPlateButtonsContainer.AddChild(textToAddWidget); textToAddWidget.ActualTextEditWidget.EnterPressed += (object sender, KeyEventArgs keyEvent) => { InsertTextNow(textToAddWidget.Text); }; Button insertTextButton = textImageButtonFactory.Generate("Insert".Localize()); editPlateButtonsContainer.AddChild(insertTextButton); insertTextButton.Click += (sender, e) => { InsertTextNow(textToAddWidget.Text); }; KeyDown += (sender, e) => { KeyEventArgs keyEvent = e as KeyEventArgs; if (keyEvent != null && !keyEvent.Handled) { if (keyEvent.KeyCode == Keys.Escape) { if (meshSelectInfo.downOnPart) { meshSelectInfo.downOnPart = false; ScaleRotateTranslate translated = SelectedMeshTransform; translated.translation *= transformOnMouseDown; SelectedMeshTransform = translated; Invalidate(); } } } }; editToolBar.AddChild(editPlateButtonsContainer); buttonBottomPanel.AddChild(editToolBar); } GuiWidget buttonRightPanelHolder = new GuiWidget(HAnchor.FitToChildren, VAnchor.ParentBottomTop); centerPartPreviewAndControls.AddChild(buttonRightPanelHolder); buttonRightPanelHolder.AddChild(buttonRightPanel); viewControls3D = new ViewControls3D(meshViewerWidget); buttonRightPanelDisabledCover = new Cover(HAnchor.ParentLeftRight, VAnchor.ParentBottomTop); buttonRightPanelDisabledCover.BackgroundColor = new RGBA_Bytes(ActiveTheme.Instance.PrimaryBackgroundColor, 150); buttonRightPanelHolder.AddChild(buttonRightPanelDisabledCover); LockEditControls(); GuiWidget leftRightSpacer = new GuiWidget(); leftRightSpacer.HAnchor = HAnchor.ParentLeftRight; buttonBottomPanel.AddChild(leftRightSpacer); closeButton = textImageButtonFactory.Generate("Close".Localize()); buttonBottomPanel.AddChild(closeButton); mainContainerTopToBottom.AddChild(buttonBottomPanel); this.AddChild(mainContainerTopToBottom); this.AnchorAll(); meshViewerWidget.TrackballTumbleWidget.TransformState = TrackBallController.MouseDownType.Rotation; AddChild(viewControls3D); // set the view to be a good angle and distance meshViewerWidget.TrackballTumbleWidget.TrackBallController.Scale = .06; meshViewerWidget.TrackballTumbleWidget.TrackBallController.Rotate(Quaternion.FromEulerAngles(new Vector3(-MathHelper.Tau * .02, 0, 0))); AddHandlers(); UnlockEditControls(); // but make sure we can't use the right panel yet buttonRightPanelDisabledCover.Visible = true; }
public void ProcessRequest(HttpContext context) { Image Cover; //判断请求的物理路径中,是否存在该文件 if (File.Exists(context.Request.PhysicalPath)) { //加载文件 Cover = Image.FromFile(context.Request.PhysicalPath); //加载水印图片 Image watermark = Image.FromFile(context.Request.MapPath(WATERMARK_URL)); //实例化画布 Graphics g = Graphics.FromImage(Cover); StringFormat fmort = new StringFormat(); fmort.Alignment = StringAlignment.Center; fmort.LineAlignment = StringAlignment.Center; //Cover上绘制水印 g.DrawImage(watermark, new Rectangle(Cover.Width - watermark.Width, Cover.Height - watermark.Height, watermark.Width, watermark.Height), 0, 0, watermark.Width, watermark.Height, GraphicsUnit.Pixel); #region 文字水印 //string logoText = "天府星空(http://www.tfxk.com) 版权所有 盗版必究"; //float fontSize = 9; //字体大小 //float textWidth = logoText.Length * fontSize; //文本的长度 ////下面定义一个矩形区域,以后在这个矩形里画上白底黑字 //float rectX = 0; //float rectY = Cover.Height - 18; //float rectWidth = Cover.Width; //float rectHeight = 18; ////声明矩形域 //RectangleF textArea = new RectangleF(rectX, rectY, rectWidth, rectHeight); //Font font = new Font("宋体", fontSize); //定义字体 //Brush whiteBrush = new SolidBrush(Color.White); //白笔刷,画文字用 //Brush blackBrush = new SolidBrush(Color.FromArgb(207, 207, 207)); //黑笔刷,画背景用 //g.FillRectangle(blackBrush, rectX, rectY, rectWidth, rectHeight); ////创建GDI+绘图图面 //g.DrawString(logoText, font, whiteBrush, textArea, fmort); ////在背景图片上绘制水印文字 //// g.DrawImage(Cover, new System.Drawing.Point(400, 300)); #endregion //释放画布 g.Dispose(); //释放水印图片 watermark.Dispose(); } else { //加载默认图片 Cover = Image.FromFile(context.Request.MapPath(DEFAULT_PIC)); } //设置输出格式 context.Response.ContentType = "image/jpeg"; //将图片存入输出流 Cover.Save(context.Response.OutputStream, ImageFormat.Jpeg); //释放资源 Cover.Dispose(); //停止HTTP响应 context.Response.End(); }
static void Main(string[] args) { //double a = 43.52; //double b = 40000566.78234234; //double max; //Stopwatch sw = Stopwatch.StartNew(); //sw.Restart(); //max = SergeysBitwiseMax(a, b); //sw.Stop(); //Console.WriteLine("SergeysBitwiseMax(" + a + ", " + b + ") = " + max + " took " + ElapsedNanoSeconds(sw) + " ns!"); //sw.Restart(); //max = Math.Max(a, b); //sw.Stop(); //Console.WriteLine("Math.Max(" + a + ", " + b + ") = " + max + " took " + ElapsedNanoSeconds(sw) + " ns!"); SymbolicExpression ident = new SymbolicExpression("symbolic"); Console.WriteLine(ident); SimpleExpression <SymbolicValue> SymbolicSE = new SymbolicExpression("symbolic_exspression"); Console.WriteLine(SymbolicSE.GetValue()); SymbolicValue sv = new SymbolicValue("sv"); IValue <AValue> sive = sv; dynamic dsv = new SymbolicValue("sv"); object osv = new SymbolicValue("sv"); Console.WriteLine(sv.Equals(dsv)); Console.WriteLine(dsv.Equals(sv)); Console.WriteLine(dsv.Equals(sive)); Console.WriteLine(osv.Equals(dsv)); Console.WriteLine(sv.Equals(osv)); Console.WriteLine(osv.Equals(sv)); Console.WriteLine(osv.Equals(sive)); Console.WriteLine(sive.Equals(osv)); IExpression <IValue <AValue> > sSV = SymbolicSE; List <IExpression <IValue <AValue> > > aivL = new List <IExpression <IValue <AValue> > >(); aivL.Add(sSV); aivL.Add(SymbolicSE); NumericExpression n = new NumericExpression(6.7); Console.WriteLine(n.GetValue()); SimpleExpression <NumericValue> NumericSE = new NumericExpression(3.4); Console.WriteLine(NumericSE.GetValue()); FunctionInvocation <int> f = new FunctionInvocation <int>( delegate(object[] parameters) { int sum = 0; foreach (object parameter in parameters) { sum += (int)parameter; } return(new NumericValue(sum)); }, 5, 7, 8); Console.WriteLine("!! FunctionInvocation !! " + f.GetValue()); // money Money <SymbolicValue> moneyFromSymbolicValue = new Money <SymbolicValue>(ident, Currency.GBP); Console.WriteLine(moneyFromSymbolicValue.GetValue()); Money <SymbolicValue> moneyFromSymbolicExpression = new Money <SymbolicValue>(SymbolicSE, Currency.GBP); Console.WriteLine(moneyFromSymbolicExpression.GetValue()); Money <NumericValue> moneyFromNumericValue = new Money <NumericValue>(n, Currency.GBP); Console.WriteLine(moneyFromNumericValue.GetValue()); Money <NumericValue> moneyFromNumericExpression = new Money <NumericValue>(NumericSE, Currency.GBP); Console.WriteLine(moneyFromNumericExpression.GetValue()); // percentage Percentage <SymbolicValue> symSEPerc = new Percentage <SymbolicValue>(SymbolicSE); Console.WriteLine(symSEPerc); Percentage <NumericValue> numPerc = new Percentage <NumericValue>(n); Console.WriteLine(numPerc); // Ratio Ratio <SymbolicValue> symbolicRatio = new Ratio <SymbolicValue>(ident); Console.WriteLine(symbolicRatio); Ratio <Value> funcInvRatio = new Ratio <Value>(f); Console.WriteLine(funcInvRatio); Ratio <NumericValue> percNumRatio = new Ratio <NumericValue>(numPerc); Console.WriteLine(percNumRatio); // participation Participation <SymbolicValue> symbolicRatioParticipation = new Participation <SymbolicValue>(symbolicRatio); Console.WriteLine(symbolicRatioParticipation); Participation <Value> funcInvRatioParticipation = new Participation <Value>(funcInvRatio); Console.WriteLine(funcInvRatioParticipation); Participation <NumericValue> percNumRatioParticipation = new Participation <NumericValue>(percNumRatio); Console.WriteLine(percNumRatioParticipation); // _Limit specification LimitSpecification <MoneyValue <SymbolicValue> > moneyFromSymbolicExpressionPayoutSpec = new LimitSpecification <MoneyValue <SymbolicValue> >(moneyFromSymbolicExpression); Console.WriteLine(moneyFromSymbolicExpressionPayoutSpec); LimitSpecification <MoneyValue <NumericValue> > moneyFromNumericValuePayoutSpec = new LimitSpecification <MoneyValue <NumericValue> >(moneyFromNumericValue, true); Console.WriteLine(moneyFromNumericValuePayoutSpec); LimitSpecification <NumericValue> numPercPayoutSpec = new LimitSpecification <NumericValue>(numPerc, true); Console.WriteLine(numPercPayoutSpec); // _Limit Limit <MoneyValue <SymbolicValue> > moneyFromSymbolicExpressionPayout = new Limit <MoneyValue <SymbolicValue> >(moneyFromSymbolicExpressionPayoutSpec, 1); // _Attachment Attachment <NumericValue> NumericSEAttachment = new Attachment <NumericValue>(NumericSE); // cover Cover <NumericValue, MoneyValue <SymbolicValue>, NumericValue> coverNumSymbNum = new Cover <NumericValue, MoneyValue <SymbolicValue>, NumericValue>(percNumRatioParticipation, moneyFromSymbolicExpressionPayout, NumericSEAttachment); Console.WriteLine(coverNumSymbNum); ICover <Value, Value, Value> cNSN = (ICover <Value, Value, Value>)coverNumSymbNum; Cover <SymbolicValue> coverNumShareNumPayout = new Cover <SymbolicValue>(symbolicRatioParticipation, "\"MyCoverLabel\""); Console.WriteLine(coverNumShareNumPayout); Console.ReadKey(); }
public CrazyStorm( GraphicsDevice g, CSManager csm_c, bool bansound_b, string filename, Vector2 Player) { shoot = new List <byte>(); id = filename; bgset = new List <BarrageType>(); csm = csm_c; bansound = bansound_b; layerm = new LayerManager(); center = new Center(); time = new Time(csm, this, layerm); StreamReader streamReader = new StreamReader(Cry.Decry("Content/Data/" + filename + ".xna", 0)); if (streamReader.ReadLine() == "Crazy Storm Data 1.01") { string source = streamReader.ReadLine(); if (File.Exists("Content/Data/" + filename + ".dat")) { tex = Texture2D.FromFile(g, Cry.Decry("Content/Data/" + filename + ".dat", 0)); } if (source.Contains("Types")) { int num = int.Parse(source.Split(' ')[0]); for (int index = 0; index < num; ++index) { string str = streamReader.ReadLine(); BarrageType barrageType = new BarrageType { name = str.Split('_')[0], rect = new Rectangle(int.Parse(str.Split('_')[1]), int.Parse(str.Split('_')[2]), int.Parse(str.Split('_')[3]), int.Parse(str.Split('_')[4])), origin = new Vector2(int.Parse(str.Split('_')[5]), int.Parse(str.Split('_')[6])), origin0 = new Vector2(int.Parse(str.Split('_')[5]), int.Parse(str.Split('_')[6])), pdr0 = int.Parse(str.Split('_')[7]) }; if (str.Split('_')[8] != "") { barrageType.color = int.Parse(str.Split('_')[8]); } else { barrageType.color = -1; } bgset.Add(barrageType); } source = streamReader.ReadLine(); } if (source.Contains("GlobalEvents")) { int num1 = int.Parse(source.Split(' ')[0]); for (int index = 0; index < num1; ++index) { string str = streamReader.ReadLine(); GlobalEvent globalEvent = new GlobalEvent(); time.GEcount.Add(int.Parse(str.Split('_')[0]) - 1); globalEvent.gotocondition = int.Parse(str.Split('_')[1]); globalEvent.gotoopreator = str.Split('_')[2]; globalEvent.gotocvalue = int.Parse(str.Split('_')[3]); globalEvent.isgoto = (bool.Parse(str.Split('_')[4]) ? 1 : 0) != 0; globalEvent.gototime = int.Parse(str.Split('_')[5]); globalEvent.gotowhere = int.Parse(str.Split('_')[6]); globalEvent.quakecondition = int.Parse(str.Split('_')[7]); globalEvent.quakeopreator = str.Split('_')[8]; globalEvent.quakecvalue = int.Parse(str.Split('_')[9]); globalEvent.isquake = (bool.Parse(str.Split('_')[10]) ? 1 : 0) != 0; globalEvent.quaketime = int.Parse(str.Split('_')[11]); globalEvent.quakelevel = int.Parse(str.Split('_')[12]); globalEvent.stopcondition = int.Parse(str.Split('_')[13]); globalEvent.stopopreator = str.Split('_')[14]; globalEvent.stopcvalue = int.Parse(str.Split('_')[15]); globalEvent.isstop = (bool.Parse(str.Split('_')[16]) ? 1 : 0) != 0; globalEvent.stoptime = int.Parse(str.Split('_')[17]); globalEvent.stoplevel = int.Parse(str.Split('_')[18]); if (time.GE.Count < int.Parse(str.Split('_')[0])) { int num2 = 0; while (true) { if (num2 < int.Parse(str.Split('_')[0])) { time.GE.Add(new GlobalEvent() { gotocondition = -1, quakecondition = -1, stopcondition = -1, stoplevel = -1 }); ++num2; } else { break; } } } time.GE[int.Parse(str.Split('_')[0]) - 1] = globalEvent; } source = streamReader.ReadLine(); } if (source.Contains("Sounds")) { int num = int.Parse(source.Split(' ')[0]); for (int index = 0; index < num; ++index) { string str = streamReader.ReadLine(); csm.bgset[int.Parse(str.Split('_')[0]) - 1].sound = str.Split('_')[1]; } source = streamReader.ReadLine(); } if (source.Contains(',')) { center.Available = true; center.x = float.Parse(source.Split(':')[1].Split(',')[0]); center.y = float.Parse(source.Split(':')[1].Split(',')[1]); if (source.Split(':')[1].Split(',').Length >= 7) { center.speed = float.Parse(source.Split(':')[1].Split(',')[2]); center.speedd = float.Parse(source.Split(':')[1].Split(',')[3]); center.aspeed = float.Parse(source.Split(':')[1].Split(',')[4]); center.aspeedd = float.Parse(source.Split(':')[1].Split(',')[5]); int index = 0; while (true) { if (index < source.Split(':')[1].Split(',')[6].Split(';').Length - 1) { center.events.Add(source.Split(':')[1].Split(',')[6].Split(';')[index]); ++index; } else { break; } } } } else { center.Available = false; } time.total = int.Parse(streamReader.ReadLine().Split(',')[0].Split(':')[1]); for (int index1 = 0; index1 < 4; ++index1) { string str1 = streamReader.ReadLine(); if (str1.Split(':')[1].Split(',')[0] != "empty") { Layer layer = new Layer(layerm, int.Parse(str1.Split(':')[1].Split(',')[1]), int.Parse(str1.Split(':')[1].Split(',')[2])); int num1 = int.Parse(str1.Split(':')[1].Split(',')[3]); for (int index2 = 0; index2 < num1; ++index2) { string str2 = streamReader.ReadLine(); Batch batch = new Batch(float.Parse(str2.Split(',')[6]), float.Parse(str2.Split(',')[7]), layerm) { id = int.Parse(str2.Split(',')[0]), parentid = int.Parse(str2.Split(',')[1]), Binding = (bool.Parse(str2.Split(',')[2]) ? 1 : 0) != 0, bindid = int.Parse(str2.Split(',')[3]), Bindwithspeedd = (bool.Parse(str2.Split(',')[4]) ? 1 : 0) != 0, begin = int.Parse(str2.Split(',')[8]), life = int.Parse(str2.Split(',')[9]), fx = float.Parse(str2.Split(',')[10]), fy = float.Parse(str2.Split(',')[11]), r = int.Parse(str2.Split(',')[12]), rdirection = float.Parse(str2.Split(',')[13]) }; string str3 = str2.Split(',')[14].Replace("{", "").Replace("}", ""); batch.rdirections.X = float.Parse(str3.Split(' ')[0].Split(':')[1]); batch.rdirections.Y = float.Parse(str3.Split(' ')[1].Split(':')[1]); batch.tiao = int.Parse(str2.Split(',')[15]); batch.t = int.Parse(str2.Split(',')[16]); batch.fdirection = float.Parse(str2.Split(',')[17]); string str4 = str2.Split(',')[18].Replace("{", "").Replace("}", ""); batch.fdirections.X = float.Parse(str4.Split(' ')[0].Split(':')[1]); batch.fdirections.Y = float.Parse(str4.Split(' ')[1].Split(':')[1]); batch.range = int.Parse(str2.Split(',')[19]); batch.speed = float.Parse(str2.Split(',')[20]); batch.speedd = float.Parse(str2.Split(',')[21]); string str5 = str2.Split(',')[22].Replace("{", "").Replace("}", ""); batch.speedds.X = float.Parse(str5.Split(' ')[0].Split(':')[1]); batch.speedds.Y = float.Parse(str5.Split(' ')[1].Split(':')[1]); batch.aspeed = float.Parse(str2.Split(',')[23]); batch.aspeedd = float.Parse(str2.Split(',')[24]); string str6 = str2.Split(',')[25].Replace("{", "").Replace("}", ""); batch.aspeedds.X = float.Parse(str6.Split(' ')[0].Split(':')[1]); batch.aspeedds.Y = float.Parse(str6.Split(' ')[1].Split(':')[1]); batch.sonlife = int.Parse(str2.Split(',')[26]); batch.type = int.Parse(str2.Split(',')[27]); batch.wscale = float.Parse(str2.Split(',')[28]); batch.hscale = float.Parse(str2.Split(',')[29]); batch.colorR = int.Parse(str2.Split(',')[30]); batch.colorG = int.Parse(str2.Split(',')[31]); batch.colorB = int.Parse(str2.Split(',')[32]); batch.alpha = int.Parse(str2.Split(',')[33]); batch.head = float.Parse(str2.Split(',')[34]); string str7 = str2.Split(',')[35].Replace("{", "").Replace("}", ""); batch.heads.X = float.Parse(str7.Split(' ')[0].Split(':')[1]); batch.heads.Y = float.Parse(str7.Split(' ')[1].Split(':')[1]); batch.Withspeedd = (bool.Parse(str2.Split(',')[36]) ? 1 : 0) != 0; batch.sonspeed = float.Parse(str2.Split(',')[37]); batch.sonspeedd = float.Parse(str2.Split(',')[38]); string str8 = str2.Split(',')[39].Replace("{", "").Replace("}", ""); batch.sonspeedds.X = float.Parse(str8.Split(' ')[0].Split(':')[1]); batch.sonspeedds.Y = float.Parse(str8.Split(' ')[1].Split(':')[1]); batch.sonaspeed = float.Parse(str2.Split(',')[40]); batch.sonaspeedd = float.Parse(str2.Split(',')[41]); string str9 = str2.Split(',')[42].Replace("{", "").Replace("}", ""); batch.sonaspeedds.X = float.Parse(str9.Split(' ')[0].Split(':')[1]); batch.sonaspeedds.Y = float.Parse(str9.Split(' ')[1].Split(':')[1]); batch.xscale = float.Parse(str2.Split(',')[43]); batch.yscale = float.Parse(str2.Split(',')[44]); batch.Mist = (bool.Parse(str2.Split(',')[45]) ? 1 : 0) != 0; batch.Dispel = (bool.Parse(str2.Split(',')[46]) ? 1 : 0) != 0; batch.Blend = (bool.Parse(str2.Split(',')[47]) ? 1 : 0) != 0; batch.Afterimage = (bool.Parse(str2.Split(',')[48]) ? 1 : 0) != 0; batch.Outdispel = (bool.Parse(str2.Split(',')[49]) ? 1 : 0) != 0; batch.Invincible = (bool.Parse(str2.Split(',')[50]) ? 1 : 0) != 0; string str10 = str2.Split(',')[51]; int idx1 = 0; while (true) { if (idx1 < str10.Split('&').Length - 1) { string str11 = str10.Split('&')[idx1]; Event @event = new Event(idx1) { tag = str11.Split('|')[0], t = int.Parse(str11.Split('|')[1]), addtime = int.Parse(str11.Split('|')[2]) }; int index3 = 0; while (true) { if (index3 < str11.Split('|')[3].Split(';').Length - 1) { @event.events.Add(str11.Split('|')[3].Split(';')[index3]); ++index3; } else { break; } } batch.Parentevents.Add(@event); ++idx1; } else { break; } } string str12 = str2.Split(',')[52]; int idx2 = 0; while (true) { if (idx2 < str12.Split('&').Length - 1) { string str11 = str12.Split('&')[idx2]; Event @event = new Event(idx2) { tag = str11.Split('|')[0], t = int.Parse(str11.Split('|')[1]), addtime = int.Parse(str11.Split('|')[2]) }; int index3 = 0; while (true) { if (index3 < str11.Split('|')[3].Split(';').Length - 1) { @event.events.Add(str11.Split('|')[3].Split(';')[index3]); ++index3; } else { break; } } batch.Sonevents.Add(@event); ++idx2; } else { break; } } batch.rand.fx = float.Parse(str2.Split(',')[53]); batch.rand.fy = float.Parse(str2.Split(',')[54]); batch.rand.r = int.Parse(str2.Split(',')[55]); batch.rand.rdirection = float.Parse(str2.Split(',')[56]); batch.rand.tiao = int.Parse(str2.Split(',')[57]); batch.rand.t = int.Parse(str2.Split(',')[58]); batch.rand.fdirection = float.Parse(str2.Split(',')[59]); batch.rand.range = int.Parse(str2.Split(',')[60]); batch.rand.speed = float.Parse(str2.Split(',')[61]); batch.rand.speedd = float.Parse(str2.Split(',')[62]); batch.rand.aspeed = float.Parse(str2.Split(',')[63]); batch.rand.aspeedd = float.Parse(str2.Split(',')[64]); batch.rand.head = float.Parse(str2.Split(',')[65]); batch.rand.sonspeed = float.Parse(str2.Split(',')[66]); batch.rand.sonspeedd = float.Parse(str2.Split(',')[67]); batch.rand.sonaspeed = float.Parse(str2.Split(',')[68]); batch.rand.sonaspeedd = float.Parse(str2.Split(',')[69]); if (str2.Split(',').Length >= 72) { batch.Cover = (bool.Parse(str2.Split(',')[70]) ? 1 : 0) != 0; batch.Rebound = (bool.Parse(str2.Split(',')[71]) ? 1 : 0) != 0; batch.Force = (bool.Parse(str2.Split(',')[72]) ? 1 : 0) != 0; } if (str2.Split(',').Length >= 74) { batch.Deepbind = (bool.Parse(str2.Split(',')[73]) ? 1 : 0) != 0; } layerm.LayerArray[index1].BatchArray.Add(batch); Batch b2 = (Batch)batch.Copy(); b2.sonspeed = b2.sonspeed * 1.5f; b2.sonaspeed = b2.sonaspeed * 1.5f; layerm.LayerArray[index1].BatchArray.Add(b2); } if (str1.Split(':')[1].Split(',').Length >= 7) { int num2 = int.Parse(str1.Split(':')[1].Split(',')[4]); for (int index2 = 0; index2 < num2; ++index2) { string str2 = streamReader.ReadLine(); Lase lase = new Lase(float.Parse(str2.Split(',')[6]), float.Parse(str2.Split(',')[7]), layerm) { id = int.Parse(str2.Split(',')[0]), parentid = int.Parse(str2.Split(',')[1]), Binding = (bool.Parse(str2.Split(',')[2]) ? 1 : 0) != 0, bindid = int.Parse(str2.Split(',')[3]), Bindwithspeedd = (bool.Parse(str2.Split(',')[4]) ? 1 : 0) != 0, begin = int.Parse(str2.Split(',')[8]), life = int.Parse(str2.Split(',')[9]), r = int.Parse(str2.Split(',')[10]), rdirection = float.Parse(str2.Split(',')[11]) }; string str3 = str2.Split(',')[12].Replace("{", "").Replace("}", ""); lase.rdirections.X = float.Parse(str3.Split(' ')[0].Split(':')[1]); lase.rdirections.Y = float.Parse(str3.Split(' ')[1].Split(':')[1]); lase.tiao = int.Parse(str2.Split(',')[13]); lase.t = int.Parse(str2.Split(',')[14]); lase.fdirection = float.Parse(str2.Split(',')[15]); string str4 = str2.Split(',')[16].Replace("{", "").Replace("}", ""); lase.fdirections.X = float.Parse(str4.Split(' ')[0].Split(':')[1]); lase.fdirections.Y = float.Parse(str4.Split(' ')[1].Split(':')[1]); lase.range = int.Parse(str2.Split(',')[17]); lase.speed = float.Parse(str2.Split(',')[18]); lase.speedd = float.Parse(str2.Split(',')[19]); string str5 = str2.Split(',')[20].Replace("{", "").Replace("}", ""); lase.speedds.X = float.Parse(str5.Split(' ')[0].Split(':')[1]); lase.speedds.Y = float.Parse(str5.Split(' ')[1].Split(':')[1]); lase.aspeed = float.Parse(str2.Split(',')[21]); lase.aspeedd = float.Parse(str2.Split(',')[22]); string str6 = str2.Split(',')[23].Replace("{", "").Replace("}", ""); lase.aspeedds.X = float.Parse(str6.Split(' ')[0].Split(':')[1]); lase.aspeedds.Y = float.Parse(str6.Split(' ')[1].Split(':')[1]); lase.sonlife = int.Parse(str2.Split(',')[24]); lase.type = int.Parse(str2.Split(',')[25]); lase.wscale = float.Parse(str2.Split(',')[26]); lase.longs = float.Parse(str2.Split(',')[27]); lase.alpha = int.Parse(str2.Split(',')[28]); lase.Ray = (bool.Parse(str2.Split(',')[29]) ? 1 : 0) != 0; lase.sonspeed = float.Parse(str2.Split(',')[30]); lase.sonspeedd = float.Parse(str2.Split(',')[31]); string str7 = str2.Split(',')[32].Replace("{", "").Replace("}", ""); lase.sonspeedds.X = float.Parse(str7.Split(' ')[0].Split(':')[1]); lase.sonspeedds.Y = float.Parse(str7.Split(' ')[1].Split(':')[1]); lase.sonaspeed = float.Parse(str2.Split(',')[33]); lase.sonaspeedd = float.Parse(str2.Split(',')[34]); string str8 = str2.Split(',')[35].Replace("{", "").Replace("}", ""); lase.sonaspeedds.X = float.Parse(str8.Split(' ')[0].Split(':')[1]); lase.sonaspeedds.Y = float.Parse(str8.Split(' ')[1].Split(':')[1]); lase.xscale = float.Parse(str2.Split(',')[36]); lase.yscale = float.Parse(str2.Split(',')[37]); lase.Blend = (bool.Parse(str2.Split(',')[38]) ? 1 : 0) != 0; lase.Outdispel = (bool.Parse(str2.Split(',')[39]) ? 1 : 0) != 0; lase.Invincible = (bool.Parse(str2.Split(',')[40]) ? 1 : 0) != 0; string str9 = str2.Split(',')[42]; int idx1 = 0; while (true) { if (idx1 < str9.Split('&').Length - 1) { string str10 = str9.Split('&')[idx1]; Event @event = new Event(idx1) { tag = str10.Split('|')[0], t = int.Parse(str10.Split('|')[1]), addtime = int.Parse(str10.Split('|')[2]) }; int index3 = 0; while (true) { if (index3 < str10.Split('|')[3].Split(';').Length - 1) { @event.events.Add(str10.Split('|')[3].Split(';')[index3]); ++index3; } else { break; } } lase.Parentevents.Add(@event); ++idx1; } else { break; } } string str11 = str2.Split(',')[43]; int idx2 = 0; while (true) { if (idx2 < str11.Split('&').Length - 1) { string str10 = str11.Split('&')[idx2]; Event @event = new Event(idx2) { tag = str10.Split('|')[0], t = int.Parse(str10.Split('|')[1]), addtime = int.Parse(str10.Split('|')[2]) }; int index3 = 0; while (true) { if (index3 < str10.Split('|')[3].Split(';').Length - 1) { @event.events.Add(str10.Split('|')[3].Split(';')[index3]); ++index3; } else { break; } } lase.Sonevents.Add(@event); ++idx2; } else { break; } } lase.rand.r = int.Parse(str2.Split(',')[44]); lase.rand.rdirection = float.Parse(str2.Split(',')[45]); lase.rand.tiao = int.Parse(str2.Split(',')[46]); lase.rand.t = int.Parse(str2.Split(',')[47]); lase.rand.fdirection = float.Parse(str2.Split(',')[48]); lase.rand.range = int.Parse(str2.Split(',')[49]); lase.rand.speed = float.Parse(str2.Split(',')[50]); lase.rand.speedd = float.Parse(str2.Split(',')[51]); lase.rand.aspeed = float.Parse(str2.Split(',')[52]); lase.rand.aspeedd = float.Parse(str2.Split(',')[53]); lase.rand.sonspeed = float.Parse(str2.Split(',')[54]); lase.rand.sonspeedd = float.Parse(str2.Split(',')[55]); lase.rand.sonaspeed = float.Parse(str2.Split(',')[56]); lase.rand.sonaspeedd = float.Parse(str2.Split(',')[57]); if (str2.Split(',').Length >= 59) { lase.Deepbind = (bool.Parse(str2.Split(',')[58]) ? 1 : 0) != 0; } layerm.LayerArray[index1].LaseArray.Add(lase); } int num3 = int.Parse(str1.Split(':')[1].Split(',')[5]); for (int index2 = 0; index2 < num3; ++index2) { string str2 = streamReader.ReadLine(); Cover cover = new Cover(float.Parse(str2.Split(',')[2]), float.Parse(str2.Split(',')[3]), layerm) { id = int.Parse(str2.Split(',')[0]), parentid = int.Parse(str2.Split(',')[1]), begin = int.Parse(str2.Split(',')[4]), life = int.Parse(str2.Split(',')[5]), halfw = int.Parse(str2.Split(',')[6]), halfh = int.Parse(str2.Split(',')[7]), Circle = (bool.Parse(str2.Split(',')[8]) ? 1 : 0) != 0, type = int.Parse(str2.Split(',')[9]), controlid = int.Parse(str2.Split(',')[10]), speed = float.Parse(str2.Split(',')[11]), speedd = float.Parse(str2.Split(',')[12]) }; string str3 = str2.Split(',')[13].Replace("{", "").Replace("}", ""); cover.speedds.X = float.Parse(str3.Split(' ')[0].Split(':')[1]); cover.speedds.Y = float.Parse(str3.Split(' ')[1].Split(':')[1]); cover.aspeed = float.Parse(str2.Split(',')[14]); cover.aspeedd = float.Parse(str2.Split(',')[15]); string str4 = str2.Split(',')[16].Replace("{", "").Replace("}", ""); cover.aspeedds.X = float.Parse(str4.Split(' ')[0].Split(':')[1]); cover.aspeedds.Y = float.Parse(str4.Split(' ')[1].Split(':')[1]); string str5 = str2.Split(',')[17]; int idx1 = 0; while (true) { if (idx1 < str5.Split('&').Length - 1) { string str6 = str5.Split('&')[idx1]; Event @event = new Event(idx1) { tag = str6.Split('|')[0], t = int.Parse(str6.Split('|')[1]), addtime = int.Parse(str6.Split('|')[2]) }; int index3 = 0; while (true) { if (index3 < str6.Split('|')[3].Split(';').Length - 1) { @event.events.Add(str6.Split('|')[3].Split(';')[index3]); ++index3; } else { break; } } cover.Parentevents.Add(@event); ++idx1; } else { break; } } string str7 = str2.Split(',')[18]; int idx2 = 0; while (true) { if (idx2 < str7.Split('&').Length - 1) { string str6 = str7.Split('&')[idx2]; Event @event = new Event(idx2) { tag = str6.Split('|')[0], t = int.Parse(str6.Split('|')[1]), addtime = int.Parse(str6.Split('|')[2]) }; int index3 = 0; while (true) { if (index3 < str6.Split('|')[3].Split(';').Length - 1) { @event.events.Add(str6.Split('|')[3].Split(';')[index3]); ++index3; } else { break; } } cover.Sonevents.Add(@event); ++idx2; } else { break; } } cover.rand.speed = float.Parse(str2.Split(',')[19]); cover.rand.speedd = float.Parse(str2.Split(',')[20]); cover.rand.aspeed = float.Parse(str2.Split(',')[21]); cover.rand.aspeedd = float.Parse(str2.Split(',')[22]); if (str2.Split(',').Length >= 24) { cover.bindid = int.Parse(str2.Split(',')[23]); } if (str2.Split(',').Length >= 25) { if (str2.Split(',')[24] != "") { cover.Deepbind = (bool.Parse(str2.Split(',')[24]) ? 1 : 0) != 0; } } layerm.LayerArray[index1].CoverArray.Add(cover); } int num4 = int.Parse(str1.Split(':')[1].Split(',')[6]); for (int index2 = 0; index2 < num4; ++index2) { string str2 = streamReader.ReadLine(); Rebound rebound = new Rebound(float.Parse(str2.Split(',')[2]), float.Parse(str2.Split(',')[3]), layerm) { id = int.Parse(str2.Split(',')[0]), parentid = int.Parse(str2.Split(',')[1]), begin = int.Parse(str2.Split(',')[4]), life = int.Parse(str2.Split(',')[5]), longs = int.Parse(str2.Split(',')[6]), angle = int.Parse(str2.Split(',')[7]), time = int.Parse(str2.Split(',')[8]), speed = float.Parse(str2.Split(',')[9]), speedd = float.Parse(str2.Split(',')[10]), aspeed = float.Parse(str2.Split(',')[11]), aspeedd = float.Parse(str2.Split(',')[12]) }; string str3 = str2.Split(',')[13]; int idx = 0; while (true) { if (idx < str3.Split('&').Length - 1) { string str4 = str3.Split('&')[idx]; rebound.Parentevents.Add(new Event(idx) { tag = str4 }); ++idx; } else { break; } } rebound.rand.speed = float.Parse(str2.Split(',')[14]); rebound.rand.speedd = float.Parse(str2.Split(',')[15]); rebound.rand.aspeed = float.Parse(str2.Split(',')[16]); rebound.rand.aspeedd = float.Parse(str2.Split(',')[17]); layerm.LayerArray[index1].ReboundArray.Add(rebound); } int num5 = int.Parse(str1.Split(':')[1].Split(',')[7]); for (int index2 = 0; index2 < num5; ++index2) { string str2 = streamReader.ReadLine(); layerm.LayerArray[index1].ForceArray.Add(new Force(float.Parse(str2.Split(',')[2]), float.Parse(str2.Split(',')[3]), layerm) { id = int.Parse(str2.Split(',')[0]), parentid = int.Parse(str2.Split(',')[1]), begin = int.Parse(str2.Split(',')[4]), life = int.Parse(str2.Split(',')[5]), halfw = int.Parse(str2.Split(',')[6]), halfh = int.Parse(str2.Split(',')[7]), Circle = (bool.Parse(str2.Split(',')[8]) ? 1 : 0) != 0, type = int.Parse(str2.Split(',')[9]), controlid = int.Parse(str2.Split(',')[10]), speed = float.Parse(str2.Split(',')[11]), speedd = float.Parse(str2.Split(',')[12]), aspeed = float.Parse(str2.Split(',')[13]), aspeedd = float.Parse(str2.Split(',')[14]), addaspeed = float.Parse(str2.Split(',')[15]), addaspeedd = float.Parse(str2.Split(',')[16]), Suction = (bool.Parse(str2.Split(',')[17]) ? 1 : 0) != 0, Repulsion = (bool.Parse(str2.Split(',')[18]) ? 1 : 0) != 0, addspeed = float.Parse(str2.Split(',')[19]), rand = { speed = float.Parse(str2.Split(',')[20]), speedd = float.Parse(str2.Split(',')[21]), aspeed = float.Parse(str2.Split(',')[22]), aspeedd = float.Parse(str2.Split(',')[23]) } }); } } } } } time.Init(Player); }
//添加数据到缓存数据以及数据库 public virtual int AddPipe2Data(Pipe pipe, Cover injuc, Cover outjunc) { return(0); }
void ModifyCoverWallDistance(Cover cover, float wallDistance) { cover.SetWallDistanceExt(wallDistance, m_TestedCollisonDistance); }
void ModifyGroundDistance(Cover cover, float groundDistance) { cover.SetGroundDistanceExt(groundDistance, m_TestedCollisonDistance); }
// ------------------------------------------------- DefineCover public override void DefineCover () { cover = new Cover (pts, radius, halfstrip); }
// ------------------------------------------------- DefineCover // order of nodes: 4 on corners (LT, RT, RB, LB), 0, 1, 2, 3 // 1 on ridge, 4 // 4 strips on sides (left, top, right, bottom) 5, 6, 7, 8 // 1 polygon node (pentagon) to fill the inner area 9 public override void DefineCover () { CoverNode [] nodes = new CoverNode [4 + 1 + 4 + 1]; int nr = 5; nodes [0] = new CoverNode (0, new PointF (rcHouse .Left, rcHouse .Top), nr, Cursors .SizeNWSE); nodes [1] = new CoverNode (1, new PointF (rcHouse .Right, rcHouse .Top), nr, Cursors .SizeNESW); nodes [2] = new CoverNode (2, new PointF (rcHouse .Right, rcHouse .Bottom), nr, Cursors .SizeNWSE); nodes [3] = new CoverNode (3, new PointF (rcHouse .Left, rcHouse .Bottom), nr, Cursors .SizeNESW); nodes [4] = new CoverNode (4, ptRidge, nr); nodes [5] = new CoverNode (5, new PointF [] {new PointF (rcHouse .Left, rcHouse .Top), new PointF (rcHouse .Left, rcHouse .Bottom)}, MovementFreedom .WE, Cursors .SizeWE); nodes [6] = new CoverNode (6, new PointF [] {new PointF (rcHouse .Left, rcHouse .Top), new PointF (rcHouse .Right, rcHouse .Top)}, MovementFreedom .NS, Cursors .SizeNS); nodes [7] = new CoverNode (7, new PointF [] {new PointF (rcHouse .Right, rcHouse .Top), new PointF (rcHouse .Right, rcHouse .Bottom)}, MovementFreedom .WE, Cursors .SizeWE); nodes [8] = new CoverNode (8, new PointF [] {new PointF (rcHouse .Left, rcHouse .Bottom), new PointF (rcHouse .Right, rcHouse .Bottom)}, MovementFreedom .NS, Cursors .SizeNS); nodes [9] = new CoverNode (9, new PointF [] {new PointF (rcHouse .Left, rcHouse .Top), ptRidge, new PointF (rcHouse .Right, rcHouse .Top), new PointF (rcHouse .Right, rcHouse .Bottom), new PointF (rcHouse .Left, rcHouse .Bottom) }); cover = new Cover (nodes); }
public Cover CreateCover(Cover createdCover) { _context.Attach(createdCover).State = EntityState.Added; _context.SaveChanges(); return(createdCover); }
void ModifyCoverCornerDistance(Cover cover, float cornerDistance) { cover.SetCornerDistanceExt(cornerDistance, m_TestedCollisonDistance); }
/// <summary> /// set the new junction point to buffer and insert into database /// </summary> /// <param name="c"></param> public override int AddJunc2Data(Cover c) { rainjuncs.AddJunc((RainCover)c); return(InsterDB(c)); }
// ------------------------------------------------- DefineCover public override void DefineCover () { CoverNode [] nodes; PointF [] pts; switch (type) { case PolygonType .NonResizable: cover = new Cover (new CoverNode [] { new CoverNode (0, Apexes) }); break; case PolygonType .ZoomByApexes: nodes = new CoverNode [nApexes + 1]; pts = Apexes; for (int i = 0; i < nApexes; i++) { nodes [i] = new CoverNode (i, pts [i], 5); } nodes [nApexes] = new CoverNode (nApexes, Apexes); cover = new Cover (nodes); break; case PolygonType .ZoomByBorder: nodes = new CoverNode [nApexes + 1]; pts = Apexes; for (int i = 0; i < nApexes; i++) { nodes [i] = new CoverNode (i, pts [i], pts [(i + 1) % nApexes], 5, Cursors .Hand); } nodes [nApexes] = new CoverNode (nApexes, Apexes); cover = new Cover (nodes); break; } }
public override void DelJuncFromData(Cover c) { rainjuncs.DelJunc((RainCover)c); //删除数据库中数据 DelDB(c); }
// ------------------------------------------------- DefineCover public override void DefineCover () { if (bResizable) { int nOnPerimeter = Convert .ToInt32 ((2 * Math .PI * radius) / distanceNeighbours); CoverNode [] nodes; int iBig, iStartOnBorder; if (str .Length > 0) { nodes = new CoverNode [2 + nOnPerimeter]; iBig = 1; iStartOnBorder = 2; } else { nodes = new CoverNode [1 + nOnPerimeter]; iBig = 0; iStartOnBorder = 1; } if (str .Length > 0) { SizeF sizef = Auxi_Geometry .MeasureString (form, str, font); Point [] corners = Auxi_Geometry .TextCorners (sizef .Width, sizef .Height, angle, ptCenter, TextBasis .M); PointF [] cornersF = new PointF [corners .Length]; for (int i = 0; i < corners .Length; i++) { cornersF [i] = new PointF (corners [i] .X, corners [i] .Y); } nodes [0] = new CoverNode (0, cornersF, Cursors .Hand); } nodes [iBig] = new CoverNode (iBig, ptCenter, radius - nrSmall + 1, Cursors .SizeAll); for (int i = 0; i < nOnPerimeter; i++) { nodes [iStartOnBorder + i] = new CoverNode (iStartOnBorder +i, Auxi_Geometry .PointToPoint (ptCenter, 2 * Math .PI * i / nOnPerimeter, radius), nrSmall); nodes [iStartOnBorder + i] .Clearance = false; } cover = new Cover (nodes); } else { if (str .Length > 0) { SizeF sizef = Auxi_Geometry .MeasureString (form, str, font); Point [] corners = Auxi_Geometry .TextCorners (sizef .Width, sizef .Height, angle, ptCenter, TextBasis .M); PointF [] cornersF = new PointF [corners .Length]; for (int i = 0; i < corners .Length; i++) { cornersF [i] = new PointF (corners [i] .X, corners [i] .Y); } CoverNode [] nodes = new CoverNode [2] {new CoverNode (0, cornersF, Cursors.Hand), new CoverNode (1, ptCenter, radius) }; cover = new Cover (nodes); } else { cover = new Cover (new PointF [] { ptCenter }, radius); cover .SetCursor (Cursors .SizeAll); } } }
private Game GetGame(string url) { HtmlWeb web = new HtmlWeb(); var html = web.Load(url.Replace("https", "http")); var dom = html.DocumentNode; var metaTable = dom.QuerySelector("#table4"); var featuresTable = dom.QuerySelector("#table19"); var discsTable = dom.QuerySelector("#table7"); var game = new Game() { Title = GetContent(metaTable.QuerySelector("tr:nth-child(1) td:nth-child(2)")), CommonTitle = GetContent(metaTable.QuerySelector("tr:nth-child(2) td:nth-child(2)")), Region = GetContent(metaTable.QuerySelector("tr:nth-child(4) td:nth-child(2)")), Genre = GetContent(metaTable.QuerySelector("tr:nth-child(5) td:nth-child(2)")), Developer = GetContent(metaTable.QuerySelector("tr:nth-child(6) td:nth-child(2)")).TrimEnd('.'), Publisher = GetContent(metaTable.QuerySelector("tr:nth-child(7) td:nth-child(2)")).TrimEnd('.'), Players = GetPlayerCount(GetContent(featuresTable.QuerySelector("tr:nth-child(1) td:nth-child(2)"))), Discs = new List <Disc>(), Covers = new List <Cover>() }; var serialNumbers = new List <string>(); for (int i = 2; i <= 7; i++) { var cell = GetContent(discsTable.QuerySelector($"tr:nth-child(2) td:nth-child({i})")); if (cell != "") { serialNumbers.Add(cell); } } foreach (var serialNumber in serialNumbers) { var disc = new Disc() { SerialNumber = serialNumber, Game = game, }; game.Discs.Add(disc); } var coverNode = dom.QuerySelector("#table2 tr:nth-child(2) td:nth-child(1) img"); var fileExtension = new FileInfo(coverNode.GetAttributeValue("src", "")).Extension; var cover = new Cover() { File = serialNumbers.First() + fileExtension, Game = game }; game.Covers.Add(cover); using (WebClient wc = new WebClient()) { var currentPage = new FileInfo(url).Name; var pageLessPath = url.Replace(currentPage, ""); wc.DownloadFile( new Uri(pageLessPath + coverNode.GetAttributeValue("src", "")), Path.Combine("covers", cover.File) ); } var dateString = GetContent(metaTable.QuerySelector("tr:nth-child(8) td:nth-child(2)")); if (DateTime.TryParse(dateString, out var dateReleased)) { game.DateReleased = dateReleased; } Console.WriteLine($"Grabbed info for [{game.Title}]"); return(game); }
private void Start() { owner = GetComponentInParent<ActorAgent>(); cover = GetComponentInParent<Cover>(); }
public void setCover(Cover newCover) { cover = newCover; }
// ------------------------------------------------- DefineCover public override void DefineCover () { CoverNode node = new CoverNode (0, Auxi_Geometry .CornersOfRectangle (rc)); node .Clearance = true; cover = new Cover (new CoverNode [] { node }); }
void SpawnCover() { foreach (CoverHex coverHex in coverHexes) { Cover cover = Instantiate <Cover>(coverPrefab); cover.ParentCell = coverHex.cell; cover.direction = coverHex.direction; //Set the scale of the object and it's parent to be it's host cell cover.transform.parent = cover.ParentCell.transform; cover.transform.localScale = new Vector3(2, 20, 2); cover.name = cover.ParentCell.name + "_Cover"; //Rotate the hex to face the set direction float rotationAngle = ((int)(cover.direction) * directionRotationFraction); cover.transform.Rotate(new Vector3(0, 1, 0), rotationAngle); //Spawn the cover on it's parent cell cover.transform.position = coverHex.cell.transform.position; //Set it's position to be off from the centre of the hex to the edge it is facing cover.transform.position += (cover.transform.forward * 0.007f); //Adjust spawn position Vector3 offset = Vector3.zero; float offsetScale = 0.004f; switch (cover.direction) { //Used to adjust where it spawns as the current system leaves each object slightly out of position case (HexDirection.E): offset.z = -0.8f * offsetScale; break; case (HexDirection.NE): offset.x = 0.6f * offsetScale; offset.z = -0.7f * offsetScale; break; case (HexDirection.NW): offset.z = 0.7f * offsetScale; offset.x = 0.6f * offsetScale; break; case (HexDirection.SE): offset.x = -0.6f * offsetScale; offset.z = -0.25f * offsetScale; break; case (HexDirection.SW): offset.x = -1f * offsetScale; offset.z = 0.5f * offsetScale; break; case (HexDirection.W): offset.z = 1 * offsetScale; offset.x = -0.5f * offsetScale; break; } cover.transform.position += offset; cover.ParentCell.UnSetNeighbor(cover.direction); //Debug.Log("Removing " + cover.ParentCell.name + "'s neighbor: " + cover.ParentCell.GetNeighbor(cover.direction) + " in direction: " + cover.direction); } }
// ------------------------------------------------- DefineCover public override void DefineCover () { int nOnPerimeter = Convert .ToInt32 ((2 * Math .PI * radius) / distanceNeighbours); CoverNode [] nodes = new CoverNode [nOnPerimeter + 1]; nodes [0] = new CoverNode (0, ptCenter, radius - nrSmall + 1, Cursors .SizeAll); for (int i = 1; i <= nOnPerimeter; i++) { nodes [i] = new CoverNode (i, Auxi_Geometry .PointToPoint (ptCenter, 2 * Math .PI * (i - 1) / nOnPerimeter, radius), nrSmall); nodes [i] .Clearance = false; } cover = new Cover (nodes); }
// ------------------------------------------------- DefineCover public override void DefineCover () { CoverNode [] nodes = new CoverNode [nApexes + 1]; PointF [] pts = Apexes; for (int i = 0; i < nApexes; i++) { nodes [i] = new CoverNode (i, pts [i], pts [(i + 1) % nApexes], 5, Cursors .Hand); } nodes [nApexes] = new CoverNode (nApexes, Apexes); cover = new Cover (nodes); }
// ------------------------------------------------- DefineCover public override void DefineCover () { CoverNode [] ca = new CoverNode [10]; for (int i = 0; i < 9; i++) { ca [i] = new CoverNode (i, pts [i], nRadius); } ca [9] = new CoverNode (9, Frame); cover = new Cover (ca); }
public static bool IsActive (Cover cover) { return cover.Version == _Version; }
// ------------------------------------------------- DefineCover // nodes on dots (except two end points) - to move them // nodes on segments - to give information (via cursor shape) that they can be clicked to add the new dot; these nodes are not movable !!! public override void DefineCover() { int nCircles = pts.Count - 2; int nStrips = pts.Count - 1; int nNodes = nCircles + nStrips; CoverNode[] nodes = new CoverNode[nNodes]; for (int i = 0; i < nCircles; i++) { nodes[i] = new CoverNode(i, pts[i + 1], halfsize, Cursors.Hand); } int j0 = nCircles; for (int i = 0; i < nStrips; i++) { nodes[j0 + i] = new CoverNode(j0 + i, pts[i], pts[i + 1], Behaviour.Frozen, Cursors.Hand); } cover = new Cover(nodes); }
public static void Dessimilate (Cover cover) { Covers.RemoveAt(cover.ID); cover.Version--; }
// ------------------------------------------------- DefineCover public override void DefineCover() { cover = new Cover(area, Resizing.Any); }
// ------------------------------------------------- DefineCover public override void DefineCover() { cover = new Cover(area, Resizing.None); this.cover.SetCursor(Cursors.Arrow); }
// ------------------------------------------------- DefineCover public override void DefineCover () { cover = new Cover (new PointF [] { center }, radius); }
private void Awake() { GetPosition = transform.position; this_cover = transform.GetComponent <Cover>(); }
public static void Assimilate (Cover cover) { cover.ID = (ushort)Covers.Add(cover); cover.Version = _Version; }
public EnemyHide(Enemy enemy, Cover cover) : base(enemy) { this.cover = cover; Begin (); }
public void StartTransition (Cover next) { CurrentCover = next; CurrentDegree = next.GetClosestDegree(this.Agent.Body.Position); IsTransitioning = true; base.StartMove(CurrentCover.GetDegreePoint(CurrentDegree)); }
public Book(double coverThickness, params PaperSheet[] sheets) : base(sheets) { FrontCover = new Cover(sheets.Max(p => p.Width) / 2, sheets.Max(p => p.Length), coverThickness); BackCover = new Cover(sheets.Max(p => p.Width) / 2, sheets.Max(p => p.Length), coverThickness); }
// ------------------------------------------------- DefineCover // order of nodes: // [0 - (nApexes - 1)] strip nodes, covering each segment of the inner border // [nApexes - (2*nApexes - 1)] strip nodes, covering each segment of the outer border // [2*nApexes - (3*nApexes - 1)] big polygon nodes // public override void DefineCover () { ApexPoints (ref ptsIn, ref ptsOut); CoverNode [] ca = new CoverNode [3 * nApexes]; for (int i = 0; i < nApexes; i++) { ca [i] = new CoverNode (i, ptsIn [i], ptsIn [(i + 1) % nApexes], Cursors .Hand); } for (int i = 0; i < nApexes; i++) { ca [nApexes + i] = new CoverNode (nApexes + i, ptsOut [i], ptsOut [(i + 1) % nApexes], Cursors .Hand); } for (int i = 0; i < nApexes; i++) { int i1 = (i + 1) % nApexes; ca [2 * nApexes + i] = new CoverNode (2 * nApexes + i, new PointF [] { ptsIn [i], ptsIn [i1], ptsOut [i1], ptsOut [i] }); } cover = new Cover (ca); }
void ProceedHits(RaycastHit[] hits, bool softInit, Vector3 newPos) { // launched from cover (fast dirty solution) Cover cover = null; bool hitIsValid = false; if ((Agent != null) && (Agent.IsInCover == true) && (Agent.BlackBoard.Cover != null)) { cover = Agent.BlackBoard.Cover; } // sort hits by distance if (hits.Length > 1) { System.Array.Sort(hits, CollisionUtils.CompareHits); } // process hits foreach (RaycastHit hit in hits) { //Debug.Log("ProjectileUpdate Hit" + hit.transform.name); if (hit.transform == Settings.IgnoreTransform) { continue; } //skip the Owner of this shot when his HitZone got hit HitZone zone = hit.transform.GetComponent <HitZone>(); if (zone && (zone.HitZoneOwner is AgentHuman) && (zone.HitZoneOwner as AgentHuman).transform == Settings.IgnoreTransform) { continue; } //HACK The projectile belongs to the "Default" collision layer. //This is probably bug but we do not want to modify the data at the moment. //The only chance now is to ignore such hits if (hit.transform.gameObject.name.StartsWith("Projectile")) { continue; } //skip friends when the projectile should explode near the player (this solves the unwanted suicide when a friend suddenly enters the area in front of me) AgentHuman hitAgent = hit.transform.gameObject.GetFirstComponentUpward <AgentHuman>(); if (Agent != null && hitAgent != null) { float dist = Vector3.Distance(Agent.Position, hitAgent.Position); if (dist < 3) //ignore only if the projectile is still within X m radius { if (Agent.IsFriend(hitAgent)) { continue; } } } Transform.position = hit.point; if (hit.collider.isTrigger) { if (!softInit) { hit.transform.SendMessage("OnProjectileHit", this, SendMessageOptions.DontRequireReceiver); continue; } } if ((cover != null) && (cover.IsPartOfCover(hit.collider.gameObject) == true)) { continue; } newPos = hit.point; #if DEBUG DebugDraw.DepthTest = true; DebugDraw.DisplayTime = 10.0f; DebugDraw.Diamond(Color.red, 0.02f, newPos); #endif Hit = true; HitNormal = hit.normal; hitIsValid = ValidateHit(hit); break; } if (false == softInit) { Transform.position = newPos; } if (Hit) { if (hitIsValid) { HitReaction(); } else { //This function probably has no effect here but I want to be sure that I did not miss anything important //This code is triggered on the server side and only in the case when attacker is cheating InvalidHitReaction(); } } }