/*
         * Returns the text of every OCR entity separated with space, inside the area of the box.
         */
        public string GetEntityInMaxBox(VisionResponse arg1, List <Vertex> verticesObj)
        {
            List <EntityAnnotation> entities = new List <EntityAnnotation>();
            string _description = "";

            foreach (var response in arg1.responses)
            {
                foreach (var entity in response.textAnnotations)
                {
                    //compare with bottom left (x,y) and top right
                    if (entity.boundingPoly.vertices[0].x > verticesObj[0].x && entity.boundingPoly.vertices[2].x <verticesObj[2].x &&
                                                                                                                   entity.boundingPoly.vertices[0].y> verticesObj[0].y && entity.boundingPoly.vertices[2].y < verticesObj[2].y)
                    {
                        entities.Add(entity);

                        //Display Bounding box
                        if (displayBoundingBox)
                        {
                            InternalTools.ProcessImage(entity.boundingPoly.vertices, ref temp_image, UnityEngine.Color.red);
                            var display_img = GameObject.FindGameObjectWithTag("DISPLAY_IMAGE").GetComponent <RawImage>();
                            display_img.texture = temp_image;
                        }
                    }
                }
            }

            foreach (var item in entities)
            {
                _description += item.description + ' ';
            }

            return(_description);
        }
        private void RenderAnnotationResults(List <Vertex> Coords)
        {
            InternalTools.ProcessImage(Coords.ToArray(), ref temp_image, UnityEngine.Color.green);
            var display_img = GameObject.FindGameObjectWithTag("DISPLAY_IMAGE").GetComponent <RawImage>();

            display_img.texture = temp_image;
        }
Пример #3
0
        //---------------------------------------------------------------------

        private void GenerateRandomPolygon(int count)
        {
            int    Q    = 10;
            Random rand = new Random();
            int    l    = 10;
            int    t    = 10;
            int    r    = (pictureBox1.ClientRectangle.Width - 20) / Q * Q;
            int    b    = (pictureBox1.ClientRectangle.Height - 20) / Q * Q;

            InternalTools.clear(subjects);
            InternalTools.clear(clips);

            Polygon subj = new Polygon();

            for (int i = 0; i < count; ++i)
            {
                subj.push(GenerateRandomPoint(l, t, r, b, rand));
            }
            subjects.push(subj);

            Polygon clip = new Polygon();

            for (int i = 0; i < count; ++i)
            {
                clip.push(GenerateRandomPoint(l, t, r, b, rand));
            }
            clips.push(clip);
        }
Пример #4
0
        public override void Action(object info = null)
        {
            base.Action(info);

            List <object> allies = new List <object>();

            allies.AddRange(GetOpponentOverlord().BoardCards);
            allies.Add(GetOpponentOverlord());

            allies = InternalTools.GetRandomElementsFromList(allies, 1);

            for (int i = 0; i < allies.Count; i++)
            {
                if (allies[i] is Player)
                {
                    BattleController.AttackPlayerByAbility(GetCaller(), AbilityData, allies[i] as Player);
                    CreateVfx((allies[i] as Player).AvatarObject.transform.position, true, 5f, true);
                }
                else if (allies[i] is BoardUnit)
                {
                    BattleController.AttackUnitByAbility(GetCaller(), AbilityData, allies[i] as BoardUnit);
                    CreateVfx((allies[i] as BoardUnit).Transform.position, true, 5f);
                }
            }
        }
Пример #5
0
        public override void Action(object info = null)
        {
            base.Action(info);

            List <object> allies = new List <object>();

            allies.AddRange(PlayerCallerOfAbility.BoardCards);
            allies.Remove(AbilityUnitOwner);
            allies.Add(PlayerCallerOfAbility);

            allies = InternalTools.GetRandomElementsFromList(allies, Value);

            for (int i = 0; i < allies.Count; i++)
            {
                switch (allies[i])
                {
                case Player player:
                    player.Stun(Enumerators.StunType.FREEZE, Turns);
                    CreateVfx(player.AvatarObject.transform.position, true, 5f);
                    break;

                case BoardUnit unit:
                    unit.Stun(Enumerators.StunType.FREEZE, Turns);
                    CreateVfx(unit.Transform.position, true, 5f);
                    break;
                }
            }
        }
        private static void DisplayBoundingBox()
        {
            InternalTools.ProcessImage(biggestBoxCoord.ToArray(), ref temp_image, UnityEngine.Color.green);
            var display_img = GameObject.FindGameObjectWithTag("DISPLAY_IMAGE").GetComponent <RawImage>();

            display_img.texture = temp_image;
        }
