private void InitNode() { CampShopItem campShopItem = m_ItemUI.GetCampItem(); CloseBtn.button.onClick.AddListener(TouchClose); ItemItem itemItem = Global.gApp.gGameData.ItemData.Get(campShopItem.propId); Debug.Log(itemItem.image_grow); MatIcon.image.sprite = Resources.Load(itemItem.image_grow, typeof(Sprite)) as Sprite; MatName.text.text = Global.gApp.gGameData.GetTipsInCurLanguage(itemItem.sourceLanguage); GeneralConfigItem colorConfig = Global.gApp.gGameData.GeneralConfigData.Get(GeneralConfigConstVal.QUALITY_COLOR); if (itemItem.showtype == ItemTypeConstVal.BASE_MAIN_WEAPON) { bgBottom.image.sprite = Resources.Load(string.Format(CommonResourceConstVal.MAIN_UI_WEAPON_DOWN_PATH, itemItem.qualevel), typeof(Sprite)) as Sprite; MatName.text.color = ColorUtil.GetColor(colorConfig.contents[itemItem.qualevel]); } else { bgBottom.image.sprite = Resources.Load(string.Format(CommonResourceConstVal.MAIN_UI_WEAPON_DOWN_PATH, 2), typeof(Sprite)) as Sprite; MatName.text.color = ColorUtil.GetColor(colorConfig.contents[2]); } EffectItem effectItem = Global.gApp.gGameData.EffectData.Get(EffectConstVal.QUALITY); string effectName = itemItem.showtype == ItemTypeConstVal.BASE_MAIN_WEAPON ? itemItem.qualevel.ToString() : "common"; GameObject effect = UiTools.GetEffect(string.Format(effectItem.path, effectName), EffectPos.rectTransform); effect.transform.localPosition = new Vector3(0f, 0f, 0f); effect.transform.GetChild(0).localPosition = new Vector3(0f, 0f, 0f); ParticleSystem[] pss = effect.GetComponentsInChildren <ParticleSystem>(); foreach (ParticleSystem ps in pss) { ps.GetComponent <Renderer>().sortingOrder = 51; } }
private void InitNextUI(QuestItemDTO nextLevelDetailDTO, ItemItem itemConfig) { bool isWeapon = ItemTypeConstVal.isWeapon(itemConfig.showtype); //NextGunName.gameObject.SetActive(isWeapon); LDAGunIcon.gameObject.SetActive(itemConfig.showtype == ItemTypeConstVal.BASE_MAIN_WEAPON); LDASubWpIcon.gameObject.SetActive(itemConfig.showtype == ItemTypeConstVal.SUB_WEAPON); LDAPetIcon.gameObject.SetActive(itemConfig.showtype == ItemTypeConstVal.PET); LDAAwardIcon.gameObject.SetActive(!isWeapon); List <GameObject> toDeleteList = new List <GameObject>(); LDAGunEffect.image.enabled = false; if (isWeapon) { GeneralConfigItem colorConfig = Global.gApp.gGameData.GeneralConfigData.Get(GeneralConfigConstVal.QUALITY_COLOR); //NextGunName.text.color = ColorUtil.GetColor(colorConfig.contents[itemConfig.qualevel]); LDAGunName.text.text = FilterFactory.GetInstance().GetTinyUnfinishTips(itemConfig.opencondition); LDAGunIcon.image.sprite = Resources.Load(itemConfig.image_grow, typeof(Sprite)) as Sprite; LDASubWpIcon.image.sprite = Resources.Load(itemConfig.image_grow, typeof(Sprite)) as Sprite; LDAPetIcon.image.sprite = Resources.Load(itemConfig.image_grow, typeof(Sprite)) as Sprite; if (itemConfig.showtype == ItemTypeConstVal.BASE_MAIN_WEAPON) { LDAGunDown.image.sprite = Resources.Load(string.Format(CommonResourceConstVal.MAIN_UI_WEAPON_DOWN_PATH, itemConfig.qualevel), typeof(Sprite)) as Sprite; } else { LDAGunDown.image.sprite = Resources.Load(string.Format(CommonResourceConstVal.MAIN_UI_WEAPON_DOWN_PATH, 2), typeof(Sprite)) as Sprite; } if (LDAGunEffect.rectTransform.childCount == 0) { EffectItem effectItem = Global.gApp.gGameData.EffectData.Get(EffectConstVal.QUALITY); string effectName = itemConfig.showtype == ItemTypeConstVal.BASE_MAIN_WEAPON ? itemConfig.qualevel.ToString() : "common"; GameObject effect = UiTools.GetEffect(string.Format(effectItem.path, effectName), LDAGunEffect.rectTransform); effect.transform.GetChild(0).localPosition = new Vector3(0f, 0f, 0f); } } else { QuestItem questCfg = Global.gApp.gGameData.QuestData.Get(nextLevelDetailDTO.id); LDAGunName.text.text = FilterFactory.GetInstance().GetTinyUnfinishTips(questCfg.condition); LDAAwardIcon.image.sprite = Resources.Load(questCfg.awardIcon, typeof(Sprite)) as Sprite; LDAGunDown.image.sprite = Resources.Load(string.Format(CommonResourceConstVal.MAIN_UI_WEAPON_DOWN_PATH, 2), typeof(Sprite)) as Sprite; } }
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 Deal4Level(ItemItem itemConfig) { m_ItemConfig = itemConfig; int gunLevel = Global.gApp.gSystemMgr.GetWeaponMgr().GetWeaponLevel(itemConfig.name); int gunShowLevel = Global.gApp.gSystemMgr.GetWeaponMgr().GetWeaponShowLevel(itemConfig.name); WeaponLvTxt.text.text = "lv: " + gunShowLevel; Guns_dataItem weaponLevelData = Global.gApp.gGameData.GunDataConfig.Get(gunLevel); double[] paramValue; if (Global.gApp.gSystemMgr.GetWeaponMgr().GetQualityLv(m_ItemConfig) == 0) { paramValue = ReflectionUtil.GetValueByProperty <Guns_dataItem, double[]>(itemConfig.name, weaponLevelData); double showVal = itemConfig.showParam / itemConfig.dtime * paramValue[0]; Param1Txt.text.text = UiTools.FormateMoney(showVal); } else { paramValue = ReflectionUtil.GetValueByProperty <Guns_dataItem, double[]>(itemConfig.name + "_super", weaponLevelData); double showVal = itemConfig.showParam / itemConfig.dtime * paramValue[0]; Param1Txt.text.text = UiTools.FormateMoney(showVal); } m_WeaponName = itemConfig.name; int m_QualityLevel = itemConfig.qualevel; GeneralConfigItem colorConfig = Global.gApp.gGameData.GeneralConfigData.Get(GeneralConfigConstVal.QUALITY_COLOR); WeaponNameTxt.text.color = ColorUtil.GetColor(colorConfig.contents[m_QualityLevel]); WeaponBg.image.sprite = Resources.Load(string.Format(CommonResourceConstVal.WEAPON_BG_PATH, m_QualityLevel), typeof(Sprite)) as Sprite; if (m_QualityLevel > 0) { EffectItem effectItem = Global.gApp.gGameData.EffectData.Get(EffectConstVal.QUALITY); GameObject effect = UiTools.GetEffect(string.Format(effectItem.path, m_QualityLevel), transform); if (mEffect != null) { GameObject.Destroy(mEffect); } mEffect = effect; mEffect.transform.SetParent(WeaponIcon.rectTransform, true); if (m_IconParentNode == null) { m_IconParentNode = WeaponIcon.gameObject.transform.parent; WeaponIcon.gameObject.GetComponent <WeaponUI_Item_Follow>().SetFollowNode(m_IconParentNode); WeaponIcon.gameObject.transform.SetParent(m_Parent.GetViewPoint2().transform, true); } } }
private void InitIcon(GoodsType goods) { //Icon.image.enabled = (goods.propEffect == null || goods.propEffect == string.Empty); //if (goods.propEffect == null || goods.propEffect == string.Empty) //{ // Icon.image.sprite = Global.gApp.gResMgr.LoadAssets<Sprite>(goods.image_grow); //} //else //{ // GameObject effect = UiTools.GetEffect(goods.propEffect, Icon.rectTransform); //} var goodsRes = TableMgr.singleton.GameGoodsTable.GetItemByID((int)goods); if (goodsRes != null && !string.IsNullOrEmpty(goodsRes.propEffect)) { GameObject effect = UiTools.GetEffect(goodsRes.propEffect, Icon.rectTransform); Icon.image.enabled = false; } else { Icon.image.sprite = GameGoodsMgr.singleton.GetGameGoodsIcon(goods); Icon.image.enabled = true; } }
private void FreshWeek() { int curIndex = GetShowIndex(); List <QuestItem> configs = Global.gApp.gGameData.QuestTypeMapData[QuestConst.TYPE_LOGIN]; for (int i = (curIndex / 7) * 7; i < (curIndex / 7 + 1) * 7; i++) { QuestItemDTO questItemDTO = Global.gApp.gSystemMgr.GetQuestMgr().GetQuestItemDTO(configs[i].quest_id); RectTransform_Image_Container day = ReflectionUtil.GetValueByProperty <SevenDayUI, RectTransform_Image_Container>("day" + (i % 7 + 1), this); //20191021 陈冬要求不读取配置图片 //Image awardIcon = day.rectTransform.GetChild(1).GetComponent<Image>(); //awardIcon.sprite = Global.gApp.gResMgr.LoadAssets<Sprite>(configs[i].awardIcon); //显示物品数目 QuestItem config = Global.gApp.gGameData.QuestData.Get(configs[i].quest_id); ItemItem questAward = Global.gApp.gGameData.ItemData.Get((int)configs[i].award[0]); if (ItemTypeConstVal.isWeapon(questAward.showtype)) { day.rectTransform.Find("m_rewardGun").GetComponent <Image>().sprite = Global.gApp.gResMgr.LoadAssets <Sprite>(questAward.image_grow); day.rectTransform.Find("m_rewardGun").gameObject.SetActive(true); day.rectTransform.Find("m_reward").gameObject.SetActive(false); day.rectTransform.Find("m_Num").gameObject.SetActive(false); if (questItemDTO.state == QuestStateConstVal.CAN_RECEIVE) { Global.gApp.gSystemMgr.GetQuestMgr().ReceiveQuest(configs[i].quest_id, 1, BehaviorTypeConstVal.OPT_SEVEN_DAY_LOGIN); questItemDTO = Global.gApp.gSystemMgr.GetQuestMgr().GetQuestItemDTO(configs[i].quest_id); AfLog(configs[i].quest_id); } Transform quality = day.rectTransform.Find("m_rewardGun").transform.Find("quality"); if (quality != null) { if (questAward.showtype == ItemTypeConstVal.BASE_MAIN_WEAPON) { quality.gameObject.GetComponent <Image>().sprite = Global.gApp.gResMgr.LoadAssets <Sprite>(string.Format(CommonResourceConstVal.MAIN_UI_WEAPON_DOWN_PATH, questAward.qualevel)); } else { quality.gameObject.GetComponent <Image>().sprite = Global.gApp.gResMgr.LoadAssets <Sprite>(string.Format(CommonResourceConstVal.MAIN_UI_WEAPON_DOWN_PATH, 2)); } } Transform effect = day.rectTransform.Find("m_rewardGun").transform.Find("effect"); if (questItemDTO.state != QuestStateConstVal.RECEIVED && effect != null) { EffectItem effectItem = Global.gApp.gGameData.EffectData.Get(EffectConstVal.QUALITY); string effectName = questAward.showtype == ItemTypeConstVal.BASE_MAIN_WEAPON ? questAward.qualevel.ToString() : "common"; GameObject effectObj = UiTools.GetEffect(string.Format(effectItem.path, effectName), effect); effectObj.transform.GetChild(0).localPosition = new Vector3(0f, 0f, 0f); ParticleSystem[] pss = effectObj.GetComponentsInChildren <ParticleSystem>(); foreach (ParticleSystem ps in pss) { ps.GetComponent <Renderer>().sortingOrder = 45; } } } else { day.rectTransform.Find("m_Num").gameObject.SetActive(true); day.rectTransform.Find("m_rewardGun").gameObject.SetActive(false); day.rectTransform.Find("m_reward").gameObject.SetActive(true); } day.rectTransform.Find("m_Num").GetComponent <Text>().text = UiTools.FormateMoneyUP(config.award[1]); //已经领取 day.rectTransform.Find("m_getMask").gameObject.SetActive(questItemDTO.state == QuestStateConstVal.RECEIVED); //当前框 day.rectTransform.Find("m_current").gameObject.SetActive(i == curIndex); if (i == curIndex) { m_Cur = day; } if (i == curIndex && questItemDTO.state != QuestStateConstVal.CAN_RECEIVE) { NormalBtn.button.interactable = false; AdBtn.button.interactable = false; } } }
private void MakeProgressItem(QuestItem itemCfg, int curId, LevelDetail_progress progressUI) { float thisId = itemCfg.condition[1]; progressUI.transform.SetParent(progress.progress.transform.parent, false); progressUI.gameObject.SetActive(true); PassItem passItem = Global.gApp.gGameData.PassData.Get(m_InitId + (int)itemCfg.condition[1]); ItemItem itemItemCfg = Global.gApp.gGameData.ItemData.Get((int)itemCfg.award[0]); if (isRight) { progressUI.RightGiftBg.gameObject.SetActive(isRight); progressUI.RightGift.gameObject.SetActive(isRight); } else { if (itemCfg.condition[1] == curId) { progressUI.mask.image.fillAmount = 0.5f; } else if (itemCfg.condition[1] < curId) { progressUI.mask.image.fillAmount = 1f; } else { progressUI.mask.image.fillAmount = 0f; } progressUI.LeftGiftBg.gameObject.SetActive(!isRight); progressUI.LeftGift.gameObject.SetActive(!isRight); } if (isRight) { progressUI.RightRetry.button.onClick.AddListener(() => { OnStartGame(passItem.id); }); progressUI.RightRetry.gameObject.SetActive(passItem.id < Global.gApp.gSystemMgr.GetPassMgr().GetCurPassId()); } else { progressUI.LeftRetry.button.onClick.AddListener(() => { OnStartGame(passItem.id); }); progressUI.LeftRetry.gameObject.SetActive(passItem.id < Global.gApp.gSystemMgr.GetPassMgr().GetCurPassId()); } QuestItemDTO questItemDTO = Global.gApp.gSystemMgr.GetQuestMgr().GetQuestItemDTO(itemCfg.quest_id); Image giftImageBg = isRight ? progressUI.RightBgImg.image : progressUI.LeftBgImg.image; giftImageBg.rectTransform.Rotate(new Vector3(0, 180, 0)); giftImageBg.sprite = Resources.Load(string.Format(CommonResourceConstVal.LEVEL_DETAIL_BG_PATH, passItem.dtType, 0), typeof(Sprite)) as Sprite; if (passItem.dtType != 4) { if (m_EffectIndex == m_EffectShowIndex) { string effctUri; if (m_DtEffectDtc.TryGetValue(passItem.dtType.ToString(), out effctUri)) { GameObject effect = UiTools.GetEffect(effctUri, giftImageBg.transform, 45); } m_EffectShowIndex = m_EffectIndex + UnityEngine.Random.Range(2, 4); } m_EffectIndex++; } Image giftImage = isRight ? progressUI.RightGift.image : progressUI.LeftGift.image; giftImage.sprite = Resources.Load(itemItemCfg.closeBoxImg, typeof(Sprite)) as Sprite; Image openedImage = isRight ? progressUI.RightOpened.image : progressUI.LeftOpened.image; Image awardBgImage = isRight ? progressUI.RightAwardBg.image : progressUI.LeftAwardBg.image; if (questItemDTO.state == QuestStateConstVal.RECEIVED) { openedImage.gameObject.SetActive(true); } else { openedImage.gameObject.SetActive(false); } Text text = isRight ? progressUI.RightNum.text : progressUI.LeftNum.text; text.text = ((int)itemCfg.condition[1]).ToString(); if (thisId >= curId) { giftImageBg.color = ColorUtil.GetTextColor(false, Global.gApp.gGameData.GeneralConfigData.Get(GeneralConfigConstVal.GREY_COLOR).content); giftImage.color = ColorUtil.GetTextColor(false, Global.gApp.gGameData.GeneralConfigData.Get(GeneralConfigConstVal.GREY_COLOR).content); openedImage.color = ColorUtil.GetTextColor(false, Global.gApp.gGameData.GeneralConfigData.Get(GeneralConfigConstVal.GREY_COLOR).content); awardBgImage.color = ColorUtil.GetTextColor(false, Global.gApp.gGameData.GeneralConfigData.Get(GeneralConfigConstVal.GREY_COLOR).content); } RectTransform levelBg = isRight ? progressUI.RightLevel.rectTransform : progressUI.LeftLevel.rectTransform; SetPassIcon(levelBg, passItem, m_InitId + curId); }
private void MakeNormalProgress(int id, int curId, LevelDetail_progress curProgressUI) { curProgressUI.transform.SetParent(progress.progress.transform.parent, false); curProgressUI.gameObject.SetActive(true); PassItem passItem = Global.gApp.gGameData.PassData.Get(m_InitId + id); if (isRight) { curProgressUI.RightGiftBg.gameObject.SetActive(isRight); m_BgIndex++; } else { if (id == curId) { curProgressUI.mask.image.fillAmount = 0.5f; } else if (id < curId) { curProgressUI.mask.image.fillAmount = 1f; } else { curProgressUI.mask.image.fillAmount = 0f; } curProgressUI.LeftGiftBg.gameObject.SetActive(!isRight); m_BgIndex++; } if (isRight) { curProgressUI.RightRetry.button.onClick.AddListener(() => { OnStartGame(m_InitId + id); }); curProgressUI.RightRetry.gameObject.SetActive(m_InitId + id < Global.gApp.gSystemMgr.GetPassMgr().GetCurPassId()); } else { curProgressUI.LeftRetry.button.onClick.AddListener(() => { OnStartGame(m_InitId + id); }); curProgressUI.LeftRetry.gameObject.SetActive(m_InitId + id < Global.gApp.gSystemMgr.GetPassMgr().GetCurPassId()); } Text text = isRight ? curProgressUI.RightNum.text : curProgressUI.LeftNum.text; text.text = id.ToString(); Image giftImageBg = isRight ? curProgressUI.RightBgImg.image : curProgressUI.LeftBgImg.image; giftImageBg.rectTransform.Rotate(new Vector3(0, 180, 0)); int ri = (m_BgIndex % 3) + 1; giftImageBg.sprite = Resources.Load(string.Format(CommonResourceConstVal.LEVEL_DETAIL_BG_PATH, passItem.dtType, ri), typeof(Sprite)) as Sprite; if (passItem.dtType == 4 && ri == 2) { string effctUri; if (m_DtEffectDtc.TryGetValue(passItem.dtType.ToString(), out effctUri)) { GameObject effect = UiTools.GetEffect(effctUri, giftImageBg.transform, 45); } } else if (passItem.dtType != 4) { if (m_EffectIndex == m_EffectShowIndex) { string effctUri; if (m_DtEffectDtc.TryGetValue(passItem.dtType.ToString(), out effctUri)) { GameObject effect = UiTools.GetEffect(effctUri, giftImageBg.transform, 45); } m_EffectShowIndex = m_EffectIndex + UnityEngine.Random.Range(2, 4); } m_EffectIndex++; } Image giftImage = isRight ? curProgressUI.RightGift.image : curProgressUI.LeftGift.image; Image openedImage = isRight ? curProgressUI.RightOpened.image : curProgressUI.LeftOpened.image; openedImage.gameObject.SetActive(false); Image awardBgImage = isRight ? curProgressUI.RightAwardBg.image : curProgressUI.LeftAwardBg.image; awardBgImage.gameObject.SetActive(false); if (id >= curId) { giftImageBg.color = ColorUtil.GetTextColor(false, Global.gApp.gGameData.GeneralConfigData.Get(GeneralConfigConstVal.GREY_COLOR).content); giftImage.color = ColorUtil.GetTextColor(false, Global.gApp.gGameData.GeneralConfigData.Get(GeneralConfigConstVal.GREY_COLOR).content); openedImage.color = ColorUtil.GetTextColor(false, Global.gApp.gGameData.GeneralConfigData.Get(GeneralConfigConstVal.GREY_COLOR).content); awardBgImage.color = ColorUtil.GetTextColor(false, Global.gApp.gGameData.GeneralConfigData.Get(GeneralConfigConstVal.GREY_COLOR).content); } RectTransform levelBg = isRight ? curProgressUI.RightLevel.rectTransform : curProgressUI.LeftLevel.rectTransform; SetPassIcon(levelBg, passItem, m_InitId + curId); }
private void ShowStepUI(int stepId) { isRight = false; int index = stepId == 0 ? 0 : m_StepIndexDic[stepId - 1]; if (stepId == -1) { m_UserStep = Global.gApp.gSystemMgr.GetPassMgr().GetUserStep(); m_CurStep = m_UserStep; } else { m_CurStep = stepId; } int stepStart = m_CurStep == 0 ? 1 : Global.gApp.gGameData.PassStep[m_CurStep - 1] + 1 - m_InitId; int stepEnd = Global.gApp.gGameData.PassStep[m_CurStep] - m_InitId; List <QuestItem> configs = Global.gApp.gGameData.QuestTypeMapData[QuestConst.TYPE_LEVEL_DETAIL]; int curId = Global.gApp.gSystemMgr.GetPassMgr().GetCurPassId() - m_InitId; //显示顶部标识 LevelDetail_step stepUI = Instantiate <LevelDetail_step>(step.step); stepUI.StepName.gameObject.SetActive(false); m_ScrolViewList[index] = stepUI; stepUI.transform.localPosition = new Vector3(Viewport.rectTransform.rect.size.x / 2, m_ScrolViewHeightList[index], stepUI.transform.localPosition.z); index++; stepUI.transform.SetParent(step.step.transform.parent, false); PassItem passItemCfg = Global.gApp.gGameData.PassData.Get(Global.gApp.gGameData.PassStep[m_CurStep]); string bgIndex = System.Text.RegularExpressions.Regex.Replace(passItemCfg.mainUIbg, @"[^0-9]+", ""); stepUI.StepIcon.image.sprite = Resources.Load(string.Format(CommonResourceConstVal.RESOURCE_LEVEL_DETAIL_ICON, bgIndex), typeof(Sprite)) as Sprite; string effctUri; if (m_IconEffectDtc.TryGetValue(bgIndex, out effctUri)) { GameObject effect = UiTools.GetEffect(effctUri, stepUI.transform, 45); } stepUI.gameObject.SetActive(true); //stepUI.GunItem.gameObject.SetActive(i != configs.Count - 1); for (int i = stepStart; i <= stepEnd; i++) { QuestItem questItemCfg = null; ItemItem iCfg = null; bool isWeapon = false; passQuestDic.TryGetValue(i, out questItemCfg); if (questItemCfg != null) { iCfg = Global.gApp.gGameData.ItemData.Get((int)questItemCfg.award[0]); isWeapon = ItemTypeConstVal.isWeapon(iCfg.showtype); } if (isWeapon) { LevelDetail_gun gunUI = Instantiate <LevelDetail_gun>(gun.gun); gunUI.transform.SetParent(gun.gun.transform.parent, false); gunUI.gameObject.SetActive(true); gunUI.num.text.text = i.ToString(); int passId = m_InitId + int.Parse(gunUI.num.text.text); gunUI.GunRetry.button.onClick.AddListener(() => { OnStartGame(passId); }); gunUI.GunRetry.gameObject.SetActive(passId < Global.gApp.gSystemMgr.GetPassMgr().GetCurPassId()); gunUI.GunIcon.image.sprite = Resources.Load(iCfg.image_grow, typeof(Sprite)) as Sprite; gunUI.GunBottom.image.sprite = Resources.Load(string.Format(CommonResourceConstVal.MAIN_UI_WEAPON_DOWN_PATH, iCfg.qualevel), typeof(Sprite)) as Sprite; string effectName = iCfg.showtype == ItemTypeConstVal.BASE_MAIN_WEAPON ? iCfg.qualevel.ToString() : "common"; EffectItem effectItem = Global.gApp.gGameData.EffectData.Get(EffectConstVal.QUALITY); GameObject gunEffect = UiTools.GetEffect(string.Format(effectItem.path, iCfg.qualevel), gunUI.EffectNode.rectTransform); gunEffect.transform.GetChild(0).localPosition = new Vector3(0f, 0f, 0f); ParticleSystem[] pss = gunEffect.GetComponentsInChildren <ParticleSystem>(); foreach (ParticleSystem ps in pss) { ps.GetComponent <Renderer>().sortingOrder = 45; } PassItem passItem = Global.gApp.gGameData.PassData.Get(m_InitId + (int)questItemCfg.condition[1]); SetPassIcon(gunUI.level.rectTransform, passItem, m_InitId + curId); if (isRight) { index++; } m_ScrolViewList[index] = gunUI; gunUI.transform.localPosition = new Vector3(Viewport.rectTransform.rect.size.x / 2, m_ScrolViewHeightList[index], gunUI.transform.localPosition.z); index++; isRight = false; if (i >= curId) { gunUI.GunIcon.image.color = ColorUtil.GetTextColor(false, Global.gApp.gGameData.GeneralConfigData.Get(GeneralConfigConstVal.BLACK_COLOR).content); gunUI.GunName.text.text = "???"; GeneralConfigItem colorConfig = Global.gApp.gGameData.GeneralConfigData.Get(GeneralConfigConstVal.BLACK_COLOR); gunUI.GunName.text.color = ColorUtil.GetColor(colorConfig.content); GeneralConfigItem color1Config = Global.gApp.gGameData.GeneralConfigData.Get(GeneralConfigConstVal.BLACK_1_COLOR); gunUI.GunBottom.image.color = ColorUtil.GetColor(color1Config.content); } else { gunUI.GunName.text.text = iCfg.gamename; GeneralConfigItem colorConfig = Global.gApp.gGameData.GeneralConfigData.Get(GeneralConfigConstVal.QUALITY_COLOR); //gunUI.GunName.text.color = ColorUtil.GetColor(colorConfig.contents[iCfg.qualevel]); if (iCfg.showtype == ItemTypeConstVal.BASE_MAIN_WEAPON) { gunUI.GunBottom.image.sprite = Resources.Load(string.Format(CommonResourceConstVal.MAIN_UI_WEAPON_DOWN_PATH, iCfg.qualevel), typeof(Sprite)) as Sprite; gunUI.GunName.text.color = ColorUtil.GetColor(colorConfig.contents[iCfg.qualevel]); } else { gunUI.GunBottom.image.sprite = Resources.Load(string.Format(CommonResourceConstVal.MAIN_UI_WEAPON_DOWN_PATH, 2), typeof(Sprite)) as Sprite; gunUI.GunName.text.color = ColorUtil.GetColor(colorConfig.contents[2]); } } } else { //有奖励 QuestItem questItem; LevelDetail_progress progressUI; if (!isRight) { progressUI = Instantiate <LevelDetail_progress>(progress.progress); progressUI.LeftGiftBg.gameObject.SetActive(false); progressUI.RightGiftBg.gameObject.SetActive(false); progressUI.LeftGift.gameObject.SetActive(false); progressUI.RightGift.gameObject.SetActive(false); m_ScrolViewList[index] = progressUI; } else { progressUI = m_ScrolViewList[index] as LevelDetail_progress; } if (passQuestDic.TryGetValue(i, out questItem)) { MakeProgressItem(questItem, curId, progressUI); } else { MakeNormalProgress(i, curId, progressUI); } progressUI.transform.localPosition = new Vector3(Viewport.rectTransform.rect.size.x / 2, m_ScrolViewHeightList[index], progressUI.transform.localPosition.z); if (isRight) { index++; } isRight = !isRight; } } if (m_CurStep == m_UserStep && m_UserStep < Global.gApp.gGameData.PassStep.Count - 1) { LevelDetail_step nextStepUI = Instantiate <LevelDetail_step>(step.step); nextStepUI.StepName.gameObject.SetActive(true); m_ScrolViewList[m_ScrolViewHeightList.Count - 1] = stepUI; nextStepUI.transform.localPosition = new Vector3(Viewport.rectTransform.rect.size.x / 2, m_ScrolViewHeightList[m_ScrolViewHeightList.Count - 1], nextStepUI.transform.localPosition.z); nextStepUI.transform.SetParent(step.step.transform.parent, false); PassItem nextPassItemCfg = Global.gApp.gGameData.PassData.Get(Global.gApp.gGameData.PassStep[m_CurStep + 1]); string nextBgIndex = System.Text.RegularExpressions.Regex.Replace(nextPassItemCfg.mainUIbg, @"[^0-9]+", ""); nextStepUI.StepIcon.image.sprite = Resources.Load(string.Format(CommonResourceConstVal.RESOURCE_LEVEL_DETAIL_ICON, nextBgIndex), typeof(Sprite)) as Sprite; nextStepUI.gameObject.SetActive(true); nextStepUI.StepIcon.image.color = ColorUtil.GetTextColor(false, Global.gApp.gGameData.GeneralConfigData.Get(GeneralConfigConstVal.GREY_COLOR).content); string nextEffctUri; if (m_IconEffectDtc.TryGetValue(nextBgIndex, out nextEffctUri)) { GameObject effect = UiTools.GetEffect(nextEffctUri, nextStepUI.transform, 45); } } isRight = false; //显示顶部标识 //LevelDetail_boss bossUI = Instantiate<LevelDetail_boss>(boss.boss); //m_ScrolViewList.Add(bossUI); //m_ScrolViewHeightList.Add(-m_Height - boss.rectTransform.sizeDelta.y / 2); //bossUI.transform.SetParent(boss.boss.transform.parent, false); //m_Height += boss.rectTransform.sizeDelta.y; //bossUI.gameObject.SetActive(true); }
public void UIFresh() { if (m_ItemConfig == null) { return; } int lv = Global.gApp.gSystemMgr.GetWeaponMgr().GetWeaponLevel(m_ItemConfig.name); int state = Global.gApp.gSystemMgr.GetWeaponMgr().GetWeaponOpenState(m_ItemConfig.name); int filterType = Convert.ToInt32(m_ItemConfig.opencondition[0]); GunsSub_dataItem lvCfg = Global.gApp.gGameData.GunSubDataConfig.Get(lv); //SubLvtxt //passProgress //BtnUnlock //BtnUpgrade //Unlocktxt //Moneyiconbtn //Moneycostbtn //m_Lock //SubWeaponIcon bottom.image.sprite = Global.gApp.gResMgr.LoadAssets <Sprite>(string.Format(CommonResourceConstVal.SUB_BOTTOM, m_ItemConfig.qualevel)); if (Effect.rectTransform.childCount == 0) { EffectItem effectItem = Global.gApp.gGameData.EffectData.Get(EffectConstVal.SUB_EFFECT); GameObject effect = UiTools.GetEffect(string.Format(effectItem.path, m_ItemConfig.qualevel), Effect.rectTransform); } PetWeaponBg.image.sprite = Global.gApp.gResMgr.LoadAssets <Sprite>(string.Format(CommonResourceConstVal.SUB_BG, m_ItemConfig.qualevel)); if (filterType != FilterTypeConstVal.CUR_ITEM_NUM) { //if (state == WeaponStateConstVal.NONE && FilterFactory.GetInstance().Filter(m_ItemConfig.opencondition)) //{ // state = WeaponStateConstVal.NEW; // Global.gApp.gSystemMgr.GetWeaponMgr().SetWeaponOpenState(m_ItemConfig.name, state); //} //应该显示解锁 bool unLock = state == WeaponStateConstVal.NEW || state == WeaponStateConstVal.EXIST; PetLvtxt.gameObject.SetActive(unLock); progress_bg.gameObject.SetActive(false); BtnUnlock.gameObject.SetActive(false); BtnUpgrade.gameObject.SetActive(unLock); Unlocktxt.gameObject.SetActive(!unLock); Moneyiconbtn.gameObject.SetActive(unLock); Moneycostbtn.gameObject.SetActive(unLock); m_Lock.gameObject.SetActive(!unLock); PetWeaponIcon.gameObject.SetActive(true); PetWeaponIcon.image.color = unLock ? ColorUtil.GetColor(ColorUtil.m_DeaultColor) : ColorUtil.GetColor(ColorUtil.m_WhiteColor); AtkMsg.gameObject.SetActive(unLock); } else { //应该显示解锁 bool unLock = state == WeaponStateConstVal.NEW || state == WeaponStateConstVal.EXIST; PetLvtxt.gameObject.SetActive(unLock); progress_bg.gameObject.SetActive(false); BtnUnlock.gameObject.SetActive(!unLock); BtnUpgrade.gameObject.SetActive(unLock); Unlocktxt.gameObject.SetActive(false); Moneyiconbtn.gameObject.SetActive(true); Moneycostbtn.gameObject.SetActive(true); m_Lock.gameObject.SetActive(!unLock); PetWeaponIcon.gameObject.SetActive(true); PetWeaponIcon.image.color = unLock ? ColorUtil.GetColor(ColorUtil.m_DeaultColor) : ColorUtil.GetColor(ColorUtil.m_WhiteColor); AtkMsg.gameObject.SetActive(unLock); } Unlocktxt.text.text = FilterFactory.GetInstance().GetMiddleUnfinishTips(m_ItemConfig.opencondition); PetLvtxt.text.text = "LV:" + lv; if (lvCfg != null) { if (filterType == FilterTypeConstVal.CUR_ITEM_NUM && state == WeaponStateConstVal.NONE) { int itemId = Convert.ToInt32(m_ItemConfig.opencondition[1]); double unlockItemNum = Convert.ToDouble(m_ItemConfig.opencondition[2]); m_ReduceItemDTO = new ItemDTO(itemId, unlockItemNum, BehaviorTypeConstVal.OPT_WEAPON_UNLOCK); double itemCount = GameItemFactory.GetInstance().GetItem(itemId); passProgress.image.fillAmount = (float)(itemCount / unlockItemNum); Moneyiconbtn.image.sprite = Global.gApp.gResMgr.LoadAssets <Sprite>(string.Format(CommonResourceConstVal.RESOURCE_PATH, itemId)); Moneycostbtn.text.text = UiTools.FormateMoney(unlockItemNum); Moneycostbtn.text.color = ColorUtil.GetTextColor(itemCount < unlockItemNum, null); } else { double[] costValue = ReflectionUtil.GetValueByProperty <GunsSub_dataItem, double[]>("base_cost_" + m_ItemConfig.qualevel, lvCfg); int itemId = Convert.ToInt32(costValue[0]); double unlockItemNum = Convert.ToDouble(costValue[1]); m_ReduceItemDTO = new ItemDTO(itemId, unlockItemNum, BehaviorTypeConstVal.OPT_WEAPON_LEVEL_UP); double itemCount = GameItemFactory.GetInstance().GetItem(itemId); passProgress.image.fillAmount = (float)(itemCount / unlockItemNum); Moneyiconbtn.image.sprite = Global.gApp.gResMgr.LoadAssets <Sprite>(string.Format(CommonResourceConstVal.RESOURCE_PATH, itemId)); Moneycostbtn.text.text = UiTools.FormateMoney(unlockItemNum); Moneycostbtn.text.color = ColorUtil.GetTextColor(itemCount < unlockItemNum, null); } double[] prm = ReflectionUtil.GetValueByProperty <GunsSub_dataItem, double[]>("base_params_" + m_ItemConfig.qualevel, lvCfg); Atk.text.text = string.Format("{0}%", (prm[0] * 100).ToString()); if (Global.gApp.gGameData.GunSubDataConfig.Get(lv + 1) == null) { MaxLevel(lv); } } else { MaxLevel(lv); } PetUp.gameObject.SetActive(Global.gApp.gSystemMgr.GetWeaponMgr().CanUpdateWeapon(m_ItemConfig)); NewPet.gameObject.SetActive(state == WeaponStateConstVal.NEW); NewIMG_pet.gameObject.SetActive(state == WeaponStateConstVal.NEW); }
private void OnLevelUp() { //InfoCLogUtil.instance.SendClickLog(ClickEnum.WEAPON_UPDATE); OnEquip(); ItemItem itemConfig = Global.gApp.gGameData.GetItemDataByName(m_WeaponName); int gunLevel = Global.gApp.gSystemMgr.GetWeaponMgr().GetWeaponLevel(itemConfig.name); int roleLevel = Global.gApp.gSystemMgr.GetBaseAttrMgr().GetLevel(); int errorCode = Global.gApp.gSystemMgr.GetWeaponMgr().CanLevelUp(m_WeaponName); if (errorCode > 0) { Global.gApp.gMsgDispatcher.Broadcast <int>(MsgIds.ShowGameTipsByID, errorCode); 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_WEAPON_LEVEL_UP); reduceItemDTO.paramStr1 = m_WeaponName; reduceItemDTO.paramStr2 = gunLevel.ToString(); GameItemFactory.GetInstance().ReduceItem(reduceItemDTO); reduceResult = reduceItemDTO.result; if (!reduceResult) { Global.gApp.gMsgDispatcher.Broadcast <int>(MsgIds.ShowGameTipsByID, 1006); return; } bool levelUpResult = Global.gApp.gSystemMgr.GetWeaponMgr().LevelUp(m_WeaponName); if (levelUpResult) { Deal4Level(itemConfig); EffectItem effectItem = Global.gApp.gGameData.EffectData.Get(EffectConstVal.WEAPON_LEVEL_IP); GameObject effect = UiTools.GetEffect(effectItem.path, transform); GameObject.Destroy(effect, 3f); } else { ItemDTO addItemDTO = new ItemDTO(m_ConsumItemId, Convert.ToSingle(costValue[1]), BehaviorTypeConstVal.OPT_WEAPON_LEVEL_UP); addItemDTO.paramStr1 = m_WeaponName; addItemDTO.paramStr2 = "MakeUp4Fail"; GameItemFactory.GetInstance().AddItem(addItemDTO); } Global.gApp.gMsgDispatcher.Broadcast(MsgIds.UIFresh); }
private void Deal4Level(ItemItem itemConfig) { m_ItemConfig = itemConfig; int gunLevel = Global.gApp.gSystemMgr.GetWeaponMgr().GetWeaponLevel(itemConfig.name); int gunShowLevel = Global.gApp.gSystemMgr.GetWeaponMgr().GetWeaponShowLevel(itemConfig.name); WeaponLvTxt.text.text = "lv: " + gunShowLevel; Guns_dataItem weaponLevelData = Global.gApp.gGameData.GunDataConfig.Get(gunLevel); double[] costValue = ReflectionUtil.GetValueByProperty <Guns_dataItem, double[]>(itemConfig.name + "_cost", weaponLevelData); CmNum.text.text = UiTools.FormateMoney(costValue[1]); CmNum.text.color = ColorUtil.GetTextColor(GameItemFactory.GetInstance().GetItem((int)costValue[0]) < costValue[1], m_CM_COLOR); CmIcon.image.sprite = Global.gApp.gResMgr.LoadAssets <Sprite>(string.Format(CommonResourceConstVal.RESOURCE_PATH, costValue[0])); m_ConsumItemId = (int)costValue[0]; double[] paramValue; if (Global.gApp.gSystemMgr.GetWeaponMgr().GetQualityLv(m_ItemConfig) == 0) { paramValue = ReflectionUtil.GetValueByProperty <Guns_dataItem, double[]>(itemConfig.name, weaponLevelData); double showVal = itemConfig.showParam / itemConfig.dtime * paramValue[0]; Param1Txt.text.text = UiTools.FormateMoney(showVal); } else { paramValue = ReflectionUtil.GetValueByProperty <Guns_dataItem, double[]>(itemConfig.name + "_super", weaponLevelData); double showVal = itemConfig.showParam / itemConfig.dtime * paramValue[0]; Param1Txt.text.text = UiTools.FormateMoney(showVal); } if (paramValue.Length <= 1) { Param2Txt.text.text = "None"; } else { Param2Txt.text.text = paramValue[1].ToString(); } m_WeaponName = itemConfig.name; int m_QualityLevel = itemConfig.qualevel; GeneralConfigItem colorConfig = Global.gApp.gGameData.GeneralConfigData.Get(GeneralConfigConstVal.QUALITY_COLOR); WeaponNameTxt.text.color = ColorUtil.GetColor(colorConfig.contents[m_QualityLevel]); WeaponBg.image.sprite = Resources.Load(string.Format(CommonResourceConstVal.WEAPON_BG_PATH, m_QualityLevel), typeof(Sprite)) as Sprite; if (m_QualityLevel > 0) { EffectItem effectItem = Global.gApp.gGameData.EffectData.Get(EffectConstVal.QUALITY); GameObject effect = UiTools.GetEffect(string.Format(effectItem.path, m_QualityLevel), transform); if (mEffect != null) { GameObject.Destroy(mEffect); } mEffect = effect; mEffect.transform.SetParent(WeaponIcon.rectTransform, true); if (m_IconParentNode == null) { m_IconParentNode = WeaponIcon.gameObject.transform.parent; WeaponIcon.gameObject.GetComponent <WeaponUI_Item_Follow>().SetFollowNode(m_IconParentNode); WeaponIcon.gameObject.transform.SetParent(m_Parent.GetViewPoint2().transform, true); } } //if (m_QualityLevel < itemConfig.qualevel.Length - 1 && gunLevel - itemConfig.qualevel[m_QualityLevel] <= itemConfig.qualevel[m_QualityLevel + 1] - itemConfig.qualevel[m_QualityLevel]) //{ // LvPro.image.fillAmount = (float)(gunLevel - itemConfig.qualevel[m_QualityLevel]) / (itemConfig.qualevel[m_QualityLevel + 1] - itemConfig.qualevel[m_QualityLevel]); //} //else if (m_QualityLevel >= itemConfig.qualevel.Length - 1) //{ // LvPro.image.fillAmount = 0; //} //else //{ // LvPro.image.fillAmount = 1; //} }
public override void Init <T>(string name, UIInfo info, T arg) { base.Init(name, info, arg); m_NextGunCfg = arg as ItemItem; bool isWeapon = ItemTypeConstVal.isWeapon(m_NextGunCfg.showtype); NextGunName.gameObject.SetActive(isWeapon); NextGunIcon.gameObject.SetActive(isWeapon); //NextGunDown.gameObject.SetActive(isWeapon); NextAwardIcon.gameObject.SetActive(!isWeapon); if (isWeapon) { TitleTxt.text.text = Global.gApp.gGameData.GetTipsInCurLanguage(3083); GeneralConfigItem colorConfig = Global.gApp.gGameData.GeneralConfigData.Get(GeneralConfigConstVal.QUALITY_COLOR); NextGunName.text.text = m_NextGunCfg.gamename; NextGunIcon.image.sprite = Resources.Load(m_NextGunCfg.image_grow, typeof(Sprite)) as Sprite; if (m_NextGunCfg.showtype == ItemTypeConstVal.BASE_MAIN_WEAPON) { NextGunDown.image.sprite = Resources.Load(string.Format(CommonResourceConstVal.MAIN_UI_WEAPON_DOWN_PATH, m_NextGunCfg.qualevel), typeof(Sprite)) as Sprite; NextGunName.text.color = ColorUtil.GetColor(colorConfig.contents[m_NextGunCfg.qualevel]); } else { NextGunDown.image.sprite = Resources.Load(string.Format(CommonResourceConstVal.MAIN_UI_WEAPON_DOWN_PATH, 2), typeof(Sprite)) as Sprite; NextGunName.text.color = ColorUtil.GetColor(colorConfig.contents[2]); } //NextGunDown.image.sprite = Resources.Load(string.Format(CommonResourceConstVal.MAIN_UI_WEAPON_DOWN_PATH, m_NextGunCfg.qualevel), typeof(Sprite)) as Sprite; EffectItem effectItem = Global.gApp.gGameData.EffectData.Get(EffectConstVal.QUALITY); string effectName = m_NextGunCfg.showtype == ItemTypeConstVal.BASE_MAIN_WEAPON ? m_NextGunCfg.qualevel.ToString() : "common"; m_Effect = UiTools.GetEffect(string.Format(effectItem.path, effectName), NextDay.rectTransform); Destxt.text.text = FilterFactory.GetInstance().GetMiddleUnfinishTips(m_NextGunCfg.opencondition); LeftTxt.text.text = FilterFactory.GetInstance().GetLeftTips(m_NextGunCfg.opencondition); m_Effect.transform.GetChild(0).localPosition = new Vector3(0f, 0f, 0f); ParticleSystem[] pss = m_Effect.GetComponentsInChildren <ParticleSystem>(); foreach (ParticleSystem ps in pss) { ps.GetComponent <Renderer>().sortingOrder = 45; } } else { TitleTxt.text.text = Global.gApp.gGameData.GetTipsInCurLanguage(3084); QuestItemDTO nextLevelDetailDTO = Global.gApp.gSystemMgr.GetQuestMgr().GetNextLevelDetailQuest(); QuestItem questCfg = Global.gApp.gGameData.QuestData.Get(nextLevelDetailDTO.id); NextAwardIcon.image.sprite = Resources.Load(questCfg.awardIcon, typeof(Sprite)) as Sprite; Destxt.text.text = FilterFactory.GetInstance().GetMiddleUnfinishTips(questCfg.condition); LeftTxt.text.text = FilterFactory.GetInstance().GetLeftTips(questCfg.condition); NextGunDown.image.sprite = Resources.Load(string.Format(CommonResourceConstVal.MAIN_UI_WEAPON_DOWN_PATH, 2), typeof(Sprite)) as Sprite; } Btn2.button.onClick.AddListener(TouchClose); BtnC.button.onClick.AddListener(TouchClose); base.ChangeLanguage(); }
private void OnUpdateLevel() { int gunLevel = Global.gApp.gSystemMgr.GetWeaponMgr().GetWeaponLevel(m_ItemConfig.name); int roleLevel = Global.gApp.gSystemMgr.GetBaseAttrMgr().GetLevel(); int state = Global.gApp.gSystemMgr.GetWeaponMgr().GetWeaponOpenState(m_ItemConfig.name); int filterType = Convert.ToInt32(m_ItemConfig.opencondition[0]); bool unlockNow = false; if (filterType == FilterTypeConstVal.CUR_ITEM_NUM) { if (state == WeaponStateConstVal.NONE && FilterFactory.GetInstance().Filter(m_ItemConfig.opencondition)) { unlockNow = true; state = WeaponStateConstVal.NEW; Global.gApp.gSystemMgr.GetWeaponMgr().SetWeaponOpenState(m_ItemConfig.name, state); } } int errorCode = Global.gApp.gSystemMgr.GetWeaponMgr().CanLevelUpSub(m_WeaponName); if (errorCode > 0) { if (errorCode == 1008) { ItemItem reduceCfg = Global.gApp.gGameData.ItemData.Get(m_ReduceItemDTO.itemId); Global.gApp.gMsgDispatcher.Broadcast <int, string>(MsgIds.ShowGameTipsByIDAndParam, errorCode, Global.gApp.gGameData.GetTipsInCurLanguage(reduceCfg.sourceLanguage)); } else { Global.gApp.gMsgDispatcher.Broadcast <int>(MsgIds.ShowGameTipsByID, errorCode); } return; } GunsSub_dataItem levelItem = Global.gApp.gGameData.GunSubDataConfig.Get(gunLevel); GunsSub_dataItem nextLevelItem = Global.gApp.gGameData.GunSubDataConfig.Get(gunLevel + 1); double[] nextValue = ReflectionUtil.GetValueByProperty <GunsSub_dataItem, double[]>("base_cost_" + m_ItemConfig.qualevel, nextLevelItem); if (nextValue == null || nextValue.Length == 0) { Global.gApp.gMsgDispatcher.Broadcast <int>(MsgIds.ShowGameTipsByID, 1004); return; } //是否成功扣钱 bool reduceResult = false; m_ReduceItemDTO.paramStr1 = m_WeaponName; m_ReduceItemDTO.paramStr2 = gunLevel.ToString(); GameItemFactory.GetInstance().ReduceItem(m_ReduceItemDTO); reduceResult = m_ReduceItemDTO.result; if (!reduceResult) { ItemItem reduceItemCfg = Global.gApp.gGameData.ItemData.Get(m_ReduceItemDTO.itemId); Global.gApp.gMsgDispatcher.Broadcast <int, string>(MsgIds.ShowGameTipsByIDAndParam, 1008, Global.gApp.gGameData.GetTipsInCurLanguage(reduceItemCfg.sourceLanguage)); return; } bool levelUpResult = false; if (unlockNow) { levelUpResult = true; //InfoCLogUtil.instance.SendClickLog(ClickEnum.WEAPON_PET_UNLOCK); } else { levelUpResult = Global.gApp.gSystemMgr.GetWeaponMgr().LevelUp(m_WeaponName); //InfoCLogUtil.instance.SendClickLog(ClickEnum.WEAPON_PET_UPDATE); } if (levelUpResult) { EffectItem effectItem = Global.gApp.gGameData.EffectData.Get(EffectConstVal.WEAPON_LEVEL_IP); GameObject effect = UiTools.GetEffect(effectItem.path, transform); effect.transform.GetChild(0).localPosition = new Vector3(0f, 0f, 0f); GameObject.Destroy(effect, 3f); } else { ItemDTO addItemDTO = new ItemDTO(m_ReduceItemDTO.itemId, m_ReduceItemDTO.num, BehaviorTypeConstVal.OPT_WEAPON_LEVEL_UP); addItemDTO.paramStr1 = m_WeaponName; addItemDTO.paramStr2 = "MakeUp4Fail"; GameItemFactory.GetInstance().AddItem(addItemDTO); } //OnEquip(); Global.gApp.gMsgDispatcher.Broadcast(MsgIds.UIFresh); }
private void InitNode() { ItemBig.gameObject.SetActive(false); ItemSmall.gameObject.SetActive(false); TopItemDetail.gameObject.SetActive(false); ItemDetail.gameObject.SetActive(false); maskBtn.gameObject.SetActive(true); int totalNum = Global.gApp.gSystemMgr.GetNpcMgr().GetTotalNum(); m_CampLevel = Global.gApp.gGameData.GetCampLevel(totalNum); //营地技能初始化 for (int i = 0; i < Global.gApp.gGameData.CampBuffConfig.items.Length; i++) { CampBuffItem cbi = Global.gApp.gGameData.CampBuffConfig.items[i]; RectTransform_Image_Container titleLockIcon = ReflectionUtil.GetValueByProperty <CampBUFF, RectTransform_Image_Container>("lock" + cbi.campLevel, this); titleLockIcon.gameObject.SetActive(m_CampLevel < cbi.campLevel); SkillItemDTO dto; Global.gApp.gSystemMgr.GetNpcMgr().CampBuffMap.TryGetValue(cbi.id, out dto); RectTransform_Button_Image_Container con = ReflectionUtil.GetValueByProperty <CampBUFF, RectTransform_Button_Image_Container>(cbi.id, this); RectTransform rt; bool lockBuff = Global.gApp.gSystemMgr.GetNpcMgr().LockBuff(dto); if (i == 0) { CampBUFF_ItemBig item = ItemBig.GetInstance(); item.gameObject.SetActive(true); item.rectTransform().SetParent(con.rectTransform); item.rectTransform().offsetMax = new Vector2(0, 0); item.rectTransform().offsetMin = new Vector2(0, 0); CampBUFF_TopItemDetail itemDetail = TopItemDetail.GetInstance(); itemDetail.rectTransform().position = new Vector3(item.rectTransform().position.x, con.rectTransform.position.y + 1.5f, item.rectTransform().position.z); TopName.text.text = Global.gApp.gGameData.GetTipsInCurLanguage(cbi.name); itemDetail.name.text.text = Global.gApp.gGameData.GetTipsInCurLanguage(cbi.name); item.goods.image.sprite = Global.gApp.gResMgr.LoadAssets <Sprite>(cbi.icon); itemDetail.Icon.image.sprite = Global.gApp.gResMgr.LoadAssets <Sprite>(cbi.icon); item.level.text.text = dto.level.ToString(); itemDetail.level.text.text = dto.level.ToString(); item.lockIcon.gameObject.SetActive(lockBuff); CampBuff_dataItem curData; CampBuff_dataItem nextData; string curPercent; if (dto.level < Global.gApp.gGameData.CampBuffDataConfig.items.Length) { curData = Global.gApp.gGameData.CampBuffDataConfig.items[dto.level - 1]; nextData = Global.gApp.gGameData.CampBuffDataConfig.items[dto.level]; curPercent = GetPercentStr(cbi, curData.buff_atkNpc[0]); string nextPercent = GetPercentStr(cbi, nextData.buff_atkNpc[0]); //item.desc.text.text = string.Format(Global.gApp.gGameData.GetTipsInCurLanguage(cbi.desc), curPercent, nextPercent); itemDetail.desc.text.text = string.Format(Global.gApp.gGameData.GetTipsInCurLanguage(cbi.desc), curPercent, nextPercent); } else { curData = Global.gApp.gGameData.CampBuffDataConfig.items[dto.level - 2]; nextData = Global.gApp.gGameData.CampBuffDataConfig.items[dto.level - 1]; curPercent = GetPercentStr(cbi, nextData.buff_atkNpc[0]); //item.desc.text.text = string.Format(Global.gApp.gGameData.GetTipsInCurLanguage(cbi.max_desc), curPercent); itemDetail.desc.text.text = string.Format(Global.gApp.gGameData.GetTipsInCurLanguage(cbi.max_desc), curPercent); } float min = dto.level == 1 ? 0 : Global.gApp.gGameData.CampBuffDataConfig.items[dto.level - 2].buff_atkNpc_cost[0]; float max = Global.gApp.gGameData.CampBuffDataConfig.items[dto.level - 1].buff_atkNpc_cost[0]; int ignoreTotalNum = Global.gApp.gSystemMgr.GetNpcMgr().GetTotalNum(true); item.CurText.text.text = (ignoreTotalNum).ToString(); item.MaxText.text.text = "/" + max.ToString(); item.Progress.image.fillAmount = (ignoreTotalNum) / (max); item.AddText.text.text = curPercent; item.NormalLevel.gameObject.SetActive(dto.level < Global.gApp.gGameData.CampBuffDataConfig.items.Length); item.MaxLevel.gameObject.SetActive(dto.level == Global.gApp.gGameData.CampBuffDataConfig.items.Length); rt = itemDetail.rectTransform(); } else { CampBUFF_ItemSmall item = ItemSmall.GetInstance(); item.gameObject.SetActive(true); item.rectTransform().SetParent(con.rectTransform); item.rectTransform().offsetMax = new Vector2(0, 0); item.rectTransform().offsetMin = new Vector2(0, 0); CampBUFF_ItemDetail itemDetail = ItemDetail.GetInstance(); itemDetail.rectTransform().localScale = new Vector3(1, 1, 1); itemDetail.gameObject.SetActive(true); itemDetail.rectTransform().position = new Vector3(item.rectTransform().position.x, con.rectTransform.position.y + 1.5f, item.rectTransform().position.z); FreshItem(cbi, dto, lockBuff, item, itemDetail); itemDetail.Button.button.onClick.AddListener(() => { ItemDTO reduceItemDTO; if (dto.level == 0) { reduceItemDTO = new ItemDTO(SpecialItemIdConstVal.RED_HEART, cbi.unlockCost, BehaviorTypeConstVal.OPT_CAMP_BUFF_UNLOCK); } else { CampBuff_dataItem curData = Global.gApp.gGameData.CampBuffDataConfig.items[dto.level - 1]; float[] cost = ReflectionUtil.GetValueByProperty <CampBuff_dataItem, float[]>(cbi.id + "_cost", curData); reduceItemDTO = new ItemDTO(SpecialItemIdConstVal.RED_HEART, cost[0], BehaviorTypeConstVal.OPT_CAMP_BUFF_UPGRADE); reduceItemDTO.paramStr2 = dto.level.ToString(); } reduceItemDTO.paramStr1 = cbi.id; GameItemFactory.GetInstance().ReduceItem(reduceItemDTO); if (!reduceItemDTO.result) { ItemItem reduceItemCfg = Global.gApp.gGameData.ItemData.Get(reduceItemDTO.itemId); Global.gApp.gMsgDispatcher.Broadcast <int, string>(MsgIds.ShowGameTipsByIDAndParam, 1008, Global.gApp.gGameData.GetTipsInCurLanguage(reduceItemCfg.sourceLanguage)); } else { dto.level++; Global.gApp.gSystemMgr.GetNpcMgr().SaveData(); lockBuff = Global.gApp.gSystemMgr.GetNpcMgr().LockBuff(dto); FreshItem(cbi, dto, lockBuff, item, itemDetail); GameObject effect = UiTools.GetEffect(EffectConfig.Camp_buff_up, item.rectTransform()); effect.transform.position = item.rectTransform().position; } }); Debug.Log(cbi.id + "|" + lockBuff); rt = itemDetail.rectTransform(); } rt.gameObject.SetActive(false); con.button.onClick.AddListener(() => { CloseDetail(); rt.gameObject.SetActive(true); rt.position = new Vector3(rt.position.x, con.rectTransform.position.y + 1.5f, rt.position.z); m_HaveTip = true; m_CurY = -100; }); } //Content.rectTransform.position = new Vector3(Content.rectTransform.position.x, 0f, Content.rectTransform.position.z); maskBtn.button.onClick.AddListener(CloseDetail); CloseBtn.button.onClick.AddListener(TouchClose); }
private void InitNode() { FreshEnterBtn(); GeneralConfigItem passMaxScaleCfg = Global.gApp.gGameData.GeneralConfigData.Get(GeneralConfigConstVal.PASS_ICON_MAX_SCALE); m_PassIconMaxScale = new Vector3(float.Parse(passMaxScaleCfg.contents[0]), float.Parse(passMaxScaleCfg.contents[1]), float.Parse(passMaxScaleCfg.contents[2])); GeneralConfigItem passMinScaleCfg = Global.gApp.gGameData.GeneralConfigData.Get(GeneralConfigConstVal.PASS_ICON_MIN_SCALE); m_PassIconMinScale = new Vector3(float.Parse(passMinScaleCfg.contents[0]), float.Parse(passMinScaleCfg.contents[1]), float.Parse(passMinScaleCfg.contents[2])); GeneralConfigItem passNumMinScaleCfg = Global.gApp.gGameData.GeneralConfigData.Get(GeneralConfigConstVal.PASS_ICON_NUM_MIN_SCALE); m_PassIconNumMinScale = int.Parse(passNumMinScaleCfg.content); GeneralConfigItem passNumMaxScaleCfg = Global.gApp.gGameData.GeneralConfigData.Get(GeneralConfigConstVal.PASS_ICON_NUM_MAX_SCALE); m_PassIconNumMaxScale = int.Parse(passNumMaxScaleCfg.content); m_LvEffectDelay = float.Parse(Global.gApp.gGameData.GeneralConfigData.Get(GeneralConfigConstVal.MAIN_UI_LV_EFFECT_DELAY_SEC).content); m_WeaponBip = MainRoleNode.transform.Find("hero/weapon_bip"); { string curMainWeaponName = Global.gApp.gSystemMgr.GetWeaponMgr().GetCurMainWeapon(); Destroy(m_ShowWeapon); string newWpnName = curMainWeaponName; if (Global.gApp.gSystemMgr.GetWeaponMgr().GetQualityLv(curMainWeaponName) > 0) { newWpnName += "_s"; } GameObject weapon = Global.gApp.gResMgr.InstantiateObj("Prefabs/Weapon/MainUI/" + newWpnName); weapon.layer = LayerMask.NameToLayer("UI"); weapon.transform.SetParent(m_WeaponBip, false); m_ShowWeapon = weapon; m_CurMainWeaponName = curMainWeaponName; } string subWpnName = Global.gApp.gSystemMgr.GetWeaponMgr().GetCurSubWeapon(); if (subWpnName == null || subWpnName.Equals(string.Empty) || !subWpnName.Equals(m_SubWpnName)) { if (m_ShowSubWeapon != null) { Destroy(m_ShowSubWeapon); m_ShowSubWeapon = null; } } if (subWpnName != null && !subWpnName.Equals(string.Empty) && !subWpnName.Equals(m_SubWpnName)) { GameObject weapon = Global.gApp.gResMgr.InstantiateObj("Prefabs/Weapon/MainUI/Sub/" + subWpnName); weapon.layer = LayerMask.NameToLayer("UI"); weapon.transform.SetParent(SubWeaponNode, false); m_ShowSubWeapon = weapon; } m_SubWpnName = subWpnName; double curExp = GameItemFactory.GetInstance().GetItem(SpecialItemIdConstVal.EXP); BaseAttrMgr baseAttrMgr = Global.gApp.gSystemMgr.GetBaseAttrMgr(); baseAttrMgr.ResetLevel(curExp); int curLevel = baseAttrMgr.GetLevel(); int branchPassCount = Global.gApp.gSystemMgr.GetPassMgr().FreshAndGetBranchPassCount(); BtnRandompass.gameObject.SetActive(branchPassCount > 0); newNum.text.text = branchPassCount.ToString(); if (m_LvUpEffect != null) { Destroy(m_LvUpEffect); m_LvUpEffect = null; } if (baseAttrMgr.LvUp) { baseAttrMgr.LvUp = false; EffectItem effectItem = Global.gApp.gGameData.EffectData.Get(EffectConstVal.Big_LEVEL_UP); //GameObject Obj = Global.gApp.gResMgr.InstantiateObj("Prefabs/Effect/ui/UI_shengji_1"); //Obj.transform.SetParent(transform, false); gameObject.AddComponent <DelayCallBack>().SetAction(() => { m_LvUpEffect = UiTools.GetEffect(effectItem.path, transform); }, m_LvEffectDelay); } //#if (UNITY_EDITOR) InputFieldCmp.gameObject.SetActive(true); //#endif //#if (!UNITY_EDITOR) // InputFieldCmp.gameObject.SetActive(false); //#endif UIFresh(); FlushOnlineCoinState(); if (Global.gApp.gSystemMgr.GetMiscMgr().Dialogues.Count > 0) { Global.gApp.gUiMgr.OpenPanel(Wndid.DialogueUI, Global.gApp.gSystemMgr.GetMiscMgr().Dialogues[0].ToString()); Global.gApp.gSystemMgr.GetMiscMgr().RemoveDialogue(0); } }
private void UIFresh() { GetMDT.gameObject.GetComponent <Animator>().enabled = (Global.gApp.gSystemMgr.GetMiscMgr().VideoMDTDataGift != 1); GetMDTLight.gameObject.SetActive(Global.gApp.gSystemMgr.GetMiscMgr().VideoMDTDataGift != 1); InitPassInfo(); Global.gApp.gSystemMgr.GetQuestMgr().CheckLoginWeaponAward(); int questId = Global.gApp.gSystemMgr.GetQuestMgr().GetShouldReceiveId4SevenDay(); SevenDayBg.gameObject.SetActive(questId > 0); m_LevelDetailDTO = Global.gApp.gSystemMgr.GetQuestMgr().GetLevelDetailQuest(); ItemItem canReceiveItem = null; if (m_LevelDetailDTO != null) { canReceiveItem = Global.gApp.gGameData.ItemData.Get((int)Global.gApp.gGameData.QuestData.Get(m_LevelDetailDTO.id).award[0]); } QuestItemDTO nextLevelDetailDTO = Global.gApp.gSystemMgr.GetQuestMgr().GetNextLevelDetailQuest(); if (nextLevelDetailDTO != null) { m_LDAGunCfg = Global.gApp.gGameData.ItemData.Get((int)Global.gApp.gGameData.QuestData.Get(nextLevelDetailDTO.id).award[0]); } m_NDCfg = Global.gApp.gSystemMgr.GetPassMgr().GetNextGun(FilterTypeConstVal.SUM_LOGIN_DAY); //可领取红点 LDARedPoint.gameObject.SetActive(m_LevelDetailDTO != null && canReceiveItem != null); if (m_LevelDetailDTO != null && canReceiveItem != null) { InitNextUI(m_LevelDetailDTO, canReceiveItem); //可以领取 LDAGunName.gameObject.SetActive(false); LDAAwardIcon.gameObject.GetComponent <DOTweenAnimation>().DORestart(); } else if (m_LDAGunCfg != null) { LDAAwardIcon.gameObject.GetComponent <DOTweenAnimation>().DOPause(); LDAAwardIcon.rectTransform.localPosition = m_LDAIconInitPos; InitNextUI(nextLevelDetailDTO, m_LDAGunCfg); LDAGunName.gameObject.SetActive(true); } else { LDAAwardIcon.gameObject.GetComponent <DOTweenAnimation>().DOPause(); LDAAwardIcon.rectTransform.localPosition = m_LDAIconInitPos; LDAGunName.gameObject.SetActive(true); LevelDetailAward.gameObject.SetActive(false); } if (m_NDCfg != null) { bool isWeapon = ItemTypeConstVal.isWeapon(m_NDCfg.showtype); GeneralConfigItem colorConfig = Global.gApp.gGameData.GeneralConfigData.Get(GeneralConfigConstVal.QUALITY_COLOR); //NextGunName.text.color = ColorUtil.GetColor(colorConfig.contents[itemConfig.qualevel]); NDGunName.text.text = FilterFactory.GetInstance().GetTinyUnfinishTips(m_NDCfg.opencondition); NDGunIcon.gameObject.SetActive(m_NDCfg.showtype == ItemTypeConstVal.BASE_MAIN_WEAPON); NDGunIcon.image.sprite = Resources.Load(m_NDCfg.image_grow, typeof(Sprite)) as Sprite; NDSubWepIcon.gameObject.SetActive(m_NDCfg.showtype == ItemTypeConstVal.SUB_WEAPON); NDSubWepIcon.image.sprite = Resources.Load(m_NDCfg.image_grow, typeof(Sprite)) as Sprite; NDPetIcon.gameObject.SetActive(m_NDCfg.showtype == ItemTypeConstVal.PET); NDPetIcon.image.sprite = Resources.Load(m_NDCfg.image_grow, typeof(Sprite)) as Sprite; NDAwardIcon.gameObject.SetActive(false); if (isWeapon) { if (m_NDCfg.showtype == ItemTypeConstVal.BASE_MAIN_WEAPON) { NDGunDown.image.sprite = Resources.Load(string.Format(CommonResourceConstVal.MAIN_UI_WEAPON_DOWN_PATH, m_NDCfg.qualevel), typeof(Sprite)) as Sprite; } else { NDGunDown.image.sprite = Resources.Load(string.Format(CommonResourceConstVal.MAIN_UI_WEAPON_DOWN_PATH, 2), typeof(Sprite)) as Sprite; } NDGunEffect.image.enabled = false; if (NDGunEffect.rectTransform.childCount == 0) { EffectItem effectItem = Global.gApp.gGameData.EffectData.Get(EffectConstVal.QUALITY); string effectName = m_NDCfg.showtype == ItemTypeConstVal.BASE_MAIN_WEAPON ? m_NDCfg.qualevel.ToString() : "common"; GameObject effect = UiTools.GetEffect(string.Format(effectItem.path, effectName), NDGunEffect.rectTransform); effect.transform.GetChild(0).localPosition = new Vector3(0f, 0f, 0f); ParticleSystem[] particleRenderers = effect.GetComponentsInChildren <ParticleSystem>(); foreach (ParticleSystem ps in particleRenderers) { ps.GetComponent <Renderer>().sortingOrder = 39; } } } else { NDGunDown.image.sprite = Resources.Load(string.Format(CommonResourceConstVal.MAIN_UI_WEAPON_DOWN_PATH, 2), typeof(Sprite)) as Sprite; } } else { NextDay.gameObject.SetActive(false); } FirstCharge.gameObject.SetActive(Global.gApp.gSystemMgr.GetMiscMgr().FirstPurchase == 0); fTip.gameObject.SetActive(Global.gApp.gSystemMgr.GetMiscMgr().FirstPurchase == 0 && Global.gApp.gSystemMgr.GetMiscMgr().EveryDayFP == 0); double mls = DateTimeUtil.m_Day_Mills * 7 - DateTimeUtil.GetMills(DateTime.Now) + Global.gApp.gSystemMgr.GetMiscMgr().TimeGiftStartTime; bool showTimeGift1 = Global.gApp.gSystemMgr.GetMiscMgr().IsShowTimeGift(mls, GeneralConfigConstVal.TIME_GIFT1_PRODUCT); bool showTimeGift2 = Global.gApp.gSystemMgr.GetMiscMgr().IsShowTimeGift(mls, GeneralConfigConstVal.TIME_GIFT2_PRODUCT); TimeGift1.gameObject.SetActive(showTimeGift1); TimeGift2.gameObject.SetActive(showTimeGift2); if (showTimeGift1 && m_TimeGift1Tick == 0) { m_TimeGift1Tick = 1; DelayCallBack dcb = gameObject.AddComponent <DelayCallBack>(); TimeTip1.text.text = GetTimtTip(mls); dcb.SetAction(() => { double ms = DateTimeUtil.m_Day_Mills * 7 - DateTimeUtil.GetMills(DateTime.Now) + Global.gApp.gSystemMgr.GetMiscMgr().TimeGiftStartTime; if (ms < 0d) { ms = 0d; } TimeTip1.text.text = GetTimtTip(ms); }, 1f); dcb.SetCallTimes(Convert.ToInt32(mls / DateTimeUtil.m_Sec_Mills) + 1); } if (showTimeGift2 && m_TimeGift2Tick == 0) { m_TimeGift2Tick = 1; DelayCallBack dcb = gameObject.AddComponent <DelayCallBack>(); TimeTip2.text.text = GetTimtTip(mls); dcb.SetAction(() => { double ms = DateTimeUtil.m_Day_Mills * 7 - DateTimeUtil.GetMills(DateTime.Now) + Global.gApp.gSystemMgr.GetMiscMgr().TimeGiftStartTime; if (ms < 0d) { ms = 0d; } TimeTip2.text.text = GetTimtTip(ms); }, 1f); dcb.SetCallTimes(Convert.ToInt32(mls / DateTimeUtil.m_Sec_Mills) + 1); } #if (UNITY_EDITOR || DISBLE_PLATFORM) #else //if (SdkdsPurchaseUtils.m_ProductList == null || SdkdsPurchaseUtils.m_ProductList.Count == 0) //{ // FirstCharge.gameObject.SetActive(false); // TimeGift1.gameObject.SetActive(false); // TimeGift2.gameObject.SetActive(false); //} #endif }