示例#1
0
    internal BattleState GetWithDefeatedRemoved()
    {
        BattleStageSide newLeftSide  = LeftSide.GetRepositionedSurvivors();
        BattleStageSide newRightSide = RightSide.GetRepositionedSurvivors();

        return(new BattleState(newLeftSide, newRightSide));
    }
        public bool ChkAgains(string sData, string sValue)
        {
            if (m_asLeft == null)
            {
                return(false);
            }
            if (m_asRight == null)
            {
                return(false);
            }

            if (m_asLeft.Length != 1)
            {
                return(false);
            }
            if (m_asRight.Length != 1)
            {
                return(false);
            }

            if (sData.ToUpper().CompareTo(LeftSide.ToUpper()) != 0)
            {
                return(false);
            }
            if (sValue.ToUpper().CompareTo(RightSide.ToUpper()) != 0)
            {
                return(false);
            }

            return(true);
        }
示例#3
0
        //tests
        //copy function in models
        private void CopyExecute(object obj)
        {
            //tests
            //Console.WriteLine("From : " + LeftSide.SelectedPath);
            //Console.WriteLine("Where : " + RightSide.SelectedPath)

            string source = "";
            string target = "";

            //LEFT SIDE
            if (LeftSide.SelectedPath != null)
            {
                source = Path.Combine(LeftSide.CurrentPath, LeftSide.GetSelectedPath());
                target = Path.GetFullPath(RightSide.CurrentPath);
            } // RIGHT SIDE
            else if (RightSide.SelectedPath != null)
            {
                source = Path.Combine(RightSide.CurrentPath, RightSide.GetSelectedPath());
                target = Path.GetFullPath(LeftSide.CurrentPath);
            }


            copyModel.Copy(source, target); // Model -> CopyModel.cs

            UpdateView();                   //UpdateView
        }
示例#4
0
        public override JsonElement Execute(JsonElement input)
        {
            JsonElement left  = LeftSide.Execute(input);
            JsonElement right = RightSide.Execute(input);

            bool result = false;

            if ((IsEqual || IsGreaterOrEqual || IsLessOrEqual) && JsonElementEqualityComparer.Default.Equals(left, right))
            {
                result = true;
            }
            else if (IsNotEqual && !JsonElementEqualityComparer.Default.Equals(left, right))
            {
                result = true;
            }
            else if (left.ValueKind == right.ValueKind)
            {
                int r = JsonElementComparer.Default.Compare(left, right);

                if ((IsGreater || IsGreaterOrEqual) && r > 0)
                {
                    result = true;
                }
                else if ((IsLess || IsLessOrEqual) && r < 0)
                {
                    result = true;
                }
            }

            return(JsonElementFactory.CreateBool(result));
        }
示例#5
0
 private void RemoveAllSides()
 {
     SuspendLayout();
     if (LeftSide != null)
     {
         LeftSide.Parent = null;
         LeftSide.Dispose();
         LeftSide = null;
     }
     if (TopSide != null)
     {
         TopSide.Parent = null;
         TopSide.Dispose();
         TopSide = null;
     }
     if (RightSide != null)
     {
         RightSide.Parent = null;
         RightSide.Dispose();
         RightSide = null;
     }
     if (BottomSide != null)
     {
         BottomSide.Parent = null;
         BottomSide.Dispose();
         BottomSide = null;
     }
     RootControl.SetBounds(
         ViewConstants.Spacing, ViewConstants.Spacing,
         Width - ViewConstants.Spacing * 2, Height - ViewConstants.Spacing * 2,
         BoundsSpecified.All);
     ResumeLayout(true);
 }
示例#6
0
        public override void ReplaceTruthyExpressions()
        {
            if (LeftSide is PropertyFilterSubExpression p1)
            {
                LeftSide = new TruthyFilterSubExpression(p1);
            }
            else if (LeftSide is ArrayAccessFilterSubExpression a1)
            {
                LeftSide = new TruthyFilterSubExpression(a1);
            }
            else
            {
                LeftSide.ReplaceTruthyExpressions();
            }

            if (RightSide is PropertyFilterSubExpression p2)
            {
                RightSide = new TruthyFilterSubExpression(p2);
            }

            else if (RightSide is ArrayAccessFilterSubExpression a2)
            {
                RightSide = new TruthyFilterSubExpression(a2);
            }
            else
            {
                RightSide.ReplaceTruthyExpressions();
            }
        }
