private void UpdateUI(UIMaoRankAwardParam param) { ObjectCommon.DestoryChildren(mItemGrid); if (param.rank == uint.MaxValue) { mRankText.text = StringHelper.GetString("zcm_outofrank"); } else { mRankText.text = string.Format(StringHelper.GetString("zcm_rank"), (param.rank + 1)); } MoneyItemTableItem moneyres = ItemManager.GetItemRes(param.item_id) as MoneyItemTableItem; if (moneyres != null && moneyres.value > 0) { mCountText.text = "X" + moneyres.value.ToString(); } AwardItemUI awardItemUI = new AwardItemUI(param.item_id, param.item_count); awardItemUI.gameObject.transform.parent = mItemGrid.transform; awardItemUI.gameObject.transform.localPosition = Vector3.zero; awardItemUI.gameObject.transform.localScale = Vector3.one; }
private void UpdateSelectedItem() { ObjectCommon.DestoryChildren(mFirstPassItem); ObjectCommon.DestoryChildren(mNormalPassItem); if (mSelectedItemUI == null || mSelectedItemRes == null) { return; } mMyFPText.text = mPlayerModule.GetGrade().ToString(); mBestFPText.text = mSelectedItemRes.mSuitableFC.ToString(); mCostSPText.text = GetCostSp().ToString(); mExpText.text = mSelectedItemRes.mAwardExp.ToString(); mEnterBtn.gameObject.SetActive(!mSelectedItemUI.IsLocked()); mHasAwardedIcon.gameObject.SetActive(mPlayerModule.IsStageHasPassed(mSelectedItemRes.resID)); if (mSelectedItemRes.mFirstAwardId >= 0) { AwardItemUI awardItemUI = new AwardItemUI(mSelectedItemRes.mFirstAwardId, 1); awardItemUI.gameObject.transform.parent = mFirstPassItem.transform; awardItemUI.gameObject.transform.localPosition = Vector3.zero; awardItemUI.gameObject.transform.localScale = Vector3.one; } if (mSelectedItemRes.mPassAwardId0 >= 0) { AwardItemUI awardItemUI = new AwardItemUI(mSelectedItemRes.mPassAwardId0, 1); awardItemUI.gameObject.transform.parent = mNormalPassItem.transform; awardItemUI.gameObject.transform.localPosition = Vector3.zero; awardItemUI.gameObject.transform.localScale = Vector3.one; } }
private void RefreshUI() { if (mParam == null) { return; } mScore.text = mParam.score.ToString(); string maxscore = mParam.maxScore.ToString(); mMaxScore.text = "历史最高:" + maxscore; mJilu.gameObject.SetActive(mParam.score > mParam.maxScore); mItemList.Clear(); ObjectCommon.DestoryChildren(mGrid.gameObject); for (int i = 0; i < mParam.resid.Count; i++) { AwardItemUI item = new AwardItemUI(mParam.resid[i], mParam.num[i]); item.gameObject.transform.parent = mGrid.gameObject.transform; item.gameObject.transform.localScale = Vector3.one; mItemList.Add(item); } mScrollBar.value = 0.0f; mGrid.Reposition(); }
//界面关闭 protected override void OnClose() { mTimer = 5000; mRankText.text = null; mCountText.text = null; ObjectCommon.DestoryChildren(mItemGrid); base.OnClose(); }
protected override void OnOpen(object param = null) { FirstChargeRewardTableItemBase item = DataManager.FirstChargeTable[0] as FirstChargeRewardTableItemBase; if (item == null) { Close(); } else { FirstChargeRewardTableItem Item = (FirstChargeRewardTableItem)item; mItemList.Clear(); ObjectCommon.DestoryChildren(Grid.gameObject); for (int i = 0; i < 7; i++) { if (Item.FirstChargeItems[i] != null && Item.FirstChargeItems[i].itemid > 0 && Item.FirstChargeItems[i].itemnum > 0) { ItemTableItem mItemRes = ItemManager.GetItemRes(Item.FirstChargeItems[i].itemid); ChargeItemInfo info = new ChargeItemInfo(Item.FirstChargeItems[i].itemid, Item.FirstChargeItems[i].itemnum); ChargeItemUI itemIcon = new ChargeItemUI(info); itemIcon.gameObject.transform.parent = Grid.gameObject.transform; itemIcon.gameObject.transform.localScale = Vector3.one; mItemList.Add(itemIcon); } } Grid.Reposition(); Grid.repositionNow = true; } EventDelegate.Add(mReturnBtn.onClick, OnReturnBtnClick); PlayerDataModule mPlayerDataModule = ModuleManager.Instance.FindModule <PlayerDataModule>(); if (!mPlayerDataModule.GetCharged()) { NGUITools.SetActive(mGetRewardBtn.gameObject, false); NGUITools.SetActive(mChargeBtn.gameObject, true); EventDelegate.Add(mChargeBtn.onClick, OnChargeBtnClick); } else if (!mPlayerDataModule.GetFirstChargePicked()) { NGUITools.SetActive(mGetRewardBtn.gameObject, true); NGUITools.SetActive(mChargeBtn.gameObject, false); EventDelegate.Add(mGetRewardBtn.onClick, OnRewardBtnClick); picked = false; } else { NGUITools.SetActive(mChargeBtn.gameObject, false); UIAtlasHelper.SetButtonImage(mGetRewardBtn, "common:anniuhui", true); } mScrollBar.value = 0.0f; }
protected override void OnClose() { base.OnClose(); MailModule module = ModuleManager.Instance.FindModule <MailModule>(); if (module.SelectedMail != null) { module.SelectedMail = null; } UIAtlasHelper.SetButtonImage(mDeleteBtn, "common:anniuhui", true); UIAtlasHelper.SetButtonImage(mPickBtn, "common:anniuhui", true); EventDelegate.Remove(mReturnBtn.onClick, OnReturnBtnClick); EventDelegate.Remove(mDeleteBtn.onClick, OnDeleteBtnClick); EventDelegate.Remove(mPickBtn.onClick, OnPickBtnClick); ObjectCommon.DestoryChildren(mGrid.gameObject); }
public void SetShowInfo(ChallengeCompleteParam param) { mParam = param; if (mParam == null) { return; } ObjectCommon.DestoryChildren(DropGrid.gameObject); for (int i = 0; i < param.mDrops.Count; i++) { AwardItemUI awardItemUI = new AwardItemUI(param.mDrops[i].mResId, param.mDrops[i].mNum); awardItemUI.gameObject.transform.parent = DropGrid.gameObject.transform; awardItemUI.gameObject.transform.localScale = Vector3.one; } DropGrid.repositionNow = true; }
private void OnStartBtnClick() { if (chooseMode == true) { chooseMode = false; mStartBtnLab.text = "充 值"; UIAtlasHelper.SetSpriteImage(mIcon, "chongzhi:chongzhi_11", true); ObjectCommon.DestoryChildren(mGrid.gameObject); NGUITools.SetActive(mChargebk.gameObject, false); } else { chooseMode = true; mStartBtnLab.text = "VIP"; UIAtlasHelper.SetSpriteImage(mIcon, "chongzhi:chongzhi_10", true); NGUITools.SetActive(mChargebk.gameObject, true); OnCreateChargeItem(); } }
protected override void OnRespond(respond_mail_state respond, object userdata) { if (respond.result == (int)ERROR_CODE.ERR_MAIL_PICK_OK) { MailModule module = ModuleManager.Instance.FindModule <MailModule>(); if (module.SelectedMail != null) { module.SelectedMail.isPicked = true; UIWindow MailUI = WindowManager.Instance.GetUI("mail"); UIButton mPickBtn = MailUI.FindComponent <UIButton>("background/mGetBtn"); UIGrid mItemGrid = MailUI.FindComponent <UIGrid>("Open/ItemGridBK/Scroll View/UIGrid"); UIAtlasHelper.SetButtonImage(mPickBtn, "common:anniuhui", true); ObjectCommon.DestoryChildren(mItemGrid.gameObject); for (int i = 0; i < module.SelectedMail.mMaildata.mItemsList.Count; i++) { PopTipManager.Instance.AddGetItemTip(module.SelectedMail.mMaildata.mItemsList[i].resid, module.SelectedMail.mMaildata.mItemsList[i].num); } } } }
public void ShowMailContent(MailsData maildata) { UIWindow MailUI = WindowManager.Instance.GetUI("mail"); UIPanel MailContent = MailUI.FindComponent <UIPanel>("Open"); UISprite Empty = MailUI.FindComponent <UISprite>("Empty"); UILabel Title = MailUI.FindComponent <UILabel>("Open/mTitle"); UIGrid Grid = MailUI.FindComponent <UIGrid>("Open/ItemGridBK/Scroll View/UIGrid"); List <AwardItemUI> mItemList = new List <AwardItemUI>(); mItemList.Clear(); if (Grid) { ObjectCommon.DestoryChildren(Grid.gameObject); } Title.text = maildata.title; UILabel Text = MailUI.FindComponent <UILabel>("Text"); Text.text = maildata.content; if (maildata.mItemsList.Count > 0 && !isPicked) { for (int i = 0; i < maildata.mItemsList.Count; i++) { AwardItemUI item = new AwardItemUI(maildata.mItemsList[i].resid, maildata.mItemsList[i].num); item.gameObject.transform.parent = Grid.gameObject.transform; item.gameObject.transform.localScale = Vector3.one; mItemList.Add(item); } Grid.Reposition(); Grid.repositionNow = true; } if (NGUITools.GetActive(Empty.gameObject)) { NGUITools.SetActive(Empty.gameObject, false); } if (!NGUITools.GetActive(MailContent.gameObject)) { NGUITools.SetActive(MailContent.gameObject, true); } }
public void OpenUI(uint ranknum, int resId) { mGameObject.SetActive(true); UIEventListener.Get(Background).onClick = OnCloseUI; if (ranknum > 3) { mRankLabel.gameObject.SetActive(true); mRankIcon.gameObject.SetActive(false); mRankLabel.text = ranknum.ToString(); } else { mRankLabel.gameObject.SetActive(false); mRankIcon.gameObject.SetActive(true); UIAtlasHelper.SetSpriteImage(mRankIcon, "common:top" + ranknum); } mTip1.text = StringHelper.GetString("cha_rank_tip1"); mTip2.text = StringHelper.GetString("cha_rank_tip2"); ObjectCommon.DestoryChildren(mAwardGuid.gameObject); var res = DataManager.ChaRankAwardItemTable[resId] as ChaRankAwardItemTableItem; if (res == null) { return; } for (int i = 0; i < res.awardItems.Length; i++) { if (res.awardItems[i].itemid != -1) { AwardItemUI awardItemUI = new AwardItemUI(res.awardItems[i].itemid, res.awardItems[i].itemnum); awardItemUI.gameObject.transform.parent = mAwardGuid.gameObject.transform; awardItemUI.gameObject.transform.localScale = Vector3.one; } } mAwardGuid.repositionNow = true; }
//界面打开 protected override void OnOpen(object param = null) { EventDelegate.Add(OkBtn.onClick, OnClickClose); PlayerDataModule pdm = ModuleManager.Instance.FindModule <PlayerDataModule>(); QuestAwardData mCurAwardInfo = PlayerDataPool.Instance.MainData.mQuestData.GetAward(); QuestTableItem qti = DataManager.QuestTable[mCurAwardInfo.mQuestId] as QuestTableItem; QuestName.text = qti.questName; ObjectCommon.DestoryChildren(DropGrid.gameObject); if (mAwardUIList != null) { mAwardUIList.Clear(); } else { mAwardUIList = new List <AwardItemUI>(); } for (int i = 0; i < mCurAwardInfo.mAwardList.Count; i++) { AwardItemUI temp = new AwardItemUI(mCurAwardInfo.mAwardList[i].mResId, (int)mCurAwardInfo.mAwardList[i].mNum); temp.gameObject.transform.parent = DropGrid.gameObject.transform; temp.gameObject.transform.localScale = Vector3.one; } DropGrid.repositionNow = true; mCurStep = UIStep.STEP_ORIGINAL; //强制隐藏引导 GuideModule module = ModuleManager.Instance.FindModule <GuideModule>(); module.ForceHideGuide(true); }
private void RefresItemInfo() { FashionItemData itemdata; FashionTableItem res = DataManager.FashionTable[SelectedId] as FashionTableItem; ObjectCommon.DestoryChildren(mAwardContainer); FashionPropTableItem propRes; if (mModule.GetFashionByID(SelectedId, out itemdata)) { //时装已经解锁 mWearTxt.text = StringHelper.GetString((mModule.GetEquipId(res.bodypart) == SelectedId) ? "takeoff" : "wear"); mWearBtn.gameObject.SetActive(true); mBuyBtn.gameObject.SetActive(false); mAddStarBtn.gameObject.SetActive(true); ownItemNum.gameObject.SetActive(false); propRes = DataManager.FashionPropTable[itemdata.starnum + res.propid] as FashionPropTableItem; } else { //未解锁 mWearBtn.gameObject.SetActive(false); mBuyBtn.gameObject.SetActive(true); mAddStarBtn.gameObject.SetActive(false); mBuyText.text = StringHelper.GetString(res.activity.Equals("no") ? "buy" : "goingto"); var proRes = DataManager.FashionPropTable[res.propid] as FashionPropTableItem; AwardItemUI awarItem = new AwardItemUI(res.costid, proRes.costnum); awarItem.gameObject.transform.parent = mAwardContainer.transform; awarItem.gameObject.transform.localPosition = Vector3.zero; awarItem.gameObject.transform.localScale = Vector3.one; ownItemNum.gameObject.SetActive(true); PlayerDataModule pdm = ModuleManager.Instance.FindModule <PlayerDataModule>(); uint ownNum; if (res.costtype == 1) { ownNum = pdm.GetProceeds(ProceedsType.Money_Game); } else if (res.costtype == 2) { ownNum = pdm.GetProceeds(ProceedsType.Money_RMB); } else { ownNum = pdm.GetItemNumByID(res.costid); } ownItemNum.text = StringHelper.GetString("ownnum") + ownNum; propRes = DataManager.FashionPropTable[res.propid] as FashionPropTableItem; } mBtnGrid.repositionNow = true; if (propRes != null) { mLife.text = StringHelper.GetString("life") + ": " + propRes.life; mPower.text = StringHelper.GetString("power") + ": " + propRes.power; mCritical.text = StringHelper.GetString("critical") + ": " + propRes.critical; mAttack.text = StringHelper.GetString("attack") + ": " + propRes.fight; mDefence.text = StringHelper.GetString("defence") + ": " + propRes.defence; } mGetWay.text = res.getWay; mDesc.text = res.desc; mFashionName.text = res.name; //调用任务换装接口 }
//刷新排行界面 private void RefreshRankPanel(EventBase evt = null) { if (mChalModule.GetChaRankNum() == UInt32.MaxValue) { mRankNum.gameObject.SetActive(false); } else { mRankNum.gameObject.SetActive(true); mRankNum.text = String.Format(StringHelper.GetString("diming"), (int)mChalModule.GetChaRankNum()); } PlayerDataModule pdm = ModuleManager.Instance.FindModule <PlayerDataModule>(); mPlayerName.text = "LV." + pdm.GetLevel() + " " + pdm.GetName(); mSelfScore.text = StringHelper.GetString("currentscore") + mChalModule.GetWeekScore(); if (mChalModule.IsInRankList(pdm.getGUID())) { if (mChalModule.GetWeekScore() == 0) { mScoreTip.gameObject.SetActive(true); mScoreTip.text = StringHelper.GetString("notchallenge2"); } else { mScoreTip.gameObject.SetActive(false); } } else { mScoreTip.gameObject.SetActive(true); mScoreTip.text = StringHelper.GetString("out_rank2"); } if (mRankVersion != mChalModule.GetRankVersion()) { for (int i = 0; i < mRankItemList.Count; ++i) { mRankItemList[i].Clear(); } mRankItemList.Clear(); ObjectCommon.DestoryChildren(mRankGuid.gameObject); List <RankingChallengeInfo> rankListInfo = mChalModule.GetRankList(); for (int i = 0; i < rankListInfo.Count; ++i) { GameObject rankItemObj = GameObject.Instantiate(mExamRankItem) as GameObject; ChaRankItemUI rankItemUI = new ChaRankItemUI(rankItemObj); rankItemUI.SetShowInfo((i + 1), rankListInfo[i].resid, rankListInfo[i].level, rankListInfo[i].name, rankListInfo[i].challenge_weekscore, rankListInfo[i].floor); rankItemUI.mButton.CustomData = i; rankItemUI.clickCallBack = OnClickRankItem; rankItemUI.mGameObject.SetActive(true); rankItemUI.mGameObject.transform.parent = mRankGuid.gameObject.transform; rankItemUI.mGameObject.transform.localScale = Vector3.one; mRankItemList.Add(rankItemUI); } mRankGuid.repositionNow = true; mRankVersion = mChalModule.GetRankVersion(); } }
// 显示关卡信息 private void OnStageChanged() { PlayerDataModule module = ModuleManager.Instance.FindModule <PlayerDataModule>(); if (module == null) { return; } mMyFPText.text = module.GetGrade().ToString(); mBestFPText.text = mModule.GetSuitableFC().ToString(); mCostSPText.text = mModule.GetCostSP().ToString(); mExpText.text = mModule.GetAwardExp().ToString(); if (mModule.ShowLevelBar) { bool unlock = false; if (!mModule.HasNormalLevel(mModule.SelectedStageListRes)) { mNormalBtn.SetActive(false); mNormalDisable.SetActive(false); //SetEnergyBarShowType(EnergyBarUI.EnergyBarShowType.ShowSpOnly); SetMoneyBarShowType(MoneyBarType.TiLi); } else { unlock = mPlayerModule.IsStageUnlock(mModule.SelectedStageListRes.mNromalStageId); mNormalBtn.SetActive(unlock); mNormalDisable.SetActive(!unlock); //SetEnergyBarShowType(EnergyBarUI.EnergyBarShowType.All); BetterList <MoneyBarType> list = new BetterList <MoneyBarType>(); list.Add(MoneyBarType.TiLi); list.Add(MoneyBarType.XingXing); SetMoneyBarShowType(list); } if (!mModule.HasHardLevel(mModule.SelectedStageListRes)) { mHardBtn.SetActive(false); mHardDisable.SetActive(false); } else { unlock = mPlayerModule.IsStageUnlock(mModule.SelectedStageListRes.mHardStageId); mHardBtn.SetActive(unlock); mHardDisable.SetActive(!unlock); } if (!mModule.HasSeriousLevel(mModule.SelectedStageListRes)) { mSeriousBtn.SetActive(false); mSeriousDisable.SetActive(false); } else { unlock = mPlayerModule.IsStageUnlock(mModule.SelectedStageListRes.mSeriousStageId); mSeriousBtn.SetActive(unlock); mSeriousDisable.SetActive(!unlock); } for (int i = 0; i < mHoverList.Count; ++i) { mHoverList[i].SetActive(mModule.SelectedLevel == i); } } else { //SetEnergyBarShowType(EnergyBarUI.EnergyBarShowType.ShowSpOnly); SetMoneyBarShowType(MoneyBarType.TiLi); } if (mModule.SelectedUI != null) { mModule.SelectedUI.SetStageRes(mModule.SelectedStageRes); mEnterBtn.SetActive(!mModule.SelectedUI.GetLocked()); } ObjectCommon.DestoryChildren(mFirstPassItem); ObjectCommon.DestoryChildren(mNormalPassItem); if (mModule.SelectedStageRes != null) { mHasAwardedIcon.SetActive(module.IsStageHasPassed(mModule.SelectedStageRes.resID)); if (mModule.SelectedStageRes.mFirstAwardId >= 0) { AwardItemUI awardItemUI = new AwardItemUI(mModule.SelectedStageRes.mFirstAwardId, 1); awardItemUI.gameObject.transform.parent = mFirstPassItem.transform; awardItemUI.gameObject.transform.localPosition = Vector3.zero; awardItemUI.gameObject.transform.localScale = Vector3.one; } if (mModule.SelectedStageRes.mPassAwardId0 >= 0) { AwardItemUI awardItemUI = new AwardItemUI(mModule.SelectedStageRes.mPassAwardId0, 1); awardItemUI.gameObject.transform.parent = mNormalPassItem.transform; awardItemUI.gameObject.transform.localPosition = Vector3.zero; awardItemUI.gameObject.transform.localScale = Vector3.one; } } }
/// <summary> /// 每次打开界面的强制刷新,只需要刷新神秘商店的,因为其他商店都是填表固定不变的; /// </summary> void updateMallUI(int resid = -1, bool needDestroy = true) { PlayerDataModule playerModule = ModuleManager.Instance.FindModule <PlayerDataModule>(); if (playerModule == null) { GameDebug.LogError("player data is null!"); return; } // 其他商店刷新; UpdateShopItemsMoneyWithoutSecret(); // 神秘商店初始化; BetterList <int> resIds = Module.GetPlayerSecretShopItemIds(); if (needDestroy) { if (mSecretItems.Count > 0) { clearSecretItemInAllItemList(); ObjectCommon.DestoryChildren(sGrid.gameObject); mSecretItems.Clear(); } if (resIds != null) { foreach (int id in resIds) { ShopTableItem tmpitem = DataManager.ShopTable[id] as ShopTableItem; if (tmpitem == null) { continue; } CreateMallItem(tmpitem, (ShopSubTable)tmpitem.subTable); } sGrid.repositionNow = true; } } //刷新指定resid的商品; if (resIds.Contains(resid)) { ShopItemInfo info = playerModule.GetShopSecretItemInfo(resid); if (info == null) { return; } setSecretItemInfo(resid, info); //isbuy = playerModule.GetShopIsBuyDone(resid); //if (!isbuy) // return; //if (!setItemBuyDone(resid)) //{ // GameDebug.LogError("商城数据错了"); // return; //} } //刷新全部的神秘商品; else { foreach (int id in resIds) { ShopItemInfo info = playerModule.GetShopSecretItemInfo(id); if (info == null) { continue; } setSecretItemInfo(id, info); } } }
protected override void OnClose() { base.OnClose(); EventDelegate.Remove(mStartBtn.onClick, OnStartBtnClick); ObjectCommon.DestoryChildren(mGrid.gameObject); }