Пример #7
0
        private void _gcVision_AnnotateSuccessEvent(VisionResponse arg1, long arg2)
        {
            statusImage.color = UnityEngine.Color.green;

            foreach (var response in arg1.responses)
            {
                foreach (var entity in response.localizedObjectAnnotations)
                {
                    InternalTools.ProcessImage(entity.boundingPoly.normalizedVertices, ref _loadedTexture, color);
                }
            }
        }
Пример #8
0
        public virtual void Init(WorkingCard card)
        {
            WorkingCard = card;

            LibraryCard = WorkingCard.LibraryCard;

            NameText.text = LibraryCard.Name;
            BodyText.text = LibraryCard.Description;
            CostText.text = LibraryCard.Cost.ToString();

            IsNewCard = true;

            InitialCost = WorkingCard.InitialCost;
            ManaCost    = InitialCost;

            WorkingCard.Owner.PlayerGooChanged += PlayerGooChangedHandler;

            string rarity = Enum.GetName(typeof(Enumerators.CardRank), WorkingCard.LibraryCard.CardRank);

            string setName = LibraryCard.CardSetType.ToString();

            string frameName = string.Format("Images/Cards/Frames/frame_{0}_{1}", setName, rarity);

            if (!string.IsNullOrEmpty(LibraryCard.Frame))
            {
                frameName = "Images/Cards/Frames/" + LibraryCard.Frame;
            }

            BackgroundSprite.sprite = LoadObjectsManager.GetObjectByPath <Sprite>(frameName);
            PictureSprite.sprite    = LoadObjectsManager.GetObjectByPath <Sprite>(string.Format(
                                                                                      "Images/Cards/Illustrations/{0}_{1}_{2}", setName.ToLower(), rarity.ToLower(),
                                                                                      WorkingCard.LibraryCard.Picture.ToLower()));

            AmountText.transform.parent.gameObject.SetActive(false);
            DistibuteCardObject.SetActive(false);

            if (LibraryCard.CardKind == Enumerators.CardKind.CREATURE)
            {
                ParentOfLeftBlockOfCardInfo  = Transform.Find("Group_LeftBlockInfo");
                ParentOfRightBlockOfCardInfo = Transform.Find("Group_RightBlockInfo");

                if (!InternalTools.IsTabletScreen())
                {
                    ParentOfLeftBlockOfCardInfo.transform.localScale    = new Vector3(.7f, .7f, .7f);
                    ParentOfLeftBlockOfCardInfo.transform.localPosition = new Vector3(10f, 6.8f, 0f);

                    ParentOfRightBlockOfCardInfo.transform.localScale    = new Vector3(.7f, .7f, .7f);
                    ParentOfRightBlockOfCardInfo.transform.localPosition = new Vector3(17f, 6.8f, 0f);
                }
            }
        }
Пример #9
0
        private void OnSystemItemSelectedEventHandler(SystemItem item)
        {
            _fileManager.OnSystemItemSelectedEvent -= OnSystemItemSelectedEventHandler;

            if (InternalTools.IsValidImageFile(item.path))
            {
                _selectedImageText.text = item.name;
                _selectedImageData      = ImageConvert.Convert(ImageConvert.GetTextureFromPath(item.path));
            }
            else
            {
                _selectedImageText.text = "File isn't valid.";
            }
        }
Пример #10
0
        // editing deck page
        public void SetAmountOfCardsInEditingPage(bool init, uint maxCopies, int amount)
        {
            CardsAmountDeckEditing = amount;
            if (init)
            {
                foreach (Transform child in ParentOfEditingGroupUI)
                {
                    Object.Destroy(child.gameObject);
                }

                foreach (ElementSlotOfCards item in ElementSlotsOfCards)
                {
                    Object.Destroy(item.SelfObject);
                }

                ElementSlotsOfCards.Clear();

                for (int i = 0; i < maxCopies; i++)
                {
                    ElementSlotsOfCards.Add(new ElementSlotOfCards(ParentOfEditingGroupUI, false));
                }
            }

            for (int i = 0; i < maxCopies; i++)
            {
                if (i >= ElementSlotsOfCards.Count)
                {
                    ElementSlotsOfCards.Add(new ElementSlotOfCards(ParentOfEditingGroupUI, false));
                }

                ElementSlotsOfCards[i].SetStatus(i < amount);
            }

            float offset = 0.5f;

            if (maxCopies > 3)
            {
                offset = 0.8f;
            }
            else if (maxCopies > 2)
            {
                offset = 0.5f;
            }
            else if (maxCopies > 1)
            {
                offset = 0.7f;
            }

            InternalTools.GroupHorizontalObjects(ParentOfEditingGroupUI, offset, 2f);
        }