示例#7
0
        public void Processing()
        {
            RightToLeft();
            SumLeftCompatibles();

            LeftSide = LeftSide.OrderByDescending(x => x).ToList();
        }
 public int isValid()
 {
     if (LeftSideInt.HasValue && RightSideInt.HasValue)
     {
         if (LeftSideInt.Value != RightSideInt.Value)
         {
             return(1);
         }
         else
         {
             return(0);
         }
     }
     else if (LeftSideInt.HasValue)
     {
         return(1);
     }
     else if (RightSideInt.HasValue)
     {
         return(1);
     }
     else
     {
         if (LeftSide.Trim() != RightSide.Trim())
         {
             return(1);
         }
         else
         {
             return(0);
         }
     }
 }
示例#9
0
        public double Calculate()
        {
            if (description.UpSpine == null || description.DownSpine == null || description.storage == null)
            {
                throw new ArgumentNullException("Fill all properties");
            }
            if (!description.storage.ContainDescription(description.UpSpine) || !description.storage.ContainDescription(description.DownSpine))
            {
                throw new ArgumentException("Spine not in storage");
            }

            var upspine   = description.storage.GetDescription(description.UpSpine);
            var downspine = description.storage.GetDescription(description.DownSpine);

            var up_point   = upspine.DownLeft;
            var down_point = downspine.UpLeft;

            var dist = GeometryHelper.Distance(new PointF(up_point.X,
                                                          up_point.Y),
                                               new PointF(down_point.X,
                                                          down_point.Y));

            LeftSide.Description = description;
            var d1 = LeftSide.Calculate();

            return((float)Math.Sqrt(dist * dist + d1 * d1));
        }
示例#10
0
        public override string ToString()
        {
            char op = char.MinValue;

            switch (this.operation)
            {
            case CSharpMulDivOperation.Multiplication:
                op = '*';
                break;

            case CSharpMulDivOperation.Division:
                op = '/';
                break;

            case CSharpMulDivOperation.Remainder:
                op = '%';
                break;

            case CSharpMulDivOperation.Term:
                return(this.RightSide.ToString());

            default:
                return(null);
            }
            return(string.Format("{0} {1} {2}", LeftSide.ToString(), op, RightSide.ToString()));
        }
示例#11
0
            public MeshCutData(CutterMesh victimMesh, CutterPlane blade)
            {
                VictimMesh = victimMesh;
                LeftSide.SetTargetMesh(victimMesh);
                RightSide.SetTargetMesh(victimMesh);

                Blade = blade;
            }
        public override object SatisfiedBy(Dictionary <string, object> values)
        {
            Contract.RequiresNotNull(values, "values != null");

            var leftValue  = LeftSide.SatisfiedBy(values);
            var rightValue = RightSide.SatisfiedBy(values) as object[];

            return(rightValue.Contains(leftValue));
        }
示例#13
0
 public Shift CalcShift(Reading reading)
 {
     return(new Shift(
                FrontSide.CalcPercDiff(reading.FrontSide)
                , RearSide.CalcPercDiff(reading.RearSide)
                , RightSide.CalcPercDiff(reading.RightSide)
                , LeftSide.CalcPercDiff(reading.LeftSide)
                ));
 }
示例#14
0
        public Inequality getLinearInequality(float x1, float y1, float x2, float y2, float newx, float newy)
        {
            float output;

            if (x1 == x2)
            {
                output = x1;
                lSide  = LeftSide.X;
                if (newx < output)
                {
                    return(Inequality.LESSTHAN);
                }
                else if (newx == output)
                {
                    return(Inequality.EQUAL);
                }
                else if (newx > output)
                {
                    return(Inequality.GREATERTHAN);
                }
            }
            else if (y1 == y2)
            {
                output = y1;
                lSide  = LeftSide.Y;
                if (newy < output)
                {
                    return(Inequality.LESSTHAN);
                }
                else if (newy == output)
                {
                    return(Inequality.EQUAL);
                }
                else if (newy > output)
                {
                    return(Inequality.GREATERTHAN);
                }
            }
            else
            {
                output = (((y2 - y1) / (x2 - x1)) * newx) + (y2 - (((x2 * y2) - (x2 * y1)) / (x2 - x1)));
                lSide  = LeftSide.Y;
                if (newy < output)
                {
                    return(Inequality.LESSTHAN);
                }
                else if (newy == output)
                {
                    return(Inequality.EQUAL);
                }
                else if (newy > output)
                {
                    return(Inequality.GREATERTHAN);
                }
            }
            return(Inequality.EQUAL);
        }
