Beispiel #1
0
        public override void Handle(User usr, Room room)
        {
            if (!room.gameactive && room.channel != 3)
            {
                return;
            }

            DropType DropType = (DropType)(int.Parse(getBlock(7)));

            switch (DropType)
            {
            case DropType.Respawn:
            {
                break;
            }

            case DropType.Medic:
            {
                usr.Health     = 1000;
                sendBlocks[10] = usr.Health;
                break;
            }

            case DropType.Ammo:
            {
                break;
            }

            case DropType.Repair:
            {
                int     vehicleId = room.GetIncubatorVehicleId();
                Vehicle Vehicle   = room.GetVehicleByID(vehicleId);
                if (Vehicle != null)
                {
                    Vehicle.Health += 10000;

                    if (Vehicle.Health > Vehicle.MaxHealth)
                    {
                        Vehicle.Health = Vehicle.MaxHealth + 1;
                    }

                    sendBlocks[10] = Vehicle.Health;
                    sendBlocks[11] = Vehicle.MaxHealth;
                }
                break;
            }

            default:
            {
                Log.WriteError("Unknown Zombie Drop ID: " + int.Parse(getBlock(7)));
                break;         // Unknown
            }
            }

            room.DropID--;

            /* Important */

            sendPacket = true;
        }
        //temp
        private void DetermineDrop(DropType t)
        {
            switch (t)
            {
            case DropType.HEAL:
                int temp = healthCurrent + 25;
                healthCurrent       = temp > healthMax ? healthMax : temp;
                healthUI.localScale = new Vector3(1f, (float)healthCurrent / (float)healthMax, 1f);
                break;

            case DropType.HEALTH:
                break;

            case DropType.MOVEMENTSPEED:
                //could work...
                movementSpeed = UpgradesController.Instance.GetMovementValue(++playerInfo.levelMovementSpeed);
                CoroutineEX.Delay(this, () => movementSpeed = UpgradesController.Instance.GetMovementValue(--playerInfo.levelMovementSpeed), 5f);
                break;

            case DropType.FIRERATE:
                bullet.AdjustFireRate(UpgradesController.Instance.GetFireRateValue(++playerInfo.levelFireRate));
                CoroutineEX.Delay(this, () => bullet.AdjustFireRate(UpgradesController.Instance.GetFireRateValue(--playerInfo.levelFireRate)), 5f);
                break;

            case DropType.ARMOUR:
                break;

            default:
                break;
            }
        }
Beispiel #3
0
    // Spawn a random drop at the given position
    public GameObject SpawnDrop(DropType type, Vector3 pos)
    {
        GameObject newDrop = GameObject.Instantiate(DropTypeDict[type].prefab);

        newDrop.transform.position = pos;
        return(newDrop);
    }
        public Drops(Vector2 position, double depth, Texture2D texture, Rectangle initialframe, Vector2 velocity, float pScale, Player player, int AmountOrID, DropType DropType)
            : base(position, depth, texture, initialframe, velocity)
        {
            WorldLocation = position;
            dropType      = DropType;
            amountOrid    = AmountOrID;


            switch (dropType)
            {
            case DropType.Experience:
                int ExperienceAmount = AmountOrID;
                moveSpeed = 20f;
                break;

            case DropType.Item:
                int ItemID = AmountOrID;
                break;

            case DropType.Heal:
                int HealAmount = AmountOrID;
                break;

            case DropType.Upgrade:
                int UpgradeID = AmountOrID;
                break;
            }
        }
Beispiel #5
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["USER"] == null)
            {
                Response.Redirect("~/Login.aspx");
            }
            else
            {
                if (Page.IsPostBack == false)
                {
                    txtTarix.Text = time;
                    var typ = (from x in db.TBLTYPE
                               select new
                    {
                        x.TYPENAME,
                        x.TYPEID
                    }).ToList();

                    DropType.DataSource = typ;
                    DropType.DataBind();
                    var cat = (from x in db.TBLCATEGORY
                               select new
                    {
                        x.CATNAME,
                        x.CATID
                    }).ToList();
                    DropCategory.DataSource = cat;
                    DropCategory.DataBind();
                }
            }
        }
Beispiel #6
0
    // Get the maxDropInterval of a certain type
    private float maxDropInterv(DropType type)
    {
        int   baseMDI    = DropTypeDict [type].maxDropInterval;
        float multiplier = 100f / (100f + droprateBoost [type]);

        return(((float)baseMDI) * multiplier);
    }
        public void Drop(object data, DropType dropType)
        {
            var gameObject = (GameObject)data;

            Children.Add(gameObject);
            gameObject.Parent = this;
        }
Beispiel #8
0
 public Pickup(Vector2 position, DropType dropType, int amount)
     : base(position, 30, 30)
 {
     Position = position;
     DropType = dropType;
     Amount = amount;
 }
Beispiel #9
0
 // Creates simple drop that dissolves after certain amount of take
 public void createDropLimitedAmount(Entity entity, int id, int amount)
 {
     this.entity = entity;
     this.id     = id;
     type        = DropType.LIMITED_AMOUNT;
     this.amount = amount;
 }
 public CreateEditGiveawayDropViewModel(GiveawayDrop drop)
 {
     this.ID          = drop.ID;
     this.Name        = drop.Name;
     this.LowerBound  = drop.LowerBound;
     this.HigherBound = drop.HigherBound;
     this.Type        = drop.Type;
 }
