public void AddCollection(Collection col, RackOutfitGender gender, RackType type)
        {
            foreach (var item in col)
            {
                var purchasable = Content.AvatarPurchasables.Get(item.PurchasableOutfitId);
                if (purchasable == null)
                {
                    continue;
                }
                var outfit = new RackOutfit()
                {
                    AssetID  = purchasable.OutfitID,
                    Gender   = gender,
                    RackType = type,
                    Price    = 1000
                };

                if (!Racks.ContainsKey(outfit.RackType))
                {
                    Racks.Add(outfit.RackType, new RackOutfits()
                    {
                        Outfits  = new List <RackOutfit>(),
                        RackType = outfit.RackType
                    });
                }

                Racks[outfit.RackType].Outfits.Add(outfit);
            }
        }
        protected VMPersonSuits GetSuitType(RackType type)
        {
            switch (type)
            {
            case RackType.Formalwear:
            case RackType.Daywear:
            case RackType.CAS:
                return(VMPersonSuits.DefaultDaywear);

            case RackType.Sleepwear:
                return(VMPersonSuits.DefaultSleepwear);

            case RackType.Swimwear:
                return(VMPersonSuits.DefaultSwimwear);

            case RackType.Decor_Head:
                return(VMPersonSuits.DecorationHead);

            case RackType.Decor_Back:
                return(VMPersonSuits.DecorationBack);

            case RackType.Decor_Shoe:
                return(VMPersonSuits.DecorationShoes);

            case RackType.Decor_Tail:
                return(VMPersonSuits.DecorationTail);

            default:
                throw new Exception("Illegal state");
            }
        }
        public void Identify_RackType()
        {
            // 5x4 rack test
            Color  rack_color = Color.FromArgb(82, 85, 102);
            Color  l_color;
            Color  r_color;
            Bitmap frame = GetGameFrame_Global();

            l_color = frame.GetPixel(CONST_RACK_TYPE_IDENTIFIERS[RackType.Rack_5x4][0].X, CONST_RACK_TYPE_IDENTIFIERS[RackType.Rack_5x4][0].Y);
            r_color = frame.GetPixel(CONST_RACK_TYPE_IDENTIFIERS[RackType.Rack_5x4][1].X, CONST_RACK_TYPE_IDENTIFIERS[RackType.Rack_5x4][1].Y);
            if (l_color == rack_color && r_color == rack_color)
            {
                Game_RackType = RackType.Rack_5x4; return;
            }
            // 4x4 rack test
            l_color = frame.GetPixel(CONST_RACK_TYPE_IDENTIFIERS[RackType.Rack_4x4][0].X, CONST_RACK_TYPE_IDENTIFIERS[RackType.Rack_4x4][0].Y);
            r_color = frame.GetPixel(CONST_RACK_TYPE_IDENTIFIERS[RackType.Rack_4x4][1].X, CONST_RACK_TYPE_IDENTIFIERS[RackType.Rack_4x4][1].Y);
            if (l_color == rack_color && r_color == rack_color)
            {
                Game_RackType = RackType.Rack_4x4; return;
            }
            // 3x4 rack test
            l_color = frame.GetPixel(CONST_RACK_TYPE_IDENTIFIERS[RackType.Rack_3x4][0].X, CONST_RACK_TYPE_IDENTIFIERS[RackType.Rack_3x4][0].Y);
            r_color = frame.GetPixel(CONST_RACK_TYPE_IDENTIFIERS[RackType.Rack_3x4][1].X, CONST_RACK_TYPE_IDENTIFIERS[RackType.Rack_3x4][1].Y);
            if (l_color == rack_color && r_color == rack_color)
            {
                Game_RackType = RackType.Rack_3x4; return;
            }
            // unknown rack
            Game_RackType = RackType.Unknown;
        }
Esempio n. 4
0
        public async Task <Rack> CreateRackAsync(string rackID, RackType type)
        {
            // TODO:is it right here where validation is that check existing rack ???

            var rack = await db.Racks.FindAsync(rackID);

            if (rack != null)
            {
                return(null);
            }

            rack          = new Rack();
            rack.RackID   = rackID;
            rack.RackType = type;
            db.Racks.Add(rack);

            var affected = await db.SaveChangesAsync();

            if (affected != 0)
            {
                return(rack);
            }

            return(null);
        }
        private void EditRackType(int RackTypeId)
        {
            this.RackType = this.srvRackType.GetById(RackTypeId);

            this.ClearDetailControls();
            this.LoadFormFromEntity();
            this.frmRackType.HiddenDetail(false);
            this.ShowDetail(true);
        }
Esempio n. 6
0
        public override RackType GetSearchResult()
        {
            RackType     RackType  = null;
            UltraGridRow activeRow = this.grdSchSearch.ActiveRow;

            if (activeRow != null)
            {
                int RackTypeId = Convert.ToInt32(activeRow.Cells[0].Value);
                RackType = this.srvRackType.GetById(RackTypeId);
            }

            return(RackType);
        }
 private void DeleteEntity(int RackTypeId)
 {
     if (MessageBox.Show("¿Esta seguro de eliminar el Tipo de Rack?", "Advertencia",
                         MessageBoxButtons.OKCancel, MessageBoxIcon.Question) != DialogResult.OK)
     {
         return;
     }
     this.RackType           = this.srvRackType.GetById(RackTypeId);
     this.RackType.Activated = false;
     this.RackType.Deleted   = true;
     this.srvRackType.SaveOrUpdate(this.RackType);
     this.Search();
 }