示例#15
0
        public void WriteXml(XmlWriter writer)
        {
            writer.WriteStartElement("RootPanel");
            if (RootPanel != null)
            {
                RootPanel.WriteXml(writer);
            }
            writer.WriteEndElement();

            writer.WriteStartElement("TopSide");
            if (TopSide != null)
            {
                TopSide.WriteXml(writer);
            }
            writer.WriteEndElement();

            writer.WriteStartElement("RightSide");
            if (RightSide != null)
            {
                RightSide.WriteXml(writer);
            }
            writer.WriteEndElement();

            writer.WriteStartElement("LeftSide");
            if (LeftSide != null)
            {
                LeftSide.WriteXml(writer);
            }
            writer.WriteEndElement();

            writer.WriteStartElement("BottomSide");
            if (BottomSide != null)
            {
                BottomSide.WriteXml(writer);
            }
            writer.WriteEndElement();

            // Write all floating windows (can be LayoutDocumentFloatingWindow or LayoutAnchorableFloatingWindow).
            // To prevent "can not create instance of abstract type", the type is retrieved with GetType().Name
            writer.WriteStartElement("FloatingWindows");
            foreach (var layoutFloatingWindow in FloatingWindows)
            {
                writer.WriteStartElement(layoutFloatingWindow.GetType().Name);
                layoutFloatingWindow.WriteXml(writer);
                writer.WriteEndElement();
            }
            writer.WriteEndElement();

            writer.WriteStartElement("Hidden");
            foreach (var layoutAnchorable in Hidden)
            {
                writer.WriteStartElement(layoutAnchorable.GetType().Name);
                layoutAnchorable.WriteXml(writer);
                writer.WriteEndElement();
            }
            writer.WriteEndElement();
        }
示例#16
0
        private void RemoveTopSide()
        {
            if (TopSide != null)
            {
                TopSide.Parent = null;
                TopSide.Dispose();
                TopSide = null;

                var bounds = RootControl.Bounds;
                bounds.Y          -= Renderer.SideTabHeight;
                bounds.Height     += Renderer.SideTabHeight;
                RootControl.Bounds = bounds;
                var vcs = Height - Renderer.SideTabHeight * 2;
                if (BottomSide != null)
                {
                    vcs -= Renderer.SideTabHeight;
                }
                if (LeftSide != null)
                {
                    var h   = LeftSide.Height;
                    var len = LeftSide.OptimalLength;
                    if (h >= len)
                    {
                        LeftSide.Top = ViewConstants.Spacing;
                    }
                    else
                    {
                        if (len > vcs)
                        {
                            len = vcs;
                        }
                        LeftSide.SetBounds(
                            0, ViewConstants.Spacing, Renderer.SideTabHeight, len,
                            BoundsSpecified.Y | BoundsSpecified.Height);
                    }
                }
                if (RightSide != null)
                {
                    var h   = RightSide.Height;
                    var len = RightSide.OptimalLength;
                    if (h >= len)
                    {
                        RightSide.Top = ViewConstants.Spacing;
                    }
                    else
                    {
                        if (len > vcs)
                        {
                            len = vcs;
                        }
                        RightSide.SetBounds(
                            0, ViewConstants.Spacing, Renderer.SideTabHeight, len,
                            BoundsSpecified.Y | BoundsSpecified.Height);
                    }
                }
            }
        }