Beispiel #11
0
    public static bool Compare(DropType color1, DropType color2)
    {
        int colorIndex1 = (int)color1;
        int colorIndex2 = (int)color2;

        int diff = colorIndex2 - colorIndex1;

        return(Mathf.Abs(diff) == 0);
    }
        public override void SpawnEntities()
        {
            Vector3 spawn = GetSpawnPoint();

            if (IsValidSpawn(spawn))
            {
                DropType[] dropTypes = (DropType[])Enum.GetValues(typeof(DropType));
                DropType   randDrop  = _dropType = dropTypes[Database.Random.Next(dropTypes.Length)];
                string     model     = (_dropType == DropType.Weapons) ? "prop_mil_crate_01" : "ex_prop_crate_closed_bc";
                _prop = World.CreateProp(model, spawn, Vector3.Zero, false, false);
                if (_prop == null)
                {
                    Complete();
                }
                else
                {
                    Vector3 position = _prop.Position;
                    _blip       = World.CreateBlip(position.Around(45f), 145f);
                    _blip.Color = GTA.BlipColor.Yellow;
                    _blip.Alpha = 150;
                    _dropZone   = _blip.Position;
                    position    = _prop.Position;
                    Vector3 particlePos = position.Around(5f);
                    _particle       = WorldExtended.CreateParticleEffectAtCoord(particlePos, "exp_grd_flare");
                    _particle.Color = Color.LightGoldenrodYellow;
                    int rand = Database.Random.Next(3, 6);
                    for (int i = 0; i <= rand; i++)
                    {
                        Vector3 pedSpawn = spawn.Around(10f);
                        PedHash pedHash  = _pedHashes[Database.Random.Next(_pedHashes.Length)];
                        Ped     ped      = World.CreatePed(pedHash, pedSpawn);
                        if (!(ped == null))
                        {
                            if (i > 0)
                            {
                                ped.Weapons.Give(_weapons[Database.Random.Next(_weapons.Length)], 45, true, true);
                            }
                            else
                            {
                                ped.Weapons.Give(GTA.Native.WeaponHash.SniperRifle, 15, true, true);
                            }
                            ped.Accuracy = 100;
                            ped.Task.GuardCurrentPosition();
                            ped.RelationshipGroup = Relationships.MilitiaRelationship;
                            _pedGroup.Add(ped, i == 0);
                            _peds.Add(ped);
                            EntityEventWrapper pedWrapper = new EntityEventWrapper(ped);
                            pedWrapper.Died += PedWrapperOnDied;
                        }
                    }
                    Model val = "mesa3";
                    position = _prop.Position;
                    World.CreateVehicle(val, World.GetNextPositionOnStreet(position.Around(25f)));
                    UI.Notify(string.Format("~y~Merryweather~s~ {0} drop nearby.", (_dropType == DropType.Loot) ? "loot" : "weapons"));
                }
            }
        }
Beispiel #13
0
    public static void PlayPickupSound(DropType t)
    {
        List <int> DropSounds = SoundHolder.PickupSounds[DropType.AmmunitionShotgun];

        if (DropSounds.Count != 0)
        {
            PlaySound(DropSounds[seed.NextInt(0, DropSounds.Count)]);
        }
    }
Beispiel #14
0
    // Use this for initialization
    void Start()
    {
        Rigidbody2D = this.GetComponent<Rigidbody2D>();

        SpriteRenderer = this.gameObject.GetComponent<SpriteRenderer>();

        dropType = RandDropType();

        SpriteRenderer.sprite = sprites[(int)dropType];
    }