Пример #11
0
        public void HandCardPreview(object[] param)
        {
            Vector3 cardPosition;

            if (!InternalTools.IsTabletScreen())
            {
                cardPosition = new Vector3(-9f, -3f, 0f);
            }
            else
            {
                cardPosition = new Vector3(-6f, -2.5f, 0f);
            }

            _battlegroundController.CreateCardPreview(param[0], cardPosition, false);
        }
Пример #12
0
        //---------------------------------------------------------------------

        private void GenerateAustPlusRandomEllipses(int count)
        {
            InternalTools.clear(subjects);
            //load map of Australia from resource ...
            Assembly _assembly = Assembly.GetExecutingAssembly();

            using (BinaryReader polyStream = new BinaryReader(_assembly.GetManifestResourceStream("GuiDemo.aust.bin")))
            {
                int polyCnt = polyStream.ReadInt32();
                for (int i = 0; i < polyCnt; ++i)
                {
                    int     vertCnt = polyStream.ReadInt32();
                    Polygon pg      = new Polygon();
                    for (int j = 0; j < vertCnt; ++j)
                    {
                        float x = polyStream.ReadSingle() * scale;
                        float y = polyStream.ReadSingle() * scale;
                        pg.push(new IntPoint(new haxe.lang.Null <int>((int)x, true), new haxe.lang.Null <int>((int)y, true)));
                    }
                    subjects.push(pg);
                }
            }
            InternalTools.clear(clips);
            Random rand = new Random();

            using (GraphicsPath path = new GraphicsPath())
            {
                const int ellipse_size = 100, margin = 10;
                for (int i = 0; i < count; ++i)
                {
                    int w = pictureBox1.ClientRectangle.Width - ellipse_size - margin * 2;
                    int h = pictureBox1.ClientRectangle.Height - ellipse_size - margin * 2 - statusStrip1.Height;

                    int x    = rand.Next(w) + margin;
                    int y    = rand.Next(h) + margin;
                    int size = rand.Next(ellipse_size - 20) + 20;
                    path.Reset();
                    path.AddEllipse(x, y, size, size);
                    path.Flatten();
                    Polygon clip = new Polygon();
                    foreach (PointF p in path.PathPoints)
                    {
                        clip.push(new IntPoint(new haxe.lang.Null <int>((int)(p.X * scale), true), new haxe.lang.Null <int>((int)(p.Y * scale), true)));
                    }
                    clips.push(clip);
                }
            }
        }
Пример #13
0
        private void _gcVision_AnnotateSuccessEvent(VisionResponse arg1, long arg2)
        {
            statusImage.color = UnityEngine.Color.green;
            print(arg1.responses[0].textAnnotations[0].description);
            print("==============================");
            print(arg1.responses[0].fullTextAnnotation.text);
            var list = GenericUtils.SplitStringToList(arg1.responses[0].textAnnotations[0].description);

            //list.ForEach(Debug.Log);
            foreach (var response in arg1.responses)
            {
                foreach (var entity in response.textAnnotations)
                {
                    InternalTools.ProcessImage(entity.boundingPoly.vertices, ref _loadedTexture, color);
                }
            }

            List <Vector2> vertices = new List <Vector2>();

            foreach (var response in arg1.responses)
            {
                foreach (var entity in response.textAnnotations)
                {
                    foreach (var vertex in entity.boundingPoly.vertices)
                    {
                        if (vertex != null)
                        {
                            Vector2 vert = new Vector2((float)vertex.x, (float)vertex.y);
                            vertices.Add(vert);
                        }
                    }
                }
            }

            List <float> boundingBoxArea = new List <float>();

            for (int i = 0; i < vertices.Count; i++)
            {
                float area = vertices[i].x * vertices[i].y;
                boundingBoxArea.Add(area);
            }

            float   max_Area = boundingBoxArea.Max();
            Vector2 maxBox   = vertices[boundingBoxArea.IndexOf(max_Area)];

            Debug.Log(maxBox.x + "," + maxBox.y);
        }
