예제 #1
0
 public void CompareBounds()
 {
     (double xMin, double xMax) = Zed.getAxisMinMax(X);
     (double yMin, double yMax) = Zed.getAxisMinMax(Y);
     (double zMin, double zMax) = Zed.getAxisMinMax(Z);
     if (xMin < GroupBounds.XMin)
     {
         GroupBounds.XMin = xMin;
     }
     if (xMax > GroupBounds.XMax)
     {
         GroupBounds.XMax = xMax;
     }
     if (yMin < GroupBounds.YMin)
     {
         GroupBounds.YMin = yMin;
     }
     if (yMax > GroupBounds.YMax)
     {
         GroupBounds.YMax = yMax;
     }
     if (zMin < GroupBounds.ZMin)
     {
         GroupBounds.ZMin = zMin;
     }
     if (zMax > GroupBounds.ZMax)
     {
         GroupBounds.ZMax = zMax;
     }
 }
예제 #2
0
 public void AddCurve(CurveItem curve)
 {
     if (!IsCurveAdded(curve.Label.Text))
     {
         PlanetId id = OwnerOf(curve.Label.Text[0]);
         int      i  = 0;
         for (; i < thePane.CurveList.Count; i++)
         {
             CurveItem     existed  = thePane.CurveList[i];
             PlanetId      starId   = OwnerOf(existed);
             OrbitInfoType starKind = KindOf(existed);
             if (starId > id)
             {
                 continue;
             }
             else if (starId < id)
             {
                 break;
             }
             //else if (starKind < kind)
             //    continue;
             //else if (starKind > kind)
             //    break;
         }
         thePane.CurveList.Insert(i, curve);
         Zed.Invalidate();
     }
 }
예제 #3
0
        public void AddFilledCurve(String name, List <double> xItems, List <double> yItems, Color color)
        {
            if (yItems.Count != xItems.Count)
            {
                throw new Exception();
            }

            Double max = yItems.Max();
            Double min = yItems.Min();

            max = gracefulOf(max, false);
            min = gracefulOf(min, true);
            double        temp, range = max - min;
            List <double> converted = new List <double>();

            for (int i = 0; i < yItems.Count; i++)
            {
                temp = (yItems[i] - min) * Frame.Range / range + Frame.Min;
                converted.Add(temp);
            }

            CurveItem curve = thePane.AddCurve(name, xItems.ToArray(), converted.ToArray(), color, SymbolType.None);

            Zed.Invalidate();
        }
예제 #4
0
        /// <summary>
        /// AutoPopulateSPL is used to add/update a graph for the SPL magnitude and phase curves of a driver.
        /// The system graph is updated as well.
        /// This one uses the text in the filename box to auto-populate the driver files on session file read.
        /// </summary>
        /// <param name="systemZGC"></param>
        /// <param name="filename"></param>
        /// <returns></returns>
        public static bool AutoPopulateSPL(ZedGraphControl systemZGC, string filename, double[] frequencies)
        {
            Zed zedObject = new Zed(); // Created only for access to the methods

            //ColorSymbolRotator splColor = new ColorSymbolRotator();

            if (!File.Exists(filename))
            {
                return(false);
            }
            zedObject.ImportSPLData(filename, frequencies); // Read the data, convert to double and interpolate
            zedObject.filename = filename;

            if (zedObject.splInterpolated == null)
            {
                MessageBox.Show("No valid data found, cannot continue.\nTry another file.", filename);
                return(false); // Can't go further, but don't need to stop. User can try another file.
            }

            systemZGC.ZoomOutAll(systemZGC.GraphPane);

            // Invoke the method to add the curves to the graph.
            Curves.AddComplexCurves(systemZGC, zedObject.splInterpolated, currentColor, filename, "Mag", "Phase", false);
            currentColor = splColor.NextColor;
            return(true);
        }
