public static void ReBuildShip() { U3DUtil.DestroyAllChild(m_MapStart.gameObject); Int2 roomGrid = new Int2(); switch (m_SceneState) { case TreasureState.None: case TreasureState.CanvasEdit: { ShipPlan plan = ShipPlanDC.GetCurShipPlan(); if (plan != null) { roomGrid = plan.Canvans.GetMapSize(); BattleEnvironmentM.ResetStartPos(plan.Canvans.GetMapSize(), true); } GenerateShip.GenerateShips(m_MapStart); break; } } Vector3 pos = MainCameraM.GetMainCameraPos(roomGrid); MainCameraM.s_Instance.SetCameraLimitParam(MainCameraM.s_reaLimitPyramidBoatView); MainCameraM.s_Instance.AutoMoveTo(pos, 0f); }
void BtnSetTransGate_OnClickEventHandler(UIButton sender) { SetBuildParaStart(); List <CanvasCore> childrenCore = PutCanvasM.GetChildByCore(m_Core); if (childrenCore.Count == 0) { #if UNITY_EDITOR_LOG NGUIUtil.DebugLog("房间内未检测到传送门,请调查!!!"); #endif return; } ShipPlan P = ShipPlanDC.GetCurShipPlan(); if (P == null) { return; } foreach (var childCore in childrenCore) { TouchMove tm = PutCanvasM.GetTouchMoveByCore(childCore); BuildProperty lifeobj = tm.GetComponent <BuildProperty>(); if (lifeobj != null && lifeobj.GetModeType() == 1605) { Building1605 b = lifeobj.GetLife() as Building1605; if (b != null) { ShipPutInfo Info = P.GetShipBuildInfo(m_Core); b.ShowTranGate(new Int2(Info.shipput_data0, Info.shipput_data1)); } } } }
/// <summary> /// 设置参数,第一个参数为关联的建筑Core /// </summary> public void SetBuildPara(CanvasCore Core, int data0, int data1) { ShipPlan P = ShipPlanDC.GetCurShipPlan(); if (P == null) { return; } shipput_data0 = data0; shipput_data1 = data1; if (IsTransgateRoom() == true) { ShipPutInfo Info = P.GetShipBuildInfo(Core); if (Info != null) { OffX = data0 - Info.cxMapGrid; OffY = data1 - Info.cyMapGrid; LinkRoomID = Core.m_ID; } else { LinkRoomID = -1; OffX = 0; OffY = 0; } } }
/// <summary> /// 更新传送门- 传送点 /// </summary> /// <param name="diffX"></param> /// <param name="diffY"></param> public void UpdateTransgateRoomParam(int diffX, int diffY) { ShipPlan P = ShipPlanDC.GetCurShipPlan(); if (P == null) { return; } if (IsTransgateRoom() == false) { return; } ShipPutInfo Info = P.GetShipBuildInfo(new CanvasCore(ShipBuildType.BuildRoom, false, LinkRoomID, LinkRoomID, Vector2.zero)); if (Info != null) { shipput_data0 = Info.cxMapGrid + OffX; shipput_data1 = Info.cyMapGrid + OffY; } else { shipput_data0 += diffX; shipput_data1 += diffY; } }
public override void WndStart() { base.WndStart(); if (MyHead.BtnReturn) { MyHead.BtnReturn.OnClickEventHandler += BtnReturn_OnClickEventHandler; } if (MyHead.BtnNext) { MyHead.BtnNext.OnClickEventHandler += BtnNext_OnClickEventHandler; } MainCameraM.s_Instance.EnableDrag(false); m_IsSaving = false; PutCanvasM.CanOperate = true; //TouchMove.s_CanOperate = true; //TouchMoveManager.HideDeckCanvasUnit(); CangKuWnd wnd = WndManager.GetDialog <CangKuWnd>(); ShipPlan P = ShipPlanDC.GetCurShipPlan(); P.BackupPlan(); LoadShipDesign(); //LoadCanvasBox(); }
private void SetCombatPower() { ShipPlan Plan = ShipPlanDC.GetCurShipPlan(); int combatPower = Plan.CombatPower; MyHead.LblCombatPower.text = combatPower.ToString(); }
/// <summary> /// 主菜单初始设定 /// </summary> void MainMenuInit() { m_bOpenMainMenu = false;//默认是关闭主菜单 if (MyHead.BtnClick) { MyHead.BtnClick.OnClickEventHandler += BtnClick_OnClickEventHandler; } if (MyHead.BtnWndBackground) { MyHead.BtnWndBackground.OnClickEventHandler += BtnWndBackground_OnClickEventHandler; } if (MyHead.GoTweenSprite) { Vector3 pos = MyHead.GoTweenSprite.transform.localPosition; if (m_bOpenMainMenu == true) { MyHead.GoTweenSprite.transform.localPosition = U3DUtil.SetY(pos, m_fMaxHeight); } else { MyHead.GoTweenSprite.transform.localPosition = U3DUtil.SetY(pos, m_fMinHeight); } } if (MyHead.LblFangAnName != null) { ShipPlan P = ShipPlanDC.GetCurShipPlan(); MyHead.LblFangAnName.text = P.Name; } }
public void SetCaption(int id) { m_iCurCaptainID = id; CaptionInfo c = BlackScienceDC.GetCaption(id); ShipPlan P = ShipPlanDC.GetCurShipPlan(); P.BlackScienceID = c.m_id; SetBlackScienceUI(c); }
/// <summary> /// 构建编辑战斗环境 /// </summary> private static void BuildCombatEditScene() { ShipPlan plan = ShipPlanDC.GetCurShipPlan(); if (plan != null) { LoadShipCanvans(plan.ShipDesignId); } LoadShipBuild(); }
/// <summary> /// 加入一个房间。从仓库中加载。或加载方案 /// </summary> /// <param name="Core">核心结构</param> /// <param name="TargetPos">格子坐标</param> public static void AddNewCore(CanvasCore Core, Int2 TargetPos) { if (Core == null) { return; } ShipPlan P = ShipPlanDC.GetCurShipPlan(); if (P == null) { return; } ShipPutInfo Info = P.GetShipBuildInfo(Core); if (Info == null) { return; } if (Core.IsNewCreate) { Info.SetBuildPostion(TargetPos); P.AddShipBuildInfo(Info, Core.m_type); TouchMoveManager.MoveToShip(Core); Core.IsNewCreate = false; } // if (Core.m_type == ShipBuildType.BuildRoom) { if (Core.IsDeckRoom == false) { ShapeType Shape = Info.GetPutRoomShape(); if (Shape == null) { return; } RoomMap.OpenCanvans(Shape.GetShapeData(new Int2(Info.cxMapGrid, Info.cyMapGrid)), Core.m_ID); //设置甲板区域 RoomMap.UpdateDeckRoomGrid(); //更新金库房间 if (Info.IsGoldBuild() == true) { RoomMap.UpdateGoldRoomGrid(Core.GetPutRoomGridPos()); } } else { RoomMap.AddDeckBuild(Core.m_ID, Core.GetPutRoomGridPos()); } } else { RoomMap.AddMapPosition(Core, RoomMap.GetPutRoomGridPosition(Core)); } }
/// <summary> /// 生成甲板 排除拖动的房间 /// </summary> private void GenerateDeckWithOutThis() { ShipPlan P = ShipPlanDC.GetCurShipPlan(); if (P == null) { return; } P.DoDeckDataStartWithOut(m_Core.Data); GenerateShip.CreateMiddleBeam(); P.DoDeckDataEnd(); }
/// <summary> /// 生成甲板 /// </summary> private void GenerateDeck() { ShipPlan P = ShipPlanDC.GetCurShipPlan(); if (P == null) { return; } P.DoDeckDataStart(); GenerateShip.CreateMiddleBeam(); P.DoDeckDataEnd(); }
/// <summary> /// 黑科技 /// </summary> void BtnBlackScience_OnClickEventHandler(UIButton sender) { if (BlackScienceDC.CheckHaveCaption() == false) { NGUIUtil.ShowTipWndByKey(30000050); return; } BlackScienceChoWnd bsWnd = WndManager.GetDialog <BlackScienceChoWnd>(); ShipPlan P = ShipPlanDC.GetCurShipPlan(); CaptionInfo captionInfo = BlackScienceDC.GetCaptionD(P.BlackScienceID); bsWnd.SetSelectCaptain(captionInfo); }
void BtnNO_OnClickEventHandler(UIButton sender) { ShipPlan P = ShipPlanDC.GetCurShipPlan(); P.ResetPlan(); WndManager.DestoryDialog <IsSaveFangAnWnd>(); ShipCanvasWnd wnd = WndManager.FindDialog <ShipCanvasWnd>(); if (wnd) { wnd.DoReturn(); } }
/// <summary> /// 移除一个房间 /// </summary> public static void RemoveBuildRoom(CanvasCore Core) { if (Core == null) { return; } ShipPlan P = ShipPlanDC.GetCurShipPlan(); if (P == null) { return; } ShipPutInfo Info = P.GetShipBuildInfo(Core); if (Info == null) { return; } if (Core.m_type == ShipBuildType.BuildRoom) { if (Core.IsDeckRoom == false) { if (Info.GetPutRoomShape() != null) { List <CanvasCore> l = PutCanvasM.GetChildByCore(Core); foreach (CanvasCore c in l) { ShipPutInfo II = P.GetShipBuildInfo(c); if (II != null) { P.RemoveShipBuildInfo(II, c.m_type); } } RoomMap.CloseCanvans(Core.GetPutRoomGridPos()); //设置甲板区域 RoomMap.UpdateDeckRoomGrid(); } } else { List <Int2> l = Core.GetPutRoomGridPos(); RoomMap.RemoveDeckBuild(l); } } else { RoomMap.RemoveMapPosition(Core, RoomMap.GetPutRoomGridPosition(Core)); } P.RemoveShipBuildInfo(Info, Core.m_type); }
public void DoReturn() { RoomMap.ClearCanvansArea(); TouchMoveManager.ClearShipBuild(); ShipPlan P = ShipPlanDC.GetCurShipPlan(); P.ResetPutID(); U3DUtil.DestroyAllChild(TreasureScene.GetMapStart().gameObject); WndManager.DestroyAllDialogs(); BoatObj.SendGetPlanData(); TreasureScene.BuildUIByTreasureState(); TreasureScene.OutTreasureScene(); }
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 RefreshBlackScienceUI() { ShipPlan P = ShipPlanDC.GetCurShipPlan(); CaptionInfo captionInfo = BlackScienceDC.GetCaptionD(P.BlackScienceID); if (captionInfo != null) { SetBlackScienceUI(captionInfo); } else //未设置黑科技 { NGUIUtil.Set2DSprite(MyHead.SprCaptainHead, "Textures/role/", "-999"); NGUIUtil.SetLableText <string>(MyHead.LblSkillName, ""); } }
void DoFinish() { //U3DUtil.DestroyAllChild(BattleEnvironmentM.GetLifeMBornNode(true).gameObject,false); RoomMap.CreateCanvansArea(); ShipPlan Plan = ShipPlanDC.GetCurShipPlan(); Plan.ReCalcShipBuildInfoXY(XYmode.Save2Edit); BattleEnvironmentM.SetBattleEnvironmentMode(BattleEnvironmentMode.Edit); BattleEnvironmentM.BuildScene(); WndManager.DestoryDialog <ShipShowWnd>(); WndManager.DestoryDialog <FangAnMenuWnd>(); GenerateShip.CreateMiddleBeam(); WndManager.GetDialog <ShipCanvasWnd>().ShowDialog(); MainCameraM.s_Instance.EnableOthOn(true); }
public void AddSoldier() { U3DUtil.DestroyAllChild(MyHead.Parent.gameObject, false); List <SoldierInfo> lSoldierInfo = new List <SoldierInfo>(); List <BuildInfo> lBuildInfo = new List <BuildInfo>(); List <BuildInfo> lStair = new List <BuildInfo>(); ShipPlan Plan = ShipPlanDC.GetCurShipPlan(); Plan.GetShipLifeObj(ref lSoldierInfo, ref lBuildInfo, ref lStair); foreach (SoldierInfo item in lSoldierInfo) { CreateItem(item); } NGUIUtil.RepositionTablePivot(MyHead.Parent.gameObject); SetCombatPower(); }
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); } } }
public void BtnReturn_OnClickEventHandler(UIButton sender) { Life.Environment = LifeEnvironment.View; PutCanvasM.PutDownNewBuild(); ShipPlan P = ShipPlanDC.GetCurShipPlan(); P.Mode = XYmode.Edit2Save; if (P.IsShipEditChange() == false) //如果未修改,则直接返回 { P.ReCalcShipBuildInfoXY(XYmode.Edit2Save); DoReturn(); return; } if (!m_IsSaving) { WndManager.GetDialog <IsSaveFangAnWnd>(); } }
/// <summary> /// 创建楼梯 /// </summary> /// <param name="Core"></param> public static void CreateStair(CanvasCore Core) { ShipPlan P = ShipPlanDC.GetCurShipPlan(); if (P == null) { return; } if (Core.m_type != ShipBuildType.BuildRoom && Core.IsDeckRoom) { return; } //只有房间变化楼梯才重新创建 List <Int2> points = RoomMap.GetStairCreatePoint(); if (points.Count > 0) { foreach (var grid in points) { ShipPutInfo Info = new ShipPutInfo(); Info.id = ShipPutInfo.GetNewShipPutId(); Info.objid = 1201; Info.type = 3; Info.cxMapGrid = grid.Unit; Info.cyMapGrid = grid.Layer; Info.shipput_data0 = 0; Info.shipput_data1 = 0; P.AddShipBuildInfo(Info, ShipBuildType.BuildStair); BuildInfo stair = buildingM.GetStartBuildInfo(1201); ///// 临时修改,楼梯位置不正确的问题 //stair.m_type = 1201; stair.m_cx = grid.Unit; stair.m_cy = grid.Layer; stair.m_ShipPutdata0 = 0; stair.m_ShipPutdata1 = 0; ///end if (stair != null) { BattleEnvironmentM.LoadShipPutStairBuild(Info.id, Info.objid, stair); } } } RoomMap.RemoveExcessStair(); }
void SetUI() { if (MyHead.LblFangAnName) { MyHead.LblFangAnName.text = m_ShipPlan.Name; } if (MyHead.SprBg) { ShipPlan CurPlan = ShipPlanDC.GetCurShipPlan(); if (CurPlan.ID == m_ShipPlan.ID) { MyHead.SprBg.spriteName = "bj_bg005"; } else { MyHead.SprBg.spriteName = "bj_bg006"; } } }
/// <summary> /// 设置建筑参数 /// </summary> public void SetBuildParam(CanvasCore core, int data0, int data1) { ShipPlan P = ShipPlanDC.GetCurShipPlan(); if (P == null) { return; } if (!m_Core.IsNewCreate) { if (m_Core.m_type != ShipBuildType.Soldier) { ShipPutInfo Info = P.GetShipBuildInfo(m_Core); if (Info != null) { Info.SetBuildPara(core, data0, data1); } } } SetBuildParaOver(); }
/// <summary> /// 加载编辑船只数据。 /// </summary> public static void LoadShipBuild() { ShipPlan P = ShipPlanDC.GetCurShipPlan(); List <ShipPutInfo> PutBuild = P.GetShipBuildInfo(ShipBuildType.All); if (PutBuild != null) { foreach (ShipPutInfo r in PutBuild) { if (r == null) { continue; } if (r.type == (int)ShipBuildType.BuildRoom) { BuildInfo RoomBuild = r.GetBuildInfo(); if (RoomBuild != null) { LoadShipPutBuild(r.id, r.objid, RoomBuild); } } else if (r.type == (int)ShipBuildType.BuildStair) { BuildInfo RoomBuild = r.GetBuildInfo(); if (RoomBuild != null) { LoadShipPutStairBuild(r.id, r.objid, RoomBuild); } } else if (r.type == (int)ShipBuildType.Soldier) { SoldierInfo s = new SoldierInfo(); if (r.GetSoldier(ref s) == true) { LoadShipPutSoldier(r.id, r.objid, s); } } } } }
/// <summary> /// 确认能否移除 /// </summary> /// <returns>true 能被删除,false 不能被删除</returns> public static bool CheckCanRemove(CanvasCore Core, ref PutERR err) { if (Core == null) { return(false); } ShipPlan P = ShipPlanDC.GetCurShipPlan(); if (P == null) { return(false); } ShipPutInfo Info = P.GetShipBuildInfo(Core); if (Info == null) { return(false); } if (Core.m_type == ShipBuildType.BuildRoom && !Core.IsNewCreate) { if (Core.IsDeckRoom == false) { /* * List<Int2> SubList = Core.GetPutRoomGridXY(); * List<Int2> AddList = new List<Int2>(); * if(RoomMap.CheckMapLinkOk(SubList ,AddList ,Core.m_style, true) == false) * { * err = PutERR.ERR_NOLink; * return false; * }*/ return(true); } else { return(true); } } return(true); }
void SaveSuccecd() { TouchMoveManager.ShowCanvas(false); MainCameraM.s_Instance.ResetCameraDataByHaven(); MainCameraM.s_Instance.EnableOthOn(false); MainCameraM.s_Instance.SetCameraLimitParam(MainCameraM.s_reaLimitPyramidHavenView); MainCameraM.s_Instance.AutoMoveTo(MainCameraM.s_vHavenViewBoatviewCamPos, 0.3f); MainCameraM.s_Instance.EnableDrag(false); Life.Environment = LifeEnvironment.View; PutCanvasM.PutDownNewBuild(); TouchMoveManager.DoTransgatePoint(); m_IsSaving = true; if (MyHead.BtnReturn) { MyHead.BtnReturn.gameObject.SetActive(false); } if (MyHead.BtnNext) { MyHead.BtnNext.gameObject.SetActive(false); } CangKuWnd wnd = WndManager.FindDialog <CangKuWnd>(); if (wnd) { wnd.gameObject.SetActive(false); } PutCanvasM.CanOperate = false; PutCanvasM.ShowRoomGridUI(false); TouchMoveManager.SetCurTouchMove(null); MainCameraM.s_Instance.EnableDrag(false); ShipPlan P = ShipPlanDC.GetCurShipPlan(); P.CreateCanvans(); GenerateShip.GenerateShipsWithAni(); }
//避风港 public void ResetCameraDataByHaven() { Camera cam = Camera.main; Vector3 posTemp = new Vector3(cam.transform.position.x, cam.transform.position.y, cam.transform.position.z); //主场景最大画面,目前定死 //主场景场景最大画面时,0面占屏幕的纵横世界长度 float zoomPyramid_S = -267.6354f; //锥体顶点 float zPosBackGround = 0f; //最后面背景所在的位置 cam.transform.position = new Vector3(0, 13.09499f, zoomPyramid_S); Vector3 posScreenCenterWorldB = cam.ViewportToWorldPoint(new Vector3(1.0f, 0f, zPosBackGround - zoomPyramid_S)); Vector3 posScreenLeftWorldB = cam.ViewportToWorldPoint(new Vector3(0f, 0f, zPosBackGround - zoomPyramid_S)); float fWidthBackGroundScreen = posScreenCenterWorldB.x - posScreenLeftWorldB.x; float zoomLimitMinX = -86f + fWidthBackGroundScreen / 2f; float zoomLimitMaxX = 0;//28f-fWidthBackGroundScreen/2f; s_vHavenViewFarthestCamPos = new Vector3(-28.0f, 13.09499f, zoomPyramid_S); cam.transform.position = new Vector3(s_vHavenViewFarthestCamPos.x, s_vHavenViewFarthestCamPos.y, zoomPyramid_S); float zoomPyramid_O = -CalcCameraLimitZBySWH(9f, s_fov); s_reaLimitPyramidHavenView = s_reaLimitPyramidHavenView != null ? s_reaLimitPyramidHavenView : new AreaLimitPyramid(); s_reaLimitPyramidHavenView.m_vTopL = new Vector3(zoomLimitMinX, s_vHavenViewFarthestCamPos.y, zoomPyramid_S); s_reaLimitPyramidHavenView.m_vTopR = new Vector3(zoomLimitMaxX, s_vHavenViewFarthestCamPos.y, zoomPyramid_S); cam.transform.position = new Vector3(zoomLimitMinX, s_vHavenViewFarthestCamPos.y, zoomPyramid_S); s_reaLimitPyramidHavenView.m_vBottomLT = cam.ViewportToWorldPoint(new Vector3(0, 1, zoomPyramid_O - zoomPyramid_S)); s_reaLimitPyramidHavenView.m_vBottomLB = cam.ViewportToWorldPoint(new Vector3(0, 0, zoomPyramid_O - zoomPyramid_S)); cam.transform.position = new Vector3(zoomLimitMaxX, s_vHavenViewFarthestCamPos.y, zoomPyramid_S); s_reaLimitPyramidHavenView.m_vBottomRT = cam.ViewportToWorldPoint(new Vector3(1, 1, zoomPyramid_O - zoomPyramid_S)); s_reaLimitPyramidHavenView.m_vBottomRB = cam.ViewportToWorldPoint(new Vector3(1, 0, zoomPyramid_O - zoomPyramid_S)); s_reaLimitPyramidHavenView.m_fZDeep = zoomPyramid_S; s_reaLimitPyramidHavenView.m_fxRightDeep = s_reaLimitPyramidHavenView.m_vBottomRT.x; s_reaLimitPyramidHavenView.m_fxLeftDeep = s_reaLimitPyramidHavenView.m_vBottomLT.x; s_reaLimitPyramidHavenView.m_fYBTopDeep = s_reaLimitPyramidHavenView.m_vBottomLT.y; s_reaLimitPyramidHavenView.m_fYBottomDeep = s_reaLimitPyramidHavenView.m_vBottomRB.y; //编辑船时最大场景画面 Int2 Start = Int2.zero; ShipPlan p = ShipPlanDC.GetCurShipPlan(); if (p != null) { ShipCanvasInfo Canvans = p.Canvans; Start = Canvans.GetMapSize(); } float fZeroHeight = (Start.Layer + 2) * 3.3f * 12f / 7f; //船占高度的7/12 float fZeroWidth = fZeroHeight * s_aspect; float fBoatHeight = (Start.Layer + 1f) * 3.3f; //船高 float fBoatWidth = Start.Unit * 3.0f; //船宽 if (fZeroWidth < (Start.Unit + 2) * 3.0f) { fZeroWidth = (Start.Unit + 2) * 3.0f; fZeroHeight = fZeroWidth / s_aspect; } float fMaxZeroHeight = fZeroHeight + fBoatHeight; //最大场景0面对应的高度 float fMaxZeroWidth = fZeroWidth + fBoatWidth; //最大场景0面对应的高度 zoomPyramid_S = -CalcCameraLimitZBySWH(fMaxZeroHeight, s_fov); //锥体顶点 cam.transform.position = new Vector3(0, (fMaxZeroHeight - fZeroHeight) / 2.0f + 3f, zoomPyramid_S); //最大场景显示时的相机位置 float zoomPyramid_H = -CalcCameraLimitZBySWH(fZeroHeight, s_fov); //锥体高点坐标 zoomPyramid_O = -CalcCameraLimitZBySWH(9f, s_fov); //锥体底点坐标 s_reaLimitPyramidBoatView = s_reaLimitPyramidBoatView != null ? s_reaLimitPyramidBoatView : new AreaLimitPyramid(); s_reaLimitPyramidBoatView.m_vTopL = new Vector3(cam.transform.position.x, cam.transform.position.y, zoomPyramid_S); s_reaLimitPyramidBoatView.m_vTopR = new Vector3(cam.transform.position.x, cam.transform.position.y, zoomPyramid_S); s_reaLimitPyramidBoatView.m_vBottomLT = cam.ViewportToWorldPoint(new Vector3(0, 1, zoomPyramid_O - zoomPyramid_S)); s_reaLimitPyramidBoatView.m_vBottomLB = cam.ViewportToWorldPoint(new Vector3(0, 0, zoomPyramid_O - zoomPyramid_S)); s_reaLimitPyramidBoatView.m_vBottomRT = cam.ViewportToWorldPoint(new Vector3(1, 1, zoomPyramid_O - zoomPyramid_S)); s_reaLimitPyramidBoatView.m_vBottomRB = cam.ViewportToWorldPoint(new Vector3(1, 0, zoomPyramid_O - zoomPyramid_S)); s_reaLimitPyramidBoatView.m_fZDeep = zoomPyramid_H; s_reaLimitPyramidBoatView.m_fxRightDeep = fBoatWidth / 2f; s_reaLimitPyramidBoatView.m_fxLeftDeep = -fBoatWidth / 2f; s_reaLimitPyramidBoatView.m_fYBTopDeep = fBoatHeight + 3f; s_reaLimitPyramidBoatView.m_fYBottomDeep = 3f; float fBottom = fZeroHeight / 4f + 3.0f; //屏幕底往上1/4处为船底坐标位置 s_vHavenViewBoatviewCamPos = new Vector3(0f, fBottom, zoomPyramid_H); Start = new Int2(8, 4); fZeroHeight = (Start.Layer + 2) * 3.3f * 12f / 7f; //船占高度的7/12 fZeroWidth = fZeroHeight * s_aspect; fBoatHeight = (Start.Layer + 1f) * 3.3f; //船高 fBoatWidth = Start.Unit * 3.0f; //船宽 if (fZeroWidth < (Start.Unit + 2) * 3.0f) { fZeroWidth = (Start.Unit + 2) * 3.0f; fZeroHeight = fZeroWidth / s_aspect; } fMaxZeroHeight = fZeroHeight + fBoatHeight; //最大场景0面对应的高度 fMaxZeroWidth = fZeroWidth + fBoatWidth; //最大场景0面对应的高度 zoomPyramid_S = -CalcCameraLimitZBySWH(fMaxZeroHeight, s_fov); //锥体顶点 cam.transform.position = new Vector3(0, (fMaxZeroHeight - fZeroHeight) / 2.0f + 3f, zoomPyramid_S); //最大场景显示时的相机位置 zoomPyramid_H = -CalcCameraLimitZBySWH(fZeroHeight, s_fov); //锥体高点坐标 zoomPyramid_O = -CalcCameraLimitZBySWH(9f, s_fov); //锥体底点坐标 s_reaLimitPyramidEditView = s_reaLimitPyramidEditView != null ? s_reaLimitPyramidEditView : new AreaLimitPyramid(); s_reaLimitPyramidEditView.m_vTopL = new Vector3(cam.transform.position.x, cam.transform.position.y, zoomPyramid_S); s_reaLimitPyramidEditView.m_vTopR = new Vector3(cam.transform.position.x, cam.transform.position.y, zoomPyramid_S); s_reaLimitPyramidEditView.m_vBottomLT = cam.ViewportToWorldPoint(new Vector3(0, 1, zoomPyramid_O - zoomPyramid_S)); s_reaLimitPyramidEditView.m_vBottomLB = cam.ViewportToWorldPoint(new Vector3(0, 0, zoomPyramid_O - zoomPyramid_S)); s_reaLimitPyramidEditView.m_vBottomRT = cam.ViewportToWorldPoint(new Vector3(1, 1, zoomPyramid_O - zoomPyramid_S)); s_reaLimitPyramidEditView.m_vBottomRB = cam.ViewportToWorldPoint(new Vector3(1, 0, zoomPyramid_O - zoomPyramid_S)); s_reaLimitPyramidEditView.m_fZDeep = zoomPyramid_H; s_reaLimitPyramidEditView.m_fxRightDeep = fBoatWidth / 2f; s_reaLimitPyramidEditView.m_fxLeftDeep = -fBoatWidth / 2f; s_reaLimitPyramidEditView.m_fYBTopDeep = fBoatHeight + 3f; s_reaLimitPyramidEditView.m_fYBottomDeep = 3f; fZeroHeight = (Start.Layer + 1) * 3.3f * 20f / 13f; //船占高度的7/12 fZeroWidth = fZeroHeight * s_aspect; if (fZeroWidth < Start.Unit * 3.0f) { fZeroWidth = Start.Unit * 3.0f; fZeroHeight = fZeroWidth / s_aspect; } float zoomBoatviewZ = -CalcCameraLimitZBySWH(fZeroHeight, s_fov); fBottom = fZeroHeight / 4f + 3.0f; //屏幕底往上1/4处为船底坐标位置 s_vEditViewBoatviewCamPos = new Vector3(0f, fBottom, zoomBoatviewZ); cam.transform.position = posTemp; ScreenManager.onScreenSizeChanged = OnScreenSizeChange; }
public void BtnSelect_OnClickEventHandler() { if (m_iItemType == 3) { if (m_bSelect) { return; } m_bSelect = true; SoldierScrollWnd scrollWnd = WndManager.FindDialog <SoldierScrollWnd>(); if (scrollWnd) { scrollWnd.DoSelectItem(transform); } else { SelectSoldierwnd selectWnd = WndManager.FindDialog <SelectSoldierwnd>(); if (selectWnd) { selectWnd.SelectSoldier(Soldier.ID); } } return; } if (m_iItemType != 0) { return; } int id = 0; if (m_ShipBuildType == ShipBuildType.BuildRoom) { id = m_WareHouse [0].ID; } else if (m_ShipBuildType == ShipBuildType.Soldier) { id = Soldier.ID; } if (TouchMoveManager.CheckHaveExist(m_ShipBuildType, id)) { return; } CangKuWnd wnd = WndManager.FindDialog <CangKuWnd>(); //PlaneClickGrid.HideCangKuUI(); if (m_ShipBuildType == ShipBuildType.BuildRoom) { BattleEnvironmentM.CreateBuildingFromWarehouse(m_WareHouse [0]); m_WareHouse.RemoveAt(0); if (wnd) { wnd.RefreshTrapUI(); } } else if (m_ShipBuildType == ShipBuildType.Soldier) { ShipPlan P = ShipPlanDC.GetCurShipPlan(); if (P.CheckSoldierUpMaxCount() == true) { NGUIUtil.ShowTipWndByKey("88800014", 2.0f); } else { BattleEnvironmentM.CreateSoldierFromWarehouse(Soldier.ID); wnd.RefreshSoldierUI(CombatLoactionType.ALL); } } }