Beispiel #15
0
 public Item(string name, int id, string desc, int power, int speed, ItemType type, DropType dtype)
 {
     itemName  = name;
     itemID    = id;
     itemDesc  = desc;
     itemIcon  = Resources.Load <Texture2D>("Textures/" + name);
     itemPower = power;
     itemSpeed = speed;
     itemType  = type;
     dropType  = dtype;
 }
 public int CountDropWaterByCondition(DropType dropType, DateTime? date, string num, int companyId,
     int gameplaywayId, double dropvalue, decimal amount)
 {
     string condition;
     var parameterList = BuildCondition(dropType, date, num, companyId, gameplaywayId, dropvalue, amount, out condition);
     string sql = string.Format(@"SELECT COUNT(0) FROM {0} dw
     LEFT JOIN {2} dic ON dic.{3}=dw.{4}
     WHERE {1}", DropWater.TABLENAME, condition, DropInCompany.TABLENAME, DropInCompany.DROPID, DropWater.DROPID);
     object count = base.ExecuteScalar(sql, parameterList.ToArray());
     return Convert.ToInt32(count);
 }
        public void Update(DropType dropType)
        {
            _dropType = dropType;
            if (_layer == null)
            {
                _layer = AdornerLayer.GetAdornerLayer(AdornedElement);
                _layer.Add(this);
            }

            _layer.Update(AdornedElement);
            Visibility = Visibility.Visible;
        }
Beispiel #18
0
        public void CreateTable(DropType DropType, string TempTableSchemaNoQuotes, string TempTableNameNoQuotes, DataTable DataTbl, SqlConnection conn, bool AddPkey, bool forceString)
        {
            string SQL = "";

            if ((DropType == TemporarySQLDestinationTable.DropType.DropAlways) || ((DropType == TemporarySQLDestinationTable.DropType.DropOnFirstCreateOnly) && (TableCreated == false)))
            {
                if (TempTableNameNoQuotes.StartsWith("#"))
                {
                    SQL = @" IF object_id('tempdb.." + TempTableNameNoQuotes + @"') IS NOT NULL
                                    BEGIN
                                        DROP TABLE [" + TempTableNameNoQuotes + @"]
                                    END";
                    //SQLAccess.ExecuteNonQuery(SQLAccess.FPMSqlCon, SQL, true);
                }
                else
                {
                    SQL = string.Format(@" IF object_id('[{0}].[{1}]') IS NOT NULL
                                    BEGIN
                                        DROP TABLE [{0}].[{1}]
                                    END", TempTableSchemaNoQuotes, TempTableNameNoQuotes);
                }
                SqlCommand sql_com = new SqlCommand(SQL, conn);
                sql_com.ExecuteNonQueryWithVerboseThrow();
                SQL     = "";
                sql_com = null;
            }

            if (TableCreated == false)
            {
                //SQL = SQLDataAccess.SqlTableCreator.GetCreateFromDataTableSQL(TempTableName, DataTbl, false);
                SQL = SqlTableCreator.GetCreateFromDataTableSQL(TempTableSchemaNoQuotes, TempTableNameNoQuotes, DataTbl, false, forceString);
                //SQLAccess.ExecuteNonQuery(SQLAccess.FPMSqlCon, SQL, true);
                SqlCommand sql_com = new SqlCommand(SQL, conn);
                sql_com.ExecuteNonQueryWithVerboseThrow();
                SQL = "";
                if (AddPkey)
                {
                    if (TempTableNameNoQuotes.StartsWith("#"))
                    {
                        SQL = string.Format(@"Alter Table [{0}] add [Pkey{1}] bigint identity(1,1) PRIMARY KEY CLUSTERED", TempTableNameNoQuotes, Guid.NewGuid().ToString());
                    }
                    else
                    {
                        SQL = string.Format(@"Alter Table [{0}].[{1}] add [Pkey{2}] bigint identity(1,1) PRIMARY KEY CLUSTERED", TempTableSchemaNoQuotes, TempTableNameNoQuotes, Guid.NewGuid().ToString());
                    }
                    sql_com = new SqlCommand(SQL, conn);
                    sql_com.ExecuteNonQueryWithVerboseThrow();
                }
                TableCreated = true;
                sql_com      = null;
            }
        }
Beispiel #19
0
 protected void Page_Load(object sender, EventArgs e)
 {
     CheckLogin();
     if (!IsPostBack)
     {
         ArrayList type = new ArrayList();
         type.Add("用户");
         type.Add("管理员");
         DropType.DataSource = type;
         DropType.DataBind();
         DropType.Items.Insert(0, new ListItem("--请选择--", ""));
     }
 }
Beispiel #20
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Drop" /> class.
        /// </summary>
        /// <param name="type">The drop type.</param>
        /// <param name="schema">The table schema.</param>
        /// <param name="target">The target name.</param>
        public Drop(DropType type, string schema, string target)
        {
            Type = type;
            switch (Type)
            {
            case DropType.Table:
                Target = new Table(schema, target);
                break;

            default:
                throw new InvalidCommandException($"Cannot convert schema+name strings to drop type '{Type}'");
            }
        }
Beispiel #21
0
        public DropRegion(DropType DropType, Rectangle Rectangle, IBlockView destination, object extraInfo, DataType argType)
        {
            this.DropType = DropType;
            this.Rectangle = Rectangle;
            this.Destination = destination;
            this.ExtraInfo = extraInfo;
            this.ArgType = argType;

            if (argType == DataType.Invalid && DropType == DropType.AsArgument)
            {
                throw new ArgumentException("DropRegion constructor: if DropType is argument, you must supply a valid argument type", "argType");
            }
        }
Beispiel #22
0
        public DropRegion(DropType DropType, Rectangle Rectangle, IBlockView destination, object extraInfo, DataType argType)
        {
            this.DropType    = DropType;
            this.Rectangle   = Rectangle;
            this.Destination = destination;
            this.ExtraInfo   = extraInfo;
            this.ArgType     = argType;

            if (argType == DataType.Invalid && DropType == DropType.AsArgument)
            {
                throw new ArgumentException("DropRegion constructor: if DropType is argument, you must supply a valid argument type", "argType");
            }
        }
Beispiel #23
0
    /// <summary>
    /// 周囲にいる同タイプのCharacterを探し、繋がっているもの全てを返す処理
    /// </summary>
    /// <param name="type">探索対象のキャラクタータイプ</param>
    /// <param name="objList">発見済みのCharacterリスト</param>
    /// <param name="x">探索基準点x</param>
    /// <param name="y">探索基準点y</param>
    /// <param name="isBomb">探索先が違うtypeでもListに含めるか 爆発の場合はtrueに</param>
    /// <param name="isCircle">斜めの位置も見るか 爆発の場合はtrueに</param>
    /// /// <param name="limit">探索する限界距離</param>
    internal void search(DropType type, List <Character> objList, int x, int y, bool isBomb = false, bool isCircle = false, int limit = 100)
    {
        if (limit <= 0)
        {
            return;
        }
        int _x, _y;

        int[,] dirs = isCircle ?
                      //爆発の場合は斜めも見るので、合計9要素の配列
                      new int[, ] {
            { 1, 1 }, { 1, 0 }, { 1, -1 }, { 0, 1 }, { 0, 0 }, { 0, -1 }, { -1, 1 }, { -1, 0 }, { -1, -1 }
        } :
        //通常の場合なら上下左右の4要素
        new int[, ] {
            { 1, 0 }, { 0, 1 }, { 0, -1 }, { -1, 0 }
        };
        for (int i = 0; i < dirs.GetLength(0); i++)
        {
            //探索先の座標が存在するか確認 存在しなければcontinue
            _x = x + dirs[i, 0];
            if (_x < 0 || _x >= StageManager.Instance.StageLength[0])
            {
                continue;
            }
            //_x = (_x < 0 ? 0 : (_x >= StageManager.Instance.StageLength[0] ? StageManager.Instance.StageLength[0] - 1 : _x));
            _y = y + dirs[i, 1];
            if (_y < 0 || _y >= StageManager.Instance.StageLength[1])
            {
                continue;
            }
            //_y = (_y < 0 ? 0 : (_y >= StageManager.Instance.StageLength[1] ? StageManager.Instance.StageLength[1] - 1 : _y));

            if (StageManager.Instance.Stage[_x, _y].character == null)
            {
                continue;
            }
            Character chara = objList.Find(z => z == StageManager.Instance.Stage[_x, _y].holdCharacter);
            //探索先が同タイプでリストに含まれていない場合、探索先をリストに含めた後さらにそこから探索を開始する
            if (chara == null && StageManager.Instance.Stage[_x, _y].holdCharacter.data.m_DropType == type)
            {
                StageManager.Instance.Stage[_x, _y].character.isChecked = true;
                objList.Add(StageManager.Instance.Stage[_x, _y].holdCharacter);
                search(type, objList, _x, _y, isBomb, isCircle, --limit);
            }
            else if (isBomb)
            {
                //爆発の場合、探索先をListに含めて処理を終了する
            }
        }
    }
Beispiel #24
0
 public Drop(int DropID, Reward reward, int OwnerID, int OwnPartyID, DropType OwnType, int SourceID, short x1, short y1, short x2, short y2, bool ByPet, bool ByUser)
 {
     this.DropID     = DropID;
     this.Reward     = reward;
     this.OwnerID    = OwnerID;
     this.OwnPartyID = OwnPartyID;
     this.OwnType    = OwnType;
     this.SourceID   = SourceID;
     this.Pt1        = new Pos(x1, y1);
     this.Pt2        = new Pos(x2, y2);
     this.MergeArea  = Rectangle.FromLTRB(x2 - 50, y2 - 20, x2 + 50, y2 + 20);
     this.ByPet      = ByPet;
     this.ByUser     = ByUser;
 }
        public int CountDropWater(DropType dropType, DateTime? date = null)
        {
            string dateCondition = date.HasValue ? string.Format(@" AND CONVERT(char(10),dw.{0},120)=CONVERT(char(10),@{0},120)", DropWater.CREATETIME) : string.Empty;
            string sql = string.Format(@"SELECT COUNT(0) FROM {0} dw
            LEFT JOIN {1} dic ON dic.{2}=dw.{3}
            WHERE dw.{4}=@{4} {5}", DropWater.TABLENAME, DropInCompany.TABLENAME, DropInCompany.DROPID, DropWater.DROPID, DropWater.DROPTYPE, dateCondition);

            var paramArr = new SqlParameter[date.HasValue ? 2 : 1];
            paramArr[0] = new SqlParameter(DropWater.DROPTYPE, (int)dropType);
            if (date.HasValue)
                paramArr[1] = new SqlParameter(DropWater.CREATETIME, date);
            object count = base.ExecuteScalar(sql, paramArr);
            return Convert.ToInt32(count);
        }
Beispiel #26
0
        // Creates simple drop that dissolves after certain time
        public void createDropLimitedTime(Entity entity, int id, float time)
        {
            this.entity = entity;
            this.id     = id;
            type        = DropType.LIMITED_TIME;
            duration    = time;
            // Create lifetime
            Timer life = gameObject.AddComponent <Timer>();

            life.time   = duration;
            life.OnEnd += delegate() {
                Destroy(gameObject);
            };
            life.Launch();
        }
Beispiel #27
0
    public static Color DropTypeColor(DropType type)
    {
        switch (type)
        {
        case DropType.Ammo:
            return(new Color(0 / 255f, 191 / 255f, 255 / 255f));     //blue

        case DropType.Health:
            return(Color.green);

        case DropType.Perk:
            return(new Color(153 / 255f, 50 / 255f, 204 / 255f));     //purple
        }
        return(Color.grey);
    }
Beispiel #28
0
 // Upgrade the droprate boost of a certain type
 public static void upgradeDR(DropType type, int total)
 {
     if (droprateBoost == null || total == 0)
     {
         droprateBoost = new Dictionary <DropType, float> ();
         foreach (DropType dropType in System.Enum.GetValues(typeof(DropType)))
         {
             droprateBoost.Add(dropType, 0f);
         }
     }
     else
     {
         droprateBoost [type] += 5f + droprateBoost[type] * 0.05f;
     }
 }
    public void DropItem(PlayerController player,
                         DropType dropType   = DropType.Standard,
                         string messageStart = "You found")
    {
        if (items == null || items.Length == 0)
        {
            return;
        }
        var guaranteedDrop = dropType == DropType.MagicRewardGuaranteed || dropType == DropType.StandardGuaranteed;

        do
        {
            var allItems = gameManager.Items.GetItems();

            var droppableItems = items.Select(x =>
            {
                RavenNest.Models.Item item = null;
                if (Guid.TryParse(x.ItemID, out var itemId))
                {
                    item = allItems.FirstOrDefault(y => y.Id == itemId);
                }
                else
                {
                    item = allItems.FirstOrDefault(y => y.Name.IndexOf(x.ItemID, StringComparison.OrdinalIgnoreCase) >= 0);
                }
                return(new
                {
                    Item = item,
                    x.DropChance
                });
            })
                                 .Where(x => x.Item != null)
                                 .OrderByDescending(x => x.DropChance).ToList();

            foreach (var item in droppableItems)
            {
                //if (player.Stats.Attack.Level < item.Item.RequiredAttackLevel ||
                //    player.Stats.Defense.Level < item.Item.RequiredDefenseLevel)
                //    continue;

                if (UnityEngine.Random.value <= item.DropChance)
                {
                    player.PickupItem(item.Item, messageStart);
                    return;
                }
            }
        } while (guaranteedDrop);
    }
        public void Drop(object sender, DragEventArgs e, DropType type)
        {
            //var source = WPFHelper.FindParent<HierarchyControl>(e.Data.GetData() as TextBlock);
            var source        = e.Data.GetData("control") as HierarchyControl;
            var target        = WPFHelper.FindParent <HierarchyControl>(sender as DependencyObject);
            var source_parent = WPFHelper.FindParent <HierarchyControl>(source);

            source.Effect          = null;
            source.RenderTransform = null;

            //make sure we aren't double dropping
            if (source != target)
            {
                //drop into the target hierarchy control as child
                switch (type)
                {
                case DropType.NORMAL:
                    foreach (GameObject g in EngineManagerViewModel.instance.SelectedGameObjects)
                    {
                        if (g != source.GetDataContext())
                        {
                            target.Virtual_AddChild(g);
                        }
                    }
                    target.Virtual_AddChild(source);
                    break;

                case DropType.SEPARATOR:
                    target.Virtual_DetachChild(source);
                    break;

                case DropType.FOLDER:
                    target.Virtual_DetachChild(source);
                    break;
                }

                //remove it from the intermediate visualization
                foreach (GameObject g in EngineManagerViewModel.instance.SelectedGameObjects)
                {
                    source_parent.IntermediateSource.Remove(g);
                }
                source_parent.IntermediateSource.Remove(source.myGameObject);
            }

            DestroyDragDropWindow();

            e.Handled = true;
        }
Beispiel #31
0
        private void DropItem(DropType item, Vector2 loc, int amount)
        {
            switch (item)
            {
            case DropType.BlueRupee:
                LoZGame.Instance.GameObjects.Items.Add(new DroppedRupee(loc));
                break;

            case DropType.YellowRupee:
                LoZGame.Instance.GameObjects.Items.Add(new DroppedYellowRupee(loc));
                break;

            case DropType.Bomb:
                LoZGame.Instance.GameObjects.Items.Add(new DroppedBomb(loc));
                break;

            case DropType.RedPotion:
                LoZGame.Instance.GameObjects.Items.Add(new DroppedBluePotion(loc));
                break;

            case DropType.BluePotion:
                LoZGame.Instance.GameObjects.Items.Add(new DroppedRedPotion(loc));
                break;

            case DropType.Health:
                LoZGame.Instance.GameObjects.Items.Add(new DroppedHealth(loc));
                break;

            case DropType.Fairy:
                LoZGame.Instance.GameObjects.Items.Add(new Fairy(loc));
                break;

            case DropType.Clock:
                LoZGame.Instance.GameObjects.Items.Add(new Clock(loc));
                break;

            case DropType.MagicShield:
                if (LoZGame.Instance.Players[0].AcquiredMagicShield && !LoZGame.Instance.Players[0].Inventory.HasMagicShield)
                {
                    LoZGame.Instance.GameObjects.Items.Add(new MagicShield(loc));
                }
                break;

            default:
                break;
            }
        }
Beispiel #32
0
    public Drop(DropType type)
    {
        switch (type)
        {
        case DropType.gun:
            this.dropName  = "a gun";
            this.dropPrice = 100;
            break;

        case DropType.food:
            string[] names = { "some lettuce", "a steak", "some bacon", "some tomatoes", "some rat meat" };
            this.dropName  = names[Random.Range(0, 5)];
            this.dropPrice = 20;
            break;

        case DropType.water:
            this.dropName  = "some water";
            this.dropPrice = 40;
            break;

        case DropType.rifle:
            this.dropName  = "a rifle";
            this.dropPrice = 100;
            break;

        case DropType.gbullets:
            this.dropName  = "some gun bullets";
            this.dropPrice = 1;
            break;

        case DropType.rbullets:
            this.dropName  = "some rifle bullets";
            this.dropPrice = 2;
            break;

        case DropType.medicine:
            this.dropName  = "some medicine";
            this.dropPrice = 50;
            break;

        case DropType.radaway:
            this.dropName  = "some radaway";
            this.dropPrice = 30;
            break;
        }
    }
Beispiel #33
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="type"></param>
        /// <returns></returns>
        /// <exception cref="ApplicationException"></exception>
        public int[] GetDropArray(DropType type)
        {
            switch (type)
            {
            case DropType.SAPOW:
                return(SaPow);

            case DropType.SATEC:
                return(SaTec);

            case DropType.BCDPOW:
                return(BcdPow);

            default:
                throw new ApplicationException("Attempting unexisting drop type");
            }
        }
Beispiel #34
0
            private bool MakeDrop(DropType t, Item i, int value)
            {
                switch (t)
                {
                case DropType.Random:
                    return(Main.rand.Next(2) == 0);

                case DropType.Value:
                    return(i.value >= value);

                case DropType.Both:
                    return(Main.rand.Next(2) == 0 && i.value >= value);

                default:
                    break;
                }
                return(false);
            }
Beispiel #35
0
 static void DetermineDrop()
 {
     percentResult = Random.Range(1, 101);
     if (percentResult < chanceToDropHealth)
     {
         toSpawn = DropType.HEALTH;
     }
     else if (percentResult >= chanceToDropHealth && percentResult < chanceToDropHealth + chanceToDropDefense)
     {
         toSpawn = DropType.DEFENSE;
     }
     else if (percentResult >= chanceToDropHealth + chanceToDropDefense && percentResult < chanceToDropHealth + chanceToDropDefense + chanceToDropAttack)
     {
         toSpawn = DropType.ATTACK;
     }
     else if (percentResult >= chanceToDropHealth + chanceToDropDefense + chanceToDropAttack && percentResult < chanceToDropHealth + chanceToDropDefense + chanceToDropAttack + chanceToDropStamina)
     {
         toSpawn = DropType.STAMINA;
     }
 }
Beispiel #36
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["USER"] == null)
            {
                Response.Redirect("~/Login.aspx");
            }
            else
            {
                id = Convert.ToInt32(Request.QueryString["BLOGID"]);
                if (Page.IsPostBack == false)
                {
                    var blg = db.TBLBLOCG.Find(id);
                    txtbasliq.Text             = blg.BLOGBASLIQ;
                    txtContent.Text            = blg.BLOGCONTENT;
                    txtTarix.Text              = blg.BLOGTAARIX.ToString();
                    txtMedia.Text              = blg.BLOGMEDIA;
                    DropType.SelectedValue     = blg.BLOGTYPE.ToString();
                    DropCategory.SelectedValue = blg.BLOGCATEGORY.ToString();

                    var typ = (from x in db.TBLTYPE
                               select new
                    {
                        x.TYPENAME,
                        x.TYPEID
                    }).ToList();

                    DropType.DataSource = typ;
                    DropType.DataBind();
                    var cat = (from x in db.TBLCATEGORY
                               select new
                    {
                        x.CATNAME,
                        x.CATID
                    }).ToList();
                    DropCategory.DataSource = cat;
                    DropCategory.DataBind();
                }
            }
        }
Beispiel #37
0
            public static void Initialize()
            {
                var ini = new Ini()
                {
                    path    = InvPlayer.path,
                    setting = InvPlayer.setting
                };

                string[] data = ini.ReadFile();
                string   vf = string.Empty, str = string.Empty;
                int      k  = 10000;
                DropType dt = DropType.Random;

                if (data.Length == 2)
                {
                    Ini.TryParse(data[0], out str);
                    Ini.TryParse(data[1], out vf);
                    Enum.TryParse(str, out dt);
                    int.TryParse(vf, out k);
                }
                dropType = dt;
                value    = k == 0 ? 10000 : k;
            }
Beispiel #38
0
        public override void DragOver(IDropInfo dropInfo)
        {
            if (CanAcceptData(dropInfo))
            {
                dropInfo.Effects = DragDropEffects.Copy;
                dropInfo.DropTargetAdorner = DropTargetAdorners.Insert;
                current_drop = DropType.Default;
            }
            else
            {
                var category_target = dropInfo.TargetItem as Category;
                if (category_target != null)
                {
                    var source_type = TypeUtilities.GetCommonBaseClass(ExtractData(dropInfo.Data));
                    if (source_type == typeof(Pattern))
                    {
                        dropInfo.Effects = DragDropEffects.Copy;
                        dropInfo.DropTargetAdorner = DropTargetAdorners.Highlight;
                        current_drop = DropType.PatternToCategory;
                        return;
                    }
                }

                var group_target = dropInfo.TargetItem as Group;
                if (group_target != null)
                {
                    var source_type = TypeUtilities.GetCommonBaseClass(ExtractData(dropInfo.Data));
                    if (source_type == typeof(Category))
                    {
                        dropInfo.Effects = DragDropEffects.Copy;
                        dropInfo.DropTargetAdorner = DropTargetAdorners.Highlight;
                        current_drop = DropType.CategoryToGroup;
                        return;
                    }
                }
            }
        }
 public void Remove()
 {
     _dropType = 0;
     _parentAdorner?.Remove();
     Visibility = Visibility.Collapsed;
 }
        public IEnumerable<DropWater> ListDropWater(DropType dropType, int start, int end, DateTime? date = null)
        {
            string dateCondition = date.HasValue ? string.Format(@" AND CONVERT(char(10),{0},120)=CONVERT(char(10),@{0},120)", DropWater.CREATETIME) : string.Empty;

            string sql = string.Format(@";WITH CTE AS(select  dw.*,dic.CompanyId from {0} dw
            left join {1} dic on dic.{2}=dw.{3}
            where dw.{4}=@{4} {9})
            SELECT * FROM
            (
             SELECT ROW_NUMBER() OVER(ORDER BY CompanyType,GamePlayWayId, {6},Amount ) AS RowNumber,*
             FROM CTE
            ) T
            WHERE RowNumber BETWEEN {7} AND {8}", DropWater.TABLENAME, DropInCompany.TABLENAME, DropInCompany.DROPID, DropWater.DROPID,
                           DropWater.DROPTYPE, DropWater.CREATETIME, DropWater.NUM, start, end, dateCondition);

            var paramArr = new SqlParameter[date.HasValue ? 2 : 1];
            paramArr[0] = new SqlParameter(DropWater.DROPTYPE, (int)dropType);
            if (date.HasValue)
                paramArr[1] = new SqlParameter(DropWater.CREATETIME, date);

            return base.ExecuteList<DropWater>(sql, paramArr);
        }
