コード例 #1
0
        public override unsafe void OnMessageArrivals(IntPtr msgs, int count)
        {
            Sphynx.IncomingMessage [] messages = Sphynx.GetMessages(msgs, count);

            System.Windows.Forms.MessageBox.Show("msg");

            byte[] msg = new byte[50];
            WriteReliable(2, 1, msg, (uint)msg.Length);
        }
コード例 #2
0
    private static int SetPieces(string[] pieceFile, int index, PieceColor[,] colors, Quaternion[,] rotations, ref IPiece[,] pieces)
    {
        int a = 0;

        for (int i = index; i < pieceFile.Length; i++)
        {
            if (pieceFile[i].Trim() == "~")
            {
                return(Mathf.Clamp(i + 1, 0, pieceFile.Length - 1));
            }

            for (int j = 0; j < pieceFile[i].Length; j++)
            {
                char   c = pieceFile[i][j];
                IPiece gp;

                switch (c)
                {
                case 'I':
                    gp = new Pharaoh(new Point(a, j), rotations[a, j], colors[a, j], null);
                    break;

                case 'S':
                    gp = new Sphynx(new Point(a, j), rotations[a, j], colors[a, j], null);
                    break;

                case 'C':
                    gp = new Scarab(new Point(a, j), rotations[a, j], colors[a, j], null);
                    break;

                case 'A':
                    gp = new Anubis(new Point(a, j), rotations[a, j], colors[a, j], null);
                    break;

                case 'P':
                    gp = new Pyramid(new Point(a, j), rotations[a, j], colors[a, j], null);
                    break;

                default:
                    gp = new EmptyPoint(null, new Point(a, j));
                    break;
                }

                pieces[a, j] = gp;
            }

            a++;
        }

        return(Mathf.Clamp(index + 1, 0, pieceFile.Length - 1));
    }
コード例 #3
0
        public FortuneGump(Sphynx sphynx) : base(150, 50)
        {
            m_Sphynx = sphynx;

            Closable   = false;
            Disposable = false;
            Dragable   = true;
            Resizable  = false;
            AddPage(0);
            AddImage(0, 0, 3600);
            AddImageTiled(0, 14, 15, 200, 3603);
            AddImageTiled(380, 14, 14, 200, 3605);
            AddImage(0, 201, 3606);
            AddImageTiled(15, 201, 370, 16, 3607);
            AddImageTiled(15, 0, 370, 16, 3601);
            AddImage(380, 0, 3602);
            AddImage(380, 201, 3608);
            AddImageTiled(15, 15, 365, 190, 2624);
            AddRadio(30, 140, 9727, 9730, false, 1);
            AddHtmlLocalized(65, 145, 300, 25, 1060863, 32767, false, false);              // Pay for the reading.
            AddRadio(30, 175, 9727, 9730, true, 2);
            AddHtmlLocalized(65, 178, 300, 25, 1060862, 32767, false, false);              // No thanks. I decide my own destiny!
            AddHtmlLocalized(30, 20, 360, 35, 1060864, 32767, false, false);               // Interested in your fortune, are you?  The ancient Sphynx can read the future for you - for a price of course...
            AddImage(65, 72, 5605);
            AddImageTiled(80, 90, 200, 1, 9107);
            AddImageTiled(95, 92, 200, 1, 9157);
            AddLabel(90, 70, 140, "5000");
            AddHtmlLocalized(140, 70, 100, 25, 1023823, 32767, false, false);               // gold coins
            AddButton(290, 175, 247, 248, 1, GumpButtonType.Reply, 0);
            AddImageTiled(15, 14, 365, 1, 9107);
            AddImageTiled(380, 14, 1, 190, 9105);
            AddImageTiled(15, 205, 365, 1, 9107);
            AddImageTiled(15, 14, 1, 190, 9105);
            AddImageTiled(0, 0, 395, 1, 9157);
            AddImageTiled(394, 0, 1, 217, 9155);
            AddImageTiled(0, 216, 395, 1, 9157);
            AddImageTiled(0, 0, 1, 217, 9155);
            AddHtmlLocalized(30, 105, 340, 40, 1060865, 0xB5CE6B, false, false);               // Do you accept this offer?  The funds will be withdrawn from your backpack.
        }
コード例 #4
0
        static void Main()
        {
            Sphynx.AssemblyResolveHook();

            DoMain();
        }