예제 #5
0
        static void Main(string[] args)
        {
            Zed zed_cam = new Zed();

            zed_cam.Start_Sequential();

            int show_time = 10;

            for (int i = 0; i < show_time; i++)
            {
                zed_cam.GrabOnce();
                Image <Bgra, byte> image_zed_left = zed_cam.Left;
                CvInvoke.cvShowImage("Left", image_zed_left);
                //CvInvoke.Imshow("Left", image_zed_left);
                Image <Bgra, byte> image_zed_right = zed_cam.Right;
                CvInvoke.cvShowImage("Right", image_zed_right);
                //CvInvoke.Imshow("Right", image_zed_right);

                //CvInvoke.WaitKey(25);
                CvInvoke.cvWaitKey(25);
            }

            zed_cam.GrabOnce();
            Bitmap left_im = (Bitmap)zed_cam.Left.ToBitmap().Clone();

            Console.WriteLine("left_im.Size:{0}", left_im.Size);
            left_im.Save("left_save_cv.png");

            Image <Gray, ushort> depth_im = zed_cam.FetchDepth16U();

            //CvInvoke.Imwrite("depth_save_cv.png", depth_im);
            depth_im.Save("depth_save_cv.png");

            zed_cam.Close();
        }
예제 #6
0
        public static void PopulateZedList()
        {
            for (var i = 0; i < ZedSpawner.ZedQuantity; i++)
            {
                var zed = new Zed
                {
                    Position      = ZedSpawner.ZedSpawnPoint(),
                    IsSpawned     = true,
                    IsAlive       = true,
                    CurrentHealth = 100,
                    MaxHealth     = 100,
                    Speed         = 0.5f,
                    Texture       = Textures.ZedTexture,
                    ID            = Guid.NewGuid().ToString(),
                    Description   = "A zombie.  Grr, argh",
                    AlertRange    = 400,
                    AttackPower   = 1,
                    AttackSpeed   = 4,
                    NextAttack    = 4
                };

                zed.CurrentPoint     = zed.Position;
                zed.DestinationPoint = zed.Position;

                zed.BRec.X = (int)zed.Position.X;
                zed.BRec.Y = (int)zed.Position.Y;

                zed.BRec.Width  = Textures.ZedTexture.Width;
                zed.BRec.Height = Textures.ZedTexture.Height;

                ZedSpawner.StopZedsBunching();

                EntityLists.ZedList.Add(zed);
            }
        }
예제 #7
0
 public void Disconnected()
 {
     lock (this)
     {
         camera      = null;
         isConnected = false;
         Debug.WriteLine("Disconnected from Camera");
     }
 }
예제 #8
0
 private void Create1DCal(double[] A, double[] B, string axis, int range)
 {
     (double b, double m) = Zed.linearFit(A, B);
     RTBOutput.Text      += $":START {ZAxis} MASTER={axis} POSUNIT=METRIC CORUNIT=METRIC/1000 SAMPLEDIST=-{range}\n"
                            + $"{(m * range) + b:f3}\t{b:f3}\t0.000\n"
                            + $":END\n";
     RTBOutput.Text += $":START {ZCAxis} MASTER={axis} POSUNIT=METRIC CORUNIT=METRIC/1000 SAMPLEDIST=-{range}\n"
                       + $"{(m * range) + b:f3}\t{b:f3}\t0.000\n"
                       + $":END\n";
 }
예제 #9
0
    void Start()
    {
        BaseHero zed = new Zed();

        Debug.Log(zed.GetType());
        PlaySkill(zed);
        Debug.Log("---------------------------");
        BaseHeroVersionTwo lebanc = new Lebanc();

        PlaySkill2(lebanc);
    }
예제 #10
0
 private void AcquireImages(Zed zed)
 {
     try
     {
         imageBox1.Invoke((MethodInvoker) delegate
         {
             // you can use method FetchImage or any of the helper methods
             // e.g. zed.Left, zed.Right, zed.Depth ...
             var image       = zed.FetchImage(view);
             imageBox1.Image = image;
         });
     }
     catch { }
 }
예제 #11
0
        public static void CheckZedHumanCollision(Zed zed)
        {
            foreach (var human in EntityLists.HumanList)
            {
                if (zed.BRec.Intersects(human.BRec))
                {
                    if (zed.NextAttack <= 0)
                    {
                        human.CurrentHealth -= zed.AttackPower;

                        zed.NextAttack = zed.AttackSpeed;
                    }
                    else
                    {
                        zed.NextAttack--;
                    }

                    if (human.NextAttack <= 0)
                    {
                        zed.CurrentHealth -= human.AttackPower;

                        human.NextAttack = human.AttackSpeed;
                    }
                    else
                    {
                        human.NextAttack--;
                    }

                    if (zed.Position.X >= human.Position.X)
                    {
                        zed.Position.X += 1;
                    }
                    if (zed.Position.X <= human.Position.X)
                    {
                        zed.Position.X -= 1;
                    }
                    else if (zed.Position.Y >= human.Position.Y)
                    {
                        zed.Position.Y += 1;
                    }
                    if (zed.Position.Y <= human.Position.Y)
                    {
                        zed.Position.Y -= 1;
                    }
                }
            }
        }