Beispiel #41
0
 /*
 ============================================================================
 Drag and drop functions
 ============================================================================
 */
 public void SetDrop(DropType t, DragOrigin d, int id, int charID)
 {
     this.dropType = t;
     this.dragDestination = d;
     this.dropID = id;
     this.characterID = charID;
     this.droptarget = true;
 }
Beispiel #42
0
 public void SetDropType_Start( DropType type )
 {
     Start();
     dropType = type;
     dropType_GOorRIorRA = type;
     SpriteRenderer.sprite = sprites[(int)type];
 }
Beispiel #43
0
 /////////////////////////////////////////////////////////////////
 public void SetDropType( DropType type )
 {
     dropType = type;
     SpriteRenderer.sprite = sprites[(int)type];
 }
Beispiel #44
0
    // Use this for initialization
    void Start()
    {
        DropManager = GameObject.Find( "DropManager" ).GetComponent<DropManager>();

        Rigidbody2D = this.GetComponent<Rigidbody2D>();

        LinkLightEffect = transform.FindChild( "LinkLightEffect" ).gameObject.GetComponent<ParticleSystem>();
        LinkLightEffect.Stop();

        SpriteRenderer = this.gameObject.GetComponent<SpriteRenderer>();

        dropType = RandDropType();

        SpriteRenderer.sprite = sprites[(int)dropType];

        time_IsTouched = Time.time;
    }
