public void OnSelectTitle(TitleListItem titleItem) { GameWebAPI.RespDataMA_TitleMaster.TitleM titleM = TitleDataMng.GetDictionaryTitleM()[titleItem.GetTitleId()]; this.titleName.text = titleM.name; this.titleDetail.text = titleM.detail; TitleDataMng.SetTitleIcon(titleM.titleId, this.titleIcon); if (titleItem.GetEquiped() || !titleItem.GetOwned()) { this.equipBtn.GetComponent <UISprite>().spriteName = "Common02_Btn_Gray"; this.equipBtnLbl.color = ConstValue.DEACTIVE_BUTTON_LABEL; this.equipBtn.GetComponent <BoxCollider>().enabled = false; } else { this.equipBtn.GetComponent <UISprite>().spriteName = "Common02_Btn_Green"; this.equipBtnLbl.color = Color.white; this.equipBtn.GetComponent <BoxCollider>().enabled = true; } if (titleItem.GetEquiped()) { this.titleNameLbl.text = StringMaster.GetString("CurrentUserTitle"); } else { this.titleNameLbl.text = StringMaster.GetString("SelectedUserTitle"); } this.currentSelectedTitleId = titleItem.GetTitleId(); }
public void OnEquipTitle() { RestrictionInput.StartLoad(RestrictionInput.LoadType.LARGE_IMAGE_MASK_ON); TitleListItem[] titles = this.titleList.GetComponentsInChildren <TitleListItem>(true); TitleListItem currentEquipedTitle = titles.FirstOrDefault((TitleListItem _title) => _title.GetTitleId() == this.currentSelectedTitleId); APIRequestTask apirequestTask = new APIRequestTask(); apirequestTask.Add(TitleDataMng.RequestUpdateEquipedTitle(this.currentSelectedTitleId, false)); base.StartCoroutine(apirequestTask.Run(delegate { RestrictionInput.EndLoad(); TitleListItem[] titles; foreach (TitleListItem titleListItem in titles) { titleListItem.unequip(); } currentEquipedTitle.equip(); currentEquipedTitle.OnSelectTitle(); GUIPlayerStatus.RefreshParams_S(false); CMD_Profile.RefreshParams(); }, delegate(Exception nop) { RestrictionInput.EndLoad(); }, null)); }
public async Task <IActionResult> GetTitlesAsync(string searchString) { mongoDatabase = GetMongoDatabase(); //FilterDefinition<BsonDocument> filter = FilterDefinition<BsonDocument>.Empty; // https: //docs.mongodb.com/manual/reference/operator/query/#query-selectors FilterDefinition <BsonDocument> filter = "{ TitleName: { $text: " + "searchString" + " } }"; FindOptions <BsonDocument> options = new FindOptions <BsonDocument> { NoCursorTimeout = false }; MongoDB.Driver.IAsyncCursor <BsonDocument> result = await mongoDatabase.GetCollection <BsonDocument>("Titles").FindAsync <BsonDocument>(filter, options); List <BsonDocument> resultDocs = result.ToList <BsonDocument>(); //convert result to MediaItem MediaItem mItem = new MediaItem(); List <MediaItem> mItemList = new List <MediaItem>(); List <TitleListItem> mTitleList = new List <TitleListItem>(); foreach (BsonDocument d in resultDocs) { mItem = JsonConvert.DeserializeObject <MediaItem>(d.ToJson()); TitleListItem i = new TitleListItem(); i.id = mItem._id.ToString(); i.TitleName = mItem.TitleName; mTitleList.Add(i); } //return list of titles for view ViewBag["titlelist"] = mTitleList; return(View()); }