Exemplo n.º 1
0
        private void Update()
        {
            if (CurrentWorld == null)
            {
                UpdateWorld((StartupWorld)Configuration.LeftSideObjects.Find(x => x.GetType() == typeof(StartupWorld)));
            }

            foreach (LeftSide leftSide in Configuration.LeftSideObjects)
            {
                if (leftSide is TickEvent @event)
                {
                    if (@event != null)
                    {
                        @event.Execute();
                    }
                }
                else if (leftSide is GameWorld world1 && leftSide != CurrentWorld)
                {
                    GameWorld world = world1;
                    if (world != null && world.WorldReference.reference.Name != null)
                    {
                        Rectangle match;
                        if (Recognize(world.WorldReference, out match))
                        {
                            UpdateWorld(world);
                        }
                    }
                }
            }

            if (CurrentWorld is GameWorld)
            {
                GameWorld world = (GameWorld)CurrentWorld;
                if (world.WorldObjects.Count > 0)
                {
                    foreach (GameWorld.WorldObject worldObject in world.WorldObjects)
                    {
                        if (!(worldObject is IRecognizable))
                        {
                            continue;
                        }
                        Rectangle     match;
                        IRecognizable worldObj = (IRecognizable)worldObject;
                        if (worldObj.Get() is World.ImageRecognition reference)
                        {
                            if (Recognize(reference, out match))
                            {
                                worldObj.Recognized(match);
                            }
                        }
                        else if (worldObj.Get() is World.TextRecognition)
                        {
                            // TODO
                        }
                        else if (worldObj.Get() is World.ShapeRecognition)
                        {
                            // TODO
                        }
                        else if (worldObj.Get() is World.ScreenParameter)
                        {
                            // TODO
                        }
                        else if (worldObj.Get() is World.RectangleRecognition)
                        {
                            // TODO
                        }
                    }
                }
            }

            Overlay.Run();
        }
Exemplo n.º 2
0
 public static int RequestID(IRecognizable target)
 {
     return(GameRandom.GetRand(startID, endID));
 }