Beispiel #45
0
 public void Drop(object data, DropType dropType)
 {
     GameObjects.Add((GameObject)data);
 }
 private IList<SqlParameter> BuildCondition(DropType dropType, DateTime? date, string num, int companyId,
    int gameplaywayId, double dropvalue, decimal amount, out string condit)
 {
     List<SqlParameter> parameterList = new List<SqlParameter>();
     StringBuilder condition = new StringBuilder();
     Action<string, object> appendToCondtion = (it, arg) =>
     {
         if (condition.Length > 0)
             condition.Append(" AND ");
         condition.AppendFormat("{0}=@{0}", it);
         parameterList.Add(new SqlParameter(it, arg));
     };
     if (!string.IsNullOrEmpty(num))
     {
         if (num.IsNum())
             appendToCondtion(DropWater.NUM, num);
         else if (new Regex(@"^-+\d+$").IsMatch(num))
         {
             if (condition.Length > 0)
                 condition.Append(" AND ");
             int numIndex = num.LastIndexOf("-") + 1;
             string n = num.Substring(numIndex);
             string placeHolder = string.Empty;
             for (int i = 0; i < num.Length - n.Length; i++)
                 placeHolder += "_";
             condition.AppendFormat("{0} like @{0}", DropWater.NUM);
             parameterList.Add(new SqlParameter(DropWater.NUM, placeHolder + n));
         }
     }
     if (date.HasValue)
     {
         if (condition.Length > 0)
             condition.Append(" AND ");
         condition.AppendFormat("CONVERT(char(10),{0},120)=CONVERT(char(10),@{0},120)", DropWater.CREATETIME);
         parameterList.Add(new SqlParameter(DropWater.CREATETIME, date));
     }
     if (companyId > 0)
         appendToCondtion(DropInCompany.COMPANYID, companyId);
     if (gameplaywayId > 0)
         appendToCondtion(DropWater.GAMEPLAYWAYID, gameplaywayId);
     if (dropvalue > 0)
         appendToCondtion(DropWater.DROPVALUE, dropvalue);
     if (amount > 0)
         appendToCondtion(DropWater.AMOUNT, amount);
     appendToCondtion(DropWater.DROPTYPE, (int)dropType);
     condit = condition.ToString();
     return parameterList;
 }
 public DropWater GetDropWater(int gameplaywayId, decimal amount, DropType dropType, CompanyType companyType)
 {
     string sql = string.Format(@"SELECT * FROM {0} WHERE {1}=@{1} AND {2}=@{2} AND {3}=@{3} AND {4}=@{4}", DropWater.TABLENAME, DropWater.GAMEPLAYWAYID,
         DropWater.AMOUNT, DropWater.DROPTYPE, DropWater.COMPANYTYPE);
     return base.ExecuteModel<DropWater>(sql, new SqlParameter(DropWater.GAMEPLAYWAYID, gameplaywayId),
         new SqlParameter(DropWater.AMOUNT, amount),
         new SqlParameter(DropWater.DROPTYPE, (int)dropType),
         new SqlParameter(DropWater.COMPANYTYPE, (int)companyType));
 }
