Inheritance: MonoBehaviour
Example #1
0
 private void MainForm_Load(object sender, EventArgs e)
 {
     bW = new BackgroundWorker();
     bW.WorkerSupportsCancellation = true;
     bW.DoWork += (s, ev) =>
     {
         while (true)
         {
             try
             {
                 if (emuInit && gameInit && formInit)
                 {
                     Dolphin.UpdateTrackerInfo(this);
                 }
                 FormUtils.Refresh();
             }
             catch
             {
                 emuInit  = false;
                 gameInit = false;
                 formInit = false;
                 FormUtils.Close();
                 break;
             }
             Thread.Sleep(200);
         }
     };
 }
    public static void test()
    {
        var Cassie = new Dolphin();

        Cassie.swim();
        Cassie.giveLiveBirth();
    }
Example #3
0
 private void timer1_Tick(object sender, EventArgs e)
 {
     try
     {
         if (!emuInit)
         {
             emuInit = Dolphin.Init();
         }
         if (emuInit && !gameInit)
         {
             gameInit = Dolphin.GameInit();
         }
         if (emuInit && gameInit && !formInit)
         {
             Dolphin.InitMP();
             Dolphin.InitTracker(this);
             formInit = true;
             bW.RunWorkerAsync();
             this.timer1.Stop();
         }
     }
     catch
     {
         emuInit  = false;
         gameInit = false;
         formInit = false;
         FormUtils.Close();
     }
 }
Example #4
0
        public void Orca_Eats_Dolphin()
        {
            Orca    eater = new Orca();
            Dolphin food  = new Dolphin();

            Assert.True(eater.Eat(food));
        }
Example #5
0
 protected override void OnPaint(PaintEventArgs e)
 {
     base.OnPaint(e);
     base.SetStyle(ControlStyles.SupportsTransparentBackColor, true);
     base.SetStyle(ControlStyles.OptimizedDoubleBuffer, true);
     base.SetStyle(ControlStyles.AllPaintingInWmPaint, true);
     try
     {
         if (!formInit)
         {
             e.Graphics.DrawString("Waiting for Metroid Prime 1/2/3...", new Font("Arial", 10), Brushes.Black, new Point(10, 5));
         }
         if (emuInit && gameInit && formInit)
         {
             Dolphin.UpdateTracker(e.Graphics);
         }
     }
     catch
     {
         emuInit  = false;
         gameInit = false;
         formInit = false;
         FormUtils.Close();
     }
 }
Example #6
0
        public void Dolphin_Eats_Other()
        {
            Dolphin             eater = new Dolphin();
            OtherEdibleCritters food  = new OtherEdibleCritters();

            Assert.True(eater.Eat(food));
        }
Example #7
0
    static void Main()
    {
        Dolphin d = new Dolphin();
        Wombat  w = new Wombat();

        d.Print();
        w.Print();
    }
Example #8
0
        static void  DolphinInheritsSound()
        {
            Dolphin dolphin = new Dolphin();
            string  actual  = dolphin.Sound(dolphin.Name);
            string  reply   = "Skippy the Dolphin can make sounds";

            Assert.Equal(reply, actual);
        }
Example #9
0
 public Dolphin SpawnDolphin()
 {
     var dolphin = new Dolphin();
     dolphin.Position(Util.RandomVector() * 25f);
     dolphin.target = this.ocean;
     dolphin.currentFluid = dolphin.target.Component<Fluid>();
     return dolphin;
 }
Example #10
0
        static void DolphinInheritsGivesBirth()
        {
            Dolphin dolphin = new Dolphin();
            string  actual  = dolphin.GivesBirth();
            string  reply   = "Skippy the Dolphin gives birth and does not lay eggs because it is a mammal";

            Assert.Equal(reply, actual);
        }
Example #11
0
        static void Main(string[] args)
        {
            //Owl owl = new Owl(1, true, 100);
            //string s = owl.ToString();
            //Console.WriteLine(s);

            List <Animal> zoo = new List <Animal>();

            Owl owl = new Owl(1, true, 100);

            zoo.Add(owl);

            Dolphin dolphin = new Dolphin(50, false, 200);

            zoo.Add(dolphin);

            Horse horse = new Horse(600, false, 20);

            zoo.Add(horse);

            foreach (Animal anAnimal in zoo)
            {
                Console.WriteLine($"Weight: {anAnimal.Weight}");
                Console.WriteLine($"Nocturnal: {anAnimal.Nocturnal}");
                anAnimal.Move();

                string msg = anAnimal switch
                {
                    Owl extraOwl => $"Wingspan: {extraOwl.Wingspan}",
                    Dolphin extraDolphin => $"Fish per day: {extraDolphin.FishPerDay}",
                    Horse extraHorse => $"Hay per day: {extraHorse.HayPerDay}",
                       _ => "N/A"
                };

                Console.WriteLine(msg);

                //if(anAnimal is Owl)
                //{
                //    Console.WriteLine($"Wingspan: {((Owl)anAnimal).Wingspan}");
                //}

                //if (anAnimal is Dolphin)
                //{
                //    Console.WriteLine($"Fish per day: {((Dolphin)anAnimal).FishPerDay}");
                //}

                //if (anAnimal is Horse)
                //{
                //    Console.WriteLine($"Hay per day: {((Horse)anAnimal).HayPerDay}");
                //}

                Console.WriteLine();
            }
        }
    }
    void GetEntity()
    {
        var ai = GetComponent<AIController>().ai;
        entity = ai.entity;

        if (entity is Dolphin)
            dolphin = entity as Dolphin;

        if (entity is Mekka)
            mekka = entity as Mekka;
    }
 public SimpleTest()
 {
     try
     {
         _process = Process.GetProcessesByName("dolphin")[0];
         _dolphin = new Dolphin(_process);
     }
     catch (Exception e)
     {
         throw new Exception("Dolphin is not running.");
     }
 }
