/// <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(); }
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); } } }
public void SetData(ItemTypeInfo info, BeiBaoWnd wnd) { m_parent = wnd; m_ItemInfo = info; m_itemcount = ItemDC.GetItemCount(m_ItemInfo.itemType); SetUI(); }
void Resweep(UIButton sender) { ItemTypeInfo sweepTicketInfo = ItemDC.GetSweepTickets(); if (sweepTicketInfo == null || sweepTicketInfo.Num < mSweepCount) { WndManager.DestoryDialog <StageWipeWnd>(); NGUIUtil.ShowFreeSizeTipWnd(NGUIUtil.GetStringByKey("70000229")); return; } CounterPartInfo info = StageDC.GetCounterPartInfo(); int playerPhysical = UserDC.GetPhysical(); // ÌåÁ¦²»×ã if (playerPhysical < info.win_physical * mSweepCount) { WndManager.DestoryDialog <StageWipeWnd>(); NGUIUtil.ShowFreeSizeTipWnd(NGUIUtil.GetStringByKey("99904008")); return; } StageDC.SendStageSweepRequest(StageDC.GetCompaignStageID(), mSweepCount); Clear(); //DataCenter.RegisterHooks((int)gate.Command.CMD.CMD_718, ShowSweepResult); }
private void UpdateSweepInfo() { CounterPartInfo info = StageDC.GetCounterPartInfo(); int times = StageDC.GetPassStageTimes(m_type, m_stageid); bool passed = times > 0; bool hasBoss = info.isboss > 0; bool isPVE = StageDC.GetPveMode() == PVEMode.Attack; // 是否需要显示扫荡UI bool activeSweepInfo = passed && hasBoss && isPVE; MyHead.SweepGroup.SetActive(activeSweepInfo); if (!activeSweepInfo) { return; } ItemTypeInfo sweepTicketInfo = ItemDC.GetSweepTickets(); int sweepTicketCount = sweepTicketInfo == null ? 0 : sweepTicketInfo.Num; MyHead.LblSweepTicket.text = string.Format("x{0}", sweepTicketCount); int sweepOnce = 1; int currentSweepMultiple = 0; if (info.type == (int)StageType.Normal) { currentSweepMultiple = 10; } else if (info.type == (int)StageType.Hard) { currentSweepMultiple = 3; } MyHead.LblSweepMultiple.text = string.Format(NGUIUtil.GetStringByKey(70000255), currentSweepMultiple); MyHead.LblSweepOnce.text = string.Format(NGUIUtil.GetStringByKey(70000256), sweepOnce); }
/// <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); }
public void ReSetUI() { m_listAllTypeInfo = ItemDC.GetItemList(m_itemType); CreateItems(); //最后一个卖掉,显示其上一个内容. if (nSelectIndex == m_listAllTypeInfo.Count) { nSelectIndex = m_listAllTypeInfo.Count - 1; } if (nSelectIndex >= 0 && nSelectIndex < m_listAllTypeInfo.Count) { ItemTypeInfo info = m_listAllTypeInfo[nSelectIndex]; if (info != null && info.Num > 0) { RefreshIntorduct(info); return; } } ItemTypeInfo defaultInfo = GetDefaultInfo(); if (defaultInfo == null) { U3DUtil.DestroyAllChild(MyHead.ItemParent); return; } RefreshIntorduct(defaultInfo); }
/// <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 BtnSure_OnClickEventHandler(UIButton sender) { switch (m_wndType) { case 1: //确定 BtnWndBg_OnClickEventHandler(null); break; case 2: //合成公式 TweenLeft(); EquipComposeWnd wnd = WndManager.GetDialog <EquipComposeWnd>(); if (wnd) { EnableBtn(false); wnd.SetData(m_iItemTypeID); } break; case 3: //穿装备 PdbycWnd wnd1 = WndManager.FindDialog <PdbycWnd>(); if (wnd1) { wnd1.SetEquipDataNoReady(); } MyHead.BtnSure.isEnabled = false; SoldierDC.Send_SoldierEquipRequest(m_soldierInfo.ID, m_posIndex); WndManager.DestoryDialog <EquipmentInfoWnd>(); break; case 4: //购买 //堆叠数量上限判定 bool overLimit = ItemDC.CheckItemOverLimit(m_iItemTypeID, m_iBuyCount); if (overLimit) { NGUIUtil.ShowTipWndByKey(30000030); break; } //持有代币是否足够 bool currencyEnough = UserDC.CheckCurrencyEnough(m_iBuyCurrency, m_iBuyPrice); if (currencyEnough) { } else { string currencyName = NGUIUtil.GetStringByKey(99700000 + m_iBuyCurrency); string tipText = string.Format(NGUIUtil.GetStringByKey(30000029), currencyName); //NGUIUtil.ShowTipWnd(tipText); NGUIUtil.ShowFreeSizeTipWnd(tipText); } break; case 5: //获得途径 ItemComeFromWnd Formwnd = WndManager.GetDialog <ItemComeFromWnd>(); s_itemtypeInfo info = ItemM.GetItemInfo(m_iItemTypeID); Formwnd.SetData(info, m_soldierInfo, null); break; } }
/// <summary> /// 清理数据中心数据 /// </summary> public static void ClearDC() { UserDC.ClearDC(); SoldierDC.ClearDC(); BuildDC.ClearDC(); ItemDC.ClearDC(); BlackScienceDC.ClearDC(); ShipPlanDC.ClearDC(); }
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); }
/// <summary> /// Llama al Data Core para el retorno del item que se esta creando, arma la entidad (json) con la informacion que va a retornar /// </summary> /// <param name="request"></param> /// <returns></returns> public static SaveItemResponse saveItem(SaveItemRequest request) { SaveItemResponse response = new SaveItemResponse(); response.item = ItemDC.saveItem(request); response.code = 100; response.message = "OK"; return(response); }
void BtnSell_OnClickHander(UIButton sender) { List <KeyValue> l = new List <KeyValue>(); KeyValue v = new KeyValue(); v.key = m_ItemInfo.ID; v.value = m_iSelectNum; l.Add(v); ItemDC.Send_ItemSellRequest(l); }
/// <summary> /// Llama al Data Core para el retorno del listado de los items, arma la entidad (json) que va a retornar /// </summary> /// <returns></returns> public static GetItemResponse getItems() { GetItemResponse response = new GetItemResponse(); response.items = ItemDC.getItems(); response.code = 100; response.message = "OK"; return(response); }
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"; } }
/// <summary> /// /// </summary> /// <param name="dItemID"></param> /// <param name="posIndex">装备索引 0~5</param> /// <param name="solderierInfo"></param> public void SetData(int dItemID, int posIndex, SoldierInfo solderierInfo) { m_iItemID = dItemID; m_soldierInfo = solderierInfo; m_iPosIndex = posIndex; m_itemTypeID = SoldierM.GetSoldierEquip(solderierInfo.SoldierTypeID, solderierInfo.Quality, posIndex); if (m_itemTypeID == 0) { NGUIUtil.DebugLog(string.Format(" SoldierTypeID={0},Quality={1},EquipIndex={2} 装备静态数据未配置", solderierInfo.SoldierTypeID, solderierInfo.Quality, posIndex)); return; } if (m_iItemID == 0)//当未穿装备时 { ItemTypeInfo info = ItemDC.SearchItem(m_itemTypeID); if (info != null) { m_iItemID = info.ID; m_itemTypeID = info.itemType; m_icon = info.m_Icon; } else { s_itemtypeInfo sInfo = ItemM.GetItemInfo(m_itemTypeID); if (sInfo != null) { m_icon = sInfo.icon; } else { NGUIUtil.DebugLog("itemTypeID =" + m_itemTypeID + " 未配置"); } } } else//已装备 { ItemTypeInfo info1 = ItemDC.GetItem(m_iItemID); if (info1 == null || info1.Positon == 0) { NGUIUtil.DebugLog("获取已装备的信息失败 itemID =" + m_iItemID); return; } m_icon = info1.m_Icon; if (info1 != null) { m_iEquipQuality = info1.m_Quality; } } int itemTypeid = 0; m_equipmentPutType = SoldierM.CheckCanPutEquip(solderierInfo, dItemID, posIndex, ref itemTypeid); SetUI(); }
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); }
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; } } } }
/// <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 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> 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 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> public void HideAniScroll() { NGUIUtil.SetActive(MyHead.ScrollLeft, false); NGUIUtil.SetActive(MyHead.ScrollRight, false); List <ItemTypeInfo> litem = ItemDC.SearchItemListBystype(45); if (litem.Count > 0) { ItemUseConfirmWnd wnd = WndManager.GetDialog <ItemUseConfirmWnd>(); if (wnd != null) { wnd.SetData(45, litem); } } }
void BtnConfirm_OnClickHander(UIButton sender) { if (m_send == false) { m_send = true; List <KeyValue> litem = new List <KeyValue>(); foreach (ItemTypeInfo item in m_litem) { KeyValue v = new KeyValue(); v.key = item.ID; v.value = item.Num; litem.Add(v); } ItemDC.SendItemBatchUseRequest(litem, UserDC.GetUserID()); Invoke("closewnd", 0.1f); } }
void BtnCompose_OnClickEventHandler(UIButton sender) { if (UserDC.GetCoin() < m_coin) { NGUIUtil.ShowTipWndByKey("88800108"); return; } if (ItemM.CheckEquipCompose(m_itemTypeID)) { ItemDC.SendEquipComposeRequest(m_itemTypeID); } else { NGUIUtil.ShowTipWndByKey("88800110"); } }
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(); }
/// <summary> /// 隐藏左右两个动画轴 /// </summary> public void HideAniScroll() { NGUIUtil.SetActive(MyHead.ScrollLeft, false); NGUIUtil.SetActive(MyHead.ScrollRight, false); NGUIUtil.SetPanelClipping(MyHead.PanelMask, UIDrawCall.Clipping.None); if (m_bGuide) { return; } List <ItemTypeInfo> litem = ItemDC.SearchItemListBystype(44); if (litem.Count > 0) { ItemUseConfirmWnd wnd = WndManager.GetDialog <ItemUseConfirmWnd>(); wnd.SetData(44, litem); } }