Beispiel #48
0
        public void Drop(object sender, DragEventArgs e, DropType type)
        {
            //var source = WPFHelper.FindParent<HierarchyControl>(e.Data.GetData() as TextBlock);
            var source = e.Data.GetData("control") as HierarchyControl;
            var target = WPFHelper.FindParent<HierarchyControl>(sender as DependencyObject);
            var source_parent = WPFHelper.FindParent<HierarchyControl>(source);

            source.Effect = null;
            source.RenderTransform = null;

            //make sure we aren't double dropping
            if (source != target)
            {
                //drop into the target hierarchy control as child
                switch (type)
                {
                    case DropType.NORMAL:
                        foreach (GameObject g in EngineManagerViewModel.instance.SelectedGameObjects)
                        {
                            if (g != source.GetDataContext())
                                target.Virtual_AddChild(g);
                        }
                        target.Virtual_AddChild(source);
                        break;
                    case DropType.SEPARATOR:
                        target.Virtual_DetachChild(source);
                        break;
                    case DropType.FOLDER:
                        target.Virtual_DetachChild(source);
                        break;
                }

                //remove it from the intermediate visualization
                foreach (GameObject g in EngineManagerViewModel.instance.SelectedGameObjects)
                    source_parent.IntermediateSource.Remove(g);
                source_parent.IntermediateSource.Remove(source.myGameObject);
            }

            DestroyDragDropWindow();

            e.Handled = true;
        }
 public void Delete(string num, int gameplaywayId, double dropValue, decimal amount, CompanyType? companyType, DropType dropType, DateTime? date)
 {
     StringBuilder condition = new StringBuilder();
     List<SqlParameter> paramList = new List<SqlParameter>();
     #region 获取号码条件
     if (num.IsNum())
     {
         condition.AppendFormat("{0}=@{0}", DropWater.NUM);
         paramList.Add(new SqlParameter(DropWater.NUM, num));
     }
     else if (num.IsNumArray())
     {
         var nums = num.Split(new[] { "," }, StringSplitOptions.RemoveEmptyEntries);
         condition.AppendFormat("('|'+@{0}+'|' like '%|'+{0}+'|%')", DropWater.NUM);
         paramList.Add(new SqlParameter(DropWater.NUM, string.Join("|", nums)));
     }
     else if (num.IsRangeNum())
     {
         var nums = num.Split(new[] { "-" }, StringSplitOptions.RemoveEmptyEntries);
         condition.AppendFormat("{0} between @{1} and @{2} and len({0})={3}", DropWater.NUM, "FromNum", "ToNum", nums[0].Length);
         paramList.Add(new SqlParameter("FromNum", nums[0]));
         paramList.Add(new SqlParameter("ToNum", nums[1]));
     }
     else if (num.IsBatterNum())
     {
         var numIndex = num.LastIndexOf("-");
         var lastNum = num.Substring(numIndex + 1);
         var preNumLen = num.Length - lastNum.Length;
         string fromNum = lastNum, toNum = lastNum;
         for (int i = 0; i < preNumLen; i++)
         {
             fromNum = "0" + fromNum;
             toNum = "9" + toNum;
         }
         condition.AppendFormat("{0} between @{1} and @{2} and len({0})={3}", DropWater.NUM, "FromNum", "ToNum", fromNum.Length);
         paramList.Add(new SqlParameter("FromNum", fromNum));
         paramList.Add(new SqlParameter("ToNum", toNum));
     }
     #endregion
     Action<string, object> appendToCondition = (key, value) =>
     {
         if (condition.Length > 0)
             condition.Append(" AND ");
         condition.AppendFormat("{0}=@{0}", key);
         paramList.Add(new SqlParameter(key, value));
     };
     if (gameplaywayId != 0)
         appendToCondition(DropWater.GAMEPLAYWAYID, gameplaywayId);
     if (dropValue > 0)
         appendToCondition(DropWater.DROPVALUE, dropValue);
     if (amount > 0)
         appendToCondition(DropWater.AMOUNT, amount);
     if (companyType.HasValue)
         appendToCondition(DropWater.COMPANYTYPE, (int)companyType.Value);
     appendToCondition(DropWater.DROPTYPE, (int)dropType);
     if (date.HasValue)
     {
         if (condition.Length > 0) condition.Append(" AND ");
         condition.AppendFormat(@"CONVERT(char(10),{0},120)=CONVERT(char(10),@{0},120)", DropWater.CREATETIME);
         paramList.Add(new SqlParameter(DropWater.CREATETIME, date.Value));
     }
     string sql = string.Format(@"DELETE {0} WHERE {1}", DropWater.TABLENAME, condition.ToString());
     base.ExecuteNonQuery(sql, paramList.ToArray());
 }