Example #14
0
        private void btnCreateDolphin_Click(object sender, EventArgs e)
        {
            string  myName    = "Flipper";
            Dolphin myDolphin = new Dolphin(ref myName);

            // if you were to debug here you would find that myName value has been
            // changed by the Dolphin class because the name was
            // passed by reference vs by value where a second value is created
            // in the class which is then discarded from memory by a method
            // called garbage collection
            lblDescription.Text = myDolphin.AboutMe; // display name doesnt match what was provided does it ?
        }
Example #15
0
 public GetDolphinAddressBenchmark()
 {
     try
     {
         var process = Process.GetProcessesByName("dolphin")[0];
         _dolphin = new Dolphin(process);
     }
     catch (Exception e)
     {
         throw new Exception("Dolphin is not running.");
     }
 }
Example #16
0
        public static void Multiple()
        {
            var dolphin = new Dolphin();

            IWalker  walk = new Dolphin();
            ISwimmer swim = new Dolphin();

            Console.WriteLine(walk.Move());
            Console.WriteLine(swim.Move());

            Console.WriteLine(dolphin.Move());
        }
Example #17
0
        internal override bool Artifacts(int index)
        {
            if (CPlayerState == -1)
            {
                return(false);
            }
            if (index < 0)
            {
                throw new Exception("Index can't be negative");
            }
            switch (index)
            {
            case 0:
                return(Dolphin.ReadUInt32(CPlayerState + OFF_ARTIFACT_OF_TRUTH_OBTAINED) > 0);

            case 1:
                return(Dolphin.ReadUInt32(CPlayerState + OFF_ARTIFACT_OF_STRENGTH_OBTAINED) > 0);

            case 2:
                return(Dolphin.ReadUInt32(CPlayerState + OFF_ARTIFACT_OF_ELDER_OBTAINED) > 0);

            case 3:
                return(Dolphin.ReadUInt32(CPlayerState + OFF_ARTIFACT_OF_WILD_OBTAINED) > 0);

            case 4:
                return(Dolphin.ReadUInt32(CPlayerState + OFF_ARTIFACT_OF_LIFEGIVER_OBTAINED) > 0);

            case 5:
                return(Dolphin.ReadUInt32(CPlayerState + OFF_ARTIFACT_OF_WARRIOR_OBTAINED) > 0);

            case 6:
                return(Dolphin.ReadUInt32(CPlayerState + OFF_ARTIFACT_OF_CHOZO_OBTAINED) > 0);

            case 7:
                return(Dolphin.ReadUInt32(CPlayerState + OFF_ARTIFACT_OF_NATURE_OBTAINED) > 0);

            case 8:
                return(Dolphin.ReadUInt32(CPlayerState + OFF_ARTIFACT_OF_SUN_OBTAINED) > 0);

            case 9:
                return(Dolphin.ReadUInt32(CPlayerState + OFF_ARTIFACT_OF_WORLD_OBTAINED) > 0);

            case 10:
                return(Dolphin.ReadUInt32(CPlayerState + OFF_ARTIFACT_OF_SPIRIT_OBTAINED) > 0);

            case 11:
                return(Dolphin.ReadUInt32(CPlayerState + OFF_ARTIFACT_OF_NEWBORN_OBTAINED) > 0);

            default:
                throw new Exception("There are no artifacts past the 12th artifact");
            }
        }
Example #18
0
 public void InitDolphin()
 {
     dolphin = new Dolphin();
     dolphin.spirit.light.InitByLevel(2f);
     dolphin.spirit.ChangeAlignment(Spirit.Alignment.Light);
     dolphin.gameObject.transform.position = new Vector3(0, 0, 5f);
     dolphin.Component<Rigidbody>().constraints = RigidbodyConstraints.FreezeRotation;
     dolphin.gameObject.name = "Player";
     dolphin.gameObject.AddComponent<PlayerController>();
     dolphin.gameObject.AddComponent<PlayerZone>().SetRadius(1200).Retrigger();
     characters.Add(dolphin);
     GameManager.game.scene.entities.Add(dolphin);
 }
Example #19
0
        static void Main(string[] args)
        {
            GameSettings initialSettings = new GameSettings(settingspath);
            Sequences    sequences       = new Sequences(sequencespath);

            Console.WriteLine("Initial Settings x {0}, y {1}, Start Direction {2}", initialSettings.ExitPoint_x, initialSettings.ExitPoint_y, initialSettings.StartingDirection);
            Console.WriteLine("Board Size {0},{1} ; Finish {2},{3}", initialSettings.BoardSize_x, initialSettings.BoardSize_y, initialSettings.ExitPoint_x, initialSettings.ExitPoint_y);


            //Test1
            Turtle Ninj = new Turtle();

            Ninj.NinjFactor = 1;
            TurtleGameActions TurtleSeaAnimalsGame = new TurtleGameActions(Ninj, initialSettings, sequences);

            //Choosing first line of sequences for test
            Ninj = TurtleSeaAnimalsGame.TurtleGameRun(0);

            if (Ninj.AnimalHasLost == false && Ninj.AnimalHasWon == false)
            {
                Console.WriteLine("Test1 : Game Result is correct. TEST PASS");
            }
            else
            {
                Console.WriteLine("Test1 : Game Result is incorrect. TEST FAIL.");
            }

            Console.WriteLine();

            //Test2
            Dolphin Flipper = new Dolphin();

            Flipper.Speed = 1;
            Console.WriteLine("Dolphin Speed {0}", Flipper.Speed);
            DolphinGameActions DolphinSeaAnimalsGame = new DolphinGameActions(Flipper, initialSettings, sequences);

            ////Choosing first 4th line of sequences for test
            Flipper = DolphinSeaAnimalsGame.DolphinGameRun(3);

            if (Flipper.x_position == 2 && Flipper.y_position == 4)
            {
                Console.WriteLine("Test2 : Final Co-ords correct. TEST PASS");
            }
            else
            {
                Console.WriteLine("Test2 : Final Co-ords incorrect. TEST FAIL");
            }

            Console.ReadKey();
        }