示例#17
0
        private void RemoveLeftSide()
        {
            if (LeftSide != null)
            {
                LeftSide.Parent = null;
                LeftSide.Dispose();
                LeftSide = null;

                var bounds = RootControl.Bounds;
                bounds.X          -= Renderer.SideTabHeight;
                bounds.Width      += Renderer.SideTabHeight;
                RootControl.Bounds = bounds;
                var hcs = Width - ViewConstants.Spacing * 2;
                if (RightSide != null)
                {
                    hcs -= Renderer.SideTabHeight;
                }
                if (TopSide != null)
                {
                    var w   = TopSide.Width;
                    var len = TopSide.OptimalLength;
                    if (w >= len)
                    {
                        TopSide.Left = ViewConstants.Spacing;
                    }
                    else
                    {
                        if (len > hcs)
                        {
                            len = hcs;
                        }
                        TopSide.SetBounds(
                            ViewConstants.Spacing, 0, len, Renderer.SideTabHeight,
                            BoundsSpecified.X | BoundsSpecified.Width);
                    }
                }
                if (BottomSide != null)
                {
                    var w   = BottomSide.Height;
                    var len = BottomSide.OptimalLength;
                    if (w >= len)
                    {
                        BottomSide.Left = ViewConstants.Spacing;
                    }
                    else
                    {
                        if (len > hcs)
                        {
                            len = hcs;
                        }
                        BottomSide.SetBounds(
                            ViewConstants.Spacing, 0, len, Renderer.SideTabHeight,
                            BoundsSpecified.X | BoundsSpecified.Width);
                    }
                }
            }
        }
示例#18
0
    private void OnFinish()
    {
        if (state == 3)
        {
            return;
        }
        else
        {
            int logs = isPlayer1 ? GameCanvas.GetPlayer1Logs() : GameCanvas.GetPlayer2Logs();

            if (logs >= buildCosts[state])
            {
                spamKeyMinigame.currentValue = 0.5f;

                if (isPlayer1)
                {
                    GameCanvas.SetPlayer1Logs(logs - buildCosts[state]);
                }
                else
                {
                    GameCanvas.SetPlayer2Logs(logs - buildCosts[state]);
                }

                state++;

                if (state == 3)
                {
                    buildCostObject.SetActive(false);
                    photonView.RPC("EnableSpamKey", RpcTarget.Others, true, 0, false);

                    if (OnMaximum != null)
                    {
                        OnMaximum.Invoke();
                    }

                    if (isPlayer1)
                    {
                        LeftSide.AddNewDamBeaver();
                    }
                    else
                    {
                        RightSide.AddNewDamBeaver();
                    }
                }
                else
                {
                    photonView.RPC("EnableSpamKey", RpcTarget.Others, true, buildCosts[state], true);
                }

                buildCostText.text = buildCosts[state].ToString();


                AudioSFXReferences.PlayPurchase();
            }
        }
    }
示例#19
0
        private void RightToLeft()
        {
            foreach (var summand in RightSide)
            {
                summand.Multiplier *= -1;
            }

            LeftSide = LeftSide.Concat(RightSide).ToList();
            RightSide.Clear();
        }
示例#20
0
        public override void Accept(INumberVisitor visitor)
        {
            visitor.AddLevel();

            visitor.Visit(this);
            LeftSide.Accept(visitor);
            RightSide.Accept(visitor);

            visitor.RemoveLevel();
        }
示例#21
0
        public override string ToString()
        {
            string op = string.Empty;

            switch (this.Operation)
            {
            case AssignmentOperation.SimpleAssign:
                op = "=";
                break;

            case AssignmentOperation.MultiplicationAssign:
                op = "*=";
                break;

            case AssignmentOperation.DivisionAssign:
                op = "/=";
                break;

            case AssignmentOperation.ModulusAssign:
                op = "%=";
                break;

            case AssignmentOperation.AddAssign:
                op = "+=";
                break;

            case AssignmentOperation.SubtractionAssign:
                op = "-=";
                break;

            case AssignmentOperation.LeftShiftAssign:
                op = "<<=";
                break;

            case AssignmentOperation.RightShiftAssign:
                op = ">>=";
                break;

            case AssignmentOperation.BitwiseAndAssign:
                op = "&=";
                break;

            case AssignmentOperation.BitwiseOrAssign:
                op = "|=";
                break;

            case AssignmentOperation.Term:
                return(this.LeftSide.ToString());

            default:
                return(null);
            }
            return(string.Format(CultureInfo.CurrentCulture, "{0} {1} {2}", LeftSide.ToString(), op, RightSide.ToString()));
        }
