コード例 #1
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;
        }
    }
コード例 #2
0
    /// <summary>
    /// 加载方案项
    /// </summary>
    private void CreateItems()
    {
        if (MyHead.FangAnTable == null)
        {
            return;
        }
        MyHead.FangAnTable.gameObject.SetActive(false);

        List <ShipPlan> infos = ShipPlanDC.GetAllShipPlan();

        m_listFangAnBtnItem = new List <FangAnBtnItem>(infos.Count);
        foreach (ShipPlan info in infos)
        {
            GameObject go = NDLoad.LoadWndItem("FangAnBtnItem", MyHead.FangAnTable);
            if (go)
            {
                FangAnBtnItem item = go.GetComponent <FangAnBtnItem>();
                if (item)
                {
                    item.SetData(info);
                    m_listFangAnBtnItem.Add(item);
                }
                NGUIUtil.SetItemPanelDepth(go, MyHead.FangAnTable.parent.gameObject);
            }
        }
        NGUIUtil.RepositionTable(MyHead.FangAnTable.gameObject);
    }
コード例 #3
0
ファイル: ShipCanvasWnd.cs プロジェクト: 741645596/batgame
    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();
    }
コード例 #4
0
ファイル: ShipPlan.cs プロジェクト: 741645596/batgame
    /// <summary>
    /// 设置方案画布
    /// </summary>
    public void SetPlanCanvans(canvasedit.ShipCanvasInfo Info)
    {
        if (Info == null)
        {
            return;
        }
        ID             = Info.id;
        Name           = Info.name;
        Type           = (PlanType)Info.type;
        BlackScienceID = Info.bs_id;
        //
        m_Canvans.width    = Info.width;
        m_Canvans.height   = Info.height;
        m_Canvans.map      = Info.map;
        m_Canvans.shape    = Info.shape;
        m_Canvans.shift_cx = Info.shift_cx;
        m_Canvans.shift_cy = Info.shift_cy;
        m_shipDesignId     = Info.designid;
        StaticShipCanvas shipInfo = ShipPlanDC.GetShipDesignInfo(m_shipDesignId);

        if (shipInfo != null)
        {
            m_Canvans.CorrectionShiftError(new Int2(shipInfo.Width, shipInfo.Height));
        }
    }
コード例 #5
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));
                }
            }
        }
    }
コード例 #6
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;
        }
    }
コード例 #7
0
    private void SetCombatPower()
    {
        ShipPlan Plan        = ShipPlanDC.GetCurShipPlan();
        int      combatPower = Plan.CombatPower;

        MyHead.LblCombatPower.text = combatPower.ToString();
    }
コード例 #8
0
ファイル: TreasureScene.cs プロジェクト: 741645596/batgame
    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);
    }
コード例 #9
0
    /// <summary>
    /// 目的区域是否是图形区域内.
    /// </summary>
    /// <returns><c>true</c>, if in shape was built, <c>false</c> otherwise.</returns>
    /// <param name="roomPosGrid">Room position grid.</param>
    public static bool BuildInShape(Int2 roomPosGrid)
    {
        StaticShipCanvas canvas = ShipPlanDC.GetCurShipDesignInfo();

        if (canvas != null)
        {
            string[] ShapeList = canvas.Shape.Split(',');
            //是否在设计图宽高内.
            if (roomPosGrid.Layer >= RoomMap.Mapv2Start.Layer && roomPosGrid.Layer < canvas.Height)
            {
                if (roomPosGrid.Unit >= RoomMap.Mapv2Start.Unit && roomPosGrid.Unit < canvas.Width)
                {
                    //设计图对应的位置是否能摆放
                    if (ShapeList.Length > 0 && ShapeList.Length <= canvas.Height && ShapeList[roomPosGrid.Layer].Length <= canvas.Width)
                    {
                        if (ShapeList[roomPosGrid.Layer][roomPosGrid.Unit] == '0')
                        {
                            return(false);
                        }
                    }

                    return(true);
                }
            }
        }
        return(false);
    }
コード例 #10
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;
            }
        }
    }
コード例 #11
0
ファイル: DataCenter.cs プロジェクト: 741645596/batgame
 /// <summary>
 /// 清理数据中心数据
 /// </summary>
 public static void ClearDC()
 {
     UserDC.ClearDC();
     SoldierDC.ClearDC();
     BuildDC.ClearDC();
     ItemDC.ClearDC();
     BlackScienceDC.ClearDC();
     ShipPlanDC.ClearDC();
 }
コード例 #12
0
ファイル: DataCenter.cs プロジェクト: 741645596/batgame
 /// <summary>
 /// 模拟数据接口。
 /// </summary>
 public static void SimulationData()
 {
     UserDC.SimulationData();
     SoldierDC.SimulationData();
     StageDC.SimulationData();
     BuildDC.SimulationData();
     BlackScienceDC.SimulationData();
     ShipPlanDC.SimulationData();
 }
コード例 #13
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);
    }