Example #20
0
    void Start()
    {
        widthScreen = Screen.width;
        heightScreen = Screen.height;

        leftBorder = (widthScreen - heightScreen) / 2;
        rightBorder = widthScreen - leftBorder;
        middleBorder = heightScreen / 2;

        upperLeftDolphinScript = GameObject.Find("Dolphins/Dolphin_top_left").GetComponent<Dolphin>();
        bottomLeftDolphinScript = GameObject.Find("Dolphins/Dolphin_bottom_left").GetComponent<Dolphin>();
        upperRightDolphinScript = GameObject.Find("Dolphins/Dolphin_top_right").GetComponent<Dolphin>();
        bottomRightDolphinScript = GameObject.Find("Dolphins/Dolphin_bottom_right").GetComponent<Dolphin>();
    }
Example #21
0
        public void testDolphin()
        {
            Dolphin franklin = new Dolphin()
            {
                Waterboi = true, shouldRide = "absolutely"
            };

            franklin.makeMilk();
            string expected          = "Make that milk";
            string expectedInterface = "absolutely";

            Assert.Equal(expected, franklin.makeMilk());
            Assert.True(franklin.Waterboi);
            //test below checks for interface + ridable
            Assert.Equal(expectedInterface, franklin.shouldRide);
        }
Example #22
0
        public void CanInherit()
        {
            Bat      testBat     = new Bat();
            Crow     testCrow    = new Crow();
            Dolphin  testDolphin = new Dolphin();
            Owl      testOwl     = new Owl();
            Penguin  testPenguin = new Penguin();
            SeaOtter testOtter   = new SeaOtter();
            Snake    testSnake   = new Snake();

            Assert.False(testBat.Extinct);
            Assert.False(testCrow.WarmBlooded);
            Assert.True(testDolphin.LiveBirth);
            Assert.True(testOwl.LaysEggs);
            Assert.False(testPenguin.Dangerous);
            Assert.True(testOtter.HasLegs);
            Assert.True(testSnake.ForkedTongue);
        }
Example #23
0
        public void InterfacesCanImplement()
        {
            Bat      testBat     = new Bat();
            Crow     testCrow    = new Crow();
            Dolphin  testDolphin = new Dolphin();
            Owl      testOwl     = new Owl();
            Penguin  testPenguin = new Penguin();
            SeaOtter testOtter   = new SeaOtter();
            Snake    testSnake   = new Snake();

            Assert.True(testBat.Fly());
            Assert.True(testCrow.Fly());
            Assert.True(testDolphin.Carnivore());
            Assert.True(testOwl.Fly());
            Assert.True(testPenguin.Carnivore());
            Assert.True(testOtter.Carnivore());
            Assert.True(testSnake.Carnivore());
            Assert.True(testOwl.Carnivore());
        }
        static void Main(string[] args)
        {
            var fido = new Dog()
            {
                Name = "Fido"
            };
            var bryan = new Dolphin {
                Name = "Bryan"
            };
            var zoo = new Zoo();

            zoo.AddAnimal(fido);
            zoo.AddAnimal(bryan);
            zoo.AddAnimal(new Cricket()
            {
                Name = "Toby"
            });

            zoo.Tour();
        }
        protected virtual void FinishEffect(Point3D p, Map map, Mobile from)
        {
            from.RevealingAction();

            int count = GetSpawnCount();

            for (int i = 0; map != null && i < count; ++i)
            {
                BaseCreature spawn;

                switch (Utility.Random(8))
                {
                default:
                case 0: spawn = new SeaSerpent(); break;

                case 1: spawn = new DeepSeaSerpent(); break;

                case 2: spawn = new WaterElemental(); break;

                case 3: spawn = new SeaSerpent(); break;

                case 4: spawn = new DeepSeaSerpent(); break;

                case 5: spawn = new WaterElemental(); break;

                case 6: spawn = new Dolphin()
                {
                        Name = "Flipper"
                }; break;

                case 7: spawn = new Kraken(); break;
                }

                Spawn(p, map, spawn);

                spawn.Combatant     = from;
                spawn.m_WasFishedUp = true;
            }

            Delete();
        }
Example #26
0
        static void Main(string[] args)
        {
            List <Animal> zoo  = new List <Animal>();
            Owl           owly = new Owl(1, true, 100);

            zoo.Add(owly);

            Dolphin dolphiny = new Dolphin(50, false, 200);

            zoo.Add(dolphiny);

            Horse horsy = new Horse(600, false, 20);

            zoo.Add(horsy);

            foreach (Animal anAnimal in zoo)
            {
                Console.WriteLine($"Weight: {anAnimal.Weight}");
                Console.WriteLine($"Nocturnal: {anAnimal.Nocturnal}");
                anAnimal.Move();
            }
        }
Example #27
0
        static void Main(string[] args)
        {
            //Initialisation.
            GameSettings initialSettings = new GameSettings(settingspath);
            Sequences    sequences       = new Sequences(sequencespath);

            Console.WriteLine("Initial Settings for both games: x {0}, y {1}, Start Direction {2}", initialSettings.ExitPoint_x, initialSettings.ExitPoint_y, initialSettings.StartingDirection);
            Console.WriteLine("Board Size {0},{1} ; Finish {2},{3}", initialSettings.BoardSize_x, initialSettings.BoardSize_y, initialSettings.ExitPoint_x, initialSettings.ExitPoint_y);

            Console.WriteLine("SeaAnimal-Turtle Game");

            //This is runs 5 sets of sequences so 5 Games
            for (int i = 0; i < 4; i++)
            {
                Turtle Ninj = new Turtle();
                Ninj.NinjFactor = 1;
                TurtleGameActions TurtleSeaAnimalsGame = new TurtleGameActions(Ninj, initialSettings, sequences);
                Ninj = TurtleSeaAnimalsGame.TurtleGameRun(i);
                Console.WriteLine("NINJ_FACTOR {0}", Ninj.NinjFactor);
                Console.WriteLine();
            }
            Console.WriteLine("Any Key to continue with SeaAnimal-Dolphin Game");
            Console.ReadKey();

            Console.WriteLine("SeaAnimal-Dolphin Game");
            //This is runs 5 sets of sequences so 5 Games
            for (int i = 0; i < 4; i++)
            {
                Dolphin Flipper = new Dolphin();
                Flipper.Speed = i;
                Console.WriteLine("Dolphin Speed {0}", Flipper.Speed);
                DolphinGameActions DolphinSeaAnimalsGame = new DolphinGameActions(Flipper, initialSettings, sequences);
                Flipper = DolphinSeaAnimalsGame.DolphinGameRun(i);
            }

            Console.ReadKey();
        }
