Esempio n. 1
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;
        }
    }
Esempio n. 2
0
    public void CopyPlanShipPut(ShipPlan Info)
    {
        m_Canvans.Copy(Info.m_Canvans);

        m_Soldiers.Clear();
        foreach (ShipPutInfo item in Info.m_Soldiers)
        {
            ShipPutInfo newItem = new ShipPutInfo();
            newItem.Copy(item);
            m_Soldiers.Add(newItem);
        }
        m_RoomBuildings.Clear();
        foreach (ShipPutInfo item in Info.m_RoomBuildings)
        {
            ShipPutInfo newItem = new ShipPutInfo();
            newItem.Copy(item);
            m_RoomBuildings.Add(newItem);
        }

        m_StairBuildings.Clear();
        foreach (ShipPutInfo item in Info.m_StairBuildings)
        {
            ShipPutInfo newItem = new ShipPutInfo();
            newItem.Copy(item);
            m_StairBuildings.Add(newItem);
        }

        BlackScienceID = Info.BlackScienceID;
    }
Esempio n. 3
0
    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();
    }
Esempio n. 4
0
    private void SetCombatPower()
    {
        ShipPlan Plan        = ShipPlanDC.GetCurShipPlan();
        int      combatPower = Plan.CombatPower;

        MyHead.LblCombatPower.text = combatPower.ToString();
    }
Esempio n. 5
0
    /// <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;
        }
    }
Esempio n. 6
0
    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);
    }
Esempio n. 7
0
    /// <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;
            }
        }
    }
Esempio n. 8
0
    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));
                }
            }
        }
    }
Esempio n. 9
0
 public void SetData(ShipPlan Plan)
 {
     m_ShipPlan = Plan;
     if (m_ShipPlan != null)
     {
         SetUI();
     }
 }
Esempio n. 10
0
    public void SetCaption(int id)
    {
        m_iCurCaptainID = id;
        CaptionInfo c = BlackScienceDC.GetCaption(id);
        ShipPlan    P = ShipPlanDC.GetCurShipPlan();

        P.BlackScienceID = c.m_id;
        SetBlackScienceUI(c);
    }
Esempio n. 11
0
    /// <summary>
    /// 构建编辑战斗环境
    /// </summary>
    private static void BuildCombatEditScene()
    {
        ShipPlan plan = ShipPlanDC.GetCurShipPlan();

        if (plan != null)
        {
            LoadShipCanvans(plan.ShipDesignId);
        }
        LoadShipBuild();
    }
Esempio n. 12
0
    /// <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));
        }
    }
Esempio n. 13
0
    /// <summary>
    /// 生成甲板
    /// </summary>
    private void GenerateDeck()
    {
        ShipPlan P = ShipPlanDC.GetCurShipPlan();

        if (P == null)
        {
            return;
        }
        P.DoDeckDataStart();
        GenerateShip.CreateMiddleBeam();
        P.DoDeckDataEnd();
    }
Esempio n. 14
0
    /// <summary>
    /// 生成甲板 排除拖动的房间
    /// </summary>
    private void GenerateDeckWithOutThis()
    {
        ShipPlan P = ShipPlanDC.GetCurShipPlan();

        if (P == null)
        {
            return;
        }
        P.DoDeckDataStartWithOut(m_Core.Data);
        GenerateShip.CreateMiddleBeam();
        P.DoDeckDataEnd();
    }
Esempio n. 15
0
 /// <summary>
 /// 设置当前方案
 /// </summary>
 public static void SetCurShipPlan(PlanType Type)
 {
     foreach (ShipPlan Plan  in m_lShipPlan.Values)
     {
         if (Plan.Type == Type)
         {
             m_SelPlan         = Plan;
             m_curShipDesignID = m_SelPlan.ShipDesignId;
             return;
         }
     }
 }
Esempio n. 16
0
    /// <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);
    }
Esempio n. 17
0
    void BtnNO_OnClickEventHandler(UIButton sender)
    {
        ShipPlan P = ShipPlanDC.GetCurShipPlan();

        P.ResetPlan();
        WndManager.DestoryDialog <IsSaveFangAnWnd>();
        ShipCanvasWnd wnd = WndManager.FindDialog <ShipCanvasWnd>();

        if (wnd)
        {
            wnd.DoReturn();
        }
    }
Esempio n. 18
0
    /// <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);
    }
Esempio n. 19
0
 public void RefreshFangAnName(ShipPlan P, string name)
 {
     if (MyHead.LblFangAnName)
     {
         MyHead.LblFangAnName.text = name;
     }
     foreach (FangAnBtnItem item in m_listFangAnBtnItem)
     {
         if (item.m_ShipPlan.ID == P.ID)
         {
             item.SetData(P);
         }
     }
 }
Esempio n. 20
0
    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();
    }
Esempio n. 21
0
    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);
        }
    }
Esempio n. 22
0
 public void CopyPlan(ShipPlan Info)
 {
     ID             = Info.ID;
     Name           = Info.Name;
     Type           = Info.Type;
     BlackScienceID = Info.BlackScienceID;
     //
     m_Canvans.width    = Info.m_Canvans.width;
     m_Canvans.height   = Info.m_Canvans.height;
     m_Canvans.map      = Info.m_Canvans.map;
     m_Canvans.shape    = Info.m_Canvans.shape;
     m_Canvans.shift_cx = Info.m_Canvans.shift_cx;
     m_Canvans.shift_cy = Info.m_Canvans.shift_cy;
     m_shipDesignId     = Info.ShipDesignId;
 }
Esempio n. 23
0
    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, "");
        }
    }
Esempio n. 24
0
    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);
    }
Esempio n. 25
0
    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();
    }
Esempio n. 26
0
    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);
            }
        }
    }
Esempio n. 27
0
    /// <summary>
    /// 510 获取方案摆设数据
    /// </summary>
    public static void Recv_CanvasBuildResponse(object Info)
    {
        if (Info == null)
        {
            return;
        }
        CanvasBuildResponse res = Info as CanvasBuildResponse;

        foreach (CanvasBuildResponse.CanvasBuildInfo item in res.canvasbuild_info)
        {
            if (m_lShipPlan.ContainsKey(item.canvasid) == true)
            {
                ShipPlan P = m_lShipPlan[item.canvasid];
                P.SetPlanShipPut(item);
            }
        }
    }
Esempio n. 28
0
    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>();
        }
    }
Esempio n. 29
0
    /// <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();
    }
Esempio n. 30
0
 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";
         }
     }
 }