예제 #12
0
 public PlotData(Scan scan, Zed.Axes xAxis, Zed.Axes yAxis, Zed.Axes zAxis, bool compare = true)
 {
     Name = scan.Name;
     Zed.Position[] data = ApplyFilters((Zed.Position[])scan.Data.ToArray().Clone());
     X = Zed.getAxis(data, (int)xAxis, FlipX);
     Y = Zed.getAxis(data, (int)yAxis, FlipY);
     Z = Zed.getAxis(data, (int)zAxis, FlipZ);
     if (compare)
     {
         CompareBounds();
     }
     SelectedPoint = scan.SelectedIdx == -1 ? null : new Zed.Position(
         data[scan.SelectedIdx].Time,
         xAxis == Zed.Axes.None ? 0 : X[scan.SelectedIdx],
         yAxis == Zed.Axes.None ? 0 : Y[scan.SelectedIdx],
         zAxis == Zed.Axes.None ? 0 : Z[scan.SelectedIdx],
         0, 0);
 }
예제 #13
0
        /// <summary>
        ///     Checks if the player can go to the selected Shadow.
        /// </summary>
        /// <param name="shadow">The shadow</param>
        /// <returns></returns>
        public static bool CanGoToShadow(Shadow shadow) //TODO safety Checks lel
        {
            if (Zed.getCheckBoxItem(Zed.miscMenu, "safetyChecks") &&
                (!Zed.getKeyBindItem(Zed.fleeMenu, "fleeActive") ||
                 !Orbwalker.ActiveModesFlags.HasFlag(Orbwalker.ActiveModes.Flee)))
            {
                if (shadow.State == ShadowState.Created)
                {
                    if (ObjectManager.Player.HealthPercent < 35 || shadow.Position.UnderTurret(true) ||
                        (shadow.ShadowObject.CountEnemiesInRange(1200f) > 1 &&
                         shadow.ShadowObject.CountEnemiesInRange(1200f) < 2))
                    {
                        return(false);
                    }
                }
            }

            return(shadow.State == ShadowState.Created);
        }
예제 #14
0
        public void Connect(Zed camera)
        {
            lock (this)
            {
                if (camera == null)
                {
                    Debug.WriteLine("Connecting a null Camera.");
                    return;
                }

                if (isConnected == true)
                {
                    Disconnected();
                }

                this.camera = camera;
                isConnected = true;
                Debug.WriteLine("Connected to a Camera");
            }
        }
예제 #15
0
        void Start()
        {
            // start with stored SVO
            //var zed = new Zed(@"c:\Projects\files\HD720_SN17600_11-04-52.svo");

            // start with live feed
            // zed = new Zed();
            zed = new Zed(RESOLUTION.HD1080);

            // You need to assign the listener that will execute in each camera loop
            // in this case I named it AcquireImages and implemented it below
            zed.FrameTick        += this.AcquireImages;
            zed.RuntimeParameters = new RuntimeParameters
            {
                sensingMode = SENSING_MODE.FILL,
                enableDepth = true
            };
            //zed.Start();
            //zed.Start_Sequential();
            zed.Start_with_Thread();
        }
예제 #16
0
 private Zed.Position[] ApplyFilters(Zed.Position[] data)
 {
     if (RemoveAngle)
     {
         Zed.Plane plane = Zed.getPlane(data);
         for (int i = 0; i < data.Length; i++)
         {
             Zed.Position p = data[i];
             data[i] = new Zed.Position(p.Time, p.X, p.Y, p.Z, p.H - Zed.projectPlane(plane, Zed.posToVec3(data[i])).Z, p.I);
         }
     }
     if (Equalize)
     {
         double equalizer = Zed.getAxis(data, 4, false).Min();
         for (int i = 0; i < data.Length; i++)
         {
             data[i] = new Zed.Position(data[i].Time, data[i].X, data[i].Y, data[i].Z, data[i].H - equalizer, data[i].I);
         }
     }
     return(data);
 }