Example #28
0
    // Start is called before the first frame update
    void Start()
    {
        Bear bear = new Bear();

        bear.name   = "Winnie";
        bear.weight = 180.0f;
        bear.height = 0.76f;

        Wolf wolf = new Wolf();

        wolf.name   = "Fang";
        wolf.weight = 45.0f;
        wolf.height = 0.3f;

        Dolphin dolphin = new Dolphin();

        dolphin.name   = "Flipper";
        dolphin.weight = 180.0f;
        dolphin.height = 0.35f;

        Shark shark = new Shark();

        shark.name   = "Jaws";
        shark.weight = 2100.0f;
        shark.height = 4.2f;

        Animal[] theAnimals = new Animal[] { bear, wolf, dolphin, shark };

        Debug.Log("The animals' names are:");

        for (int i = 0; i < theAnimals.Length; i++)
        {
            Animal animal = theAnimals[i];
            Debug.Log(animal.name);
        }
    }
Example #29
0
        private void Form1_Load(object sender, EventArgs e)
        {
            LoadSettings();
            try
            {
                this.comboBox1.SelectedIndex = 0;
                this.comboBox1.Update();
                this.comboBox2.SelectedIndex = 0;
                this.comboBox2.Update();
                this.comboBox3.SelectedIndex = 0;
                this.comboBox3.Update();
                GCSettings.LatencyMode = GCLatencyMode.LowLatency;
                var Worker = new BackgroundWorker();
                Worker.DoWork += (s, ev) =>
                {
                    emuInit = Dolphin.Init();
                    if (emuInit)
                    {
                        gameInit = Dolphin.GameInit();
                        if (gameInit)
                        {
                            detectVersion = Dolphin.InitMP();
                        }
                    }

                    while (!this.Exiting)
                    {
                        try
                        {
                            if (emuInit && gameInit && detectVersion)
                            {
                                if (Dolphin.GameCode == "")
                                {
                                    throw new Exception();
                                }

                                if (Dolphin.MetroidPrime.Health == 0)
                                {
                                    Thread.Sleep(1);
                                    continue;
                                }
                                this.label5.SetTextSafely(Dolphin.MetroidPrime.IGTAsStr);
                                if (WasInSaveStation != Dolphin.MetroidPrime.IsInSaveStationRoom && Dolphin.MetroidPrime.IsInSaveStationRoom)
                                {
                                    Dolphin.MetroidPrime.Health = Dolphin.MetroidPrime.MaxHealth;
                                }
                                WasInSaveStation = Dolphin.MetroidPrime.IsInSaveStationRoom;
                                this.label1.SetTextSafely("Missiles : " + Dolphin.MetroidPrime.Missiles + " / " + Dolphin.MetroidPrime.MaxMissiles);
                                this.label2.SetTextSafely("Morph Ball Bombs : " + Dolphin.MetroidPrime.MorphBallBombs + " / " + Dolphin.MetroidPrime.MaxMorphBallBombs);
                                this.label3.SetTextSafely("Power Bombs : " + Dolphin.MetroidPrime.PowerBombs + " / " + Dolphin.MetroidPrime.MaxPowerBombs);
                                this.label4.SetTextSafely("HP : " + Dolphin.MetroidPrime.Health + " / " + Dolphin.MetroidPrime.MaxHealth + (Dolphin.MetroidPrime.Health < 30 ? " /!\\" : ""));
                                if (!EditingInventory)
                                {
                                    this.morphBallChkBox.SetChecked(Dolphin.MetroidPrime.HaveMorphBall);
                                    this.scanVisorChkBox.SetChecked(Dolphin.MetroidPrime.HaveScanVisor);
                                    this.thermalVisorChkBox.SetChecked(Dolphin.MetroidPrime.HaveThermalVisor);
                                    this.xrayVisorChkBox.SetChecked(Dolphin.MetroidPrime.HaveXRayVisor);
                                    this.morphBallBombsChkBox.SetChecked(Dolphin.MetroidPrime.HaveMorphBallBombs);
                                    this.missileLauncherChkBox.SetChecked(Dolphin.MetroidPrime.MaxMissiles > 0);
                                    this.superMissileChkBox.SetChecked(Dolphin.MetroidPrime.HaveSuperMissile);
                                    this.plasmaBeamChkBox.SetChecked(Dolphin.MetroidPrime.HavePlasmaBeam);
                                    this.iceBeamChkBox.SetChecked(Dolphin.MetroidPrime.HaveIceBeam);
                                    this.waveBeamChkBox.SetChecked(Dolphin.MetroidPrime.HaveWaveBeam);
                                    this.chargeBeamChkBox.SetChecked(Dolphin.MetroidPrime.HaveChargeBeam);
                                    this.grappleBeamChkBox.SetChecked(Dolphin.MetroidPrime.HaveGrappleBeam);
                                    this.spiderBallChkBox.SetChecked(Dolphin.MetroidPrime.HaveSpiderBall);
                                    this.boostBallChkBox.SetChecked(Dolphin.MetroidPrime.HaveBoostBall);
                                    this.powerBombsChkBox.SetChecked(Dolphin.MetroidPrime.MaxPowerBombs > 0);
                                    this.variaSuitChkBox.SetChecked(Dolphin.MetroidPrime.HaveVariaSuit);
                                    this.gravitySuitChkBox.SetChecked(Dolphin.MetroidPrime.HaveGravitySuit);
                                    this.phazonSuitChkBox.SetChecked(Dolphin.MetroidPrime.HavePhazonSuit);
                                    this.wavebusterChkBox.SetChecked(Dolphin.MetroidPrime.HaveWavebuster);
                                    this.iceSpreaderChkBox.SetChecked(Dolphin.MetroidPrime.HaveIceSpreader);
                                    this.flamethrowerChkBox.SetChecked(Dolphin.MetroidPrime.HaveFlamethrower);
                                    this.spaceJumpBootsChkBox.SetChecked(Dolphin.MetroidPrime.HaveSpaceJumpBoots);
                                }
                                for (int i = 0; i < 12; i++)
                                {
                                    ((Label)this.groupBox3.Controls["lblArtifact_" + (i + 1)]).SetTextSafely(this.groupBox3.Controls["lblArtifact_" + (i + 1)].Text.Split(':')[0] + ": " + (Dolphin.MetroidPrime.Artifacts(i) ? OBTAINED : UNOBTAINED));
                                }
                                HandleRefillMissiles(comboBox1.GetSelectedIndex());
                                if (comboBox2.GetText() == "Instant Refill")
                                {
                                    Dolphin.MetroidPrime.MorphBallBombs = Dolphin.MetroidPrime.MaxMorphBallBombs;
                                }
                                HandleRefillPowerBombs(comboBox3.GetSelectedIndex());
                            }
                            else
                            {
                                if (!this.Exiting)
                                {
                                    new Thread(() => MessageBox.Show("Either Dolphin or the game is not running!\r\nExiting...")).Start();
                                    SafeClose();
                                    this.Exiting = true;
                                }
                            }
                        }
                        catch
                        {
                            if (!this.Exiting)
                            {
                                new Thread(() => MessageBox.Show("Either Dolphin or the game is not running!\r\nExiting...")).Start();
                                SafeClose();
                                this.Exiting = true;
                            }
                        }
                        Thread.Sleep(100);
                    }
                };
                Worker.RunWorkerAsync();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
                this.Close();
            }
        }
