Esempio n. 1
0
        protected override void OnEditorExist()
        {
            base.OnEditorExist();

            m_editor = IOC.Resolve <IRTE>();

            m_handlesRoot = new GameObject("Handles").transform;
            m_handlesRoot.SetParent(transform, false);

            m_terrainHandlesSelection = IOC.Resolve <ICustomSelectionComponent>();

            IOC.RegisterFallback <ITerrainSelectionHandlesTool>(this);

            OnEditorSelectionChanged(null);
            m_editor.Selection.SelectionChanged += OnEditorSelectionChanged;
        }
Esempio n. 2
0
        private void Awake()
        {
            m_editor = IOC.Resolve <IRuntimeEditor>();

            m_commandsList.ItemClick       += OnItemClick;
            m_commandsList.ItemDataBinding += OnItemDataBinding;
            m_commandsList.ItemExpanding   += OnItemExpanding;
            m_commandsList.ItemBeginDrag   += OnItemBeginDrag;
            m_commandsList.ItemDrop        += OnItemDrop;
            m_commandsList.ItemDragEnter   += OnItemDragEnter;
            m_commandsList.ItemDragExit    += OnItemDragExit;
            m_commandsList.ItemEndDrag     += OnItemEndDrag;

            m_commandsList.CanEdit        = false;
            m_commandsList.CanReorder     = false;
            m_commandsList.CanReparent    = false;
            m_commandsList.CanSelectAll   = false;
            m_commandsList.CanUnselectAll = true;
            m_commandsList.CanRemove      = false;

            m_localization    = IOC.Resolve <ILocalization>();
            m_terrainTool     = IOC.Resolve <ITerrainSelectionHandlesTool>();
            m_customSelection = IOC.Resolve <ICustomSelectionComponent>();
            m_customSelection.Selection.SelectionChanged += OnTerrainToolSelectionChanged;

            if (m_xSpacingEditor != null)
            {
                m_xSpacingEditor.Min = 5;
                m_xSpacingEditor.Max = 40;
                m_xSpacingEditor.Init(m_terrainTool, m_terrainTool, Strong.PropertyInfo((ITerrainSelectionHandlesTool x) => x.XSpacing), null, m_localization.GetString("ID_RTTerrain_SelectionHandles_XSpacing", "X Space"), null, null, () => m_terrainTool.Refresh(), false);
            }

            if (m_zSpacingEditor != null)
            {
                m_zSpacingEditor.Min = 5;
                m_zSpacingEditor.Max = 40;
                m_zSpacingEditor.Init(m_terrainTool, m_terrainTool, Strong.PropertyInfo((ITerrainSelectionHandlesTool x) => x.ZSpacing), null, m_localization.GetString("ID_RTTerrain_SelectionHandles_ZSpacing", "Z Space"), null, null, () => m_terrainTool.Refresh(), false);
            }

            if (m_zTestEditor != null)
            {
                m_zTestEditor.Init(m_terrainTool, m_terrainTool, Strong.PropertyInfo((ITerrainSelectionHandlesTool x) => x.EnableZTest), null, m_localization.GetString("ID_RTTerrain_SelectionHandles_ZTest", "Z Test"));
            }
        }
Esempio n. 3
0
        private void Awake()
        {
            m_terrainEditor = GetComponentInParent <TerrainEditor>();

            m_localization = IOC.Resolve <ILocalization>();
            m_editor       = IOC.Resolve <IRTE>();
            m_editor.Selection.SelectionChanged += OnEditorSelectionChanged;
            m_customSelection = IOC.Resolve <ICustomSelectionComponent>();

            m_terrainCutoutRenderer = IOC.Resolve <ITerrainCutoutMaskRenderer>();
            m_terrainCutoutRenderer.ObjectImageLayer = m_editor.CameraLayerSettings.ResourcePreviewLayer;

            m_source = FindObjectOfType <TerrainBrushSource>();
            if (m_source == null)
            {
                m_source = new GameObject("TerrainBrushSource").AddComponent <TerrainBrushSource>();
            }

            if (m_brushesList != null)
            {
                m_brushesList.SelectionChanged += OnBrushesSelectionChanged;
                m_brushesList.ItemDataBinding  += OnBrushesDataBinding;
                m_brushesList.CanDrag           = false;
                m_brushesList.CanEdit           = false;
                m_brushesList.CanRemove         = false;
                m_brushesList.CanReorder        = false;
                m_brushesList.CanReparent       = false;
                m_brushesList.CanSelectAll      = false;
                m_brushesList.CanUnselectAll    = false;
            }

            if (m_brushSizeEditor != null)
            {
                //BrushSize = 2.5f;
                RaiseBrushParamsChanged();

                m_brushSizeEditor.Min = 0.5f;
                m_brushSizeEditor.Max = 40;
                m_brushSizeEditor.Init(this, this, Strong.MemberInfo((TerrainBrushEditor x) => x.BrushSize), null, m_localization.GetString("ID_RTTerrain_TerrainBrushEditor_BrushSize", "Brush Size"), null, null, null, false);
            }

            if (m_opacityEditor != null)
            {
                //BrushOpacity = 100;
                RaiseBrushParamsChanged();

                m_opacityEditor.Min = 0;
                m_opacityEditor.Max = 100;
                m_opacityEditor.Init(this, this, Strong.MemberInfo((TerrainBrushEditor x) => x.BrushOpacity), null, m_localization.GetString("ID_RTTerrain_TerrainBrushEditor_BrushOpacity", "Brush Opacity"), null, null, null, false);
            }

            if (m_beginCreateButton != null)
            {
                m_beginCreateButton.onClick.AddListener(BeginCreateButtonClick);
            }

            if (m_addButton != null)
            {
                m_addButton.onClick.AddListener(OnAddButtonClick);
            }

            if (m_deleteButton != null)
            {
                m_deleteButton.onClick.AddListener(OnDeleteButtonClick);
            }
        }