Exemplo n.º 1
0
        public async Task OnGetAsync(int?id_item)
        {
            await LoadItemAsync(id_item); // if there is an item load it, else load the first time.

            List <int> temp = new List <int>()
            {
                1, 2, 3, 4, 5
            };                                                 //for the rating drop downlist

            ratingValues = from a in temp
                           select new SelectListItem
            {
                Text  = a.ToString(),
                Value = a.ToString()
            };

            /// if the user is logged in, grab any rating they may have had for this item.
            if (HttpContext.Session.GetString("id") != null)
            {
                // load user rating and set the ITEM_RATINGSelected.RATING
                if (id_item != null)
                {
                    int         ID_USER = Int32.Parse(HttpContext.Session.GetString("id"));
                    ITEM_RATING tempIR  = await _db.ITEM_RATING_DBSet.FindAsync(id_item, ID_USER);

                    if (tempIR != null)
                    {
                        ITEM_RATINGSelected = tempIR;
                    }
                }
            }

            // in case nothing is found have an instantiated collection.
            if (ITEM_RATINGSelected == null)
            {
                ITEM_RATINGSelected = new ITEM_RATING();
            }

            // the user name list.
            await LoadUsersAsync();
        }
Exemplo n.º 2
0
        public ItemInfoData(string _itemName, ITEM_RATING _itemRating, ITEM_TYPE _itemType, int _level, Sprite _image)
        {
            itemName   = _itemName;
            itemRating = _itemRating;
            itemType   = _itemType;
            level      = _level;
            image      = _image;

            switch (itemRating)
            {
            case ITEM_RATING.NOMAL:
                ratingName  = "일반";
                frameColorR = 79;
                frameColorG = 79;
                frameColorB = 79;
                frameColorA = 255;
                break;

            case ITEM_RATING.MAGIC:
                ratingName  = "매직";
                frameColorR = 68;
                frameColorG = 102;
                frameColorB = 28;
                frameColorA = 255;
                break;

            case ITEM_RATING.RARE:
                ratingName  = "레어";
                frameColorR = 74;
                frameColorG = 126;
                frameColorB = 194;
                frameColorA = 255;
                break;

            case ITEM_RATING.EPIC:
                ratingName  = "에픽";
                frameColorR = 76;
                frameColorG = 22;
                frameColorB = 117;
                frameColorA = 255;
                break;

            case ITEM_RATING.UNIQUE:
                ratingName  = "유니크";
                frameColorR = 184;
                frameColorG = 146;
                frameColorB = 38;
                frameColorA = 255;
                break;
            }

            switch (itemType)
            {
            case ITEM_TYPE.WEAPON:
                typeName = "무기";
                break;

            case ITEM_TYPE.ARMOR:
                typeName = "방어구";
                break;

            case ITEM_TYPE.ACCESSORIES:
                typeName = "악세서리";
                break;
            }
        }