Example #30
0
 public DolphinAI(Dolphin d)
     : base(d)
 {
     dolphin = d;
 }
Example #31
0
        public bool method_14()
        {
            if (this.PatchGame == null)
            {
                throw new Exception("This game is not patchable!");
            }
            GClass30 title = (GClass30)GClass28.dictionary_0[this.PatchGame];

            if (RadMessageBox.Show(string.Format("This title is a modified version of {0}.\nUSB Helper can build an iso for you by automatically patching the game from the eShop.\nThis way you do not have to provide the iso.\nProceed? (About {1}MB will of data will be downloaded)", (object)title.Name, (object)this.PatchSize), "Proceed?", MessageBoxButtons.YesNo) != DialogResult.Yes)
            {
                return(false);
            }
            // ISSUE: object of a compiler-generated type is created
            // ISSUE: variable of a compiler-generated type
            GClass94.Class79 class79 = new GClass94.Class79();
            if (title.GEnum2_0 != GEnum2.const_2)
            {
                // ISSUE: object of a compiler-generated type is created
                // ISSUE: variable of a compiler-generated type
                GClass94.Class80 class80  = new GClass94.Class80();
                GClass80         gclass80 = new GClass80((WebProxy)null, true, true);
                // ISSUE: reference to a compiler-generated field
                class80.frmWait_0 = new FrmWait("USB Helper is downloading the base game", true);
                // ISSUE: reference to a compiler-generated method
                gclass80.Event_6 += new EventHandler <GEventArgs0>(class80.method_0);
                // ISSUE: reference to a compiler-generated method
                gclass80.Event_5 += new EventHandler <GClass81>(class80.method_1);
                gclass80.method_1(((IEnumerable <GClass30>) new GClass30[1]
                {
                    title
                }).ToList <GClass30>(), 100, 10000);
                // ISSUE: reference to a compiler-generated field
                int num = (int)class80.frmWait_0.ShowDialog();
            }
            Dolphin dolphin = new Dolphin(title, false);

            dolphin.method_5();
            string rom = dolphin.GetRom();

            // ISSUE: reference to a compiler-generated field
            class79.string_0 = new Alphaleonis.Win32.Filesystem.DirectoryInfo(rom).Parent.FullName;
            // ISSUE: reference to a compiler-generated field
            // ISSUE: reference to a compiler-generated field
            class79.string_1 = Alphaleonis.Win32.Filesystem.Path.Combine(class79.string_0, "workdir.tmp");
            // ISSUE: reference to a compiler-generated field
            // ISSUE: reference to a compiler-generated field
            class79.string_2 = Alphaleonis.Win32.Filesystem.Path.Combine(class79.string_0, "patch.uhd");
            dolphin.method_12(true);
            int num1;
            // ISSUE: reference to a compiler-generated method
            FrmWait frmWait1 = new FrmWait("USB Helper is preparing the game...", new Action(class79.method_0), (Action <Exception>)(exception_0 => num1 = (int)RadMessageBox.Show(exception_0.ToString())));

            // ISSUE: reference to a compiler-generated field
            class79.frmWait_0 = new FrmWait("USB Helper is downloading the differential data", true);
            WebClient webClient = new WebClient();

            // ISSUE: reference to a compiler-generated method
            webClient.DownloadProgressChanged += new DownloadProgressChangedEventHandler(class79.method_1);
            // ISSUE: reference to a compiler-generated method
            webClient.DownloadFileCompleted += new AsyncCompletedEventHandler(class79.method_2);
            // ISSUE: reference to a compiler-generated field
            webClient.DownloadFileAsync(new Uri(string.Format("{0}/res/Wii/template/{1}/patch.uhd", (object)Class67.String_2, (object)this.ToInject.ProductId)), class79.string_2);
            // ISSUE: reference to a compiler-generated field
            int num2 = (int)class79.frmWait_0.ShowDialog();
            int num3;
            // ISSUE: reference to a compiler-generated method
            FrmWait frmWait2 = new FrmWait("USB HELPER is patching the game...", new Action(class79.method_3), (Action <Exception>)(exception_0 => num3 = (int)RadMessageBox.Show(exception_0.ToString())));

            // ISSUE: reference to a compiler-generated field
            GClass6.smethod_6(class79.string_2);
            // ISSUE: reference to a compiler-generated field
            GClass6.smethod_5(class79.string_1);
            // ISSUE: reference to a compiler-generated field
            if (!this.vmethod_0(new Alphaleonis.Win32.Filesystem.DirectoryInfo(Alphaleonis.Win32.Filesystem.Path.Combine(class79.string_0, "new-image")).GetFiles()[0].FullName))
            {
                throw new Exception("The output iso was not recognized!");
            }
            int num4 = (int)new frmInjectionAnimation((GClass91)this).ShowDialog();

            dolphin.method_12(true);
            // ISSUE: reference to a compiler-generated field
            GClass6.smethod_5(Alphaleonis.Win32.Filesystem.Path.Combine(class79.string_0, "rawFiles"));
            return(true);
        }