Esempio n. 8
0
        public override void OnConnection(VMEODClient client)
        {
            Client = client;
            var param = client.Invoker.Thread.TempRegisters;

            if (client.Avatar != null)
            {
                var rackType = param[0];
                if (!Lobby.Join(client, 0))
                {
                    return;
                }
                RackType = (RackType)rackType;
                client.Send("rack_show", ((short)RackType).ToString());
                BroadcastOutfits(client.vm, false);
            }
        }
Esempio n. 9
0
        /**
         * Owner outfit grid
         */
        protected override void SetRackType(RackType type)
        {
            base.SetRackType(type);
            switch (RackType)
            {
            case RackType.Decor_Back:
            case RackType.Decor_Head:
            case RackType.Decor_Shoe:
            case RackType.Decor_Tail:
                SelectedGender = RackOutfitGender.Neutral;
                break;

            default:
                SelectedGender = RackOutfitGender.Male;
                break;
            }
            SetOwnerOutfits();
        }
        public async Task TestCreateRackAsync()
        {
            var newRackType = new RackType()
            {
                Name     = "TestRackType",
                Capacity = 10
            };

            context.RackType.Add(newRackType);
            context.SaveChanges();
            var createdRack = await repository.CreateRackAsync(rackID : "TestRack", type : newRackType);

            Assert.NotNull(createdRack);
            Assert.True(createdRack.RackID == "TestRack");
            Assert.True(createdRack.RackTypeName == newRackType.Name);
            Assert.Null(createdRack.Boxes);

            // create id duplicate rack.
            createdRack = await repository.CreateRackAsync(rackID : "TestRack", type : newRackType);

            Assert.Null(createdRack);
        }
        public override void OnConnection(VMEODClient client)
        {
            Client = client;
            var param = client.Invoker.Thread.TempRegisters;

            if (client.Avatar != null)
            {
                var rackType = param[0];
                if (!Lobby.Join(client, 0))
                {
                    return;
                }
                RackType = (RackType)rackType;
                client.Send("rack_show", ((short)RackType).ToString());
                if (((VMTSOObjectState)Server.Object.TSOState).OwnerID == client.Avatar.PersistID)
                {
                    BroadcastOutfits(client.vm, true);
                }
                else
                {
                    BroadcastOutfits(client.vm, false);
                }
            }
        }
Esempio n. 12
0
 protected virtual void SetRackType(RackType type)
 {
     RackType = type;
 }
Esempio n. 13
0
 public RackOutfits GetByRackType(RackType rackType)
 {
     return(Racks[rackType]);
 }
 private void btnSchCreate_Click(object sender, EventArgs e)
 {
     this.RackType = new RackType();
     this.ClearDetailControls();
     this.ShowDetail(true);
 }
        public async Task TestInputBoxInRackAsync()
        {
            var newRackType = new RackType()
            {
                Name     = "TestRackType",
                Capacity = 10
            };
            var newBoxType = new BoxType()
            {
                Name = "TestBoxType", Capacity = 12
            };
            var createdRack = await repository.CreateRackAsync(rackID : "TestRack", type : newRackType);

            var createdBox = await repository.CreateBoxAsync(boxID : "TestBox", type : newBoxType);

            var inputedBox = await repository.InputBoxInRackAsync(box : createdBox, toRack : createdRack, slot : 1);

            Assert.NotNull(inputedBox);
            Assert.True(inputedBox.IsOut == false);
            Assert.True(inputedBox.RackID == createdRack.RackID);
            Assert.True(inputedBox.Slot == 1);

            // with not Existing Rack.
            try
            {
                var notExistedRack = new Rack()
                {
                    RackID = "noExistedRack"
                };
                inputedBox = await repository.InputBoxInRackAsync(box : createdBox, toRack : notExistedRack, slot : 1);
            }
            catch (Exception e)
            {
                Assert.True(e is NotFoundRackException);
            }

            // with box in tank.
            try
            {
                // Already Box is Existed in other rack.
                inputedBox = await repository.InputBoxInRackAsync(box : createdBox, toRack : createdRack, slot : 1);
            }
            catch (Exception e)
            {
                Assert.True(e is NotMoveBoxException);
            }

            // with not existing box
            try
            {
                var notExistedBox = new Box()
                {
                    BoxID = "noExistedBox"
                };
                inputedBox = await repository.InputBoxInRackAsync(box : notExistedBox, toRack : createdRack, slot : 1);
            }
            catch (Exception e)
            {
                Assert.True(e is NotFoundBoxException);
            }

            // this slot is occupied!
            try
            {
                var newBox = await repository.CreateBoxAsync(boxID : "ExistedBox001", type : newBoxType);

                inputedBox = await repository.InputBoxInRackAsync(box : newBox, toRack : createdRack, slot : 1);
            }
            catch (Exception e)
            {
                Assert.True(e is AlreadyOccupiedInSlotException);
            }
        }