• Üyelik paylaşımı yasaktır! Hesabınızı başkalarına vermeyin! Hesap paylaşımları yasaklama ile sonuçlanacaktır.

swf flash c# örnek taskservice

Durum
Üzgünüz bu konu cevaplar için kapatılmıştır...

dede454531

ReportSpammer
Banlı Üye
Katılım
15 Ara 2017
Mesajlar
299
Beğeni Puanı
23
Kod:
using PlayerIO.GameLibrary;
using System;
using System.Collections.Generic;
using System.Net;

namespace Marketplace
{
    [RoomType("taskservice")]
    public class taskservice : Game<Player>
    {
        public override void GameStarted()
        {
            // anything you write to the Console will show up in the
            // output window of the development server
            Console.WriteLine("Game is started: " + RoomId);

            // This is how you setup a timer
            AddTimer(delegate
            {
                // code here will code every 100th millisecond (ten times a second)
            }, 100);

            // Debug Example:
            // Sometimes, it can be very usefull to have a graphical representation
            // of the state of your game.
            // An easy way to accomplish this is to setup a timer to update the
            // debug view every 250th second (4 times a second).
            AddTimer(delegate
            {
                // This will cause the GenerateDebugImage() method to be called
                // so you can draw a grapical version of the game state.
                RefreshDebugView();
            }, 250);
        }

        // This method is called when the last player leaves the room, and it's closed down.
        public override void GameClosed()
        {
            Console.WriteLine("RoomId: " + RoomId);
        }