예제 #17
0
        public bool RemoveCurveOf(String label)
        {
            CurveItem toBeDropped = null;

            foreach (CurveItem curve in thePane.CurveList)
            {
                if (curve.Label.Text != label)
                {
                    continue;
                }

                toBeDropped = curve;
                break;
            }

            if (toBeDropped == null)
            {
                return(false);
            }
            else
            {
                thePane.CurveList.Remove(toBeDropped);

                if (toBeDropped.IsY2Axis)
                {
                    int index = toBeDropped.GetYAxisIndex(thePane);
                    if (index == 0)
                    {
                        SetY2Scale();
                    }
                    else if (index == 1)
                    {
                        SetY3Scale();
                    }
                }

                Zed.Invalidate();
                return(true);
            }
        }
예제 #18
0
        private bool VerifyPath(string path, int idx)
        {
            int result = -1;

            switch (idx)
            {
            case 0:
                result = Metro.verify(path);
                break;

            case 1:
                result = Zed.verify(path);
                break;

            case 2:
                result = Report.verify(path);
                break;

            default:
                break;
            }
            if (result == -1)
            {
                return(false);
            }
            switch (result)
            {
            case 0:
                MessageBox.Show("Insufficient data in file", "XferSuite");
                return(false);

            case 1:
            case 2:
                return(true);

            default:
                MessageBox.Show("Invalid file", "XferSuite");
                return(false);
            }
        }
예제 #19
0
        public static void CheckZedBuildingCollision(Zed zed)
        {
            foreach (var building in EntityLists.BuildingList)
            {
                if (zed.BRec.Intersects(building.BRec))
                {
                    if (zed.NextAttack <= 0)
                    {
                        building.CurrentHealth -= zed.AttackPower;

                        zed.NextAttack = zed.AttackSpeed;
                    }
                    else
                    {
                        zed.NextAttack--;
                    }

                    if (zed.Position.X >= building.Position.X)
                    {
                        zed.Position.X += 1;
                    }
                    if (zed.Position.X <= building.Position.X)
                    {
                        zed.Position.X -= 1;
                    }
                    else if (zed.Position.Y >= building.Position.Y)
                    {
                        zed.Position.Y += 1;
                    }
                    if (zed.Position.Y <= building.Position.Y)
                    {
                        zed.Position.Y -= 1;
                    }
                }
            }
        }
예제 #20
0
        public PluginLoader()
        {
            if (!_loaded)
            {
                switch (ObjectManager.Player.ChampionName.ToLower())
                {
                case "ahri":
                    var ahri = new Ahri();
                    _loaded = true;
                    break;

                case "akali":
                    var akali = new Akali();
                    _loaded = true;
                    break;

                case "anivia":
                    var anivia = new Anivia();
                    break;

                case "cassiopeia":
                    var cassiopeia = new Cassiopeia();
                    _loaded = true;
                    break;

                case "ashe":
                    var ashe = new Ashe();
                    _loaded = true;
                    break;

                case "azir":
                    var azir = new Azir();
                    _loaded = true;
                    break;

                case "chogath":
                    var chogath = new Chogath();
                    _loaded = true;
                    break;

                case "corki":
                    var corki = new Corki();
                    _loaded = true;
                    break;

                case "ekko":
                    var ekko = new Ekko();
                    _loaded = true;
                    break;

                case "ezreal":
                    var ezreal = new Ezreal();
                    _loaded = true;
                    break;

                case "irelia":
                    var irelia = new Irelia();
                    _loaded = true;
                    break;

                case "jinx":
                    var jinx = new Jinx();
                    _loaded = true;
                    break;

                case "karthus":
                    var karthus = new Karthus();
                    _loaded = true;
                    break;

                case "katarina":
                    var katarina = new Katarina();
                    _loaded = true;
                    break;

                case "kogmaw":
                    var kogMaw = new KogMaw();
                    _loaded = true;
                    break;

                case "lissandra":
                    var lissandra = new Lissandra();
                    _loaded = true;
                    break;

                case "lucian":
                    var lucian = new Lucian();
                    _loaded = true;
                    break;

                case "jayce":
                    var jayce = new Jayce();
                    _loaded = true;
                    break;

                case "orianna":
                    var orianna = new Orianna();
                    _loaded = true;
                    break;

                case "rumble":
                    var rumble = new Rumble();
                    _loaded = true;
                    break;

                case "syndra":
                    var syndra = new Syndra();
                    _loaded = true;
                    break;

                case "vayne":
                    var vayne = new Vayne();
                    _loaded = true;
                    break;

                case "viktor":
                    var viktor = new Viktor();
                    _loaded = true;
                    break;

                case "vladimir":
                    var vladimir = new Vladimir();
                    _loaded = true;
                    break;

                case "urgot":
                    var urgot = new Urgot();
                    _loaded = true;
                    break;

                case "zyra":
                    var zyra = new Zyra();
                    _loaded = true;
                    break;

                //case "veigar":
                //    var veigar = new Veigar();
                //    _loaded = true;
                //    break;
                case "zed":
                    var zed = new Zed();
                    _loaded = true;
                    break;

                default:
                    Notifications.AddNotification(ObjectManager.Player.ChampionName + " not supported!!", 10000);
                    break;
                }
            }
        }