Пример #14
0
        private void BuffRandomAlly(List <BoardUnit> units, int count, List <Enumerators.BuffType> buffTypes)
        {
            if (_tutorialManager.IsTutorial)
            {
                // need for attacking by Poizom's
                units = units.FindAll(x => x.UnitCanBeUsable());
            }

            units = InternalTools.GetRandomElementsFromList(units, count);

            foreach (Enumerators.BuffType buff in buffTypes)
            {
                foreach (BoardUnit unit in units)
                {
                    unit.ApplyBuff(buff);
                }
            }
        }
Пример #15
0
        private void UserIDPoolSaveButton_Click(object sender, RoutedEventArgs e)
        {
            if (11 != UserIDPool.Text.Length)
            {
                MessageBox.Show("无效的用户ID池数据 长度应为:11", "错误", MessageBoxButton.OK, MessageBoxImage.Error);
                return;
            }

            byte[] buffer = new byte[11];
            for (int i = 0; i < 11; ++i)
            {
                if ('0' <= UserIDPool.Text[i] && '9' >= UserIDPool.Text[i])
                {
                    buffer[i] = (byte)(UserIDPool.Text[i] - '0');
                }
                else
                {
                    MessageBox.Show("无效的用户ID池数据 数据只能在范围:0-9", "错误", MessageBoxButton.OK, MessageBoxImage.Error);
                    return;
                }
            }

            InternalTools.SetUserIDPool(buffer);
        }
Пример #16
0
        //---------------------------------------------------------------------

        bool LoadFromFile(string filename, Polygons ppg, double scale = 0,
                          int xOffset = 0, int yOffset = 0)
        {
            double scaling = System.Math.Pow(10, scale);

            InternalTools.clear(ppg);
            if (!File.Exists(filename))
            {
                return(false);
            }
            using (StreamReader sr = new StreamReader(filename))
            {
                string line;
                if ((line = sr.ReadLine()) == null)
                {
                    return(false);
                }
                int polyCnt, vertCnt;
                if (!Int32.TryParse(line, out polyCnt) || polyCnt < 0)
                {
                    return(false);
                }
                //ppg.Capacity = polyCnt;
                for (int i = 0; i < polyCnt; i++)
                {
                    if ((line = sr.ReadLine()) == null)
                    {
                        return(false);
                    }
                    if (!Int32.TryParse(line, out vertCnt) || vertCnt < 0)
                    {
                        return(false);
                    }
                    Polygon pg = new Polygon();
                    ppg.push(pg);
                    for (int j = 0; j < vertCnt; j++)
                    {
                        double x, y;
                        if ((line = sr.ReadLine()) == null)
                        {
                            return(false);
                        }
                        char[]   delimiters = new char[] { ',', ' ' };
                        string[] vals       = line.Split(delimiters);
                        if (vals.Length < 2)
                        {
                            return(false);
                        }
                        if (!double.TryParse(vals[0], out x))
                        {
                            return(false);
                        }
                        if (!double.TryParse(vals[1], out y))
                        {
                            if (vals.Length < 2 || !double.TryParse(vals[2], out y))
                            {
                                return(false);
                            }
                        }
                        x = x * scaling + xOffset;
                        y = y * scaling + yOffset;
                        pg.push(new IntPoint(new haxe.lang.Null <int>((int)System.Math.Round(x), true), new haxe.lang.Null <int>((int)System.Math.Round(y), true)));
                    }
                }
            }
            return(true);
        }