Example #32
0
        ///<summary>Typically used when user clicks a button to a Program link.  This method attempts to identify and execute the program based on the given programNum.</summary>
        public static void Execute(long programNum, Patient pat)
        {
            Program prog = null;

            for (int i = 0; i < ProgramC.Listt.Count; i++)
            {
                if (ProgramC.Listt[i].ProgramNum == programNum)
                {
                    prog = ProgramC.Listt[i];
                }
            }
            if (prog == null)           //no match was found
            {
                MessageBox.Show("Error, program entry not found in database.");
                return;
            }
            if (prog.PluginDllName != "")
            {
                if (pat != null)
                {
                    Plugins.LaunchToolbarButton(programNum, pat.PatNum);
                }
                return;
            }
            if (prog.ProgName == ProgramName.Apixia.ToString())
            {
                Apixia.SendData(prog, pat);
                return;
            }
            else if (prog.ProgName == ProgramName.Apteryx.ToString())
            {
                Apteryx.SendData(prog, pat);
                return;
            }
            else if (prog.ProgName == ProgramName.BioPAK.ToString())
            {
                BioPAK.SendData(prog, pat);
                return;
            }
            else if (prog.ProgName == ProgramName.Camsight.ToString())
            {
                Camsight.SendData(prog, pat);
                return;
            }
            else if (prog.ProgName == ProgramName.CaptureLink.ToString())
            {
                CaptureLink.SendData(prog, pat);
                return;
            }
            else if (prog.ProgName == ProgramName.Cerec.ToString())
            {
                Cerec.SendData(prog, pat);
                return;
            }
            else if (prog.ProgName == ProgramName.CliniView.ToString())
            {
                Cliniview.SendData(prog, pat);
                return;
            }
            else if (prog.ProgName == ProgramName.ClioSoft.ToString())
            {
                ClioSoft.SendData(prog, pat);
                return;
            }
            else if (prog.ProgName == ProgramName.DBSWin.ToString())
            {
                DBSWin.SendData(prog, pat);
                return;
            }
#if !DISABLE_WINDOWS_BRIDGES
            else if (prog.ProgName == ProgramName.DentalEye.ToString())
            {
                DentalEye.SendData(prog, pat);
                return;
            }
            else if (prog.ProgName == ProgramName.DentalStudio.ToString())
            {
                DentalStudio.SendData(prog, pat);
                return;
            }
            else if (prog.ProgName == ProgramName.DentX.ToString())
            {
                DentX.SendData(prog, pat);
                return;
            }
            else if (prog.ProgName == ProgramName.DrCeph.ToString())
            {
                DrCeph.SendData(prog, pat);
                return;
            }
#endif
            else if (prog.ProgName == ProgramName.DentForms.ToString())
            {
                DentForms.SendData(prog, pat);
                return;
            }
            else if (prog.ProgName == ProgramName.Dexis.ToString())
            {
                Dexis.SendData(prog, pat);
                return;
            }
            else if (prog.ProgName == ProgramName.Digora.ToString())
            {
                Digora.SendData(prog, pat);
                return;
            }
            else if (prog.ProgName == ProgramName.Dolphin.ToString())
            {
                Dolphin.SendData(prog, pat);
                return;
            }
            else if (prog.ProgName == ProgramName.Dxis.ToString())
            {
                Dxis.SendData(prog, pat);
                return;
            }
            else if (prog.ProgName == ProgramName.EvaSoft.ToString())
            {
                EvaSoft.SendData(prog, pat);
                return;
            }
            else if (prog.ProgName == ProgramName.EwooEZDent.ToString())
            {
                Ewoo.SendData(prog, pat);
                return;
            }
            else if (prog.ProgName == ProgramName.FloridaProbe.ToString())
            {
                FloridaProbe.SendData(prog, pat);
                return;
            }
            else if (prog.ProgName == ProgramName.Guru.ToString())
            {
                Guru.SendData(prog, pat);
                return;
            }
            else if (prog.ProgName == ProgramName.HouseCalls.ToString())
            {
                FormHouseCalls FormHC = new FormHouseCalls();
                FormHC.ProgramCur = prog;
                FormHC.ShowDialog();
                return;
            }
            else if (prog.ProgName == ProgramName.iCat.ToString())
            {
                ICat.SendData(prog, pat);
                return;
            }
            else if (prog.ProgName == ProgramName.ImageFX.ToString())
            {
                ImageFX.SendData(prog, pat);
                return;
            }
            else if (prog.ProgName == ProgramName.Lightyear.ToString())
            {
                Lightyear.SendData(prog, pat);
                return;
            }
            else if (prog.ProgName == ProgramName.MediaDent.ToString())
            {
                MediaDent.SendData(prog, pat);
                return;
            }
            else if (prog.ProgName == ProgramName.MiPACS.ToString())
            {
                MiPACS.SendData(prog, pat);
                return;
            }
            else if (prog.ProgName == ProgramName.Owandy.ToString())
            {
                Owandy.SendData(prog, pat);
                return;
            }
            else if (prog.ProgName == ProgramName.Patterson.ToString())
            {
                Patterson.SendData(prog, pat);
                return;
            }
            else if (prog.ProgName == ProgramName.PerioPal.ToString())
            {
                PerioPal.SendData(prog, pat);
                return;
            }
            else if (prog.ProgName == ProgramName.Planmeca.ToString())
            {
                Planmeca.SendData(prog, pat);
                return;
            }
            else if (prog.ProgName == ProgramName.Progeny.ToString())
            {
                Progeny.SendData(prog, pat);
                return;
            }
            else if (prog.ProgName == ProgramName.PT.ToString())
            {
                PaperlessTechnology.SendData(prog, pat, false);
                return;
            }
            else if (prog.ProgName == ProgramName.PTupdate.ToString())
            {
                PaperlessTechnology.SendData(prog, pat, true);
                return;
            }
            else if (prog.ProgName == ProgramName.RayMage.ToString())
            {
                RayMage.SendData(prog, pat);
                return;
            }
#if !DISABLE_WINDOWS_BRIDGES
            else if (prog.ProgName == ProgramName.Schick.ToString())
            {
                Schick.SendData(prog, pat);
                return;
            }
#endif
            else if (prog.ProgName == ProgramName.Sirona.ToString())
            {
                Sirona.SendData(prog, pat);
                return;
            }
            else if (prog.ProgName == ProgramName.Sopro.ToString())
            {
                Sopro.SendData(prog, pat);
                return;
            }
            else if (prog.ProgName == ProgramName.TigerView.ToString())
            {
                TigerView.SendData(prog, pat);
                return;
            }
            else if (prog.ProgName == ProgramName.Trophy.ToString())
            {
                Trophy.SendData(prog, pat);
                return;
            }
            else if (prog.ProgName == ProgramName.TrophyEnhanced.ToString())
            {
                TrophyEnhanced.SendData(prog, pat);
                return;
            }
            else if (prog.ProgName == ProgramName.Tscan.ToString())
            {
                Tscan.SendData(prog, pat);
                return;
            }
#if !DISABLE_WINDOWS_BRIDGES
            else if (prog.ProgName == ProgramName.Vipersoft.ToString())
            {
                Vipersoft.SendData(prog, pat);
                return;
            }
#endif
            else if (prog.ProgName == ProgramName.VixWin.ToString())
            {
                VixWin.SendData(prog, pat);
                return;
            }
            else if (prog.ProgName == ProgramName.VixWinBase41.ToString())
            {
                VixWinBase41.SendData(prog, pat);
                return;
            }
            else if (prog.ProgName == ProgramName.VixWinOld.ToString())
            {
                VixWinOld.SendData(prog, pat);
                return;
            }
            else if (prog.ProgName == ProgramName.XDR.ToString())
            {
                Dexis.SendData(prog, pat);               //XDR uses the Dexis protocol
                return;
            }
            //all remaining programs:
            try{
                string cmdline = prog.CommandLine;
                string path    = Programs.GetProgramPath(prog);
                if (pat != null)
                {
                    cmdline = cmdline.Replace("[LName]", pat.LName);
                    cmdline = cmdline.Replace("[FName]", pat.FName);
                    cmdline = cmdline.Replace("[PatNum]", pat.PatNum.ToString());
                    cmdline = cmdline.Replace("[ChartNumber]", pat.ChartNumber);
                    cmdline = cmdline.Replace("[WirelessPhone]", pat.WirelessPhone);
                    cmdline = cmdline.Replace("[HmPhone]", pat.HmPhone);
                    cmdline = cmdline.Replace("[WkPhone]", pat.WkPhone);
                    cmdline = cmdline.Replace("[LNameLetter]", pat.LName.Substring(0, 1).ToUpper());
                    path    = path.Replace("[LName]", pat.LName);
                    path    = path.Replace("[FName]", pat.FName);
                    path    = path.Replace("[PatNum]", pat.PatNum.ToString());
                    path    = path.Replace("[ChartNumber]", pat.ChartNumber);
                    path    = path.Replace("[WirelessPhone]", pat.WirelessPhone);
                    path    = path.Replace("[HmPhone]", pat.HmPhone);
                    path    = path.Replace("[WkPhone]", pat.WkPhone);
                    path    = path.Replace("[LNameLetter]", pat.LName.Substring(0, 1).ToUpper());
                }
                Process.Start(path, cmdline);
            }
            catch {
                MessageBox.Show(prog.ProgDesc + " is not available.");
                return;
            }
        }
