private void UpdateSweepInfo() { CounterPartInfo info = StageDC.GetCounterPartInfo(); int times = StageDC.GetPassStageTimes(m_type, m_stageid); bool passed = times > 0; bool hasBoss = info.isboss > 0; bool isPVE = StageDC.GetPveMode() == PVEMode.Attack; // 是否需要显示扫荡UI bool activeSweepInfo = passed && hasBoss && isPVE; MyHead.SweepGroup.SetActive(activeSweepInfo); if (!activeSweepInfo) { return; } ItemTypeInfo sweepTicketInfo = ItemDC.GetSweepTickets(); int sweepTicketCount = sweepTicketInfo == null ? 0 : sweepTicketInfo.Num; MyHead.LblSweepTicket.text = string.Format("x{0}", sweepTicketCount); int sweepOnce = 1; int currentSweepMultiple = 0; if (info.type == (int)StageType.Normal) { currentSweepMultiple = 10; } else if (info.type == (int)StageType.Hard) { currentSweepMultiple = 3; } MyHead.LblSweepMultiple.text = string.Format(NGUIUtil.GetStringByKey(70000255), currentSweepMultiple); MyHead.LblSweepOnce.text = string.Format(NGUIUtil.GetStringByKey(70000256), sweepOnce); }
public void SetWipeResult(List <StageDC.StageSweepReward> sweepRewards) { CounterPartInfo info = StageDC.GetCounterPartInfo(); if (info.type == (int)StageType.Normal) { MyHead.LblTitle.text = NGUIUtil.GetStringByKey(70000213); } else if (info.type == (int)StageType.Hard) { MyHead.LblTitle.text = NGUIUtil.GetStringByKey(70000214); } List <StageDC.StageSweepReward.ItemInfo> extraRewardItems = new List <StageDC.StageSweepReward.ItemInfo>(); for (int i = 0; i < sweepRewards.Count; i++) { StageDC.StageSweepReward sweepReward = sweepRewards[i]; GameObject go = Create(MyHead.SweepResultInfoTemplate, MyHead.StageWipeParent.transform); go.SetActive(true); SweepResultItem sweepResultItem = go.GetComponent <SweepResultItem>(); sweepResultItem.SetSweepResult(sweepReward, i); mSweepResultItems.Add(sweepResultItem); extraRewardItems.AddRange(sweepReward.mExtraRewards); } GameObject goExtra = Create(MyHead.SweepResultInfoTemplate, MyHead.StageWipeParent.transform); goExtra.SetActive(true); SweepResultItem sweepExtraRewardItem = goExtra.GetComponent <SweepResultItem>(); sweepExtraRewardItem.SetExtraRewardItems(extraRewardItems); mSweepResultItems.Add(sweepExtraRewardItem); MyHead.StageWipeParent.Reposition(); }
void Resweep(UIButton sender) { ItemTypeInfo sweepTicketInfo = ItemDC.GetSweepTickets(); if (sweepTicketInfo == null || sweepTicketInfo.Num < mSweepCount) { WndManager.DestoryDialog <StageWipeWnd>(); NGUIUtil.ShowFreeSizeTipWnd(NGUIUtil.GetStringByKey("70000229")); return; } CounterPartInfo info = StageDC.GetCounterPartInfo(); int playerPhysical = UserDC.GetPhysical(); // ÌåÁ¦²»×ã if (playerPhysical < info.win_physical * mSweepCount) { WndManager.DestoryDialog <StageWipeWnd>(); NGUIUtil.ShowFreeSizeTipWnd(NGUIUtil.GetStringByKey("99904008")); return; } StageDC.SendStageSweepRequest(StageDC.GetCompaignStageID(), mSweepCount); Clear(); //DataCenter.RegisterHooks((int)gate.Command.CMD.CMD_718, ShowSweepResult); }
/// <summary> /// 设置关卡副本数据 /// <summary> public void SetStageData(StageType Type, int Chapter, CounterPartInfo Info) { m_Type = Type; m_Chapter = Chapter; m_StageID = StageM.GetStageID(m_Type, m_Chapter, m_Stage); m_CounterInfo = Info; if (Info.isboss == 1) { if ((this is BossStageNode) == false) { //Debug.LogError("data skin is error"); } } else { if ((this is SmallStageNode) == false) { //Debug.LogError("data skin is error"); } } AddEvents(); InitUI(); }
/// <summary> /// 设置战役胜负 /// </summary> private void SetStageWin(bool outcome, int star) { bool boss = false; CounterPartInfo countInfo = StageM.GetCounterPartInfo(StageDC.GetCompaignStageID()); if (countInfo != null) { boss = countInfo.isboss == 1; } if (outcome) { MyHead.succ.gameObject.SetActive(true); MyHead.fail.gameObject.SetActive(false); SetStageStar(star, boss); GatePassInfo Info = new GatePassInfo(); Info.star = star; Info.times = 1; Info.stageid = StageDC.GetCompaignStageID(); StageDC.UpdataStageScheduler(Info); } else { MyHead.succ.gameObject.SetActive(false); MyHead.fail.gameObject.SetActive(true); MyHead.PvpPveFail.SetActive(true); MyHead.Datatable.gameObject.SetActive(false); // MyHead.PvpPveFail.transform.FindChild("PvpFailText").gameObject.SetActive(false); MyHead.Rewardtable.transform.parent.gameObject.SetActive(false); } }
public static void BuildViewStageScene() { CounterPartInfo Info = StageDC.GetCounterPartInfo(); ShipCanvasInfo Map = StageM.GetCounterPartMap(Info.countershipcanvasid); List <SoldierInfo> lSoldier = new List <SoldierInfo>(); List <BuildInfo> lBuild = new List <BuildInfo>(); StageM.GetCounterPartShipPut(Info.id, ref lSoldier, ref lBuild); CmCarbon.SetDefenseMap(Map); GenerateShip.GenerateShips(GetShipBodyMap(), GetLifeMBornNode(true), lBuild, lSoldier); MainCameraM.s_Instance.ResetCameraDataByBattle(); }
void ClickCombat(UIButton sender) { CounterPartInfo Info = StageDC.GetCounterPartInfo(); if (Info == null) { return; } if (m_type != StageType.Normal) { int Times = StageDC.GetPassStageTimes(m_type, m_stageid); if (Times >= Info.times) { NGUIUtil.ShowTipWndByKey("88800031", 2); return; } } if (StageDC.GetPveMode() == PVEMode.Defense) { SoundPlay.PlayBackGroundSound("bgm_battle_loop", true, false); ShipCanvasInfo Canvas = new ShipCanvasInfo(); List <SoldierInfo> lSoldier = new List <SoldierInfo>(); List <ShipPutInfo> lBuild = new List <ShipPutInfo>(); ShipPlanDC.SetCurShipPlan(PlanType.Default); ShipPlan Plan = ShipPlanDC.GetCurShipPlan(); Plan.GetShipCansInfoPlan(ref Canvas, ref lSoldier, ref lBuild); CmCarbon.SetDefenseMap(Canvas); CmCarbon.SetDefenseBuild(lBuild); CmCarbon.SetDefenseSoldier(lSoldier); CmCarbon.SetDefenseFloor(UserDC.GetDeckLevel()); CmCarbon.SetDefenseUserInfo(Info, null); List <int> l = new List <int>(); foreach (SoldierInfo s in lSoldier) { l.Add(s.ID); } sender.enabled = false; //DataCenter.RegisterHooks((int)gate.Command.CMD.CMD_702, CanCombat); //StageDC.SendStageAttackRequest(m_stageid, l, 0); SceneM.Load(CombatScene.GetSceneName(), false, false); } else { sender.enabled = false; //SoldierDC.Send_SoldierBattleListRequest(0); //DataCenter.RegisterHooks((int)gate.Command.CMD.CMD_214, LoadStage); SceneM.Load(CombatScene.GetSceneName(), false, false); } }
void CheckShowCombatResult() { CounterPartInfo info = StageDC.GetCounterPartInfo(); int Times = StageDC.GetPassStageTimes(StageDC.GetCompaignStageType(), StageDC.GetCompaignStageID()); if (Times == 0 && info.drop != null && info.drop.Length > 0) { StageDC.SendStageScriptDropRequest(StageDC.GetCompaignStageID()); DataCenter.RegisterHooks((int)gate.Command.CMD.CMD_716, ShowScriptCombatResult); } else { ShowCombatResult(); } }
public void SetStageid(StageType Type, int stageid) { m_stageid = stageid; m_type = Type; CounterPartInfo info = StageDC.GetCounterPartInfo(); StartCoroutine(DoBubble(info.m_lBubblePromt, 0.8f)); UpdateStageInfo(); ShowDropInfo(); ShowTitleByStageType(); UpdateSweepInfo(); if (StageDC.GetPveMode() == PVEMode.Defense) { ShipPlanDC.SetCurShipPlan(PlanType.Default); ShipPlan Plan = ShipPlanDC.GetCurShipPlan(); if (MyHead.RoleText != null) { MyHead.RoleText.text = "[ffff00]" + NGUIUtil.GetStringByKey("88800094") + "[-]"; } if (MyHead.PlanText != null) { if (Plan != null) { MyHead.PlanText.text = "[ffff00]" + NGUIUtil.GetStringByKey("88800095") + "[-][ffffff]" + Plan.Name + "[-]"; } else { MyHead.PlanText.text = "[ffff00]" + NGUIUtil.GetStringByKey("88800095") + "[-]"; } } SetStageSoldier(); MyHead.DefenseBg.gameObject.SetActive(true); } else { if (MyHead.Role != null) { MyHead.Role.SetActive(false); } if (MyHead.Plan != null) { MyHead.Plan.SetActive(false); } } }
/// <summary> /// 设置防守方玩家信息 /// </summary> public static void SetDefenseUserInfo(CounterPartInfo Info, List <BuildInfo> lb) { m_DefenderUserInfo.Name = Info.counterpartname; m_DefenderUserInfo.Level = Info.CounterNode; m_DefenderUserInfo.Coin = Info.rewardglod; int wood = 0; if (lb != null) { foreach (BuildInfo b in lb) { wood += b.m_wood; } } m_DefenderUserInfo.Wood = wood; }
/// <summary> /// 根据关卡id获取副本信息. /// </summary> /// <returns>The counter part info list.</returns> /// <param name="lStageID">L stage I.</param> public static List <CounterPartInfo> GetCounterPartInfoList(List <int> lStageID) { if (lStageID == null || lStageID.Count < 1) { return(null); } List <CounterPartInfo> lInfo = new List <CounterPartInfo>(); foreach (int stageId in lStageID) { CounterPartInfo info = GetCounterPartInfo(stageId); if (info != null) { lInfo.Add(info); } } return(lInfo); }
// 添加剧情掉落物品 private void AddScriptDropItems() { CounterPartInfo info = StageDC.GetCounterPartInfo(); int Times = StageDC.GetPassStageTimes(m_type, m_stageid); if (Times == 0 && info.drop != null) { JsonData jd = JsonMapper.ToObject(info.drop); if (jd.Keys.Contains("item")) { int count = jd["item"].Count; for (int i = 0; i < count; i++) { if (jd["item"][i].Keys.Contains("id")) { int id = (int)jd["item"][i]["id"]; SetStageItemReward(0, id, 0); } } } if (jd.Keys.Contains("captain")) { int count = jd["captain"].Count; for (int i = 0; i < count; i++) { int id = (int)jd["captain"][i]; SetStageItemReward(4, id, 0); } } if (jd.Keys.Contains("soldier")) { int count = jd["soldier"].Count; for (int i = 0; i < count; i++) { int id = (int)jd["soldier"][i]; SetStageItemReward(1, id, 0); } } } }
public void UpdateStageInfo() { CounterPartInfo Info = StageDC.GetCounterPartInfo(); if (Info != null) { if (MyHead.stagename != null) { int Stage = Info.id % 1000; MyHead.stagename.text = "[ffffff]" + Info.chapters + "-" + Stage + " " + Info.chaptersname + "·" + Info.counterpartname + "[-]"; } if (MyHead.ManualLabel != null) { MyHead.ManualLabel.text = "[ffff00]" + NGUIUtil.GetStringByKey("88800096") + "[-]" + "[ffffff]" + Info.win_physical + "[-]"; } if (MyHead.RewardLabel != null) { MyHead.RewardLabel.text = "[ffff00]" + NGUIUtil.GetStringByKey("88800097") + "[-]"; } if (MyHead.DescLabel != null) { MyHead.DescLabel.text = "[ffffff]" + Info.description + "[-]"; } if (MyHead.TimesLabel != null) { if (m_type == StageType.Normal) { MyHead.TimesLabel.text = ""; m_AvailableMultipleSweep = 10; } else { int Times = StageDC.GetPassStageTimes(m_type, m_stageid); m_AvailableMultipleSweep = Info.times - Times; MyHead.TimesLabel.text = "[ffff00]" + NGUIUtil.GetStringByKey("88800098") + "[-]" + "[ffffff]" + m_AvailableMultipleSweep + "/" + Info.times + "[-]"; } } SetStageStar(StageDC.GetPassStageStar(m_type, m_stageid)); } }
/// <summary> /// 加入战役战斗,填充战役相关数据。 /// </summary> public static bool JoinCompaignBattle() { m_CounterPartPutSoldier.Clear(); m_CounterPartEnemys.Clear(); m_CounterPartPutBulid.Clear(); m_CounterPartInfo = StageM.GetCounterPartInfo(m_stageid); if (m_CounterPartInfo != null) { SetStageReward(m_stageid); //战斗模式 if (m_CounterPartInfo.mode == 0) { m_CounterPartMap = StageM.GetCounterPartMap(m_CounterPartInfo.countershipcanvasid); StageM.GetCounterPartShipPut(m_stageid, ref m_CounterPartPutSoldier, ref m_CounterPartPutBulid); //加入战斗 CmCarbon.ReadyCombat(); CmCarbon.SetDefenseMap(m_CounterPartMap); CmCarbon.SetDefenseBuild(m_CounterPartPutBulid); CmCarbon.SetPVEMonisterSoldier(m_CounterPartPutSoldier); CmCarbon.SetDefenseFloor(m_CounterPartInfo.decklevel); CmCarbon.SetDefenseUserInfo(m_CounterPartInfo, m_CounterPartPutBulid); } else //防守模式 //StageM.GetCounterPartShipPut(m_stageid , ref m_CounterPartPutSoldier , ref m_CounterPartPutBulid); { StageM.GetCounterPartShipPut(m_stageid, ref m_CounterPartEnemys, ref m_CounterPartPutBulid); //加入战斗 CmCarbon.ReadyCombat(); CmCarbon.SetAttackSoldier(m_CounterPartEnemys); } if (GetPassStageStar(m_type, m_stageid) == 0 /*&& GetPassStageTimes (m_type ,m_stageid) == 0*/) { CmCarbon.SetStartTalk(m_CounterPartInfo.m_StageStartTalk); CmCarbon.SetEndTalk(m_CounterPartInfo.m_StageEndTalk); } return(true); } return(false); }
void ClickSweepMultiple(UIButton sender) { // 判定是否有扫荡券 ItemTypeInfo sweepTicketInfo = ItemDC.GetSweepTickets(); if (sweepTicketInfo == null || sweepTicketInfo.Num < m_AvailableMultipleSweep) { NGUIUtil.ShowFreeSizeTipWnd(NGUIUtil.GetStringByKey("70000229")); return; } CounterPartInfo info = StageDC.GetCounterPartInfo(); // 体力不足 int playerPhysical = UserDC.GetPhysical(); if (playerPhysical < info.win_physical * m_AvailableMultipleSweep) { NGUIUtil.ShowFreeSizeTipWnd(NGUIUtil.GetStringByKey("99904008")); return; } // VIP, 解锁判定 //...... int vipLevel = UserDC.GetVIPLevel(); if (vipLevel < 4) { string tip = string.Format(NGUIUtil.GetStringByKey("70000228"), 4); NGUIUtil.ShowFreeSizeTipWnd(tip); //return; } m_ClickSweepTimes = m_AvailableMultipleSweep; StageDC.SendStageSweepRequest(StageDC.GetCompaignStageID(), m_ClickSweepTimes); DataCenter.RegisterHooks((int)gate.Command.CMD.CMD_718, ShowSweepResult); }
void ClickSweepOnce(UIButton sender) { // 判定是否有扫荡券 ItemTypeInfo sweepTicketInfo = ItemDC.GetSweepTickets(); if (sweepTicketInfo == null || sweepTicketInfo.Num == 0) { NGUIUtil.ShowFreeSizeTipWnd(NGUIUtil.GetStringByKey("70000229")); return; } CounterPartInfo info = StageDC.GetCounterPartInfo(); int playerPhysical = UserDC.GetPhysical(); // 体力不足 if (playerPhysical < info.win_physical) { NGUIUtil.ShowFreeSizeTipWnd(NGUIUtil.GetStringByKey("99904008")); return; } m_ClickSweepTimes = 1; StageDC.SendStageSweepRequest(StageDC.GetCompaignStageID(), m_ClickSweepTimes); DataCenter.RegisterHooks((int)gate.Command.CMD.CMD_718, ShowSweepResult); }
public void SetCounterInfoData(CounterPartInfo info) { m_counterInfo = info; }
/// <summary> /// 初始化副本数据 /// </summary> public void SetStageContext(StageType Type, int Chapter) { m_CounterInfo = StageDC.GetChaptersGate(Chapter, Type); if (m_CounterInfo == null || m_CounterInfo.Count == 0) { Debug.LogError("s_counterpartInfo is error"); return; } if (m_StageNode == null || m_StageNode.Count == 0) { Debug.LogError("m_StageNode is error"); return; } if (m_StageNode.Count < m_CounterInfo.Count) { NGUIUtil.ShowFreeSizeTipWnd(20000001, null, 30); return; } foreach (StageNode Node in m_StageNode) { if (Node == null) { Debug.LogError("Node is error"); continue; } else { CounterPartInfo Info = FindCounterpartInfo(Type, Chapter, Node.m_Stage); if (Info == null) { Node.gameObject.SetActive(false); continue; } else { Node.SetStageData(Type, Chapter, Info); } } } if (m_lbStageName != null) { m_lbStageName.text = "[ffffff]" + NGUIUtil.GetStringByKey("88800092") + m_CounterInfo[0].chapters.ToString() + NGUIUtil.GetStringByKey("88800093") + " " + m_CounterInfo[0].chaptersname; } else { Debug.LogError("m_lbStageName is null"); } foreach (StageLine line in m_StageLine) { if (line == null) { Debug.LogError("Node is error"); continue; } else { line.SetStageData(Type, Chapter); } } }