예제 #21
0
 public ZEDCommonSettingPage(Zed camera)
 {
     InitializeComponent();
     setCamera(camera.Camera);
 }
예제 #22
0
        public void AddCurve(String name)
        {
            if (IsCurveAdded(name))
            {
                RemoveCurveOf(name);
            }

            switch (name[0])
            {
            case 'A':
                if (Clock != null)
                {
                    LineItem clockLine = Frame.CurveOf(Clock, Orbits.Start, Orbits.End);

                    if (clockLine != null)
                    {
                        AddCurve(clockLine);
                    }
                }
                break;

            case '$':
                if (PriceTranslator != null)
                {
                    LineItem priceLine;

                    if (PriceTranslator.Rule != PriceMappingRules.Filled)
                    {
                        priceLine = Frame.CurveOf(PriceTranslator, History.CurrentOutline.PivotDates, History.CurrentOutline.PivotValues, CycleMapper, true);
                    }
                    else
                    {
                        priceLine = Frame.CurveOf(PriceTranslator, History.Dates, History.OutlineValues, CycleMapper, true);
                    }

                    if (priceLine != null)
                    {
                        AddCurve(priceLine);
                    }
                }
                break;

            case '+':
                if (Shift != null)
                {
                    LineItem shiftLine = Frame.CurveOf("+", timeScope, new List <double> {
                        Shift.Degrees, Shift.Degrees
                    }, Color.DarkCyan, SymbolType.None);
                    AddCurve(shiftLine);
                }
                break;

            case '*':
                if (Shift == null)
                {
                    break;
                }
                else if (MinusOrbits.Count != 0 || PlusOrbits.Count != 0)
                {
                    List <Double> xList = getCombinedDateValues();

                    if (xList != null)
                    {
                        CurveItem curve = combinedCurveOf(xList);
                        AddCurve(curve);
                    }
                    else
                    {
                        throw new Exception();
                    }
                }
                break;

            default:
                PlanetId      id   = OwnerOf(name[0]);
                OrbitInfoType kind = kindOf(name.Substring(1, name.Length - 1));
                AddCurve(id, kind);
                break;
            }
            Zed.Invalidate();
        }
예제 #23
0
        private static void GameEvents_GameStart()
        {
            if (Valid.All(x => Global.Player.ChampionName != x))
            {
                return;
            }

            SummonerSpells.Init();
            GameObjects.Init();
            Global.Init();
            GetRandom.Init();

            switch (Global.Player.ChampionName)
            {
            case "Ezreal":
                Ezreal.Init();
                break;

            case "Azir":
                Azir.Init();
                break;

            case "Irelia":
                Irelia.Init();
                break;

            case "Jax":
                Jax.Init();
                break;

            case "Jinx":
                var jinx = new Jinx();
                jinx.Init();
                break;

            case "Kayn":
                Kayn.Init();
                break;

            case "LeeSin":
                var lee = new LeeSin();
                lee.Init();
                break;

            case "Rengar":
                Rengar.Init();
                break;

            case "Riven":
                Riven.Init();
                break;

            case "Tristana":
                var tristana = new Tristana();
                tristana.Init();
                break;

            case "Yasuo":
                Yasuo.Init();
                break;

            case "Zed":
                Zed.Init();
                break;
            }
        }