コード例 #5
0
ファイル: Program.cs プロジェクト: rh24/Zoo
        static void Main(string[] args)
        {
            // Instantiate objects from concrete classes
            ScottishFold    waffles = new ScottishFold("Waffles");
            Sphynx          cleo    = new Sphynx("Cleopatra");
            MaineCoon       simba   = new MaineCoon("Simba");
            Mouse           minnie  = new Mouse("Minnie");
            Rat             rat     = new Rat("PizzaRat");
            SoftShellTurtle softie  = new SoftShellTurtle("Softie");
            SeaTurtle       wen     = new SeaTurtle("Wen");

            // Display properties and behaviors of all objects. Categorize them in two main loops. Concrete animals inheriting from the Cat class, Turtle class, and Rodent Class.
            var cats = new List <Cat> {
                waffles, cleo, simba
            };

            Console.WriteLine("********************************** WELCOME TO MY CAT$$$$$$$$$$ *************************************");
            foreach (var cat in cats)
            {
                Console.WriteLine($"Hello, my name is {cat.Name}. I'm a {cat.GetType().Name}.");
                Console.WriteLine($"Endoskeleton: {cat.Endoskeleton}");
                Console.WriteLine($"Brain: {cat.Brain}");
                Console.WriteLine($"Avg. Life Span in Years: {cat.AvgLifeSpanInYears}");
                Console.WriteLine($"Ear type: {cat.Ears}");
                Console.WriteLine($"Cuteness: {cat.Cuteness}");
                Console.WriteLine($"Sleeping Pattern: {cat.Sleeps()}");
                Console.WriteLine($"Activity: {cat.Plays()}");
                Console.WriteLine($"Demeanor: {cat.GetDemeanor()}");
                Console.WriteLine($"Has Hair: {cat.HairOnSkin}");
                Console.WriteLine($"NOTE TO TOURISTS: {cat.ShouldTouristApproach()}");
                Console.WriteLine($"ARE WE EDIBLE: {cat.ShouldWeEatThis()}");
                Console.WriteLine("------------------------------------------------------------------------------------------------------");
            }

            var rodents = new List <Rodent> {
                minnie, rat
            };

            Console.WriteLine("**************************************** Rodents *************************************************");
            foreach (var rodent in rodents)
            {
                Console.WriteLine($"I'm a {rodent.GetType().Name}.");
                Console.WriteLine($"Endoskelenton: {rodent.Endoskeleton}");
                Console.WriteLine($"Brain: {rodent.Brain}");
                Console.WriteLine($"Avg. Life Span in Years: {rodent.AvgLifeSpanInYears}.");
                Console.WriteLine($"Diseased: {rodent.Diseased}");
                Console.WriteLine($"Sound: {rodent.MakeSound()}");
                Console.WriteLine($"Has Hair: {rodent.HairOnSkin}");
                Console.WriteLine($"Blood Temperature: {rodent.BloodTemperature()}");
                Console.WriteLine($"ARE WE EDIBLE: {rodent.ShouldWeEatThis()}");
                Console.WriteLine($"GROWS UNTIL: {rodent.GrowsUntil()}");
                Console.WriteLine("------------------------------------------------------------------------------------------------------");
            }

            var turtles = new List <Turtle> {
                softie, wen
            };

            Console.WriteLine("**************************************** TURTLE$ *************************************************");
            foreach (var turtle in turtles)
            {
                // Is there any way I can get the property from this turtle object's derived type SeaTurtle or SoftShellTurtle?
                // Is there any way I can force it to be a derived type at runtime? {turtle.Name} gives me red squigglies because I never gave implemented a name property in the abstract Turtle class. I only did that in derived classes.
                // I know there's a way to extract derived types from a collection with LINQ, but that means generating an entirely new collection of the subtype and iterating over that subtype collection. I'm wondering if there's a type casting we can do to extract a derived type from a base type.
                Console.WriteLine($"I'm a {turtle.GetType().Name}.");
                Console.WriteLine($"Endoskelenton: {turtle.VertebrateGretting()}");
                Console.WriteLine($"Brain: {turtle.Brain}");
                Console.WriteLine($"Moving Speed: {turtle.MovingSpeed}.");
                Console.WriteLine($"Skin Type: {turtle.GetSkinType()}");
                Console.WriteLine($"Blood Temperature: {turtle.BloodTemperature()}");
                Console.WriteLine($"NOTE TO TOURISTS: {turtle.ShouldTouristApproach()}");
                Console.WriteLine($"ARE WE EDIBLE: {turtle.ShouldWeEatThis()}");
                Console.WriteLine($"Fatty Meat: {turtle.FattyMeat}");
                Console.WriteLine("------------------------------------------------------------------------------------------------------");
            }
        }