Пример #17
0
        //---------------------------------------------------------------------------

        private void DrawBitmap(bool justClip = false)
        {
            Cursor.Current = Cursors.WaitCursor;
            try
            {
                if (!justClip)
                {
                    if (rbTest2.Checked)
                    {
                        GenerateAustPlusRandomEllipses((int)nudCount.Value);
                    }
                    else
                    {
                        GenerateRandomPolygon((int)nudCount.Value);
                    }
                }
                using (Graphics newgraphic = Graphics.FromImage(mybitmap))
                    using (GraphicsPath path = new GraphicsPath())
                    {
                        newgraphic.SmoothingMode = SmoothingMode.AntiAlias;
                        newgraphic.Clear(Color.White);
                        if (rbNonZero.Checked)
                        {
                            path.FillMode = FillMode.Winding;
                        }

                        //draw subjects ...
                        for (int i = 0; i < subjects.length; i++)
                        {
                            Polygon  pg  = (Polygon)subjects[i];
                            PointF[] pts = PolygonToPointFArray(pg, scale);
                            path.AddPolygon(pts);
                            pts = null;
                        }
                        using (Pen myPen = new Pen(Color.FromArgb(196, 0xC3, 0xC9, 0xCF), (float)0.6))
                            using (SolidBrush myBrush = new SolidBrush(Color.FromArgb(127, 0xDD, 0xDD, 0xF0)))
                            {
                                newgraphic.FillPath(myBrush, path);
                                newgraphic.DrawPath(myPen, path);
                                path.Reset();

                                //draw clips ...
                                if (rbNonZero.Checked)
                                {
                                    path.FillMode = FillMode.Winding;
                                }
                                for (int i = 0; i < clips.length; i++)
                                {
                                    Polygon  pg  = (Polygon)clips[i];
                                    PointF[] pts = PolygonToPointFArray(pg, scale);
                                    path.AddPolygon(pts);
                                    pts = null;
                                }
                                myPen.Color   = Color.FromArgb(196, 0xF9, 0xBE, 0xA6);
                                myBrush.Color = Color.FromArgb(127, 0xFF, 0xE0, 0xE0);
                                newgraphic.FillPath(myBrush, path);
                                newgraphic.DrawPath(myPen, path);

                                //do the clipping ...
                                if ((clips.length > 0 || subjects.length > 0) && !rbNone.Checked)
                                {
                                    Polygons solution2 = new Polygons();
                                    Clipper  c         = new Clipper(new haxe.lang.Null <int>(0, false));
                                    c.addPaths(subjects, PolyType.PT_SUBJECT, true);
                                    c.addPaths(clips, PolyType.PT_CLIP, true);
                                    InternalTools.clear(solution);
#if UsePolyTree
                                    bool succeeded = c.executePolyTree(GetClipType(), solutionTree, GetPolyFillType(), GetPolyFillType());
                                    //nb: we aren't doing anything useful here with solutionTree except to show
                                    //that it works. Convert PolyTree back to Polygons structure ...
                                    solution = Clipper.polyTreeToPaths(solutionTree);
#else
                                    bool succeeded = c.executePaths(GetClipType(), solution, GetPolyFillType(), GetPolyFillType());
#endif
                                    if (succeeded)
                                    {
                                        //SaveToFile("solution", solution);
                                        myBrush.Color = Color.Black;
                                        path.Reset();

                                        //It really shouldn't matter what FillMode is used for solution
                                        //polygons because none of the solution polygons overlap.
                                        //However, FillMode.Winding will show any orientation errors where
                                        //holes will be stroked (outlined) correctly but filled incorrectly  ...
                                        path.FillMode = FillMode.Winding;

                                        //or for something fancy ...

                                        if (nudOffset.Value != 0)
                                        {
                                            ClipperOffset co = new ClipperOffset(new haxe.lang.Null <double>(0.0, false), new haxe.lang.Null <double>(0.0, false));
                                            co.addPaths(solution, JoinType.JT_ROUND, EndType.ET_CLOSED_POLYGON);
                                            co.executePaths(solution2, (double)nudOffset.Value * scale);
                                        }
                                        else
                                        {
                                            solution2 = solution2.concat(solution);// Polygons(solution);
                                        }
                                        for (int i = 0; i < solution2.length; i++)
                                        {
                                            Polygon  pg  = (Polygon)solution2[i];
                                            PointF[] pts = PolygonToPointFArray(pg, scale);
                                            if (pts.Count() > 2)
                                            {
                                                path.AddPolygon(pts);
                                            }
                                            pts = null;
                                        }
                                        myBrush.Color = Color.FromArgb(127, 0x66, 0xEF, 0x7F);
                                        myPen.Color   = Color.FromArgb(255, 0, 0x33, 0);
                                        myPen.Width   = 1.0f;
                                        newgraphic.FillPath(myBrush, path);
                                        newgraphic.DrawPath(myPen, path);

                                        //now do some fancy testing ...
                                        using (Font f = new Font("Arial", 8))
                                            using (SolidBrush b = new SolidBrush(Color.Navy))
                                            {
                                                double subj_area = 0, clip_area = 0, int_area = 0, union_area = 0;
                                                c.clear();
                                                c.addPaths(subjects, PolyType.PT_SUBJECT, true);
                                                c.executePaths(ClipType.CT_UNION, solution2, GetPolyFillType(), GetPolyFillType());
                                                for (int i = 0; i < solution2.length; i++)
                                                {
                                                    Polygon pg = (Polygon)solution2[i];
                                                    subj_area += Clipper.area(pg);
                                                }
                                                c.clear();
                                                c.addPaths(clips, PolyType.PT_CLIP, true);
                                                c.executePaths(ClipType.CT_UNION, solution2, GetPolyFillType(), GetPolyFillType());
                                                for (int i = 0; i < solution2.length; i++)
                                                {
                                                    Polygon pg = (Polygon)solution2[i];
                                                    clip_area += Clipper.area(pg);
                                                }
                                                c.addPaths(subjects, PolyType.PT_SUBJECT, true);
                                                c.executePaths(ClipType.CT_INTERSECTION, solution2, GetPolyFillType(), GetPolyFillType());
                                                for (int i = 0; i < solution2.length; i++)
                                                {
                                                    Polygon pg = (Polygon)solution2[i];
                                                    int_area += Clipper.area(pg);
                                                }
                                                c.executePaths(ClipType.CT_UNION, solution2, GetPolyFillType(), GetPolyFillType());
                                                for (int i = 0; i < solution2.length; i++)
                                                {
                                                    Polygon pg = (Polygon)solution2[i];
                                                    union_area += Clipper.area(pg);
                                                }

                                                using (StringFormat lftStringFormat = new StringFormat())
                                                    using (StringFormat rtStringFormat = new StringFormat())
                                                    {
                                                        lftStringFormat.Alignment     = StringAlignment.Near;
                                                        lftStringFormat.LineAlignment = StringAlignment.Near;
                                                        rtStringFormat.Alignment      = StringAlignment.Far;
                                                        rtStringFormat.LineAlignment  = StringAlignment.Near;
                                                        Rectangle rec = new Rectangle(pictureBox1.ClientSize.Width - 108,
                                                                                      pictureBox1.ClientSize.Height - 116, 104, 106);
                                                        newgraphic.FillRectangle(new SolidBrush(Color.FromArgb(196, Color.WhiteSmoke)), rec);
                                                        newgraphic.DrawRectangle(myPen, rec);
                                                        rec.Inflate(new Size(-2, 0));
                                                        newgraphic.DrawString("Areas", f, b, rec, rtStringFormat);
                                                        rec.Offset(new Point(0, 14));
                                                        newgraphic.DrawString("subj: ", f, b, rec, lftStringFormat);
                                                        newgraphic.DrawString((subj_area / 100000).ToString("0,0"), f, b, rec, rtStringFormat);
                                                        rec.Offset(new Point(0, 12));
                                                        newgraphic.DrawString("clip: ", f, b, rec, lftStringFormat);
                                                        newgraphic.DrawString((clip_area / 100000).ToString("0,0"), f, b, rec, rtStringFormat);
                                                        rec.Offset(new Point(0, 12));
                                                        newgraphic.DrawString("intersect: ", f, b, rec, lftStringFormat);
                                                        newgraphic.DrawString((int_area / 100000).ToString("0,0"), f, b, rec, rtStringFormat);
                                                        rec.Offset(new Point(0, 12));
                                                        newgraphic.DrawString("---------", f, b, rec, rtStringFormat);
                                                        rec.Offset(new Point(0, 10));
                                                        newgraphic.DrawString("s + c - i: ", f, b, rec, lftStringFormat);
                                                        newgraphic.DrawString(((subj_area + clip_area - int_area) / 100000).ToString("0,0"), f, b, rec, rtStringFormat);
                                                        rec.Offset(new Point(0, 10));
                                                        newgraphic.DrawString("---------", f, b, rec, rtStringFormat);
                                                        rec.Offset(new Point(0, 10));
                                                        newgraphic.DrawString("union: ", f, b, rec, lftStringFormat);
                                                        newgraphic.DrawString((union_area / 100000).ToString("0,0"), f, b, rec, rtStringFormat);
                                                        rec.Offset(new Point(0, 10));
                                                        newgraphic.DrawString("---------", f, b, rec, rtStringFormat);
                                                    }
                                            }
                                    } //end if succeeded
                                }     //end if something to clip
                                pictureBox1.Image = mybitmap;
                            }
                    }
            }
            finally
            {
                Cursor.Current = Cursors.Default;
            }
        }