Example #33
0
        public static Entity Create(this EntityType entityType, World world)
        {
            Entity entity = null;

            switch (entityType)
            {
            case EntityType.None:
                return(null);

            case EntityType.Chicken:
                entity = new Chicken(world);
                break;

            case EntityType.Cow:
                entity = new Cow(world);
                break;

            case EntityType.Pig:
                entity = new Pig(world);
                break;

            case EntityType.Sheep:
                entity = new Sheep(world);
                break;

            case EntityType.Wolf:
                entity = new Wolf(world);
                break;

            case EntityType.Villager:
                entity = new Villager(world);
                break;

            case EntityType.MushroomCow:
                entity = new Mooshroom(world);
                break;

            case EntityType.Squid:
                entity = new Squid(world);
                break;

            case EntityType.Rabbit:
                entity = new Rabbit(world);
                break;

            case EntityType.Bat:
                entity = new Bat(world);
                break;

            case EntityType.IronGolem:
                entity = new VillagerGolem(world);
                break;

            case EntityType.SnowGolem:
                entity = new Snowman(world);
                break;

            case EntityType.Ocelot:
                entity = new Ocelot(world);
                break;

            case EntityType.Zombie:
                entity = new Zombie(world);
                break;

            case EntityType.Creeper:
                entity = new Creeper(world);
                break;

            case EntityType.Skeleton:
                entity = new Skeleton(world);
                break;

            case EntityType.Spider:
                entity = new Spider(world);
                break;

            case EntityType.ZombiePigman:
                entity = new ZombiePigman(world);
                break;

            case EntityType.Slime:
                entity = new Slime(world);
                break;

            case EntityType.Endermite:
                entity = new Endermite(world);
                break;

            case EntityType.Enderman:
                entity = new Enderman(world);
                break;

            case EntityType.Silverfish:
                entity = new Silverfish(world);
                break;

            case EntityType.CaveSpider:
                entity = new CaveSpider(world);
                break;

            case EntityType.Ghast:
                entity = new Ghast(world);
                break;

            case EntityType.MagmaCube:
                entity = new MagmaCube(world);
                break;

            case EntityType.Blaze:
                entity = new Blaze(world);
                break;

            case EntityType.ZombieVillager:
                entity = new ZombieVillager(world);
                break;

            case EntityType.Witch:
                entity = new Witch(world);
                break;

            case EntityType.Stray:
                entity = new Stray(world);
                break;

            case EntityType.Husk:
                entity = new Husk(world);
                break;

            case EntityType.WitherSkeleton:
                entity = new WitherSkeleton(world);
                break;

            case EntityType.Guardian:
                entity = new Guardian(world);
                break;

            case EntityType.ElderGuardian:
                entity = new ElderGuardian(world);
                break;

            case EntityType.Horse:
                entity = new Horse(world);
                break;

            case EntityType.ZombieHorse:
                entity = new ZombieHorse(world);
                break;

            case EntityType.PolarBear:
                entity = new PolarBear(world);
                break;

            case EntityType.Shulker:
                entity = new Shulker(world);
                break;

            case EntityType.EnderDragon:
                entity = new EnderDragon(world);
                break;

            case EntityType.SkeletonHorse:
                entity = new SkeletonHorse(world);
                break;

            case EntityType.Wither:
                entity = new Wither(world);
                break;

            case EntityType.Evoker:
                entity = new EvocationIllager(world);
                break;

            case EntityType.Vindicator:
                entity = new VindicationIllager(world);
                break;

            case EntityType.Vex:
                entity = new Vex(world);
                break;

            case EntityType.FallingBlock:
                entity = new EntityFallingBlock(world);
                break;

            case EntityType.ArmorStand:
                entity = new EntityArmorStand(world, null);
                break;

            case EntityType.Arrow:
                entity = new ArrowEntity(world, null);
                break;

            case EntityType.Item:
                entity = new ItemEntity(world);
                break;

            case EntityType.Mooshroom:
                entity = new Mooshroom(world);
                break;

            case EntityType.Snowball:
                entity = new SnowballEntity(world, null);
                break;

            case EntityType.ThrownEgg:
                entity = new EggEntity(world, null);

                break;

            case EntityType.Donkey:
                entity = new Donkey(world);
                break;

            case EntityType.Llama:
                entity = new Llama(world);
                break;

            case EntityType.Mule:
                entity = new Mule(world);
                break;

            case EntityType.Fox:
                entity = new Fox(world);
                break;

            case EntityType.Parrot:
                entity = new Parrot(world);
                break;

            case EntityType.Phantom:
                entity = new Phantom(world);
                break;

            case EntityType.Bee:
                entity = new Bee(world);
                break;

            case EntityType.LlamaSpit:
                entity = new LlamaSpit(world);
                break;

            case EntityType.Cat:
                entity = new Cat(world);
                break;

            case EntityType.SmallFireball:
                entity = new SmallFireball(world);
                break;

            case EntityType.Fireball:
                entity = new Fireball(world);
                break;

            case EntityType.Dolphin:
                entity = new Dolphin(world);
                break;

            case EntityType.Cod:
                entity = new Cod(world);
                break;

            case EntityType.PufferFish:
                entity = new PufferFish(world);
                break;

            case EntityType.Salmon:
                entity = new Salmon(world);
                break;

            case EntityType.TropicalFish:
                entity = new TropicalFish(world);
                break;

            case EntityType.FireworkRocket:
                entity = new FireworkRocket(world, null);
                break;

            //case EntityType.Human:
            //entity = new PlayerMob("test", world, );
            //	break;
            default:
                return(null);
            }

            return(entity);
        }
