private void CampGuid1() { ItemDTO itemDTO = new ItemDTO((int)FightNpcPlayer.FightDropNPC.Npc_oldwoman, 1, BehaviorTypeConstVal.OPT_GM); GameItemFactory.GetInstance().AddItem(itemDTO); ItemDTO itemDTO1 = new ItemDTO((int)FightNpcPlayer.FightDropNPC.Npc_boy, 1, BehaviorTypeConstVal.OPT_GM); GameItemFactory.GetInstance().AddItem(itemDTO1); ItemDTO itemDTO2 = new ItemDTO((int)FightNpcPlayer.FightDropNPC.Npc_doctor03, 1, BehaviorTypeConstVal.OPT_GM); GameItemFactory.GetInstance().AddItem(itemDTO2); ItemDTO itemDTO3 = new ItemDTO((int)FightNpcPlayer.FightDropNPC.Npc_human00, 1, BehaviorTypeConstVal.OPT_GM); GameItemFactory.GetInstance().AddItem(itemDTO3); ItemDTO itemDTO4 = new ItemDTO((int)FightNpcPlayer.FightDropNPC.Npc_human03, 1, BehaviorTypeConstVal.OPT_GM); GameItemFactory.GetInstance().AddItem(itemDTO4); ItemDTO itemDTO5 = new ItemDTO((int)FightNpcPlayer.FightDropNPC.Npc_human04, 1, BehaviorTypeConstVal.OPT_GM); GameItemFactory.GetInstance().AddItem(itemDTO5); ItemDTO itemDTO6 = new ItemDTO((int)FightNpcPlayer.FightDropNPC.Npc_police01, 1, BehaviorTypeConstVal.OPT_GM); GameItemFactory.GetInstance().AddItem(itemDTO6); }
public void Init() { mProgressY = m_Pronum.rectTransform.sizeDelta.y; mMaxProgressParam = m_Pronum.rectTransform.sizeDelta.x; m_BuyCostMDT = new ItemDTO(SpecialItemIdConstVal.MDT, double.Parse(Global.gApp.gGameData.GeneralConfigData.Get(GeneralConfigConstVal.ENERGY_BUY_ONCE).content), BehaviorTypeConstVal.OPT_MDT_EXCHANGE_ENERGY); m_BuyAddEnergy = new ItemDTO(SpecialItemIdConstVal.ENERGY, double.Parse(Global.gApp.gGameData.GeneralConfigData.Get(GeneralConfigConstVal.ENERGY_BUY_ADD).content), BehaviorTypeConstVal.OPT_MDT_EXCHANGE_ENERGY); m_AdAddEnergy = new ItemDTO(SpecialItemIdConstVal.ENERGY, double.Parse(Global.gApp.gGameData.GeneralConfigData.Get(GeneralConfigConstVal.ENERGY_AD_ADD).content), BehaviorTypeConstVal.OPT_MDT_EXCHANGE_ENERGY); m_AdAddEnergyCD = int.Parse(Global.gApp.gGameData.GeneralConfigData.Get(GeneralConfigConstVal.AD_ADD_ENERGY_CD).content); EnergyChanged(GameItemFactory.GetInstance().GetItem(SpecialItemIdConstVal.ENERGY)); FlushCD(); m_Btn1txt.text.text = string.Format("×{0}", (int)m_BuyCostMDT.num); EnergyNum.text.text = string.Format("×{0}", (int)m_BuyAddEnergy.num); AdEnergyNum.text.text = string.Format("×{0}", (int)m_AdAddEnergy.num); Btn1.button.onClick.AddListener(OnEnergy); Btn2.button.onClick.AddListener(TouchClose); AdBtn.button.onClick.AddListener(OnAd); m_AdAddEnergyTimesLimit = int.Parse(Global.gApp.gGameData.GeneralConfigData.Get(GeneralConfigConstVal.ENERGY_AD_ADD_TIMES).content); AdText.text.text = string.Format(Global.gApp.gGameData.GetTipsInCurLanguage(3043), m_AdAddEnergyTimesLimit - Global.gApp.gSystemMgr.GetMiscMgr().adEnegyTimes); }
public void UIFresh() { ItemItem itemItem = Global.gApp.gGameData.ItemData.Get(m_CampShopItem.propId); //武器需要根据当前情况处理 if (itemItem != null && GameItemFactory.GetInstance().GetItem(m_CampShopItem.propId) > 0) { Global.gApp.gSystemMgr.GetNpcMgr().CampShopTimesMap[m_CampShopItem.id.ToString()] = 1; Global.gApp.gSystemMgr.GetNpcMgr().SaveData(); } MatIcon.image.sprite = Resources.Load(itemItem.image_grow, typeof(Sprite)) as Sprite; double addNum = m_CampShopItem.propNum; if (m_CampShopItem.propId == SpecialItemIdConstVal.GOLD) { Gold_paramsItem gpiCfg = Global.gApp.gGameData.GoldParamsConfig.Get(Global.gApp.gSystemMgr.GetBaseAttrMgr().GetLevel()); addNum *= gpiCfg.coinParams; } m_ExchangeCount.text.text = "X " + UiTools.FormateMoneyUP(addNum); HeartCount.text.text = m_CampShopItem.heartNum.ToString(); HeartCount.text.color = ColorUtil.GetTextColor(GameItemFactory.GetInstance().GetItem(SpecialItemIdConstVal.RED_HEART) < m_CampShopItem.heartNum, "#FDE47EFF"); bool limit = Global.gApp.gSystemMgr.GetNpcMgr().CampShopTimesMap[m_CampShopItem.id.ToString()] >= m_CampShopItem.limitButTimes; ExchangeNode.gameObject.SetActive(!limit); SellOut.gameObject.SetActive(limit); MatIcon.image.color = limit ? ColorUtil.GetColor(ColorUtil.m_BlackColor) : ColorUtil.GetColor(ColorUtil.m_DeaultColor); MatName.text.text = itemItem.gamename; ExchangeCount.gameObject.SetActive(false); }
private void OnConfirm() { if (m_CurSellCount > 0) { double realSellCount = m_CurSellCount; if (realSellCount >= m_MaxCount) { realSellCount = m_RealMaxCount; } ItemDTO reduceItemDTO = new ItemDTO(m_CampRecycleItem.id, realSellCount, BehaviorTypeConstVal.OPT_EXCHANGE_REDUCE_ITEM); GameItemFactory.GetInstance().ReduceItem(reduceItemDTO); double addGoldCount = m_CurSellCount * m_CampRecycleItem.price * m_GoldParam; ItemDTO addItemDTO = new ItemDTO(SpecialItemIdConstVal.GOLD, addGoldCount, BehaviorTypeConstVal.OPT_EXCHANGE_ADD_COIN); GameItemFactory.GetInstance().AddItem(addItemDTO); Global.gApp.gMsgDispatcher.Broadcast <int, int, Vector3>(MsgIds.ShowRewardGetEffect, SpecialItemIdConstVal.GOLD, 20, m_ConfirmBtn.rectTransform.position); m_MaxCount -= m_CurSellCount; m_RealMaxCount -= m_CurSellCount; if (m_RealMaxCount < 0) { m_RealMaxCount = 0; } m_MaxCount = (double)((int)(m_RealMaxCount + 0.5d)); m_CurSellCount = m_MaxCount; FreshSellInfo(); TouchClose(); } }
private void OnLineReward(float times) { FallBox_dataItem config = Global.gApp.gGameData.FallBoxDataConfig.Get(Global.gApp.gSystemMgr.GetBaseAttrMgr().GetLevel()); ItemDTO addItemDTO = new ItemDTO(SpecialItemIdConstVal.GOLD, config.coin * times, BehaviorTypeConstVal.OPT_RECEIVE_SUPPLY); GameItemFactory.GetInstance().AddItem(addItemDTO); }
//private SdkdsPurchaseUtils.Product m_Product; public override void Init <T>(string name, UIInfo info, T arg) { base.Init(name, info, arg); Btn2.button.onClick.AddListener(OnGoTo); BtnC.button.onClick.AddListener(OnCloseBtn); RegisterListeners(); base.ChangeLanguage(); m_IdStr = Global.gApp.gGameData.GeneralConfigData.Get(GeneralConfigConstVal.TIME_GIFT1_PRODUCT).content; string[] prms = m_IdStr.Split('.'); ItemItem itemCfg = Global.gApp.gGameData.ItemData.Get(int.Parse(prms[2])); NextGunName.text.text = itemCfg.gamename; m_RemainStr = Global.gApp.gGameData.GetTipsInCurLanguage(4186); double mills = DateTimeUtil.m_Day_Mills * 7 - DateTimeUtil.GetMills(DateTime.Now) + Global.gApp.gSystemMgr.GetMiscMgr().TimeGiftStartTime; if (mills < 0d) { mills = 0d; } DelayCallBack dcb = gameObject.AddComponent <DelayCallBack>(); TimeCount.text.text = GetTimtTip(mills); dcb.SetAction(() => { double ms = DateTimeUtil.m_Day_Mills * 7 - DateTimeUtil.GetMills(DateTime.Now) + Global.gApp.gSystemMgr.GetMiscMgr().TimeGiftStartTime; if (ms < 0d) { ms = 0d; } TimeCount.text.text = GetTimtTip(ms); }, 1f); List <ItemDTO> itemDTOs = GameItemFactory.GetInstance().DealItems(Global.gApp.gGameData.GeneralConfigData.Get(GeneralConfigConstVal.TIME_GIFT1).contents, BehaviorTypeConstVal.OPT_TIME_GIFT1); ItemIcon1.image.sprite = Global.gApp.gResMgr.LoadAssets <Sprite>(string.Format(CommonResourceConstVal.RESOURCE_PATH, itemDTOs[0].itemId)); ItemCount1.text.text = "X " + (int)itemDTOs[0].num; ItemIcon2.image.sprite = Global.gApp.gResMgr.LoadAssets <Sprite>(string.Format(CommonResourceConstVal.RESOURCE_PATH, itemDTOs[1].itemId)); ItemCount2.text.text = "X " + (int)itemDTOs[1].num; dcb.SetCallTimes(Convert.ToInt32(mills / DateTimeUtil.m_Sec_Mills) + 1); #if (UNITY_EDITOR || DISBLE_PLATFORM) #else //if (SdkdsPurchaseUtils.m_ProductList!= null && SdkdsPurchaseUtils.m_ProductList.Count > 0) //{ // foreach (SdkdsPurchaseUtils.Product product in SdkdsPurchaseUtils.m_ProductList) { // if (SdkdsPurchaseUtils.IsSpecialPruchase(product, GeneralConfigConstVal.TIME_GIFT1_PRODUCT)) // { // m_Product = product; // break; // } // } // moneyNum.text.text = m_Product.price; //} #endif }
private void ExChangeAllUnUseMat() { if (m_RecyclyMat.Count > 0) { Gold_paramsItem gpiCfg = Global.gApp.gGameData.GoldParamsConfig.Get(Global.gApp.gSystemMgr.GetBaseAttrMgr().GetLevel()); double coinParams = gpiCfg.coinParams; bool excangeSucess = false; foreach (KeyValuePair <int, double> keyValue in m_RecyclyMat) { int count = (int)keyValue.Value; if (count > 0) { ItemDTO reduceItemDTO = new ItemDTO(keyValue.Key, count, BehaviorTypeConstVal.OPT_EXCHANGE_REDUCE_ITEM); GameItemFactory.GetInstance().ReduceItem(reduceItemDTO); CampRecycleItem campRecycleItem = Global.gApp.gGameData.CampRecycleConfig.Get(keyValue.Key); ItemDTO addItemDTO = new ItemDTO(SpecialItemIdConstVal.GOLD, count * campRecycleItem.price * coinParams, BehaviorTypeConstVal.OPT_EXCHANGE_ADD_COIN); GameItemFactory.GetInstance().AddItem(addItemDTO); excangeSucess = true; } } if (excangeSucess) { Global.gApp.gMsgDispatcher.Broadcast <int, int, Vector3>(MsgIds.ShowRewardGetEffect, SpecialItemIdConstVal.GOLD, 20, AdaptNode.rectTransform.position); } TouchClose(); } else { TouchClose(); } }
private void InitNode() { m_CloseBtn.button.onClick.AddListener(TouchClose); m_Btn1.button.onClick.AddListener(TouchClose); m_Btn2.button.onClick.AddListener(UpdateQuality); m_fromGun.image.sprite = Resources.Load(m_Item.image_grow, typeof(Sprite)) as Sprite; m_toGun.image.sprite = Resources.Load(m_Item.image_grow + "_s", typeof(Sprite)) as Sprite; int itemId = Convert.ToInt32(m_Item.supercondition[1]); double unlockItemNum = Convert.ToDouble(m_Item.supercondition[2]); m_Cost1.text.color = ColorUtil.GetTextColor(GameItemFactory.GetInstance().GetItem(itemId) < unlockItemNum, m_CM_COLOR); m_Cost1.text.text = unlockItemNum.ToString(); double itemCount = GameItemFactory.GetInstance().GetItem(itemId); string iconPath = string.Format(CommonResourceConstVal.RESOURCE_PATH, itemId); m_Icon1.image.sprite = Global.gApp.gResMgr.LoadAssets <Sprite>(iconPath); int itemId2 = Convert.ToInt32(m_Item.supercondition[3]); double unlockItemNum2 = Convert.ToDouble(m_Item.supercondition[4]); m_Cost2.text.color = ColorUtil.GetTextColor(GameItemFactory.GetInstance().GetItem(itemId2) < unlockItemNum2, m_CM_COLOR); m_Cost2.text.text = unlockItemNum2.ToString(); double itemCount2 = GameItemFactory.GetInstance().GetItem(itemId2); string iconPath2 = string.Format(CommonResourceConstVal.RESOURCE_PATH, itemId2); m_Icon2.image.sprite = Global.gApp.gResMgr.LoadAssets <Sprite>(iconPath2); }
private void OnBuy() { //InfoCLogUtil.instance.SendClickLog(ClickEnum.SHOP_MDT_COIN1 + m_Index); ShopItem itemConfig = Global.gApp.gGameData.ShopConfig.Get(m_ShopId); //扣钱 bool reduceResult = false; if (itemConfig.consumeType == SpecialItemIdConstVal.REAL_MONEY) { //暂无充值sdk Global.gApp.gMsgDispatcher.Broadcast <int>(MsgIds.ShowGameTipsByID, 2021); return; } else { double curCoin = GameItemFactory.GetInstance().GetItem(itemConfig.consumeType); if (curCoin < itemConfig.price || itemConfig.price < 0) { Global.gApp.gMsgDispatcher.Broadcast <int>(MsgIds.ShowGameTipsByID, 1002); return; } } Global.gApp.gUiMgr.OpenPanel(Wndid.ConfirmPanel, this); }
private void InitNode() { m_CloseBtn.button.onClick.AddListener(TouchClose); CampBadgeItem[] campBadges = Global.gApp.gGameData.CampBadgeConfig.items; int index = 0; foreach (CampBadgeItem campBadgeItem in campBadges) { CampBadgeUI_BadgeItemUI campBadgeUI_BadgeItemUI = BadgeItemUI.GetInstance(); campBadgeUI_BadgeItemUI.gameObject.SetActive(true); campBadgeUI_BadgeItemUI.Detail.text.text = Global.gApp.gGameData.GetTipsInCurLanguage(campBadgeItem.detail); campBadgeUI_BadgeItemUI.Title.text.text = Global.gApp.gGameData.GetTipsInCurLanguage(campBadgeItem.title); if (GameItemFactory.GetInstance().GetItem(campBadgeItem.id) > 0) { campBadgeUI_BadgeItemUI.Detail.gameObject.SetActive(true); campBadgeUI_BadgeItemUI.Title.gameObject.SetActive(true); campBadgeUI_BadgeItemUI.NoActiveTip.gameObject.SetActive(false); campBadgeUI_BadgeItemUI.Icon.image.sprite = Resources.Load(campBadgeItem.activeIcon, typeof(Sprite)) as Sprite; campBadgeUI_BadgeItemUI.Icon.image.color = new Color(1, 1, 1, 1); } else { campBadgeUI_BadgeItemUI.Detail.gameObject.SetActive(false); campBadgeUI_BadgeItemUI.Title.gameObject.SetActive(false); campBadgeUI_BadgeItemUI.NoActiveTip.gameObject.SetActive(true); campBadgeUI_BadgeItemUI.Icon.image.sprite = Resources.Load(campBadgeItem.noActiveIcon, typeof(Sprite)) as Sprite; campBadgeUI_BadgeItemUI.Icon.image.color = new Color(1, 1, 1, 0.5f); } campBadgeUI_BadgeItemUI.transform.SetSiblingIndex(index); index++; } }
public override string GetLeftTips(float[] condition) { int itemId = (int)condition[1]; string tip = Global.gApp.gGameData.GetTipsInCurLanguage(3087); ItemItem itemConfig = Global.gApp.gGameData.ItemData.Get((int)condition[1]); return(string.Format(tip, condition[1] + condition[2] - GameItemFactory.GetInstance().GetItem(itemId), itemConfig.gamename)); }
private void InitNode() { GoldChanged(GameItemFactory.GetInstance().GetItem(SpecialItemIdConstVal.GOLD)); DiamondChanged(GameItemFactory.GetInstance().GetItem(SpecialItemIdConstVal.DIAMOND)); ShowScrollItem(ItemTypeConstVal.CARRIER); }
public void UIFresh() { ShopItem chargeItemConfig = Global.gApp.gGameData.ShopConfig.Get(m_ShopId); if (chargeItemConfig.consumeType != SpecialItemIdConstVal.REAL_MONEY) { ConsumeValue.text.color = ColorUtil.GetTextColor(GameItemFactory.GetInstance().GetItem(chargeItemConfig.consumeType) < chargeItemConfig.price, null); } }
private void OpenRecycleUi() { double count = GameItemFactory.GetInstance().GetItem(m_RecycleItem.id); if (count > 0) { Global.gApp.gUiMgr.OpenPanel(Wndid.CampMatRecycleDetailUi, this); } }
private void OnAdBtn() { AddTouchMask(); m_AddItemDTO.num = m_AddItemDTO.num * float.Parse(offlineConfig.contents[7]); //Global.gApp.gMsgDispatcher.Broadcast<float>(MsgIds.GainDelayShow, 1.5f); Global.gApp.gMsgDispatcher.Broadcast <int, int, Vector3>(MsgIds.ShowRewardGetEffect, m_AddItemDTO.itemId, 15, Vector3.zero); GameItemFactory.GetInstance().AddItem(m_AddItemDTO); Global.gApp.gMsgDispatcher.Broadcast(MsgIds.UIFresh); TouchClose(); //gameObject.AddComponent<DelayCallBack>().SetAction(TouchClose, 1.5f); }
protected void AddBrage() { if (m_CampStepItem.brageId > 0) { if (GameItemFactory.GetInstance().GetItem(m_CampStepItem.brageId) == 0d) { ItemDTO itemDTO = new ItemDTO(m_CampStepItem.brageId, 1, BehaviorTypeConstVal.OPT_CAMP_GENBADGE); GameItemFactory.GetInstance().AddItem(itemDTO); } Global.gApp.gUiMgr.OpenPanel(Wndid.CampBadgeSuccessUI, this); } }
private void AddFightItem(ref int[] itemArray) { foreach (int itemId in itemArray) { ItemItem itemCfg = Global.gApp.gGameData.ItemData.Get(itemId); string itemName = itemCfg.name; double itemCount = Global.gApp.CurScene.GetMainPlayerComp().GetPlayerData().GetDropResCount(itemName); if (itemCount > 0) { ItemDTO weaponChip = new ItemDTO(itemId, itemCount, BehaviorTypeConstVal.OPT_BALANCE); GameItemFactory.GetInstance().AddItem(weaponChip); } } }
private void CompleteAd(bool res) { if (res) { //Global.gApp.gMsgDispatcher.Broadcast<float>(MsgIds.GainDelayShow, 1.8f); Global.gApp.gMsgDispatcher.Broadcast <int, int, Vector3>(MsgIds.ShowRewardGetEffect, m_AdAddEnergy.itemId, (int)m_AdAddEnergy.num * 3, AdBtn.rectTransform.position); GameItemFactory.GetInstance().AddItem(m_AdAddEnergy); Global.gApp.gSystemMgr.GetMiscMgr().adEnegyTimes += 1; Global.gApp.gSystemMgr.GetMiscMgr().lastAdEnegyMills = DateTimeUtil.GetMills(DateTime.Now); AdText.text.text = string.Format(Global.gApp.gGameData.GetTipsInCurLanguage(3043), m_AdAddEnergyTimesLimit - Global.gApp.gSystemMgr.GetMiscMgr().adEnegyTimes); FlushCD(); } }
private void OnLevelUp() { ItemItem itemConfig = Global.gApp.gGameData.GetItemDataByName(m_WeaponName); int gunLevel = Global.gApp.gSystemMgr.GetWeaponMgr().GetWeaponLevel(itemConfig.name); if (gunLevel == Global.gApp.gGameData.GunDataConfig.items.Length) { Global.gApp.gMsgDispatcher.Broadcast <int>(MsgIds.ShowGameTipsByID, 3046); return; } Guns_dataItem levelItem = Global.gApp.gGameData.GunDataConfig.Get(gunLevel); Guns_dataItem nextLevelItem = Global.gApp.gGameData.GunDataConfig.Get(gunLevel + 1); double[] nextValue = ReflectionUtil.GetValueByProperty <Guns_dataItem, double[]>(m_WeaponName, nextLevelItem); if (nextValue == null || nextValue.Length == 0) { Global.gApp.gMsgDispatcher.Broadcast <int>(MsgIds.ShowGameTipsByID, 1004); return; } //是否成功扣钱 bool reduceResult = false; double[] costValue = ReflectionUtil.GetValueByProperty <Guns_dataItem, double[]>(m_WeaponName + "_cost", levelItem); ItemDTO reduceItemDTO = new ItemDTO(m_ConsumItemId, Convert.ToSingle(costValue[1]), BehaviorTypeConstVal.OPT_SUPPORT_LEVEL_UP); reduceItemDTO.paramStr1 = m_WeaponName; GameItemFactory.GetInstance().ReduceItem(reduceItemDTO); reduceResult = reduceItemDTO.result; if (!reduceResult) { Global.gApp.gMsgDispatcher.Broadcast <int>(MsgIds.ShowGameTipsByID, 1002); return; } bool levelUpResult = Global.gApp.gSystemMgr.GetWeaponMgr().LevelUp(m_WeaponName); if (levelUpResult) { Deal4Level(itemConfig); } else { ItemDTO addItemDTO = new ItemDTO(m_ConsumItemId, Convert.ToSingle(costValue[1]), BehaviorTypeConstVal.OPT_SUPPORT_LEVEL_UP); addItemDTO.paramStr1 = m_WeaponName; addItemDTO.paramStr2 = "MakeUp4Fail"; GameItemFactory.GetInstance().AddItem(addItemDTO); } }
private void OnStartGame() { string[] consumeItemStr = Global.gApp.gGameData.GeneralConfigData.Get(GeneralConfigConstVal.REPASS_ENERGY_TAKE).contents; bool result0 = GameItemFactory.GetInstance().ReduceItem(consumeItemStr, BehaviorTypeConstVal.OPT_GAME_CONSUME); if (!result0) { Global.gApp.gUiMgr.OpenPanel(Wndid.EnergyShowPanel); return; } Global.gApp.gSystemMgr.GetPassMgr().EnterPass(); Global.gApp.gUiMgr.ClossAllPanel(); Global.gApp.gGameCtrl.ChangeToFightScene(m_Pass.id); }
public void Init(ShopItem itemConfig, int i) { m_Index = i; m_ShopId = itemConfig.id; effct_num = itemConfig.effectNum; Shop_dataItem shop_DataItem = Global.gApp.gGameData.ShopDataConfig.Get(Global.gApp.gSystemMgr.GetBaseAttrMgr().GetLevel()); if (shop_DataItem != null) { m_ItemNum = ReflectionUtil.GetValueByProperty <Shop_dataItem, float>("stageGet_" + (i + 1), shop_DataItem); m_Valuetxt.text.text = UiTools.FormateMoneyUP(m_ItemNum); } else { m_Valuetxt.text.text = GameConstVal.EmepyStr; } CmIcon.image.sprite = Global.gApp.gResMgr.LoadAssets <Sprite>(string.Format(CommonResourceConstVal.RESOURCE_PATH, itemConfig.goodsType)); ItemIcon.image.sprite = Global.gApp.gResMgr.LoadAssets <Sprite>(itemConfig.itemIcon); if (itemConfig.consumeType == SpecialItemIdConstVal.REAL_MONEY) { ConsumeValue.text.text = "$ " + itemConfig.price.ToString(); ConsumeIcon.gameObject.SetActive(false); } else { ConsumeValue.text.text = " " + UiTools.FormateMoneyUP(itemConfig.price); ConsumeIcon.gameObject.SetActive(true); ConsumeIcon.image.sprite = Global.gApp.gResMgr.LoadAssets <Sprite>(string.Format(CommonResourceConstVal.RESOURCE_PATH, itemConfig.consumeType)); ConsumeValue.text.color = ColorUtil.GetTextColor(GameItemFactory.GetInstance().GetItem(itemConfig.consumeType) < itemConfig.price, null); } Cmbglight.image.sprite = Global.gApp.gResMgr.LoadAssets <Sprite>(itemConfig.bgLight); EffectItem effectItem = Global.gApp.gGameData.EffectData.Get(EffectConstVal.SHOP_GOLD); string location = System.Text.RegularExpressions.Regex.Replace(itemConfig.itemIcon, @"[^0-9]+", GameConstVal.EmepyStr); GameObject effect = UiTools.GetEffect(string.Format(effectItem.path, location), transform); if (mEffect != null) { GameObject.Destroy(mEffect); } mEffect = effect; gameObject.SetActive(true); }
private void EnterBranchPass() { string[] consumeItemStr = Global.gApp.gGameData.GeneralConfigData.Get(GeneralConfigConstVal.GAME_CONSUME_ITEMS).contents; bool result = GameItemFactory.GetInstance().ReduceItem(consumeItemStr, BehaviorTypeConstVal.OPT_GAME_CONSUME); if (!result) { Global.gApp.gUiMgr.OpenPanel(Wndid.EnergyShowPanel); return; } int passId = Global.gApp.gSystemMgr.GetPassMgr().GetBranchPassId(); Global.gApp.gUiMgr.ClossAllPanel(); Global.gApp.gGameCtrl.ChangeToFightScene(passId); }
public void FreshUi() { double count = GameItemFactory.GetInstance().GetItem(m_RecycleItem.id); if (count > 0) { gameObject.SetActive(true); MatIcon.image.sprite = Resources.Load(m_ItemItem.image_grow, typeof(Sprite)) as Sprite; MatName.text.text = Global.gApp.gGameData.GetTipsInCurLanguage(m_ItemItem.sourceLanguage); CurCount.text.text = ((int)(count + 0.5d)).ToString(); } else { m_Parrent.RemoveItem(this); } }
private void OnItemBtn() { Dropdown dd = ItemDropdown.gameObject.GetComponent <Dropdown>(); ItemItem itemConfig = Global.gApp.gGameData.GetItemDataByName(dd.captionText.text); if (itemConfig != null) { ItemDTO itemDTO = new ItemDTO(itemConfig.id, ItemNumSlider.slider.value, BehaviorTypeConstVal.OPT_GM); GameItemFactory.GetInstance().AddItem(itemDTO); Global.gApp.gMsgDispatcher.Broadcast <string>(MsgIds.ShowGameTipsByStr, string.Format("成功添加{0}个\"{1}\"", itemDTO.num, dd.captionText.text)); } else { Global.gApp.gMsgDispatcher.Broadcast <string>(MsgIds.ShowGameTipsByStr, string.Format("不支持添加\"{0}\"", dd.captionText.text)); } }
private void OnEnergy() { //InfoCLogUtil.instance.SendClickLog(ClickEnum.NO_ENERGY_MDT); if (!GameItemFactory.GetInstance().CanReduce(m_BuyCostMDT)) { Global.gApp.gMsgDispatcher.Broadcast <int>(MsgIds.CommonUIIndexChange, 0); TouchClose(); return; } GameItemFactory.GetInstance().ReduceItem(m_BuyCostMDT); //Global.gApp.gMsgDispatcher.Broadcast<float>(MsgIds.GainDelayShow, 1.8f); Global.gApp.gMsgDispatcher.Broadcast <int, int, Vector3>(MsgIds.ShowRewardGetEffect, m_BuyAddEnergy.itemId, (int)m_BuyAddEnergy.num, Btn1.rectTransform.position); GameItemFactory.GetInstance().AddItem(m_BuyAddEnergy); }
private void CreateMatItem() { CampRecycleItem[] campRecycleItems = Global.gApp.gGameData.CampRecycleConfig.items; foreach (CampRecycleItem recycleItem in campRecycleItems) { double count = GameItemFactory.GetInstance().GetItem(recycleItem.id); if (count > 0) { ItemItem itemItem = Global.gApp.gGameData.ItemData.Get(recycleItem.id); CampMatBag_MatItemUI matItem = MatItemUI.GetInstance(); matItem.Init(recycleItem, itemItem, this); m_AllCampRecycleItem.Add(matItem); } } FreshTipsState(); }
private void SetConsumeCoin() { m_ComsumeItem = Global.gApp.gSystemMgr.GetSkillMgr().GetSkillUpdateItem(); CmIcon.gameObject.SetActive(m_ComsumeItem != null); CmNum.gameObject.SetActive(m_ComsumeItem != null); Maxtxt.gameObject.SetActive(m_ComsumeItem == null); dotxt.gameObject.SetActive(m_ComsumeItem != null); if (m_ComsumeItem != null) { int itemId = m_ComsumeItem.itemId; CmIcon.gameObject.SetActive(true); CmIcon.image.sprite = Global.gApp.gResMgr.LoadAssets <Sprite>(string.Format(CommonResourceConstVal.RESOURCE_PATH, itemId)); CmNum.text.text = UiTools.FormateMoney(m_ComsumeItem.num); CmNum.text.color = ColorUtil.GetTextColor(GameItemFactory.GetInstance().GetItem((int)m_ComsumeItem.itemId) < m_ComsumeItem.num, Global.gApp.gGameData.GeneralConfigData.Get(GeneralConfigConstVal.YELLOW_COLOR).content); } }
public override void Init <T>(string name, UIInfo info, T arg) { base.Init(name, info, arg); m_MatItemUI = arg as CampMatBag_MatItemUI; m_CampRecycleItem = m_MatItemUI.GetRecycleItem();; Gold_paramsItem gpiCfg = Global.gApp.gGameData.GoldParamsConfig.Get(Global.gApp.gSystemMgr.GetBaseAttrMgr().GetLevel()); m_GoldParam = gpiCfg.coinParams; double count = GameItemFactory.GetInstance().GetItem(m_CampRecycleItem.id); m_RealMaxCount = count; m_MaxCount = (double)((int)(m_RealMaxCount + 0.5d)); m_CurSellCount = m_MaxCount; InitNode(); base.ChangeLanguage(); }
public void ExchangeHeartImp() { bool limit = Global.gApp.gSystemMgr.GetNpcMgr().CampShopTimesMap[m_CampShopItem.id.ToString()] >= m_CampShopItem.limitButTimes; if (limit) { Global.gApp.gMsgDispatcher.Broadcast <int>(MsgIds.ShowGameTipsByID, 4255); return; } bool enough = GameItemFactory.GetInstance().GetItem(SpecialItemIdConstVal.RED_HEART) >= m_CampShopItem.heartNum; if (!enough) { Global.gApp.gMsgDispatcher.Broadcast <int>(MsgIds.ShowGameTipsByID, 4262); return; } ItemItem itemConfig = Global.gApp.gGameData.ItemData.Get(SpecialItemIdConstVal.RED_HEART); ItemDTO reduceItemDTO = new ItemDTO(SpecialItemIdConstVal.RED_HEART, m_CampShopItem.heartNum, BehaviorTypeConstVal.OPT_EXCHANGE_REDUCE_HEART); reduceItemDTO.paramStr1 = m_CampShopItem.propId.ToString(); GameItemFactory.GetInstance().ReduceItem(reduceItemDTO); ItemItem addItemConfig = Global.gApp.gGameData.ItemData.Get(m_CampShopItem.propId); double addNum = m_CampShopItem.propNum; if (m_CampShopItem.propId == SpecialItemIdConstVal.GOLD) { Gold_paramsItem gpiCfg = Global.gApp.gGameData.GoldParamsConfig.Get(Global.gApp.gSystemMgr.GetBaseAttrMgr().GetLevel()); addNum *= gpiCfg.coinParams; } if (ItemTypeConstVal.isWeapon(addItemConfig.showtype)) { Global.gApp.gSystemMgr.GetWeaponMgr().SetWeaponOpenState(addItemConfig.name, WeaponStateConstVal.NEW); } ItemDTO addItemDTO = new ItemDTO(m_CampShopItem.propId, addNum, BehaviorTypeConstVal.OPT_EXCHANGE_ADD_ITEM); GameItemFactory.GetInstance().AddItem(addItemDTO); Global.gApp.gSystemMgr.GetNpcMgr().CampShopTimesMap[m_CampShopItem.id.ToString()]++; Global.gApp.gSystemMgr.GetNpcMgr().SaveData(); m_Parent.FresAllItem(); Global.gApp.gUiMgr.OpenPanel(Wndid.ExchangeSuccessUI, this); }
private void OnExChangeHeart() { bool limit = Global.gApp.gSystemMgr.GetNpcMgr().CampShopTimesMap[m_CampShopItem.id.ToString()] >= m_CampShopItem.limitButTimes; if (limit) { Global.gApp.gMsgDispatcher.Broadcast <int>(MsgIds.ShowGameTipsByID, 4255); return; } bool enough = GameItemFactory.GetInstance().GetItem(SpecialItemIdConstVal.RED_HEART) >= m_CampShopItem.heartNum; if (!enough) { Global.gApp.gMsgDispatcher.Broadcast <int>(MsgIds.ShowGameTipsByID, 4262); return; } Global.gApp.gUiMgr.OpenPanel(Wndid.ExchangeConfirmUI, this); }