Пример #18
0
        public void DrawTooltipInfoOfCard(BoardCard boardCard)
        {
            GameClient.Get <ICameraManager>().FadeIn(0.8f, 1);

            if (boardCard.WorkingCard.LibraryCard.CardKind == Enumerators.CardKind.SPELL)
            {
                return;
            }

            BuffOnCardInfoObjects = new List <BuffOnCardInfoObject>();

            const float offset  = 0f;
            const float spacing = -6.75f;

            BuffOnCardInfoObject buff;

            List <BuffTooltipInfo> buffs = new List <BuffTooltipInfo>();

            // left block info ------------------------------------
            if (boardCard.WorkingCard.LibraryCard.CardRank != Enumerators.CardRank.MINION)
            {
                TooltipContentData.RankInfo rankInfo =
                    DataManager.GetRankInfoByType(boardCard.WorkingCard.LibraryCard.CardRank.ToString());
                if (rankInfo != null)
                {
                    TooltipContentData.RankInfo.RankDescription rankDescription = rankInfo.Info.Find(y =>
                                                                                                     y.Element.ToLower()
                                                                                                     .Equals(CardsController.GetSetOfCard(boardCard.WorkingCard.LibraryCard).ToLower()));

                    buffs.Add(
                        new BuffTooltipInfo
                    {
                        Title             = rankInfo.Name,
                        Description       = rankDescription.Tooltip,
                        TooltipObjectType = Enumerators.TooltipObjectType.RANK,
                        Value             = -1
                    });
                }
            }

            if (boardCard.WorkingCard.Type != Enumerators.CardType.WALKER &&
                boardCard.WorkingCard.Type != Enumerators.CardType.NONE)
            {
                TooltipContentData.BuffInfo buffInfo =
                    DataManager.GetBuffInfoByType(boardCard.WorkingCard.Type.ToString());
                if (buffInfo != null)
                {
                    buffs.Add(
                        new BuffTooltipInfo
                    {
                        Title             = buffInfo.Name,
                        Description       = buffInfo.Tooltip,
                        TooltipObjectType = Enumerators.TooltipObjectType.UNIT_TYPE,
                        Value             = -1
                    });
                }
            }

            if (boardCard.WorkingCard.LibraryCard.Abilities != null)
            {
                foreach (AbilityData abil in boardCard.WorkingCard.LibraryCard.Abilities)
                {
                    TooltipContentData.BuffInfo buffInfo = DataManager.GetBuffInfoByType(abil.BuffType);
                    if (buffInfo != null)
                    {
                        buffs.Add(
                            new BuffTooltipInfo
                        {
                            Title             = buffInfo.Name,
                            Description       = buffInfo.Tooltip,
                            TooltipObjectType = Enumerators.TooltipObjectType.ABILITY,
                            Value             = GetValueOfAbilityByType(abil)
                        });
                    }
                }
            }

            for (int i = 0; i < buffs.Count; i++)
            {
                if (i >= 3)
                {
                    break;
                }

                if (BuffOnCardInfoObjects.Find(x => x.BuffTooltipInfo.Title.Equals(buffs[i].Title)) != null)
                {
                    continue;
                }

                buff = new BuffOnCardInfoObject(buffs[i], ParentOfLeftBlockOfCardInfo, offset + spacing * i);

                BuffOnCardInfoObjects.Add(buff);
            }

            buffs.Clear();

            float cardSize     = 7.2f;
            float centerOffset = -7f;

            if (!InternalTools.IsTabletScreen())
            {
                cardSize     = 6.6f;
                centerOffset = -10f;
            }

            InternalTools.GroupVerticalObjects(ParentOfLeftBlockOfCardInfo, 0f, centerOffset, cardSize);
        }
