コード例 #1
0
    //void OnMenuQuickSwitchPointBrush()
    //{
    //    if (pointMode == EBSBrushMode.Add)
    //        mMenuCtrl.OnBrushItemClick(UIBrushMenuItem.BrushType.pointRemove);
    //    else if (pointMode == EBSBrushMode.Subtract)
    //        mMenuCtrl.OnBrushItemClick(UIBrushMenuItem.BrushType.pointAdd);
    //}

    //void OnMenuQuickSwitchDiagonalBrush()
    //{
    //    if (diagonalRot == 0)
    //        mMenuCtrl.OnBrushItemClick(UIBrushMenuItem.BrushType.diagonalZPos);
    //    else if (diagonalRot == 1)
    //        mMenuCtrl.OnBrushItemClick(UIBrushMenuItem.BrushType.diagonalXNeg);
    //    else if (diagonalRot == 2)
    //        mMenuCtrl.OnBrushItemClick(UIBrushMenuItem.BrushType.diagonalZNeg);
    //    else if (diagonalRot == 3)
    //        mMenuCtrl.OnBrushItemClick(UIBrushMenuItem.BrushType.diagonalXPos);
    //}

    //void OnMenuQuickSwitchBoxBrush()
    //{
    //    if (boxMode == EBSBrushMode.Add)
    //        mMenuCtrl.OnBrushItemClick(UIBrushMenuItem.BrushType.boxRemove);
    //    else if (boxMode == EBSBrushMode.Subtract)
    //        mMenuCtrl.OnBrushItemClick(UIBrushMenuItem.BrushType.boxAdd);
    //}


    #endregion

    #endregion



    #region Save_Wnd_Event

    bool OnSaveIsoClick(string iso_name)
    {
        BSMiscBrush      select_brush = m_CurBrush as BSMiscBrush;
        BSIsoSelectBrush iso_select   = m_CurBrush as BSIsoSelectBrush;

        if (select_brush != null || iso_select != null)
        {
            if (iso_name != "")
            {
                // Icon
                int       width   = PEBuildingMan.Self.IsoCaputure.photoRT.width;
                int       height  = PEBuildingMan.Self.IsoCaputure.photoRT.height;
                Texture2D iconTex = new Texture2D(width, height, TextureFormat.ARGB32, false);

                RenderTexture.active = PEBuildingMan.Self.IsoCaputure.photoRT;

                iconTex.ReadPixels(new Rect(0, 0, width, height), 0, 0);
                iconTex.Apply();

                RenderTexture.active = null;


                BSIsoData iso = null;

                if (select_brush != null && select_brush.SaveToIso(iso_name, iconTex.EncodeToPNG(), out iso))
                {
                    _initIosBlockPage = false;
                    InitIsoBlockPage();
                    if (onSaveIsoClick != null)
                    {
                        onSaveIsoClick();
                    }
                    return(true);
                }
                else if (iso_select != null && iso_select.SaveToIso(iso_name, iconTex.EncodeToPNG(), out iso))
                {
                    _initIosBlockPage = false;
                    InitIsoBlockPage();
                    if (onSaveIsoClick != null)
                    {
                        onSaveIsoClick();
                    }
                    return(true);
                }
                else
                {
                    MessageBox_N.ShowOkBox(PELocalization.GetString(8000494));
                }
            }
            else
            {
                MessageBox_N.ShowOkBox(PELocalization.GetString(8000494));
            }
        }

        return(false);
    }
コード例 #2
0
    void DeleteOnClick()
    {
        BSMiscBrush select_brush = m_CurBrush as BSMiscBrush;

        if (select_brush != null)
        {
            if (!select_brush.IsEmpty())
            {
                select_brush.DeleteVoxel();
            }
        }
        else
        {
            BSIsoSelectBrush iso_select_brush = m_CurBrush as BSIsoSelectBrush;
            if (iso_select_brush != null)
            {
                iso_select_brush.DeleteVoxels();
            }
        }
    }