/// <summary> /// 获取需要的碎片及拥有数量。 /// </summary> private void GetFragment() { //获取升级需要的资源。 buildingM.GetUpStarNeed(m_Info.BuildType, m_Info.StarLevel + 1, ref m_NeedFragment, ref m_NeedCoin); m_HaveFragment = ItemDC.GetItemCount(m_Info.fragmentTypeID);//当前灵魂石 m_haveCoin = UserDC.GetCoin(); }
public void SetData(ItemTypeInfo info, BeiBaoWnd wnd) { m_parent = wnd; m_ItemInfo = info; m_itemcount = ItemDC.GetItemCount(m_ItemInfo.itemType); SetUI(); }
/// <summary> /// 陷阱能否升星. /// </summary> /// <returns>The can up star.</returns> /// <param name="Info">Info.</param> public static CanStarResult GetCanUpStar(BuildInfo Info) { if (Info.StarLevel == 5) { return(CanStarResult.StarMax); } int NeedCoin = 0; int HaveCoin = 0; int NeedFragmentNum = 0; GetUpStarNeed(Info.BuildType, Info.StarLevel + 1, ref NeedFragmentNum, ref NeedCoin); int HaveFragmentNum = ItemDC.GetItemCount(Info.fragmentTypeID); //当前灵魂石 HaveCoin = UserDC.GetCoin(); if (HaveCoin < NeedCoin) { return(CanStarResult.LessCoin); } if (HaveFragmentNum < NeedFragmentNum) { return(CanStarResult.LessMater); } return(CanStarResult.CanUp); }
void ClickDown(Vector3 pos) { sdata.s_itemtypeInfo Info = ItemM.GetItemInfo(m_iItemID); if (Info != null) { string Name = Info.name; int Level = Info.level; string Description = Info.title.Replace("\\n", System.Environment.NewLine); int Money = Info.money; int HaveCount = ItemDC.GetItemCount(m_iItemID); m_wnd = WndManager.GetDialog <StageTipWnd>(); if (Info.gtype == 0) { m_wnd.SetTipData(pos, StageClickType.Item, Info.icon, Info.quality, Name, Level, Description, HaveCount, Money, Info.gtype); } else if (Info.gtype == 1) { m_wnd.SetTipData(pos, StageClickType.Item, Info.gid, Info.quality, Name, Level, Description, HaveCount, Money, Info.gtype); } if (Info.gtype == 2) { m_wnd.SetTipData(pos, StageClickType.Item, Info.gid, Info.quality, Name, Level, Description, HaveCount, Money, Info.gtype); } if (Info.gtype == 3) { m_wnd.SetTipData(pos, StageClickType.Item, Info.gid, Info.quality, Name, Level, Description, HaveCount, Money, Info.gtype); } } }
/// <summary> /// 检测装备是否大等于某个数量 /// </summary> /// <returns></returns> public static bool CheckEquipEnough(int itemTypeID, int count, ref List <int> listUsedItem) { int totalCount = ItemDC.GetItemCount(itemTypeID); int countUsed = listUsedItem.Count; if (totalCount > 0) { int nCnt = 0; for (nCnt = 0; nCnt < countUsed; nCnt++) { if (listUsedItem[nCnt] == itemTypeID) { totalCount--; if (totalCount == 0) { break; } } } for (nCnt = 0; nCnt < count; nCnt++) { listUsedItem.Add(itemTypeID); } } return(totalCount >= count); }
/// <summary> /// 设置装备数量UI /// </summary> private void SetEquipCountUI() { int count = ItemDC.GetItemCount(m_iItemTypeID); string countText = string.Format("[FF7E14]" + NGUIUtil.GetStringByKey("88800040") + "[-][9C4314]{0}[-][FF7E14]" + NGUIUtil.GetStringByKey("88800037") + "[-]", count); NGUIUtil.SetActive(MyHead.LblFuMo.gameObject, true); NGUIUtil.SetLableText <string>(MyHead.LblFuMo, countText); }
/// <summary> /// 返回物品的数量 /// </summary> public static int GetItemCount(s_signinInfo info) { int result = 0; int id = info.item_type; SignInRewardType type = (SignInRewardType)info.reward_type; switch (type) { case SignInRewardType.BlackScience: CaptionInfo cInfo = new CaptionInfo(); GodSkillM.GetCaption(id, ref cInfo); if (cInfo.m_captionid > 0) { result = 1; } break; case SignInRewardType.HeroSoulFragment: case SignInRewardType.ItemAndEquip: case SignInRewardType.TrapFragment: case SignInRewardType.BlackScienceFragment: result = ItemDC.GetItemCount(id); break; case SignInRewardType.Hero: SoldierInfo info2 = SoldierM.GetSoldierInfo(id); if (info2 != null) { result = 1; } break; case SignInRewardType.Trap: BuildInfo info3 = buildingM.GetStartBuildInfo(id); if (info3 != null) { result = 1; } break; case SignInRewardType.GoldCoin: //下面内容策划待定 result = UserDC.GetCoin(); break; case SignInRewardType.Diamond: result = UserDC.GetDiamond(); break; case SignInRewardType.Crystal: result = UserDC.GetCrystal(); break; case SignInRewardType.Wood: result = UserDC.GetWood(); break; } return(result); }
void SetUI(ref List <int> listUsedItem) { s_itemtypeInfo info = ItemM.GetItemInfo(m_itemTypeID); if (info != null) { NGUIUtil.Set2DSprite(Spr2dEquipIcon, "Textures/item/", info.icon.ToString()); int quality = ConfigM.GetBigQuality(info.quality); NGUIUtil.SetSprite(SprEquipQuality, quality.ToString()); } else { NGUIUtil.DebugLog(" ItemM.GetItemInfo " + m_itemTypeID.ToString() + " not found!"); return; } //设置装备总数量和合成所需的数量 int totalCount = ItemDC.GetItemCount(m_itemTypeID); int countUsed = listUsedItem.Count; if (totalCount > 0) { int nCountTemp = totalCount; int nCnt = 0; for (nCnt = 0; nCnt < countUsed; nCnt++) { if (listUsedItem[nCnt] == m_itemTypeID) { nCountTemp--; if (nCountTemp == 0) { break; } } } for (nCnt = 0; nCnt < m_iNeedNum; nCnt++) { listUsedItem.Add(m_itemTypeID); } if (nCountTemp < m_iNeedNum) { totalCount = nCountTemp; } } string numText = ""; if (totalCount >= m_iNeedNum) { numText = string.Format("[FFFFFF]{0}/{1}[-]", totalCount, m_iNeedNum); } else { numText = string.Format("[FF0000]{0}/{1}[-]", totalCount, m_iNeedNum); } NGUIUtil.SetLableText <string>(LblNum, numText); }
private void SetUserData() { if (m_CurItem != null) { int bookcount = ItemDC.GetItemCount(m_CurItem.Godskill.m_needbook); MyHead.lblScroll.text = bookcount.ToString(); } else { MyHead.lblScroll.text = "0"; } }
private void SetUI() { NGUIUtil.Set2DSprite(MyHead.SprType, "Textures/item/", m_info.m_Icon.ToString()); if (MyHead.LblName) { MyHead.LblName.text = m_info.m_Name; } if (MyHead.LblCount) { int Count = ItemDC.GetItemCount(m_info.itemType); MyHead.LblCount.text = string.Format("[552d0a]" + NGUIUtil.GetStringByKey("88800040") + "[-][0000FF]{0}[-][552d0a]" + NGUIUtil.GetStringByKey("88800037") + "[-]", Count); } if (MyHead.LblDescription1) { MyHead.LblDescription1.text = m_info.m_title; } if (MyHead.LblDescription2) { if (m_info.m_message != "0") { MyHead.LblDescription2.text = m_info.m_message; } else { MyHead.LblDescription2.text = ""; } } if (MyHead.LblPrice) { MyHead.LblPrice.text = m_info.m_sellemoney.ToString(); } //http://jingyan.baidu.com/article/5552ef47d82a90518ffbc914.html if (MyHead.AnchorBg != null) { BeiBaoWnd wnd = WndManager.FindDialog <BeiBaoWnd>(); if (wnd != null) { Transform target = wnd.MyHead.AnchorTarget; if (target != null) { MyHead.AnchorBg.SetAnchor(target); MyHead.AnchorBg.leftAnchor.absolute = -390; MyHead.AnchorBg.rightAnchor.relative = 0; MyHead.AnchorBg.rightAnchor.absolute = 6; MyHead.AnchorBg.bottomAnchor.absolute = -7; MyHead.AnchorBg.topAnchor.absolute = 9; } } } }
public void UpStar() { if (MyHead.togUpStar.value) { MyHead.UpStar.SetActive(true); MyHead.UpLevel.SetActive(false); MyHead.BtnUpStar.gameObject.SetActive(true); MyHead.btnUp.gameObject.SetActive(false); MyHead.LblNextName.text = NGUIUtil.GetStringByKey(70000115); //MyHead.BtnUpStar.isEnabled = false; if (m_CurItem != null) { m_CurItem.ResetUI(); MyHead.LblStarName.text = "[71fff0]" + m_CurItem.Godskill.m_name + "[-]"; MyHead.lblName.text = ""; MyHead.lblExplain.text = string.Format("[552d0a]" + m_CurItem.Godskill.m_stardescription + "[-]"); int bookcount = ItemDC.GetItemCount(m_CurItem.Godskill.m_needbook); if (m_CurItem.Godskill.m_needbooknum == 0 && m_CurItem.m_caption.m_star == 5) { MyHead.lblScrollNum.text = NGUIUtil.GetStringByKey(10000085); MyHead.SprProgress.fillAmount = 1.0f; } else { MyHead.lblScrollNum.text = bookcount + "/" + m_CurItem.Godskill.m_needbooknum; MyHead.SprProgress.fillAmount = bookcount * 1.0f / m_CurItem.Godskill.m_needbooknum; } GodSkillInfo nextInfo = new GodSkillInfo(); GodSkillM.GetGodSkill(m_CurItem.Godskill.m_type, m_CurItem.Godskill.m_level, m_CurItem.m_caption.m_star + 1, ref nextInfo); if (m_CurItem.m_caption.m_star == 5) { MyHead.NextStarDes.text = string.Format("[552d0a]" + NGUIUtil.GetStringByKey(10000085) + "[-]"); } else if (nextInfo != null && nextInfo.m_stardescription != null) { MyHead.NextStarDes.text = string.Format("[552d0a]" + nextInfo.m_stardescription + "[-]"); } SetTrapStarLevel(m_CurItem.m_caption.m_star); m_CurItem.CheckUp(); // MyHead.BtnUpStar.isEnabled = m_CurItem.CheckStarTop(); UIGrid grid = MyHead.StarParent.GetComponent <UIGrid>(); grid.repositionNow = true; } } }
/// <summary> /// 陷阱能否升阶. /// </summary> /// <returns>The quality can U.</returns> /// <param name="info">Info.</param> public static CanQualityResult GetQualityCanUP(BuildInfo info) { int NextQuality = ConfigM.GetNextQuality(info.Quality); if (NextQuality == info.Quality) { return(CanQualityResult.QualityMax); } int LimitLev = 0; Dictionary <int, int> lNeedMaterial = new Dictionary <int, int>(); Dictionary <int, int> lhaveFragment = new Dictionary <int, int> (); buildingM.GetUpQualityNeed(info.BuildType, info.Quality, ref lNeedMaterial, ref LimitLev); if (info.Level < LimitLev) { return(CanQualityResult.LevelLimit); } if (lNeedMaterial.Count == 0 && info.Quality == NextQuality) { return(CanQualityResult.QualityMax); } foreach (int itemtype in lNeedMaterial.Keys) { if (lNeedMaterial[itemtype] == 0 && info.Quality == NextQuality) { return(CanQualityResult.QualityMax); } } //获取已有的资源。 List <int> litemType = new List <int>(); foreach (int itemtype in lNeedMaterial.Keys) { litemType.Add(itemtype); } ItemDC.GetItemCount(litemType, ref lhaveFragment); foreach (int itemtype in lNeedMaterial.Keys) { if (lhaveFragment[itemtype] < lNeedMaterial[itemtype]) { return(CanQualityResult.MaterialLimit); } } return(CanQualityResult.CanUp); }
public static bool CheckStarUp(CaptionInfo info) { GodSkillInfo Godskill = info.GetGodSkillInfo(); int bookcount = ItemDC.GetItemCount(Godskill.m_needbook); if (UserDC.GetLevel() >= info.m_levelneed && Godskill.m_needbooknum > 0 && bookcount >= Godskill.m_needbooknum) { return(true); } else { return(false); } }
/// <summary> /// 检测装备是否存在且符合穿的条件 /// </summary> /// <returns></returns> public bool CheckEquipExist() { m_wndType = 3; SetWndType(); s_itemtypeInfo info = ItemM.GetItemInfo(m_iItemTypeID); if (ItemDC.GetItemCount(m_iItemTypeID) > 0 && m_soldierInfo.Level >= info.level) { MyHead.BtnSure.isEnabled = true; return(true); } MyHead.BtnSure.isEnabled = false; return(false); }
public void SetInfo(int itemID) { m_stageClickType = StageClickType.Item; sdata.s_itemtypeInfo Info = ItemM.GetItemInfo(itemID); if (Info != null) { TipID = itemID; Name = Info.name; Level = Info.level; Description = Info.title; Money = Info.money; HaveCount = ItemDC.GetItemCount(itemID); Quality = Info.quality; } }
/// <summary> /// 获取需要的碎片及拥有数量。 /// </summary> private void GetFragment() { int LimitLev = 0; buildingM.GetUpQualityNeed(m_Info.BuildType, m_Info.Quality, ref m_lNeedMaterial, ref LimitLev); //获取已有的资源。 List <int> litemType = new List <int>(); foreach (int itemtype in m_lNeedMaterial.Keys) { litemType.Add(itemtype); } ItemDC.GetItemCount(litemType, ref m_lhaveFragment); }
public static void SortCanNotExitBuildList(ref List <BuildInfo> list) { list.Sort((obj1, obj2) => { int have1 = ItemDC.GetItemCount(obj1.fragmentTypeID); int have2 = ItemDC.GetItemCount(obj2.fragmentTypeID); int ret = have1.CompareTo(have2); if (ret != 0) { return(ret); } return(obj2.fragmentTypeID.CompareTo(obj1.fragmentTypeID)); } ); list.Reverse(); }
private void SetUI() { if (ItemType == 1) { NGUIUtil.SetActive(MyHead.LblLevelNum.gameObject, true); NGUIUtil.SetActive(MyHead.GroupNumPercentage, false); NGUIUtil.Set2DSprite(MyHead.sprHead, "Textures/role/", m_caption.m_captionid.ToString()); } else if (ItemType == 0) { NGUIUtil.SetActive(MyHead.LblLevelNum.gameObject, false); NGUIUtil.SetActive(MyHead.lblLevelneed.gameObject, false); NGUIUtil.SetActive(MyHead.GroupNumPercentage, true); NGUIUtil.Set2DSpriteGraySV(MyHead.sprHead, "Textures/role/", m_caption.m_captionid.ToString()); int itemtype = Godskill.m_needbook; m_iHave = ItemDC.GetItemCount(itemtype); m_iNeed = GodSkillM.GetCaptainNeedBookNum(m_caption.m_captionid); float fillAmount = m_iHave / (m_iNeed * 1.0f); NGUIUtil.SetSpriteFillAmount(MyHead.SprNumPercentage, fillAmount); SetSummonNum(m_iHave, m_iNeed); } gameObject.name = m_caption.m_captionid.ToString(); if (MyHead.lblName) { MyHead.lblName.text = m_caption.m_GodSkill[m_caption.m_godskilltype1].m_name; } MyHead.sprCanUse.gameObject.SetActive(false); if (UserDC.GetLevel() < m_caption.m_levelneed) { MyHead.lblLevelneed.text = string.Format(NGUIUtil.GetStringByKey("60000004"), m_caption.m_levelneed.ToString()); MyHead.toggle.activeSprite.enabled = false; MyHead.LblLevelNum.gameObject.SetActive(false); MyHead.SprStarparent.SetActive(false); SetStarLevel(0); } else { CheckUp(); SetStarLevel(m_caption.m_star); } MyHead.LblLevelNum.text = Godskill.m_level.ToString(); }
private void ShowLblItemCount() { if (m_wndType == 1) { int count = ItemDC.GetItemCount(m_itemInfo.id); string countText = string.Format("[FF7E14]" + NGUIUtil.GetStringByKey("88800040") + "[-][9C4314]{0}[-][FF7E14]" + NGUIUtil.GetStringByKey("88800037") + "[-]", count); MyHead.LblItemAmount.text = countText; } else if (m_wndType == 2 && m_soldierInfo != null) { int NeedNum = 0; int NeedCoin = 0; SoldierM.GetUpStarNeed(m_soldierInfo.SoldierTypeID, m_soldierInfo.StarLevel + 1, ref NeedNum, ref NeedCoin); int Have = m_soldierInfo.GetHaveFragmentNum(); //当前灵魂石 MyHead.LblItemAmount.text = Have.ToString() + "/" + NeedNum.ToString(); } else if (m_wndType == 3 && m_soldierInfo != null) { int NeedNum = 0; int NeedCoin = 0; SoldierM.GetUpStarNeed(m_soldierInfo.SoldierTypeID, m_soldierInfo.StarLevel, ref NeedNum, ref NeedCoin); int Have = m_soldierInfo.GetHaveFragmentNum(); //当前灵魂石 MyHead.LblItemAmount.text = Have.ToString() + "/" + NeedNum.ToString(); } else if (m_wndType == 4 && m_buildInfo != null) { int iCoin = 0; int NeedNum = 0; buildingM.GetUpStarNeed(m_buildInfo.BuildType, m_buildInfo.StarLevel + 1, ref NeedNum, ref iCoin); int Have = ItemDC.GetItemCount(m_buildInfo.fragmentTypeID); MyHead.LblItemAmount.text = Have.ToString() + "/" + NeedNum.ToString(); } else if (m_wndType == 5 && m_buildInfo != null) { int iCoin = 0; int NeedNum = 0; buildingM.GetUpStarNeed(m_buildInfo.BuildType, m_buildInfo.StarLevel, ref NeedNum, ref iCoin); int Have = ItemDC.GetItemCount(m_buildInfo.fragmentTypeID); MyHead.LblItemAmount.text = Have.ToString() + "/" + NeedNum.ToString(); } }
/// <summary> /// 获取有碎片(尚未召唤)黑科技 /// </summary> public static void GetHaveFragmentBS(ref List <CaptionInfo> l) { if (l == null) { l = new List <CaptionInfo>(); } l.Clear(); l = GodSkillM.GetCaptions(); for (int i = l.Count - 1; i >= 0; i--) { CaptionInfo info = l[i]; int itemtype = info.GetGodSkillInfo().m_needbook; int have = ItemDC.GetItemCount(itemtype); if (CheckHaveBS(info.m_captionid) || have == 0) { l.RemoveAt(i); } } }
private void SetUI() { if (m_Info != null) { SetNameLevel(m_Info.m_name, m_Info.Quality); SetTrapLevel(m_Info.Level); NGUIUtil.SetStarLevelNum(MyHead.StarSprites, m_Info.StarLevel); SetTrapPhoto(m_Info.BuildType); NGUIUtil.SetTrapTypeIcon(MyHead.SprRoleType, m_Info.m_RoomKind); NGUIUtil.Set2DSprite(MyHead.Shape, "Textures/shape/", "shape1"); NGUIUtil.SetLableText(MyHead.LblDefanAt, string.Format("[FFFFFF]{0}[-]", m_Info.m_DefensePower)); ShowRedPot(m_ItemType == 1); int NeedNum = 0; int NeedCoin = 0; buildingM.GetUpStarNeed(m_Info.BuildType, m_Info.StarLevel, ref NeedNum, ref NeedCoin); int Have = ItemDC.GetItemCount(m_Info.fragmentTypeID); //当前灵魂石 SetPercentageNum(Have, NeedNum); } if (m_TrapState == TrapState.Exit) { MyHead.GoUnDeder.SetActive(m_ItemType == 1); MyHead.GoNotExit.SetActive(false); MyHead.StarListParent.SetActive(true); } else { MyHead.GoUnDeder.SetActive(false); MyHead.GoNotExit.SetActive(true); MyHead.StarListParent.SetActive(false); ShowRedPot(false); } }
/// <summary> /// 检测背包中是否已经大等于列表中的全部物品 /// </summary> public static bool CheckItemsEnough(List <KeyValue> lNeedItemsIdNum) { List <int> listUsedCheck = new List <int>(); listUsedCheck.Clear(); foreach (KeyValue item in lNeedItemsIdNum) { int totalCount = ItemDC.GetItemCount(item.key); int countUsed = listUsedCheck.Count; if (totalCount > 0) { int nCnt = 0; for (nCnt = 0; nCnt < countUsed; nCnt++) { if (listUsedCheck[nCnt] == item.key) { totalCount--; if (totalCount == 0) { break; } } } for (nCnt = 0; nCnt < item.value; nCnt++) { listUsedCheck.Add(item.key); } } if (totalCount < item.value) { listUsedCheck.Clear(); return(false); } } listUsedCheck.Clear(); return(true); }
/// <summary> /// 检测是否满足召唤条件(钱够,碎片够) /// </summary> public static bool CheckCanSummon(int buildTypeId) { foreach (s_building_typeInfo BaseInfo in m_lType) { if (BaseInfo == null) { continue; } if (BaseInfo.id == buildTypeId) { int NeedCoin = 0; int fragment = 0; int NeedNum = 0; GetUpStarNeed(buildTypeId, BaseInfo.starlevel, ref NeedNum, ref NeedCoin); int Have = ItemDC.GetItemCount(BaseInfo.fragment); //当前灵魂石 if (Have >= NeedNum) { return(true); } return(false); } } return(false); }
public static bool CheckCanSummonMoney(int SoldierTypeID) { foreach (s_soldier_typeInfo BaseInfo in m_soldierType) { if (BaseInfo == null) { continue; } if (BaseInfo.id == SoldierTypeID) { int NeedCoin = 0; int fragment = 0; int NeedNum = 0; SoldierM.GetUpStarNeed(SoldierTypeID, BaseInfo.starlevel, ref NeedNum, ref NeedCoin); int Have = ItemDC.GetItemCount(BaseInfo.fragment);//当前灵魂石 if (Have >= NeedNum && UserDC.GetCoin() >= NeedCoin) { return(true); } return(false); } } return(false); }
/// <summary> /// 获取碎片数量 /// </summary> public int GetHaveFragmentNum() { return(ItemDC.GetItemCount(fragmentTypeID)); }