Example #34
0
    static void Main(string[] args)
    {
        DateTime      worldTime = DateTime.Now;
        List <Animal> animals   = new List <Animal>();

        animals.Add(new Dolphin());
        foreach (var animal in animals)
        {
            animal.Death += Globals.animalDeathLogger;
        }

        System.Timers.ElapsedEventHandler onWorldTimeUpdate = delegate(object sender, System.Timers.ElapsedEventArgs e)
        {
            worldTime = worldTime.AddYears(1);
            animals[0].Live(worldTime);
            Console.WriteLine($"[{worldTime}] Updating...");
        };
        System.Timers.Timer worldTimer = new System.Timers.Timer(1000);
        worldTimer.AutoReset = true;
        worldTimer.Elapsed  += onWorldTimeUpdate;
        worldTimer.Start();
        Console.ReadKey();

        Humanity h = new Humanity(5);
        int      c = h.CurrentJobCount("dev");

        Human      human     = new Human();
        IFormatter formatter = new BinaryFormatter();

        using (Stream stream = new FileStream("data.bin", FileMode.Create)) {
            formatter.Serialize(stream, human);
        }

        Human dp;

        using (Stream stream = new FileStream("data.bin", FileMode.Open)) {
            dp = (Human)formatter.Deserialize(stream);
        }

        dp.ShowInfo();

        Dolphin d = new Dolphin();

        using (Stream stream = new FileStream("data.json", FileMode.Create)) {
            DataContractJsonSerializer ser = new DataContractJsonSerializer(typeof(Dolphin));
            ser.WriteObject(stream, d);
            stream.Position = 0;
        }

        using (Stream stream = new FileStream("data.json", FileMode.Open)) {
            DataContractJsonSerializer ser = new DataContractJsonSerializer(typeof(Dolphin));
            stream.Position = 0;
            d = (Dolphin)ser.ReadObject(stream);
        }

        d.ShowInfo();

        Humanity list = new Humanity(5);

        Console.WriteLine(list.CurrentJobCount("cook"));
    }
Example #35
0
 public void go_to_dolphin()
 {
     iTween.MoveTo(player, dolphin.transform.position, 5f);
     dolphinCanvas.SetActive(true);
     Dolphin.PlayDelayed(2.0f);
 }