示例#22
0
 //sadly it's not a joke!! ha ha....no!
 public void SideSplitter(List <string> strings)
 {
     //started at element 1 to skip error with none int text;
     for (int i = 1; i < strings.Count(); i++)
     {
         string firstValue = strings[i].Split('\t').First();
         string lastValue  = strings[i].Split('\t').Last();
         LeftSide.Add(Int32.Parse(firstValue));
         RightSide.Add(Int32.Parse(lastValue));
     }
 }
        /// <summary>
        /// Returns an array of the names all of the elements used in this equation.
        /// The array represents a set, so the items are in an arbitrary order and no item is repeated.
        /// </summary>
        public List <string> GetElements()
        {
            var result    = new List <string>();
            var bothSides = LeftSide.Concat(RightSide);

            foreach (var item in bothSides)
            {
                item.GetElements(result);
            }
            return(result);
        }
示例#24
0
    private Dictionary <BattalionIdentifier, EffectsBuilder> GetEffectsDictionary()
    {
        Dictionary <BattalionIdentifier, EffectsBuilder> ret = new Dictionary <BattalionIdentifier, EffectsBuilder>();

        List <BattalionState> units = LeftSide.ToList();

        units.AddRange(RightSide);
        foreach (BattalionState unit in units)
        {
            ret.Add(unit.Id, new EffectsBuilder(unit));
        }
        return(ret);
    }
示例#25
0
        private void button2_Click(object sender, EventArgs e)
        {
            LeftSide leftSide = dict[treeView1.SelectedNode.Text];

            if (leftSide is CustomEvent)
            {
                game.CustomEvents.Find(x => x.Name == leftSide.Name).Name = EventName.Text;
            }
            leftSide.Name = textBox1.Text;
            dict.Remove(treeView1.SelectedNode.Text);
            dict.Add(textBox1.Text, leftSide);
            treeView1.SelectedNode.Text = textBox1.Text;
        }
示例#26
0
        public QValueType GetQValueType()
        {
            var leftSideType  = LeftSide.GetQValueType();
            var rightSideType = RightSide.GetQValueType();

            if (leftSideType == rightSideType)
            {
                return(leftSideType);
            }
            else
            {
                return(QValueType.UNKNOWN);
            }
        }
示例#27
0
        public int isValid()
        {
            string cleanedLeftSide  = LeftSide.Trim().TrimStart(new char[] { '\'' }).TrimEnd(new char[] { '\'' });
            string cleanedRightSide = RightSide.Trim().TrimStart(new char[] { '\'' }).TrimEnd(new char[] { '\'' });

            if (cleanedLeftSide.Contains(cleanedRightSide))
            {
                return(1);
            }
            else
            {
                return(0);
            }
        }
示例#28
0
        public override string ToString()
        {
            string op = string.Empty;

            switch (this.Operation)
            {
            case CSharpRelationalOperation.LessThan:
                op = "<";
                break;

            case CSharpRelationalOperation.LessThanOrEqualTo:
                op = "<=";
                break;

            case CSharpRelationalOperation.GreaterThan:
                op = ">";
                break;

            case CSharpRelationalOperation.GreaterThanOrEqualTo:
                op = ">=";
                break;

            case CSharpRelationalOperation.TypeCheck:
                op = "is";
                break;

            case CSharpRelationalOperation.TypeCastOrNull:
                op = "as";
                break;

            case CSharpRelationalOperation.Term:
                if (this.RightSide == null)
                {
                    return(null);
                }
                return(this.RightSide.ToString());

            default:
                return(null);
            }
            //Invalid state, can't really display the format if the object is invalid.
            if (RightSide == null || LeftSide == null)
            {
                return(null);
            }
            return(string.Format(CultureInfo.CurrentCulture, "{0} {1} {2}", LeftSide.ToString(), op, RightSide.ToString()));
        }
示例#29
0
        bool AssertEquality(Variable[] valuePairs)
        {
            var dif = Math.Abs(LeftSide.EvaluateFor(valuePairs) - RightSide.EvaluateFor(valuePairs));

            if (dif == 0)
            {
                Console.WriteLine("Right side = Left side");
                return(true);
            }

            if (dif < 0.1)
            {
                Console.WriteLine("Right side is almost same as Left side, difference = {0}", dif);
                return(true);
            }
            return(false);
        }
示例#30
0
            public void Can_merge_to_a_third_destination_type()
            {
                // Arrange
                var left = new LeftSide {
                    Name = "Test"
                };
                var right = new RightSide {
                    Age = 10
                };

                // Act
                var result = left.Merge <Destination, LeftSide, RightSide>(right);

                // Assert
                result.Should().NotBeNull();
                result.Name.Should().Be(left.Name);
                result.Age.Should().Be(right.Age);
            }