        // This method is called whenever a player joins the game
        public override void UserJoined(Player player)
        {
            var task = player.JoinData["task"].Split(':');
            player.PayVault.Refresh(delegate ()
            {
                switch (task[0])
                {
                    case "checkredeem":
                        PlayerIO.BigDB.LoadOrCreate("Giftcodes", task[1], delegate (DatabaseObject giftcodes)
                        {
                            if (giftcodes.Contains("itemname") && giftcodes.GetString("itemname") != "")
                            {
                                if (giftcodes.GetBool("used") == false)
                                {
                                    player.Send("taskstatus", "done", "valid:" + giftcodes.GetString("itemname") + ":" + task[1]);
                                }
                                else
                                {
                                    player.Send("taskstatus", "done", "used");
                                }
                            }
                            else
                            {
                                player.Send("taskstatus", "done", "");
                                PlayerIO.BigDB.DeleteKeys("Giftcodes", task[1]);
                            }
                        });
                        break;
                    case "redeemgc":
                        string code = task[1];
                        PlayerIO.BigDB.LoadOrCreate("Giftcodes", code, delegate (DatabaseObject giftcodes)
                        {
                            if (giftcodes.Contains("itemname") && giftcodes.GetString("itemname") != "")
                            {
                                if (giftcodes.GetBool("used") == false)
                                {
                                    player.PayVault.Give(new BuyItemInfo[] { new BuyItemInfo(giftcodes.GetString("itemname")) }, delegate ()
                                    {
                                        player.Send("taskstatus", "done");
                                        giftcodes.Set("used", true);
                                        giftcodes.Save();
                                    });
                                }
                                else
                                {
                                    player.Send("taskstatus", "fail");
                                }
                            }
                            else
                            {
                                player.Send("taskstatus", "fail");
                            }
                        });
                        break;
                    case "unpack":
                        if (player.PayVault.Has(task[1]))
                        {
                            if (task[1] == "fashionpack")
                            {
                                List<BuyItemInfo> list = new List<BuyItemInfo>();
                                list.Add(new BuyItemInfo("fashionhat"));
                                list.Add(new BuyItemInfo("fashionglasses"));
                                list.Add(new BuyItemInfo("fashionbag"));
                                list.Add(new BuyItemInfo("fashionshoes"));
                                BuyItemInfo[] list2 = list.ToArray();
                                player.PayVault.Consume(new VaultItem[] { player.PayVault.First("fashionpack") }, delegate () { });
                                player.PayVault.Give(list2, delegate () { player.Send("taskstatus", "done"); });
                            }
                            if (task[1] == "memepack")
                            {
                                List<BuyItemInfo> list = new List<BuyItemInfo>();
                                list.Add(new BuyItemInfo("fuuu"));
                                list.Add(new BuyItemInfo("foreveralone"));
                                list.Add(new BuyItemInfo("fuckyeah"));
                                list.Add(new BuyItemInfo("cerealguy"));
                                list.Add(new BuyItemInfo("trollface"));
                                BuyItemInfo[] list2 = list.ToArray();
                                player.PayVault.Consume(new VaultItem[] { player.PayVault.First("memepack") }, delegate () { });
                                player.PayVault.Give(list2, delegate () { player.Send("taskstatus", "done"); });
                            }
                            else if (task[1] == "millionairepack")
                            {
                                List<BuyItemInfo> list = new List<BuyItemInfo>();
                                list.Add(new BuyItemInfo("millionairehat"));
                                list.Add(new BuyItemInfo("millionaireglasses"));
                                list.Add(new BuyItemInfo("millionairecase"));
                                BuyItemInfo[] list2 = list.ToArray();
                                player.PayVault.Consume(new VaultItem[] { player.PayVault.First("millionairepack") }, delegate () { });
                                player.PayVault.Give(list2, delegate () { player.Send("taskstatus", "done"); });
                            }
                            else if (task[1] == "builderpack")
                            {
                                List<BuyItemInfo> list = new List<BuyItemInfo>();
                                list.Add(new BuyItemInfo("hardhat"));
                                list.Add(new BuyItemInfo("hammer"));
                                list.Add(new BuyItemInfo("boots"));
                                BuyItemInfo[] list2 = list.ToArray();
                                player.PayVault.Consume(new VaultItem[] { player.PayVault.First("builderpack") }, delegate () { });
                                player.PayVault.Give(list2, delegate () { player.Send("taskstatus", "done"); });
                            }
                            else if (task[1] == "ninjapack")
                            {
                                List<BuyItemInfo> list = new List<BuyItemInfo>();
                                list.Add(new BuyItemInfo("ninjakick"));
                                list.Add(new BuyItemInfo("ninjaband"));
                                list.Add(new BuyItemInfo("ninjaeyes"));
                                list.Add(new BuyItemInfo("ninjastar"));
                                BuyItemInfo[] list2 = list.ToArray();
                                player.PayVault.Consume(new VaultItem[] { player.PayVault.First("ninjapack") }, delegate () { });
                                player.PayVault.Give(list2, delegate () { player.Send("taskstatus", "done"); });
                            }
                            else if (task[1] == "darkpack")
                            {
                                List<BuyItemInfo> list = new List<BuyItemInfo>();
                                list.Add(new BuyItemInfo("blacklordwings"));
                                list.Add(new BuyItemInfo("blackcrown"));
                                list.Add(new BuyItemInfo("blackeyes"));
                                list.Add(new BuyItemInfo("blackcepter"));
                                list.Add(new BuyItemInfo("blackshoes"));
                                BuyItemInfo[] list2 = list.ToArray();
                                player.PayVault.Consume(new VaultItem[] { player.PayVault.First("darkpack") }, delegate () { });
                                player.PayVault.Give(list2, delegate () { player.Send("taskstatus", "done"); });
                            }
                            else if (task[1] == "darkwizardpack")
                            {
                                List<BuyItemInfo> list = new List<BuyItemInfo>();
                                list.Add(new BuyItemInfo("darkwizardhat"));
                                list.Add(new BuyItemInfo("darkwizardeyes"));
                                list.Add(new BuyItemInfo("darkwizardbeard"));
                                list.Add(new BuyItemInfo("darkwizardcepter"));
                                list.Add(new BuyItemInfo("darkwizardshoes"));
                                BuyItemInfo[] list2 = list.ToArray();
                                player.PayVault.Consume(new VaultItem[] { player.PayVault.First("darkwizardpack") }, delegate () { });
                                player.PayVault.Give(list2, delegate () { player.Send("taskstatus", "done"); });
                            }
                            else if (task[1] == "blackpack")
                            {
                                List<BuyItemInfo> list = new List<BuyItemInfo>();
                                list.Add(new BuyItemInfo("blackgirlshair"));
                                list.Add(new BuyItemInfo("epicbeard"));
                                list.Add(new BuyItemInfo("diamondshoes"));
                                list.Add(new BuyItemInfo("tradingpass"));
                                list.Add(new BuyItemInfo("skipboost"));
                                list.Add(new BuyItemInfo("tradecash5"));
                                list.Add(new BuyItemInfo("blackskin"));
                                BuyItemInfo[] list2 = list.ToArray();
                                player.PayVault.Consume(new VaultItem[] { player.PayVault.First("blackpack") }, delegate () { });
                                player.PayVault.Give(list2, delegate () { player.Send("taskstatus", "done"); });
                            }
                            else if (task[1] == "winterpack")
                            {
                                List<BuyItemInfo> list = new List<BuyItemInfo>();
                                list.Add(new BuyItemInfo("bluewinterscarf"));
                                list.Add(new BuyItemInfo("bluewintercap"));
                                list.Add(new BuyItemInfo("bluewintergloves"));
                                list.Add(new BuyItemInfo("blueiceskates"));
                                list.Add(new BuyItemInfo("iceshotgun"));
                                BuyItemInfo[] list2 = list.ToArray();
                                player.PayVault.Consume(new VaultItem[] { player.PayVault.First("winterpack") }, delegate () { });
                                player.PayVault.Give(list2, delegate () { player.Send("taskstatus", "done"); });
                            }
                            else if (task[1] == "winterpack2")
                            {
                                List<BuyItemInfo> list = new List<BuyItemInfo>();
                                list.Add(new BuyItemInfo("redwinterscarf"));
                                list.Add(new BuyItemInfo("redwintercap"));
                                list.Add(new BuyItemInfo("redwintergloves"));
                                list.Add(new BuyItemInfo("rediceskates"));
                                list.Add(new BuyItemInfo("goldenshotgun"));
                                BuyItemInfo[] list2 = list.ToArray();
                                player.PayVault.Consume(new VaultItem[] { player.PayVault.First("winterpack2") }, delegate () { });
                                player.PayVault.Give(list2, delegate () { player.Send("taskstatus", "done"); });
                            }
                            else if (task[1] == "detectivepack")
                            {
                                List<BuyItemInfo> list = new List<BuyItemInfo>();
                                list.Add(new BuyItemInfo("detectivehat"));
                                list.Add(new BuyItemInfo("detectiveglass"));
                                list.Add(new BuyItemInfo("detectivetie"));
                                list.Add(new BuyItemInfo("magnifier"));
                                list.Add(new BuyItemInfo("detectiveshoes"));
                                BuyItemInfo[] list2 = list.ToArray();
                                player.PayVault.Consume(new VaultItem[] { player.PayVault.First("detectivepack") }, delegate () { });
                                player.PayVault.Give(list2, delegate () { player.Send("taskstatus", "done"); });
                            }
                            else if (task[1] == "cupidpack")
                            {
                                List<BuyItemInfo> list = new List<BuyItemInfo>();
                                list.Add(new BuyItemInfo("cupidhair"));
                                list.Add(new BuyItemInfo("heartglasses"));
                                list.Add(new BuyItemInfo("cupidarrow"));
                                list.Add(new BuyItemInfo("cupidwings"));
                                BuyItemInfo[] list2 = list.ToArray();
                                player.PayVault.Consume(new VaultItem[] { player.PayVault.First("cupidpack") }, delegate () { });
                                player.PayVault.Give(list2, delegate () { player.Send("taskstatus", "done"); });
                            }
                            else if (task[1] == "angelpack")
                            {
                                List<BuyItemInfo> list = new List<BuyItemInfo>();
                                list.Add(new BuyItemInfo("halo"));
                                list.Add(new BuyItemInfo("magicwand"));
                                list.Add(new BuyItemInfo("wings"));
                                BuyItemInfo[] list2 = list.ToArray();
                                player.PayVault.Consume(new VaultItem[] { player.PayVault.First("angelpack") }, delegate () { });
                                player.PayVault.Give(list2, delegate () { player.Send("taskstatus", "done"); });
                            }
                            else if (task[1] == "purplewinterpack")
                            {
                                List<BuyItemInfo> list = new List<BuyItemInfo>();
                                list.Add(new BuyItemInfo("purplexmashat"));
                                list.Add(new BuyItemInfo("purplewinterscarf"));
                                list.Add(new BuyItemInfo("purplemittens"));
                                list.Add(new BuyItemInfo("tradecash100"));
                                list.Add(new BuyItemInfo("tradecash100"));
                                BuyItemInfo[] list2 = list.ToArray();
                                player.PayVault.Consume(new VaultItem[] { player.PayVault.First("purplewinterpack") }, delegate () { });
                                player.PayVault.Give(list2, delegate () { player.Send("taskstatus", "done"); });
                            }
                            else if (task[1] == "baddevilpack")
                            {
                                List<BuyItemInfo> list = new List<BuyItemInfo>();
                                list.Add(new BuyItemInfo("baddevilhead"));
                                list.Add(new BuyItemInfo("baddevileyes"));
                                list.Add(new BuyItemInfo("baddevilwings"));
                                list.Add(new BuyItemInfo("baddevilarrow"));
                                BuyItemInfo[] list2 = list.ToArray();
                                player.PayVault.Consume(new VaultItem[] { player.PayVault.First("baddevilpack") }, delegate () { });
                                player.PayVault.Give(list2, delegate () { player.Send("taskstatus", "done"); });
                            }
                            else if (task[1] == "novapack")
                            {
                                List<BuyItemInfo> list = new List<BuyItemInfo>();
                                list.Add(new BuyItemInfo("novahair"));
                                list.Add(new BuyItemInfo("novaeyes"));
                                list.Add(new BuyItemInfo("novabandana"));
                                list.Add(new BuyItemInfo("novahand"));
                                list.Add(new BuyItemInfo("novashoes"));
                                BuyItemInfo[] list2 = list.ToArray();
                                player.PayVault.Consume(new VaultItem[] { player.PayVault.First("novapack") }, delegate () { });
                                player.PayVault.Give(list2, delegate () { player.Send("taskstatus", "done"); });
                            }
                        }
                        break;
                }
            });
        }

        public override void UserLeft(Player player)
        {


        }

        public override void GotMessage(Player player, Message message)
        {
            PayVault vault = player.PayVault;
        }
    }

}
 
Durum
Üzgünüz bu konu cevaplar için kapatılmıştır...


Üst Alt