public static void FillComboWithValidValues(System.Windows.Forms.ComboBox comboBoxCtrl, WiaCapability capability) { if (capability.Values.ListValues.ValuesCount <= 0 || capability.Values.ListValues.Values == null) { return; } MyItemData item = new MyItemData(); int value = 0; foreach (object i in capability.Values.ListValues.Values) { value = Convert.ToInt32(i); // If Bits per pixel property, then just add the received values. if (capability.PropertyId == WiaPropertyId.ItemDepth || capability.PropertyId == WiaPropertyId.ScannerItemXRes || capability.PropertyId == WiaPropertyId.ScannerItemYRes) { item.ItemData = value; item.ItemString = value.ToString(); comboBoxCtrl.Items.Add(item); } else { int ret = GetWiaListPropertyValueString(capability.PropertyId, value); if (ret == 1) { item.ItemData = value; item.ItemString = ListPropertyValueString; comboBoxCtrl.Items.Add(item); } } } }
public Item(MyItemData item, int itemCount = 1) { this.id = item.id; this.itemName = item.name; this.itemDescription = item.description; this.itemCount = itemCount; this.itemType = GetType(item.itemType); this.icon = Resources.Load("ItemIcon/" + id, typeof(Sprite)) as Sprite; this.salePrice = item.salePrice; this.purchasePrice = item.purchasePrice; }
public static int SelectItemFromCombo(System.Windows.Forms.ComboBox comboBoxCtrl, int value) { for (int i = 0; i < comboBoxCtrl.Items.Count; i++) { MyItemData item = (MyItemData)comboBoxCtrl.Items[i]; if (item.ItemData == value) { comboBoxCtrl.SelectedIndex = i; return(1); } } return(0); }
public void UpdateGirlInviteList() { HelpUtil.DelListInfo(Table.transform); mGirlCheckList.Clear(); WarshipConfig config = Globals.Instance.MDataTableManager.GetConfig <WarshipConfig>(); WarshipConfig.WarshipObject element = null; Dictionary <long, GirlData> dicWarShipData = Globals.Instance.MGameDataManager.MActorData.GetWarshipDataList(); List <GirlData> TempList = new List <GirlData> (); foreach (GirlData girlData in dicWarShipData.Values) { TempList.Add(girlData); } TempList.Sort(delegate(GirlData datax, GirlData datay) { if (datax.CardBase.CardRare != datay.CardBase.CardRare) { return(datax.CardBase.CardRare > datay.CardBase.CardRare ? -1 : 1); } else if (datax.CardBase.CardRank != datay.CardBase.CardRank) { return(datax.CardBase.CardRank > datay.CardBase.CardRank ? 1 : -1); } return(0); }); Artist_SkillConfig AConfig = Globals.Instance.MDataTableManager.GetConfig <Artist_SkillConfig>(); Artist_SkillConfig.SkillObject Aelement = null; int i = 0; SeleteNum = 0; ItemList.Clear(); SeleteID.Clear(); foreach (GirlData girlData in TempList) { if (girlData.CardBase.CardTypeId != 1230000001) { continue; } i++; GameObject item = GameObject.Instantiate(InviteGirlItem) as GameObject; UIToggle checkbox = item.transform.GetComponent <UIToggle>(); //UIButton NextBtn = item.transform.FindChild("Tween").FindChild("GameObject").FindChild("CheckBtn").GetComponent<UIButton>(); item.name = "GirlInviteSlotItem" + i.ToString(); item.transform.parent = Table.transform; item.transform.localPosition = new Vector3(i, i, -5.0f); item.transform.localScale = Vector3.one; //NextBtn.Data = girlData.roleCardId; UILabel NameLabel = item.transform.Find("AllLabel").Find("NameLabel").GetComponent <UILabel>(); NameLabel.text = girlData.CardBase.CardName; Transform Picture = item.transform.Find("Picture"); //各种参数赋值// UILabel ARTLabel = Picture.Find("ARTSprite").Find("ARTLabel").GetComponent <UILabel>(); ARTLabel.text = girlData.CardBase.cardArtValue.ToString(); UILabel LVLabel = Picture.Find("LVSprite").Find("LVLabel").GetComponent <UILabel>(); LVLabel.text = girlData.CardBase.CardRank.ToString() + "/99"; UILabel REPLabel = Picture.Find("REPSprite").Find("REPLabel").GetComponent <UILabel>(); REPLabel.text = girlData.CardBase.cardArtProfile.ToString(); //HangyeDengjiA UISprite GradeSprite = Picture.Find("GradeSprite").GetComponent <UISprite>(); string name = ""; if (1 == girlData.CardBase.CardRare) { name = "HangyeDengjiS"; } else { name = "HangyeDengji" + ((char)('A' + girlData.CardBase.CardRare - 2)).ToString(); } GradeSprite.spriteName = name; config.GetWarshipElement(girlData.CardBase.CardId, out element); UITexture HeadTexture = Picture.Find("HeadTexture").GetComponent <UITexture>(); // HeadTexture.mainTexture = Resources.Load("Icon/ArtistIcon/" + element.Head_Icon,typeof(Texture2D)) as Texture2D; for (int j = 0; j < girlData.skillLis.Count; ++j) { UITexture Skill = Picture.Find("SkillTexture" + j.ToString()).GetComponent <UITexture>(); AConfig.GetSkillObject(girlData.skillLis[j], out Aelement); string texturePath = "Icon/SkillIcon/" + Aelement.Skill_Icon; Skill.mainTexture = Resources.Load(texturePath, typeof(Texture2D)) as Texture2D; NGUITools.SetActive(Skill.gameObject, true); } //UIEventListener.Get(NextBtn.gameObject).onClick = OnItemPhoneClick; UIToggle SeleteBtn = item.transform.Find("SeleteBtn").GetComponent <UIToggle>(); SeleteBtn.Data = girlData; UIEventListener.Get(SeleteBtn.gameObject).onClick = delegate(GameObject Obj) { UIToggle SeleteBtnIn = item.transform.Find("SeleteBtn").GetComponent <UIToggle>(); GirlData IngirlData = (GirlData)SeleteBtnIn.Data; if (SeleteBtnIn.value) { if (SeleteNum < MaxSeleteNum) { mTotalART += IngirlData.CardBase.cardArtValue; mTotalREP += IngirlData.CardBase.cardArtProfile; SeleteNum++; SeleteID.Add(IngirlData.roleCardId); } if (SeleteNum == MaxSeleteNum) { IsDisplayUnSelete(false); } } else { if (SeleteNum == MaxSeleteNum) { IsDisplayUnSelete(true); } mTotalART -= IngirlData.CardBase.cardArtValue; mTotalREP -= IngirlData.CardBase.cardArtProfile; SeleteNum--; SeleteID.Remove(IngirlData.roleCardId); } }; MyItemData TempData = new MyItemData(); TempData.SeleteBtn = SeleteBtn; TempData.UnDoTextureObj = Picture.Find("UnDoTexture").gameObject; TempData.UnDoLabel = TempData.UnDoTextureObj.transform.Find("UnDoLabel").GetComponent <UILabel>(); TempData.ArtistID = girlData.roleCardId; TempData.ArtistData = girlData; TempData.ItemObj = item; for (int j = 0; j < 3; ++j) { TempData.SequenceObj[j] = Picture.Find("SkillTexture" + j.ToString()).Find("Sprite").gameObject; } ItemList.Add(TempData); } NGUITools.SetActive(NoAtristsFrame, i == 0); Table.repositionNow = true; ScrollView.ResetPosition(); }