Beispiel #50
0
 public void Initialize(DropType dropType)
 {
     this.DropType = dropType;
 }
Beispiel #51
0
 public DropRegion(DropType DropType, Rectangle Rectangle, IBlockView destination, object extraInfo)
     : this(DropType, Rectangle, destination, extraInfo, DataType.Invalid)
 {
 }
Beispiel #52
0
 protected override void Cleanup()
 {
     this.DropType = (DropType)(-1);
 }
        public IEnumerable<DropWater> ListDropWaterByCondition(DropType dropType, DateTime? date, string num, int companyId,
            int gameplaywayId, double dropvalue, decimal amount, int start, int end)
        {
            string condition;
            var parameterList = BuildCondition(dropType, date, num, companyId, gameplaywayId, dropvalue, amount, out condition);

            string sql = string.Format(@";WITH CTE AS(select  dw.*,dic.CompanyId from {0} dw
            left join {1} dic on dic.{2}=dw.{3}
            where {4})
            SELECT * FROM
            (
             SELECT ROW_NUMBER() OVER(ORDER BY {5} desc) AS RowNumber,*
             FROM CTE
            ) T
            WHERE RowNumber BETWEEN {6} AND {7}", DropWater.TABLENAME, DropInCompany.TABLENAME, DropInCompany.DROPID, DropWater.DROPID,
                           condition.ToString(), DropWater.NUM, start, end);
            return base.ExecuteList<DropWater>(sql, parameterList.ToArray());
        }
Beispiel #54
0
 public void InitDropType()
 {
     dropType = RandDropType();
     SpriteRenderer.sprite = sprites[(int)dropType];
 }
Beispiel #55
0
 public DropRegion(DropType DropType, Rectangle Rectangle, IBlockView destination)
     : this(DropType, Rectangle, destination, null)
 {
 }
Beispiel #56
0
 public Drop(DropType type)
 {
     _Type = type;
 }
 public DropEventArgs(object data, object target, DropType dropType)
 {
     Data = data;
     Target = target;
     DropType = dropType;
 }