コード例 #14
0
    public static void SendGetPlanData()
    {
        ShipPlanDC.SetCurShipPlan(PlanType.Default);

        List <PlanType> l = new List <PlanType>();

        l.Add(PlanType.Default);
        ShipPlanDC.SendCanvasBuildRequest(l);
    }
コード例 #15
0
 public static void ReLoadShipCanvans(int shipDesignID)
 {
     ShipPlanDC.SetShipDesignID(shipDesignID);
     TouchMoveManager.ClearShipBuild();
     ClearCombatScene();
     //		LoadCombatMap();
     LoadShipCanvans(shipDesignID);
     LoadShipBuild();
     GenerateDeck();
 }
コード例 #16
0
    /// <summary>
    /// 构建编辑战斗环境
    /// </summary>
    private static void BuildCombatEditScene()
    {
        ShipPlan plan = ShipPlanDC.GetCurShipPlan();

        if (plan != null)
        {
            LoadShipCanvans(plan.ShipDesignId);
        }
        LoadShipBuild();
    }
コード例 #17
0
    public static string [] GetDesignShape(int shipDesignID)
    {
        StaticShipCanvas canvas = ShipPlanDC.GetShipDesignInfo(shipDesignID);

        if (canvas != null)
        {
            return(canvas.Shape.Split(','));
        }
        return(null);
    }
コード例 #18
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));
        }
    }
コード例 #19
0
    public static bool CheckIsDeckGrid(Int2 GridPos)
    {
        StaticShipCanvas canvas = ShipPlanDC.GetCurShipDesignInfo();

        if (canvas != null)
        {
            string[] l = canvas.Shape.Split(',');
            return(CheckIsDeckGrid(l, GridPos.Layer, GridPos.Unit));
        }
        return(false);
    }
コード例 #20
0
    /// <summary>
    /// 生成甲板 排除拖动的房间
    /// </summary>
    private void GenerateDeckWithOutThis()
    {
        ShipPlan P = ShipPlanDC.GetCurShipPlan();

        if (P == null)
        {
            return;
        }
        P.DoDeckDataStartWithOut(m_Core.Data);
        GenerateShip.CreateMiddleBeam();
        P.DoDeckDataEnd();
    }
コード例 #21
0
    /// <summary>
    /// 生成甲板
    /// </summary>
    private void GenerateDeck()
    {
        ShipPlan P = ShipPlanDC.GetCurShipPlan();

        if (P == null)
        {
            return;
        }
        P.DoDeckDataStart();
        GenerateShip.CreateMiddleBeam();
        P.DoDeckDataEnd();
    }
コード例 #22
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);
    }
コード例 #23
0
    /// <summary>
    /// 获取当前方案最大的格子数.
    /// </summary>
    /// <returns>The end position by shape.</returns>
    /// <param name="ShipCanvasTypeId">Ship canvas type identifier.</param>
    public static Int2 GetEndPosByShape(int shipDesignID)
    {
        StaticShipCanvas canvas = ShipPlanDC.GetShipDesignInfo(shipDesignID);

        if (canvas != null)
        {
            Int2 endPos = new Int2();
            endPos.Layer = canvas.Height;
            endPos.Unit  = canvas.Width;
            return(endPos);
        }
        return(RoomMap.RealMapSize);
    }
コード例 #24
0
ファイル: BuildInfo.cs プロジェクト: 741645596/batgame
    /// <summary>
    /// 判断能否被分解
    /// </summary>
    public bool CheckSplit()
    {
        List <ShipPlan> l = ShipPlanDC.GetAllShipPlan();

        foreach (ShipPlan plan in l)
        {
            if (plan.CheckHaveTrap(ID) == true)
            {
                return(false);
            }
        }
        return(true);
    }
コード例 #25
0
    void BtnNO_OnClickEventHandler(UIButton sender)
    {
        ShipPlan P = ShipPlanDC.GetCurShipPlan();

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

        if (wnd)
        {
            wnd.DoReturn();
        }
    }
コード例 #26
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);
    }
コード例 #27
0
ファイル: ShipCanvasWnd.cs プロジェクト: 741645596/batgame
    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();
    }
コード例 #28
0
ファイル: ViewStageWnd.cs プロジェクト: 741645596/batgame
    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);
        }
    }
コード例 #29
0
ファイル: ShipCanvasWnd.cs プロジェクト: 741645596/batgame
    /// <summary>
    /// 下一步 生成船只
    /// </summary>
    /// <param name="sender"></param>
    public void BtnNext_OnClickEventHandler(UIButton sender)
    {
        if (!PutCanvasM.CheckSave())
        {
            return;
        }

        if (Input.touchCount > 1 || PutCanvasM.CanOperate == false)   //有其他操作时不得保存
        {
            return;
        }
        // 客户端直接保存。
        ShipPlanDC.SaveCanvansInfo();
        SaveSuccecd();
    }
コード例 #30
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, "");
        }
    }