Пример #19
0
        // rewrite
        public IEnumerator CreateCardPreviewAsync(object target, Vector3 pos, bool highlight)
        {
            yield return(new WaitForSeconds(0.3f));

            WorkingCard card = null;

            switch (target)
            {
            case BoardCard card1:
                card = card1.WorkingCard;
                break;

            case BoardUnit unit:
                card = unit.Card;
                break;
            }

            BoardCard boardCard;

            switch (card.LibraryCard.CardKind)
            {
            case Enumerators.CardKind.CREATURE:
                CurrentBoardCard = Object.Instantiate(_cardsController.CreatureCardViewPrefab);
                boardCard        = new UnitBoardCard(CurrentBoardCard);
                break;

            case Enumerators.CardKind.SPELL:
                CurrentBoardCard = Object.Instantiate(_cardsController.SpellCardViewPrefab);
                boardCard        = new SpellBoardCard(CurrentBoardCard);
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }

            boardCard.Init(card);
            if (highlight)
            {
                highlight = boardCard.CanBePlayed(card.Owner) && boardCard.CanBeBuyed(card.Owner);
            }

            boardCard.SetHighlightingEnabled(highlight);
            boardCard.IsPreview = true;

            InternalTools.SetLayerRecursively(boardCard.GameObject, 0);

            switch (target)
            {
            case BoardUnit boardUnit:
                boardCard.DrawTooltipInfoOfUnit(boardUnit);
                break;

            case BoardCard tooltipCard:
                boardCard.DrawTooltipInfoOfCard(tooltipCard);
                break;
            }

            Vector3 newPos = pos;

            newPos.y += 2.0f;
            CurrentBoardCard.transform.position      = newPos;
            CurrentBoardCard.transform.localRotation = Quaternion.Euler(Vector3.zero);

            Vector3 sizeOfCard = Vector3.one;

            sizeOfCard = !InternalTools.IsTabletScreen() ? new Vector3(.8f, .8f, .8f) : new Vector3(.4f, .4f, .4f);

            CurrentBoardCard.transform.localScale = sizeOfCard;

            CurrentBoardCard.GetComponent <SortingGroup>().sortingLayerID = SRSortingLayers.GameUI3;
            CurrentBoardCard.layer = LayerMask.NameToLayer("Default");
            CurrentBoardCard.transform.DOMoveY(newPos.y + 1.0f, 0.1f);
        }
