//protected override void OnClickWorldMap() //{ // UI_HomeControler.Inst.AddUI(UI_WordMap.UI_ResPath); // UI_HomeControler.Inst.ReMoveUI(UI_SelectLevelMgr.UI_ResPath); // UI_WorldMapManage._instance.WorldMapShow(); //} /// <summary> /// 判断当前章节,某个难度的关卡是否通关; /// </summary> /// <param name="chapterId"></param> /// <param name="type"></param> /// <returns></returns> bool CheckPrevStageIsPass(int chapterId, EM_STAGE_DIFFICULTTYPE type, out int prevStageId) { ChapterinfoTemplate chapterT = StageModule.GetChapterinfoTemplateById(chapterId); prevStageId = -1; if (chapterT != null) { int stageId = StageModule.GetFirstStageIdInTheChapter(chapterT, type); StageTemplate st = StageModule.GetStageTemplateById(stageId); prevStageId = st.m_premissionid; ///前置关卡为-1时,表示不需要前置关卡,直接开启; if (prevStageId == -1) { return(true); } int star = -1; if (ObjectSelf.GetInstance().BattleStageData.IsCopyScenePass(prevStageId, out star)) { if (star > 0) { return(true); } } } return(false); }
public static void PropsacessHandler(int type, int data) { switch (type) { case 1: //副本; UI_HomeControler.Inst.RemoveAllUIButThis(new string[] { UI_MainHome.UI_ResPath }); UI_SelectLevelMgrNew.InitLevelId = data; UI_HomeControler.Inst.AddUI(UI_SelectLevelMgrNew.UI_ResPath); UI_HomeControler.Inst.AddUI(UI_Stage.UI_Res); StageTemplate stageT = StageModule.GetStageTemplateById(data); UI_Stage.Inst.Show(stageT); break; case 2: //66表--界面跳转表id; PropsjumpuiTemplate jumpUiT = DataTemplate.GetInstance().m_PropsacessTable.getTableData(data) as PropsjumpuiTemplate; if (jumpUiT != null) { UI_HomeControler.Inst.AddUI(jumpUiT.getJumpUIpath()); } break; default: LogManager.LogError("不支持的获得途径类型" + type); break; } }
public void setData(int iStageId) { iStageID = iStageId; mConsumePower.text = "0"; mRewardGold.text = "0"; mRewardExp.text = "0"; //StageTemplate stageinfo = (StageTemplate)DataTemplate.GetInstance().m_StageTable.getTableData(iStageID); StageTemplate stageinfo = StageModule.GetStageTemplateById(iStageID); //if (list.ContainsKey(iStageId)) { //StageTemplate stageinfo = (StageTemplate)list[iStageID]; if (stageinfo != null) { mStageDescription.text = GameUtils.getString(stageinfo.m_stageinfo); mConsumePower.text = stageinfo.m_cost.ToString(); mRewardGold.text = stageinfo.m_goldreward.ToString(); mRewardExp.text = stageinfo.m_heroexp.ToString(); if (expMoney != null) { if (stageinfo.m_expcrystal == -1) { expMoney.SetActive(false); } else { expMoney.SetActive(true); mRewarExpMoney.text = stageinfo.m_expcrystal.ToString(); } } } } }
public void onClick() { //if (isSelect) return; if (!isOpen) { if (mStageInfo.m_premissionid != -1) { ObjectSelf.GetInstance().SetCurCampaignID(iStageID); //StageTemplate newStage = (StageTemplate)DataTemplate.GetInstance().m_StageTable.getTableData(mStageInfo.m_premissionid); StageTemplate newStage = StageModule.GetStageTemplateById(mStageInfo.m_premissionid); //需修改 if (ObjectSelf.GetInstance().GetIsPrompt()) { UI_PromptFightArea.Inst.AddMsgBox(string.Format(GameUtils.getString("activitystage_tip1"), GameUtils.getString(newStage.m_stagename))); } else { string level = null; switch (ObjectSelf.GetInstance().CurChapterLevel) { case 1: level = GameUtils.getString("fight_stageselect_difficulty1"); break; case 2: level = GameUtils.getString("fight_stageselect_difficulty2"); break; case 3: level = GameUtils.getString("fight_stageselect_difficulty3"); break; default: break; } InterfaceControler.GetInst().AddMsgBox(string.Format(GameUtils.getString("fight_stageselect_tip3"), level, GameUtils.getString(newStage.m_stagename))); } //GameUtils.getString(newStage.m_stagename) } } else { ObjectSelf.GetInstance().SetCurCampaignID(iStageID); //if (UI_SelectFightArea.Inst != null) //{ // UI_SelectFightArea.Inst.onStageSelect(iStageID); //} //else { UI_PromptFightArea.Inst.onStageSelect(iStageID); } if (mTag.activeSelf) { mTag.SetActive(false); } } }
void OnLevelItemClick(int stageId) { //判断是否是神秘商店(不在关卡表中就是神秘商店),是的话打开神秘商店界面; if (StageModule.IsMysteriousShop(stageId)) { UI_HomeControler.Inst.AddUI(UI_MysteriousShop.Path); return; } //判断当前关卡是否开启; if (ObjectSelf.GetInstance().BattleStageData.IsStageOpen(stageId)) { CurLevelID = stageId; } else { string difStr = ""; switch (mDifficutType) { case EM_STAGE_DIFFICULTTYPE.NONE: break; case EM_STAGE_DIFFICULTTYPE.NORMAL: difStr = GameUtils.getString("fight_stageselect_difficulty1"); break; case EM_STAGE_DIFFICULTTYPE.HARD: difStr = GameUtils.getString("fight_stageselect_difficulty2"); break; case EM_STAGE_DIFFICULTTYPE.HARDEST: difStr = GameUtils.getString("fight_stageselect_difficulty3"); break; default: break; } string preChapterName = ""; StageTemplate stageT = StageModule.GetStageTemplateById(stageId); if (stageT.m_premissionid != -1) { StageTemplate premStageT = StageModule.GetStageTemplateById(stageT.m_premissionid); preChapterName = GameUtils.getString(premStageT.m_stagename); } InterfaceControler.GetInst().AddMsgBox(string.Format(GameUtils.getString("fight_stageselect_tip3"), difStr, preChapterName)); } }
//刷新所有的levelitem; void UpdateLevels(ChapterinfoTemplate chapterT) { //获取当前章节所有的关卡列表; stageDatas = new List <StageTemplate>(); //章节的所有普通关卡--chapterInfo表中所有的关卡表; //主线; switch (DifficultType) { case EM_STAGE_DIFFICULTTYPE.NONE: break; case EM_STAGE_DIFFICULTTYPE.NORMAL: List <StageTemplate> datas1 = StageModule.GetStageDatas(chapterT, EM_STAGE_TYPE.MAIN_QUEST1); stageDatas = StageModule.AddList(stageDatas, datas1); //支线; List <StageTemplate> datas4 = StageModule.GetStageDatas(chapterT, EM_STAGE_TYPE.SIDE_QUEST); stageDatas = StageModule.AddList(stageDatas, datas4); break; case EM_STAGE_DIFFICULTTYPE.HARD: List <StageTemplate> datas2 = StageModule.GetStageDatas(chapterT, EM_STAGE_TYPE.MAIN_QUEST2); stageDatas = StageModule.AddList(stageDatas, datas2); break; case EM_STAGE_DIFFICULTTYPE.HARDEST: List <StageTemplate> datas3 = StageModule.GetStageDatas(chapterT, EM_STAGE_TYPE.MAIN_QUEST3); stageDatas = StageModule.AddList(stageDatas, datas3); break; default: break; } //章节的特殊关卡; SpecialStage ss = ObjectSelf.GetInstance().BattleStageData.GetSpecialStageData(); if (ss.m_StageID > 0 && (ss.m_BattlePieceNum == mCurChapterId)) { //特殊关卡; if (StageModule.IsStageTemplate(ss.m_StageID)) { StageTemplate st = StageModule.GetStageTemplateById(ss.m_StageID); stageDatas.Add(st); } //神秘商店; else { //构造一个神秘商店; StageTemplate st = new StageTemplate(); st.m_stageid = ss.m_BattlePieceNum; //章节id; st.m_mysteriousShop = ss.m_StageID; //神秘商店表格id; st.m_CustomData = true; stageDatas.Add(st); } } int adder = stageDatas.Count - mLevelItems.Count; if (adder > 0) { CreateLevels(adder); } for (int i = 0; i < mLevelItems.Count; i++) { if (i >= stageDatas.Count) { mLevelItems[i].SetTemplateData(null); } else { if (stageDatas[i].m_CustomData != null) { mLevelItems[i].SetTemplateData(stageDatas[i], EM_STAGE_STAGETYPE.MYSTERIOUS); } else { mLevelItems[i].SetTemplateData(stageDatas[i]); } mLevelItems[i].SetActive(true); } //设置选中状态; mLevelItems[i].SetSelectState(mCurLevelId); } }
public override void InitUIView() { base.InitUIView(); ObjectSelf.GetInstance().SetIsPrompt(false); //ChapterinfoTemplate ct = DataTemplate.GetInstance().GetChapterTemplateByStageID(1310381000); ///// /////当前所打关卡没有解锁新关卡时,从战斗结算界面回到关卡选择界面时,选中的关卡仍为之前所打的那关, /////当前关卡打完后有新关卡解锁,返回关卡选择界面就跳到下一关(困难难度一样如此),若同时解锁了两个 /////关卡(主线和支线),返回关卡选择界面选中主线关 ///// if (NeedSpecialStage) { InitLevelId = ObjectSelf.GetInstance().BattleStageData.GetSpecialStageData().m_StageID; } else { List <int> newStages = ObjectSelf.GetInstance().BattleStageData.GetNewStageList(); if (newStages != null && newStages.Count > 0) { DisplayNormal(); } else { if (ObjectSelf.GetInstance().CurStageID > 0 && StageModule.IsStageLevelById(ObjectSelf.GetInstance().CurStageID)) { InitLevelId = ObjectSelf.GetInstance().CurStageID; } else { DisplayNormal(); } } } if (InitLevelId <= 0) { if (InitChapterId <= 0) { DisplayNormal(); } else { ChapterinfoTemplate chapterT = StageModule.GetChapterinfoTemplateById(InitChapterId); if (chapterT == null) { DisplayNormal(); } else { mDifficutType = EM_STAGE_DIFFICULTTYPE.NORMAL; mCurChapterId = InitChapterId; mCurLevelId = StageModule.GetLastStageIdInTheChapter(chapterT, mDifficutType); } } } else { StageTemplate stageT = StageModule.GetStageTemplateById(InitLevelId); if (stageT == null) { DisplayNormal(); } else { mDifficutType = StageModule.GetStageDifficultType(stageT); mCurLevelId = InitLevelId; int chapterId = DataTemplate.GetInstance().GetChapterIdByStageT(stageT); if (chapterId == -1) { Debug.LogError("关卡stageid找不到对应的章节id,stageid=" + InitLevelId); } else { mCurChapterId = chapterId; } } } OnNewMapOpenShow(); Sprite inst = UIResourceMgr.LoadSprite(common.defaultPath + "Ui_guanqiabeijing"); Dictionary <int, BattleStage> .KeyCollection keycoll = TotalCharpter.Keys; foreach (int chapterid in keycoll) { if (chapterid != 1001) { ChapterinfoTemplate info = StageModule.GetChapterinfoTemplateById(chapterid); if (info != null) { //var info = (ChapterinfoTemplate)DataTemplate.GetInstance().m_ChapterTable.getTableData(chapterid); //var info = (ChapterinfoTemplate)table[chapterid]; Sprite pic = UIResourceMgr.LoadSprite(common.defaultPath + info.getBackgroundPicture()); GameObject item = new GameObject("background"); if (pic != null) { item.AddComponent <Image>().sprite = Instantiate(pic, Vector3.zero, Quaternion.identity) as Sprite; } else { item.AddComponent <Image>().sprite = Instantiate(inst, Vector3.zero, Quaternion.identity) as Sprite; } item.transform.SetParent(mBgTrans, false); } } } Init(); // 新手引导 100302 if (GuideManager.GetInstance().isGuideUser&& GuideManager.GetInstance().IsContentGuideID(100302) == false) { GuideManager.GetInstance().ShowGuideWithIndex(100302); } }
public void SetGoodsItem(int iStageId) { for (int i = 0; i < objList.Count; i++) { Destroy(objList[i]); } objList.Clear(); int count = mGoodsItemGroup.childCount; for (int i = 0; i < count; ++i) { Destroy(mGoodsItemGroup.GetChild(i).gameObject); } iStageID = iStageId; //StageTemplate stageinfo = (StageTemplate)DataTemplate.GetInstance().m_StageTable.getTableData(iStageID); StageTemplate stageinfo = StageModule.GetStageTemplateById(iStageID); ////if (list.ContainsKey(iStageId)) //{ // //StageTemplate stageinfo = (StageTemplate)list[iStageID]; // if (stageinfo != null) // { // Dictionary<string, int> temp = stageinfo.getDisplaydrop(); // foreach (var info in temp) // { // GameObject gooditem = Instantiate(Resources.Load("UI/Prefabs/UI_Fight/UI_LGoodItem")) as GameObject; // gooditem.transform.SetParent(mGoodsItemGroup, false); // gooditem.AddComponent<UI_GoodItem>().InitFightAreaGoodItem(info.Key, info.Value); // } // } //} string displaydrop = stageinfo.m_displaydrop; if (displaydrop == "-1" || string.IsNullOrEmpty(displaydrop)) { } else { string[] displaydropList = displaydrop.Split('#'); if (displaydropList.Length == 0) { return; } for (int i = 0; i < displaydropList.Length; i++) { string[] itemList = displaydropList[i].Split('-'); switch (int.Parse(itemList[0])) { case 1: int inner = int.Parse(itemList[1]); int itemid = inner / 1000000; switch (itemid) { case (int)EM_OBJECT_CLASS.EM_OBJECT_CLASS_RUNE: { GameObject item = Instantiate(Resources.Load("UI/Prefabs/UI_Fight/UI_LGoodRune"), transform.position, transform.rotation) as GameObject; item.transform.SetParent(mGoodsItemGroup, false); //item.transform.parent = mGoodsItemGroup; //item.transform.localScale = Vector3.one; //ItemTemplate itemTable = (ItemTemplate)DataTemplate.GetInstance().m_ItemTable.getTableData(inner); ItemTemplate itemTable = DataTemplate.GetInstance().GetItemTemplateById(inner); UI_DropFightItemManage uifigt = item.GetComponent <UI_DropFightItemManage>(); uifigt.typeNum = 1; uifigt.id = inner; uifigt.mIcon.sprite = UIResourceMgr.LoadSprite(common.defaultPath + itemTable.getIcon()); uifigt.mIcon.SetNativeSize(); if (int.Parse(itemList[2]) == 0) { uifigt.mProbability.SetActive(true); uifigt.mNumObj.SetActive(false); } else { uifigt.mProbability.SetActive(false); uifigt.mNumObj.SetActive(true); uifigt.mNum.text = "x" + itemList[3]; } objList.Add(item); } break; case (int)EM_OBJECT_CLASS.EM_OBJECT_CLASS_COMMON: { GameObject item = Instantiate(Resources.Load("UI/Prefabs/UI_Fight/UI_LGoodItem"), transform.position, transform.rotation) as GameObject; item.transform.SetParent(mGoodsItemGroup, false); //item.transform.parent = mGoodsItemGroup; //item.transform.localScale = Vector3.one; //ItemTemplate itemTable = (ItemTemplate)DataTemplate.GetInstance().m_ItemTable.getTableData(inner); ItemTemplate itemTable = DataTemplate.GetInstance().GetItemTemplateById(inner); UI_DropFightItemManage uifigt = item.GetComponent <UI_DropFightItemManage>(); uifigt.id = inner; uifigt.typeNum = 2; uifigt.mIcon.sprite = UIResourceMgr.LoadSprite(common.defaultPath + itemTable.getIcon()); uifigt.mIcon.SetNativeSize(); if (int.Parse(itemList[2]) == 0) { uifigt.mProbability.SetActive(true); uifigt.mNumObj.SetActive(false); } else { uifigt.mProbability.SetActive(false); uifigt.mNumObj.SetActive(true); uifigt.mNum.text = "x" + itemList[3]; } objList.Add(item); } break; case (int)EM_OBJECT_CLASS.EM_OBJECT_CLASS_HERO: { GameObject item = Instantiate(Resources.Load("UI/Prefabs/UI_Fight/UI_LGoodHero"), transform.position, transform.rotation) as GameObject; item.transform.SetParent(mGoodsItemGroup, false); //item.transform.parent = mGoodsItemGroup; //item.transform.localScale = Vector3.one; //HeroTemplate hero = (HeroTemplate)DataTemplate.GetInstance().m_HeroTable.getTableData(inner); HeroTemplate hero = DataTemplate.GetInstance().GetHeroTemplateById(inner); UI_DropFightItemManage uihero = item.GetComponent <UI_DropFightItemManage>(); uihero.id = inner; uihero.typeNum = 3; //ArtresourceTemplate art = (ArtresourceTemplate)DataTemplate.GetInstance().m_ArtresourceTable.getTableData(hero.getArtresources()); ArtresourceTemplate art = DataTemplate.GetInstance().GetArtResourceTemplate(hero.getArtresources()); uihero.mIcon.sprite = UIResourceMgr.LoadSprite(common.defaultPath + art.getHeadiconresource()); uihero.mIcon.SetNativeSize(); int star = hero.getQuality(); int maxStar = hero.getMaxQuality(); for (int j = 0; j < 5; j++) { uihero.starList[j].SetActive(j < star); uihero.starList[j + 5].SetActive(j < maxStar); } //for (int j = 0; j < star; j++) //{ // uihero.starList[j].SetActive(true); //} //for (int k = star; k < 5; k++) //{ // uihero.starList[k].SetActive(false); //} if (int.Parse(itemList[2]) == 0) { uihero.mProbability.SetActive(true); } else { uihero.mProbability.SetActive(false); } objList.Add(item); } break; default: break; } break; case 2: GameObject items = Instantiate(Resources.Load("UI/Prefabs/UI_Fight/UI_LGoodItem"), transform.position, transform.rotation) as GameObject; items.transform.SetParent(mGoodsItemGroup, false); //items.transform.parent = mGoodsItemGroup; //items.transform.localScale = Vector3.one; UI_DropFightItemManage uiitems = items.GetComponent <UI_DropFightItemManage>(); uiitems.id = 2; uiitems.mIcon.sprite = UIResourceMgr.LoadSprite(common.defaultPath + itemList[1]); uiitems.mIcon.SetNativeSize(); if (int.Parse(itemList[2]) == 0) { uiitems.mProbability.SetActive(true); uiitems.mNumObj.SetActive(false); } else { uiitems.mProbability.SetActive(false); uiitems.mNumObj.SetActive(true); uiitems.mNum.text = "x" + itemList[3]; } if (itemList[3] == "0") { uiitems.mTipsText = null; } else { uiitems.mTipsText = itemList[3]; } objList.Add(items); break; default: break; } } } }
public override void InitUIData() { base.InitUIData(); MsgBoxGroup = selfTransform.FindChild("MsgBoxGroup"); selfTransform.FindChild("ContinueButton").GetComponent <Button>().onClick.AddListener(new UnityEngine.Events.UnityAction(OnClickAddFightNum)); selfTransform.FindChild("ReturnButton").GetComponent <Button>().onClick.AddListener(new UnityEngine.Events.UnityAction(OnCloseFightBuy)); powerBuyNum = selfTransform.FindChild("BuyNum").GetComponent <Text>(); needGold = selfTransform.FindChild("NeedGold/Text").GetComponent <Text>(); allGold = selfTransform.FindChild("AllGold/Text").GetComponent <Text>(); info = ObjectSelf.GetInstance(); //if (info.GetIsPrompt()) //{ // list = info.BattleStageData.m_BattleStageList[1001]; //} //else //{ // if (info.BattleStageData.m_BattleStageList.ContainsKey(info.GetCurChapterID())) // { // list = info.BattleStageData.m_BattleStageList[info.GetCurChapterID()]; // } //} BattleStage bs = StageModule.GetPlayerBattleStageInfo(); if (bs != null) { list = bs; } data = list == null ? null : list.GetStageData(info.CurStageID); //VipTemplate vip = (VipTemplate)DataTemplate.GetInstance().m_VipTable.getTableData(info.VipLevel); //StageTemplate stageinfo = (StageTemplate)DataTemplate.GetInstance().m_StageTable.getTableData(info.CurStageID); VipTemplate vip = DataTemplate.GetInstance().GetVipTemplateById(info.VipLevel); StageTemplate stageinfo = StageModule.GetStageTemplateById(info.CurStageID); int[] needGoldList = stageinfo.m_resetCost; if (needGoldList.Length > 0) { if (vip.getStageResetBuyTimes() > 0) { if (data.m_BuyBattleNum == vip.getStageResetBuyTimes()) { needGoldNum = needGoldList[needGoldList.Length - 1]; } else { if (needGoldList.Length < data.m_BuyBattleNum) { needGoldNum = needGoldList[needGoldList.Length - 1]; } else { needGoldNum = needGoldList[data.m_BuyBattleNum]; } } } else { needGoldNum = needGoldList[0]; } } powerBuyNum.text = (vip.getStageResetBuyTimes() - data.m_BuyBattleNum).ToString(); needGold.text = needGoldNum.ToString(); allGold.text = info.Gold.ToString(); }