Пример #20
0
        private void FillSystemItemsIn(string path, bool ignoreSavePath = false)
        {
            Reset();


            _folderItems = new List <FileHierarchyItem>();
            _fileItems   = new List <FileHierarchyItem>();
            _cdItems     = new List <DriveHierarchyItem>();

            DirectoryInfo dir = new DirectoryInfo(path);



            FileHierarchyItem fileHierarchyItem;

            if (dir.Exists)
            {
                foreach (var item in dir.GetDirectories())
                {
                    fileHierarchyItem = new FileHierarchyItem(_parentOfContentItems, new SystemItem()
                    {
                        name = item.Name,
                        path = item.FullName,
                        type = Enumerators.SystemItemType.FOLDER
                    });

                    fileHierarchyItem.FileHierarchyItemSelectedEvent += FolderFileHierarchyItemSelectedEvent;

                    _folderItems.Add(fileHierarchyItem);
                }

                foreach (var item in dir.GetFiles())
                {
                    fileHierarchyItem = new FileHierarchyItem(_parentOfContentItems, new SystemItem()
                    {
                        name = item.Name,
                        path = item.FullName,
                        type = Enumerators.SystemItemType.FILE
                    });

                    fileHierarchyItem.FileHierarchyItemSelectedEvent += FileHierarchyItemSelectedEvent;;

                    _fileItems.Add(fileHierarchyItem);
                }
            }

            DriveHierarchyItem driveHierarchyItem;

            foreach (var item in Directory.GetLogicalDrives())
            {
                driveHierarchyItem = new DriveHierarchyItem(_parentOfCDItems, new SystemItem()
                {
                    name = item,
                    path = item,
                    type = Enumerators.SystemItemType.CD
                });

                driveHierarchyItem.DriveHierarchyItemSelectedEvent += DriveHierarchyItemSelectedEvent;;

                _cdItems.Add(driveHierarchyItem);
            }

            InternalTools.FixVerticalLayoutGroupFitting(_parentOfContentItems);
            InternalTools.FixVerticalLayoutGroupFitting(_parentOfCDItems);

            _contentScrollRect.verticalNormalizedPosition = 1f;

            _currentPathText.text = path;

            if (!ignoreSavePath)
            {
                _historyOfOpenedPathes.Add(path);
            }
        }
Пример #21
0
 private int CalculateTimeout()
 {
     return(InternalTools.CalculateTimeout(_errorCount, ErrorThresholdCount, DefaultReconnectTimeout, MaxReconnectTimeout));
 }
Пример #22
0
 internal static string getExceptionMessageTailForID(string debugIDForExceptions)
 {
     return(InternalTools.getExceptionMessageTailForID(debugIDForExceptions, "Parse"));
 }